Professional Documents
Culture Documents
Wincc Scada - Diagnostics
Wincc Scada - Diagnostics
Diagnostics
Siemens
WinCC V7.4 SP1 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109757865 Support
Legal information
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
Siemens AG 2018 All rights reserved
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
at: https://www.siemens.com/industrialsecurity.
Table of contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Diagnostic tools .................................................................................... 6
1.3 Components used ................................................................................ 7
2 Script diagnostics .............................................................................................. 8
2.1 VBS actions .......................................................................................... 8
2.1.1 Trace statement ................................................................................... 8
2.1.2 Error handling ....................................................................................... 9
2.1.3 Script debugger .................................................................................. 10
2.1.4 Debugging with Visual Studio ............................................................ 13
2.2 C actions............................................................................................. 16
2.2.1 printf instruction .................................................................................. 16
2.2.2 Diagnostics tags ................................................................................. 17
2.2.3 Application diagnostics (ApDiag) ....................................................... 17
2.2.4 Debugging with ApDiag ...................................................................... 18
2.3 Log files .............................................................................................. 22
2.4 Global Script Inspector ....................................................................... 23
3 Appendix .......................................................................................................... 24
3.1 Service and Support ........................................................................... 24
Siemens AG 2018 All rights reserved
1 Introduction
1.1 Overview
During technical problem solving, it is usually advantageous to proceed
systematically. For a SCADA application such as WinCC, the following steps are
recommended:
1. Problem determination
2. Problem description
– Performance
– Connection problems
– Installation problem
– sporadic or reproducible error
– different areas, e.g. script, graphic runtime
3. Diagnostics (cause research)
– Configuration error
– Software fault
– Hardware fault
4. Troubleshooting
Siemens AG 2018 All rights reserved
Fig. 1-1
4
3 Troubleshooting
2 Diagnostics
1
Problem determination
Problem description
Note This application example will be gradually expanded. The topic "script
diagnostics" will be discussed in the first step.
Other topics, such as
• log files,
• general diagnostic tools,
• diagnostic tools for communication,
• avoiding errors through prevention,
Required knowledge
Basic knowledge of WinCC V7 is required.
Note Basics are taught in the SITRAIN course "SIMATIC WinCC, System Course."
• SIMATIC WinCC, system course (de)
• SIMATIC WinCC, System Course (en)
Siemens AG 2018 All rights reserved
Often, a combination of the various tools is helpful, e.g. in the form of performance
monitoring and log files.
Fig. 1-2
2 Script diagnostics
2.1 VBS actions
2.1.1 Trace statement
The targeted implementation of trace statements, e.g. for the output of tag values,
enables the progress of actions and the procedures called in them to be traced.
To display trace statements, you need a special application window in your screen.
This application window, the GSC diagnostics, returns the trace statements
contained in the VBS actions in the order in which they are accessed. This also
applies to trace statements in procedures accessed in actions.
1. From the "Smart Objects" object palette, paste the "Application Window" into
your screen.
2. Select the entry "Global Script" from the "Window Contents" dialog and confirm
by pressing "OK".
Siemens AG 2018 All rights reserved
General Information
Error handling in VBS is not as convenient as in other high-level languages. For
example, no jump labels or goto instructions are used.
If you want to implement error handling in VBS, you must program it yourself. The
error object provides the following properties and methods for this:
Table 2-1
Properties
Err.Number Error number of the last script error (no error = 0)
Err.Source Provides the name of the error source (application)
Err.Description Error description as plain text
Table 2-2
Methods
Err.clear Reset error object (Err.Number = 0)
Implementation
To evaluate possible script errors at runtime, implement the following error handler
Siemens AG 2018 All rights reserved
in your code:
1. At the beginning of the code, use the instruction "On Error Resume Next". This
prevents you from stopping further script processing in the event of a runtime
error.
2. Then write the actual code to be executed.
3. At the end of the code the error handling then takes place:
– With "IF Err.Number <> 0 THEN" ask if a runtime error occurred.
– If this is the case, a branch is made in the IF statement and the runtime
error is issued in plain text with "Err.Description."
– The error object is reset with "Err.clear."
– Close the IF statement with "END IF."
Fig. 2-2
WinCC supports runtime debugging for global scripts and scripts in screens. To
test your VB scripts in runtime, you can use the Microsoft Visual Studio 2008
debugger.
Note The debugger of "Microsoft Visual Studio 2008" is supplied with the WinCC
setup. If another Visual Studio version is already installed, for example "Microsoft
Visual Studio 2010," use the debugger of this version.
Installation
To use the debugger in WinCC, you must start Setup and specify instance "Visual
Studio 2008" as the default:
1. During the installation of WinCC, the "VS 2008 Shell Redist" folder is created
on a drive of the PC, for example, as "D:\VS 2008 Shell Redist." Start the
Setup with the following file: "D:\VS 2008 Shell Redist\Integrated
Mode\Vside.enu.exe."
If the folder "D:\VS 2008 Shell Redist" is not on your PC, you can create it
later. To do this, start the "vs_ideredist.exe" application in the
"...\InstData\VSRedist\Setup" folder of the WinCC installation DVD.
2. Follow the instructions and accept the default settings.
3. The following program is installed: "Microsoft Visual Studio 2008 Shell
Siemens AG 2018 All rights reserved
Note Please note that your code displayed in the debugger is write-protected. You
cannot modify the code directly in the debugger, but rather only test the changes
made.
4. Select "Start debugger" when the debugger should be started directly following
an error in the runtime.
5. Select "Display Error Dialog" if you do not want to start the debugger directly,
but wish to display an error dialog with information about the error. The
debugger can be started from the error dialog by means of a button.
Fig. 2-4
Siemens AG 2018 All rights reserved
DF FA S SUP HMI
Setting breakpoints
1. Start the debugger and select the script. If you have selected the automatic
activation of the debugger in WinCC, the debugger is called up as soon as a
faulty script is executed.
2. Place the cursor in the action where you want to set a breakpoint.
3. From the "Debug" menu, choose "Toggle Breakpoint" or its icon from the
toolbar.
The next executable line is marked with a red dot.
Fig. 2-6
4. Change to the WinCC runtime and execute the action that you want to debug.
The debugger stops at the first breakpoint it finds in the script. The current line
is highlighted in yellow. You can now go through the script step by step.
Siemens AG 2018 All rights reserved
Fig. 2-7
Clearing breakpoints
1. Place the cursor in the line whose breakpoint you want to clear.
2. Select the entry "Toggle Breakpoint" from the "Debug" menu.
3. The line is displayed again without marking.
4. To clear all breakpoints in a script, select "Clear all Breakpoints" from the
"Debug" menu.
Fig. 2-8
2.2 C actions
2.2.1 printf instruction
Through the targeted use of printf instructions, for example to issue tag values, the
sequence of actions and the functions called in it can be tracked.
To display printf instructions, you need a special application window in your screen.
This application window, the GSC diagnostics, returns the printf instructions
contained in the C actions in the order in which they are accessed. This also
applies to the printf instructions in functions that are called up in actions.
Note Specify the printf instructions in the format "printf ("\ r \ n value1:% d", sum);". For
performance reasons, you should delete the printf statements after you have
tested the scripts.
The printf() instructions can contain a maximum of 360 characters.
1. From the "Smart Objects" object palette, paste the "Application Window" into
your screen.
2. Select the entry "Global Script" from the "Window Contents" dialog and confirm
by pressing "OK".
3. Select the entry "GSC Diagnostics" from the dialog "Template".
Siemens AG 2018 All rights reserved
WinCC offers a number of system tags, including three diagnostic tags, for the
status display of script processing.
Table 2-3
Tag name Meaning
@SCRIPT_COUNT_TAGS This tag contains the current number of
script-requested tags.
@SCRIPT_COUNT_REQUESTS_IN_QUEUES This tag contains the current number of
jobs.
@SCRIPT_COUNT_ACTIONS_IN_QUEUES This tag contains the current number of
actions pending for processing.
Note For performance reasons, the diagnostic tags are not supplied with current
values by default.
There are two ways to turn on the update for diagnostic purposes:
• In the script with the function "void FillDiagnoseInTags (BOOL bFill);"
• With ApDiag in the menu "Diagnostics> FillTags ...> OnTags ON"
Parameter "bFill":
TRUE = switch on the supply of the diagnostic tags.
FALSE = switch off supply of diagnostic tags.
Siemens AG 2018 All rights reserved
The "ApDiag.exe" diagnostic tool supports the analysis of errors and performance
issues.
"ApDiag.exe" is located in the folder "...\Siemens\WinCC\uTools" of the WinCC
installation path.
Description
As soon as WinCC is open, you can start the ApDiag application as usual (double-
click). It does not matter if the runtime is activated or not. If no project is open, no
connection to the action control can be established.
When a project is changed and when WinCC is closed, ApDiag is terminated.
ApDiag is in the foreground in order to always have a view of the diagnostic
information independent of operation and navigation in the system. Set your
window position and size so that ApDiag disturbs as little as possible. These
settings are saved and reestablished again during the next startup.
Menu items
The menu bar is constructed as follows:
Figure 2-10
Siemens AG 2018 All rights reserved
• File
• Diagnostics
– Using "Start," "Change" and "Stop," the recording of diagnostic
information (trace) can be controlled. Different trace levels can be defined.
– Using the "OnFile" dialog, diagnostic information (e.g. “OnErrorExecute,"
"printf") can be converted into a text file. All settings are saved in the
registry and restored after a reboot.
Fig. 2-11
Siemens AG 2018 All rights reserved
• Output
– The menu command "Output On Screen" opens the diagnostics window.
The previously collected trace entries are output here. Unlike the output
window, the diagnostics window is only updated when opening and with
the "Refresh" button. The contents are only deleted if "Reset" is actuated
or the diagnostics buffer has been written full.
Fig. 2-12
Note
The diagnostics buffer is a circulating buffer. The lowest entry is therefore
not necessarily the oldest entry.
– Menu command "Output To File" can be used one time to put the
Siemens AG 2018 All rights reserved
At the end of the list, the total sum of tags requested in transactions is
output.
– Menu command "Count of Actions in Cycle" lists the amount of cyclic
actions sorted by trigger.
– Menu command "Count of Functions" provides the number of standard
functions and project functions and lists the functions by name.
• Trace points
– The levels of certain trace points can be changed with the menu command
"Change Level."
If you expect e.g. only one certain trace point, you can set the respective
level high and are no longer disrupted by a number of other trace points.
You can change the level by double clicking "Actual Level" for the desired
trace point, setting the desired level in the dialog box and leaving the box
Siemens AG 2018 All rights reserved
with "OK."
The original level is set again with "Reset."
• Output Window
– Opens or closes the output window.
Fig. 2-13
In the case of script errors, WinCC can also generate alarm messages that are in
the message number range from 1007000 to 1007009.
The prerequisite for this is the activation of the corresponding system alarms:
Fig. 2-15
Fig. 2-16
1
Siemens AG 2018 All rights reserved
3 Appendix
3.1 Service and Support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
https://support.industry.siemens.com
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:
www.siemens.com/industry/supportrequest
Siemens AG 2018 All rights reserved
Note Basics are taught in the SITRAIN course "SIMATIC WinCC, System Course."
• SIMATIC WinCC, system course (de)
• SIMATIC WinCC, System Course (en)
Topics for troubleshooting and diagnostics are taught, among many other topics,
in the course "SIMATIC WinCC, Advanced Course."
• SIMATIC WinCC, advanced course (de)
• SIMATIC WinCC, advanced course (en)
Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
https://support.industry.siemens.com/cs/sc
Table 3-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the article page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109757865
\3\ Application example "Diagnostics of SIMATIC IPCs"
https://support.industry.siemens.com/cs/ww/en/view/109478242