OPC Configuration

Configure OPC clients to use in model, pseudo real-time control options, and behavior in response to OPC errors and events

Library

OPC Toolbox

Description

The OPC Configuration block defines the OPC clients to be used in a model, configures pseudo real-time behavior for the model, and defines behavior for OPC errors and events.

The block has no input ports. One optional output port displays the model latency (time spent waiting in each simulation step to achieve pseudo real-time behavior).

You cannot place more than one OPC Configuration block in a model. If you attempt to do so, an error message appears, and the second OPC Configuration block becomes disabled.

Dialog Box

Configure OPC Clients

Opens the OPC Client Manager for this model. Each model has a list of clients associated with it. These clients are used during the simulation to read or write data to an OPC server. See Use the OPC Client Manager for more information.

Error control

Defines actions that Simulink® software must take when OPC-specific errors and events are encountered. The available actions are to produce an error and stop the simulation, produce a warning and continue the simulation, or ignore the error or event. The following table describes each error or event.

Error/Event

Description

Default

Items not available on server

Defines the behavior for items that are specified in a Read or Write block but do not exist on the server when the simulation starts.

error

Read/write errors

Defines the behavior when a read or write operation fails.

warn

Server unavailable

Defines the behavior when the client cannot connect to the OPC server, or when the server sends a shutdown event to the client.

error

Pseudo real-time violation

Defines the behavior when the simulation runs slower than real time. See the Pseudo real-time simulation options for more information.

warn

Pseudo real-time simulation

Allows you to configure options for running the simulation in pseudo real time. When Enable pseudo real-time simulation is checked, the model execution time matches the system clock as closely as possible by slowing down the simulation appropriately. The Speedup setting determines how many times faster than the system clock the simulation runs. For example, a setting of 2 means that a 10-second simulation will take 5 seconds to complete. The Speedup parameter must be a literal integer; you cannot use a MATLAB or Simulink model workspace variable to define the speedup factor.

Note that the real-time control settings do not guarantee real-time behavior. If the model runs slower than real time, a pseudo real-time latency violation error occurs. You can control how Simulink responds to a pseudo real-time latency violation using the settings in the Error control pane. You can also output the model latency using the Show pseudo real-time latency port setting.

Show pseudo real-time latency port

When checked, the pseudo real-time latency (in seconds) is output from the block. Pseudo real-time latency is the time spent waiting for the system clock during each step. If this value is negative, the simulation runs slower than real time, and the behavior defined in the Pseudo real-time violation setting determines the action that Simulink takes.

Was this topic helpful?