How Do You Access Array Elements with WinCC OPC UA Client? WinCC V7.4 SP1 Update 1 https://support.industry.siemens.com/cs/ww/en/view/109746486 Siemens Industry Online Support
Siemens AG 2017 All rights reserved This entry is from the Siemens Industry Online Support. The general terms of use (http://www.siemens.com/terms_of_use) apply. Security information Siemens provides products and solutions with industrial security functions that support the secure operation of plants, systems, machines and networks. In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement and continuously maintain a holistic, state-of-the-art industrial security concept. Siemens products and solutions only form one element of such a concept. Customer is responsible to prevent unauthorized access to its plants, systems, machines and networks. Systems, machines and components should only be connected to the enterprise network or the internet if and to the extent necessary and with appropriate security measures (e.g. use of firewalls and network segmentation) in place. Additionally, Siemens guidance on appropriate security measures should be taken into account. For more information about industrial security, please visit http://www.siemens.com/industrialsecurity. Siemens products and solutions undergo continuous development to make them more secure. Siemens strongly recommends to apply product updates as soon as available and to always use the latest product versions. Use of product versions that are no longer supported, and failure to apply latest updates may increase customer s exposure to cyber threats. To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under http://www.siemens.com/industrialsecurity. Table of content 1 Configuring OPC UA Arrays... 3... 5 2.1 Data consistency... 5 2.2 Performance... 5 2.3 Dynamic arrays... 5 2.4 Manual configuration of arrays... 5 2.5 Index Range support... 7 Entry-ID: 109746486, V1.0, 15.05.2017 2
Siemens AG 2017 All rights reserved 1 Configuring OPC UA Arrays This document describes how to configure OPC UA arrays in WinCC and the related restrictions and potential risks at Runtime. 1 Configuring OPC UA Arrays As of V7.4.1 Update 1, WinCC supports the configuration of OPC UA arrays. A WinCC tag can only match one single array element; thus, it is not possible to match an entire OPC UA array value to a WinCC tag. The WinCC Configuration Studio was enhanced to support the configuration of OPC UA array variables, as shown as shown in the following steps. In a first step, the Configuration Studio displays in the AS Symbols pane one line for each OPC UA variable found at the current location in the server s address space (i.e. the Arrays folder in next figure). If the variable contains an OPC UA array, the variable name is marked as expandable via a preceding > symbol and the array type and dimension(s) are displayed in the OPC UA Data Type column. In a second step, the user expands the array elements simply clicking on the > symbol preceding the variable name in the Configuration Studio, as shown below: In a third step, the user selects the array elements to be configured in WinCC, using the check box on the left. WinCC creates one tag for each selected array element. Entry-ID: 109746486, V1.0, 15.05.2017 3
Siemens AG 2017 All rights reserved 1 Configuring OPC UA Arrays Supported data types WinCC supports OPC UA arrays of following built-in types, with any dimensions: Boolean SByte Byte Int16 UInt16 Int32 UInt32 Float Double String DateTime ByteString If a server exposes an unsupported array type, no tag can be configured in the WinCC Configuration Studio. Entry-ID: 109746486, V1.0, 15.05.2017 4
Siemens AG 2017 All rights reserved 2.1 Data consistency At Runtime, data inconsistencies of OPC UA array values configured in WinCC may occur. In particular, array data may be inconsistent: 2.2 Performance When reading several array elements in different read cycles. When reading and updating entire arrays (see Write Without IndexRange mode below). If the OPC Server doesn't support Index Range, performance problems may occur while reading multiple elements of an array. That is because WinCC has to read the entire array value and to extract the configured array elements. 2.3 Dynamic arrays An OPC UA array s length may be dynamic and can change at runtime; thus, WinCC tag values may have a bad quality if the array is shorter than expected. 2.4 Manual configuration of arrays Some OPC UA servers may not be fully compliant with the OPC UA norm so that the WinCC Configuration Studio may not be able to display array elements. In such a case the user has to manually create array tags and to adapt the tag address; thus, the user will need server-specific knowledge to configure arrays for such servers. The best ways to configure tags manually are shown below: copying an existing server s tag using the copy/paste function in the Configuration Studio editing the NodeId to specify the array element 1. To copy the MyArrayVariable tag, simply right click on the tag name and select copy and then paste. A new tag MyArrayVariable_1 is created. The tag can be renamed. Entry-ID: 109746486, V1.0, 15.05.2017 5
Siemens AG 2017 All rights reserved 2. To edit the tag address of MyArrayVariable_1, select the tag and click on the [ ] button on the right of the tag address (marked in red on the figure above). 3. The Address properties dialog appears and you can then adapt the NodeId, the data type and, if applicable, the index of the array element to configure. For example, SINUMERIK tags (R variables, PLC variables ) cannot be recognized as arrays. This is a limitation of the SINUMERIK server. Only the array itself (without its elements) can be displayed in the Configuration Studio. Thus, the WinCC user has to create array elements with the Configuration Studio and to modify the tag address manually as described above, in order to specify the NodeId expected by the server. Entry-ID: 109746486, V1.0, 15.05.2017 6
Siemens AG 2017 All rights reserved 2.5 Index Range support When reading/writing an OPC UA array, the OPC UA client can access the entire array or only a subset of it, using the Index Range feature specified in the OPC UA norm. For example, the client may read/write only elements 3 to 10 of an array, specifying 3,10 as Index Range, or read/write only array element 5 simply specifying 5 as Index Range. OPC UA servers that are compliant to the OPC UA specification should support Index Range when reading arrays. On the other hand, support for writing to arrays through IndexRange is not mandatory for OPC UA Servers. WinCC will always try to read or write array elements using Index Range. If array elements cannot be read with Index Range, WinCC tries to read the entire array and to extract the array elements configured in WinCC. If array elements cannot be written with Index Range, WinCC will use the fallback strategy only if it is enabled by the user as described in next paragraph. Enable /Disable OPC UA array writing without Index Range If an OPC UA server does not support Index Range when writing arrays, there is no way to modify single elements in a safe manner. A fallback strategy is to read the entire array, to modify the array elements concerned and to write the entire array back to the server. Unfortunately, this approach can lead to data inconsistency on server side. Nevertheless the WinCC user may enable this fallback strategy via a new connection setting. Doing so, the user accepts the data consistency issues that may be caused by this strategy. The connection setting is called Write array entries without Index Range as seen below. Entry-ID: 109746486, V1.0, 15.05.2017 7