WOLFRAM SYSTEM MODELER
ReadAndWriteBasic example that demonstrates how to write to and read from nodes on an OPC UA server |
SystemModel["OPCUA.Examples.ReadAndWrite"]
This example shows the principles of how to use the OPCUA Library to connect to an OPC UA server for data acquisition.
This example requires an OPC UA example server running on localhost. Read about how to start the example server here.
Components writeReal, writeInteger, and writeBoolean are blocks for writing data of their respective types to items on an OPC UA server. The input to a block is the signal that is to be sampled and written to the server, in this case a cosine wave, a real-to-integer converted sine wave, and a Boolean pulse signal.
Components readReal, readInteger, and readBoolean are blocks for reading data of their respective types from the server. The data is stored on nodes on the server, which is accessed by specifying the nodeID, nodeIDType, and nodeNamespace.
Plot of the signals of type Real that are written to and read from the OPC UA server.
Plot of the signals of type Integer that are written to and read from the OPC UA server.
Plot of the signals of type Boolean that are written to and read from the OPC UA server.
opcServer |
Type: OPCUAServer Description: A model used for setting up server parameters |
|
---|---|---|
readReal |
Type: Read Description: A block for reading data from items on an OPC server at intervals determined by parameter samplePeriod |
|
readBoolean |
Type: Read Description: A block for reading data from an item on an OPC server at intervals determined by parameter samplePeriod |
|
writeBoolean |
Type: Write Description: A block for writing data to items on an OPC server at intervals determined by parameter samplePeriod |
|
writeReal |
Type: Write Description: A block for writing data to an item on an OPC server at intervals determined by parameter samplePeriod |
|
cosine |
Type: Cosine Description: Generate cosine signal |
|
writeInteger |
Type: Write Description: A block for writing data to items on an OPC server at intervals determined by parameter samplePeriod |
|
booleanPulse |
Type: BooleanPulse Description: Generate pulse signal of type Boolean |
|
realToInteger |
Type: RealToInteger Description: Convert Real to Integer signal |
|
readInteger |
Type: Read Description: A block for reading data from an OPC server at intervals determined by parameter samplePeriod |