Read data from OPC server
The OPC Read block reads data from one or more items on an OPC server. The read operation takes place synchronously (from the cache or from the device) or asynchronously (from the device).
The block outputs the values (
V) of the requested items in the first
output, and optionally outputs the quality IDs (
Q) and the time stamps
T) associated with each data value in additional outputs. The time
stamp may be output as a serial date number (real-world time), or as the number of seconds
from the start of the simulation (simulation time).
The V,Q,T triple available at the output ports is the last known data for each of the items read by the block. Use the time stamp output to determine when a sample last changed.
You must have an OPC Configuration block in your model to use the OPC Read block. You cannot open the OPC Read dialog without first including an OPC Configuration block in the model.
Allows you to import settings for the OPC Read block from a
dagroup object in the base workspace. The client, item IDs, and
sample time are updated based on the properties of the imported group. The
Value port data type is also set if all items in the group have
Defines the OPC client associated with this block. You can add additional clients to the list using Configure OPC Clients. For more information, see Use the OPC Client Manager.
Shows the items to be read from the specified server. You can add items to the list using Add Items, or delete items using Delete. You can reorder the items in the list using Move Up or Move Down. The order of the items determines the order of their values in the block outputs.
Defines the read mode for this block. Available options are
Synchronous (cache), or
Synchronous (device). Synchronous reads have slightly more
overhead than asynchronous reads, but they are generally more reliable than
Defines the sample time for the block. For synchronous reads, data is read from the server at the specified sample time. For asynchronous reads, the sample time setting defines the update rate for data change events.
Defines the data type for the value output. The OPC server is responsible for converting all data to the required type.
For items with a Canonical Data Type of
logical, the OPC Read
-1 for signed data types, or the maximum value for
unsigned data types, when the item value is "true". A value of
is output when the item value is "false".
When checked, the quality IDs of all the items are output in the second port as a vector of unsigned 16-bit integers. Use the OPC Quality Parts block to separate the quality ID into component parts.
When checked, the timestamps for each of the items are output in the last port as a vector of doubles. You choose whether to output the timestamps as Seconds since start (i.e., simulation time) or as Serial date numbers (i.e., real-world time).