Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

co⚡e: Sparkplug™ MQTT edge and host:

zeke
2022-02-03
2024-02-21
  • zeke - 2022-02-03

    Hi, For some reasson the MQTT_Client_SL is not getting resolved in the library. I tried setting the placeholder but the issue isstill the same. Could you please point me in the right direction?


    Talk Topic about project #cobolt

     
  • i-campbell

    i-campbell - 2022-02-03

    Hi, you will need to download and install the package "IIoT Libraries SL", either from the CODESYS Installer, or the store

     
    👍
    1
  • zeke - 2022-02-07

    Hi, I am trying to install the sparkplugB into one of my projects and for some reason I am not able to see any images you have posted. Do you have another link I could see the images? If I try to open the image in a new tab it says read access is required.

    Kind Regards

     
  • i-campbell

    i-campbell - 2022-02-07

    strange, can you share that link? this one already works for me, even when logged out:
    https://forge.codesys.com/lib/cobolt/home/Add%20SparkplugB%20to%20existing%20CODESYS%20project/#

     
    👍
    1
    • i-campbell

      i-campbell - 2022-02-07

      I think I found it and removed it. We recently moved from /prj/mqttsparkplugb/ to /lib/cobolt/ due to Sparkplug™ being a trademarked term. Some of the old content, while not linked to, is still accessible.

       
      👍
      1
  • zeke - 2022-02-08

    Hi, The SparkplugB MQTT Topic and Payload Definition doesnt exist in the library. Is it called something different now? I Tried using the FB.Metric funtion block from your example but not able to add the variables I defined under EoN call as it is not part of EoN.
    As per the metric function block it says to define name, datatype and value and datatype is not part of metric function block.
    I do have IIoT Libraries SL 1.5.0.0 installed.

     
    • i-campbell

      i-campbell - 2022-02-09

      Hi, you are right the tutorial is outdated.
      Attached is a screenshot with the new library names.
      We are not allowed to call the library Sparkplug so we had to change the name. I have created a ticket #156, that the tutorials be gone through and corrected.
      Thanks for reporting it!

       
      👍
      2
      • zeke - 2022-02-18

        Hi, When I update values on scada, I do see the message coming up in the FB_Edge Function block.

        "IF _MQTT.NCMDMessageReceived() THEN
        _RecvNCMDMesg REF= _MQTT.GetNCMDMessage(MessageTopic => _RecvNCMDTopic);
        // only updates the received NCMD metric
        onNCMDMessage(pTopic := ADR(_RecvNCMDTopic), pMessage := _RecvNCMDMesg);
        END_IF"

        But I am not able to figure where this data is going so that the value on my scada gets updated.

        I am not using the primaryhost to connect to Ignition. If I update value in PLC it updates in SCADA. If I update value in Scada it doesn't update on scada but sends the value to the PLC. I talked to cirius link, they said the value on scada will still be updated only when coming from the edge device(PLC).

        I went over the example but not be to find where it is being sent again to Ignition (Scada)

        Could you please point me in the right direction?

         
        • i-campbell

          i-campbell - 2022-02-19

          Hi zeke,
          Great to hear you have it setup and talking to Ignition. At the step in that document which is called "Write the names and copy the values in code:" it gets you to copy the values from your program variables to the Sparkplug metric values. What's missing is anything to copy the metric values back to the program variables.

          Option 1:
          Copy to the metrics, call EoN(), Copy from the metric values.

          Metric_rDuty.Float := PRG_PWM.rDuty;
          // and other metrics
          
          EoN(//all the inputs of EoN
             );
          
          PRG_PWM.rDuty := Metric_rDuty.Float;
          // and other metrics
          

          Option 2:
          Just use the metric values directly in you code. So do a search and replace for PRG_PWM.rDuty, and replace with Metric_rDuty.Float.

          If you want to document the steps you have taken, we would love the contribution to the documentation.

           
  • hermsen

    hermsen - 2022-02-08

    It seems like you use an outdated version of the library. Please download all libraries and the example from the SparkplugB Home under downloads.

    If you have downloaded and installed all 4 libs you can open the example which is also provided under downloads.

     
    👍
    1

    Last edit: hermsen 2022-02-08
  • zeke - 2022-02-17
     

    Last edit: zeke 2022-02-18

Log in to post a comment.