wincc scada –diagnostics · 1 introduction wincc scada diagnostics entry id: 109757865, v1.0,...

25
WinCC SCADA – Diagnostics WinCC V7.4 SP1 https://support.industry.siemens.com/cs/ww/en/view/109757865 Siemens Industry Online Support

Upload: vandung

Post on 29-Aug-2019

420 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

WinCC SCADA –Diagnostics

WinCC V7.4 SP1

https://support.industry.siemens.com/cs/ww/en/view/109757865

Siemens Industry Online Support

Page 2: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

Legal information

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 2

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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 at: https://www.siemens.com/industrialsecurity.

Page 3: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

Table of contents

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 3

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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 3.2 Links and Literature ............................................................................ 25 3.3 Change documentation ...................................................................... 25

Page 4: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

1 Introduction

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 4

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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

Fig. 1-1

12

34

Troubleshooting

Diagnostics

Problem description

Problem determination

This application example focuses on step 3 (diagnostics), in particular:

• How do you diagnose the application?

• Where can you find useful information?

• Which diagnostic tools are available to you?

Page 5: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

1 Introduction

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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,

will be added to this document in loose order.

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)

Page 6: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

1 Introduction

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 6

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

1.2 Diagnostic tools

For the diagnostics of WinCC, you can use various tools provided by the components involved:

• Operating system (Windows)

• Database (SQL server)

• WinCC with its basic functions

• WinCC with its options packages

Often, a combination of the various tools is helpful, e.g. in the form of performance monitoring and log files.

Fig. 1-2

WINDOWS WinCC

Diagnostics - OPTIONS

WinCC

Diagnostics - BASIC

APDIAG

Log files

Performance monitorSDT

EventViewerLog files

Redundancy Control

Channel Diagnostics

Script Debug

IIS

ALM

Server-Client-Connection

SQL Server

SQL Profiler

SQL Server Log Files

ActivityMonitor

Windows Problem

Steps Recorder (PSR)

Resource Monitor

… …

Report Runtime Diagnostics

PH Console

Status page of

WebNavigator

Page 7: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

1 Introduction

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 7

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

1.3 Components used

This application example was created using these hardware and software components:

Table 1-1

Component Number Article number Note

Engineering station 1 Development computer

SIMATIC WinCC V7.4 1 6AV63.1-....7-4...

MS SQL Server 2010 1

This application example consists of the following components:

Table 1-2

Component File name Note

Documentation 109757865_WinCC_Diagnostics_en.pdf This document

Page 8: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 8

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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.

Note You specify the trace statement in the format "HMIRuntime.Trace <Variable>.Value". For performance reasons, you should clear the trace statements after you have tested the scripts.

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".

4. Confirm with "OK" to insert the diagnostics window.

Fig. 2-1

Page 9: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 9

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.1.2 Error handling

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 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

Page 10: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 10

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.1.3 Script debugger

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 (Integrated Mode) – NEW."

4. The first time you start the debugger, the "Visual Studio Just-In-Time Debugger" dialog opens.

5. Select the entry "New instance of Visual Studio 2008."

6. To set "Visual Studio 2008" as the default debugger, enable the "Set the currently selected debugger as the default."

The following functions are supported:

• Viewing the source code of the script to be debugged.

• Step-by-step processing of the scripts to be checked.

• Change the tags and property values.

• Viewing and controlling the script flow.

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.

There are several ways to enable the debugger:

• Automatic activation of the debugger when an error occurs in runtime.

• Opening an error dialog in runtime via which the debugger can be activated.

• Starting the debugger from the Start menu and opening a running runtime script.

Page 11: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 11

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Automatic access, showing an error dialog

1. In the computer's context menu in WinCC Explorer, select the command "Properties." The "Computer Properties" dialog opens.

2. Select the "Runtime" tab.

3. Activate the desired debug options. The debug behavior for actions in Global Script and Graphics Designer can be set independently of each other:

Figure 2-3

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

4

5

6. Click "OK" to confirm your entry.

Page 12: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 12

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Starting the debugger from the Start menu

If the Microsoft Script Debugger is accessed via Windows instead of automatic activation using WinCC, scripts which are currently running can be accessed for editing in runtime.

Define a connection in the debugger to the respective processes, "pdlrt.exe" for the Graphical Runtime System and "gscrt.exe" for the Global Runtime System.

• Start Microsoft Visual Studio 2008: "START > Programs > Microsoft Visual Studio 2008"

• Create a new script file: File > New > File… > Script template "Windows Script Host."

• Start debugging with "Debug > Attach to Process" and select gscrt.exe or pdlrt.exe, for example.

Fig. 2-5

DF FA S SUP HMI

Note • To debug a picture, the following prerequisites must be met:

– Runtime is activated.

– The picture to be debugged is active.

• It is possible to stop the debugger without exiting the WinCC runtime.

• The first time you start the debugger, the "Visual Studio Just-In-Time Debugger" dialog opens. Select the entry "New instance of Visual Studio 2008." To set "Visual Studio 2008" as the default debugger, enable the "Set the currently selected debugger as the default."

Page 13: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 13

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.1.4 Debugging with Visual Studio

Executing scripts step-by-step

You can execute your scripts step-by-step to test the effects of each individual line of script in the runtime, or to limit logical errors.

1. Activate the document to be debugged in runtime.

2. Manually start the debugger from the start menu and open the desired script file or activate the debugger in WinCC. When activated in WinCC, the debugger automatically opens when a faulty script is executed.

3. Put a breakpoint in the script file. Breakpoints are typically placed before lines of code in which you suspect errors.

4. Switch to WinCC runtime and trigger an action that causes the script to run. The debugger stops at the first breakpoint and marks the current line.

5. Select one of the following menu commands to go through the script document step-by-step:

– "Debug > Step Into:" Goes to the next code line.

– If the script in this line calls up a procedure, use the "Step Into" command to jump to this procedure. You can then process the accessed procedure step by step.

– "Debug > Step Over:" Skips the called up procedure. The procedure is run, but the debugger does not guide you through the individual lines of the procedure. Instead, it leads you to the next line of the current script after the procedure has been executed.

6. To abort the step-by-step execution of a procedure, select the menu command "Debug> Step Out." The debugger then jumps to the next action.

7. Proceed step by step to the end of the document or select the menu command "Debug> Run" to restart the script in runtime.

Page 14: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 14

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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.

Fig. 2-7

– The code can be traversed line by line with <F11>.

– Tag values can be observed in the window "Watch."

– The yellow arrow (current script position) can be moved with the mouse to another line of code (e.g. to leave the loop).

– <F5> continues the script until the next breakpoint.

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.

Page 15: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 15

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Setting and clearing bookmarks

During debugging, you can bookmark lines of code to make it easier to find a line later.

• Place the mouse pointer in the line in which you want to bookmark.

• Press <Ctrl + F9> to set a bookmark.

• Press <Ctrl + Shift + F9> to clear a bookmark.

• Press <F9> to go to the next bookmark in the script.

• <Shift + F9> takes you to the previous bookmark in the script.

Monitoring tags and objects

While a script is running in runtime, you can use the debugger "Watch Window" to find values of tags or objects.

1. Set at least one breakpoint in the current script.

2. Switch to WinCC runtime and execute an action that executes the script.

3. Activate the entry "Windows> Watch> Watch 1" in the “Debug menu. The "Watch Window" opens.

4. To find the value of a tag or property, enter "?" followed by a space and the name of the tag or property you want to find, such as "? myTag." Press <Return> to execute the command.

Fig. 2-8

Page 16: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 16

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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".

4. Confirm with "OK" to insert the diagnostics window.

Fig. 2-9

Page 17: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 17

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.2.2 Diagnostics tags

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.

More information on application diagnostics (ApDiag) can be found in the chapter 2.2.3.

2.2.3 Application diagnostics (ApDiag)

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.

The application diagnostics offers the following functions:

• Output of trace entries

• Saving all diagnostic data to files

• Script runtime monitoring

• Output of trace & script errors

• Detailed information about ongoing actions

Page 18: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 18

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.2.4 Debugging with ApDiag

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

Page 19: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 19

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

• 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

– The "Profiles" command allows the early detection of queue growth or overflow. The duration of actions can be measured and an increase in the queue can be checked.

– The "FillTags" command enables and disables the saving of important diagnostic information in internal tags.

Page 20: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 20

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

• 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 previously collected trace entries into a text file.

– Use menu command "Reset Buffer" to delete the previously collected trace entries. This functionality corresponds with the "Reset" button in the diagnostics window.

• Info

– The menu command "First Action" delivers information on the currently running action and therefore provides the possibility of recognizing which action in the queue is in the first position and e.g. blocks the processing of other actions with a loop.

– The menu command "Count of Connections" lists all applications that have established a connection to the action control.

– Menu command "Count of Actions in RequestQueue" outputs the current number of actions that are queued for processing. There are jobs from Global Script, cycle jobs from pictures and event-controlled jobs from pictures.

– Menu command "Count of TransAction" lists the current number of transactions for every application that is logged in. One transaction is established e.g. for every event-controlled action, for every picture window, which contains at least one cyclic action, and for global scripts.

– Menu command "Count of Actions of each Transaction" lists the number of actions contained in the transactions. The output is composed as follows: - Name of the application - Number of the transaction - Number of actions

Page 21: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 21

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

– Menu command "Count of Tags in each Transaction" lists the number of tags requested in the transactions. The output is composed as follows: - Name of the application - Number of the transaction - Cycle time when the tags are logged - Number of tags 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 with "OK." The original level is set again with "Reset."

• Output Window

– Opens or closes the output window. The output window corresponds with application window GSC diagnostics, but offers the following advantages: It is independent of the configuration. The configuration does not have to be accessed, especially with third-party projects. It also remains visible during a picture change. It can be opened even before activating runtime and can therefore show error messages during power up, which remain hidden from the application window GSC diagnostics.

Fig. 2-13

Page 22: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 22

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.3 Log files

An access violation in C or VB scripts generates the "Script.log" file. The file "ApDiag.exe" is located in the folder "...\Siemens\WinCC\Diagnosis" of the WinCC installation path.

It contains, for example:

• Screen names

• Object names

• Properties / events

• Script name

• Line number of the error in the script

The corresponding information is also displayed in the WinCC diagnostics window or in APDiag

Fig. 2-14

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

Page 23: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

2 Script diagnostics

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 23

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2.4 Global Script Inspector

The "CCScriptInspector.exe" diagnostic tool examines the source code of the global scripts and indicates potential errors at runtime.

"CCScriptInspector.exe" is located in the folder "...\Siemens\WinCC\ uTools" of the WinCC installation path.

1. All global scripts can be examined via "Action> Check All" (1).

2. The output window contains warnings (2) and possibly errors of the global scripts, which could lead to problems in the service mode.

Fig. 2-16

1

2

Page 24: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

3 Appendix

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 24

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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

SITRAIN – Training for Industry

We support you with our globally available training courses for industry with practical experience, innovative learning methods and a concept that’s tailored to the customer’s specific needs.

For more information on our offered trainings and courses, as well as their locations and dates, refer to our web page: www.siemens.com/sitrain

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)

Page 25: WinCC SCADA –Diagnostics · 1 Introduction WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 5 G 8 d Note This application example will be gradually expanded

3 Appendix

WinCC SCADA Diagnostics Entry ID: 109757865, V1.0, 09/2018 25

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

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

Industry Online Support app

You will receive optimum support wherever you are with the "Siemens Industry Online Support" app. The app is available for Apple iOS, Android and Windows Phone: https://support.industry.siemens.com/cs/ww/en/sc/2067

3.2 Links and Literature

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

3.3 Change documentation

Table 3-2

Version Date Change

V1.0 09/2018 First version