This guide takes the open source project, meatforge and makes its variables available to a SparkplugB SCADA/IIoT Host Node.
If you don’t have a SparkplugB test system up and running, you can use our lightweight Primary Host Node which is demonstrated in our [Preview how-to] or
Right click application and Add Object > POU. Call it Sparkplug, Type: Program, Language: ST.
Open the new POU and add an EoN : SparkplugB.FB_Edge_Of_Network_Node;
Click the first line of the implementation part of this POU and press F2 to bring up the Input Assistant. Categories > Instance Calls > EoN > Tick “Insert with arguments” > OK
You should now have this view:
Fill in your server connection settings, eg:
Now there are only a few variables in this project. We need to create a SparkplugB.FB_SimpleValue for each of them, but in an array. Note that each datatype has its own array, and the nature of VAR_IN_OUT means that each array is required.
PRG_PWM.rDuty: REAL;
PRG_REGULATOR.rTempSet: REAL;
SPI_Temperature.rValue : REAL;
xOut: BOOL;
a. Declare the necessary arrays. Unused array can be declared with 0 elements =p
b. Add the new arrays to the EoN call.
c. Write the names and copy the values in code:
d. Add a new task for this new POU, or use an existing one.
Testing
Now run it and see if you get the values into your Sparkplug B SCADA / IIoT Host Node