WOLFRAM SYSTEM MODELER

RPiInteraction

Demonstrates the interaction with an OPC UA server on a Raspberry Pi

Diagram

Wolfram Language

In[1]:=
SystemModel["OPCUA.Examples.RPiInteraction"]
Out[1]:=

Information

This example shows the principles of how to use the OPCUA Library to read and write data to a Raspberry Pi.

By using a OPCUA.Components.Unclocked.RealSignals.Read, named in this example readCPUTemp, you can read the temperature of the CPU of the Raspberry Pi. This can be done if the OPC UA server has implemented the neccessary features, as the ExampleServer from open62541 has done. See Getting Started on how to set up such a server.

Using another component OPCUA.Components.Clocked.BooleanSignals.Write, named writeLEDStatus, in combination with a Modelica.Clocked.BooleanSignals.TickBasedSources.Pulse, you can turn the OK LED on the Raspberry Pi on and off. You can read the status of the LED by using a OPCUA.Components.Unclocked.BooleanSignals.Read component, reading the value of the node being written to.

Parameters (1)

errorHandling

Value: Types.ErrorHandling.ErrorWhenUncertain

Type: ErrorHandling

Description: How to handle node errors (request errors are handled by the connected Read/WriteNodeList component)

Components (7)

raspberrypi

Type: Client

Description: Client for connecting to an OPC UA server

readCPUTemp

Type: Read

Description: Adds reading of a Real scalar node to a ReadNodeList

readLEDStatus

Type: Read

Description: Adds reading of a Boolean scalar node to a ReadNodeList

writeLEDStatus

Type: Write

Description: Adds writing of a Boolean scalar node to a WriteNodeList

pulse

Type: Pulse

Description: Generate pulse signal of type Boolean

writeClock

Type: PeriodicExactClock

Description: Generate a periodic clock signal with a period defined by an Integer number with resolution

shiftSample

Type: ShiftSample

Description: Shift the input clock by a fraction of the last interval and provide it as output clock