next up previous contents
Next: Representation of the Item Up: Representation of OPC XML-DA Previous: Qualified Names (QNames) and   Contents

OPC Item Properties

Every OPC Item may have so-called properties that contain further information about the item. Example properties would be the access rights or a description of the item. These OPC properties are modeled as a specific Python object, called OPCProperty, which contains the following information:

Name:
The name uniquely identifies an OPC property. Names must be of the type QName.
Value:
Properties most often have a value, for instance in case of a property ``accessRights'', it stores the strings readable or writable.
Description:
In order to easily understand the meaning of a property, it can store a description.
ItemPath/ItemName:
The address of the property, consisting of the ItemPath and ItemName.
ResultID/ErrorText:
In case a property is erroneous, for instance if it cannot be read or does not exist, the error can be stored in a ResultID and a descriptive error text.

Listing 6 shows in line 1 to 5 how to create and access a PyOPC property object.

language=C
\begin{lstlisting}[caption={Creating and Accessing PyOPC Properties}
,label=ex_...
...ar
p2 = OPCProperty(Name = 'accessRights')
print p2.Description
\end{lstlisting}

The OPC XML-DA standard specifies various common properties, which should be preferred over custom properties, if possible. A full list of these available properties is given in [OPCXMLDA]. The alternative are custom properties that will often be in the namespace of PyOPC. Therefore the framework offers a simple shortcut in creating properties: if the property name is a string instead of a QName, PyOPC searches in a table for a matching OPC property. If one is found, the OPC XML-DA namespace is used, moreover the description is filled out automatically. If the property is unknown, the PyOPC namespace will automatically be used. This behavior is reflected in line 7 and 8 in listing 6.

Properties will be associated with items, therefore an ItemContainer object provides the following methods to add, delete and list properties:


next up previous contents
Next: Representation of the Item Up: Representation of OPC XML-DA Previous: Qualified Names (QNames) and   Contents
Hermann Himmelbauer 2006-11-07