Overview
As with all adapters, an existing Logic Simulator is required.
Where to find the different Gateway Adapters
Where to find
To find the OPC UA adapter, go to the Inspector window of a https://unit040.atlassian.net/wiki/spaces/PUD/pages/280987237/Logic+Simulator#Overview component.
This https://unit040.atlassian.net/wiki/spaces/PUD/pages/280987237/Logic+Simulator#Overview can be added under Logic.
Feature overview
Only the settings between the lines refer to the OPC UA Adapter.
Please check the documentation for the rest of the https://unit040.atlassian.net/wiki/spaces/PUD/pages/280987237/Logic+Simulator#Overview
Gateway settings | |
---|---|
Adapter Target | Select a different adapter, please see prespective documentation for more information |
Adapter Setting (OPCUAServerSettings) | |
XmlFilePath | File path to the policy file Warning : <Make sure to fill in a relative path to the Asset folder of the project and include .xml file extension> |
endPointURL | The endpoint of the server |
configurationFilePath | Configuration path for the configuration XML (default is sample case, please use your own) |
namespaceIndex | the namespace index for opc ua |
IdentifierTypeOpc | The identifier type for this configuration For more information: http://documentation.unified-automation.com/uasdkhp/1.0.0/html/_l2_ua_node_ids.html |
UserName | Is passed to the server for authentication if the field is not empty (not used by default) |
PassWord | Is passed to the server for authentication when the UserName field is not empty (not used by default) |
Fidelity:
In order to get opc variables in real-time the fidelity of the signal definition has to be set to 0.
To use a subscription set the fidelity to the number of seconds for the interval.
Default fidelity is -1 this is counted as 1.
Right now we do not offer support for certificate accepting within Unity. A quick workaround is to connect to the server via Ua Expert and accept the certificate there. Then it should also work in prespective.
https://www.unified-automation.com/products/development-tools/uaexpert.html
Opc ua variable naming
For the naming of opc ua variables we have to create the NodeId.
https://documentation.unified-automation.com/uasdkhp/1.0.0/html/_l2_ua_node_ids.html
Example NodeId:
ns=4;i=1241
for this example, you have to configure your PreLogic Simulator as follows:
And your PrelogicComponent:
(Example Script)
public class OPCTestComponent : PreLogicComponent { public override List<SignalDefinition> SignalDefinitions => new List<SignalDefinition> { new SignalDefinition("1241", PLCSignalDirection.INPUT, SupportedSignalType.BOOL), }; }
Another example NodeId (Tia Portal):
ns=3;s="OPC_UA_DB"."TestBOOLINPUT0"
for this example, you have to configure your PreLogic Simulator as follows:
And your Prelogic component:
(Example Script)
public class OPCTestComponent : PreLogicComponent { public override List<SignalDefinition> SignalDefinitions => new List<SignalDefinition> { new SignalDefinition("TestBOOLINPUT0", PLCSignalDirection.INPUT, SupportedSignalType.BOOL), }; }