WinCC Unified Engineering Guideline DOC V1 en
WinCC Unified Engineering Guideline DOC V1 en
WinCC Unified Engineering Guideline DOC V1 en
Industry
Online
Support
APPLICATION EXAMPLE
Engineering guideline
for WinCC Unified.
SIMATIC WinCC Unified V18 / V19
Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several components in the form of
text, graphics and/or software modules. The application examples are a free service by Siemens AG and/or a subsidiary of
Siemens AG (“Siemens”). They are non-binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute customer-specific solutions. You
yourself are responsible for the proper and safe operation of the products in accordance with applicable regulations and must
also check the function of the respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the application examples used by
technically trained personnel. Any change to the application examples is your responsibility. Sharing the application examples
with third parties or copying the application examples or excerpts thereof is permitted only in combination with your own
products. The application examples are not required to undergo the customary tests and quality inspections of a chargeable
product; they may have functional and performance defects as well as errors. It is your responsibility to use them in such a
manner that any malfunctions that may occur do not result in property damage or injury to persons.
Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation, liability for the usability,
availability, completeness and freedom from defects of the application examples as well as for related information, configuration
and performance data and any damage caused thereby. This shall not apply in cases of mandatory liability, for example under
the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of life, bodily injury or damage to
health, non-compliance with a guarantee, fraudulent non-disclosure of a defect, or culpable breach of material contractual
obligations. Claims for damages arising from a breach of material contractual obligations shall however be limited to the
foreseeable damage typical of the type of agreement, unless liability arises from intent or gross negligence or is based on loss of
life, bodily injury or damage to health. The foregoing provisions do not imply any change in the burden of proof to your
detriment. You shall indemnify Siemens against existing or future claims of third parties in this connection except where Siemens
is mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any damage beyond the liability
provisions described.
Other information
Siemens reserves the right to make changes to the application examples at any time without notice. In case of discrepancies
between the suggestions in the application examples and other Siemens publications such as catalogs, the content of the other
documentation shall have precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also 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 constitute one
element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines and networks. Such systems,
machines and components should only be connected to an enterprise network or the internet if and to the extent such a
connection is necessary and only when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly recommends
that product updates are applied as soon as they are available and that the latest product versions are used. Use of product
versions that are no longer supported, and failure to apply the 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
https://www.siemens.com/cert.
Table of contents
1. Introduction ...................................................................................................................................5
3.3.3. Use Case: Faceplate that is not always visible in Runtime ........................................................................... 44
5. Appendix .....................................................................................................................................79
1. Introduction
1.1. Overview
SIMATIC WinCC Unified is the completely newly developed visualization system from Siemens in the automation
environment. The SIMATIC WinCC Unified system consists of the SIMATIC WinCC Unified visualization software and the
new SIMATIC HMI Unified Comfort Panels as well as the Unified Basic Panels.
The Unified Comfort Panels extend the product range of the SIMATIC Advanced Panel-based HMIs and are the successor
devices of the SIMATIC HMI Comfort Panels. In addition to the new hardware, there are numerous innovative new
features that have a lot of impact in the way you use things. To get a better overview of the steps that help you get the
best out of the new features and behaviors in Unified Comfort panels and PC Runtime, this document will address several
topics. We will discuss the advantages and guide you through the steps of the changed process.
The content of this document refers to the entire Unified HMI portfolio, unless there are further references to device-
specific information.
SIMATIC HMI Unified Comfort Panel MTP1200 1 6AV2128-3MB06-0AX1 Alternatively, any other SIMATIC HMI Unified
Comfort Panel can be used.
You can purchase these components from the Siemens Industry Mall.
NOTE Please note that all functions shown or explained in the document only apply to WinCC Unified V18
including updates and V19. The additional functionalities of the any V19 updates are not covered in
this document!
2. Preliminary Information
2.1. Reasons for using the Engineering
Guideline
Unified Panel and PC-RT Devices offer the latest technologies, such as HTML5, JavaScript and scalable vector graphics
(SVGs). This makes them more powerful and able to offer a wider range of functions and capabilities than the old Comfort
Panels and WinCC RT Advanced systems, allowing you to get more out of your system. In order to use them efficient this
document provides some recommendations for the engineering. The presented implementations can be helpful if you
start a new project but also if you have an existing project already there.
When creating a new project, it is recommended to first work through the engineering guideline. It will provide the
knowledge to use the resources of the devices the most efficient way.
But also, if there is already an existing Unified HMI project, this guideline contributes to further improve the
implementation. There is also an explicit section on how to analyze a project to find the areas that can be improved easily.
If optimizations regarding Java Script code in general, the style guide for scripting and the HMI layout can be found in
additional documentation: StyleChecker, HMI Template Suite, Tips and Tricks for Scripting
All tools can also be found in section 5.2 Links and literature.
Create a
screen/view
Collect content
and group the
information
Is the
content
also
Yes displayed in No
other
views?
This is content for an
Put the content, that is used in
individual screen of
multiple screens (e.g. Alarmline,
this view. Select the
navigation buttons, username), in a
necessary screen
separate screen window, to reuse it
items and design the
and to only load it ones for different
screen.
screen assemblys
Content
for this
view is
Yes complete No
?
Arrange the view with the view-
individual screen/content and the
multiple used screens with
screen windows
The result of this configuration could be a screen layout like it is displayed in the following figure. All individual screen
windows are highlighted with an orange frame.
Header MainNav
Content
ThirdNav
Subnavigation
Figure 2-2 Example of a view using several screen windows
Once you have determined which elements are to be placed on which screen, you can continue working on the individual
screens. Most of the screen items need dynamic properties or will use events to trigger system functions or scripts. To
implement these dynamizations, the following scheme shows you which implementation might be best for your
application. Depending on the desired functionality, select a suitable element from the toolbox and drag it onto the
screen if it is not already there.
Need
Use different Use static
dynamizations property values
Yes No
settings?
A property
needs to be
Use Use simple tag
dynamized
expressions dynamizations
Yes with a No
logic?
Configured
screen item
NOTE In general, tag dynamization is the most recommended dynamization type. If a more complex logic is
necessary, use the expressions. Try to avoid script dynamizations. Nevertheless, if a scripting logic can
replace multiple overlayed screen items, then use scripts. e.g., a button to show and/or hide other
elements: Use one button and decide through scripting which method (show or hide) is executed
(see 2.2.1).
The following section explains the practice of a scripting logic instead of multiple objects with a simple use case.
Description
The concrete action or scripting behind an event can often depend on the current state. In this exemplary use case there
should be a button to show and hide a specific screen content (here: a rectangle), dependent on the current visibility of
that screen content. One solution could be to use two different buttons, that implement once the show-action and once
the hide-action and to change the visibility of these two buttons also with the current state. The second solution could be,
having only one button, and decide by scripting (switch … case), which action should be done.
Solution
Use a single button for this task and implement a scripting logic for the decision if the visibility of the content needs to be
set to be visible or not. Directly use the same tag (here: “ContentVisible”) for
As this use case is very simple, the inverting of the state tag “ContentVisible” in the scripting logic could also be just done
by a system function through the button click event. But to demonstrate how the implementation could look like for a
more complex use case the screenshot shows the implementation with switch case.
To change the button text for the different states, it is dynamized with a text list and again the state tag.
In the following solution, that is NOT recommended, two overlaying buttons are used, one to set the visibility of the
rectangle to true and a second one to set the visibility to false. To make the buttons accessible at the right time, their
visibility is also dynamized with the visibility state of the rectangle. For such use cases with a state depended action, the
previous shown scripting solution is better than having multiple overlayed screen item, in order to minimize the number
of objects per screen.
The reason why the use case example applies text boxes as buttons, is explained in 3.1.1.2 Use Case: Button without
implementation of the press and release event.
The screen load procedure of an individual screen is mostly separated in synchronous sections, meaning that one thing
happens sequential after another. As the layout is often made by the composition of nested screens and faceplates, it is
important to know, that for each screen window and faceplate instance there is an own decoupled cycle.
At the very beginning of a screen change, even before the new screen is loaded, the previous one gets cleared.
After this step is finished, the base screen is built and all properties, even if they are dynamized, e.g., linked to tags, are
loaded with the static value for an initial load of a screen. All nested faceplates and screens in screen windows are loaded
in an own decoupled cycle also first with static values.
Next the screen “loaded” event, that also can be customized in the engineering, is executed.
The tag registration happens after the initial load of the screen. When the tag registration is done, all dynamizations are
considered and the screen item properties that have a linked tag in the dynamization area can change again from the
static value to the value of the dynamized tag.
If tags, linked to any dynamization or any property are changed in this context again, also the screen item properties can
change again. Through this order, the on-change event of a property can be executed twice during the screen load
procedure. This second call of the change event is highlighted orange in the following figure (Figure 2-9).
Screen
Loads
Is there a
dynamization
Yes for the No
property?
Is the
screen
load a
Yes runtime No
start?
The dynamizations are triggered Tag dyamizations
with the initial values of the tags are triggered with
the latest value of
the tag
Property change
event execution
Property
QualityCode
Change event
Screen load
event
Is the
value
different
Yes from the No Property change
Tag dyamizations last value? event execution
are triggered with
the new value of
the tag
2. Property
change event
execution
Figure 2-9 Call of the change event of screen item properties during screen load
Another important aspect are the execution contexts. A context is an independent runtime environment where a specific
script or task is performed. The different contexts work parallel in runtime; therefore, you can handle several scripts and
tasks at the same time.
As you can see in the figure above, the main separation is made into scripting and dynamics. This already indicates why
the tag dynamization and expressions are preferred to the script dynamization as they work in parallel to all processed
scripts.
For the scripting the separation is between the scheduled tasks context and screen context. Each screen has its own
scripting context for scripts and system functions. The namespace (global definition area) is unique for each scripting
context. The scheduled tasks and also scripts in the screen context can be triggered cyclically, tag triggered, or alarm
triggered. Both is important for the load procedure, the decision if the script is implemented in the scheduled task or
screen context but also which trigger type is used (see 3.4.1).
With this information it can already be defined what configurations are relevant for screen load.
Property on change event scripts ✓ Figure 2-9 Call of the change event
of screen item properties during
screen load
Dynamization scripts ✓
Table 2-1 Overview of screen load relevant scripts
Expressions ✓
Dynamizations ✓
As you can see, there are a lot of things that affect the procedure of screen change at the runtime device. To give you all
the detailed information on the single aspects, we’re focusing even more on the following areas. You will also receive a
description and best practice how to implement the features in the most efficient way. If a project needs to be analyzed
there is a guideline provided in chapter 4. But first this document describes the best practices for screen engineering in
more detail.
NOTE To support the comprehension of these best practices, the general screen load procedure is described
in the chapter 2.3.
In general, all recommendations of this section about screen objects follow on rule.
Before we go on, it is important to mention that each object has a footprint. With footprint the rendering effort is
described. A small footprint is associated with a small number of properties and the low complexity of the screen item,
e.g., a rectangle. Objects with a higher footprint often contain a lot of properties as the controls do have. Besides the fixed
properties, also the customization through dynamizations can increase the rendering effort of a screen item and therefore
influence the loading procedure of the whole screen.
In the groups themselves there are differences as well and the most important thing to understand is that each screen
object has an individual rendering effort (footprint). Before we go on, make sure that you know the toolbox elements and
even the adaptions in V19. The text and text box adaption is shown in the figure below.
NOTE The Text box from the basic objects has moved to the elements section for V19. The same looking item
in the basic objects of the V19 toolbox is now “only” a text, comparable to a simple label. So, if the
engineering system is a V18 version, the rendering effort of the Text box is also higher than for the
basic objects and comparable with the items from the elements section
Sometimes, there is more than one possibility to display a functionality with different objects. Even if two objects look the
same when configured on screen, they can have different influence on loading time of the whole screen. In the following
some examples are shown.
Even if the following examples do not cover a complete real use case, keep these points in mind when configuring a new
screen.
Solution
Instead of using a Text box, the rectangle element is the better choice due to its smaller rendering effort.
Solution
In terms of rendering effort, the text has the smallest footprint, followed by the text box and the button. Therefore, use a
Text box if you need a background color, otherwise a Text if they fulfil your requirements. Also, these items have on
mouse click events. Only use a button when the press and release events are necessary.
Solution
Whenever possible, especially for simple labels, use a Text instead of a Text box. The following table shows the different
feature sets of a Text compared to a Text box. Compared to the text box, the reduced functional scope of the text causes
the lower food print and rendering effort at the runtime device.
Format – Spacing X ✔
Parameter Field ✔ ✔
Solution
Instead of adding an additional rectangle to the screen and using its background color as the screen background, change
the color of the screen element directly. This is also relevant for faceplates.
Solution
It is always preferable to use the Unified screen objects with their intended function. The reproduction of user-defined
designs of an item with the help of several screen items should be avoided, as this leads to a higher number of screen
objects and usually to additional unused functions of these auxiliary items. Also, the use of faceplates as a
standardization method for corporate designed objects create an unnecessary overload. Use the SIMATIC WinCC Unified
Corporate Designer to create these designed objects and also colors as part of your own style and use this style in your
project.
Inside the corporate designer a new style can be created already based on existing styles. Then you can either change the
style of existing objects or also create completely new objects. These styles can also be linked to color palettes and fonts.
When the style design is finished, the style needs to be exported and the generated file must be copied to the project
directory (Userfiles > Styles). After these steps the style can be selected in the runtime settings.
The style that is selected in the runtime settings of the device, can still be changed on demand in runtime. Also, with the
new custom styles.
Figure 3-13 Change the style item of system and customized screen objects in engineering
Custom Style
Define a custom style instead of using faceplates for single object configurations
System limits
Delete unused and invisible objects to achieve a lower loading effort
Does the
content Put the content
Put the content
in a faceplate need data in a screen
Yes through an No
interface?
Does the
Is the screen window
screen / faceplate
Create it at runtime with
window / item it self
the system function
faceplate require OpenScreenInPopUp /
visible at No dynamizations No OpenFaceplateInPopUp
runtime and complex
start? configurations
?
Yes
Yes
Configure the
screenwindow
on the screen
Configure the screen window / facepalte in
the engineering, but only set the screen
property, when the screen window is set to
visibie
Finished
Figure 3-16 Static value for Visibility if the item is assumed to be invisible at screen load
Solution
If only the visibility is changed depending on the same condition, move all objects in one layer and dynamize the runtime
visibility of the layer. The visibility of the layer can be changed also in runtime by scripting.
Solution
Change the properties in runtime and do not configure multiple controls or even change the screen to realize different
settings. Therefore, use the system function “SetPropertyValue” or the object model “Screen.Items(« Itemname »)”. The
name of the properties can be easily copied in the engineering from the properties tab.
All accessible properties can be found in the WinCC Unified object model directly in the TIA help or on the SIMATIC HMI
WinCC Unified Engineering V18 System Manual on SIOS.
Unified Controls
Reconfigure the control in runtime, when different settings are needed, instead of having
multiple controls.
Solution
As we in general recommend designing a screen layout with screen windows (see 3.1.3 and Figure 2-2), there are screens
that change the content and screens that remain. The alarm control belongs to the screen items with a huge footprint
(see 3.1.1 and Figure 3-2) therefore it is recommended to put it in screen windows, that are not reloaded that often like
e.g., the header. Since these screen windows like the header are not that big, you can configure the alarm view as an
alarm line with the following steps:
1. Use the simplified appearance style
4. Go to Miscellaneous > Alarm view > Header-settings and change column header to none and row header to none
If the alarm view with the whole functionality is necessary, show it as a pop up on demand.
• JPG (joint photographic experts group) are recommended for UCPs as the format reduces the size of large files. So
there is also a loss of quality through the compression, but the files can also be decoded faster. When a graphic is
needed in a high resolution, a JPG can also be used in a high quality. JPG does not automatically mean less quality.
• PNG (portable network graphic) is a raster graphics format with lossless data compression. Therefore it is
recommended when transparency is required or when exact pixel accuracy is important.
• SVG (scalable vector graphics) is used for displaying two-dimensional graphics, diagrams and illustrations on websites.
As a vector format, SVG images can be scaled to different sizes without affecting the resolution. Therefore, this format
is recommended when high quality zooming is required or dynamic SVGs are used. In other cases, it is better to
convert the file in the size used to a PNG or, if no transparency is required, to a JPG, whereby the largest size used for
multiple use should be selected.
Graphics
Regardless of the graphic format, the file size should not be larger than the maximum
size /resolution that is needed for this HMI
Graphics Format
The recommended order for selecting the graphic format is
1. JPG
2. PNG
3. SVG
If there are further requirements for the graphic, still the SVG can be the most suitable. But select it
carefully!
Solution
Do not create pattern by the use of single items but combine them to one image. This reduces the number of objects on
the screen. Even if the objects are basic like rectangles, the combination to one object reduces the rendering effort. When
dynamizations are necessary create a custom dynamic SVG (see next use case). This also reduces the number of object
containers on the screen and helps to comply with the system limits.
Combined objects
Reduce the number of elements on the screen, by creating SVGs and dynamic SVGs of
combined objects
Also use graphics in their original resolution and only as large as it is necessary.
Solution
As already described in the previous use case, to minimize the number of screen items per screen, composed objects
should be combined to one object container. There are dynamic SVGs available for a wide range of standard components
in the IndustryGraphicLibrary. Before building your own component with several screen items, check if there is already a
solution in the graphic library. Through the interface some properties can be configured and changed in runtime
dynamically. More information about the usage of the dynamic widgets can be found in the Unified Manual.
In this context it is important to mention, that there is also a “Change” event. Through this event, an additional script can
be executed If the property is changed at runtime, e.g., if the tag value of the dynamization tag is changed. That happens
when this event is triggered during the screen load process can be seen in detail in Figure 2-9.
The second dynamization is a script dynamization. The return value of this script defines the property value after the script
is executed. To execute the script a trigger needs to be specified. Information about triggers is given in section 3.4.1.
The expressions are another way to dynamize a screen item property. To configure them, there is an additional tab
available. With an expression a condition based on multiple tags can be defined and multiple properties can be changed
by the conditions.
Be aware of the order in which the expressions are defined. They are executed from top to button and once a condition is
true, the others are not executed anymore. In the following example, the order must be as follows. If it is defined in
reverse order, the AND condition is never evaluated, as the OR condition is always fulfilled first.
Depending on the property it is also possible to use a resource list or flashing as a dynamization. The flashing option is
available for color properties. The resource list for text properties.
In general, it can be said that expressions and tag dynamizations are the preferred solution for property changes. But if a
script can be used to avoid multiple screen objects, scripts are recommended (see 2.2.1).
Dynamizations
Use, if possible, tag dynamization. When more complex logic is required use expressions.
Try to avoid script dynamizations
Information about the different trigger types (cyclic, tag, alarm, event-driven,…) are documented in detail in SIMATIC
WinCC Unified – Tips and Tricks for Scripting (Java Script).
for this use case (see Use Case: Custom Styles ). Another thing is the use of faceplates with versions <V19. Check if
their functionality can be reimplemented with the new features. Also pay attention to the following.
• Use faceplates screen objects with sophisticated and extensive logical configuration
• Chose appropriate datatypes in the faceplate interface
• Keep in mind the system limits \9\ of a screen when creating a faceplate. Sample calculation for a Unified Comfort
Panel 7-12 inch:
Number of objects per screen for a UCP 7-12“: 800
20 faceplates on the Screen
20 Additional Objects on the Screen
→ 800 - 20 Screen Objects - 20 faceplates = 760 Objects that are remaining for the faceplates
→ 760 / 20 = 38 Objects that can be used per faceplate in this use case
Solution
If you need a string that is used for a tag dynamization inside a faceplate type, select the multilingual text. A configuration
string cannot be linked to a property as a dynamization, but only through scripting.
Configuration strings are only recommended for the transfer of configuration settings e.g., trends in a trend control or
alarm filters.
Multilingual strings also have the benefit of saving the text information for the different runtime languages and can be
switched during runtime.
Figure 3-39 Multilingual text and configuration string in faceplate property interface
Solution
If only some entries from the text list are used inside of the faceplate or the entries are further individually evaluated for
example are written to different screen item properties, transfer them as single texts and as a multilingual text. In the
following use case only the NoError,SoftwareError and HardwareError from the ErrorStates text list are needed inside of
the faceplate. Therefore, it is enough to transfer these entries instead of the whole list.
Figure 3-40: Single text list entries as multilingual text in faceplate interface
Solution
Activate the suspendable flag for these faceplate instances. With this setting the cyclic script or scripts triggered by tag
changed are not executed when the faceplate is not visible. Not visible refers also to the case that it is out of the current
visible screen area.
If two scripts are triggered by the same tag, combine them into one single script.
Script triggers
Use tag triggers and avoid cyclic triggers
Solution
Create a subscription in the loaded event of the screen for this tag and manage centrally the property changes with one
script. There is already a snippet for the tag subscription available. Especially when the same scripting logic is
implemented in the scripts (e.g., if-else) you save a lot of script execution through the one subscription.
• Delete functions or import statements in the global definition area that are not called
Prefer system functions from the system function list, instead of scripting in the JavaScript editor
• Delete empty events
Figure 3-47
• Delete or comment out constants, variable definitions, debugging traces that are not used anymore
• Only read tags that are used in the script
• If two scripts are triggered by the same tag, combine them into one single script.
• Read tags once, save them in a variable and reuse this one if the tag is used multiple time in the script
• Use a “const” definition when possible (if the value does not need to be changed in the script context) and otherwise
define a variable with “let”. Do not use “var” anymore, because it is a deprecated java script standard.
• Use a switch-case instead of if-else
Use asynchronous scripts if possible. For calls that can take longer e.g. database access, only the async variant is offered
anyway. For tag access the sync and the async mode is supported because tag accesses are normally faster. More
information regarding the script call can be found in the Java Script Tips and Tricks.
function A function A
function B
function B function C
function C
function D
function D
• Be aware of how often scripts are executed, especially during the screen load process (see Figure 2-9). The following
example is for a script in the on change event of the dynamized process value of a list box. The visibility of these
property change events can be switched in the engineering through the eye icon .
Figure 3-53: Excerpt from the system function in the tags section
But there could be also a tag set created, that covers multiple tags in a container.
Solution
Create a tag set when writing or reading multiple tags and use its Write and Read method to only send one collective
order to the PLC.
Figure 3-54
For more information regarding scripting read the SIMATIC WinCC Unified – Tips and Tricks for Scripting (Java Script).
3.5. Others
• Consider the used acquisition cycle for PLC tags
Figure 3-55: Acquisition cycle for HMI tags with PLC connection
• Only relevant for PC-RT: Script Debugger should be disabled in productive use of the runtime project
If there are a lot of instances of this object (e.g., 20), but not all data of all instances need to be available at once in
runtime, there is the option of multiplexing. Thereby only a subset from this array (e.g., 5 motors) is addressed and when
the data of another motor is required only the reference to the instance needs to be changed by selecting another index
of the array.
Sometimes the UDTs are much more complex and store a lot of data that might be necessary for the PLC but not for the
HMI.
Figure 3-59: Complex PLC UDT with more data than required in HMI
Solution
If only a small amount of the data from the UDT instances is required in the visualization, do not use the multiplexing.
Even if only one datapoint from the UDT is linked to an HMI property, when changing the concrete instance of the UDT,
the whole structure is loaded from PLC and not only the part that is needed.
For data stored in complex PLC UDTs load each UDT as an own instance and do not use arrays with multiplexing.
Every time an index is changed the whole structure at the PLC will be refreshed even if it is not in use.
4. Analysis of an existing
project
When there is already an existing project, regardless of whether problems have already occurred during runtime or not, it
is always beneficial to carry out an analysis whether there are opportunities for improvement in the engineering of a
project. In this section a guideline is provided that shows you all possibilities to further analyze your WinCC Unified
project and therefore also gives you an overview about a possible step-by-step analysis procedure.
If there is a known problem in runtime (screens are loaded slowly, some functionality is not working as intended), you
can directly jump in the object or script analysis. Otherwise, you can test the project on the target device in runtime and
check if everything works as expected.
For an analysis it is also important to be familiar with the general runtime workflow (e.g., the order of running scripts)
and what is running maybe in the background (e.g., cyclic scripts for timers), to be able to go to the responsible location
(script, configuration, task) in the engineering when a problem is found. If there is to less knowledge about the running
scripts and order of processing during runtime, the Google Chrome script debugger gives a good opportunity to
automatically navigate through all the executed scripts during screen load, event execution through a button click or a
specific screen change.
Another method is to put traces into scripts and check through the RTIL Trace Viewer when they are triggered.
Once you are familiar with the general script execution and processes in your project, you have a good knowledge base
for the further analysis.
The following scheme shows a possible procedure in which order and how to choose the tools for analyzing the project,
when to look at the runtime or when to focus more on the scripting part of the project. The analysis also consists of two
parts, the object and the script analysis. The order, which one is made first, can be changed depending on the project.
All procedures that are mentioned in the flow chart are described in detail in the following chapters.
General
analysis of a
project
Put traces in the necessary scripts to find out through the RTIL Trace viewer to
indicate some critical scripts or issues or screens with long loading times
Apply the
ShowScripts
add-in
Object Analysis
Is the issue
Summarize the item count for these related to Summarize the item counts for screens (and
screens with the exported table specific ist context) with high quantity structure
Yes screens? No
Are
Count the objects within the faceplates
faceplates manually, summarize with used in
screen items and compare again with screen
system limits Yes context?
No
Script Analysis
The following flowchart shows the different possibilities for script analysis.
Script Analysis
Are there
also global
Use the JS Connector to analyse the script
global modules also with keywords modules
Yes No
used?
Are there
Analyse the scripts manually in TIA Portal Scheduled
Tasks used No
Yes
NOTE Please be aware to download the most current version of the add-in to take benefit from the latest
bugfixes.
After the download of the .zip folder of the ShowScripts add-in, it needs to be installed in TIA Portal. Please refer to the
respective application example in the Siemens Industry Online Support for a description how add-ins can be installed and
used.
The add-in is ready for use as soon as you can see the green status in the add-ins task card in the top right corner.
• All scripts which are used on the screen items within every screen as a js file
• A tabular overview (csv file) of all screens and its respective screen item amount
For the initial analysis of a device in your project select the option “Export all scripts of HMI” to start the project analysis.
As next step the TIA Portal will ask you for confirmation that the add-in will access your project’s data via Openness which
you need to confirm with “Yes to all”.
After “yes to all” has been executed, a window opens in which you have to assign a screen name.
Afterwards you will see the analysis progress of the add-in in the command window. If the tool runs successfully the
command window will close itself after running through all the screens in the device. In the folder “UserFiles” of your TIA
Portal project folder there will be a new folder created with the respective device name in which you can find the
exported scripts and a csv-based screen overview file.
Therefore, the first step is to bring the analysis data into a well readable format.
1. Mark the first column which contains the comma-separated data.
2. Go to the register card “Data” and select the option “Text to Columns”.
3. A wizard will open which guides you to get the right format. It is important to set the delimiter “comma” in the
second step of the wizard. Afterwards the wizard can be finished, and you will see the values separated into
columns.
4. The readability can be increased even more by auto-fitting the column width depending on the table head texts.
Therefore, all columns need to be marked and the option “AutoFit Column Width” in the register card “Home”
needs to be selected.
After these two steps the readability of the screen analysis data is increased considerably, and the analysis of the project
data can be started.
NOTE For the following chapters be aware that the ShowScripts add-in currently does not support the
analysis of objects and configurations inside faceplates but only the faceplate containers itself and its
properties.
Faceplates must be therefore analyzed manually in the library view of the TIA Portal project.
NOTE The screen context describes the total number of simultaneously existing screens windows with its
objects, tags and dynamizations in WinCC Unified based applications.
In the example below you can see that the screen “02_ScreenLayout” has several child screens which means that the
screen contains several screen windows with or without configured screens.
1
2
Figure 4-13 Example for screen window hierarchy in “child screens” column
Every child screen which means a screen window with or without configured screen is separated from another one with
an “&” letter. If there are two “&” letters following on each other this means that there is a screen window in the
respective screen which has an empty “screen” property like shown below.
Figure 4-15 Example for screen window with empty screen property
NOTE Be aware that the screen related system limits mentioned in the manual always refer to the overall
screen context which can contain several further screen window levels. This can result in a larger
footprint on the runtime load due to the additional objects, tags and dynamizations.
In complex applications it can be hard to check the whole screen context in the engineering system. Same applies to the
runtime application itself where screen windows can be invisible but still contain loaded screens with all its objects, tags
and dynamizations.
The ShowScripts add-in provides a better understanding of the screen context in your application with the child screens
information. This helps for avoiding overloaded screen contexts in an early stage of the project development or for later
implementation of measures to reduce the load footprint by using the best practice recommendations in chapter 3.
Since the content of faceplate instances on screens is not evaluated yet by the ShowScripts add-in, the number of objects
generated by them needs to be counted manually.
1 2
The "total number of tags" is the sum of all tags that are used as trigger on the screen. These trigger tags will be
subscribed to the PLC on screen loading and will influence the screen loading time. Trigger tags are used in
dynamizations only.
NOTE Expressions for the dynamization of objects (available since WinCC Unified V18) cannot be evaluated
by the ShowScripts add-in yet and are therefore not included in the counts of the screen overview file.
Examples for the described dynamizations can be found in chapter 3.2 Use of dynamizations.
Tag dynamizations
The “Tags-Dyn” column lists the amount of tag dynamizations configured on a screen.
Events
The “Events” column lists the sum of following configurations:
7. Events on screens and screen items
8. The amount of “on-change” triggered scripts at properties of screen items
NOTE Currently the ShowScripts add-in does not support the export of scripts inside faceplates, global
modules, scheduled tasks and libraries. The scripts inside faceplates and scheduled tasks must be
analyzed separately in the TIA Portal project.
For the global module and library scripts there is an alternative since WinCC Unified V19 to retrieve
script exports by use of the WinCC Unified JS Connector (see 4.2)
Therefore, download VS Code and once it is installed follow the further steps.
1. Open the program and drag & drop the whole export folder of ShowScripts add-in from the Windows Explorer into the
VS Code “Explorer” area.
2. Afterwards the content of the export folder will get listed in the left area of VS Code (1). As soon as you select any of
the script export files the content will be displayed in the work area of the application (2).
2
1
A B
NOTE Be aware that the ShowScripts add-in also exports function lists as scripts (see example B). The reason
is that system functions are only engineering related but during runtime they get executed as script
code as well.
4. By the use of the global search function of VS Code the exported scripts can be analyzed according to the best practice
recommendations in chapter 3.
5. In the example below the scripts get scanned for example for the keyword "SetTagValue" to be able to find relevant
scripts for the replacement with tag sets as described in chapter 3.4.2.1.
NOTE Furthermore, Visual Studio Code can use the style guide configuration, that offers verification and
automatic correction of script code inside the Visual Studio Code editor according to the programming
style guide specifications. The style guide configuration can be found also on SIOS
NOTE The WinCC Unified JS Connector extension is supported since WinCC Unified ES V19.
Below you can see an example for the usage of global modules. If you want to see the content of the used scripts in the
imported module the WinCC Unified JS Connector can be used.
The WinCC Unified JS Connector extension is free of charge and available in a separate entry of the Siemens Industry
Online Support (SIOS). With the extension following workflow can be applied by users for project analysis and
optimization:
1. Export of scripts in global modules from the TIA Portal project
Figure 4-30 Export function of the extension (1) with the exported files in the work directory (2)
2. Analysis and adaption of the scripts in VS Code (according to the best practices in chapter 3)
Figure 4-32
For more detailed information about the installation and usage of the WinCC Unified JS Connector please refer to the
provided manual in the extension related SIOS entry.
The RTIL Trace Viewer is an external application provided with the WinCC Unified installation. It displays all available trac e
messages that a Unified Basic/Comfort Panel or PC Runtime provides during runtime operation.
NOTE The setup procedure for using the RTIL Trace Viewer on WinCC Unified based devices is described more
detailed in the following FAQ:
Use of Trace Viewer with WinCC Unified Comfort Panel or WinCC Unified PC Runtime
The procedure described for the Unified Comfort Panels also applies the identically for the Unified
Basic Panels.
An example for such errors is visible below in which a configured script tries to access an object (“Button_4”) in the
runtime which does not exist and therefore error messages are shown.
The execution result of the script is shown understandably in the RTIL Trace Viewer and needs to be resolved by
adapting the loop in the script.
NOTE For better analyzability of the traces in the RTIL Trace Viewer, special display filters can be applied to
the default view. In order to see just the script related traces you can set the filter for “Subsystem” to
“ScriptFW”.
2. The Trace Viewer can be an alternative to detect and understand possible failures of scripts in the project. As there is
no further debugging possibility on the Unified Basic/Comfort Panel hardware the usage of trace messages in
conjunction with the RTIL Trace Viewer can help to:
For the Unified PC Runtime, a useful alternative to the Trace Viewer could be the Script Debugger which is described in
the next chapter.
NOTE Further information about the usage of the trace viewer and configuration of trace messages can be
found in the document SIMATIC WinCC Unified - Tips and Tricks for Scripting (JavaScript) in chapter
5.16.2 “Diagnosis with RTIL Trace Viewer”.
The debugger offers you further possibilities for script analysis offering typical functions like setting breakpoints and step-
by-step execution.
NOTE A detailed description about the setup and usage of the Script Debugger in WinCC Unified is available
in the WinCC Unified Engineering (V18) manual.
• See which scripts get executed in certain operating scenarios. When a breakpoint is set e.g. in a loaded event, by
clicking through the single steps, also all following script executions are shown.
• Check how often these scripts are executed, by counting how often a breakpoint is reached in a script.
If you want to debug the script executions during the screen change the project needs to be prepared in a certain manner
to be able to debug the simultaneously executed scripts. The following steps show how to configure a breakpoint in the
load event of the base screen and trigger the loading again for stepping through all scripts that are executed during the
initial screen load as this is the more difficult configuration from the two mentioned above.
2. Configure a code in the loaded event of the projects base screen. This is used later to set a break point at the position
where the base screen starts loading. Define an event that you can trigger during runtime (e.g., through a mouse click
event of a screen item), that toggles the base screen from one that is not your current base screen and then back to
the original base screen. If you only set the base screen again to the original one, the loaded event will not be
triggered.
Figure 4-37 Refresh of the base screen and code for the loaded event
3. Start the Runtime
4. Open an additional browser window and type: chrome://inspect/
Every script that is executed will be shown. Once you want to end the debugging and execute the rest of the scripts at
once, click on the “Resume script execution” button. If there are more breakpoints defined, the debugger will jump to the
next breakpoint.
Figure 4-45 Google Chrome inspect page for selection runtime session
5. Appendix
5.1. Service and support
SiePortal
The integrated platform for product selection, purchasing and support - and connection of Industry Mall and Online
support. The SiePortal home page replaces the previous home pages of the Industry Mall and the Online Support Portal
(SIOS) and combines them.
Technical Support
The Technical Support of Siemens Industry provides you fast and competent support regarding all technical queries with
numerous tailor-made offers – ranging from basic support to individual support contracts.
Please send queries to Technical Support via Web form: support.industry.siemens.com/cs/my/src
\3\ Beginners Guide: Quick entry and conversion with WinCC Unified
https://support.industry.siemens.com/cs/ww/en/view/109810917
\6\ SIMATC WinCC Unified – Tips and Tricks for Scripting (JavaScript)
https://support.industry.siemens.com/cs/ww/en/view/109758536
\7\ TIA-Add-In-ShowScripts
https://github.com/tia-portal-applications/TIA-Add-In-ShowScripts
\8\ Developing WinCC Unified JavaScript code and checking style guide with Visual Studio Code
https://support.industry.siemens.com/cs/ww/en/view/109801600