Field variables

To reference field variables (controller tags or variables of an OPC UA server), use 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#

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 must 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 an 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

  • To subscribe methods to the change value event of the field variables, use a
    RemoteVariableSynchronizer
    object. The
    RemoteVariableSynchronizer
    object updates the project variables referring to the field, without repeating readings through simple API reading.
  • The
    RemoteVariableSynchronizer
    object is not required if a link to a tag variable from a graphical object, data logger object, alarm or recipe schema object exists in
    FactoryTalk 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 verify that the current value is read or written. The APIs for reading/writing field variables are synchronous. Their execution must end before the next instruction can be ran.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.