OPC DA server CNS
This section describes the OPC DA CNS function of the WinCC OA OPC DA server which allows to map CNS views to the server's address space. Therefore the server address space is independent from the data point structure of the respective project and can be freely defined.
Using CNS means that no data point groups are required. The necessary structure of the CNS view can be defined via the Plantmodel Editor or control functions.
Configuration
The ID of the view which shall be mapped to the address space must be specified on the internal data point element Config.CNSView of type _OPCPvssServer. Only one view can be assigned to each server.
The OPC DA server checks the Config.CNSView data point element only on starting. If another view shall be mapped to the address space, the other view ID must be defined on the data point element. After that the server must be restarted. In case of an invalid view ID the server is shut down and the following error message is displayed::
SEVERE, 54, Unexpected state, CNSViewBrowser, Constructor, View 'View13' doesn't exist!
The WinCC OA system name and the view name are not part of the server's address space. The first level of the address space is the root node configured via the config entry rootNode. Nodes of the CNS view are displayed beneath the configured root node.
AccessLevel
The AccessLevel attribute must be used to define how the value of a variable can be accessed (read/write). The OPC UA server only represents nodes for which an appropriate AccessLevel is defined.
To define the AccessLevel for a node, the keyword OA:OPC with a value of data type UINTEGER_VAR must be stored in the node's UserData (either automatically via Plantmodel Editor - OPC or cnsSetProperty). All child notes for which the AccessLevel is not explicitly set inherit the AccessLevel of the parent node.
Field | Bit | Description |
---|---|---|
Read | 0 |
Indicates if the value is readable 0: Not readable 1: Readable |
Write | 1 |
Indicates if the value is writable 0: Not writable 1: Writable |
Inheritance | 31 |
Indicates if the AccessLevel of this node is inheritable or only valid for this node. 0: Inheritable 1: Not inheritable |
Mapping to the server address space
Data points can be assigned to nodes of a CNS view. If a data point element is assigned to a node and the AccessLevel is defined, the object for this node is represented as LEAF item and represents the current value of the linked data point element.
CNS Nodes without any linked data point element are represented as BRANCH items.
Consider the following information:
-
A node without AccessLevel is not represented in the server address space unless the AccessLevel of at least one child nodes is defined and the child node is assigned to a data point element
-
A node with defined AccessLevel but without an assigned data point element is not mapped to the address space, unless there is at least one child node with an assigned data point element.
-
A parent node with assigned data point element but without defined AccessLevel is mapped as BRANCH item if the AccessLevel is defined for one of the child nodes.
-
The structure of objects in the address space equates to the linked data point structure. If a data point element structure is assigned to a node, the OPC UA server appends all elements of the linked structure to the CNS node.
-
Mapping nodes to the address space beneath a LEAF element (i.e. a node with assigned data point element) is not possible. If a LEAF element has child nodes in the CNS view, they are not mapped to the address space and an appropriate error message is displayed in the LogViewer.
The data point element names of the linked structure are used for the OPC DA node ID. If the data point element names of the linked structure are conflicting with CNS nodes with the same ID, the OPC DA server displays an error message in the LogViewer. In this case the nodes which are already existing in the address space remain unchanged and the new conflicting nodes are not added to the address space.
The attributes of a CNS view are mapped to the address space in the following way:
CNS view | Address space | Comment |
---|---|---|
ID path | ItemID | The full ID path of the respective CNS node without system name and CNS view name. |
UserData (OA:OPC) | AccessLevel | AccessLevel (Read/Write) of a CNS node is stored in its UserData |
Additional information
Changes to the CNS view
Following changes to the used CNS view are applied dynamically to the address space at runtime:
-
Creating new nodes
-
Deleting existing nodes
-
Changing the node ID
-
Linkage of data point elements with nodes
-
Deleting data point element assignments
-
Changing the AccessLevel of nodes
Modifications to the WinCC OA data point types (e.g. adding a new node to an existing data point type or changing the element type) are not applied to the address space at runtime. Therefore the server must be restarted after changing the data point type of a data point element (structure) which is linked to a CNS node.
Example for mapping a CNS view to the server
The following example shows how a CNS view can be mapped to the address space of a OPC UA server.
CNS view | Data point linkage | AccessLevel defined? | Mapped to server | ||
---|---|---|---|---|---|
N1 | No | No | Yes | ||
N1_1 | Yes | No | Yes (as BRANCH) | ||
N1_1_1 | Yes | Yes | Yes | ||
N1_2 | No | Yes | No | ||
N1_3 | Yes | Yes | Yes | ||
N1_3_1 | Yes | No | No (the LEAF item N1_3 cannot have child nodes) |