Methods

Setup

Setup OPC Server connections and items.

The Setup method is used to setup the connection to the needed OPC Servers and the needed OPC Items. It is possible to setup a connection to any number of local and remote OPC Servers and any number of OPC Items.

The list of OPC Items will be presented to the script as a flat list where only the given name of each item is used, no matter which and how many different servers are used.

The list of servers is configured under the SERVERS section in the General tab of the properties.

A new server can be added by pressing the ‘Add server’ button of the SERVERS heading line.
An existing server connection can be removed by pressing the Delete key when the server line is selected.
A server connection can be moved up and down in the list by pressing Alt + Up or Alt + Down when the server line is selected.

There are three fields to setup for each connected OPC server:

Please note that this means that there is a difference between connecting to localhost (which involves DCOM) and connecting to the local OPC server by setting the MachineName to the empty string. Please see the section named Troubleshooting OPC problems for more.

The list of used OPC items is configured under the ITEMS section in the General tab of the properties.

A new item can be added by pressing the ‘Add item’ button of the ITEMS heading line or by pressing the Enter key on the line where you wish to insert a new item.
An existing item can be removed by pressing the Delete key when the item line is selected.
An item line can be moved up and down in the list by pressing Alt + Up or Alt + Down when the item line is selected.

The different fields for each item are:

Error Handling in Setup

Many different errors can occur in the setup process. The different error types are listed below along with a description of how each error type is handled during setup.

Errors on server entries:

Error descriptionIn parserBreaks setup
Missing ‘Server ID’
The ‘Server ID’ field is empty.
ErrorYes
Missing ‘Server Class’
The ‘Server Class’ field is empty.
ErrorYes
Duplicate ‘Server ID’ on server entry
The ID has the same name as a pervious entry in the list.
ErrorYes
The specified ‘Server Class’ was not found
The specified server class was not found on the specified machine.
NoNo

Errors on OPC items:

Error descriptionIn parserBreaks setupStep errorSimulates
Missing ‘Server ID’
The ‘Server ID’ field is empty.
ErrorYesYesNo
Unknown server ID
No server entry has the specified server ID.
ErrorYesYesNo
Missing ‘Name’
The ‘Name’ field is empty.
ErrorYes-No
Duplicate ‘Name’
The entry has the same name as a previous entry in the list.
ErrorYesNoNo
Missing ‘Item ID’
The ‘Item ID’ field is empty.
ErrorYesYesNo
Unknown item ID
The OPC server has no item with the specified ID.
WarningNoYesNo
Selected ‘Type’ is different from the data type of the item on the OPC server.-NoNoYes
Selected ‘Direction’ is incompatible with the direction of the item on the OPC server.-NoNoYes
Syntax error in specified ‘Update Rate’
The specified update rate does not follow the supported format of a time interval value.
ErrorYesNoNo
Quality is bad and not one of these values:
LastKnown, WaitingForInitialData
-NoNoYes

The column ‘In Parser’ indicates whether the error is listed in the Errors and Warnings view, and whether it is reported as an error or as a warning.
The column ‘Breaks setup’ indicates whether the error will prevent the setup of the tool from completing. If the error breaks the setup, the error has to be fixed before the tool can be used.
The column ‘Step error’ indicates whether steps using the item will report an error in the Errors and Warnings view.
The ‘Simulates’ column indicates whether the error will force the tool into ‘Simulate’ mode.

Get Item Value

Gets the value for the specified OPC item.

This method gets the value of an OPC item.

The setup shows the list of available items for the selected OPC Client instance. The user can select one of the items on the list and the output data type of the procedure step will be set to the data type of the selected item.

Set Item Value

Sets the value for the specified OPC item.

This method sets the value of an OPC item.

The setup shows the list of available items for the selected OPC Client instance. The user can select one of the items on the list and the input data type of the procedure step will be set to the data type of the selected item.