Communication driver¶
Introduction
In UNIQO, communication with the PLCs can be configured for two purposes:
at design time, establish a communication channel to import the PLC tags into the project, which are useful for designing the desired application logics (for example, activating an alarm when the value of a tag exceeds a certain value).
at runtime, keep the values and data types of the imported variables synchronized with those of the PLC tags.
Objects to configure the communication
To configure the communication between UNIQO and a PLC, two specific objects must be used:
a Communication driver object that represents the communication protocol
a Communication station object inside the related driver that represents the PLC, and in which to set the communication parameters.
For each protocol, as many Communication stations as there are physical PLCs that use the same protocol in your application can be configured
Supported communication drivers
The drivers supported are those available in the Communication drivers folder in the Types panel.
To communicate with PLCs that support custom protocols on a serial interface, through the Serial port object, it is possible to configure a custom protocol (see Serial port and Serial Port APIs).
Importing tags
To exploit the PLC tags in their application logics, these tags must be represented in UNIQO. UNIQO can import tags in offline mode, i.e. by loading a file exported from the PLC, or in online mode, i.e. with connection to the PLC on the network, for the protocols which support it.
Depending on the communication protocol, the Station communication object can contain a TagImporter object to import tags in online or offline mode.
For each tag imported from the PLC, UNIQO creates a corresponding Tag project variable. For example, a Codesys PLC tag is represented by a CODESYS Tag variable. The values and data types of Tag variables remain synchronized with the values of the tags on the PLC at runtime, in read mode and in write mode.
Note
when the PLC tag data type does not match an OPC UA standard data type, UNIQO sets the most relevant OPC UA data type for the variable.
For more advanced uses, the dedicated APIs can be exploited through NetLogic (see API for reading/writing of field variables), for example to read/write tags at runtime.
Synchronization of tags at runtime
At runtime, UNIQO synchronizes the tags at regular intervals based on the value of the Polling time for dynamic variables property of the Presentation engine (see Presentation engine).
To optimize the operations of reading/writing of tags, UNIQO synchronizes primarily the tags displayed/written through the active graphical objects (for example a circular Indicator in a window in the foreground).
Codes of the read/write operation on the PLC
For each operation of reading/writing of one or more tags, the PLC generates an operation code that describes its result.
Code |
Description |
---|---|
Good |
Reading/writing succeeded |
BadNoCommunication |
Read/write failed for timeout, e.g. connection timeout. Note the timeout value is that set in the Timeout property of the Communication stations. |
BadCommunicationError |
Read/write failed as the PLC returned an error |
BadConfigurationError |
Read/write failed for tag configuration error (e.g. invalid address) |
See also
Related procedures
References