Enumerations in WinCC

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

How can you use the

texts of enumerations
for display in WinCC?
Siemens
SIMATIC WinCC / SIMATIC PCS 7 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/27147567 Support
This entry is from the Siemens Industry Online Support. The general terms of use
(http://www.siemens.com/terms_of_use) apply.

Security Siemens provides products and solutions with industrial security functions that
Informatio support the secure operation of plants, systems, machines and networks.
n 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.
The 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 the customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial
© Siemens AG 2022 All rights reserved

Security RSS Feed under http://www.siemens.com/industrialsecurity.

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 2
Contents
1 Summary......................................................................................................... 4
2 Requirements ................................................................................................. 5
3 Procedure ....................................................................................................... 6
3.1 Implementation in the CFC ................................................................ 6
3.2 Implementation in WinCC/OS .......................................................... 11
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 3
1 Summary

1 Summary
Enumerations allow you to assign texts to values. The following entry shows you
how to define enumerations in the STEP 7 project in the SIMATIC Manager and
how to use them in the CFC and WinCC.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 4
2 Requirements

2 Requirements
The WinCC component "AS-OS Engineering" is installed.
You can select this component when doing a user-defined setup of WinCC. Please
use the following installation sequence:
1. STEP 7
2. WinCC with the "AS-OS Engineering" component
3. The CFC software for STEP 7 must be installed to be able to create shared
declarations in the STEP 7 project.
4. The WinCC project is integrated in the STEP 7 project.
Entry 11841504 includes information on how to integrate a WinCC project in
STEP 7.
If you are building on top of an existing project, it is possible that the component
"AS-OS Engineering" is missing and has to be installed retroactively. Entry
22272911 includes a description of how to retroactively install the "AS-OS
Engineering" component.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 5
3 Procedure

3 Procedure
3.1 Implementation in the CFC
Define the enumeration
1. In the SIMATIC Manager, you define the enumeration in the STEP 7 project
under "Shared Declarations > Enumerations".

2. Insert the desired number of texts into the enumeration.


© Siemens AG 2022 All rights reserved

3. Change the name, display name and value in the Properties.

4. Configure the enumeration texts for all the display languages that will be used
at WinCC Runtime. For this, in the SIMATIC Manager you select the menu
command "Options > Display Language...". This opens the window "Add,
remove language, set default language ...".

5. You select a language in the "Installed Languages in Project" list and click the
"Set as Default" button.

6. Click the "Apply" button and then close the dialog with the "OK" button.

7. Once you have set a default display language you match the display texts of
the enumeration to the default language selected (see 3).

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 6
3 Procedure
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 7
3 Procedure

Example of an SCL source with the "S7_enum" attribute


Those block parameters for which an enumeration is to be used are given the
attribute "S7_enum". The following figure shows an SCL source of a block, which
uses the attribute "S7_enum".
© Siemens AG 2022 All rights reserved

Note You can of course also define the attribute "S7_enum" in other programming
languages for the S7 controller (STL, for example).

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 8
3 Procedure

Use an enumeration on the block instance


1. Assign the configured enumeration to the block parameters at block call. For
this you open the "Properties - Input/Output" dialog. Select the required
enumeration in the "Enumeration" combo box.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 9
3 Procedure

2. You can then select an initial value in the "Value" combo box. The configured
texts of the enumeration are available for selection.
© Siemens AG 2022 All rights reserved

Note Make sure that you also configure the enumeration for the output parameters.

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 10
3 Procedure

3.2 Implementation in WinCC/OS


Compile AS and OS
Compile the program of the controller and the WinCC station.

Compiling makes the data available in the WinCC project for using the enumeration
in Runtime. These are:
• Entries in the Text Library
The name of the enumeration and the display texts of the individual values are
entered in the Text Library.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 11
3 Procedure

• Internal WinCC tags


The following figure shows which internal tags can be created for an
enumeration.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 12
3 Procedure

The initial values of the text reference tags are assigned the text IDs of the
corresponding texts in the WinCC Tag Management. In the following two figures
the white fields show the values of the internal tags of the enumeration for the
different Runtime languages. The blue I/O field shows the current value of the
enumeration tag. The value can be changed. The yellow text field shows the
current value of the enumeration tag as text. When the value of the enumeration
tag changes, the corresponding text of the enumeration is displayed in the current
Runtime language.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 13
3 Procedure

Using enumeration texts to dynamize the process screen


The internal tags of an enumeration that have been created through OS
compilation are used for dynamizing the text display. Below we describe one way
of displaying the current value of an enumeration with a WinCC object of the type
"Static Text".
1. Insert a Static Text on the associated screen.
2. Dynamize a non-relevant property of this text with the tag (one of the
enumeration tags) that contains the process information.
In this example, the property "Static Text > Flashing > Flashing Background
Color Off" was linked directly to the enumeration tag.
© Siemens AG 2022 All rights reserved

In the "Static" column for the dynamized property, you select a value that does
WARNING not in any way occur in the process mode. This ensures that the property
changes when a screen is opened and the process connection functions. This is
important for the next configured script to be executed in any case when a
screen opens.

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 14
3 Procedure

3. Now you define the C action: For this you select the event "Static Text >
Property Topics > Flashing > Flashing Background Color Off > Change". A
window opens where you insert the C action.
© Siemens AG 2022 All rights reserved

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 15
3 Procedure

The C action has the following structure.


© Siemens AG 2022 All rights reserved

Note The download of the C action is available on the entry page.

Brief description of the C action


The C action determines the current text of an enumeration according to the
current value and the Runtime language. The C action first determines the name of
the WinCC tag that is dynamized with the object. This information is then used to
determine the name of the enumeration used. Once the name and the current
value of the enumeration are known, the current text of the enumeration is read out
of the relevant text reference tag and written to the "Text" property.

Note The method described here can be used repeatedly. This means:
If several different measuring points are dynamized in this way, you can copy the
graphics object of an existing measuring point. Then all you have to do is change
the tag direct link accordingly. It is not necessary to change the script or a trigger
requirement. This method is thus also suitable for creating customized objects
(block symbols) in PCS 7 projects.

Using enumeration texts in WinCC


Entry ID: 27147567, Version 1.0, 06/2022 16

You might also like