Field variables
To reference field variables (controller tags or variables of an OPC UA server),
FactoryTalk Optix Studio
uses special project variables (tags) that report the value of the field variables.
TIP:
When a tag variable is read,
FactoryTalk Optix Studio
reads the field variable and updates the value of the project variable. When a tag variable is written, FactoryTalk Optix Studio
propagates the write on the field variable.Read/write field variables in FactoryTalk Optix Studio and in C#
FactoryTalk Optix Studio
and in C#Field variable reading/writing occurs automatically when a tag variable is read/written in
FactoryTalk Optix Studio
. To reproduce the same behavior in C#, you need to use specific APIs in these cases:
- Reading/writing tag variables synchronized with corresponding controller tags.
- Reading/writing important variables with an OPC UA Client object from a OPC UA server to synchronize them with the OPC UA server corresponding variables.
- Reading/writing a variable directly or indirectly connected (using dynamic links or converters) to a variable described in previous cases.
IMPORTANT:
When a tag variable is read using the
Get
method, FactoryTalk Optix Studio
does not read the value on the field and can return a value that has not been updated.Value change events - considerations
- To subscribe methods to the change value event of the field variables, use aRemoteVariableSynchronizerobject. TheRemoteVariableSynchronizerobject updates the project variables referring to field, without repeating readings through simple API reading.
- TheRemoteVariableSynchronizerobject is not required if a link to a tag variable from a graphical object, data logger object, alarm or recipe schema object already exists inFactoryTalk Optix Studio. In a NetLogic, you can subscribe the change value method directly to the linked tag variable.
- Management of communication delays with the field. If a field variable is read/written in NetLogic, execute the instructions, and ensure that the current value is read or written .The APIs for reading/writing field variables are synchronous. Their execution must terminate before the next instruction can be ran.
Provide Feedback