WOLFRAM SYSTEM MODELER

ReadAndWrite

Basic example that demonstrates how to write to and read from items on an OPC server

Diagram

Wolfram Language

In[1]:=
SystemModel["OPCClassic.Examples.ReadAndWrite"]
Out[1]:=

Information

This example shows the principles of how to use the OPC Classic Library to connect to an OPC server for data acquisition.

Components writeReal, writeInteger, and writeBoolean are blocks for writing data of their respective type to items on an OPC server. In this example, the server is Matrikon.OPC.Simulation.1, which is a Matrikon OPC server for simulation and testing. The input to a block is the signal that is to be sampled and written to the server, in this case a sine wave, a real-to-integer converted sine wave, and a Boolean pulse signal. In this example, all blocks write to and read from bucket brigade items of different types.

Components readReal, readInteger, and readBoolean are blocks for reading data of their respective types from the server. Since the read and write blocks for each specific type both connect to the same item, the read blocks sample the same signal that is written to the server.

This is a model that shows the principles of reading and writing data from an OPC server with the OPCClassic

Plot of the signals of type Real that are written to and read from the MatrikonOPC Server.


This is a model that shows the principles of reading and writing data from an OPC server with the OPCClassic

Plot of the signals of type Integer that are written to and read from the MatrikonOPC Server.


This is a model that shows the principles of reading and writing data from an OPC server with the OPCClassic

Plot of the signals of type Boolean that are written to and read from the MatrikonOPC Server.

Components (10)

sine

Type: Sine

Description: Generate sine signal

booleanPulse

Type: BooleanPulse

Description: Generate pulse signal of type Boolean

realToInteger

Type: RealToInteger

Description: Convert Real to Integer signal

opcServer

Type: OPCServer

Description: A model used for setting up server parameters (name of host and server)

readReal

Type: Read

Description: A block for reading data from items on an OPC server at intervals determined by parameter samplePeriod

readInteger

Type: Read

Description: A block for reading data from 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

writeReal

Type: Write

Description: A block for writing data to 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

writeInteger

Type: Write

Description: A block for writing data to items on an OPC server at intervals determined by parameter samplePeriod