WOLFRAM SYSTEM MODELER

Fallback

Demonstrates how to switch to a fallback value after a period of Uncertain or Bad status severity

Diagram

Wolfram Language

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

Information

This example demonstrates how to switch to a fallback value after a period of Uncertain or Bad status severity.

This example requires an OPC UA example server running on localhost. Read about how to start the example server here.

For all types that can be read by the library, there is a corresponding SetIfGood component (see, for example, the one for a scalar Real) that can be used to propagate the value and its corresponding timestamp, only in the case when severity is UAStatusSeverity.Good. In this example, that is used in combination with a ElapsedTimeSince to measure the age of the last known value with status severity UAStatusSeverity.Good. When that age exceeds the specified threshold of 2 s, the model switches to a fallback value.

The purpose of the startStatusSimulation is to start a simulation on the example server that changes the status and value of certain nodes.

Components (10)

startStatusSimulation

Type: StartStatusSimulation

Description: Block that starts a status simulation on the ExampleServer

client

Type: Client

Description: Client for connecting to an OPC UA server

readClock

Type: PeriodicExactClock

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

readReal

Type: Read

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

setIfGood

Type: SetIfGood

Description: Set the output to the input if severity == Good

elapsedTimeSince

Type: ElapsedTimeSince

Description: Output y is the elapsed time in seconds since the input timestamp u

fallbackValue

Type: Constant

Description: Generate constant signal of type Real

greaterThreshold

Type: GreaterThreshold

Description: Output y is true, if input u is greater than threshold

switch

Type: Switch

Description: Switch between two Real signals

severityEquals

Type: SeverityEquals

Description: Output y is true if input u is equal to severity