OPC Commands

Thomas Hadlich
OPC Commands Working Group

Why OPC Commands?

OPC technology has been widely applied and is very successful as a means of providing automation infrastructure and software interfaces. Available OPC standards cover different aspects of data management. The most successful OPC specification defines how to access data (OPC Data Access). Other specifications include handling of alarms (OPC Alarms and Events), handling of historical data (OPC Historical Data Access), etc. However, automation solutions are not only based on transport of data: they also require the ability to exercise control. What has been lacking until now is the ability to execute and control "commands".

In OPC terms, "commands" are actions that may change the state of a server or of a device. The execution of these actions may take more time than is usually associated with reading and writing data. On the other hand a "command" is relatively simple - a user can only pass information to the server when the execution of a command is started. Influencing the execution of the command is limited to runtime control (pause, resume, cancel).

What is OPC Commands?

The OPC Commands specification defines the means to discover, to understand and to control commands (methods) that a server provides.

The discovery and understanding is provided by the information interface. A client can discover on which levels an OPC Commands Server exposes commands (for instance in relation to an OPC DA namespace or an OPC A&E hierarchy). Commands can be exposed on different levels:

  • on a global level: commands applying to the server itself or to the whole infrastructure represented by the server or
  • on a sub-level: representing only a part of the infrastructure behind a server.

For each level it is possible to discover which commands a server exposes; descriptions of these commands are also provided. The description of a command includes information about preconditions, input and output parameters, and how the command is executed by the server. Command execution is described by means of a state machine, defined as a list of state transitions. By default a state transition has the following attributes:

  • (optional) transition condition
  • start state
  • end state
  • (optional) action (with input and output data)
  • message event (with transitional data).

Each state has a set of attributes. The information relating to these attributes can be passed to the client when command execution moves into or out of these states.

The OPC Commands Specification defines a basic state machine for the execution of a command. This state machine can be changed or extended according to the needs of the command.


Default-state machine of a command

Figure 1: Default-state machine of a command

The Command Execution interface supports starting the execution of a command. A command can be started either synchronously or asynchronously. A command started synchronously is similar to a blocking function call: the client is blocked during the execution of the command. If the command execution finishes, the client receives a report and the results of the execution.

Any command that was started asynchronously can be monitored and influenced via the Command Execution interface. The specification also allows a client to issue a command and disconnect from the server; execution of the command will proceed while the client is disconnected. When it reconnects to the server at a later time, the client will receive a report of the execution history and the results of the execution.

An execution report contains information regarding executed state transitions, and the events and data related to those transitions. When a command is started, a client can define which events shall be reported.

What is OPC Commands good for?

If an OPC Server is compared to a software object, then OPC DA provides access to properties of the object, OPC A&E provides event handling and OPC Commands provides method call capability.

OPC Commands allows control mechanisms to be defined that go beyond Read and Write access. Using OPC Commands it is possible to provide a clear understanding of:

  • what is needed before a command can be issued (preconditions),
  • what will happen when a command is issued,
  • how the execution of the command can be affected, and
  • how the execution of the command is progressing.

A generic OPC Commands client program is able to retrieve this information via the OPC Commands interfaces. Based on this information the client program can provide a user with a good graphical representation of the command execution.

OPC Commands provides a solution for a wide range of problems in implementation of open interfaces.

Even if a command is relatively simple in itself, multiple commands may be combined to implement complex state machines. The control of such a complex state machine will be executed by a set of commands. The relationship of these commands can be defined by describing the preconditions for each command.

On the other hand it is not necessary to implement the execution of a command as a state machine. While the command execution itself can be implemented as a simple method call (for instance by running a procedure), describing it as a state machine provides an unambiguous picture of the execution, and enhances the user's understanding. An example for such a simple implementation is shown in the listing in Figure 2. An sample execution report for such a simple state machine is shown in Figure 3.


Example for a simple state machine

Figure 2: Example for a simple state machine


Execution report for simple state machine

Figure 3: Execution report for simple state machine

How to use OPC Commands?

OPC Commands provides a base for control execution standards.

Standards bodies and server vendors will define sets of commands for different types of application. These sets of commands will define different "application domains".

Some example use cases for commands are the control and configuration of servers, the control of program download and invocation, and parameter download. Possible application areas include interfaces for programmable controls and complex devices (e.g. drives and valves). The control of batch execution will also benefit from OPC Commands.

On the other hand a server vendor may choose to define a specific solution for a specific problem. E.g., to provide open access to unique functions of a particular device.

In both cases a generic OPC Commands Client will be able to provide easy access to the commands exposed by any server (including non-standard commands).

Further information

The OPC Commands specification is available from the the OPC Foundation website (www.opcfoundation.org). As with all OPC Specifications, released versions are publicly available, while pre-release versions are reserved for OPC Foundation members only. OPC members who would like to participate in further development of the OPC Commands Specification should join the working group at: http://groups.yahoo.com/group/opc-commands.

Author: -
Thomas Hadlich is Chairman of the OPC Commands Working Group
ifak system GmbH
www.ifak-system.com

This article originally published in: -
Praxis Profiline - OPC 2004
Vogel Industrie Medien GmbH & Co. KG