Skip to content

Link OpcUA variable to c++ port

I am trying to archive something similar to what is done here (CppExamples/Examples/OpcPlcManager at master · PLCnext/CppExamples), however instead of opcua method, I have a variable.

How can I link a opc ua variable defined in the nodeset xml to a port defined in the c++? Is there any extension similar to

      <Extension>

                <MethodTarget xmlns="http://phoenixcontact.com/OpcUA/2019/NodeSetExtensions.xsd" FunctionBlock="OpcPlcManagerComponent1/GetPlcState"/>

      </Extension>

that could be used for variables?

Comments

  • There is information about this in this section (and in the two following sections) of the PLCnext Technology Info Center:


    The section on integrating a model - using the PA-DIM model as an example - has examples of connecting GDS ports (which must be declared with the "OPC" attribute) to nodes in a Nodeset file.

  • edited December 2024

    Thanks! That seems to be working when I try to link it to a Arp.Plc.Eclr program, however the linking is not successfull when I try to do the same on a C++ component. What would be the right syntax? I am trying to link a bool variable

    I have tried:

                <Extension>

                    <AttributeSource xmlns="http://phoenixcontact.com/OpcUA/2019/NodeSetExtensions.xsd" GdsValueAttribute="OpcPlcManagerComponent1/Start.UA_Value "/>

                </Extension>

           <AttributeSource xmlns="http://phoenixcontact.com/OpcUA/2019/NodeSetExtensions.xsd" GdsValueAttribute="OpcPlcManagerComponent1/Start"/>

          </Extension>



      struct START

      {

        //#attributes(Input|Opc)

        Arp::boolean UA_Value = false;

      };


      //#port

      START Start;

  • The Nodeset file maps to existing OPC UA nodes, including component ports that are marked with the "Opc" attribute. Those component ports should be visible in UaExpert even before they're mapped in the NodeSet file. You can see the NodeId of those Component Ports in the Attributes frame in UaExpert, after you select the Component Port in the Address Space frame.

Sign In or Register to comment.