456
WinCC Configuration Manual Manual Volume 2 C79000-G8276-C140-01 Edition February 1999

WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

Embed Size (px)

Citation preview

Page 1: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

WinCC

Configuration Manual

Manual

Volume 2

C79000-G8276-C140-01

Edition February 1999

Page 2: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

WinCC, SIMATIC, SINEC, STEP are Siemens registered trademarks.

All other product and system names in this manual are (registered) trademarks of their respective owners andmust be treated accordingly.

(The reproduction, transmission or use of this document or itscontents is not permitted without express written authority.Offenders will be liable for damages. All rights, including rightscreated by patent grant or registration of a utility model ordesign, are reserved.)

(We have checked the contents of this manual for agreementwith the hardware and software described. Since deviationscannot be precluded entirely, we cannot guarantee fullagreement. However, the data in this manual are reviewedregularly and any necessary corrections included in subsequenteditions. Suggestions for improvement are welcomed.)

Siemens AG 1994 - 1999 All rights reserved Technical data subject to change

C79000-G8276-C140-01Printed in the Federal Republic of Germany Siemens Aktiengesellschaft

Page 3: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

WinCC Configuration Manual iC79000-G8276-C140-01

Table of Contents

1 Configuration - Examples ......................................................... 1-1

2 Tags (Project: varia_00.mcp).................................................... 2-12.1 Creating, grouping and moving tags............................................. 2-22.2 Incrementing, decrementing and jogging...................................... 2-72.2.1 Jogging - changing a set value (example 01)................................ 2-82.2.2 Jogging - changing a set value using Global Script (example 02) . 2-102.2.3 Jogging - buttons (example 05).................................................... 2-132.2.4 Jogging - changeover switch (example 06)................................... 2-172.2.5 Incrementing and decrementing (example 01).............................. 2-192.2.6 Incrementing and decrementing using Global Script (example 02) 2-222.2.7 The other examples related to this topic ....................................... 2-272.3 Changing tag value using Windows Objects................................. 2-282.3.1 Inputting by means of a slider with direct connection

(example 01)................................................................................ 2-292.3.2 Inputting by means of slider and tag connection (example 03)...... 2-322.3.3 Inputting by means of an Option Group (example 02)................... 2-342.3.4 Inputting by means of check box (example 04)............................. 2-362.4 Bit editing in words....................................................................... 2-392.4.1 Directly setting a bit with the aid of a check box and direct

connection (example 06).............................................................. 2-402.4.2 Selecting a bit and changing its state (example 01) ...................... 2-432.4.3 The other examples related to this topic ....................................... 2-462.5 Indirect addressing of tags ........................................................... 2-472.5.1 Indirect addressing by means of a direct connection

(example 01)................................................................................ 2-482.5.2 Multiplex display using indirect addressing and a C action

(example 02)................................................................................ 2-502.5.3 Indirect addressing by means of C action (example 03)................ 2-522.5.4 The other examples related to this topic ....................................... 2-542.6 Simulation of tags ........................................................................ 2-552.6.1 Simulating a triangular oscillation by means of a C action

(example 01)................................................................................ 2-562.6.2 Simulation by means of an external program (example 02) .......... 2-592.7 Importing / exporting tags............................................................. 2-612.8 Using structure tags ..................................................................... 2-632.8.1 Valve control by means of a structure tag (example 01) ............... 2-642.9 Serial connection to S5 ................................................................ 2-672.9.1 The other examples related to this topic ....................................... 2-68

3 Picture configuration (Project: pictu_00.mcp)........................ 3-13.1 Screen layout and changing pictures............................................ 3-33.1.1 Laying out the screen................................................................... 3-43.2 Picture change............................................................................. 3-63.2.1 Opening a picture by means of a direct connection and

displaying the picture name (example 01) .................................... 3-7

Page 4: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

7DEOH�RI�&RQWHQWV �����

ii WinCC Configuration ManualC79000-G8276-C140-01

3.2.2 Opening a picture by means of the Dynamic Wizard(example 02) ............................................................................... 3-12

3.2.3 Opening a picture by means of internal function (example 02)...... 3-143.2.4 Single picture change by means of the Dynamic Wizard

(example 03) ............................................................................... 3-153.2.5 Single picture change by means of a direct connection

(example 04) ............................................................................... 3-173.2.6 Opening a picture by means of the object name and an internal

function (example 05) .................................................................. 3-193.2.7 Opening a picture by means of the object name and a tag

connection, with display of the picture name (example 06) ........... 3-213.3 Shutdown WinCC / access protection .......................................... 3-253.3.1 Shutting down (exiting) runtime and the system (example 01) ...... 3-263.3.2 Access protection, login by means of a standard box

(example 02) ............................................................................... 3-283.3.3 Operator-Control Enable, login in a separate dialog box

(example 03) ............................................................................... 3-313.4 Showing a picture window............................................................ 3-333.4.1 Showing and hiding from outside a picture window (example 01) . 3-343.4.2 Showing from outside and hiding from inside a picture window

(example 02) .............................................................................. 3-363.4.3 Time-controlled hiding of a picture window (example 03).............. 3-373.4.4 Showing a picture window while holding down the right mouse

button (example 04)..................................................................... 3-393.4.5 Configuring info (instruction) boxes with the wizard (example 05). 3-403.4.6 Showing a dialog box for entering text (example 06) .................... 3-443.5 Zoom........................................................................................... 3-463.5.1 Changing picture geometry between two sizes (example 01) ....... 3-473.5.2 Changing the picture geometry steplessly (smooth zoom)

(example 02) ............................................................................... 3-503.5.3 Configuring adjustable picture geometry by means of the

properties dialog (example 03)..................................................... 3-523.6 Operator panels........................................................................... 3-533.6.1 Binary switching operation (two-step control) (example 01) .......... 3-543.6.2 Binary S/R switching operation (two-step control) (example 02) ... 3-563.6.3 Binary switching operation with acknowledgement (example 03).. 3-583.6.4 Automatic input check (example 04) ............................................ 3-603.6.5 Enhanced automatic input check (example 05) ............................ 3-623.6.6 Multiple operation (example 06) ................................................... 3-663.7 Dynamics .................................................................................... 3-703.7.1 Color change (example 01).......................................................... 3-713.7.2 Text exchange (example 02)........................................................ 3-733.7.3 Animation of movement (example 03).......................................... 3-743.7.4 Showing and hiding objects by means of bit evaluation

(example 04) ............................................................................... 3-753.7.5 Animation of movement by means of a C action (example 05) ..... 3-773.7.6 Create animation of movement by means of a wizard

(example 06) ............................................................................... 3-793.7.7 Color change by means of a C action (example 06) ..................... 3-813.7.8 Animation of movement by means of a status display

(example 07) ............................................................................... 3-82

Page 5: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 7DEOH�RI�&RQWHQWV

WinCC Configuration Manual iiiC79000-G8276-C140-01

3.8 Language switch.......................................................................... 3-843.8.1 Change runtime language (example 01)....................................... 3-853.8.2 Dialog box for changing the runtime and Control Center language

(example 02)................................................................................ 3-863.9 Working without a mouse............................................................. 3-873.9.1 Operation with the TAB key or hot key (example 01) .................... 3-883.9.2 Cursor keyboard (example 02)..................................................... 3-963.9.3 Value input, control actions (example 03)..................................... 3-1013.10 Showing and hiding information ................................................... 3-1043.10.1 Showing and hiding objects (example 01) .................................... 3-1053.10.2 Displaying the date and time (example 02)................................... 3-1073.11 Configuring messages ................................................................. 3-109

4 Additional Functions in WinCC (Project: example_01.mcp).. 4-14.1 Tag Logging................................................................................. 4-24.1.1 Cyclic-Continuous Archiving (ex_3_chapter_01.PDL) ................... 4-34.1.2 Cyclic-Selective Archiving (ex_3_chapter_01a.PDL) .................... 4-184.1.3 Archiving if Value is Exceeded (ex_3_chapter_01b.PDL) ............. 4-244.1.4 User defined table layout (ex_3_chapter_01c.PDL)...................... 4-334.1.5 Archiving of binary tags (ex_3_chapter_01d.PDL) ........................ 4-424.1.6 Archiving at Set Times (ex_3_chapter_01e.PDL) ......................... 4-464.1.7 Exporting an Archive (ex_3_chapter_01f.PDL) ............................. 4-504.2 Alarm Logging.............................................................................. 4-554.2.1 Bit Message Procedure (ex_3_chapter_02.PDL) .......................... 4-564.2.2 Bit Message Procedure (Continued)............................................. 4-694.2.3 Analog Alarms (ex_3_chapter_02a.PDL)...................................... 4-784.2.4 Analog Alarms (continued) ........................................................... 4-844.2.5 Message Window (ex_3_chapter_02b.PDL)................................. 4-954.2.6 Message Archiving (ex_3_chapter_02c.PDL) ............................... 4-984.2.7 WinCC Alarm Control (ex_3_chapter_02d.PDL)........................... 4-1054.2.8 Group Messages (ex_8_generator_00.PDL) ................................ 4-1094.3 Report Designer........................................................................... 4-1174.3.1 Picture Documentation (ex_3_chapter_03.PDL)........................... 4-1184.3.2 Reporting the Project Function (ex_3_chapter_03.PDL) ............... 4-1244.3.3 Reporting of the Control Center (ex_3_chapter_03.PDL).............. 4-1274.3.4 Reporting of Tag Logging CS (ex_3_chapter_03.PDL) ................. 4-1304.3.5 Print Out the Trend Window in Runtime (ex_3_chapter_01a.PDL) 4-1324.3.6 Printing Out the Table in Runtime (ex_3_chapter_01c.PDL)......... 4-1394.3.7 Message Sequence Report (ex_3_chapter_02b.PDL) .................. 4-1434.3.8 Message Sequence Report on a Line Printer ............................... 4-1464.3.9 Message Archive Report (ex_3_chapter_02c.PDL) ...................... 4-1484.4 OLE Communication to EXCEL.................................................... 4-1504.4.1 Reading and Writing Tag Values (ex_3_chapter_04.PDL) ............ 4-1514.5 Additional Configurations in the Examples.................................... 4-1554.5.1 Picture Register ........................................................................... 4-1564.5.2 Table of Contents ........................................................................ 4-1604.5.3 Dialog Boxes for Setting Colors (ex_3_chapter_01c).................... 4-1634.5.4 Bar Graph Display (ex_3_chapter_01e) ....................................... 4-166

5 User Archive .............................................................................. 5-1

Page 6: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

7DEOH�RI�&RQWHQWV �����

iv WinCC Configuration ManualC79000-G8276-C140-01

5.1 User Archive................................................................................ 5-25.1.1 Creating a User Archive (ex_3_chapter_01.PDL)......................... 5-35.1.2 Data Entry (ex_3_chapter_01.PDL) ............................................. 5-125.1.3 Configuring a Table View (ex_3_chapter_01.PDL) ....................... 5-165.1.4 Configuring a Form View (ex_3_chapter_011.PDL)...................... 5-245.1.5 Working with Control Tags (ex_3_chapter_012.PDL) ................... 5-295.1.6 Connecting via WinCC Tags (ex_3_chapter_01a.pdl) .................. 5-355.1.7 Connection via WinCC Raw Data Tags to the S5

(ex_3_chapter_01b.pdl) ............................................................... 5-505.1.8 Connection via WinCC Raw Data Tags to the S7

(ex_3_chapter_01c.pdl) ............................................................... 5-715.1.9 Status Monitoring of External Tags (ex_3_chapter_01c.pdl)......... 5-1005.1.10 Structure of raw data message frames......................................... 5-105

Page 7: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 7DEOH�RI�&RQWHQWV

WinCC Configuration Manual vC79000-G8276-C140-01

3UHIDFH

3XUSRVH�RI�WKH�PDQXDO

The purpose of this manual is to show you the options open to you when configuring withWinCC and it does this by means of the following sections:

• description of example project YDULDB��

• description of example project SLFWXB��

• description of example project H[DPSOHB��

The Contents or Index will point you quickly and easily to the information you require.This information is of course also available as an on-line document in HTML format andwith enhanced search functions.

You will find general information on effective and efficient configuration with WinCC inthe :LQ&&�&RQILJXUDWLRQ�0DQXDO��3DUW��.

5HTXLUHPHQWV�IRU�XVLQJ�WKLV�PDQXDO

Knowledge of WinCC �*HWWLQJ�6WDUWHG) or practical configuration experience usingWinCC.

$GGLWLRQDO�6XSSRUW

For technical questions, please contact your local Siemens representative at the responsiblebranch office.

Their addresses can be found at the "Siemens Worlwide Appendix" of the "S7-300Programmable Controller System, Hardware and Installtion Manual", in catalogs, and atCompuServe ("go autforum").

You can also direct your questions to our Hotline, which can be reached at:+49 (911) 895-7000 (Fax 7001).

Additional information can be found on the Internet at the address:www.aut.siemens.de/coros/html_00/coros.htm.

Page 8: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

7DEOH�RI�&RQWHQWV �����

vi WinCC Configuration ManualC79000-G8276-C140-01

,QIRUPDWLRQ�DERXW�6,0$7,&�3URGXFWV

Continuously updated information about SIMATIC products can be obtained:

• from the Internet at http://www.aut.siemens.de/

• via fax back service at 08765–93 02 77 95 00

Additionally, the SIMATIC Customer Support provides you with current information anddownloads helpful for the application of SIMATIC products. They can be reached:

• from the Internet at http://www.aut.siemens.de/support/html_00/index.shtml

• via the SIMATIC Customer Support Mailbox at +49 (911) 895–7100

• To access the mailbox, use a modem up to V.34 (28.8 kBaud). Set its parameters asfollows: 8, N, 1, ANSI, or dial-in via ISDN (x.75, 64 kBit).

The SIMATIC Customer Support can be reached by phone at +49 (911) 895–7000 and byfax at +49 (911) 895–7002. Inquiries can also be made via Internet mail or to the abovemailbox.

Page 9: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFWV

WinCC Configuration Manual 1-1C79000-G8276-C140-01

��&RQILJXUDWLRQ���([DPSOHVIn this section of the manual, we describe configuration using WinCC on the basis ofsample projects. Taking into account the multitude of potential applications WinCC has tooffer, the projects described below are to be seen only as examples of what can be donewith WinCC.

1RWH�The projects have been configured for a resolution of 1024 x 768. If you would prefer tostart the projects with a resolution of 800 x 600, you must select the window attributes )XOO6FUHHQ�and�6OLGHU under�&RQWURO�&HQWHU�→�&RPSXWHU�→�3URSHUWLHV�→�3URSHUWLHV�→*UDSKLFV�5XQWLPH.

The partitioning of the screen and the associated presettings and scripts associated with thisare described in more detail in Chapter ������/D\LQJ�RXW�WKH�VFUHHQ näher beschrieben.

1RWH�There is frequently more than just a single method of tackling a particular task. If a task canbe implemented by means of a direct link, you should DOZD\V choose this type ofdynamization, since this is the method which offers the best level of performance inruntime.

The consequence of configuring a direct link for an event is that when this event occursduring runtime, the value�of a source element (source) is taken over for a destinationelement (destination). Sources can take the form of constants, tags or the attributes of theobjects in the picture, while the dynamizable attributes of objects, the dynamizableattributes of the eigenen window and tags can be used as destinations.The advantages of the direct link are to be found in the simplicity of configuration and inthe link's time response during runtime.

Page 10: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�SURMHFWV �����

1-2 WinCC Configuration ManualC79000-G8276-C140-01

,QLWLDOL]DWLRQ

If required, initialization procedures are performed for the individual pictures. Theseinitialization procedures are configured under (YHQWV�→ 0LVFHOODQHRXV → 2SHQ�3LFWXUH.

Page 11: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-1C79000-G8276-C140-01

��7DJV��3URMHFW��YDULDB���PFS�In this project, we will show you a number of ways of creating, changing and reusingWinCC tags. There are three different types of tag in WinCC. ,QWHUQDO�WDJV without processdriver connection, ([WHUQDO�WDJV with process driver connection, and in the scripts, &�WDJV.In our examples, we will mainly be using LQWHUQDO�WDJV and &�WDJV.

The examples used for these topics are configured in the WinCC project entitled YDULDB��.

Page 12: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-2 WinCC Configuration ManualC79000-G8276-C140-01

���� &UHDWLQJ��JURXSLQJ�DQG�PRYLQJ�WDJV

In WinCC, tags can be created in the &RQWURO�&HQWHU under the items 7DJ�0DQDJHPHQW and'DWD�7\SHV.

7DJ�PDQDJHPHQW

When processing large volumes of data and, consequently, a large number of tags, it isadvisable to organize these tags into groups. Only in this way is it possible to keep a trackof things in large-scale projects. The tag groups, however, do nothing toward ensuring theuniqueness of the tags. This is done solely by means of the tag names.

6WHS 3URFHGXUH��FUHDWLQJ�WDJV�LQ�WKH�7DJ�0DQDJHPHQW

1 To create a tag group for LQWHUQDO�WDJV, 8' the item. Then 85 the subitem,QWHUQDO�WDJV that appears in order to open the pop-up menu. Select the 1HZ*URXS��� item.

2 In the window that appears, enter a suitable name (e.g. button). A new groupsymbol with the name you have just entered now appears in the right window of

the &RQWURO�&HQWHU. If you now 8' the ,QWHUQDO�WDJV item, this group symboland name will also appear as a further subitem in the left window. In our sampleproject, grouping has been carried out in accordance with the sequence of thechapters.

3 To create a tag in a tag group, 8' the group symbol in the right window or 8

the corresponding symbol in the left window. Then 85 this symbol to open thepop-up menu and select the 1HZ�7DJ��� item.

Page 13: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-3C79000-G8276-C140-01

6WHS 3URFHGXUH��FUHDWLQJ�WDJV�LQ�WKH�7DJ�0DQDJHPHQW

4 On the *HQHUDO�,QIRUPDWLRQ tab in the window that appears, enter a tag name.Then select the GDWD�W\SH you want from the list box immediately below. An$GGUHVV does not have to be set for internal tags.

1RWH�The current status of the tag in the process image can be queried in the &RQWURO�&HQWHU bymeans of a tool tip while runtime is active.

'DWD�W\SHV

A new tag can also be created by means of the 'DWD�7\SHV item.You can choose from the following data types:

6WHS 3URFHGXUH��FUHDWLQJ�WDJV�E\�PHDQV�RI�WKH�'DWD�7\SHV�PHQX�LWHP

1 By 8' the 'DWD�7\SHV item, a list of the data types available appears.

2 By 85 the desired type, open the pop-up menu and select the appropriate item.A selection window appears which controls how the tag to be created is to beassigned.

Page 14: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-4 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FUHDWLQJ�WDJV�E\�PHDQV�RI�WKH�'DWD�7\SHV�PHQX�LWHP

3 When you click the 2. button, you are returned to the *HQHUDO�,QIRUPDWLRQ tabin the 7DJ�SURSHUWLHV window under the Tag Management item.

0RYLQJ�WDJV

To move tags from one group to another, proceed as follows:

6WHS 3URFHGXUH��PRYLQJ�WDJV

1 85 the tag in question to open the pop-up menu and select the &XW item.

2 Switch to the group to which the tag is to be moved. Open the pop-up menu inthis group and select 3DVWH.

The same procedure can also be used for several tags simultaneously.

1RWH�If you want to cut or delete tags in the Control Center, runtime must not be active.

If you require a large number of tags which should all have the same tag name but benumbered consecutively, you only have to create one tag of this type. You can copy this tagusing the pop-up menu and then insert (paste) it as often as you want. The tags will benumbered automatically in ascending order. You should take this possibility into accountwhen defining the name convention for tags.

([WHUQDO�WDJV

Before you can create external tags in the Tag Management, you first have to configure aconnection to a programmable controller. You do not, however, have to install thisconnection in the sense of hardware; all you have to do is install the desired communicationdriver and configure the desired connection.

6WHS 3URFHGXUH�

1 85 the Tag Management item to open the pop-up menu and select the $GG�1HZ'ULYHU��� item.

2 Select the driver you want from the list displayed and click the 2SHQ button. Anew subitem with the name of the driver appears in the left window of the&RQWURO�&HQWHU.

3 If you 8' this new subitem, a further subitem appears. 85 this new subitemto open the pop-up menu and select the 1HZ�'ULYHU�&RQQHFWLRQ��� item.

Page 15: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-5C79000-G8276-C140-01

6WHS 3URFHGXUH�

4 On the *HQHUDO�,QIRUPDWLRQ tab, give the connection a name.

The tab named after the driver is used to make the connection settings. Theconnection is created when you click the 2. button.

5 Open the pop-up menu by 85 the new subitem created, which represents thenew connection. This menu enables you to create tag groups and tags in the usualway.

6 When you create an H[WHUQDO�WDJ, you must also define the addressing and formatadjustment in addition to the settings for LQWHUQDO�WDJV. The addressing refers tothe address of the tag in the programmable controller.

6WUXFWXUH�WDJV

Structure tags are used to enable a larger number of different tags and tag types which forma logical unit to be combined. These tag and tag types can then be addressed under onename.A structure tag consists of a number of individual tags, which can represent the most variedout data types.

6WHS 3URFHGXUH�

1 To create a new structure, 85 the 6WUXFWXUH�WDJ item to open the pop-up menuand select the 1HZ�6WUXFWXUH�7\SH��� item.

2 In the window that appears, 85 1HZ�6WUXFWXUH and select 5HQDPH in the pop-upmenu that appears. Give the new structure a name.

3 You can then add a new structure element by clicking the 1HZ�HOHPHQW button.

Page 16: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-6 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH�

4 By 85 the new element created, you can select its data type and enter its name.For each structure element, you must define whether it refers to an internal or anexternal tag. You conclude configuration and create the structure type by clickingthe 2. button.

1RWH�Once a structure type has been created, it cannot be reconfigured. The complete structuretype must be redefined.

A structure tag is created in the same way as all other types of tag, but the data type usedmust be structure type created.The name of the individual elements of the structure tag created is composed of thestructure name assigned when creating the tag and the element name assigned whencreating the structure type. The two are separated in the name by a dot.

Page 17: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-7C79000-G8276-C140-01

���� ,QFUHPHQWLQJ��GHFUHPHQWLQJ�DQG�MRJJLQJ

In runtime, you access the examples that relate to these topics in

our YDULDB�� project by 8 the button depicted above. The examples are configured in thepictures YDULDB�BFKDSWHUB���SGO and YDULDB�BFKDSWHUB��D�SGO.

'HILQLWLRQ

,QFUHPHQWLQJ refers to the increasing of a tag value by a fixed or variable increment.'HFUHPHQWLQJ refers to the decreasing of a tag value by a fixed or variable increment.-RJJLQJ refers to the execution of an action when a EXWWRQ is clicked (comparable withpressing a pushbutton). In the case of binary signals, this represents, as a rule, the triggeringof a device. With analog values, a set value can be changed by means of jogging.

Page 18: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-8 WinCC Configuration ManualC79000-G8276-C140-01

������ -RJJLQJ���FKDQJLQJ�D�VHW�YDOXH��H[DPSOH����

7DVN�GHILQLWLRQ

Jogging is to be performed using the mouse.A set value is to be changed in fixed steps by clicking a button. This changing of the valueis to be restricted to fixed limits.The changes are to be implemented locally in the picture.

,PSOHPHQWDWLRQ�FRQFHSW

We implement changing of the set value by means of two buttons, which we create under

→; changing is event-driven. When the EXWWRQ is 8, the value of an LQWHUQDO�WDJ ischanged to the extent of one increment. The increment is specified beforehand and cannotbe altered during runtime. The change in the set value is implemented by means of a &DFWLRQ.The change in the set value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG. Theoutput value of the�,�2�ILHOG is linked to the LQWHUQDO�WDJ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�D�VHW�YDOXH�LQ�IL[HG�VWHSV

1 Create a tag of type 6LJQHG����ELW�YDOXH in Tag Management. In our example, weuse the tag called 6��LBYDULDBEXWB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named 6��LBYDULDBEXWB��, change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW.

3 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ��

4 To change the set value, create a &�DFWLRQ by the object and selecting3URSHUWLHV����(YHQWV�→�0RXVH�→�3UHVV�OHIW. This &�DFWLRQ changes the value of

the tag each time the button is clicked with the 8. The limit value is specifiedand checked in the &�DFWLRQ.

5 Configure decrementation of the set value in the same way. In our example, weuse the object called %XWWRQ�.

Page 19: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-9C79000-G8276-C140-01

C action for Button2

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){DWORD value;

value=GetTagDWord("S32i_varia_but_00"); //get tag valueif (value>1300) (value=1400); //check limitelse value=value+100; //inc valueSetTagDWord("S32i_varia_but_00",value); //set new value}

• Declare the C tag value.

• Use the LQWHUQDO�IXQFWLRQ *HW7DJ':RUG to read out the current value from tag6��LBYDULDBEXWB��.

• In the LI inquiry, check whether the value of the tag is greater than 1300. If it is, 1400will be specified as the upper limit. If the value of the tag is less than 1300, theinstruction in the HOVH branch is executed and the value is raised in this way by 100.

• The LQWHUQDO�IXQFWLRQ 6HW7DJ':RUG then returns the changed value to the6��LBYDULDBEXWB�� tag.

1RWHV�RQ�JHQHUDO�XVH

The &�DFWLRQV linked to the two EXWWRQV can be used after changes have been made to thetag (internal or external), the limits and the increment.

Page 20: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-10 WinCC Configuration ManualC79000-G8276-C140-01

������ -RJJLQJ���FKDQJLQJ�D�VHW�YDOXH�XVLQJ�*OREDO�6FULSW��H[DPSOH����

7DVN�GHILQLWLRQ

Jogging is to be performed using the mouse.A set value is to be changed in fixed steps by clicking a button. This changing of the valueis to be restricted to fixed limits.It is to be implemented with the aid of a SURMHFW�IXQFWLRQ.

,PSOHPHQWDWLRQ�FRQFHSW

We implement changing of the set value by means of two buttons, which we create under

→; changing is event-driven. When the EXWWRQ is 8, the value of an LQWHUQDO�WDJ ischanged to the extent of one increment. The increment is specified beforehand and cannotbe altered during runtime. The change in the set value is implemented by means of a SURMHFWIXQFWLRQ.The change in the set value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG. Theoutput value of the�,�2�ILHOG is linked to the LQWHUQDO�WDJ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FUHDWLQJ�WKH�SURMHFW�IXQFWLRQ

1 Open the *OREDO�6FULSW editor from the &RQWURO�&HQWHU.

2 Create a new function by selecting )LOH�→�1HZ�3URMHFW�)XQFWLRQ.

3 Assign this new function the name ,QF'HF9DOXH and save the function byselecting )LOH�→�6DYH�$V�→�,QF'HF9DOXH�IFW.

4 Program and compile the function.

Project function IncDecValue

void IncDecValue(DWORD *value,DWORD low,DWORD high,DWORD step,DWORDa)

{DWORD v;v=*value; //get current valueswitch (a){ case 0: { if (v<step) (v=0); //low limit else v=v-step; //decrement } //case 0 break; case 1:{ if (v>(high-step)) (v=high); //high limit else v=v+step; //increment }//case 1 break; }//switch*value=v; //return}

Page 21: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-11C79000-G8276-C140-01

• The function header with the name of the project function ,QF'HF9DOXH and the transferparameters. We use the same SURMHFW�IXQFWLRQ for incrementing and decrementing.

• The declaration of the tag.

• When the function is called, it is not the tag to be processed that is transferred as thetransfer parameter, but only its address. The contents of this address are read into the&�WDJ Y.

• Using the VZLWFK statement, evaluate the information of the direction tag D.

• In the relevant FDVH branch, check the limit values and specify the maximum orminimum value if the limit is exceeded.

• If the limit is not violated, change the current value.

• Transfer the current set value to the address of the tag to be processed.

Implementing in the WinCC project

6WHS 3URFHGXUH��FKDQJLQJ�D�VHW�YDOXH�LQ�IL[HG�VWHSV

1 Create a tag of type 6LJQHG����ELW�YDOXH in Tag Management. In our example, weuse the tag called 6��LBYDULDBEXWB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG.

In our example, we use the object called I/O Field2. When configuring the�,�2ILHOG in the FRQILJXUDWLRQ�GLDORJ, select the tag named 6��LBYDULDBEXWB��. changethe entry in the list box from the default value of 2s to 8SRQ�FKDQJH and changethe field type entry (7\SH) to 2XWSXW.

3 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ��

4 To change the set value, create a &�DFWLRQ by the object and selecting3URSHUWLHV����(YHQWV�→�0RXVH�→�3UHVV�OHIW. This &�DFWLRQ calls the SURMHFWIXQFWLRQ ,QF'HF9DOXH and transfers the required parameters to it. The changes the

value of the tag each time the EXWWRQ is clicked with the 8. The limits arespecified as the transfer parameters when the SURMHFW�IXQFWLRQ is called. They arechecked in the SURMHFW�IXQFWLRQ.

5 Configure decrementation of the set value in the same way. In our example, weuse the object called %XWWRQ�.

Page 22: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-12 WinCC Configuration ManualC79000-G8276-C140-01

C action for Button7

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){DWORD value;

value=GetTagDWord("S32i_varia_but_04");

//IncDecValue(DWORD *value,DWORD low,DWORD high,DWORD step,DWORD a )IncDecValue(&value,0,1400,100,1);SetTagDWord("S32i_varia_but_04",value);}

• Use the LQWHUQDO�IXQFWLRQ *HW7DJ':RUG to read out the current value of the LQWHUQDOWDJV.

• Call the SURMHFW�IXQFWLRQ ,QF'HF9DOXH�and transfer the parameters (3RLQWHU�WR�WDJ,/RZHU�OLPLW��8SSHU�OLPLW��,QFUHPHQW��'LUHFWLRQ�.

• Use the LQWHUQDO�IXQFWLRQ 6HW7DJ':RUG to transfer the changed value to the LQWHUQDOWDJ.

1RWHV�RQ�JHQHUDO�XVH

The SURMHFW�IXQFWLRQ can be used immediately without any further changes being required.In the &�DFWLRQ used for calling the SURMHFW�IXQFWLRQ, adapt the transfer parameters to suityour own requirements.

Page 23: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-13C79000-G8276-C140-01

������ -RJJLQJ���EXWWRQV��H[DPSOH����

→�You access the solutions to these subjects in our project called YDULDB���by choosing the

two EXWWRQV�with the 8. They are configured in the picture with the nameSLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

Jogging is to be performed using the mouse.A unit (motor, valve) is to be activated by clicking a button. When the button is released,activation will be canceled.

,PSOHPHQWDWLRQ�FRQFHSW

We implement the button along event-driven lines by means of a button, which we createunder :LQGRZV�2EMHFWV�→�%XWWRQ.We visualize this implementation by means of a GLUHFW�FRQQHFWLRQ and a &�DFWLRQ.

1RWH�Implementing a button by means of a GLUHFW�FRQQHFWLRQ offers the best level of performanceduring runtime.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW���GLUHFW�FRQQQHFWLRQ

6WHS 3URFHGXUH��KRZ�D�EXWWRQ�ZRUNV�±�GLUHFW�FRQQHFWLRQ

1 Create a tag of type %LQDU\�WDJ in Tag Management. In our example, we use thetag called %,1LBYDULDBEXWB���

2 In a picture, we configure :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we usethe object called %XWWRQ��

3 Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW 9DULDEOH�→�%,1LBYDULDBEXWB��.Accept the settings by clicking the 2. button. Configure another GLUHFWFRQQHFWLRQ under (YHQWV�→�0RXVH�→�5HOHDVH�OHIW, but this time for the VRXUFH&RQVWDQW�→��.

Page 24: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-14 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��KRZ�D�EXWWRQ�ZRUNV�±�GLUHFW�FRQQHFWLRQ

4 We control our animation by means of the %,1LBYDULDBEXWB�� tag.

As an option, we will explain implementation with a &�action in the same example.TheGLUHFW�FRQQHFWLRQ method described above is the better and quicker way of doing it.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW���&�DFWLRQ

6WHS 3URFHGXUH��KRZ�D�EXWWRQ�ZRUNV���&�DFWLRQ

1 Create a tag of type %LQDU\�WDJ in Tag Management. In our example, we use thetag called %,1LBYDULDBEXWB���

2 In a picture, we configure :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we usethe object called %XWWRQ��

3 Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, generate a &�DFWLRQ which sets the value ofthe %,1LBYDULDBEXWB�� tag to �. Under (YHQWV�→�0RXVH�→�5HOHDVH�OHIW, generatea further &�DFWLRQ which sets the value of the %,1LBYDULDBEXWB�� tag to �.

C action for Button1

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetTagWord("BINi_varia_but_12",1); //on}

• Use the LQWHUQDO�IXQFWLRQ 6HW7DJ':RUG to set the tag to �.

Page 25: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-15C79000-G8276-C140-01

$QLPDWLRQ�RI�RXU�H[DPSOH

In our example, we use the button to animate the following color wheel.

• The color wheel consists of several 6WDQGDUG�2EMHFWV�→�3LH�6HJPHQW.

• The 3URSHUWLHV�→�*HRPHWU\�→�6WDUW�$QJOH and 3URSHUWLHV�→�*HRPHWU\�→�(QG�$QJOHof all the objects are dynamized using the '\QDPLF�'LDORJ���.

• To change the value, we need an action which changes the value of the angle of rotationwith a fixed time base. We effect this changing of the value by means of a &�DFWLRQ for3LH�6HJPHQW� under 3URSHUWLHV�→�&RORUV�→�/LQH�&RORU. We set the trigger for theaction to ���PV. In this case, we do QRW dynamize the /LQH�&RORU. The reason a &�DFWLRQis linked to this property is that we require a trigger to start changing of the value. Wecould also use a different property of the object instead of the .

• The current angle of rotation is changed in the LQWHUQDO�WDJ called 6��LBYDUDBEXWB��.

Page 26: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-16 WinCC Configuration ManualC79000-G8276-C140-01

C action for animation

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){static DWORD i = 0;

//if button pressed

if (GetTagBit("BINi_varia_but_12")) { i=i+10; //increment of rotation if (i==360) (i=0); //high limit SetTagDWord("S32i_varia_but_11",i); }//ifreturn(0x0); //black}

• Declare the &�WDJ L as a VWDWLF�':25', since its value must remain constant while thepicture is open.

• By clicking the EXWWRQ (button on), rotate the wheel further in steps of 10 degrees, i.e.increment the value of the tag by 10.

• The tag L is initialized once the wheel has been fully rotated through 360°.

• Transfer the new value for the angle of rotation of the LQWHUQDO�WDJ.

• Return the input configured for the background color with UHWXUQ. It isn't supposed to bechanged.

1RWHV�RQ�JHQHUDO�XVH

The EXWWRQ with the GLUHFW�FRQQHFWLRQ can be used after changes have been made to the tag.

Page 27: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-17C79000-G8276-C140-01

������ -RJJLQJ���FKDQJHRYHU�VZLWFK��H[DPSOH����

You access the example that relates to this topic in our YDULDB�� project by 8 the twoEXWWRQV depicted above. They are configured in the picture with the nameSLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

Jogging is to be performed using the mouse.The function of a changeover switch is to be implemented by means of a button.Pressing the button will switch the unit (motor, valve) on and the unit is to remain on whenthe button is released. Pressing the button again will switch the unit off.

,PSOHPHQWDWLRQ�FRQFHSW

We implement the changeover switch along event-driven lines by means of a button, whichwe create under :LQGRZV�2EMHFWV�→�%XWWRQ.

1RWH�Implementing a changeover switch by means of a GLUHFW�FRQQHFWLRQ offers the bestperformance during runtime, but it requires two buttons.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW���GLUHFW�FRQQQHFWLRQ

6WHS 3URFHGXUH��KRZ�D�FKDQJHRYHU�VZLWFK�ZRUNV���GLUHFW�FRQQHFWLRQ

1 Create a tag of type %LQDU\�WDJ in Tag Management. In our example, we use thetag called %,1LBYDULDBEXWB���

2 In a picture, configure two buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, we use the object %XWWRQ� for switching on and the object %XWWRQ� forswitching off.

3 Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW 9DULDEOH�→�%,1LBYDULDBEXWB��.Accept the settings by clicking the 2. button. Configure a GLUHFW�FRQQHFWLRQlinked to %XWWRQ� in the same way, but this time with the VRXUFH &RQVWDQW�→��.

4 The GLUHFW�FRQQHFWLRQ under Events → Mouse → Mouse Action onlysynchronizes the labeling on %XWWRQ� and isn’t essential for the changeover switchto be able to function.

Page 28: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-18 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW���&�DFWLRQ

6WHS 3URFHGXUH��KRZ�D�FKDQJHRYHU�VZLWFK�ZRUNV���&�DFWLRQ

1 Create a tag of type %LQDU\�WDJ in Tag Management. In our example, we use thetag called %,1LBYDULDBEXWB���

2 In a picture, configure a :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use theobject called %XWWRQ�.

3 Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, generate a &�DFWLRQ which negates thestatus of the %,1LBYDULDBEXWB�� tag.

C action for changeover switch

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){BOOL state;

//flip tag

state = !GetTagBit("BINi_varia_but_16"),SetTagBit("BINi_varia_but_16",(SHORT)state);}

• The declaration of the VWDWH tag.

• The LQWHUQDO�IXQFWLRQ *HW7DJ%LW reads out the value of the LQWHUQDO�WDJ, inverts it andreturns it with 6HW7DJ%LW.

1RWHV�RQ�JHQHUDO�XVH

The button with the &�DFWLRQ can be used after changes have been made to the tag.Inversion of the LQWHUQDO�WDJ can also be carried out without the &�WDJ.SetTagDWord("BINi_varia_but_16",(SHORT)!GetTagBit("BINi_varia_but_16"));

Page 29: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-19C79000-G8276-C140-01

������ ,QFUHPHQWLQJ�DQG�GHFUHPHQWLQJ��H[DPSOH����

7DVN�GHILQLWLRQ

The value of a tag is to be changed. This changing of the value is to be restricted to fixedlimits. Changing of the value is to be performed using the mouse.A tag value is to be changed by pressing a button. The value is to be changed only when thebutton is pressed. The value set must be retained when the button is released.

,PSOHPHQWDWLRQ�FRQFHSW

We create a button along event-driven lines using :LQGRZV�2EMHFWV�→�%XWWRQ.

When the button is pressed with the 8, the value of an LQWHUQDO�WDJ is incremented by the

increment set; when the button is pressed with the 85, the value of this�tag isdecremented by the increment set. The value keeps changing as long as the button ispressed. The increment is specified beforehand and cannot be altered during runtime.The change in the value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG. The outputvalue of the�,�2�ILHOG is linked to the LQWHUQDO�WDJ.

Changing the value

To change the value, we need an action which changes the value of an LQWHUQDO�WDJ with afixed time base. We effect this changing of the value by means of a &�DFWLRQ on the ,�2ILHOG under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�;. We set the trigger for the action to���PV. We are QRW dynamizing the position of the ,�2�ILHOG. The reason a &�DFWLRQ is linkedto this property is that we want to implement changing of the value directly on the object.In our sample project, we have also solved this problem by means of a JOREDO�DFWLRQ.

Page 30: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-20 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��LQFUHPHQWLQJ��GHFUHPHQWLQJ

1 Creating the tag in the Tag Management. In our example, we use the tags called6��LBYDULDBEXWB���DQG�6��LBYDULDBEXWB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�� When creating the ,�2�ILHOG in theFRQILJXUDWLRQ�GLDORJ, set the tag called 6��LBYDULDBEXWB��. change the entry inthe list box from the default value of 2s to 8SRQ�FKDQJH and change the field typeentry (7\SH) to 2XWSXW.

3 In the same picture, configure a :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, weuse the object called %XWWRQ��

4 To modify a setpoint at the click of a mouse, we create several GLUHFW�FRQQHFWLRQVat this�EXWWRQ. These GLUHFW�FRQQHFWLRQV�modify the value of tag

6��LBYDULDBEXWB���every time the EXWWRQ is chosen with the 8 or 8R.

Set (YHQWV�→�0RXVH�→�3UHVV�OHIW to incrementation ON (set tag to �). Set (YHQWV→�0RXVH�→�5HOHDVH�OHIW to incrementation OFF (set tag to �). Set (YHQWV�→0RXVH�→�3UHVV�ULJKW to decrementation ON (set tag to �) and (YHQWV�→�0RXVH→�5HOHDVH�ULJKW to decrementation OFF (set tag to �).

5 The value of the 6��LBYDULDBEXWB�� tag is changed by a &�DFWLRQ for the object,�2�)LHOG� under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�;.

6 We then change the trigger for calling the &�DFWLRQ to ���PV.

Page 31: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-21C79000-G8276-C140-01

C action for the I/O field for changing the value

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){DWORD value;SHORT count;

count = GetTagWord("S08i_varia_but_01"); //inc or decif ((count==1) || (count==2)){ //current value value = GetTagDWord("S32i_varia_but_00");

if (count==1){ //inc value++; if (value>1400) (value=1400); //high limit SetTagDWord("S32i_varia_but_00",value); }//inc if (count==2){ //dec value--; if (value<0) (value=0); //low limit SetTagDWord("S32i_varia_but_00",value); }//dec }//if countreturn(81); //x-pos}

• The declaration of the &�WDJV YDOXH and FRXQW.

• Evaluation of whether the EXWWRQ is pressed. If the EXWWRQ is not being pressed, the &DFWLRQ is ended (to avoid unnecessary loading of the system).

• If the EXWWRQ is being pressed, the script inquires whether the value is to be incrementedor decremented. The value of the tag is changed depending on the result of thisevaluation.

• After the value has been changed, the limit value check is performed.

• Return the value configured for position X with UHWXUQ. It isn’t supposed to be changed.

1RWHV�RQ�JHQHUDO�XVH

The button with the GLUHFW�FRQQHFWLRQV can be used after changes have been made to the tagand in conjunction with the &�DFWLRQ for the ,�2�ILHOG. The limits and tags must be adaptedin the &�DFWLRQ.

Page 32: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-22 WinCC Configuration ManualC79000-G8276-C140-01

������ ,QFUHPHQWLQJ�DQG�GHFUHPHQWLQJ�XVLQJ�*OREDO�6FULSW��H[DPSOH����

7DVN�GHILQLWLRQ

The value of a tag is to be changed. This changing of the value is to be restricted to fixedlimits. Changing of the value is to be performed using the mouse.A tag value is to be changed by pressing a button. The value is to be changed only when thebutton is pressed. The value set must be retained when the button is released.

,PSOHPHQWDWLRQ�FRQFHSW

We create a button along event-driven lines using :LQGRZV�2EMHFWV�→�%XWWRQ.It is to be implemented with the aid of a JOREDO�DFWLRQ.

When the button is pressed with the 8, the value of an LQWHUQDO�WDJ is incremented by the

increment set; when the button is pressed with the 8R, the value of this�tag isdecremented by the increment set. The value keeps changing as long as the button ispressed. The increment is specified beforehand and cannot be altered during runtime.The change in the value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG. The outputvalue of the�,�2�ILHOG is linked to the LQWHUQDO�WDJ.

Page 33: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-23C79000-G8276-C140-01

Changing the value

To change the value, we need an action which changes the value of an LQWHUQDO�WDJ with afixed time base. We implement the change in the value by means of a JOREDO�DFWLRQ.The action is activated when the WinCC runtime is started and is then processed with theset cycle. The action is programmed in such a way that the actual program component isonly processed when the button is pressed.One unusual feature of this action is that it uses external &�WDJV. External &�WDJV arerecognized throughout the entire WinCC runtime, but they must be declared outside thefunction header. Since in WinCC this is only possible in a SURMHFW�IXQFWLRQ, a separateSURMHFW�IXQFWLRQ is created for declaring these tags. This project function must be executedonce when the project is started and is then no longer required.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

Configuration is divided into the following three steps.

6WHS��

&UHDWLQJ�WKH�SURMHFW�IXQFWLRQ

6WHS 3URFHGXUH��FUHDWLQJ�WKH�SURMHFW�IXQFWLRQ�IRU�LQLWLDOL]DWLRQ

1 Open the *OREDO�6FULSW editor from the &RQWURO�&HQWHU.

2 Create a new function by selecting )LOH�→�1HZ�3URMHFW�)XQFWLRQ.

3 Assign this new function the name ,QLW$FWLRQ and save the function by selecting)LOH�→�6DYH�$V�→�,QLW$FWLRQ�IFW.

4 Program and compile the function.

Project function InitAction//declaration for counter.pas

extern char tagname[30] = " ";extern SHORT count = 0;extern DWORD low = 0;extern DWORD high = 0;extern DWORD step = 0;

void InitAction(){//function is used to generate external tags}

• The declaration of the external &�WDJV.

• This function must be executed once when the project is started and is then no longerrequired. A good way of executing it is in the Start Picture, and this can be set under(YHQWV�→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH.

Page 34: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-24 WinCC Configuration ManualC79000-G8276-C140-01

6WHS��

&UHDWLQJ�WKH�JOREDO�DFWLRQ

6WHS 3URFHGXUH��FUHDWLQJ�WKH�JOREDO�DFWLRQ

1 Open the *OREDO�6FULSW editor from the &RQWURO�&HQWHU.

2 Create a new action by selecting )LOH�→�1HZ�$FWLRQ.

3 Save the file by selecting )LOH�→�6DYH�$V�→�FRXQWHU�SDV.

4 Program and compile the action.

5Set the trigger. You do this by clicking the EXWWRQ and selecting the 7ULJJHUtab. Add 7LPHU�→�&\FOLF�→����PV on this tab.

Global action counter.pas

#include "apdefap.h"

int gscAction( void ){extern char tagname[30];extern SHORT count;extern DWORD low;extern DWORD high;extern DWORD step;

DWORD value;

if ((count==1)||(count==2)){//get current valuevalue = GetTagDWord(tagname);if (count==1){ //inc

value = value+step;if (value>high) (value=high); //high limit}//if

if (count==2){ //decvalue = value-step;if (value<low) (value=low); //low limit}//if

SetTagDWord(tagname,value);}//if

return(0);}

• The declaration of the external &�WDJ.

• Evaluation of whether the EXWWRQ is pressed. If the EXWWRQ is not being pressed, the &DFWLRQ is ended (to avoid unnecessary loading of the system).

• If the EXWWRQ is being pressed, the script inquires whether the value is to be incrementedor decremented. The value of the &�WDJ�YDOXH is changed depending on the result of thisevaluation.

• After the value has been changed, the limit value check is performed.

• Use the LQWHUQDO�IXQFWLRQ 6HW7DJ':RUG to assign the new value to the tag to beprocessed.

Page 35: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-25C79000-G8276-C140-01

6WHS���

&RQILJXULQJ�WKH�EXWWRQV

6WHS 3URFHGXUH��LQFUHPHQWLQJ�DQG�GHFUHPHQWLQJ�XVLQJ�*OREDO�6FULSW

1 Creating the tag in the Tag Management. In our example, we use the tag called6��LBYDULDBEXWB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�� When creating the ,�2�ILHOG in theFRQILJXUDWLRQ�GLDORJ, set the tag called 6��LBYDULDBEXWB��. change the entry inthe list box from the default value of 2s to 8SRQ�FKDQJH and change the field typeentry (7\SH) to 2XWSXW.

3 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ��

4 To modify a setpoint at the click of a mouse, we create several &�DFWLRQV at thisEXWWRQ��These &�DFWLRQV provide the JOREDO�DFWLRQ, FRXQWHU�SDV��with the relevant

parameters. This happens each time the button is clicked with the 8 or 8R.Set (YHQWV�→�0RXVH�→�3UHVV�OHIW to incrementation ON, (YHQWV�→�0RXVH�→5HOHDVH�OHIW to incrementation OFF, (YHQWV�→�0RXVH�→�3UHVV�ULJKW todecrementation ON and (YHQWV�→�0RXVH�→�5HOHDVH�ULJKW to decrementationOFF.

5 The value of the 6��LBYDULDBEXWB�� tag is changed in the JOREDO�DFWLRQFRXQWHU�SDV.

C action for Button8for incrementation ON

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){//inc onextern char tagname[30];extern SHORT count;extern DWORD low;extern DWORD high;extern DWORD step;

strcpy(tagname,"S32i_varia_but_04");count = 1;low = 0;high =1400;step = 1;}

Page 36: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-26 WinCC Configuration ManualC79000-G8276-C140-01

C action for Button8 for incrementation OFF

#include "apdefap.h"void OnLButtonUp(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName, UINT nFlags, int x, int y){//inc offextern SHORT count;count=0;}

• The declaration of the external &�WDJV in the &�DFWLRQ. These tags are generated in theproject function ,QLW$FWLRQ.

• Provide the tags with the relevant values. This is comparable with transferringparameters to a SURMHFW�IXQFWLRQ. The content of the FRXQW tag is responsible forprocessing the program in the JOREDO�DFWLRQ.

• When switching off the incrementation process, there is no need to set all the tags.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• In the &�DFWLRQV, change the tag and adapt the limit values and the increment.

• If this button is to be used in another project, the SURMHFW�IXQFWLRQ ,QLW$FWLRQ and theJOREDO�DFWLRQ FRXQWHU�SDV must both be transferred over together with the button.

Page 37: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-27C79000-G8276-C140-01

������ 7KH�RWKHU�H[DPSOHV�UHODWHG�WR�WKLV�WRSLF

H[DPSOH���

The functionality of this example is similar to that of example H[DPSOH���. The basicdifference is that the increment can be changed during runtime.Another difference is the dynamic changing of the increment when the increment is beingset. If the increment is > 20, the value is changed in steps of 10; if the increment is < 20, thevalue is changed in steps of 1.

H[DPSOH���

The functionality of this example results from combining H[DPSOH��� and H[DPSOH���. Thevalue is changed with the help of the JOREDO�DFWLRQ FRXQWHU�SDV.

H[DPSOH���

The functionality of this example is similar to that of example H[DPSOH���. The differencehere is in the mode of animation.

Page 38: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-28 WinCC Configuration ManualC79000-G8276-C140-01

���� &KDQJLQJ�WDJ�YDOXH�XVLQJ�:LQGRZV�2EMHFWV

In runtime, you access the solutions that relate to these topics in

our YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepicture named YDULDB�BFKDSWHUB���SGO.

Page 39: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-29C79000-G8276-C140-01

������ ,QSXWWLQJ�E\�PHDQV�RI�D�VOLGHU�ZLWK�GLUHFW�FRQQHFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

Changing a set value is to be performed by means of a slider.This changing of the value is to be restricted to fixed limits.

,PSOHPHQWDWLRQ�FRQFHSW

We use a slider object created under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW to implementchanging of the set values. By means of a GLUHFW�FRQQHFWLRQ, the value of an LQWHUQDO�WDJ ischanged when the position of the slider is changed.The change in the set value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�VHW�YDOXH�E\�PHDQV�RI�D�VOLGHU�±�GLUHFW�FRQQHFWLRQ

1 Create a tag in Tag Management. In our example, we use the tag called6��LBYDULDBZLQB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named 6��LBYDULDBZLQB��. change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW.

Page 40: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-30 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FKDQJLQJ�VHW�YDOXH�E\�PHDQV�RI�D�VOLGHU�±�GLUHFW�FRQQHFWLRQ

3 In the same picture, configure an object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW.In our example, we use the object called 6OLGHU�2EMHFW�. Create a�GLUHFWFRQQHFWLRQ under (YHQWV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ.

4 In the 'LUHFW�&RQQHFWLRQ dialog box, connect the VRXUFH WKLV�REMHFW�→�3URFHVV'ULYHU�&RQQHFWLRQ to the WDUJHW 9DULDEOH�→�6��BYDULDBZLQB��. Accept thesettings by clicking the 2. button.

Page 41: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-31C79000-G8276-C140-01

6WHS 3URFHGXUH��FKDQJLQJ�VHW�YDOXH�E\�PHDQV�RI�D�VOLGHU�±�GLUHFW�FRQQHFWLRQ

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Change the tag in the GLUHFW�FRQQHFWLRQ.

• The value range of the 6OLGHU�2EMHFW can be changed under 3URSHUWLHV�→�0LVFHOODQHRXV→�0D[LPXP�9DOXH and�0LQLPXP�9DOXH. This can also be done under &RQILJXUDWLRQ'LDORJ���

Page 42: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-32 WinCC Configuration ManualC79000-G8276-C140-01

������ ,QSXWWLQJ�E\�PHDQV�RI�VOLGHU�DQG�WDJ�FRQQHFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

Changing a set value is to be performed by means of a slider.This changing of the value is to be restricted to fixed limits.

,PSOHPHQWDWLRQ�FRQFHSW

We use a slider object created under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW to implementchanging of the set values. By means of a WDJ�FRQQHFWLRQ, the value of an LQWHUQDO�WDJ ischanged when the position of the slider is changed. The tag is only written to when theslider is released.The change in the set value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�VHW�YDOXH�E\�PHDQV�RI�D�VOLGHU�±�WDJ�FRQQHFWLRQ

1 Create a tag in Tag Management. In our example, we use the tag called6��LBYDULDBZLQB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the�,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named 6��LBYDULDBZLQB��. Change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW.

3 In the same picture, configure an object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW.In our example, we use the object called 6OLGHU�2EMHFW�. When configuring theVOLGHU�REMHFW in the FRQILJXUDWLRQ�GLDORJ, select the tag named6��LBYDULDBZLQB��. Change the entry in the 8SGDWH list box from the defaultvalue of 2s to 8SRQ�FKDQJH.

Page 43: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-33C79000-G8276-C140-01

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Change the tag in the�WDJ�FRQQHFWLRQ.

• The value range of the 6OLGHU�2EMHFW can be changed under 3URSHUWLHV�→�0LVFHOODQHRXV→�0D[LPXP�9DOXH and�0LQLPXP�9DOXH. This can also be done under &RQILJXUDWLRQ'LDORJ���.

Page 44: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-34 WinCC Configuration ManualC79000-G8276-C140-01

������ ,QSXWWLQJ�E\�PHDQV�RI�DQ�2SWLRQ�*URXS��H[DPSOH����

7DVN�GHILQLWLRQ

Changing of a set value is to be implemented by selecting specified, fixed values from alist.

,PSOHPHQWDWLRQ�FRQFHSW

We implement this changing of the set value by means of an option group, which we createunder :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS.

When one of the specified set values is selecting using the 8, the value in an LQWHUQDO�WDJis changed. The list of set values is specified and cannot be altered during runtime.The change in the set value is displayed by means of a 6PDUW�2EMHFWV�→�,�2�)LHOG. Theoutput value of the�,�2�ILHOG is linked to the LQWHUQDO�WDJ. The change in the set value isimplemented by means of a &�DFWLRQ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�VHW�YDOXH�XVLQJ�DQ�RSWLRQ�JURXS

1 Create a tag in Tag Management. In our example, we use the tag called6��LBYDULDBZLQB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named 6��LBYDULDBZLQB��. Change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW.

3 In the same picture, configure a :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS. In ourexample, this is 2SWLRQ�*URXS�. Under 3URSHUWLHV�→�*HRPHWU\�→�1XPEHU�RI%R[HV, change the default value 3 to �.

4 Select the index value 1 under 3URSHUWLHV�→�)RQW�→�,QGH[�→��. Enter theappropriate text for the selected index under 3URSHUWLHV�→�)RQW�→�7H[W�→��. Inthe same way, configure the values for the remaining index inputs.

5 Under (YHQWV�→�3URSHUW\�7RSLFV�→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV, create a &DFWLRQ, which set tag 6��LBYDULDBZLQB�� to a specific value depending on thefield selected.

Page 45: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-35C79000-G8276-C140-01

6WHS 3URFHGXUH��FKDQJLQJ�VHW�YDOXH�XVLQJ�DQ�RSWLRQ�JURXS

C action for the option group

void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,char* lpszPropertyName, long value)

{//set tag according to selected boxswitch(value){ case 1 : SetTagDWord("S32i_varia_win_02",0); break; case 2 : SetTagDWord("S32i_varia_win_02",50); break; case 4 : SetTagDWord("S32i_varia_win_02",100); break; case 8 : SetTagDWord("S32i_varia_win_02",150); break; }//switch}

• Assign values to tag 6��LBYDULDBZLQB�� in accordance with the input state. The inputstate is stored in the predefined tag YDOXH.

1RWHV�RQ�JHQHUDO�XVH

The following adaptation must be made before the 2SWLRQ�*URXS can be put to general use:

• Adapt the tag in the &�DFWLRQ under (YHQWV�→�3URSHUW\�7RSLFV�→�2XWSXW�,QSXW�→6HOHFWHG�%R[HV.

Page 46: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-36 WinCC Configuration ManualC79000-G8276-C140-01

������ ,QSXWWLQJ�E\�PHDQV�RI�FKHFN�ER[��H[DPSOH����

7DVN�GHILQLWLRQ

Various objects are to be configured such that they can be shown and hidden by means of acheck box.

,PSOHPHQWDWLRQ�FRQFHSW

We implement this by means of a check box, which we create under :LQGRZV�2EMHFWV�→&KHFN�%R[, and we use this check box to set individual bits in a tag. A number of objectscreated under 6WDQGDUG�2EMHFWV�→�3RO\JRQ are shown or hidden depending on these bits.We display the binary output value of the FKHFN�ER[ by means of a 6PDUW�2EMHFWV�→� ,�2)LHOG.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��LQSXWWLQJ�E\�PHDQV�RI�D�FKHFN�ER[

1 Create a tag of type 6LJQHG����ELW�YDOXH in Tag Management. In our example, weuse the tag called 6��LBYDULDBZLQB���

2 Configure a number of objects under 6WDQGDUG�2EMHFWV�→�3RO\JRQ; in ourexample, we use 3RO\JRQ� through 3RO\JRQ�. These objects are to be shown orhidden depending on the selection state of the FKHFN�ER[.

3 In the same picture, configure a :LQGRZV�2EMHFWV�→�&KHFN�%R[. In our example,&KHFN�%R[�. Under 3URSHUWLHV�→�*HRPHWU\�→�1XPEHU�RI�%R[HV, change thedefault value 3 to �.

4 Select the index value 1 under 3URSHUWLHV�→�)RQW�→�,QGH[�→��. Enter theappropriate text for the selected index under 3URSHUWLHV�→�)RQW�→�7H[W, this textbeing the name of the object you want to control by selecting this field. In thesame way, configure the values for the remaining index inputs.

5 Under (YHQWV�→�3URSHUW\�7RSLFV�→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV� create a &DFWLRQ which assigns the binary state of &KHFN�%R[� to tag S32i_varia_win_03and controls the "visibility" of the individual SRO\JRQ�REMHFWV.

Page 47: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-37C79000-G8276-C140-01

6WHS 3URFHGXUH��LQSXWWLQJ�E\�PHDQV�RI�D�FKHFN�ER[

6 Configure an I/O field under 6PDUW�2EMHFWV�→�,�2�)LHOG; in our example, we use,�2�)LHOG�. Under &RQILJXUDWLRQ�'LDORJ���, select tag 6��LBYDULDBZLQB��. Changethe entry in the 8SGDWH list box from the default value of 2s to 8SRQ�FKDQJH.Under 3URSHUWLHV�→�2XWSXW�,QSXW, change the 'DWD�)RUPDW to %LQDU\ and changethe Output Format to ��������.

Page 48: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-38 WinCC Configuration ManualC79000-G8276-C140-01

C action for the check box

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, long value){

SetTagDWord("S32i_varia_win_03",value);//first box selected

if (value&1) SetVisible(lpszPictureName,"Polygon1",1);else SetVisible(lpszPictureName,"Polygon1",0);//second box selected

if (value&2) SetVisible(lpszPictureName,"Polygon2",1);else SetVisible(lpszPictureName,"Polygon2",0);//third box selected

if (value&4) SetVisible(lpszPictureName,"Polygon3",1);else SetVisible(lpszPictureName,"Polygon3",0);//fourth box selected

if (value&8) SetVisible(lpszPictureName,"Polygon4",1);else SetVisible(lpszPictureName,"Polygon4",0);//fifth box selected

if (value&16) SetVisible(lpszPictureName,"Polygon5",1);else SetVisible(lpszPictureName,"Polygon5",0);//sixth box selected

if (value&32) SetVisible(lpszPictureName,"Polygon6",1);else SetVisible(lpszPictureName,"Polygon6",0);//seventh box selected

if (value&64) SetVisible(lpszPictureName,"Polygon7",1);else SetVisible(lpszPictureName,"Polygon7",0);}

• Set tag 6��LBYDULDBZLQB�� to the new input state of the FKHFN�ER[.

• Control the visibility of the objects in accordance with the input state. The input state isstored in the predefined tag YDOXH. To read out the respective bit, you have to performbit masking to the relevant bit.

1RWH�A simple example is shown in the SLFWXB�� project in the chapter entitled '\QDPLFV inH[DPSOH�. In this case, however, visibility is queried for each individual object by means ofthe '\QDPLF�'LDORJ.

1RWHV�RQ�JHQHUDO�XVH

The following adaptation must be made before the &KHFN�%R[ can be put to general use:• Adapt the tag and the object names in the &�DFWLRQ under (YHQWV�→�3URSHUW\�7RSLFV�→

2XWSXW�,QSXW�→�6HOHFWHG�%R[HV.

Page 49: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-39C79000-G8276-C140-01

���� %LW�HGLWLQJ�LQ�ZRUGV

You access the solutions that relate to these topics in our

YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepictures YDULDB�BFKDSWHUB���SGO and YDULDB�BFKDSWHUB��D�SGO.

'HILQLWLRQ

The term ELW�HGLWLQJ refers to changing the state of bits in a word.

Page 50: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-40 WinCC Configuration ManualC79000-G8276-C140-01

������ 'LUHFWO\�VHWWLQJ�D�ELW�ZLWK�WKH�DLG�RI�D�FKHFN�ER[�DQG�GLUHFWFRQQHFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

The state of a bit in a word is to be changed when this bit is selected. We want to be able toselect several bits.

,PSOHPHQWDWLRQ�FRQFHSW

We implement changing of the bit states by means of a check box, which we create under

:LQGRZV�2EMHFWV�→�&KHFN�%R[. When we 8 one of the fields of the &KHFN�%R[, the bitassigned to it in the LQWHUQDO�WDJ is changed with the aid of a GLUHFW�FRQQHFWLRQ.The bit pattern is displayed by means of an I/O field created under 6PDUW�2EMHFWV�→�,�2)LHOG. The output value of the ,�2�ILHOG is linked to an LQWHUQDO�WDJ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��GLUHFWO\�VHWWLQJ�D�ELW�ZLWK�WKH�DLG�RI�D�FKHFN�ER[�DQG�GLUHFWFRQQHFWLRQ

1 Create a tag of type 8QVLJQHG����ELW�YDOXH in Tag Management. In our example,we use the tag called 8��LBYDULDBVHWB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named 8��LBYDULDBVHWB��. Change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW. Under 3URSHUWLHV�→�2XWSXW�,QSXW, change the'DWD�)RUPDW to %LQDU\ and change the 2XWSXW�)RUPDW to �����������������.

3 In the same picture, configure a :LQGRZV�2EMHFWV�→�&KHFN�%R[��In our example,we use the object called &KHFN�%R[�. Under 3URSHUWLHV�→�*HRPHWU\�→�1XPEHU

Page 51: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-41C79000-G8276-C140-01

6WHS 3URFHGXUH��GLUHFWO\�VHWWLQJ�D�ELW�ZLWK�WKH�DLG�RI�D�FKHFN�ER[�DQG�GLUHFWFRQQHFWLRQ

RI�%R[HV, change the default value 3 to ��.

4 Select the index value 1 under 3URSHUWLHV�→�)RQW�→�,QGH[�→��. Enter theappropriate text for the selected index under 3URSHUWLHV�→�)RQW�→�7H[W�→�ELW��.In the same way, configure the values for the remaining index inputs.

5 Under (YHQWV�→�3URSHUW\�7RSLFV�→�6HOHFWHG�%R[HV, dynamize this event using aGLUHFW�FRQQHFWLRQ.

6 In the 'LUHFW�&RQQHFWLRQ dialog box, connect the VRXUFH 3URSHUW\�→�WKLV�REMHFW→�6HOHFWHG�%R[HV to the target 9DULDEOH�→8��LBYDULDBVHWB��. Accept thesettings by clicking the 2. button.

Page 52: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-42 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��GLUHFWO\�VHWWLQJ�D�ELW�ZLWK�WKH�DLG�RI�D�FKHFN�ER[�DQG�GLUHFWFRQQHFWLRQ

7 Configure two :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use the objectscalled %XWWRQ� and %XWWRQ�. These will be used to set and reset all bits.

8 Create a GLUHFW�FRQQHFWLRQ for under (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ. Connectthe VRXUFH &RQVWDQW�→������ to the WDUJHW 2EMHFW�LQ�3LFWXUH�→&KHFN�%R[��→6HOHFWHG�%R[HV. Accept the settings by clicking the 2. button. The constantselected corresponds to the binary number 1111111111111111.

Create a GLUHFW�FRQQHFWLRQ linked to the object %XWWRQ� in the same way, but thistime with the VRXUFH &RQVWDQW�→��.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tags must be adapted in the GLUHFW�FRQQHFWLRQV.

Page 53: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-43C79000-G8276-C140-01

������ 6HOHFWLQJ�D�ELW�DQG�FKDQJLQJ�LWV�VWDWH��H[DPSOH����

7DVN�GHILQLWLRQ

The state of a bit in a word is to be changed by entering its bit number and clicking aEXWWRQ. Switching from 0 to 1 and vice versa.

,PSOHPHQWDWLRQ�FRQFHSW

We implement changing of the bit states by means of a button, which we create under:LQGRZV�2EMHFWV�→�%XWWRQ.To enter the bit number and display the bit pattern, we use a 6PDUW�2EMHFWV�→�,�2�)LHOG.

When we enter the bit number and 8 the EXWWRQ, the selected bit in an LQWHUQDO�WDJ ischanged. The change is implemented by means of a &�DFWLRQ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�D�ELW�LQ�D�ZRUG

1 Create two tags of type 8QVLJQHG����ELW�YDOXH in Tag Management. In ourexample, we use the tags called 8��LBYDULDBVHWB�� and 8��LBYDULDBVHWB���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG,connect it to tag 8��LBYDULDBVHWB��. Change the entry in the 8SGDWH list boxfrom the default value of 2s to 8SRQ�FKDQJH. The bit number is entered in thisinput field.

Page 54: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-44 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FKDQJLQJ�D�ELW�LQ�D�ZRUG

3 Configure a second ,�2�ILHOG for displaying the bit states. In our example, we usethe object called ,�2�)LHOG�. When configuring the ,�2�ILHOG, connect it to tag8��LBYDULDBVHWB��. Change the entry in the 8SGDWH list box from the defaultvalue of 2s to 8SRQ�FKDQJH. Change the field type to 2XWSXW. Under 3URSHUWLHV→�2XWSXW�,QSXW, change the 'DWD�)RUPDW to %LQDU\ and change the 2XWSXW)RUPDW to �����������������.

4 In the same picture, configure three buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. Inour example, we use the objects called %XWWRQ�, %XWWRQ� and %XWWRQ�.

5 Create a &�DFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. This &�DFWLRQis to be used to set the bit selected in the ,�2�ILHOG in an LQWHUQDO�WDJ. In the sameway, create &�DFWLRQV under the other EXWWRQV for resetting and toggling the bit.

C action for set button

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){WORD word,pos;

//get word and bit positionpos=GetTagWord("U16i_varia_set_09");word=GetTagWord("U16i_varia_set_08");

word = (WORD)(word|1<<pos);

SetTagWord("U16i_varia_set_08",word);}

• Declare the &�WDJV.

• Use the LQWHUQDO�IXQFWLRQ *HW7DJ:RUG to read out the bit position entered and thecurrent value of the tag.

• The bit shift function (<<) is used to generate the corresponding bit mask. This is ORed(|) bit-by-bit with the contents of the tag to be processed. The states of the other bits areretained.

• Assign the new value to the LQWHUQDO�WDJ.

Page 55: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-45C79000-G8276-C140-01

C action for reset button

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){WORD word,pos;

//get word and bit positionpos=GetTagWord("U16i_varia_set_09");word=GetTagWord("U16i_varia_set_08");

word=(WORD)(word&~(1<<pos));

SetTagWord("U16i_varia_set_08",word);}

• Declare the &�WDJV.

• Use the LQWHUQDO�IXQFWLRQ *HW7DJ:RUG to read out the bit position entered and thecurrent value of the tag.

• The bit shift function (<<) is used to generate the corresponding bit mask. This iscomplemented with the operator (~) and ANDed (&) bit-by-bit with the contents of thetag to be processed.

• Assign the new value to the LQWHUQDO�WDJ.

C action for toggle button

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){WORD word,pos;

//get word and bit positionpos=GetTagWord("U16i_varia_set_09");word=GetTagWord("U16i_varia_set_08");

word = (WORD)(word^1<<pos);

SetTagWord("U16i_varia_set_08",word);}

• Declare the &�WDJV.

• Use the LQWHUQDO�IXQFWLRQ *HW7DJ:RUG to read out the bit position entered and thecurrent value of the tag.

• The bit shift function (<<) is used to generate the corresponding bit mask. This isEXORed (^) bit-by-bit with the contents of the tag to be processed. The states of theother bits are retained.

• Assign the new value to the LQWHUQDO�WDJ.

Page 56: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-46 WinCC Configuration ManualC79000-G8276-C140-01

������ 7KH�RWKHU�H[DPSOHV�UHODWHG�WR�WKLV�WRSLF

H[DPSOH���

The functionality of this example is similar to that of example H[DPSOH���. The basicdifference is in the way the bit to be switched is selected. In this example, the bit isswitched by selecting an object which represents this bit. Each object is able to read outwhich bit it is responsible for from its object name.

H[DPSOH���

The functionality of this example is similar to that of example H[DPSOH���. The difference

is that the bit is immediately toggled on being selected with the 8. Here too, the objectsare assigned to the bits by means of the Object name.

H[DPSOH���

The functionality of this example is similar to that of example H[DPSOH���. The differencehere is that an option group is used. Use of this object type means that only one bit can beset in each data word.

Page 57: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-47C79000-G8276-C140-01

���� ,QGLUHFW�DGGUHVVLQJ�RI�WDJV

You access the solutions that relate to these topics in our

YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepicture named YDULDB�BFKDSWHUB���SGO.

Page 58: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-48 WinCC Configuration ManualC79000-G8276-C140-01

������ ,QGLUHFW�DGGUHVVLQJ�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

Various process values are to be displayed in an ,�2�ILHOG. The corresponding values are tobe selected by means of EXWWRQV.

,PSOHPHQWDWLRQ�FRQFHSW

We implement selection of the corresponding process values by means of a button, whichwe create under :LQGRZV�2EMHFWV�→�%XWWRQ.We use an I/O field created under 6PDUW�2EMHFWV�→�,�2�)LHOG and indirect addressing inWinCC to display the process values. Three more I/O fields created under 6PDUW�2EMHFWV�→,�2�ILHOGV�also enable you to enter the process value directly.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��LQGLUHFW�DGGUHVVLQJ�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ

1 Create three tags of type 6LJQHG����ELW�YDOXH in Tag Management. In ourexample, we use the tags called 6��LBYDULDBDGUB����6��LBYDULDBDGUB�� and6��LBYDULDBDGUB��. These contain the process values to be displayed.

2 Create a tag of type 7H[W�WDJ����ELW�FKDUDFWHU�VHW with a length of 20 characters inTag Management. In our example, we use the tag called 7��[BYDULDBDGUB��.This will be used as an address tag.

3 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named 7��[BYDULDBDGUB��. Change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW. Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW9DOXH, select the box in the ,�����,QGLUHFW� column. Select the box.

4 Configure an object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W. In our example, we

Page 59: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-49C79000-G8276-C140-01

6WHS 3URFHGXUH��LQGLUHFW�DGGUHVVLQJ�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ

use the object called 6WDWLF�7H[W�. This object indicates which process value iscurrently being displayed. The text in the object is automatically supplied by theEXWWRQ.

5 In the same picture, configure three buttons under :LQGRZV�2EMHFWV�→�%XWWRQ��Inour example, we use the objects called %XWWRQ�, %XWWRQ� and %XWWRQ�.

6 Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�6��LBYDULDBDGUB�� to the WDUJHW 9DULDEOH�→7��[BYDULDBDGUB��. Accept the settings by clicking the 2. button.

7 Create a further GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ.Connect the VRXUFH 3URSHUW\�→�WKLV�REMHFW�→�7H[W to the WDUJHW 2EMHFW�LQ�3LFWXUH→�6WDWLF�7H[W��→�7H[W. Accept the settings by clicking the 2. button.

8 Configure %XWWRQ� and %XWWRQ��in the same way as %XWWRQ�. In the first GLUHFWFRQQHFWLRQ, the tag name in the VRXUFH must be changed. The second GLUHFWFRQQHFWLRQ can be applied without any change.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names must be adapted.

Page 60: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-50 WinCC Configuration ManualC79000-G8276-C140-01

������ 0XOWLSOH[�GLVSOD\�XVLQJ�LQGLUHFW�DGGUHVVLQJ�DQG�D�&�DFWLRQ�H[DPSOH����

7DVN�GHILQLWLRQ

Three different process values of a container are to be displayed. The same display is,however, also to be set up for several containers. The relevant process values are to bedisplayed by selecting the corresponding container.

,PSOHPHQWDWLRQ�FRQFHSW

We implement selection of the corresponding container by means of an option group,which we create under :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS.We use three I/O fields created under 6PDUW�2EMHFWV�→�,�2�)LHOG and indirect addressing inWinCC to display the process values.The containers with the corresponding values are displayed in H[DPSOH���.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��PXOWLSOH[�GLVSOD\�ZLWK�LQGLUHFW�DGGUHVVLQJ

1 Create nine tags of type 6LJQHG����ELW�YDOXH in Tag Management. In our example,we use the tags called 6��LBYDULDBDGUB�� through 6��LBYDULDBDGUB��. Thesetags contain the corresponding process values of the container.

2 Create three tags of type 7H[W�WDJ����ELW�FKDUDFWHU�VHW in Tag Management. In ourexample, we use the tags called 7��[BYDULDBDGUB��, 7��[BYDULDBDGUB�� and7��[BYDULDBDGUB��. They will be used as address tags for the�,�2�ILHOGV.

3 Configure three I/O fields under 6PDUW�2EMHFWV�→�,�2�)LHOG. In our example, weuse ,�2�)LHOG�, ,�2�)LHOG� and ,�2�)LHOG�.

4 For object ,�2�)LHOG�, change the )LHOG�7\SH to 2XWSXW under 3URSHUWLHV�→2XWSXW�,QSXW. Under the property 2XWSXW�9DOXH, configure a WDJ�FRQQHFWLRQ to tag7��[BYDULDBDGUB�� and select the box in the ,�����,QGLUHFW� column. Select thebox.

5 In the same way, configure the other ,�2�ILHOGV, but connect each field to adifferent address tag.

6 Configure an option group under :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS. In ourexample, we use the object called 2SWLRQ�*URXS�.

7 Select the index 1 under 3URSHUWLHV�→�)RQW�→�,QGH[. Enter the appropriate textfor the selected index under 3URSHUWLHV�→�)RQW�→�7H[W�→�&RQWDLQHU�. In thesame way, configure the texts for the remaining index values.

8 Create a &�DFWLRQ under (YHQWV�→�3URSHUW\�7RSLFV�→�2XWSXW�,QSXW�→�6HOHFWHG%R[HV. This action describes the address tag depending on the field selected.

Page 61: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-51C79000-G8276-C140-01

C action for the option group

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, long value){char address1[20],address2[20],address3[20];

switch(value) {case 2: {

strcpy(address1,"S32i_varia_adr_03");strcpy(address2,"S32i_varia_adr_06");strcpy(address3,"S32i_varia_adr_09");}//case 2break;

case 4: {strcpy(address1,"S32i_varia_adr_04");strcpy(address2,"S32i_varia_adr_07");strcpy(address3,"S32i_varia_adr_10");}//case 4break;

default: {strcpy(address1,"S32i_varia_adr_05");strcpy(address2,"S32i_varia_adr_08");strcpy(address3,"S32i_varia_adr_11");}//defaultbreak;

}//switch

SetTagChar("T16x_varia_adr_01",address1);SetTagChar("T16x_varia_adr_02",address2);SetTagChar("T16x_varia_adr_03",address3);}

• Declaration of three &�WDJV as an array of characters.

• Copy the tag names into the tags declared beforehand, in accordance with the inputstate. The input state is stored in the predefined tag YDOXH.

• Assign the corresponding tag names to the address tags.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names must be adapted.

Page 62: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-52 WinCC Configuration ManualC79000-G8276-C140-01

������ ,QGLUHFW�DGGUHVVLQJ�E\�PHDQV�RI�&�DFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

Various process values are to be displayed in an ,�2�ILHOG. The corresponding values are tobe selected by means of an 2SWLRQ�*URXS.

,PSOHPHQWDWLRQ�FRQFHSW

We implement selection of the corresponding process value by means of an option group,which we create under :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS. We use an I/O field createdunder 6PDUW�2EMHFWV�→�,�2�)LHOG and indirect addressing in WinCC to display the processvalue.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��LQGLUHFW�DGGUHVVLQJ�E\�PHDQV�RI�D�&�DFWLRQ

1 Create three tags of type 6LJQHG����ELW�YDOXH in Tag Management. In ourexample, we use the tags called 6��LBYDULDBDGUB����6��LBYDULDBDGUB�� and6��LBYDULDBDGUB��. These contain the process values to be displayed.

2 Create a tag of type 7H[W�WDJ����ELW�FKDUDFWHU�VHW with a length of 20 characters inTag Management. In our example, we use the tag called 7��[BYDULDBDGUB��.This will be used as an address tag.

3 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. When configuring the ,�2�ILHOG inthe FRQILJXUDWLRQ�GLDORJ, select the tag named7��[BYDULDBDGUB��. Change theentry in the list box from the default value of 2s to 8SRQ�FKDQJH and change thefield type entry (7\SH) to 2XWSXW. Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW9DOXH, select the box in the ,�����,QGLUHFW� column. Select the box.

4 In the same picture, configure a :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS. In ourexample, we use the object called 2SWLRQ�*URXS�.

5 Select the index 1 under 3URSHUWLHV�→�)RQW�→�,QGH[. Enter the appropriate textfor the selected index under 3URSHUWLHV�→�)RQW�→�7H[W�→�)LOO�/HYHO. In the sameway, configure the texts for the remaining index values.

6 Create a &�DFWLRQ under (YHQWV�→�3URSHUW\�7RSLFV�→�2XWSXW�,QSXW�→�6HOHFWHG%R[HV. This action describes the address tag depending on the field selected.

Page 63: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-53C79000-G8276-C140-01

C action for the option group

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, long value){char address[40];

//set tag according to input valueswitch(value) { case 2: strcpy(address,"S32i_varia_adr_01"); break; case 4: strcpy(address,"S32i_varia_adr_02"); break; default: strcpy(address,"S32i_varia_adr_00"); }//switchSetTagChar("T16x_varia_adr_00",address);}

• Assign a tag name to address tag 7��[BYDULDBDGUB�� in accordance with the input state.The input state is stored in the predefined tag YDOXH.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names must be adapted.

Page 64: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-54 WinCC Configuration ManualC79000-G8276-C140-01

������ 7KH�RWKHU�H[DPSOHV�UHODWHG�WR�WKLV�WRSLF

H[DPSOH���

The functionality of this example is to display the process values used in H[DPSOH���.

Page 65: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-55C79000-G8276-C140-01

���� 6LPXODWLRQ�RI�WDJV

You access the solutions that relate to these topics in our

YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepicture named YDULDB�BFKDSWHUB���SGO.

'HILQLWLRQ

The term VLPXODWLRQ refers to changing the contents of a tag without a process driverconnection. Simulation is performed using utility programs.

Page 66: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-56 WinCC Configuration ManualC79000-G8276-C140-01

������ 6LPXODWLQJ�D�WULDQJXODU�RVFLOODWLRQ�E\�PHDQV�RI�D�&�DFWLRQ�H[DPSOH����

7DVN�GHILQLWLRQ

A triangular oscillation simulation with settable values for the maximum value andminimum value is to be created. The plausibility of these values is to be verified as they areentered. Simulation is to be started and stopped by means of a EXWWRQ. Another EXWWRQ is tobe used to reset the tag value to zero.

,PSOHPHQWDWLRQ�FRQFHSW

We implement starting of the simulation and initialization by means of two buttons, whichwe create under :LQGRZV�2EMHFWV�→�%XWWRQ. To display the tag value and to input themaximum and minimum values, we will create three I/O fields under 6PDUW�2EMHFWV�→�,�2)LHOG. If simulation is started while the maximum and minimum values set are identical, amessage box pops up.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VLPXODWLQJ�D�WULDQJXODU�RVFLOODWLRQ�E\�PHDQV�RI�D�&�DFWLRQ

1 Create three tags of type 6LJQHG����ELW�YDOXH in Tag Management. In ourexample, we use the tags called 6��LBYDULDBVLPB����6��LBYDULDBVLPB�� and6��LBYDULDBVLPB���

2 Create two tags of type %LQDU\�WDJ in Tag Management. In our example, we usethe tags called %,1LBYDULDBVLPB�� and %,1LBYDULDBVLPB��.

3 Configure three I/O fields under 6PDUW�2EMHFWV�→�,�2�)LHOG. In our example, weuse ,�2�)LHOG�, ,�2�)LHOG� and ,�2�)LHOG�.

4 For object �,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag 6��LBYDULDBVLPB�� under3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH and set the trigger to 8SRQ�FKDQJH.Change the 2XWSXW�)RUPDW to ����. In the same way, configure ,�2�)LHOG�, butset tag 6��LBYDULDBVLPB���

� 7R�FKHFN�WKH�SODXVLELOLW\�RI�,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag6��LBYDULDBVLPB�� under 3URSHUWLHV�→�/LPLWV�→�+LJK�/LPLW�9DOXH. In the sameway, configure the tag 6��LBYDULDBVLPB�� as the /RZ�/LPLW�9DOXH for ,�2�)LHOG�.

6 For object �,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag 6��LBYDULDBVLPB�� under3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH and set the trigger to 8SRQ�FKDQJH.Change the 2XWSXW�)RUPDW to ���� and the )LHOG�7\SH to 2XWSXW.

7 Configure a picture window at 6PDUW�2EMHFWV→�3LFWXUH�:LQGRZ; in our examplewe use GLDORJ�ER[� Select 3URSHUWLHV�→�0LVFHOODQHRXV�and modify the properties0RYHDEOH and %RUGHU to <HV and the 3LFWXUH�1DPH to YDULDB�BZLQGRZB��. Youcan take this picture from the sample project for use in your own projects; theinfo text and title can be changed to whatever you want.

8 Configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ; in our example, we use%XWWRQ�. Create a further GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW�9DULDEOH�→%,1LBYDULDBVLPB���.This EXWWRQ is used for initialization.

9 Configure another :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use the object

Page 67: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-57C79000-G8276-C140-01

6WHS 3URFHGXUH��VLPXODWLQJ�D�WULDQJXODU�RVFLOODWLRQ�E\�PHDQV�RI�D�&�DFWLRQ

called %XWWRQ�. Under (YHQWV�→B�0RXVH�→�3UHVV�OHIW, generate a &�DFWLRQ whichnegates the status of the %,1LBYDULDBVLPB�� tag. Under 3URSHUWLHV�→�*HRPHWU\→�3RVLWLRQ�;, create a &�DFWLRQ, which executes tag simulation.

10 Create a status display under 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\� to display thestatus of simulation. In our example, we use the object called 6WDWXV�'LVSOD\�.Under &RQILJXUDWLRQ�'LDORJ���, set tag %,1LBYDULDBVLPB�� and set the trigger to8SRQ�FKDQJH. Add another status. For status �, set the pictureJO�KELUQHB�B��%LW�EPS, and for status �, set the picture JO�KELUQHB�B��%LW�EPS.

&�DFWLRQ�IRU�WDJ�VLPXODWLRQ

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){BOOL state;static DWORD lowstore = 0;static BOOL statestore = 0;static DWORD r = 1;static DWORD i = 0;static DWORD box = 0;int high,low;

//if button init was pressed

if (GetTagBit("BINi_varia_sim_04")) { (i=lowstore); (r=1); SetTagDWord("S32i_varia_sim_00",i); SetTagDWord("BINi_varia_sim_04",0);

}

//get simulator state

state=GetTagBit("BINi_varia_sim_01");

if (state!=statestore) (box=0);

statestore=state;

//get limits

high=GetTagDWord("S32i_varia_sim_02");low=GetTagDWord("S32i_varia_sim_03");

//set low limit storeif (low!=lowstore){

lowstore = low;i=low;}//if

//if limits differentif (high!=low) {

box=0;//if simulator is activatedif (state==TRUE) {

//inc or dec according to directionif (r==1) (i=i+1);else (i=i-1);//set direction

Page 68: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-58 WinCC Configuration ManualC79000-G8276-C140-01

if (i==high) (r=0);if (i==low) (r=1);//init simulator if limit overflowif ((i>high)||(i<low)){

(i=low);(r=1);}//if

//set new value

SetTagDWord("S32i_varia_sim_00",i);}//if state

}//if (high!=low)//set visible message boxif ((high==low)&&(state==1)&&(box==0)){

box++;SetVisible("varia_3_chapter_05.PDL","dialog box",1);}

return 80;//x-pos}

• Declare tags.

• If %XWWRQ� (init)�has been pressed (clicked), set the tag value memory to the minimumvalue stored, the counter direction to ascending, the value of the LQWHUQDO�WDJ6��LBYDULDBVLPB�� to the minimum value stored and turn off the simulator.

• Read in the simulator state.

• If the state has changed, allow the message box to pop up.

• Save the state.

• Read in the maximum and minimum values.

• When the minimum value changes, update the minimum value memory.

• If the maximum and minimum values are different, the message box is allowed to popup, and simulation is performed when the simulator is turned on. Counting up orcounting down depends on the direction tag; when the limits are reached, the directionis reversed; if the limit values are exceeded, initialization takes place and tagS32i_varia_sim_00 is set to the minimum value.

• When the simulator is turned on, popping-up of the message box is enabled, and if themaximum and minimum values agree, the message box is ’set visible’ (i.e. it pops up).

• The return value is the X position of the object %XWWRQ�.

Page 69: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-59C79000-G8276-C140-01

������ 6LPXODWLRQ�E\�PHDQV�RI�DQ�H[WHUQDO�SURJUDP��H[DPSOH����

WinCC provides its own simulation program, which can simulate tags using a number ofdifferent methods. This simulation program must be installed using the 6HWXS�H[H programin the folder called 6PDUW7RROV�→�&&B6LPXODWRU on the WinCC CD.

7DVN�GHILQLWLRQ

Tags are to be simulated using the WinCC tag simulator.

,PSOHPHQWDWLRQ�FRQFHSW

We will use a number of tags, which will be displayed in I/O fields created under 6PDUW2EMHFWV�→�,�2�)LHOG and whose contents will be controlled by means of the tag simulator.

Page 70: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-60 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VLPXODWLQJ�E\�PHDQV�RI�DQ�H[WHUQDO�SURJUDP

1 Create two LQWHUQDO�WDJV of type 6LJQHG����ELW�YDOXH in Tag Management. In ourexample, we use the tags called 6��LBYDULDBVLPB�� and 6��LBYDULDBVLPB���

2 Configure two I/O fields under 6PDUW�2EMHFWV�→�,�2�)LHOG. In our example, weuse ,�2�)LHOG� and ,�2�)LHOG�.

3 For object �,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag 6��LBYDULDBVLPB�� under3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH and set the trigger to 8SRQ�FKDQJH.Change the 2XWSXW�)RUPDW to �������� and the )LHOG�7\SH to 2XWSXW�)LHOG. In thesame way, configure ,�2�)LHOG�, but set tag 6��LBYDULDBVLPB��.

4 Start the tag simulator by means of the 6LPXODWRU button. If the tag simulator hasnot been installed under the default path, set the correct path by means of the3DWK button. If the simulation program is started using a method other than theone described, you must ensure that the project in question is running in runtimemode.

5 In the simulator, select tag 6��LBYDULDBVLPB�� under the menu item (GLW�→�1HZ7DJ from the Tag Management screen which appears. Select the ,QF tab and enterthe 6WDUW�9DOXH and (QG�9DOXH. In our example, the values � and �� have beenused. Simulation is started by selecting the item DFWLYH. The value of the tag isincreased from 0 to 20, after which simulation is restarted at 0.

6 Proceed in the same way with tag 6��LBYDULDBVLPB��. In our example, the 6LQXVtab has been selected and $PSOLWXGH set to ��, 2IIVHW to �� and 2VFLOODWLRQ�WLPH to��.

1RWH�In the sample project, you can use the flag icon to select the English or German version ofthe tag simulator.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tags to be simulated and the method of simulation must be customized to suit yourown requirements.

Page 71: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-61C79000-G8276-C140-01

���� ,PSRUWLQJ���H[SRUWLQJ�WDJV

You access the solutions that relate to these topics in our

YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepicture named YDULDB�BFKDSWHUB���SGO.

7DVN�GHILQLWLRQ

The contents of Tag Management are to be read out by means of a utility program andedited in the spreadsheet program Excel. The modified data is to be able to be importedback into the WinCC project again. This procedure makes it possible to create a largenumber of tags without any great effort.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this in the project, we use two buttons which we create under :LQGRZV2EMHFWV�→�%XWWRQ; these buttons are used to start the import/export program YDUBLPH[�H[Hand H[FHO�H[H. The path to each of these programs can be set by means of two I/O fieldscreated under 6PDUW�2EMHFWV�→�,�2�)LHOG.

Page 72: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-62 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��LPSRUWLQJ���H[SRUWLQJ�WDJV

1 Set the correct paths to the programs H[FHO�H[H and YDUBLPH[�H[H.

2 Call the YDUBH[LP�H[H program by clicking the ,PS�([S EXWWRQ during runtime.The program can also be started directly in Explorer, without runtime beingactive.

3Use the EXWWRQ to set the path to project YDULDB�� and select the fileYDULDB���PFS there.

4 Select the selection field ([SRUW. Then click ([HFXWH�→�2.. Exporting of the tagsis now performed. The program generates a file with the extension YH[, whichcontains the information relating to the tags. It also creates a second file with theextension FH[, which contains the information relating to the connections to theprogrammable controller, and a third file with the extension GH[, which containsthe information relating to tags of type 'DWD�6WUXFWXUH.

5 Start ([FHO and open the YDULDBYD[�FVY file just generated by selecting )LOH�→2SHQ.

6 To configure 100 tags of type 8QVLJQHG����ELW�YDOXH, proceed as described below.The names to be assigned to these tags are to range from 8��LBYDULDBLPSH[B��through 8��LBYDULDBLPSH[B��.

7 In the first column of the first empty line, enter the name 8��LBYDULDBLPSH[B��.Select the cell and move the mouse pointer to the bottom right corner. Press and

hold down the 8 and drag the mouse pointer downward to fill in the remaining99 cells automatically.

8 In the second column, enter a ; in the third column, LQWHUQDO�WDJ; in the fourth,LPSH[S as the group name; in the fifth column, �; and in the sixth column, � asthe code for an 8QVLJQHG����ELW�YDOXH. In the remaining Columns, enter the value�. Fill in the remaining 99 lines automatically.

9 Open YDUBLPH[�H[H again via the task bar and select the selection field ,PSRUW.Then click ([HFXWH�→�2.. After completing import of the tags, exit the program.

10 100 new tags have now been created in Tag Management.

1RWH�Runtime doesn’t have to be active to enable the importing and exporting of tags.

Page 73: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-63C79000-G8276-C140-01

���� 8VLQJ�VWUXFWXUH�WDJV

You access the solutions that relate to these topics in our

YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepicture named YDULDB�BFKDSWHUB���SGO.

'HILQLWLRQ

This data type enables you to generate a data structure that forms a logical unit. Structuretags consist of various standard data types.

Page 74: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-64 WinCC Configuration ManualC79000-G8276-C140-01

������ 9DOYH�FRQWURO�E\�PHDQV�RI�D�VWUXFWXUH�WDJ��H[DPSOH����

7DVN�GHILQLWLRQ

Different states of a valve are to be displayed with the aid of a structure tag.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this, we use two buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ, withwhich we will turn the valve on and off and simulate a fault condition. We will also usepolygons created under 6WDQGDUG�2EMHFWV�→�3RO\JRQ�

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��YDOYH�FRQWURO�E\�PHDQV�RI�D�VWUXFWXUH�WDJ

1 Define a new structure tag in the &RQWURO&HQWHU. Select 1HZ�6WUXFWXUH at 'DWD

7\SHV�→�6WUXFWXUH�7\SHV using 85.

2 In the window that appears, 85 1HZ�6WUXFWXUH and select 5HQDPH in the pop-upmenu that appears. The name YDOYH has been selected in our example. Add a new

structure element by clicking the 1HZ�HOHPHQW button. Then 85 this newstructure element and select the data type %,7.

Page 75: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-65C79000-G8276-C140-01

6WHS 3URFHGXUH��YDOYH�FRQWURO�E\�PHDQV�RI�D�VWUXFWXUH�WDJ

3 Using 5HQDPH, change the name to DFWLYDWHG and select the selection fieldLQWHUQDO�WDJ. Define further structure elements as follows:

4 In Tag Management, create a tag of type YDOYH. In our example, we use the tagcalled 678LBYDULDBVWUB��. The following ELQDU\�WDJV are created in this way.

5 Configure two buttons under :LQGRZV�2EMHFWV�→�%XWWRQ; in our example, we use%XWWRQ� and %XWWRQ�. Create a &�DFWLRQ for %XWWRQ�, which turns the valve on andoff. Create a &�DFWLRQ�IRU %XWWRQ�, which turns the error bit on and off.

6 Under %XWWRQ�, configure a &�DFWLRQ under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ;, which simulates the external processes on the valve.

7 We then create three different pictures to display the on, off, and error states ofthe valve. In our example, each of these pictures consists of two polygons createdunder 6WDQGDUG�2EMHFWV�→�3RO\JRQ. These are positioned one on top of the otherand shown or hidden depending on the state of the valve.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The structure type name and the comprising structure element types and structureelement names must be adapted.

• &�DFWLRQV for simulating the external processes on the valve are not necessary inpractical applications.

Page 76: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-66 WinCC Configuration ManualC79000-G8276-C140-01

���� 6HULDO�FRQQHFWLRQ�WR�6�

You access the solutions that relate to these topics in our

YDULDB�� project by 8 the EXWWRQ depicted above. The examples are configured in thepicture named YDULDB�BFKDSWHUB���SGO.

7DVN�GHILQLWLRQ

Planning, configuring and testing a serial connection. To connection partner to be used is aSimatic PLC of the S5 system family. Data is to be read from the PLC (actual values,states) and written to the PLC (set values, instructions).

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VHULDO�FRQQHFWLRQ�WR�6�

1 In the &RQWURO�&HQWHU under 7DJ�0DQDJHPHQW, add a new driver. In our example,we use the driver 6,0$7,&�6��6(5,$/�����5.

2 Click the name of the driver with the 85, select 1HZ�'ULYHU�&RQQHFWLRQ��� andgive the connection a name on the *HQHUDO�,QIRUPDWLRQ tab; in our example, weuse 3/&�&RQQHFWLRQ. On the *URXSV tab, create a new group; in our example, weuse FRQQHFW.

3 On the 6HULDO�����5 tab, make the settings you want; in our example, thestandard values are set.

4 In the tag group, create three new tags of type 8QVLJQHG����ELW�YDOXH. The tagsmust be assigned an address in the PLC, this being set by means of the 6HOHFWbutton. The type of format adaptation selected in our example is:RUG7R8QVLJQHG:RUG. Tags 8��ZBYDULDBFRQB��, 8��ZBYDULDBFRQB�� and8��ZBYDULDBFRQB�� are used.

5 These tags are also used in the following examples.

Page 77: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���YDULDB��

WinCC Configuration Manual 2-67C79000-G8276-C140-01

������ 7KH�RWKHU�H[DPSOHV�UHODWHG�WR�WKLV�WRSLF

H[DPSOH���

The functionality of this example corresponds to the example named ������6HOHFWLQJ�D�ELWDQG�FKDQJLQJ�LWV�VWDWH��H[DPSOH���� in the section called %LW�HGLWLQJ�LQ�ZRUGV. The tag inwhich the bit is set is, however, the external data word 8��ZBYDULDBFRQB��.

H[DPSOH���

The functionality of this example corresponds to the example named ������'LUHFWO\�VHWWLQJD�ELW�ZLWK�WKH�DLG�RI�D�FKHFN�ER[�DQG�GLUHFW�FRQQHFWLRQ��H[DPSOH���� in the section called%LW�HGLWLQJ�LQ�ZRUGV. The tag in which the bit is set is, however, the external data word8��ZBYDULDBFRQB��.

H[DPSOH���

The functionality corresponds to the example named ����� 7KH�RWKHU�H[DPSOHV�UHODWHG�WRWKLV�WRSLF in the section called ,QFUHPHQWLQJ��GHFUHPHQWLQJ�DQG�MRJJLQJ. The tag which isincremented or decremented is, however, the external data word 8��ZBYDULDBFRQB��.

Page 78: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���YDULDB�� �����

2-68 WinCC Configuration ManualC79000-G8276-C140-01

Page 79: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-1C79000-G8276-C140-01

��3LFWXUH�FRQILJXUDWLRQ��3URMHFW��SLFWXB���PFS�

Details about the projects

This project presents various ways of building and opening pictures in WinCC.Picture buildup and picture opening depend on two factors: on the hardware used (anindustry PC in the form of an operator panel with integrated keyboard -OP47- or a PC inthe control room with mouse and standard keyboard) and on the application. Amanufacturer of machinery requires different things from an HMI system compared with,for example, a chemicals company.

What possibilities does WinCC have to offer

WinCC supports all screen resolutions that are supported by Windows (e.g. 640x480,800x600, 1024x768, 1280x1024). Sometimes, overview pictures have to be displayed on alarger base (e.g. 1600x1028, 2000x1500, etc.).WinCC allows you to create pictures with a maximum resolution of 4096 x 4096 pixels. Ifthese dimensions are greater than the maximum resolution of the graphics system beingused (video card with monitor), these pictures can be moved round using scroll bars.

Page 80: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-2 WinCC Configuration ManualC79000-G8276-C140-01

Assumption

The resolution of the graphics system being used is assumed to be 1024x768 pixels. Thisresolution corresponds to the recommendations with regard to ergonomics for a graphicssystem with a 17" monitor.

The examples used for these topics are configured in the WinCC project entitled SLFWXB��.

1RWH�The password for logging in is the project name, SLFWXB����A simpler way to log in is toclick /RJLQ in the title bar, click the input field 3DVVZRUG and then to confirm the input.

Page 81: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-3C79000-G8276-C140-01

���� 6FUHHQ�OD\RXW�DQG�FKDQJLQJ�SLFWXUHV

This chapter should show you a number of different ways of building and opening pictures.The basic elements (start picture, overview section and buttons section) of the screen layoutare also used in the other projects.

Page 82: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-4 WinCC Configuration ManualC79000-G8276-C140-01

������ /D\LQJ�RXW�WKH�VFUHHQ

7DVN�GHILQLWLRQ

Dynamic button set and overview section

The screen is to be divided into three sections:an overview section, a buttons section, and a section for the plant pictures.The overview and buttons sections are to be adjustable.The system is located in a control room and is controlled using a mouse and a keyboard.

,PSOHPHQWDWLRQ�FRQFHSW

The screen is set to a resolution of 1024x768 pixels. We will divide the screen into threesections. We will use two different layouts for the three sections.

Layout 1

Overview Area

Plant Representations

Button Area

Page 83: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-5C79000-G8276-C140-01

Layout 2

Overview Area

Plant RepresentationsButton Area

Logo

/D\RXW�SULQFLSOH

We use an empty start picture in which we then create 3 picture windows (overview,buttons, plant). The pictures displayed in these picture windows can be swapped overduring runtime as required. This gives us a solution which is very flexible and simple tomodify.

Overview section

In the overview section, we configure a logo, a picture title, a clock with the date and time,and an alarm line.

Buttons section

In the buttons section, we configure permanent buttons which will be displayed in everypicture and buttons which will be displayed depending on the plant picture displayed.

Plant section

In the plant section, we configure the respective plant pictures.

Page 84: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-6 WinCC Configuration ManualC79000-G8276-C140-01

���� 3LFWXUH�FKDQJH

In runtime, you access the examples that relate to these topics in our SLFWXB�� project by

8 the button depicted above. The examples are configured in the picturesSLFWXB�BFKDSWHUB���SGO and SLFWXB�BFKDSWHUB��D�SGO.

Page 85: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-7C79000-G8276-C140-01

������ 2SHQLQJ�D�SLFWXUH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ�DQG�GLVSOD\LQJWKH�SLFWXUH�QDPH��H[DPSOH����

7DVN�GHILQLWLRQ

The picture in the picture window is to be changed by clicking a EXWWRQ with the mouse; thischange is to be executed with the aid of a direct connection.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 8 to change the picture displayed in the 6PDUW�2EMHFWV→�3LFWXUH�:LQGRZ. We display the picture name in the picture by means of 6WDQGDUG2EMHFWV�→�6WDWLF�7H[W.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ�DQG�GLVSOD\LQJWKH�SLFWXUH�QDPH

1 Create a new picture by selecting�)LOH�→�1HZ and then select )LOH�→�6DYH�DV��� tosave it under the name SLFWXB�BZLQGRZB���SGO. Change the picture geometry bysetting 3URSHUWLHV�→�*HRPHWU\�→�3LFWXUH�:LGWK to ��� and 3URSHUWLHV�→*HRPHWU\�→�3LFWXUH�+HLJKW to ���.

2 In picture SLFWXB�BZLQGRZB���SGO, configure the 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W.In our example, we use the object called 6WDWLF�7H[W�. Change 3URSHUWLHV�→�)RQW→�%ROG to <HV. Under 3URSHUWLHV�→�)RQW�→�7H[W, delete the default text in the6WDWLF column. This prevents an incorrect text from being output at the moment ofpicture buildup.

Dynamize the object using a &�DFWLRQ��7KLV�&�DFWLRQ returns the current picturename as the return value. The trigger we use for the &�DFWLRQ is the 6WDQGDUGF\FOH�→��K (low system load, no change).

3 In picture SLFWXB�BZLQGRZB���SGO, configure the information to be displayed. Inour example, we use 7DQN� from the Global Library. The library is opened by

choosing 9LHZ�→�/LEUDU\ from the menu or by choosing the button on thetoolbar.

Make sure that the symbol view function is selected by means of the EXWWRQ,so that a preview of the individual objects is displayed.

Page 86: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-8 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ�DQG�GLVSOD\LQJWKH�SLFWXUH�QDPH

4 Configure two more pictures by saving the picture you have just configured onceagain, but this time under the name SLFWXB�BZLQGRZB���SGO, and then saving thispicture under the name SLFWXB�BZLQGRZB���SGO ()LOH�→�6DYH�$V���). This gives ustwo copies of SLFWXB�BZLQGRZB���SGO��Now insert the content you want into thenew pictures created. There’s no need to change the 6WDWLF�7H[W� object fordisplaying the picture name.

5 Configure a new picture by selecting )LOH�→�1HZ. In this picture, configure apicture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ. In our example, we use3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUH�ZLQGRZ to the size of the picturesjust created by means of 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�:LGWK and3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW. In order to display the window witha border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to <HV.

6 Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with thename SLFWXB�BZLQGRZB���SGO. This sets the picture to be displayed by the3LFWXUH�:LQGRZ� object when the picture is opened.

Page 87: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-9C79000-G8276-C140-01

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ�DQG�GLVSOD\LQJWKH�SLFWXUH�QDPH

7 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Create a further GLUHFWFRQQHFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW.

Under 6RXUFH, select &RQVWDQW and click the now active button to display aselection list of all the pictures available. Select the SLFWXB�BZLQGRZB���SGOpicture and under 7DUJHW, select 2EMHFW�LQ�3LFWXUH, 3LFWXUH�:LQGRZ� as the objectand 3LFWXUH�1DPH as the property.

Accept the settings by clicking the 2. button.

Page 88: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-10 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ�DQG�GLVSOD\LQJWKH�SLFWXUH�QDPH

8 Select the now configured %XWWRQ� by clicking it with the 8 and duplicate theobject by means of (GLW�→�'XSOLFDWH. Repeat this procedure once more. We nowhave two more buttons, %XWWRQ� and %XWWRQ�. Under (YHQWV�→�0RXVH�→�3UHVVOHIW, modify the GLUHFW�FRQQHFWLRQ configured. Change the 6RXUFH for %XWWRQ� toSLFWXB�BZLQGRZB���SGO and the 6RXUFH for %XWWRQ� to SLFWXB�BZLQGRZB���SGO.

C action for Static Text1

#include "apdefap.h"char* _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){char *name = lpszPictureName;char *pdest;int ch = ’:’;

//check if picture path contains charpdest = strrchr( lpszPictureName, ch );//read only picture name without pathif ( pdest == NULL ) return lpszPictureName;else {

name = strcpy(name,strrchr(name,’:’)+1);return name;}//else

}

• Declare the &�WDJV.

• Check whether OSV]3LFWXUH1DPH contains only the picture name. You do this using thefunction VWUUFKU. This function searches through OSV]3LFWXUH1DPH. If the picture isdisplayed in a SLFWXUH�ZLQGRZ, OSV]3LFWXUH1DPH contains the picture name with thecomplete path of the picture.

• In the first case, return OSV]3LFWXUH1DPH directly as the return value.

Page 89: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-11C79000-G8276-C140-01

• In the latter case, read only the picture name out of the picture path and return this nameas the return value.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The object 6WDWLF�7H[W� can be transferred directly to any other SLFWXUH�ZLQGRZ. Thisobject is also suitable for being stored in the project library. In this way, it can quitesimply be inserted into any picture by means of drag&drop.

• The picture name to be displayed and the object name of the SLFWXUH�ZLQGRZ must beadapted in the GLUHFW�FRQQHFWLRQ for %XWWRQ�.

• Pictures, picture contents and SLFWXUH�ZLQGRZV that are to be displayed must be laid outas you need them. The height and width of the picture and the SLFWXUH�ZLQGRZ shouldagree.

Page 90: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-12 WinCC Configuration ManualC79000-G8276-C140-01

������ 2SHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�'\QDPLF�:L]DUG��H[DPSOH����

7DVN�GHILQLWLRQ

The picture in the SLFWXUH�ZLQGRZ is to be changed by clicking a EXWWRQ with the mouse;configuration of the button is to be performed by means of the '\QDPLF�:L]DUG.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 85 to change the picture displayed in the 6PDUW�2EMHFWV→�3LFWXUH�:LQGRZ. We will use the pictures already configured in the previous example.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�'\QDPLF�:L]DUG

1 In a picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ.In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUH�ZLQGRZto the size of the screen and change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to<HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture withthe name SLFWXB�BZLQGRZB���SGO.

2 If the '\QDPLF�:L]DUG isn’t visible, activate it by selecting 9LHZ�→�7RROEDUV���

3 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. With the object selected, select

the 3LFWXUH�)XQFWLRQV tab from the '\QDPLF�:L]DUG and 8' the 3LFWXUH&KDQJH�LQ�WKH�:LQGRZ option. In the '\QDPLF�:L]DUG on the page entitled 6HOHFWWULJJHU, select 5LJKW�PRXVH�EXWWRQ and choose 1H[W to close the page. Fill in the6HW�RSWLRQV page as follows:

Page 91: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-13C79000-G8276-C140-01

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�'\QDPLF�:L]DUG

Click the EXWWRQ to display a list of the pictures available in the project. Closethe )LQLVKHG�� page by clicking )LQLVK.

4 Configure two more buttons under :LQGRZV�2EMHFWV�→�%XWWRQ; in our example,we use %XWWRQ� and %XWWRQ�. Apply the '\QDPLF�:L]DUG to these buttons, too. Inthe 6HW�RSWLRQV window, set SLFWXB�BZLQGRZB���SGO as the GHVWLQDWLRQ�SLFWXUHQDPH for %XWWRQ� and SLFWXB�BZLQGRZB���SGO for %XWWRQ�.

C action generated by the Dynamic Wizard

#include "apdefap.h"void OnRButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){static char szPicture[22] = "pictu_5_window_00.PDL";static char* tmp = &szPicture[0];PDLRTSetPropEx(PDLRT_AM_PICTABS, "pictu_3_chapter_01","PictureWindow2", "PictureName",VT_LPSTR,&tmp,NULL,NULL,0,NULL, NULL);}

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Adapt the settings in the '\QDPLF�:L]DUG to suit your own needs.

Page 92: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-14 WinCC Configuration ManualC79000-G8276-C140-01

������ 2SHQLQJ�D�SLFWXUH�E\�PHDQV�RI�LQWHUQDO�IXQFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

The picture in the SLFWXUH�ZLQGRZ is to be changed by clicking a EXWWRQ with the mouse;configuration of the EXWWRQ is to be performed by means of a C action.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 8 to change the picture displayed in the 6PDUW�2EMHFWV→�3LFWXUH�:LQGRZ. We will use the pictures from the previous example.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�LQWHUQDO�IXQFWLRQ

1 In a picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ.In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUH�ZLQGRZto the size of the screen and change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to<HV.

Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with thename SLFWXB�BZLQGRZB���SGO.

2 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Under (YHQWV�→�0RXVH�→3UHVV�OHIW, configure the &�DFWLRQ for changing picture. Configure two moreEXWWRQV; in our example, we use %XWWRQ��and %XWWRQ�, which are equipped withan appropriately modified &�DFWLRQ.

C action for Button4

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetPictureName("pictu_3_chapter_01.PDL", "PictureWindow2","pictu_5_window_00");}

• Using the LQWHUQDO�IXQFWLRQ 6HW3LFWXUH1DPH, switch the picture SLFWX�BZLQGRZB���SGOto the object 3LFWXUH�:LQGRZ�. SLFWXB�BFKDSWHUB���SGO is the name of the picture inwhich the SLFWXUH�ZLQGRZ is located.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The parameters of the LQWHUQDO�IXQFWLRQ6HW3LFWXUH1DPH must be adapted to suit yourown needs.

Page 93: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-15C79000-G8276-C140-01

������ 6LQJOH�SLFWXUH�FKDQJH�E\�PHDQV�RI�WKH�'\QDPLF�:L]DUG�H[DPSOH����

7DVN�GHILQLWLRQ

The picture displayed during runtime is to be changed by clicking a EXWWRQ. Configuration isto be implemented using the '\QDPLF�:L]DUG.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 8 to change the picture displayed during runtime.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VLQJOH�SLFWXUH�FKDQJH�E\�PHDQV�RI�WKH�'\QDPLF�:L]DUG

1 In our example, the picture change is from SLFWXB�BVWDUWSLFWXUHB���SGO toSLFWXB�BFKDSWHUB��D�SGO. In the sample project, pictureSLFWXB�BVWDUWSLFWXUHB���SGO is always selected and only picture changes betweenwindows are performed there. By using the &�DFWLRQ generated by the '\QDPLF:L]DUG, the entire picture system displayed during runtime is replaced by the onecalled. Changing back to SLFWXB�BVWDUWSLFWXUHB���SGO is like completely restartingthe picture project.

2 In the picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, we use the object called %XWWRQ�.

3 With the object selected, select the 3LFWXUH�)XQFWLRQV tab from the '\QDPLF

:L]DUG and 8' the 6LQJOH�SLFWXUH�FKDQJH option. In the '\QDPLF�:L]DUG onthe page entitled 6HOHFW�WULJJHU, select the /HIW�PRXVH�EXWWRQ list entry and choose1H[W to close the page. Fill in the 6HW�RSWLRQV page as follows:

Click the EXWWRQ to display a listof the pictures available in the project. Close the )LQLVKHG�� page by clicking)LQLVK.

4 If the picture change is performed in the sample project, you can return to theproject by clicking the

button.

Page 94: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-16 WinCC Configuration ManualC79000-G8276-C140-01

C action generated by the Dynamic Wizard

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){OpenPicture("pictu_3_chapter_01a.PDL");}

• The '\QDPLF�:L]DUG generates a &�DFWLRQ. This &�DFWLRQ uses a VWDQGDUG�IXQFWLRQcalled 2SHQ3LFWXUH, thus switching the picture �SLFWXB�BFKDSWHUB��D�SGO to runtime.The &�DFWLRQ generated can itself also be programmed.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Adapt the settings in the '\QDPLF�:L]DUG to suit your own needs.

Page 95: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-17C79000-G8276-C140-01

������ 6LQJOH�SLFWXUH�FKDQJH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ��H[DPSOH����

→�You access this example in our project SLFWXB�� by clicking the two�EXWWRQV.

7DVN�GHILQLWLRQ

In contrast to the previous examples, clicking a EXWWRQ will in this case lead to the entirepicture being changed. This isn’t intended to just change the contents of a picture window; anew picture is opened.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 8 to change the picture. The button is configure using aGLUHFW�FRQQHFWLRQ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VLQJOH�SLFWXUH�FKDQJH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ

1 In our example, the picture change is from SLFWXB�BFKDSWHUB��D�SGO toSLFWXB�BVWDUWSLFWXUHB���SGO.

2 In the picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, we use the object called %XWWRQ�.

3 In the &KDQJH�3LFWXUH�RQ�0RXVH�&OLFN section of the %XWWRQ�&RQILJXUDWLRQdialog, select the picture SLFWXB�BVWDUWSLFWXUHB�� by means of the selectionwindow. This automatically leads to the generation of a GLUHFW�FRQQHFWLRQ under(YHQWV�→�0RXVH�→�0RXVH�$FWLRQ. This connection can also be generated bymeans of the 2EMHFW�3URSHUWLHV dialog box.

Page 96: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-18 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��VLQJOH�SLFWXUH�FKDQJH�E\�PHDQV�RI�D�GLUHFW�FRQQHFWLRQ

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The picture name to be displayed and the object name of the picture window must beadapted in the GLUHFW�FRQQHFWLRQ for %XWWRQ�.

Page 97: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-19C79000-G8276-C140-01

������ 2SHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�REMHFW�QDPH�DQG�DQ�LQWHUQDOIXQFWLRQ��H[DPSOH����

→�You access this example in our project SLFWXB�� by clicking the two�EXWWRQV.

7DVN�GHILQLWLRQ

The picture in a SLFWXUH�ZLQGRZ is to be changed by clicking a button. The EXWWRQ is torecognize which picture it is to call by means of its object name, and is consequently onlysupposed to be reusable for making further copies after its object name is changed.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 8 to change the picture displayed in the 6PDUW�2EMHFWV�→3LFWXUH�:LQGRZ. We will use the pictures already configured in the previous example. Thenames of these pictures comprise two components: a text section and a picture number.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�REMHFW�QDPH�DQG�DQ�LQWHUQDOIXQFWLRQ

1 In a picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ.In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUH�ZLQGRZto match the size of the pictures previously created. In order to display thewindow with a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→%RUGHU to <HV.

Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with thename SLFWXB�BZLQGRZB���SGO.

2 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Under (YHQWV�→�0RXVH�→3UHVV�OHIW, configure a &�DFWLRQ which reads out the name and number of theEXWWRQ and displays the picture you want in accordance with the agreed nameconventions.

3 Duplicate %XWWRQ� twice and change the object names to %XWWRQ� and %XWWRQ�.

Page 98: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-20 WinCC Configuration ManualC79000-G8276-C140-01

C action for Button0

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){char name[30];int number;int ch = ’n’;char *pdest;

//check if object name contains characterpdest = strrchr( lpszObjectName, ch );if ( pdest == NULL )(printf("ObjectNameError"));else { //read object number number = atoi(strrchr(lpszObjectName,’n’)+1); //generate picture name sprintf(name,"pictu_5_window_%02d.PDL",number); //set picture name SetPictureName("pictu_3_chapter_01a.PDL","Picture Window1",name); }}

• Declare the &�WDJV.

• Check whether the object has been named in accordance with the agreed guidelines. Theobjects are given the name [button]+[number of the picture to be called].

• Output of an error message if the character in front of the number, namely n, is notfound.

• Reading the number out of the button name. The function VWUUFKU searches backwardthrough the name for the character and the character string that follows the Q is pickedup and converted into an integer value by the function DWRL.

• The VSULQWI function uses the two components, namely the picture name to be called andthe picture number, to generate the complete picture name to be called up by the EXWWRQ.

• The LQWHUQDO�IXQFWLRQ 6HW3LFWXUH1DPH�is then used to switch the picture to be called tothe object 3LFWXUH�:LQGRZ�.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The &�DFWLRQ for the EXWWRQ and assignment of the object name must be adapted to be inaccordance with your own name conventions. Make sure that these name conventionsare always strictly observed, both in object names and picture names, in order toguarantee perfect accessing of the picture you want to open.

Page 99: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-21C79000-G8276-C140-01

������ 2SHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�REMHFW�QDPH�DQG�D�WDJFRQQHFWLRQ��ZLWK�GLVSOD\�RI�WKH�SLFWXUH�QDPH��H[DPSOH����

→�You access this example in our project SLFWXB�� by clicking the two�EXWWRQV.

7DVN�GHILQLWLRQ

The picture in a SLFWXUH�ZLQGRZ is to be changed by clicking a EXWWRQ. The EXWWRQ is torecognize which picture it is to call by means of its object name, and is consequently onlysupposed to be reusable for making further copies after its object name is changed. Thepicture name is to be stored in a text tag and displayed in a text field which isn’t in theactual picture.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, which we click with the 8 to change the picture displayed in the 6PDUW�2EMHFWV→�3LFWXUH�:LQGRZ. We will use the pictures already configured in the previous example.The names of these pictures comprise two components: a text section and a picture number.In addition, we use a static text created under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W to display thepicture name.

Page 100: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-22 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��RSHQLQJ�D�SLFWXUH�E\�PHDQV�RI�WKH�REMHFW�QDPH�DQG�D�WDJFRQQHFWLRQ��ZLWK�GLVSOD\�RI�WKH�SLFWXUH�QDPH

1 Create a tag of type 7H[W�WDJ����ELW�FKDUDFWHU�VHW with a length of 30 characters inTag Management. In our example, we use the tag called 7��[BVHOHFB��. This tagcontains the name of the picture displayed in the SLFWXUH�ZLQGRZ.

2 Call the properties dialog box of the picture object with the nameSLFBFKDSWHUB��D�SGO.

Under (YHQWV→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH, configure a &�DFWLRQ whichassigns the picture name SLFWXB�BZLQGRZB���SGO to tag 7��[BVHOHFB��. Thiscorresponds to the picture that is to be displayed the first time a picture is opened.

3 In a picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ.In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUH�ZLQGRZto match the size of the pictures previously created. In order to display thewindow with a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→%RUGHU to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, selectSLFWXB�BZLQGRZB���SGO and create a WDJ�FRQQHFWLRQ to tag 7��[BVHOHFB��.

4 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQB�. Under (YHQWV�→�0RXVH�→3UHVV�OHIW, configure a &�DFWLRQ which reads out the name and number of theEXWWRQ and assigns this name to the LQWHUQDO�WDJ 7��[BVHOHFB��.

5 Duplicate %XWWRQB� twice and change the object names to %XWWRQB� and %XWWRQB�.

6 In the picture, configure a static text (6PDUW�2EMHFWV�→�6WDWLF�7H[W��above 3LFWXUH:LQGRZ�; in our example, we use the object 6WDWLF�7H[W�. Change 3URSHUWLHV�→)RQW�→�%ROG to <HV. Under 3URSHUWLHV�→�)RQW�→�7H[W, delete the default text inthe 6WDWLF column and create a WDJ�FRQQHFWLRQ to tag 7��[BVHOHFB��. Set updatingto take place 8SRQ�FKDQJH. Deleting the static entry prevents an incorrect textfrom being output at the moment of picture buildup.

Page 101: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-23C79000-G8276-C140-01

C action for Open Picture

#include "apdefap.h"void OnOpenPicture(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName){SetTagChar("T16x_selec_00","pic_window_01.pdl");}

• Assigning the picture name by means of the LQWHUQDO�IXQFWLRQ 6HW7DJ&KDU.

C action for Button_0

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){char name[30];int number;int ch = ’_’;char *pdest;

//check if object name contains characterpdest = strrchr( lpszObjectName, ch );if ( pdest == NULL )(printf("ObjectNameError"));else { //read object number number = atoi(strrchr(lpszObjectName,’_’)+1); //generate picture name sprintf(name,"pictu_5_window_%02d.PDL",number); //set tag which contains picture name SetTagChar("T16x_selec_00",name); }}

• Declare the LQWHUQDO�WDJV.

• Check whether the object has been named in accordance with the agreed guidelines. Theobjects are given the name [button]+[_]+[number of the picture to be called].

• Output of an error message if the character in front of the number, namely _, is notfound.

• Reading the number out of the button name. The function VWUUFKU searches backwardthrough the name for the character B and the character string that follows the B is pickedup and converted into an integer value by the function DWRL.

• The VSULQWI function uses the two components, namely the picture name to be called andthe picture number, to generate the complete picture name to be called up by the EXWWRQ.

• The LQWHUQDO�IXQFWLRQ 6HW7DJ&KDU�is then used to transfer the picture name to be calledto tag 7��[BVHOHFB��.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The�&�DFWLRQ for the EXWWRQ and assignment of the object name must be adapted to be inaccordance with your own name conventions. Make sure that these name conventionsare always strictly observed, both in object names and picture names, in order toguarantee perfect accessing of a picture you want to open.

Page 102: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-24 WinCC Configuration ManualC79000-G8276-C140-01

���� 6KXWGRZQ�:LQ&&���DFFHVV�SURWHFWLRQ

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 103: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-25C79000-G8276-C140-01

������ 6KXWWLQJ�GRZQ��H[LWLQJ��UXQWLPH�DQG�WKH�V\VWHP��H[DPSOH����

7DVN�GHILQLWLRQ

Two EXWWRQV are to be used by means of the mouse to select two windows via which eitherruntime or the complete system is shut down.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, each of which displays a picture in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click it with the 8. In the individual pictures, two buttons created under :LQGRZV�2EMHFWV→�%XWWRQ are to enable either the corresponding system function to be called or theprocedure to be canceled.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKXWWLQJ�GRZQ��H[LWLQJ��UXQWLPH�DQG�WKH�V\VWHP

1 Configure a picture that is to be used to shut down (exit) runtime; in our example,we use picture SLFWXB�BZLQGRZB���SGO.

2 In this picture, configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ; in ourexample, we use %XWWRQ�.With the object selected, select the 6\VWHP�)XQFWLRQV

tab from the '\QDPLF�:L]DUG and 8' the ([LW�:LQ&&�RU�:LQGRZV option. Inthe '\QDPLF�:L]DUG on the page entitled 6HOHFW�WULJJHU, select /HIW�PRXVH�EXWWRQ

and 8 1H[W. On the 6HW�RSWLRQV page, select ([LW�:LQGRZV. Close the )LQLVKHG��page by clicking )LQLVK.

3 Configure another :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use the objectcalled %XWWRQ�. This is used to cancel the procedure. Under (YHQWV�→�0RXVH�→3UHVV�OHIW, configure a GLUHFW�FRQQHFWLRQ which hides the picture.

4 Configure another picture that is to be used to shut down the system; in ourexample, we use picture SLFWXB�BZLQGRZB���SGO.

5 In this picture, configure a :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we usethe object called %XWWRQ�. With the object selected, select the 6\VWHP�)XQFWLRQV

tab from the '\QDPLF�:L]DUG and 8' the ([LW�:LQ&&�5XQWLPH option. In the'\QDPLF�:L]DUG on the page entitled 6HOHFW�WULJJHU, select /HIW�PRXVH�EXWWRQ and

8 1H[W. Close the )LQLVKHG�� page by clicking )LQLVK.

6 Configure another :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use the objectcalled %XWWRQ�. This is used to cancel the procedure. Under (YHQWV�→�0RXVH�→3UHVV�OHIW, configure a GLUHFW�FRQQHFWLRQ which hides the picture.

7 In another picture, configure two picture windows under 6PDUW�2EMHFWV�→3LFWXUH�:LQGRZ; in our example, we use the objects 3LFWXUH�:LQGRZ� and3LFWXUH�:LQGRZ�, which, however are tiled. Adjust the size of the SLFWXUHZLQGRZV to match the size of the pictures just configured. If the SLFWXUH�ZLQGRZVare to be displayed with borders, :LQGRZ�+HLJKW and the :LQGRZ�:LGWK of theSLFWXUH�ZLQGRZV must be set 10 pixels greater than those of the pictures, so thatthe entire picture can be displayed. Enter the respective picture names under3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH. Change 3URSHUWLHV�→

Page 104: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-26 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��VKXWWLQJ�GRZQ��H[LWLQJ��UXQWLPH�DQG�WKH�V\VWHP

0LVFHOODQHRXV�→�'LVSOD\ to 1R.

8 In the same picture, configure two button objects under :LQGRZV�2EMHFWV�→%XWWRQ. In our example, these are %XWWRQ� and %XWWRQ�. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH&RQVWDQW�→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\.Accept the settings by clicking the 2. button. In the same way, create a GLUHFWFRQQHFWLRQ for %XWWRQ�, but set the WDUJHW to 2EMHFW�LQ�3LFWXUH�→�3LFWXUH:LQGRZ��→�'LVSOD\.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The pictures for shutting down the system and runtime can be applied directly to otherprojects.

• The object names in the GLUHFW�FRQQHFWLRQV of the SLFWXUH�ZLQGRZV which make up theEXWWRQV for calling the picture windows must be changed.

Page 105: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-27C79000-G8276-C140-01

������ $FFHVV�SURWHFWLRQ��ORJLQ�E\�PHDQV�RI�D�VWDQGDUG�ER[��H[DPSOH����

7DVN�GHILQLWLRQ

A picture should only be able to be changed by means of two EXWWRQV if the user has theappropriate authorization.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, each of which displays a picture in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click it with the 8. The necessary settings for assigning user authorization are to be madein the 8VHU�$GPLQLVWUDWRU editor.

Page 106: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-28 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��DFFHVV�SURWHFWLRQ��ORJLQ�E\�PHDQV�RI�D�VWDQGDUG�ER[

1 Open the 8VHU�$GPLQLVWUDWRU�editor in the &RQWURO�&HQWHU using 85.

2Click the �EXWWRQ to create a new user group and give it a name; in ourexample, we use the name VHUYLFH.

3 Under the menu item 7DEOH�→�$GG�QHZ�DXWKRUL]DWLRQ�OHYHO�, define theauthorization level &KDQJH�SLFWXUH under line 9. This authorization level is

assigned to the VHUYLFH group. For this, select the group with 8. In the table

containing the authorization levels, 8' the SLFWXUH�FKDQJH line in the (QDEOHcolumn.

An authorization level assigned to a group or a user is identified by a red dot inthe (QDEOH column.

4With the VHUYLFH user group selected, click the EXWWRQ and create a new user.User ZLOOL having the password SLFWXB�� was used in the example project. The&RS\�JURXS�VHWWLQJV�DOVR check box is selected in order to transfer theauthorization levels applicable to the group to the user.

Close the 8VHU$GPLQLVWUDWRU editor by choosing )LOH�→�([LW from the menu.

5 In the &RQWURO�&HQWHU, call the 3URMHFW�SURSHUWLHV dialog box.

In the window now displayed, select the+RW.H\V tab and enter the desired settings for calling the login (Log on) dialogbox and for logoff (Log off). In our example, we use the key combinationCTRL+O for Log on and CTRL+F for Log off.

6 In a picture, configure two buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, we use the objects called %XWWRQ� and %XWWRQ�.

Configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ, into which

Page 107: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-29C79000-G8276-C140-01

6WHS 3URFHGXUH��DFFHVV�SURWHFWLRQ��ORJLQ�E\�PHDQV�RI�D�VWDQGDUG�ER[

various pictures are inserted by means of GLUHFW�FRQQHFWLRQV linked to the twoEXWWRQV.

7 Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�8VHU�OHYHO, select the authorization level&KDQJH�SLFWXUH for the objects %XWWRQ��and %XWWRQ� and change 3URSHUWLHV�→0LVFHOODQHRXV�→�2SHUDWRU�&RQWURO�(QDEOH� to 1R.

8 Select�the tab labeled 0LVFHOODQHRXV on %XWWRQ� for an object selected in the

'\QDPLF�:L]DUG�and 8' 2SHUDEOH�LI�DXWKRUL]HG. Close the '\QDPLF�:L]DUG bychoosing �)LQLVK. Apply the same procedure to %XWWRQ�.

9 In tag management, create the system tag #&XUUHQW8VHU�of type WH[W�WDJ����ELWFKDUDFWHU�VHW with a length of 20 characters. This tag is automatically assignedthe user name currently logged in.

10 Trigger the &�DFWLRQV generated by the '\QDPLF�:L]DUG at �%XWWRQ��and %XWWRQ�on change of this tag. This means that the &�DFWLRQ is no longer processed everytwo seconds but only when there is a change of user name.

C action generated by the Dynamic Wizard

#include "apdefap.h"BOOL _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){#pragma code (" UseAdmin.DLL")#include "pwrt_api.h"#pragma code ()#define NO_MESSAGEBOX 1CMN_ERROR err;DWORD pwlevel = 0;pwlevel = (DWORD) GetPasswordLevel(lpszPictureName,lpszObjectName);if (pwlevel==0)return (TRUE);elsereturn(PWRTCheckPermissionOnPicture(pwlevel,lpszPictureName,NO_MESSAGEBOX,&err));

}

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The names of the user groups and the users, the logins and the passwords (user levels)must be adapted.

Page 108: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-30 WinCC Configuration ManualC79000-G8276-C140-01

������ 2SHUDWRU�&RQWURO�(QDEOH��ORJLQ�LQ�D�VHSDUDWH�GLDORJ�ER[�H[DPSOH����

7DVN�GHILQLWLRQ

Runtime should only be able to be exited by means of a EXWWRQ if the user has theappropriate authorization. A dialog box for logging in is to pop up when a EXWWRQ is clicked.

,PSOHPHQWDWLRQ�FRQFHSW

For implementation we use two buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ; with thefirst button a picture window, created under 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ, is opened for

logging on upon clicking8. The second button is to be used to shut down runtime.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��DFFHVV�SURWHFWLRQ��2SHUDWRU�&RQWURO�(QDEOH���ORJLQ�E\�PHDQV�RID�VHSDUDWH�GLDORJ�ER[

1 In the 8VHU�$GPLQLVWUDWRU editor, create a new user group and give it a name; inour example, we use the name XVHU. Under line 10, define a new authorizationlevel with the name 5XQWLPH�HQG (= Exit runtime). This authorization level isassigned to the XVHU group. Create a user for the group.

User XOULFK having the password SLFWXB�� was used in the example project.

2 In a picture, configure two buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, we use the objects called %XWWRQ� and %XWWRQ�.

3 Under object %XWWRQ�, configure the call for a picture window created under6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ to be used to exit runtime; in our example, weuse 3LFWXUH�:LQGRZ��

4 Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�8VHU�OHYHO, select the authorization level5XQWLPHHQG for the object %XWWRQ� and change 3URSHUWLHV�→�0LVFHOODQHRXV�→2SHUDWRU�&RQWURO�(QDEOH to 1R.

5 At �%XWWRQ�, apply the '\QDPLF�:L]DUG labeled 2SHUDEOH�LI�DXWKRUL]HG. Set the &DFWLRQ generated to be triggered by the system tag, #&XUUHQW8VHU, to be createdin Tag Management.

6 Configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ. In ourexample, we use the object called 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ+HLJKW to ���. In the 3URSHUWLHV�→�0LVFHOODQHRXV�:LQGRZ��FKDQJH�0RYDEOH,%RUGHU, 7LWOH and )RUHJURXQG to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→3LFWXUH�1DPH, select the picture with the name SLFWXB�BZLQGRZB���SGO. Thispicture can be taken directly from project SLFWXB��.

Page 109: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-31C79000-G8276-C140-01

6WHS 3URFHGXUH��DFFHVV�SURWHFWLRQ��2SHUDWRU�&RQWURO�(QDEOH���ORJLQ�E\�PHDQV�RID�VHSDUDWH�GLDORJ�ER[

7 Under %XWWRQ�, configure a GLUHFW�FRQQHFWLRQ for displaying the SLFWXUH�ZLQGRZjust configured.

8 Under %XWWRQ�, configure a &�DFWLRQ which assigns a text to the button label,which depends on whether the user is logged in or not. This &�DFWLRQ is alsotriggered by the #&XUUHQW8VHU tag.

C action for Button6

#include "apdefap.h" char *_main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){if (strcmp(GetTagChar("@CurrentUser"),""))

return "Logoff";else return "Logon";}

• If the #&XUUHQW8VHU tag contains a name, that is, the comparison of the two textsresults in 758(, the text /RJRII is returned, otherwise /RJRQ.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The names of the user groups and the users, the logins and the passwords (user levels)must be adapted.

Page 110: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-32 WinCC Configuration ManualC79000-G8276-C140-01

���� 6KRZLQJ�D�SLFWXUH�ZLQGRZ

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 111: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-33C79000-G8276-C140-01

������ 6KRZLQJ�DQG�KLGLQJ�IURP�RXWVLGH�D�SLFWXUH�ZLQGRZ��H[DPSOH����

7DVN�GHILQLWLRQ

A picture window is to be shown and hidden again by means of two EXWWRQV for clicking.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, to show and hide the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ

when we click one of them with the 8.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKRZLQJ�DQG�KLGLQJ�IURP�RXWVLGH�D�SLFWXUH�ZLQGRZ

1 Configure a picture that is to be shown and hidden, e.g. a help text or an info box.In our example, we use SLFWXB�BZLQGRZB��, a pure info box without anyadditional control elements.

2 In another picture, configure a 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ with the samegeometric dimensions as the picture created before. In our example, we use3LFWXUH�:LQGRZ�� Change 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�:LGWK to ��� and3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW to ���. In order to display thewindow with a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→%RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV�→0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH1DPH, select the picture with the name SLFWXB�BZLQGRZB���SGO.

3 In the same picture, configure two button objects under :LQGRZV�2EMHFWV�→%XWWRQ. In our example, these are %XWWRQ� and %XWWRQ�. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH&RQVWDQW�→�� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\.Accept the settings by clicking the 2. button.

Page 112: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-34 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��VKRZLQJ�DQG�KLGLQJ�IURP�RXWVLGH�D�SLFWXUH�ZLQGRZ

4 In the same way as for %XWWRQ�, configure a direct connection for %XWWRQ� under(YHQWV�→�0RXVH�→�3UHVV�OHIW. Enter the value � as the &RQVWDQW.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The picture name to be displayed and the object name of the SLFWXUH�ZLQGRZ must beadapted in the GLUHFW�FRQQHFWLRQV for %XWWRQ� and %XWWRQ�.

• The picture SLFWXB�BZLQGRZB�� can be integrated directly into another project, whereits title and information text are changed.

Page 113: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-35C79000-G8276-C140-01

������ 6KRZLQJ�IURP�RXWVLGH�DQG�KLGLQJ�IURP�LQVLGH�D�SLFWXUH�ZLQGRZ�H[DPSOH�����

7DVN�GHILQLWLRQ

A picture window is to be shown (displayed) by clicking a EXWWRQ. The picture window is tobe hidden by clicking a button inside the�SLFWXUH�ZLQGRZ.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, to show and hide the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ

when we click one of them with the 8.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKRZLQJ�IURP�RXWVLGH�DQG�KLGLQJ�IURP�LQVLGH�WKH�SLFWXUH�ZLQGRZ

1 Configure a picture that is to be shown and hidden, e.g. a help text or an info box.In our example, we use picture SLFWXB�BZLQGRZB��, an info box with anadditional button → which will be used to hide the picture. In our example, this is%XWWRQ�.

2 Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the source &RQVWDQW�→�� to the target &XUUHQW�:LQGRZ�→�'LVSOD\.

Accept the settings by clicking the 2. button.

3 In another picture, configure a 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ with the samegeometric dimensions as the picture created before. In our example, we use3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�:LGWK to ��� and3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW to ���. In order to display thewindow with a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→%RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV�→0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH1DPH, select the picture with the name SLFWXB�BZLQGRZB���SGO.

4 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Configure a GLUHFW�FRQQHFWLRQfor %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH &RQVWDQW→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\. Accept thesettings by clicking the 2. button.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The picture name to be displayed and the object name of the SLFWXUH�ZLQGRZ must beadapted in the GLUHFW�FRQQHFWLRQ for %XWWRQ�.

• The picture SLFWXB�BZLQGRZB�� can be integrated directly into another project, whereits title and info text are changed. There is no need to make any changes to the GLUHFWFRQQHFWLRQ under %XWWRQ�.

Page 114: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-36 WinCC Configuration ManualC79000-G8276-C140-01

������ 7LPH�FRQWUROOHG�KLGLQJ�RI�D�SLFWXUH�ZLQGRZ��H[DPSOH����

7DVN�GHILQLWLRQ

A SLFWXUH�ZLQGRZ is to be shown and hidden by clicking a EXWWRQ. This picture window isthen to be hidden automatically after a set time.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show and hide the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ

when we click it with the 8.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��WLPH�FRQWUROOHG�KLGLQJ�RI�D�SLFWXUH�ZLQGRZ

1 Configure a picture that is to be shown and hidden, e.g. a help text or an info box.In our example, we use the picture SLFWXB�BZLQGRZB��, a pure info box withoutany additional control elements. To implement time-controlled hiding of theobject called *UDSKLF�2EMHFW� at 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�;,configure a &�DFWLRQ. This &�DFWLRQ can be positioned anywhere, since only aWULJJHU is required. Set ��VHFRQG as the trigger.

2 In another picture, configure a 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ with the samegeometric dimensions as the picture created before. In our example, we use3LFWXUH�:LQGRZ�� Change 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�:LGWK to ��� and3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW to ���. In order to display thewindow with a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→%RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV�→0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH1DPH, select the picture with the name SLFWXB�BZLQGRZB���SGO.

3 In our example, this is %XWWRQ�. Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, configure a&�DFWLRQ for %XWWRQ�, which shows and hides the SLFWXUH�ZLQGRZ.

Page 115: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-37C79000-G8276-C140-01

C action for Graphic Object1

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){staticint i = 0;

//count timei++;//if maximum time is reached

if (i>5) SetVisible("pictu_3_chapter_03.PDL","Picture Window3",0);return 0;}

• Declare the static &�WDJ. This tag retains its value during the time the picture is open.

• Incrementing of the static &�WDJ each time the program is called.

• When it has exceeded the value 5, that is, after 5 seconds if the trigger has been set to 1second, the SLFWXUH�ZLQGRZ is hidden.

• The return value is the X position of *UDSKLF�2EMHFW�, since the &�DFWLRQ is attached tothis property and the property itself is not to be changed.

C action for Button4

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){//set visibility in complement state

SetVisible("pictu_3_chapter_03.PDL","PictureWindow3",(SHORT)!GetVisible("pictu_3_chapter_03.PDL","PictureWindow3"));}

• The LQWHUQDO�IXQFWLRQ 6HW9LVLEOH assigns the inverse of the current state of visibility tothe state of visibility of 3LFWXUH�:LQGRZ�. The current state is queried by the LQWHUQDOIXQFWLRQ *HW9LVLEOH.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The picture name to be displayed and the object name of the SLFWXUH�ZLQGRZ must beadapted in the &�DFWLRQ for %XWWRQ�.

• The picture SLFWXB�BZLQGRZB�� can be integrated directly into another project, whereits title and info text are changed. The time until the picture is hidden can be defined inthe &�DFWLRQ under *UDSKLF�2EMHFW� either by changing the trigger or by changing thecondition in the LI statement itself.

Page 116: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-38 WinCC Configuration ManualC79000-G8276-C140-01

������ 6KRZLQJ�D�SLFWXUH�ZLQGRZ�ZKLOH�KROGLQJ�GRZQ�WKH�ULJKW�PRXVHEXWWRQ��H[DPSOH����

7DVN�GHILQLWLRQ

A SLFWXUH�ZLQGRZ is to be shown while the 85 is pressed and held down on a EXWWRQ, and

is to be hidden again when the 85 is released.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show the picture in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ while the 8R is beingpressed and held down on this button.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKRZLQJ�D�SLFWXUH�ZLQGRZ�ZKLOH�KROGLQJ�GRZQ�WKH�ULJKW�PRXVHEXWWRQ

1 Configure a picture that is to be shown and hidden, e.g. a help text or an info box.In our example, we use the picture SLFWXB�BZLQGRZB��, a pure info box withoutany additional control elements.

2 In another picture, configure a 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ with the samegeometric dimensions as the picture created before. In our example, we use3LFWXUH�:LQGRZ�� Change 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�:LGWK to ��� and3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW to ���. In order to display thewindow with a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→%RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV�→0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH1DPH, select the picture with the name SLFWXB�BZLQGRZB���SGO.

3 In the same picture, configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ; in ourexample, this is %XWWRQ�. Configure a GLUHFW�FRQQHFWLRQ�IRU %XWWRQ� under (YHQWV→�0RXVH�→�3UHVV�ULJKW. Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW 2EMHFWLQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\. Accept the settings by clicking the2. button.

4 In the same way, configure a GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→5HOHDVH�ULJKW. Enter the value � as the &RQVWDQW.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The picture name to be displayed and the object name of the SLFWXUH�ZLQGRZ must beadapted in the GLUHFW�FRQQHFWLRQV for %XWWRQ�.

• The picture SLFWXB�BZLQGRZB�� can be integrated directly into another project, whereits title and information text are changed.

Page 117: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-39C79000-G8276-C140-01

������ &RQILJXULQJ�LQIR��LQVWUXFWLRQ��ER[HV�ZLWK�WKH�ZL]DUG��H[DPSOH����

You access this example by 8 the EXWWRQ depicted above. The example is configured inthe picture named SLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

An info (instruction) box is to be shown (pop up) if a tag exceeds the value 100; anemergency box is to be shown if it exceeds 150.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a slider object created under :LQGRZV�2EMHFWV�→6OLGHU�2EMHFW to input the tag value and an I/O field created under 6PDUW�2EMHFWV�→�,�2)LHOG to display the tag value.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FRQILJXULQJ�LQIR��LQVWUXFWLRQ��ER[HV�ZLWK�WKH�ZL]DUG

1 If the '\QDPLF�:L]DUG isn’t visible, activate it by selecting 9LHZ�→�7RROEDUV���

2 In a picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. In ourexample, we use the object called ,�2�)LHOG�. With the object selected, select the

3LFWXUH�)XQFWLRQV tab from the '\QDPLF�:L]DUG and 8' the 'LVSOD\,QVWUXFWLRQ�%R[ option. In the '\QDPLF�:L]DUG on the page entitled 6HOHFW

WULJJHU, select /HIW�PRXVH�EXWWRQ and 8 1H[W. Fill in the 6HW�RSWLRQV page asfollows:

Page 118: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-40 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�LQIR��LQVWUXFWLRQ��ER[HV�ZLWK�WKH�ZL]DUG

Close the )LQLVKHG�� page by clicking )LQLVK.

3 Use the '\QDPLF�:L]DUG on ,�2�)LHOG� once again. On the page entitled 6HOHFWWULJJHU, select 5LJKW�PRXVH�EXWWRQ. On the page entitled 6HW�RSWLRQV, select the(PHUJHQF\�%R[ option and enter the text to be displayed.

4 Create a tag of type 6LJQHG����ELW�YDOXH in Tag Management. In our example, weuse the tag called 6��LBSLFWXBER[HVB��.

5 In the same picture, configure an object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW.in our example, this is 6OLGHU�2EMHFW�. Create a GLUHFW�FRQQHFWLRQ for 6OLGHU2EMHFW� under (YHQWV�→�3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU&RQQHFWLRQ. Connect the VRXUFH 3URSHUW\�→�6OLGHU�2EMHFW��→�3URFHVV�'ULYHU&RQQHFWLRQ to the WDUJHW 9DULDEOH�→�6��LBSLFWXBER[HVB��. Accept the settingsby clicking the 2. button.

6 For object �,�2�)LHOG�, create a tag connection to tag 6��LBSLFWXBER[HVB�� under3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH and set the trigger to 8SRQ�FKDQJH.

Page 119: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-41C79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�LQIR��LQVWUXFWLRQ��ER[HV�ZLWK�WKH�ZL]DUG

7 For object ,�2�)LHOG�, create a &�DFWLRQ under (YHQWV�→�3URSHUW\�7RSLFV�→2XWSXW�,QSXW�→�2XWSXW�9DOXH, which displays an info box if tag6��LBSLFWXBER[HVB�� exceeds a value of 100 and an emergency box if the tagexceeds a value of 150. The &�DFWLRQV generated by the '\QDPLF�:L]DUG can becopied at (YHQWV�→�0RXVH�→�3UHVV�OHIW�and 3UHVV�ULJKW and inserted into this &DFWLRQ.

8 Delete the &�DFWLRQV under (YHQWV�→�0RXVH�→�3UHVV�OHIW�and 3UHVV�ULJKW.

Page 120: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-42 WinCC Configuration ManualC79000-G8276-C140-01

C action for I/O Field1

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, double value){int a;static int i = 0, j = 0;

//get tag value

a=GetTagDWord("S32i_pictu_boxes_00");

//set visible info boxif ((a>100)&&(i==0)) {

i=1;MessageBox(NULL,"The tag value has exceeded \r\n100",

"Message", MB_OK|MB_ICONEXCLAMATION|MB_SETFOREGROUND);}//if

if (a<=100) (i=0);

//set visible emergency boxif ((a>150)&&(j==0)) {

j=1;MessageBox(NULL,"The tag value has exceeded \r\n150",

"Caution!!!", MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);}//if

if (a<=150) (j=0);}

• Read in the tag value using the LQWHUQDO�IXQFWLRQ *HW7DJ':RUG.

• If 100 is exceeded, show the info (instruction) box with the &�DFWLRQ generated by the'\QDPLF�:L]DUG. If 100 is exceeded, the info box is initially shown again; if 100 isfallen below, the static &�WDJ ’i’ has been reset to zero.

• If 150 is exceeded, show the emergency box with the&�DFWLRQ generated by the '\QDPLF:L]DUG. If 150 is exceeded, the emergency box is initially shown again; if 150 is fallenbelow, the static &�WDJ j has been reset to zero.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag name in the &�DFWLRQ under ,�2�)LHOG� must be adapted.

• The text displayed in the info and emergency boxes must be adapted to suit your ownneeds.

Page 121: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-43C79000-G8276-C140-01

������ 6KRZLQJ�D�GLDORJ�ER[�IRU�HQWHULQJ�WH[W��H[DPSOH����

You access this example by 8 the EXWWRQ depicted above. The example is configured inthe picture named SLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

When a�EXWWRQ is clicked with the 8 , a dialog box is to be displayed to enable you to entera text. The text entered is displayed in the picture.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ to display the dialog box and a static text created under 6WDQGDUG�2EMHFWV�→�6WDWLF7H[W to display the text. An I/O field created under 6PDUW�2EMHFWV�→�,�2�)LHOG is used toenter the text in the dialog box, and two buttons created under :LQGRZV�2EMHFWV�→�%XWWRQare used apply or cancel the input.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKRZLQJ�D�GLDORJ�ER[�IRU�HQWHULQJ�WH[W

1 Create two tags of type 7H[W�WDJ����ELW�FKDUDFWHU�VHW in Tag Management. In ourexample, we use 7��LBSLFWXBZLQB�� and 7��LBSLFWXBZLQB��.

2 Configure a picture in which text input is to be carried out. in our example, weuse picture SLFWXB�BZLQGRZB���SGO.

3 In this picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG.Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH, configure a WDJ�FRQQHFWLRQ totag 7��LBSLFWXBZLQB�� and set the trigger to 8SRQ�FKDQJH. Change 3URSHUWLHV�→2XWSXW�,QSXW�→�'DWD�)RUPDW to 6WULQJ and 3URSHUWLHV�→�2XWSXW�,QSXW�→�$SSO\RQ�([LW to <HV. This means that the Return key doesn’t have to be pressed toaccept the text entered.

4 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. This is used to accept (apply)the text entered. Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, configure a &�DFWLRQwhich transfer the contents of tag 7��LBSLFWXBZLQB�� to the tag which containsthe text to be displayed, i.e. tag7��LBSLFWXBZLQB��. Under (YHQWV�→�0RXVH�→0RXVH�$FWLRQ, configure a GLUHFW�FRQQHFWLRQ which hides the picture.

5 Configure another button under :LQGRZV�2EMHFWV�→�%XWWRQ; in our example, weuse %XWWRQ�. This is used to cancel the input; the text previously entered isretained. Configure a &�DFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Thistransfers the contents of tag 7��LBSLFWXBZLQB�� (which contains the previoustext) to tag7��LBSLFWXBZLQB��. Under (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ,configure a GLUHFW�FRQQHFWLRQ which hides the picture.

6 In a second picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ. In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUHZLQGRZ to match the size of the picture just configured. If the picture window is

Page 122: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-44 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��VKRZLQJ�D�GLDORJ�ER[�IRU�HQWHULQJ�WH[W

to be displayed with borders, the :LQGRZ�+HLJKW and the :LQGRZ�:LGWK of theSLFWXUH�ZLQGRZ must be set 10 pixels greater than those of the picture. Under3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB��BZLQGRZB���SGO.

7 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Create a further GLUHFWFRQQHFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH &RQVWDQW→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\. Accept thesettings by clicking the 2. button.

8 In the same picture, configure an object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W.In our example, this is 6WDWLF�7H[W�. Under 3URSHUWLHV�→�)RQW�→7H[W, configure aWDJ�FRQQHFWLRQ to tag 7��LBSLFWXBZLQB�� and set the trigger to 8SRQ�FKDQJH.

C action for Button1

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){//set new text to current text

SetTagChar("T16i_pictu_win_00",GetTagChar ("T16i_pictu_win_01"));}

• Assign the contents of tag 7��LBSLFWXBZLQB�� to tag 7��LBSLFWXBZLQB��.

C action for Button2

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){//set actual text to temporary text

SetTagChar("T16i_pictu_win_01",GetTagChar ("T16i_pictu_win_00"));}

• Assign the contents of tag 7��LBSLFWXBZLQB�� to tag 7��LBSLFWXBZLQB��.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Picture SLFWXB�BZLQGRZB���SGO can be used directly for entering text. The &�DFWLRQVunder the EXWWRQV, however, must be adapted to your own tag names.

Page 123: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-45C79000-G8276-C140-01

���� =RRP

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 124: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-46 WinCC Configuration ManualC79000-G8276-C140-01

������ &KDQJLQJ�SLFWXUH�JHRPHWU\�EHWZHHQ�WZR�VL]HV��H[DPSOH����

7DVN�GHILQLWLRQ

A SLFWXUH�ZLQGRZ�is to be shown and hidden again by means of two EXWWRQV for clicking.When opened, the picture is to be shown small. The size of the picture is to be adjustable bymeans of another EXWWRQ.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, to show and hide the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH

:LQGRZwhen we click one of them with the 8. Two further buttons created under:LQGRZV�2EMHFWV�→�%XWWRQ are used to enlarge and reduce the size of the picture.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�SLFWXUH�JHRPHWU\�EHWZHHQ�WZR�VL]HV

1 Configure a picture that is to be shown and hidden. In our example, we use thepicture with the name SLFWXB�BFKDSWHUB�� (the start picture of picture projectSLFWXB���.

2 In another picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ; in our example, we use 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ+HLJKW to ���. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to <HV and3URSHUWLHV�→�0LVFHOODQHRXV�→�$GDSW�3LFWXUH to <HV. In this way, the picture,which has a geometry of 859*698, is adapted to the size of the picture window.Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with thename SLFWXB�BFKDSWHUB��. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\ to1R.

3 In the same picture, configure two more button objects under :LQGRZV�2EMHFWV→�%XWWRQ. In our example, these are %XWWRQ� and %XWWRQ�. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH&RQVWDQW�→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\.Accept the settings by clicking the 2. button.

4 Configure two more buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. In our example,these are %XWWRQ� and %XWWRQ�. Under %XWWRQ�, select (YHQWV�→�0RXVH�→�3UHVVOHIW and configure a &�DFWLRQ which enlarges the SLFWXUH�ZLQGRZ, then hides%XWWRQ� and shows %XWWRQ�. Under %XWWRQ�, likewise select (YHQWV�→�0RXVH�→3UHVV�OHIW and configure a &�DFWLRQ which reduces the SLFWXUH�ZLQGRZ, then hides%XWWRQ� and shows %XWWRQ�. The 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\ settingsof both EXWWRQV are set to 1R.

5 Create a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW 2EMHFW�LQ�3LFWXUH�→�%XWWRQ��→'LVSOD\.

Accept the settings by clicking the 2. button. Under %XWWRQ�, select (YHQWV�→0RXVH�→�3UHVV�OHIW and configure a &�DFWLRQ which hides %XWWRQ� and %XWWRQ�,reduces the size of 3LFWXUH�:LQGRZ� and then hides the SLFWXUH�ZLQGRZ.

Page 125: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-47C79000-G8276-C140-01

6WHS 3URFHGXUH��FKDQJLQJ�SLFWXUH�JHRPHWU\�EHWZHHQ�WZR�VL]HV

6 Position �%XWWRQ� and %XWWRQ� directly one on top of the other.

C action for Button3

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetHeight(lpszPictureName,"Picture Window1",420);SetWidth(lpszPictureName,"Picture Window1",516);SetVisible(lpszPictureName,"Button3",0);SetVisible(lpszPictureName,"Button4",1);}

• Change height and width of 3LFWXUH�:LQGRZ� using the�LQWHUQDO�IXQFWLRQV 6HW+HLJKWand 6HW:LGWK.

• Hide the HQODUJH button (%XWWRQ�).

• Show the UHGXFH button (%XWWRQ�).

C action for Button4

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetHeight(lpszPictureName,"Picture Window1",140);SetWidth(lpszPictureName,"Picture Window1",172);SetVisible(lpszPictureName,"Button3",1);SetVisible(lpszPictureName,"Button4",0);}

• Change height and width of 3LFWXUH�:LQGRZ� using the�LQWHUQDO�IXQFWLRQV 6HW+HLJKWand 6HW:LGWK.

• Show the HQODUJH button (%XWWRQ�).

• Hide the UHGXFH button (%XWWRQ�).

Page 126: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-48 WinCC Configuration ManualC79000-G8276-C140-01

C action for Button2

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetVisible(lpszPictureName,"Button3",0);SetVisible(lpszPictureName,"Button4",0);SetHeight(lpszPictureName,"Picture Window1",140);SetWidth(lpszPictureName,"Picture Window1",172);SetVisible(lpszPictureName,"Picture Window1",0);}

• Hide the HQODUJH button (%XWWRQ�) and the UHGXFH button (%XWWRQ�).

• Change height and width of 3LFWXUH�:LQGRZ� using the�LQWHUQDO�IXQFWLRQV 6HW+HLJKWand 6HW:LGWK.

• Hide 3LFWXUH�:LQGRZ�.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The object names in the GLUHFW�FRQQHFWLRQV under %XWWRQ� must be adapted.

• The object names and the picture dimensions to be set must be adapted in the &�DFWLRQVfor %XWWRQ�, %XWWRQ� and %XWWRQ�.

Page 127: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-49C79000-G8276-C140-01

������ &KDQJLQJ�WKH�SLFWXUH�JHRPHWU\�VWHSOHVVO\��VPRRWK�]RRP��H[DPSOH����

7DVN�GHILQLWLRQ

A SLFWXUH�ZLQGRZ is to be shown and hidden again by means of two EXWWRQV for clicking. Inaddition, the size of the picture is to be made steplessly adjustable by means of a VOLGHUREMHFW.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, to show and hide the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH

:LQGRZwhen we click one of them with the 8, and a slider object created under :LQGRZV2EMHFWV�→�6OLGHU�2EMHFW, with which we change the size of the picture.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJLQJ�WKH�SLFWXUH�JHRPHWU\�VWHSOHVVO\��VPRRWK�]RRP�

1 Configure a picture that is to be shown and hidden. In our example, we use thepicture named SLFWXB�BZLQGRZB���SGO, whose width:height ratio is 2:1.

2 In another picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ; in our example, we use 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ+HLJKW to �� (width:height ratio likewise 2:1). In order to display the windowwith a border during runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to<HV and 3URSHUWLHV�→�0LVFHOODQHRXV�→�$GDSW�3LFWXUH to <HV. In this way, thepicture is adapted to the size of the SLFWXUH�ZLQGRZ. Under 3URSHUWLHV�→0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB���SGO. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\ to 1R.

3 In the same picture, configure two more button objects under :LQGRZV�2EMHFWV→�%XWWRQ. In our example, these are %XWWRQ� and %XWWRQ�. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH&RQVWDQW�→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\.

Accept the settings by clicking the 2. button.

4 In the same way, configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→0RXVH�→�3UHVV�OHIW. Enter the value � as the &RQVWDQW.

5 Create a tag of type 8QVLJQHG����ELW�YDOXH in Tag Management. In our example,we use the tag called 8��LBSLFWXB]RRPB��.

6 Configure a slider object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW; in ourexample, this is 6OLGHU�2EMHFW�. Change 3URSHUWLHV�→�0LVFHOODQHRXV→0D[LPXP�9DOXH to ���. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�3URFHVV'ULYHU�&RQQHFWLRQ to ��. Create a GLUHFW�FRQQHFWLRQ under (YHQWV�→�3URSHUW\7RSLFV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ. Connect the VRXUFH3URSHUW\�→�WKLV�REMHFW�→�3URFHVV�'ULYHU�&RQQHFWLRQ to the WDUJHW�9DULDEOH�→8��LBSLFWXB]RRPB��.

Accept the settings by clicking the 2. button.

Page 128: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-50 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FKDQJLQJ�WKH�SLFWXUH�JHRPHWU\�VWHSOHVVO\��VPRRWK�]RRP�

7 Create a G\QDPLF�GLDORJ for 3LFWXUH�:LQGRZ� under 3URSHUWLHV�→�*HRPHWU\�→

:LQGRZ�+HLJKW. Click 7DJ����→ and select 8��LBSLFWXB]RRPB��. Click the

button and confirm tag 8��LBSLFWXB]RRPB�� as the trigger name in the&KDQJH�WULJJHU dialog box. Select 8SRQ�FKDQJH as the standard cycle andconfirm by clicking 2.. In the 'DWD�7\SH field, select 'LUHFW and close the'\QDPLF�'LDORJ by clicking $SSO\.

8 Create a dynamic dialog for 3LFWXUH�:LQGRZ� under 3URSHUWLHV�→�*HRPHWU\�→:LQGRZ�:LGWK. The settings can be made as described above, but the([SUHVVLRQ�)RUPXOD field must be filled in as follows:

This means that the valueassigned to the window height will be twice that of the window width.

9 In picture object SLFWXB�BFKDSWHUB��, configure a &�DFWLRQ�under (YHQWV�→0LVFHOODQHRXV�→�2SHQ�3LFWXUH, which sets tag 8��LBSLFWXB]RRPB�� to �� whenthe picture is opened. Without this initialization, the value of the tag wouldremain 0 until the object 6OLGHU�2EMHFW� is operated for the first time. If the%XWWRQ� object were operated, 3LFWXUH�:LQGRZ� with the dimensions 0x0 wouldbe visibly set.

C action for Open Picture

#include "apdefap.h"void OnOpenPicture(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName){//init tag

SetTagWord("U16i_pictu_zoom_00",80);}

• Set tag 8��LBSLFWXB]RRPB�� to ��.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag name in the GLUHFW�FRQQHFWLRQ under 6OLGHU�2EMHFW� must be adapted.

• The tag names in the G\QDPLF�GLDORJV under 3LFWXUH�:LQGRZ� must be adapted. Themultiplier must be adapted to the width:height ratio used.

Page 129: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-51C79000-G8276-C140-01

������ &RQILJXULQJ�DGMXVWDEOH�SLFWXUH�JHRPHWU\�E\�PHDQV�RI�WKH�SURSHUWLHVGLDORJ��H[DPSOH����

7DVN�GHILQLWLRQ

A SLFWXUH�ZLQGRZ is to be able to be dragged to any size using the mouse. In addition, thepicture is to be able to be moved to any position on the screen. It can be maximized andhidden by clicking a EXWWRQ.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, to show and hide the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ

when we click one of them with the 8. The necessary picture properties are configured inthe properties dialog box.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FRQILJXULQJ�DGMXVWDEOH�SLFWXUH�JHRPHWU\�E\�PHDQV�RI�WKHSURSHUWLHV�GLDORJ

1 Configure a picture that is to be shown and hidden. In our example, we use thepicture with the name SLFWXB�BFKDSWHUB�� (the start picture of picture projectSLFWXB���.

2 In another picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ; in our example, we use 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ+HLJKW to ���. Under 3URSHUWLHV�→�0LVFHOODQHRXV, change the attributes6L]HDEOH, 0RYDEOH, %RUGHU, 7LWOH, &DQ�%H�0D[LPL]HG, $GDSW�3LFWXUH and &DQ�%H&ORVHG to <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, selectSLFWXB�BFKDSWHUB��. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\ to 1R.

3 In the same picture, configure two buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. Inour example, these are %XWWRQ� and %XWWRQ�. Configure a GLUHFW�FRQQHFWLRQ for%XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH &RQVWDQW�→��to the WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\. Accept thesettings by clicking the 2. button.

4 In the same way, configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→0RXVH�→�3UHVV�OHIW. However, enter the value � as the &RQVWDQW.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The picture name to be displayed and the object name of the SLFWXUH�ZLQGRZ must beadapted in the GLUHFW�FRQQHFWLRQV for %XWWRQ� and %XWWRQ�.

• The picture shown in 3LFWXUH�:LQGRZ� must be adapted.

Page 130: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-52 WinCC Configuration ManualC79000-G8276-C140-01

���� 2SHUDWRU�SDQHOV

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 131: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-53C79000-G8276-C140-01

������ %LQDU\�VZLWFKLQJ�RSHUDWLRQ��WZR�VWHS�FRQWURO���H[DPSOH����

7DVN�GHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is tocontain a EXWWRQ which can be used to turn a valve on and off, and the panel itself is to beclosed by clicking another EXWWRQ.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click the button with the 8 , and two more EXWWRQV which are used in the operator panelfor performing the switching operation and for closing the panel.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��ELQDU\�VZLWFKLQJ�RSHUDWLRQ��WZR�VWHS�FRQWURO�

1 Create a tag of type %LQDU\�WDJ in Tag Management. in our example, we use%,1LBSLFWXBLQSXWB��. This tag is to contain the current state of the value.

2 Configure a picture with two buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use picture SLFWXB�BZLQGRZB�� with %XWWRQ� and %XWWRQ�.Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW &XUUHQW�:LQGRZ�→�'LVSOD\Accept the settings by clicking the 2. button.

3 Under the second EXWWRQ, in our example %XWWRQ�, configure a &�DFWLRQ whichreverses the status of the binary tag %,1LBSLFWXBLQSXWB��.

4 In another picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ; in our example, we use 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ

Page 132: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-54 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��ELQDU\�VZLWFKLQJ�RSHUDWLRQ��WZR�VWHS�FRQWURO�

+HLJKW to ���. In order to display the window with a border and make it movableduring runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to <HV and3URSHUWLHV�→�0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB��. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�0LVFHOODQHRXV to1R.

5 In the picture, configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, this is %XWWRQ� in picture SLFWXB�BFKDSWHUB��. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH&RQVWDQW�→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\.

Accept the settings by clicking the 2. button.

C action for Button2

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetTagBit("BINi_pictu_input_00",(SHORT)!GetTagBit("BINi_pictu_input_00"));}

• Read in the of tag %,1LBSLFWXBLQSXWB�� using�LQWHUQDO�IXQFWLRQ *HW7DJ%LW, negate it andreset it using LQWHUQDO�IXQFWLRQ 6HW7DJ%LW.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The object name of the picture window to be opened must be adapted in the GLUHFWFRQQHFWLRQ for %XWWRQ�.

• The tag name in the &�DFWLRQ under %XWWRQ� in the operator panel must be adapted.

Page 133: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-55C79000-G8276-C140-01

������ %LQDU\�6�5�VZLWFKLQJ�RSHUDWLRQ��WZR�VWHS�FRQWURO���H[DPSOH����

7DVN�GHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is tocontain one EXWWRQ for turning a valve on and a second EXWWRQ for turning the same valve offagain. The panel itself is to be closed by clicking another EXWWRQ in the panel.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click the button with the 8, and three more EXWWRQV which are used in the operator panelfor performing the switching operation and for closing the panel.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��ELQDU\�6�5�VZLWFKLQJ�RSHUDWLRQ��WZR�VWHS�FRQWURO�

1 Create a tag of type %LQDU\�WDJ in Tag Management. in our example, we use%,1LBSLFWXBLQSXWB��. This tag is to contain the current state of the value.

2 Configure a picture with three buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use picture SLFWXB�BZLQGRZB�� with %XWWRQ�, %XWWRQ� and%XWWRQ�. Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→3UHVV�OHIW. Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW &XUUHQW�:LQGRZ�→'LVSOD\

Accept the settings by clicking the 2. button.

3 Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW 9DULDEOH�→�%,1LBSLFWXBLQSXWB��.

Accept the settings by clicking the 2. button.

4 In the same way, configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→0RXVH�→�3UHVV�OHIW. Enter the value � as the &RQVWDQW.

5 In another picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ; in our example, we use 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ+HLJKW to ���. In order to display the window with a border and make it movableduring runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to <HV and3URSHUWLHV�→�0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB��.

6 In a picture, configure a :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, this is%XWWRQ� in picture SLFWXB�BFKDSWHUB��. Configure a GLUHFW�FRQQHFWLRQ for%XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH &RQVWDQW�→�to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\.

Accept the settings by clicking the 2. button.

Page 134: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-56 WinCC Configuration ManualC79000-G8276-C140-01

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The object name of the picture window to be opened must be adapted in the GLUHFWFRQQHFWLRQ for %XWWRQ�.

• The tag names in the GLUHFW�FRQQHFWLRQV under %XWWRQ� and %XWWRQ� in the operatorpanel must be adapted.

Page 135: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-57C79000-G8276-C140-01

������ %LQDU\�VZLWFKLQJ�RSHUDWLRQ�ZLWK�DFNQRZOHGJHPHQW��H[DPSOH����

7DVN�GHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is tocontain a EXWWRQ which can be used to turn a valve on and off. Actual switching operation isonly to take effect when a separate 2. button is clicked, which at the same time closes theoperator panel.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click the button with the 8, and two more EXWWRQV�which are used in the operator panel forperforming the switching operation and for closing the panel.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��ELQDU\�VZLWFKLQJ�RSHUDWLRQ�ZLWK�DFNQRZOHGJHPHQW

1 Create two tags of type %LQDU\�WDJ in Tag Management. In our example, we use%,1LBSLFWXBLQSXWB�� and %,1LBSLFWXBLQSXWB��. %,1LBSLFWXBLQSXWB�� is tocontain the current state of the valve, %,1LBSLFWXBLQSXWB���is to act as a buffermemory for the switching operation before acknowledgement.

2 Configure a picture with two buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use picture SLFWXB�BZLQGRZB�� with %XWWRQ� and %XWWRQ�.Create a GLUHFW�FRQQHFWLRQ�IRU�%XWWRQ� under (YHQWV�→�0RXVH�$FWLRQ. Connectthe VRXUFH &RQVWDQW�→�� to the WDUJHW &XUUHQW�:LQGRZ�→�'LVSOD\.

Accept the settings by clicking the 2. button.

Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, configure another GLUHFW�FRQQHFWLRQ.Connect the VRXUFH�%,1LBSLFWXBLQSXWB�� to the WDUJHW %,1LBSLFWXBLQSXWB��.

Accept the settings by clicking the 2. button.

3 Under the second button, in our example %XWWRQ�, configure a &�DFWLRQ whichreverses the status of the binary tag %,1LBSLFWXBLQSXWB��.

4 In another picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ; in our example, we use 3LFWXUH�:LQGRZ�. Change 3URSHUWLHV�→*HRPHWU\�→�:LQGRZ�:LGWK to ��� and 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ+HLJKW to ���. In order to display the window with a border and make it movableduring runtime, change 3URSHUWLHV�→�0LVFHOODQHRXV�→�%RUGHU to <HV and3URSHUWLHV�→�0LVFHOODQHRXV�→�0RYDEOH to <HV. Under 3URSHUWLHV�→0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB��.

5 In a picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ. In ourexample, this is %XWWRQ� in picture SLFWXB�BFKDSWHUB��.

Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→�� to the WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH:LQGRZ��→�'LVSOD\. Accept the settings by clicking the 2. button.

Page 136: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-58 WinCC Configuration ManualC79000-G8276-C140-01

C action for Button2

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetTagBit("BINi_pictu_input_02",(SHORT)!GetTagBit("BINi_pictu_input_02"));}

• Read in the state of tag %,1LBSLFWXBLQSXWB�� using LQWHUQDO�IXQFWLRQ *HW7DJ%LW, negateit and reset it using LQWHUQDO�IXQFWLRQ 6HW7DJ%LW.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The object name of the SLFWXUH�ZLQGRZ to be opened must be adapted in the GLUHFWFRQQHFWLRQ for %XWWRQ�.

• The tag names in the GLUHFW�FRQQHFWLRQV under %XWWRQ� in the operator panel must beadapted.

• The tag name in the &�DFWLRQ under %XWWRQ� in the operator panel must be adapted.

Page 137: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-59C79000-G8276-C140-01

������ $XWRPDWLF�LQSXW�FKHFN��H[DPSOH����

You access this example in our SLFWXB�� project by 8 the button depicted above. Theexample is configured in the picture named SLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is tobe used to fill a container with an amount of liquid, which is also to be entered in this panel.The value entered is to be checked automatically to determine whether it exceeds themaximum fill level of the container or not.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click it with the 8. Furthermore, we use three buttons created under :LQGRZV�2EMHFWV�→%XWWRQ, to turn the valve on and off and to closed the operator panel. An I/O field createdunder 6PDUW�2EMHFWV�→�,�2�)LHOG is used to enter the fill level.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��DXWRPDWLF�LQSXW�FKHFN

1 In Tag Management, create a tag of type %LQDU\�WDJ, which contains the currentstate of the valve. in our example, we use %,1LBSLFWXBLQSXWB��.

2 Create two tags of type 8QVLJQHG����ELW�YDOXH. In our example, these are8��LBSLFWXBLQSXWB�� and 8��LBSLFWXBLQSXWB��. The first of these two tagscontains the set value for the container fill level, the second the actual value.

3 Configure a picture with three buttons created under :LQGRZV�2EMHFWV�→�%XWWRQand one I/O field created under 6PDUW�2EMHFWV�→�,�2�)LHOG. In our example, weuse %XWWRQ�, %XWWRQ� and %XWWRQ� and the object ,�2�)LHOG�� The picture we useis SLFWXB�BZLQGRZB���SGO.

4 For object �,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag 8��LBSLFWXBLQSXWB�� under3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH and set the trigger to 8SRQ�FKDQJH.

5 We assume the container has a maximum fill level of 40 liters. The�,�2�ILHOG musttherefore only accept inputs between 0 and 40. To set these limits, set 3URSHUWLHV→�/LPLWV�→�/RZ�/LPLW�9DOXH�WR�� and 3URSHUWLHV�→�/LPLWV�→�+LJK�/LPLW�9DOXHWR���.

6 For object %XWWRQ�, configure a GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→3UHVV�OHIW, which hides the picture.

7 For object %XWWRQ�, configure a GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→3UHVV�OHIW, which assigns the value � to tag %,1LBSLFWXBLQSXWB��. Under %XWWRQ�,configure a GLUHFW�FRQQHFWLRQ which assigns the value � to the tag.

8 In a second picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ. In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUHZLQGRZ to match the size of the picture just configured. If the SLFWXUH�ZLQGRZ isto be displayed with borders, the :LQGRZ�+HLJKW and the :LQGRZ�:LGWK of theSLFWXUH�ZLQGRZ must be set 10 pixels greater than those of the picture. Under

Page 138: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-60 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��DXWRPDWLF�LQSXW�FKHFN

3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB���SGO.

9 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Create a further GLUHFWFRQQHFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH &RQVWDQW→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\. Accept thesettings by clicking the 2. button.

10 Select the 7DQN� object from the library and use it display the fill level. Create a&�DFWLRQ under 3URSHUWLHV�→�*HRPHWU\�→�:LGWK to simulate the filling process.Under 3URSHUWLHV�→�7DJ�$VVLJQPHQW�→�)LOO�/HYHO, configure a WDJ�FRQQHFWLRQ totag 8��LBSLFWXBLQSXWB��.

11 As a second method of displaying the fill level, configure an I/O field under6PDUW�2EMHFWV�→�,�2�)LHOG; in our example, this is ,�2�)LHOG��

C action for simulating the filling process

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){BOOL state;SHORT level1,level2;

//get valve state

state=GetTagBit("BINi_pictu_input_06");

if (state==TRUE) {level1=GetTagWord("U16i_pictu_input_04");level2=GetTagWord("U16i_pictu_input_05");level2++;if (level2>=level1) {

SetTagBit("BINi_pictu_input_06",FALSE);}//if

if (level2<=level1) {SetTagWord("U16i_pictu_input_05",level2);}//if

}//ifreturn(80);}

• Reading in the valve state.

• When the valve is opened, the actual and set values of the fill level are read in.Increment the actual value. When the actual value has reached the set value, close thevalve. Set the tag which contains the actual value.

• The return value is the width of the object.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names and the limits of the ,�2�ILHOG in picture SLFWXB�BZLQGRZB�� must beadapted to suit your own needs.

Page 139: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-61C79000-G8276-C140-01

������ (QKDQFHG�DXWRPDWLF�LQSXW�FKHFN��H[DPSOH����

You access this example in our SLFWXB�� project by 8 the EXWWRQ depicted above. Theexample is configured in the picture named SLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is tobe used to fill a container with two liquids in a specific ratio. The sum of the two valuesentered is to be checked automatically to determine whether it exceeds the maximum filllevel of the container.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a button created under :LQGRZV�2EMHFWV�→%XWWRQ, to show the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we

click it with the 8. The amounts of liquid to be filled into the container are entered bymeans of three I/O fields created under 6PDUW�2EMHFWV�→�,�2�)LHOG. In addition, we use twobuttons created under :LQGRZV�2EMHFWV�→�%XWWRQ, one to apply the settings in the�,�2ILHOGV, the other to cancel the inputs and close the operator panel.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��HQKDQFHG�DXWRPDWLF�LQSXW�FKHFN

1 In Tag Management, create two tags of type %LQDU\�WDJ, which contain thecurrent states of the valves via which the container is filled. In our example, weuse %,1LBSLFWXBLQSXWB�� and %,1LBSLFWXBLQSXWB���

2 Create four tags of type 8QVLJQHG����ELW�YDOXH; in our example, these are8��LBSLFWXBLQSXWB��, 8��LBSLFWXBLQSXWB��, 8��LBSLFWXBLQSXWB��, and8��LBSLFWXBLQSXWB��. The first two contain the set values for the container filllevels, the last two the actual values.

3 Create two tags of type 8QVLJQHG����ELW�YDOXH. In our example, these are8��LBSLFWXBLQSXWB�� and 8��LBSLFWXBLQSXWB��. These contain the values enteredin the ,�2�ILHOGV.

4 Configure a picture with two buttons created under :LQGRZV�2EMHFWV�→�%XWWRQand three I/O fields created under 6PDUW�2EMHFWV�→�,�2�)LHOG. In our example, weuse %XWWRQ� and %XWWRQ� and ,�2�)LHOG�, ,�2�)LHOG�, and ,�2�)LHOG�. The picturewe use is SLFWXB�BZLQGRZB���SGO.

5 For �,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag 8��LBSLFWXBLQSXWB�� under3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH and set the trigger to 8SRQ�FKDQJH.For ,�2�)LHOG�, create a WDJ�FRQQHFWLRQ to tag 8��LBSLFWXBLQSXWB��.

6 For ,�2�)LHOG�, configure a dynamic dialog under 3URSHUWLHV�→�2XWSXW�,QSXW�→2XWSXW�9DOXH. Enter the settings shown in the figure below. Set the trigger to’Upon change’.

Page 140: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-62 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��HQKDQFHG�DXWRPDWLF�LQSXW�FKHFN

7 For %XWWRQ�, configure a GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW,which hides the picture.

8 For %XWWRQ�, configure a &�DFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW, whichassigns the contents of input tags 8��LBSLFWXBLQSXWB�� and 8��LBSLFWXBLQSXWB��to set value tags 8��LBSLFWXBLQSXWB�� and 8��LBSLFWXBLQSXWB��. Under (YHQWV→�0RXVH�→�0RXVH�$FWLRQ, configure a GLUHFW�FRQQHFWLRQ which closes thepicture.

9 In the same picture, configure two objects of type 6WDQGDUG�2EMHFWV�→�6WDWLF7H[W. In our example, we use 6WDWLF�7H[W� and 6WDWLF�7H[W�. These are used todisplay whether the maximum fill level is exceeded or not. Under 6WDWLF�7H[W�,which contains the error message, change 3URSHUWLHV�→�0LVFHOODQHRXV�→'LVSOD\ to 1R.

10 For ,�2�)LHOG�, create a &�DFWLRQ under (YHQWV�→�3URSHUW\�7RSLFV�→2XWSXW�,QSXW�→�2XWSXW�9DOXH, which makes %XWWRQ� operable only if themaximum fill level is not exceeded and displays the error text if the maximum filllevel is exceeded.

11 In a second picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ. In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUHZLQGRZ to match the size of the picture just configured. Under 3URSHUWLHV�→0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB���SGO.

12 In the same picture, configure a button object under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the object called %XWWRQ�. Create a further GLUHFWFRQQHFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW. Connect the VRXUFH &RQVWDQW→� to the�WDUJHW 2EMHFW�LQ�3LFWXUH�→�3LFWXUH�:LQGRZ��→�'LVSOD\. Accept thesettings by clicking the 2. button.

13 Select the 7DQN� object from the library and use it display the fill level. Create a&�DFWLRQ under 3URSHUWLHV�→�*HRPHWU\�→�:LGWK and under 3URSHUWLHV�→

Page 141: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-63C79000-G8276-C140-01

6WHS 3URFHGXUH��HQKDQFHG�DXWRPDWLF�LQSXW�FKHFN

*HRPHWU\�→�+HLJKW to simulate the filling process. Under 3URSHUWLHV�→�7DJ$VVLJQPHQW�→�)LOO�/HYHO, create a G\QDPLF�GLDORJ which returns the sum of thetwo actual value tags 8��LBSLFWXBLQSXWB�� and 8��LBSLFWXBLQSXWB�� as thereturn value.

14 As a second method of displaying the fill level, configure an I/O field under6PDUW�2EMHFWV�→�,�2�)LHOG; in our example, this is ,�2�)LHOG��

C action for Button1

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SHORT tmp1,tmp2;

tmp1=GetTagWord("U16i_pictu_input_11");tmp2=GetTagWord("U16i_pictu_input_12");

if (tmp1>GetTagWord("U16i_pictu_input_07")){SetTagWord("U16i_pictu_input_07",tmp1);SetTagBit("BINi_pictu_input_09",TRUE);}//if

if (tmp2>GetTagWord("U16i_pictu_input_08")){SetTagWord("U16i_pictu_input_08",tmp2);SetTagBit("BINi_pictu_input_10",TRUE);}//if

}

• Reading in the tag values that have been entered in the ,�2�ILHOGV.

• If the value entered exceeds the current set value, it is transferred to the set value andthe valve is turned on.

Page 142: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-64 WinCC Configuration ManualC79000-G8276-C140-01

C action for I/O Field3

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, double value){int a;

a=GetTagWord("U16i_pictu_input_11")+GetTagWord("U16i_pictu_input_12");if (a<=) {

SetOperation("pictu_5_window_15.PDL","Button1",1);SetVisible("pictu_5_window_15.PDL","Static Text5",0);SetVisible("pictu_5_window_15.PDL","Static Text6",1);}//f

else {SetOperation("pictu_5_window_15.PDL","Button1",0);SetVisible("pictu_5_window_15.PDL","Static Text5",1);SetVisible("pictu_5_window_15.PDL","Static Text6",0);}//if

}

• Reading in the sum of the tag values that have been entered in the�,�2�ILHOGV.

• If the sum of the value entered exceeds the maximum fill level of the container, %XWWRQ�is made inoperable and 6WDWLF�7H[W�, which contains the error message, is displayed.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names and the limits of the�,�2�ILHOG in picture SLFWXB�BZLQGRZB�� must beadapted to suit your own needs.

Page 143: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-65C79000-G8276-C140-01

������ 0XOWLSOH�RSHUDWLRQ��H[DPSOH����

You access this example in our SLFWXB�� project by 8 the EXWWRQ depicted above. Theexample is configured in the picture named SLFWXB�BFKDSWHUB��E�SGO.

7DVN�GHILQLWLRQ

One operator panel is to be able to be displayed by clicking several different EXWWRQV. If theSLFWXUH�ZLQGRZ is opened by clicking a EXWWRQ, it can be used to control a valve assigned tothe respective EXWWRQ. The operator window is as a rule displayed next to the EXWWRQ used tocall the window. It can, however, also be anchored at any position.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ,to show the picture displayed in the 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ when we click them

with the 8. The valve is controlled by means of two buttons created under :LQGRZV2EMHFWV�→�%XWWRQ; another EXWWRQ is used to close the window. The name of the valve andthe valve state are displayed by means of two static texts created under 6WDQGDUG�2EMHFWV�→6WDWLF�7H[W. The picture is anchored by means of a status display created under 6PDUW2EMHFWV�→�6WDWXV�'LVSOD\.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��PXOWLSOH�RSHUDWLRQ

1 In Tag Management, create tags of type %LQDU\�WDJ, which contain the currentstates of the valves. The number of tags required depends on the number ofvalves. In our example, we use tags %,1LBSLFWXBPXOWLB��, %,1LBSLFWXBPXOWLB��,%,1LBSLFWXBPXOWLB��, and %,1LBSLFWXBLQSXWB��.

2 Create a tag of type 7H[W�WDJ����ELW�FKDUDFWHU�VHW with a length of 20 characters.In our example, this is 7��[BSLFWXBLQSXWB��. This will be used as an address tag.

3 Create a tag of type %LQDU\�WDJ. In our example, this is %,1LBSLFWXBPXOWLB��. Thecontents of this tag inform us whether the window has been anchored.

4 Configure a picture with three buttons created under :LQGRZV�2EMHFWV�→�%XWWRQ.In our example, we use the objects %XWWRQ�, %XWWRQ�, and %XWWRQ�� The picturewe use is SLFWXB�BZLQGRZB���SGO.

5 For %XWWRQ�, configure a &�DFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW, whichsets the position of the picture outside the visible area, closes the picture andcancels the anchoring of the picture.

6 Configure a GLUHFW�FRQQHFWLRQ for %XWWRQ� under (YHQWV�→�0RXVH�→�3UHVV�OHIW.Connect the VRXUFH &RQVWDQW�→� to the WDUJHW�9DULDEOH�→�7��[BSLFWXBLQSXWB��.Select the LQGLUHFW option. Accept the settings by clicking the 2. button. In thisway, you have carried out indirect addressing. In the same way, create a GLUHFWFRQQHFWLRQ under %XWWRQ� with the VRXUFH &RQVWDQW�→�.

7 Create a status display under 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\. In our example,we use 6WDWXV�'LVSOD\�. Under &RQILJXUDWLRQ�'LDORJ���, select tag

Page 144: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-66 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��PXOWLSOH�RSHUDWLRQ

%,1LBSLFWXBPXOWLB�� and set the trigger in the 8SGDWH list box to 8SRQ�FKDQJH.Click the $GG button to add another state. For state �, select picture SXWBXS�EPS,and for state �, picture SXWBGRZQ�EPS.

8 For 6WDWXV�'LVSOD\���FUHDWH�D�&�DFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW,which negates the state of tag %,1LBSLFWXBPXOWLB��.

9 Configure an object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W as the title. In ourexample, we use the object called 6WDWLF�7H[W�. Create a &�DFWLRQ under3URSHUWLHV�→�)RQW�→�7H[W, which reads the current valve number out of theaddress tag 7��[BSLFWXBLQSXWB�� and returns an appropriate text as the returnvalue.

10 Configure another object under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W to display thevalve state. In our example, we use the object called 6WDWLF�7H[W�. Create a�&DFWLRQ under 3URSHUWLHV�→�)RQW�→�7H[W, which reads the state of the valve inquestion and returns an appropriate text as the return value. Under 3URSHUWLHV�→&RORUV�→�)RQW�&RORU, create a &�DFWLRQ which controls the font color inaccordance with the state of the valve.

11 In a second picture, configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH:LQGRZ. In our example, we use 3LFWXUH�:LQGRZ�. Adjust the size of the SLFWXUHZLQGRZ to match the size of the picture just configured. In the 3URSHUWLHV�→0LVFHOODQHRXV window, change the attributes 0RYDEOH and %RUGHU to <HV. Under3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BZLQGRZB���SGO.

12 In the same picture, configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ foreach valve in the picture; in our example, we use %XWWRQ�, %XWWRQ�, %XWWRQ�, and%XWWRQ�. For each button, create a &�DFWLRQ which reads out the number of theEXWWRQ and assigns the corresponding tag name to the address tag. Depending onwhether the picture is anchored or not, the picture is either positioned on the rightnext to the button that calls it or not.

Page 145: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-67C79000-G8276-C140-01

C action for the Close button (Button1)

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetLeft("pictu_3_chapter_05b","Picture Window1",-1000);SetVisible("pictu_3_chapter_05b","Picture Window1",0);SetTagBit("BINi_pictu_multi_00",FALSE);}

• Set the position of the picture outside the visible area.

• Hide the picture.

• Cancel anchoring of the picture.

C action for Status Display1

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetTagBit("BINi_pictu_multi_00",(SHORT)!GetTagBit("BINi_pictu_multi_00"));}

• Negate the state tag for picture anchoring.

Page 146: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-68 WinCC Configuration ManualC79000-G8276-C140-01

C action for the control buttons for the valves

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){int x,y;char name[20];int number;int ch = n;char *pdest;//check if object name contains character npdest = strrchr( lpszObjectName, ch );if ( pdest == NULL )(printf("ObjectNameError"));//read object numberelse { number = atoi(strrchr(lpszObjectName,n)+1); sprintf(name,"BINi_pictu_multi_%02d",number); //generate tag name SetTagChar("T16x_pictu_input_15",name); }SetVisible(lpszPictureName,"Picture Window1",1);if (GetTagBit("BINi_pictu_multi_00")==FALSE){

//get object positiony=GetTop(lpszPictureName,lpszObjectName);x=GetLeft(lpszPictureName,lpszObjectName);//set position of picture window

SetLeft(lpszPictureName,"Picture Window1",-1000);SetTop(lpszPictureName,"Picture Window1",y);SetLeft(lpszPictureName,"Picture Window1",(x+22));}

}

• Read the object number from the object name.

• Generate the name of the current state tag.

• Set the address tag to the current state tag.

• Display the SLFWXUH�ZLQGRZ.

• If the SLFWXUH�ZLQGRZ is not anchored, determine the position of the�EXWWRQand set theposition of the picture to the right next to the EXWWRQ. When its position is changed, theSLFWXUH�ZLQGRZ is set outside the visible area, in order to prevent it from being brieflydisplayed in the picture after the first change of position.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Adapt the object and tag names to suit your own needs. Make sure you observe thename conventions. The button number must be able to be uniquely assigned to the tagnumber to be switched.

Page 147: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-69C79000-G8276-C140-01

���� '\QDPLFV

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 148: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-70 WinCC Configuration ManualC79000-G8276-C140-01

������ &RORU�FKDQJH��H[DPSOH����

7DVN�GHILQLWLRQ

The color of a text is to change through various colors depending on the value of a tag.

,PSOHPHQWDWLRQ�FRQFHSW

We implement this by means of a slider object created under :LQGRZV�2EMHFWV�→�6OLGHU2EMHFW, which we use to change the value in a tag. The text is displayed by means of6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FRORU�FKDQJH

1 Create a tag of type 6LJQHG����ELW�YDOXH in Tag Management. In our example, weuse the tag called 6��LBSLFWXBG\QB��.

2 Configure a slider object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW; In ourexample, we use the object called 6OLGHU�2EMHFW�. Under 3URSHUWLHV�→0LVFHOODQHRXV, set the 0D[LPXP�9DOXH to ���� and the 0LQLPXP�9DOXH to �.Under (YHQWV�→�3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU&RQQHFWLRQ, create a GLUHFW�FRQQHFWLRQ to tag 6��LBSLFWXBG\QB��.

3 Configure an object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W. In our example, weuse the object called 6WDWLF�7H[W�. Under 3URSHUWLHV�→�)RQW�→�7H[W, create a &DFWLRQ which outputs a text with the corresponding tag value. and set the triggerto 8SRQ�FKDQJH.

4 Create a G\QDPLF�GLDORJ under 3URSHUWLHV�→�&RORUV�→�)RQW�&RORU. In the([SUHVVLRQ�)RUPXOD field, set tag 6��LBSLFWXBG\QB�� and set the trigger to 8SRQFKDQJH. In the 'DWD�7\SH field, select $QDORJ and add 4 value ranges by means ofthe $GG button. Set the value ranges as follows.

5 Create a G\QDPLF�GLDORJ under 3URSHUWLHV�→�)ODVKLQJ�→�)ODVKLQJ�%DFNJURXQG$FWLYH. In the ([SUHVVLRQ�)RUPXOD field, set tag 6��LBSLFWXBG\QB�� and set thetrigger to 8SRQ�FKDQJH. In the 'DWD�7\SH field, select $QDORJ and add a valuerange by means of the $GG button. Set the value ranges as follows.

Page 149: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-71C79000-G8276-C140-01

6WHS 3URFHGXUH��FRORU�FKDQJH

C action for Static Text

#include "apdefap.h" char *_main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){char text[100];DWORD temp;

//get tag valuetemp = GetTagDWord("S32i_pictu_dyn_00");//generate textswitch (GetTagDWord("@CurrentLanguage")){case 0x407:

sprintf(text,"The boiler temperature is \r\n%ddegrees",temp);

return text;case 0x409:

sprintf(text,"Container Temperature is\r\n%d degree",temp);return text;

case 0x40C:sprintf(text,"La température de chaudière est\r\nde %d

degré",temp);return text;

}//switch}

• Read out the tag value.

• Generate a piece of text consisting of a text component and a numerical valuecomponent using the VSULQWI function. It is performed independently of the currentruntime language.

• The return value is the generated text.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The value ranges and tag used in the G\QDPLF�GLDORJV must be adapted.

Page 150: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-72 WinCC Configuration ManualC79000-G8276-C140-01

������ 7H[W�H[FKDQJH��H[DPSOH����

7DVN�GHILQLWLRQ

The texts attached to different objects are to be changed automatically depending on thestate of a tag. The tool tip text is likewise to be changed.

,PSOHPHQWDWLRQ�FRQFHSW

button created under :LQGRZV�2EMHFWV�→�%XWWRQ, to turn a valve on and off. A static textcreated under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W displays whether the valve is on or off.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��WH[W�H[FKDQJH

1 Create a tag of type %LQDU\�WDJ in Tag Management. In our example, we use thetag called %,1LBSLFWXBG\QB��.

2 Configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use theobject called %XWWRQ�. Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, generate a &�DFWLRQwhich negates the status of the %,1LBSLFWXBG\QB�� tag.

3 Create a G\QDPLF�GLDORJ under 3URSHUWLHV�→�0LVFHOODQHRXV�→�7RROWLS�7H[W. Inthe ([SUHVVLRQ�)RUPXOD field, set tag %,1LBSLFWXBG\QB�� and set the trigger to8SRQ�FKDQJH. In the 'DWD�7\SH field, select the %RRO option. In the 7RROWLS�7H[Wcolumn, enter the text FORVH next to the valid range <HV���758( and the text RSHQnext to 1R���)$/6(.

4 Configure an object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W. In our example, weuse the object called 6WDWLF�7H[W�. Create a G\QDPLF�GLDORJ under 3URSHUWLHV�→)RQW�→�7H[W. In the ([SUHVVLRQ�)RUPXOD field, set tag %,1LBSLFWXBG\QB�� and setthe trigger to 8SRQ�FKDQJH. In the 'DWD�7\SH field, select the %RRO option. In the7RROWLS�7H[W column, enter the text RSHQ next to the valid range <HV���758( andthe text FORVH next to 1R���)$/6(.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The texts and tag used in the G\QDPLF�GLDORJV must be adapted to suit your own needs.

Page 151: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-73C79000-G8276-C140-01

������ $QLPDWLRQ�RI�PRYHPHQW��H[DPSOH����

7DVN�GHILQLWLRQ

An object is to be moved to a specific position on the screen depending on a tag value.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a picture window created under 6PDUW�2EMHFWV�→3LFWXUH�:LQGRZ, whose position we control by means of a tag. We change the value in thetag by means of a slider object created under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��DQLPDWLRQ�RI�PRYHPHQW

1 Create a tag of type 6LJQHG����ELW�YDOXH in Tag Management. In our example, weuse the tag called 6��LBSLFWXBG\QB��.

2 Configure a slider object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW; in ourexample, we use 6OLGHU�2EMHFW�. Under 3URSHUWLHV�→�0LVFHOODQHRXV, set the0D[LPXP�9DOXH to ��� and the 0LQLPXP�9DOXH to �. Under (YHQWV�→�3URSHUW\7RSLFV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ, create a GLUHFWFRQQHFWLRQ to tag 6��LBSLFWXBG\QB��.

3 Configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ. In ourexample, we use the object called 3LFWXUH�:LQGRZ�. Under 3URSHUWLHV�→0LVFHOODQHRXV, change the attributes %RUGHU and $GDSW�3LFWXUH to <HV. Under3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picture with the nameSLFWXB�BFKDSWHUB��.

4 Create a G\QDPLF�GLDORJ under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�;. In the([SUHVVLRQ�)RUPXOD field, set the expression ��6��LBSLFWXBG\QB�� ������. Setthe trigger to 8SRQ�FKDQJH of tag 6��LBSLFWXBG\QB��. In the 'DWD�7\SH field,select the 'LUHFW option.

5 Create a G\QDPLF�GLDORJ under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�<. In the([SUHVVLRQ�)RUPXOD field, set the expression �����6��LBSLFWXBG\QB���. Set thetrigger to 8SRQ�FKDQJH of tag 6��LBSLFWXBG\QB��. In the 'DWD�7\SH field, selectthe 'LUHFW option.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The expressions for calculating the bit position must be adapted in the G\QDPLF�GLDORJVto suit your own needs.

• The tag name must also be adapted.

Page 152: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-74 WinCC Configuration ManualC79000-G8276-C140-01

������ 6KRZLQJ�DQG�KLGLQJ�REMHFWV�E\�PHDQV�RI�ELW�HYDOXDWLRQ�H[DPSOH����

7DVN�GHILQLWLRQ

Objects are to be shown and hidden depending on a specific bit position in a tag value.

,PSOHPHQWDWLRQ�FRQFHSW

We implement this by means of a check box, which we create under :LQGRZV�2EMHFWV�→&KHFN�%R[, and we use this check box to set individual bits in a tag. Several polygonscreated under 6WDQGDUG�2EMHFWV�→�3RO\JRQV� are displayed or hidden depending on thesebits.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKRZLQJ�DQG�KLGLQJ�REMHFWV�E\�PHDQV�RI�ELW�HYDOXDWLRQ

1 Create a tag of type 8QVLJQHG���ELW�YDOXH in Tag Management. In our example,we use the tag called 8��BSLFWXBG\QB��.

2 Configure a check box under :LQGRZV�2EMHFWV�→�&KHFN�%R[; in our example weuse &KHFN�%R[�. Under 3URSHUWLHV�→�*HRPHWU\�→�1XPEHU�RI�%R[HV, enter thenumber of objects to be switched; in our example, �. Under 3URSHUWLHV�→�)RQW→�7H[W, enter the name of the object that is to be switched by the bit in questionfor each index value;

3 Configure a number of objects under 6WDQGDUG�2EMHFWV�→�3RO\JRQ. In ourexample, we use the objects called 3RO\JRQ� through 3RO\JRQ�.

4 Create a G\QDPLF�GLDORJ for 3RO\JRQ� under 3URSHUWLHV�→�0LVFHOODQHRXV�→'LVSOD\. In the ([SUHVVLRQ�)RUPXOD field, set tag 8��LBSLFWXBG\QB�� and set thetrigger to 8SRQ�FKDQJH. In the 'DWD�7\SH field, select the %LW option. Click the

button to call bit selection and select the first bit.

5 Follow the same procedure for the other SRO\JRQ�REMHFWV and change the bitnumber for each one.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names and picture position must be adapted in the G\QDPLF�GLDORJV to suit yourown needs.

Page 153: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-75C79000-G8276-C140-01

������ $QLPDWLRQ�RI�PRYHPHQW�E\�PHDQV�RI�D�&�DFWLRQ��H[DPSOH����

You access the following examples that relate to the Dynamics chapter in our SLFWXB��

project by 8 the button depicted above. The examples are configured in the picture namedSLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

An object is to be moved in one direction by clicking a EXWWRQ and in another direction byclicking another EXWWRQ.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a status display created under 6PDUW�2EMHFWV�→6WDWXV�'LVSOD\ to display two pictures. Two buttons created under :LQGRZV�2EMHFWV�→%XWWRQ are used to move this status display in two different directions.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��DQLPDWLRQ�RI�PRYHPHQW�E\�PHDQV�RI�D�&�DFWLRQ

1 In Tag Management, create three tags of type %LQDU\�WDJ; in our example, we usetags %,1LBSLFWXBG\QB��, %,1LBSLFWXBG\QB�� and %,1LBSLFWXBG\QB��.

2 Create a status display under 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\. In our example,we use the object called 6WDWXV�'LVSOD\�. Under &RQILJXUDWLRQ�'LDORJ���, selecttag %,1LBSLFWXBG\QB�� and set the trigger to 8SRQ�FKDQJH. Add another status.Set picture )HUUDUL��EPS under state � and picture )HUUDUL��EPS under state � bymeans of drag&drop.

3 Under 3URSHUWLHV�→�6WDWH�→�%DVLF�3LFWXUH�7UDQVSDUHQW�&RORU, set the color:KLWH for both states (� and �) and set 3LFWXUH�7UDQVSDUHQW�&RORU�2Q to <HV. Thismeans that the picture is not shown with a white background.

4 Configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use theobject called %XWWRQ�. Under (YHQWV�→�0RXVH�→�3UHVV�OHIW, create a GLUHFWFRQQHFWLRQ which sets tag %,1LBSLFWXBG\QB�� to �, and under (YHQWV�→�0RXVH→�3UHVV�ULJKW, create another GLUHFW�FRQQHFWLRQ which resets the same tag to �.

5 Create a second button under :LQGRZV�2EMHFWV�→�DQG�LQ�WKH�VDPH�ZD\�DVGHVFULEHG�LQ�WKH�SUHYLRXV�VWHS��FUHDWH�WZR�GLUHFW�FRQQHFWLRQV�WR�WDJ%,1LBSLFWXBG\QB��. In our example, we use the object called %XWWRQ�.

6 Under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�;, create a &�DFWLRQ for 6WDWXV'LVSOD\� which executes animation of the movement depending on which EXWWRQis clicked. Set the trigger for this action to ����PV.

Page 154: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-76 WinCC Configuration ManualC79000-G8276-C140-01

C action for animation of movement

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){static int a = 90;

//forward

if (GetTagBit("BINi_pictu_dyn_07")&&(a<652)) {a+=20;SetTagBit("BINi_pictu_dyn_05",(SHORT)!GetTagBit("BINi_pictu_dy

n_05"));}

//rewind

if (GetTagBit("BINi_pictu_dyn_06")&&(a>-0)) {a-=10;SetTagBit("BINi_pictu_dyn_05",(SHORT)!GetTagBit("BINi_pictu_dy

n_05"));}

//return x-positionreturn a;}

• Define a tag of type VWDWLF�LQW and initialize it with the current X position of the object.

• Check whether %XWWRQ� is clicked and if the X position is greater than 652. If yes,increase the value that contains the X position by 20. Then change the picture displayedin 6WDWXV�'LVSOD\�.

• Check whether %XWWRQ� is clicked and if the X position is less than -200. If yes, decreasethe value that contains the X position by 10. Then change the picture displayed in 6WDWXV'LVSOD\�.

• The return value is the new X position.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The principle of animation can be adopted.

Page 155: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-77C79000-G8276-C140-01

������ &UHDWH�DQLPDWLRQ�RI�PRYHPHQW�E\�PHDQV�RI�D�ZL]DUG��H[DPSOH����

7DVN�GHILQLWLRQ

An object is to change its position on the screen when changes are made to a tag. Separatetags are to be used for the X and Y positions. Configuration is to be implemented using the'\QDPLF�:L]DUG.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a circle created under 6WDQGDUG�2EMHFWV�→�&LUFOH,which is to be moved on the screen. We use two slider objects created under :LQGRZV2EMHFWV�→�6OLGHU�2EMHFW to enter the tag.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FUHDWH�DQLPDWLRQ�RI�PRYHPHQW�E\�PHDQV�RI�D�ZL]DUG

1 Create two tags of type 8QVLJQHG����ELW�YDOXH in Tag Management. In ourexample, we use the tags called 6��LBSLFWXBG\QB�� and 6��LBSLFWXBG\QB��.

2 Configure two slider objects under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW; in ourexample, we use 6OLGHU�2EMHFW� and 6OLGHU�2EMHFW�. Create a GLUHFW�FRQQHFWLRQunder 6OLGHU�2EMHFW�. Connect the VRXUFH 3URSHUW\�→�6OLGHU�2EMHFW��→�3URFHVV'ULYHU�&RQQHFWLRQ to the target Variable �6��LBSLFWXBG\QB��. In the same way,create a GLUHFW�FRQQHFWLRQ to tag 6��LBSLFWXBG\QB�� under 6OLGHU�2EMHFW�.

3 Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�0D[LPXP�9DOXH, change the setting to��� for both slider objects.

4 Configure an object of type 6WDQGDUG�2EMHFWV�→�&LUFOH. In our example, we use&LUFOH�. With the object selected, select the 6WDQGDUG�'\QDPLFV tab from the

'\QDPLF�:L]DUG and 8' the 0RYH�2EMHFW option. Select 7DJ as the trigger. Onthe 6HW�RSWLRQV page, select tag 6��LBSLFWXBG\QB�� for the X direction and tag6��LBSLFWXBG\QB�� for the Y direction. Enter � and ��� as the low and highlimits for formatting, respectively. On the next page, specify the picture areawithin which the object is to be moved. Close the Finished ! page by clicking)LQLVK.

5 Under 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�; and 3URSHUWLHV�→�*HRPHWU\�→3RVLWLRQ�<, set the trigger to 8SRQ�FKDQJH of the respective tag in the &�DFWLRQVgenerated by the '\QDPLF�:L]DUG.

Page 156: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-78 WinCC Configuration ManualC79000-G8276-C140-01

C action generated by wizard at position X

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){long i,j,k;i=GetTagWord("S32i_pictu_dyn_10");j=((i-0)*100/(255-0));k=min((((j*(690-490))/100)+490),690);return max(490,k);

}

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The settings made in the '\QDPLF�:L]DUG for animation of the movement must beadapted to suit your own needs.

Page 157: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-79C79000-G8276-C140-01

������ &RORU�FKDQJH�E\�PHDQV�RI�D�&�DFWLRQ��H[DPSOH����

7DVN�GHILQLWLRQ

The color of an object is to change smoothly from a dark to a light shade as a tag valuechanges.

,PSOHPHQWDWLRQ�FRQFHSW

We implement this by means of a circle, which we create under 6WDQGDUG�2EMHFWV�→&LUFOH, whose color changes as a tag value changes. We use a slider object created under:LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW to enter the tag.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH�

1 Create a tag of type 8QVLJQHG����ELW�YDOXH in Tag Management. In our example,we use tag 6��LBSLFWXBG\QB��.

2 Configure a slider object under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW; In ourexample, we use the object called 6OLGHU�2EMHFW�. Create a GLUHFW�FRQQHFWLRQ for6OLGHU�2EMHFW� under (YHQWV�→�3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→�3URFHVV'ULYHU�&RQQHFWLRQ. Connect the VRXUFH 3URSHUW\�→�6OLGHU�2EMHFW��→�3URFHVV'ULYHU�&RQQHFWLRQ to the target Variable �6��LBSLFWXBG\QB��.

3 Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�0D[LPXP�9DOXH, change the setting for6OLGHU�2EMHFW� to ���.

4 Configure a circle under 6WDQGDUG�2EMHFWV�→�&LUFOH; in our example, we use&LUFOH�. Under 3URSHUWLHV�→�&RORUV�→�%DFNJURXQG�&RORU, create a &�DFWLRQwhich provides a color value depending on tag 6��LBSLFWXBG\QB��. This action istriggered 8SRQ�FKDQJH of this tag.

C action for color change

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){return (GetTagDWord("S32i_pictu_dyn_10")<<8);}

• The return value returned by the action is the tag read in, 6��LBSLFWXBG\QB��, shifted 8bit positions to the left.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The color values are coded by specifying values for red, green and blue. 8 bits arereserved for each of these values in the 24-bit color value. In our example, the tag hasbeen shifted 8 bits to the left and therefore represents the green value. If this isn’t done,the color will change from black to red; if the tag is shifted 16 bits, from black to blue.

Page 158: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-80 WinCC Configuration ManualC79000-G8276-C140-01

������ $QLPDWLRQ�RI�PRYHPHQW�E\�PHDQV�RI�D�VWDWXV�GLVSOD\��H[DPSOH����

7DVN�GHILQLWLRQ

Movement is to be simulated by turning on different pictures in a 6PDUW�2EMHFWV�→�6WDWXVGLVSOD\.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a status display created under 6PDUW�2EMHFWV�→6WDWXV�'LVSOD\, in which we display different pictures one after the other after turning onthe display by means of another status display created under 6PDUW�2EMHFWV�→�6WDWXVGLVSOD\.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��DQLPDWLRQ�RI�PRYHPHQW�E\�PHDQV�RI�D�VWDWXV�GLVSOD\

1 Create a tag of type %LQDU\�WDJ in Tag Management. In our example, we use thetag called %,1LBSLFWXBG\QB��.

2 Create a status display under 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\. in our example,we use the object called 6WDWXV�'LVSOD\�. Under &RQILJXUDWLRQ�'LDORJ���, selecttag %,1LBSLFWXBG\QB�� and set the trigger to 8SRQ�FKDQJH. Add another status.Set picture 6PLOL�EPS under state � and picture &RRO�EPS under state �.

3 For 6WDWXV�'LVSOD\�, create a &�DFWLRQ�XQGHU (YHQWV�→�0RXVH�→�3UHVV�OHIW,which negates the state of tag %,1LBSLFWXBG\QB��.

4 Configure another status display under 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\; in ourexample, we use 6WDWXV�'LVSOD\�. Under 3URSHUWLHV�→�6WDWH�→�&XUUHQW�6WDWXV,configure seven more statuses with the respective pictures. For each status,change the %DVLF�3LFWXUH�7UDQVSDUHQW�&RORU attribute to :KLWH and the %DVLF3LFWXUH�7UDQVSDUHQW�&RORU�2Q to <HV. Statuses � through � are each assigned oneof the pictures from 6�B���EPS through 6�B���EPS.

5 For 6WDWXV�'LVSOD\�, create a &�DFWLRQ under 3URSHUWLHV�→�6WDWH�→�&XUUHQW6WDWXV, which causes current statuses 0 through 7 to be run through. Set thetrigger for this action to ����PV.

Page 159: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-81C79000-G8276-C140-01

C action for Status Display4

#include "apdefap.h"long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){static int a = 0, b = 0;

if (GetTagBit("BINi_pictu_dyn_09")) {if (b==0) a++;else a--;if (a==7) b=1;if (a==0) b=0;}

return a;}

• Declare two tags of type VWDWLF�LQW and initialize them with zero.

• When animation is activated, run through tags 0 through 7 and then begin at 0 again.

• Return this tag as the return value.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The principle of animation can be adopted.

• 6WDWXV�'LVSOD\� can be integrated into other projects in the form of a switch object if thestatus pictures and the tag name are adapted.

Page 160: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-82 WinCC Configuration ManualC79000-G8276-C140-01

���� /DQJXDJH�VZLWFK

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 161: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-83C79000-G8276-C140-01

������ &KDQJH�UXQWLPH�ODQJXDJH��H[DPSOH����

7DVN�GHILQLWLRQ

The runtime language is to be able to be changed by means of one button for each languageset.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use three buttons, which we can take ready-configuredfrom the library when creating them under :LQGRZV�2EMHFWV�→�%XWWRQ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FKDQJH�UXQWLPH�ODQJXDJH

1 In the *UDSKLFV�'HVLJQHU, a picture (any picture) is configured in a certainlanguage. By selecting the menu item View → Language, the next language to beconfigured is selected and all the texts translated into the language in question.All of the texts used in the project can be exported to a FVYfile with the aid of theODQJXDJH�H[H program on the WinCC CD. They can then be translated andimported back into the project.

2 Call the library by selecting menu item 9LHZ�→�/LEUDU\. Select the *OREDO/LEUDU\�→�%XWWRQV�/DQJXDJH subfolder and drag the EXWWRQV you require to the

workspace using the 8.

3 If you require a language that is not contained in the library, create a button under:LQGRZV�2EMHFWV�→�%XWWRQ and configure a &�DFWLRQ under (YHQWV�→�0RXVH�→3UHVV�OHIW, which executes the language change to the language in question. The*UDSKLFV�'HVLJQHU even provides a '\QDPLF�:L]DUG, which generates the &DFWLRQ required. To do this, select the EXWWRQ to be used for the additional

language and then 8' the /DQJXDJH�6ZLWFK option in the 6\VWHP�)XQFWLRQV tabof the '\QDPLF�:L]DUG. You can then select the language you want in the'\QDPLF�:L]DUG.

C action for the German button

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){SetLanguage(0x407); //Return type:BOOL}

• Use the 6HW/DQJXDJH function to change the language setting, entering the respectivelanguage code to do so.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Carry out the desired language settings in the '\QDPLF�:L]DUG.

Page 162: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-84 WinCC Configuration ManualC79000-G8276-C140-01

������ 'LDORJ�ER[�IRU�FKDQJLQJ�WKH�UXQWLPH�DQG�&RQWURO�&HQWHU�ODQJXDJH�H[DPSOH����

7DVN�GHILQLWLRQ

A EXWWRQ is to be created, which when clicked calls a dialog box in which one of thelanguages set can be selected.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control on, we use a button created under :LQGRZV�2EMHFWV�→�%XWWRQ,which shows or hides a picture window created under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ.This dialog box can be taken directly from the project with the name SLFWXB��.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��GLDORJ�ER[�IRU�FKDQJLQJ�WKH�UXQWLPH�DQG�&RQWURO�&HQWHUODQJXDJH

1 In the *UDSKLFV�'HVLJQHU, a picture (any picture) is configured in a certainlanguage. By selecting the menu item 9LHZ�→�/DQJXDJH, the next language to beconfigured is selected and all the texts translated into the language in question.

2 Configure a picture window under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ. In ourexample, we use 3LFWXUH�:LQGRZ�. Under 3URSHUWLHV�→�*HRPHWU\, change the:LQGRZ�:LGWK to ��� and the :LQGRZ�+HLJKW to ���. Under 3URSHUWLHV�→0LVFHOODQHRXV, change the attributes 0RYDEOH, %RUGHU, 7LWOH and &DQ�%H�&ORVHGto <HV. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select the picturewith the name SLFWXB�BZLQGRZB���SGO. This picture can be taken directly fromproject SLFWXB��. Change 3URSHUWLHV�→�0LVFHOODQHRXV�→�0LVFHOODQHRXV to 1R.

3 Configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, we use theobject called %XWWRQ�. Configure a GLUHFW�FRQQHFWLRQ under (YHQWV�→�0RXVH�→3UHVV�OHIW, which shows 3LFWXUH�:LQGRZ�.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• Picture SLFWXB�BZLQGRZB���SGO can be integrated directly into another project withoutany changes.

Page 163: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-85C79000-G8276-C140-01

���� :RUNLQJ�ZLWKRXW�D�PRXVH

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the pictures SLFWXB�BFKDSWHUB���SGO,SLFWXB�BFKDSWHUB��D�SGO�and SLFWXB�BFKDSWHUB��E�SGO.

Page 164: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-86 WinCC Configuration ManualC79000-G8276-C140-01

������ 2SHUDWLRQ�ZLWK�WKH�7$%�NH\�RU�KRW�NH\��H[DPSOH����

7DVN�GHILQLWLRQ

Lettering is required to be capable of formatting across several dialog boxes in differentways. There is a requirement for it to be possible to set the font color, different fontattributes and the font size. Further, it should be possible to reset the settings to specifieddefault settings.Operation of all the elements in the picture is to be performed solely on the keyboard.

,PSOHPHQWDWLRQ�FRQFHSW

To implement these control actions, we use four buttons created under :LQGRZV�2EMHFWV�→%XWWRQ. They are used to display the dialog boxes. They can be operated on the keyboardwhen the runtime cursor is activated. Select the EXWWRQ you want to operate with the TABkey. Further, a hot key is assigned to every button.Three picture windows created under 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ are used to displaythe dialog boxes.

&RQILJXULQJ�FXUVRU�FRQWURO

6WHS 3URFHGXUH��FRQILJXULQJ�FXUVRU�FRQWURO

1 Make the relevant settings in the &RQWURO�&HQWHU to enable cursor control. 85

&RPSXWHU to call the shortcut menu and choose 3URSHUWLHV. In the &RPSXWHU�OLVW

SURSHUWLHV dialog box that appears, 8 the 3URSHUWLHV button.

Then select the *UDSKLFV�5XQWLPH tab.

2 Make the hot key settings as follows. A hot key is not configured to FKDQJHZLQGRZV since setting of the control focus is performed with &�DFWLRQV in theexamples.

To switch between 7DE�2UGHU�$OSKD�&XUVRU, set 6+,)7�$, and set 6+,)7�5 forturning the runtime cursor on and off.

3 Do not set any keys in the segment &XUVRU�FRQWURO��NH\V. If they are required in

Page 165: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-87C79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�FXUVRU�FRQWURO

the examples, they are set by means of an API function. This is performedbecause several control concepts are shown in the examples. Normally, a certaincontrol concept is selected for a project and set here.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FRQILJXULQJ�FRQWURO�E\�PHDQV�RI�KRW�NH\V

1 In tag management, create three tags of the 8QVLJQHG����ELW�YDOXH type, whichcontain the set font attributes. In our example, we use 8��LBSLFWXBFXUVRUB��through 8��LBSLFWXBFXUVRUB��.

2 In the picture SLFWXB�BFKDSWHUB���SGO, create four objects of the :LQGRZV�2EMHFW→�%XWWRQ type. In our example, we use the objects called %XWWRQ�, %XWWRQ�,%XWWRQ� and %XWWRQ�. They are used to open the dialog boxes and to reset thesettings performed.

Further, configure static text under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W, the fontattributes of which have been set in the dialog boxes. In our example, we use theobject called 6WDWLF�7H[W�.

3 Configure another picture, which will be used as a dialog box for setting colors.In our example, we use the picture named SLFWXB�BZLQGRZB���SGO.

In this picture, configure a :LQGRZV�2EMHFWV�→�2SWLRQ�*URXS. In our example,we use the object called 2SWLRQ�*URXS�. 3URSHUWLHV→�*HRPHWU\�→1XPEHU�RI)LHOGV is set to �. This means it is possible to select four different colors.

Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV, create a WDJ�FRQQHFWLRQ totag 8��LBSLFWXBFXUVRUB��.

At 3URSHUWLHV→�*HRPHWU\�→�3RVLWLRQ�;, create a &�DFWLRQ which switches thefocus to its own object. This &�DFWLRQ is triggered at �K. If the 2SWLRQ�*URXS hasthe operation focus when the runtime cursor is switched on, it is displayed with aborder. If quadrangles are placed over the edges of the object that have the samecolor as the background, the border around the object can be hidden.

4 In the same picture, configure two button objects under :LQGRZV�2EMHFWV�→%XWWRQ. In our example, we use the objects called %XWWRQ� and %XWWRQ�.

%XWWRQ��is used as the 2.�EXWWRQ. At the (YHQW�→�0RXVH→�0RXVH�FOLFN, create a&�DFWLRQ which changes the color of the lettering as a function of the value of the8��LBSLFWXBFXUVRUB���tag. Further, its own window is switched to be madeinvisible.

%XWWRQ��is used as the (6&�EXWWRQ. At (YHQW�→�0RXVH→�0RXVH�&OLFN, create aGLUHFW�FRQQHFWLRQ to hide the separate window.

5 Performing settings for keyboard control.

Set the tabulator order. It can be set by choosing (GLW�→�7$%�2UGHU�→�6ZLWFK&XUVRU�→�6HTXHQFH from the menu.

Page 166: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-88 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�FRQWURO�E\�PHDQV�RI�KRW�NH\V

Every controllable object is now represented by a number. The order ofnumbering represents the tabulator sequence. This is the order in which theobjects are addressed when the tabulator key is operated. The order can bemodified with the mouse by selecting the different numbers.

The order is set as shown below.

The selection in the 2SWLRQ�*URXS is performed with the DUURZ�NH\V. A color isselected with VSDFHEDU. You can switch to and fro between the control elementswith the WDEXODWRU�NH\. The buttons are operated with the VSDFHEDU.

The two EXWWRQV are further provided with a hot key. The dialog box forconfiguring a hot key is opened by choosing 3URSHUWLHV�→�0LVFHOODQHRXV�→�+RW.H\. (17(5� and (6& are set for 2. &DQFHO, respectively.

Page 167: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-89C79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�FRQWURO�E\�PHDQV�RI�KRW�NH\V

6 In the picture called SLFWXB�BFKDSWHUB���SGO, configure a picture window bychoosing 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ in which you want to display thepicture you have just configured. In our example, we use the object called 3LFWXUH:LQGRZ�. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select thepicture with the name SLFWXB�BZLQGRZB���SGO. Set 3URSHUWLHV�→�0LVFHOODQHRXV→�'LVSOD\ to 1R.

7 At the %XWWRQ� object, create a &�DFWLRQ which queries the currently set color ofthe lettering and, depending on that, describes the 8��LBSLFWXBFXUVRUB�� tag.This is used to set the selection of the 2SWLRQ�*URXS in the dialog box to thecurrently set value. Further, the 3LFWXUH�:LQGRZ� object is displayed.

At %XWWRQ� create at 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ�; a &�DFWLRQ thatswitches the control focus to that object. This &�DFWLRQ is triggered at �K, butsetting of the focus is performed only the first time.

The EXWWRQ is further provided with a hot key. In our example, this is the functionkey )�.

8 Configure a picture which is to be used as a dialog box for creating different fontattributes. In our example, we use the picture named SLFWXB�BZLQGRZB���SGO.

In this picture, configure a :LQGRZV�2EMHFWV�→�&KHFN�%R[. In our example, weuse the object called &KHFN�%R[�. 3URSHUWLHV→�*HRPHWU\�→1XPEHU�RI�)LHOGV isset to �. It should be possible to choose the attributes EROG, LWDOLF, XQGHUVFRUH andERUGHU.

Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV, create a WDJ�FRQQHFWLRQ totag 8��LBSLFWXBFXUVRUB��.

At 3URSHUWLHV→�*HRPHWU\�→�3RVLWLRQ�;, create a &�DFWLRQ which switches thecontrol focus to its own object. The selection frame can be hidden in a mannersimilar to the 2SWLRQ�*URXS configured beforehand.

As with the picture called SLFWXB�BZLQGRZB���SGO, two buttons are created bychoosing :LQGRZV�2EMHFWV�→�%XWWRQ. Choosing 2. reads in the8��LBSLFWXBFXUVRUB�� tag and depending on that, the appropriate settings are

Page 168: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-90 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�FRQWURO�E\�PHDQV�RI�KRW�NH\V

applied to the lettering.

The settings for keyboard control are performed in the same way as for thepicture called SLFWXB�BZLQGRZB���SGO.

9 In the picture called SLFWXB�BFKDSWHUB���SGO, configure a further picture windowby choosing 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ in which you want to display thepicture you have just configured. In our example, we use the object called 3LFWXUH:LQGRZ�. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select thepicture with the name SLFWXB�BZLQGRZB���SGO. Set 3URSHUWLHV�→�0LVFHOODQHRXV→�'LVSOD\ to 1R.

10 At the %XWWRQ� object, create a &�DFWLRQ which queries the currently set fontattributes you want to modify and, depending on that, describes the8��LBSLFWXBFXUVRUB�� tag. This is used to set the selection of the FKHFN�ER[ inthe dialog box to the currently set values. Further, the 3LFWXUH�:LQGRZ� object isdisplayed.

The EXWWRQ is further provided with a hot key. In our example, this is the functionkey )��.

11 Configure a further picture which is to be used as a dialog box for setting the fontsizeSmart-Objekt. In our example, we use the picture namedSLFWXB�BZLQGRZB���SGO.

In this picture, configure an object by selecting 6PDUW�2EMHFWV�→�,�2�)LHOG. Inour example, we use the object called ,�2�)LHOG�.

Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH, create a WDJ�FRQQHFWLRQ to tag8��LBSLFWXBFXUVRUB��.

At 3URSHUWLHV→�*HRPHWU\�→�3RVLWLRQ�;, create a &�DFWLRQ which switches thecontrol focus to its own object. Hiding the selection list-box is accomplished inthe current example by a JUDSKLF�REMHFW being placed across the ,�2�ILHOG. In ourexample, we use the object called *UDSKLF�2EMHFW�. The bitmap displayed by theJUDSKLF�REMHFW has a specific color in the area in which the ,�2�ILHOG has to bedisplayed. This color is set in the JUDSKLF�REMHFW as the picture transparent colorat 3URSHUW\�→�3LFWXUH�→�3LFWXUH�7UDQVSDUHQW�&RORU. Further, the SURSHUW\�→3LFWXUH�→�3LFWXUH�7UDQVSDUHQW�&RORU�2Q has to be set to<HV. The bitmap used isdisplayed below.

12 As with the picture called SLFWXB�BZLQGRZB���SGO, two buttons are created bychoosing :LQGRZV�2EMHFWV�→�%XWWRQ. Click 2.� or &DQFHO to close the dialogbox.

Both EXWWRQV are removed from the TAB order, however. This is accomplished bychoosing (GLW�→�7$%�2UGHU�→�6ZLWFK�&XUVRU�→�6HTXHQFH. An object can be

removed from the TAB order by selecting it with 8 with key combination

Page 169: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-91C79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�FRQWURO�E\�PHDQV�RI�KRW�NH\V

&75/�6+,)7 pressed. Instead of the number, an * appears in the whiterectangle.

The EXWWRQV are operated solely by means of the (17(5 and (6& hot keys. If,however, (17(5is pressed, the value entered in the ,�2�ILHOG is applied to tag8��LBSLFWXBFXUVRUB�� simultaneously.

At object 6WDWLF�7H[W� in the picture called SLFWXB�BFKDSWHUB���SGO, create a WDJFRQQHFWLRQ at 3URSHUWLHV�→�)RQW�→�)RQW�6L]H at tag 8��LBSLFWXBFXUVRUB��.

13 In the picture called SLFWXB�BFKDSWHUB���SGO, configure a further picture windowby choosing 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ in which you want to display thepicture you have just configured. In our example, we use the object called 3LFWXUH:LQGRZ�. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select thepicture with the name SLFWXB�BZLQGRZB���SGO. Set 3URSHUWLHV�→�0LVFHOODQHRXV→�'LVSOD\ to 1R.

14 At object %XWWRQ�, create a &�DFWLRQ that displays the object called 3LFWXUH:LQGRZ�.

The EXWWRQ is further provided with a hot key. In our example, this is the functionkey )��.

15 At object %XWWRQ�, create a &�DFWLRQ that resets the settable properties of theobject called 6WDWLF�7H[W� to the presettings. The EXWWRQ is provided with hot key)��.

16 Choose (GLW�→�7$%�2UGHU�→�6ZLWFK�&XUVRU→�6HTXHQFH from the menu to setobjects %XWWRQ� to %XWWRQ� in the corresponding order. All other objects areremoved from the TAB order.

Press the VSDFHEDU or operate the appropriate hot keys to choose the EXWWRQV.

Page 170: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-92 WinCC Configuration ManualC79000-G8276-C140-01

C action for setting the focus

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){static BOOL bFirst = FALSE;

//set focus in first runif (bFirst==FALSE) Set_Focus(lpszPictureName,lpszObjectName);

bFirst=TRUE;return 100;}

• The first time the function is triggered, the focus is set to its own object. The &�DFWLRQ iscalled once per hour. The focus is set only once, however.

• This &�DFWLRQ is located at the 3URSHUW\�→�*HRPHWU\�→�3RVLWLRQ�; of object 2SWLRQ*URXS� in the picture called SLFWXB�BZLQGRZB���SGO� It is executed once every hour.

C action to set the font color

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){WORD wValue;

//get tag valuewValue=GetTagWord("U16i_pictu_cursor_00");

//set text colorswitch (wValue) { case 1: SetForeColor("pictu_3_chapter_08.PDL","Static

Text1",CO_BLACK);break; case 2: SetForeColor("pictu_3_chapter_08.PDL","Static

Text1",CO_RED); break; case 4: SetForeColor("pictu_3_chapter_08.PDL","Static

Text1",CO_GREEN); break; case 8: SetForeColor("pictu_3_chapter_08.PDL","Static

Text1",CO_BLUE);break; default:SetForeColor("pictu_3_chapter_08.PDL","Static

Text1",CO_BLACK);break; }//close windowSetVisible("pictu_3_chapter_08.PDL","Picture Window1", FALSE);}

• The IRQW�FRORU property of object 6WDWLF�7H[W� is set as a function of the value of tag8��LBSLFWXBFXUVRUB��.

• This &�DFWLRQ is executed by choosing 2. in the picture called SLFWXB�BZLQGRZB���SGO.

Page 171: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-93C79000-G8276-C140-01

C action for Open Picture

#include "apdefap.h"void OnOpenPicture(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName){//load DLL#pragma code ("pdlrtapi.dll")#include <pdlrtapi.h>#pragma code ()

PDLRTSetCursorKeys(255,255,255,255,0,0,NULL, (LPVOID)1,NULL);}

• Selection of the picture called SLFWXB�BFKDSWHUB���SGO applies a cursor setting by meansof API-function 3'/576HW&XUVRU.H\V. The first four parameters of the functioncontain the key codes for the keys required for up and down, and for left and rightmovements.

• In the present example, the WIN key for all four directions of movement is selected inorder to disable cursor movement by means of the keyboard. Movement of the runtimecursor is therefore allowed only by means of the TAB in the set TAB order.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• If you are working with a number of windows, you must define in the &RQWURO�&HQWHU akey combination for switching between these windows. In the present example, thecontrol concept was chosen, however, so that switching from one dialog box to anotheris neither possible nor necessary on the keyboard.

• The key combinations and hot keys used must be adapted to suit your own needs.

• The present control concept has been designed so that no specific arrow keys are used tomove the runtime cursor but simply TAB. However, the arrow keys are used by defaultto operate option groups and check boxes.

Page 172: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-94 WinCC Configuration ManualC79000-G8276-C140-01

������ &XUVRU�NH\ERDUG��H[DPSOH����

The present example is obtained in the picture called SLFWXB�BFKDSWHUB���SGO using the key

combination &75/�: or by choosing the top button with 8. It is configured in thepicture with the name SLFWXB�BFKDSWHUB��D�SGO.

7DVN�GHILQLWLRQ

Text has to be entered using the arrow keys on a keyboard projected in a picture. Thedifferent characters have to be selected with the arrow keys.It shall be possible to set cursor behavior at runtime in a dialog box. It shall be possible toopen the dialog box by operating a hot key.

,PSOHPHQWDWLRQ�FRQFHSW

A ready-made keyboard from the library is used for the implementation. It is personalized.A picture window created at 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ is used to display the dialogbox. A button created at :LQGRZV�2EMHFW�→�%XWWRQ provided with a hot key is used todisplay the dialog box. The�EXWWRQ itself is not displayed at runtime, however.

Page 173: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-95C79000-G8276-C140-01

,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��LPSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

1 In tag management, create two tags of the 8QVLJQHG����ELW�YDOXH type for storingcursor behavior. In the example we use the tags 8��LBSLFWXBFXUVRUB�� and8��LBSLFWXBFXUVRUB��.

Further, create a tag of the WH[W�WDJ����ELW�FKDUDFWHU�VHW type for transferring theentered text. In our example, we use the tag called 7��LBSLFWXBFXUVRUB��.

2Open the library with the button on the toolbar.

In the .H\ERDUGV folder, select the .H\ERDUG�&KDU object and drag and drop itinto a picture. In our example, this is the picture named SLFWXB�BFKDSWHUB��D�SGO.The explanatory objects can be deleted; only the elements displayed below arerequired.

3 At (17(5, a &�DFWLRQ is created at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ to writeentered text to a text tag. This tag is called &RQQHFWHG9DU&KDU. It has to bemodified in the picture called 7��LBSLFWXBFXUVRUB��.

The contents of the 7��LBSLFWXBFXUVRUB�� tag are displayed in the example in the6WDWLF�7H[W, which forma the picture heading. This is performed by means of a WDJFRQQHFWLRQ to that tag.

4 Performing settings for cursor control. With the exception of the keyboard keys,all the objects have to be removed from the TAB order. The order does not haveto be set since operation is intended to be performed with the arrow keys ratherthan the TAB key.

The arrow keys for cursor control are set in a &�DFWLRQ at (YHQWV�→0LVFHOODQHRXV�→�2SHQ�3LFWXUH.

5 It should be possible to set the cursor behavior in a dialog box.

This will normally already have been performed in the &RQWURO�&HQWHU. Use 85

to open the shortcut menu at the item &RPSXWHU and select 3URSHUWLHV. In the

&RPSXWHU�OLVW�SURSHUWLHV dialog box that appears, 8 the 3URSHUWLHV button. Thenselect the *UDSKLFV�5XQWLPH tab. You can choose between three different settingsin the &XUVRU�FRQWURO��EHKDYLRU box.

Page 174: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-96 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��LPSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6 Create a new picture to be used as a dialog box. In our example, we use thepicture named SLFWXB�BZLQGRZB���SGO.

Configure three status displays at 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\V in thispicture. In our example these are the objects called 6WDWXV�'LVSOD\�, 6WDWXV'LVSOD\� and 6WDWXV�'LVSOD\�. The &RQILJXUDWLRQ�GLDORJ�ER[ is used to set forevery VWDWXV�GLVSOD\ one bitmap which displays the pressed state of a button, andone bitmap which displays the non-pressed state of a button. 6WDWH � is intendedto display the pressed button, while VWDWH � is intended to display the non-pressedstate.

At 3URSHUWLHV�→�6WDWH�→�&XUUHQW�6WDWXV, create in each case a G\QDPLF�GLDORJER[ that control the current status of tag 8��LBSLFWXBFXUVRUB��. This tag containsthe temporary setting for the cursor behavior.

At (YHQWV�→�.H\ERDUG�→�3UHVV, create a &�DFWLRQ that describes tag8��LBSLFWXBFXUVRUB�� with a value representing a specific selection. Thesevalues are:

• 0...Normal

• 1...Normal without roll-back

• 10...Extended

7 In the same picture, configure two button objects under :LQGRZV�2EMHFWV�→%XWWRQ. In our example, we use the objects called %XWWRQ� and %XWWRQ�.

%XWWRQ��is used as the 2.�EXWWRQ. At (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, create a&�DFWLRQ that writes the value of tag 8��LBSLFWXBFXUVRUB���to tag8��LBSLFWXBFXUVRUB��. This is intended to represent the currently set cursorbehavior. Following that, the cursor behavior is changed using the API function3'/576HW&XUVRU.H\V. The value stored in the 8��LBSLFWXBFXUVRUB���tagcorresponds to the numerical value demanded by the function for specific cursorbehavior. Further, the focus is set to the $�EXWWRQ and the separate window isswitched to become invisible.

%XWWRQ��is used as the (6&�EXWWRQ. At (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, create a&�DFWLRQ that sets the focus to the $�EXWWRQ and hides its own window..

8 In the picture called SLFWXB�BFKDSWHUB��D�SGO, configure a picture window bychoosing 6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ in which you want to display thepicture you have just configured. In our example, we use the object called 3LFWXUH:LQGRZ�. Under 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, select thepicture with the name SLFWXB�BZLQGRZB���SGO. Set 3URSHUWLHV�→�0LVFHOODQHRXV→�'LVSOD\ to 1R.

9 In the picture called SLFWXB�BFKDSWHUB��D�SGO, create a button at :LQGRZV2EMHFWV�→�%XWWRQ. In our example, we use the object called %XWWRQ�.

Page 175: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-97C79000-G8276-C140-01

6WHS 3URFHGXUH��LPSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

At object %XWWRQ�, create a &�DFWLRQ which writes the value for the currently setcursor behavior to the 8��LBSLFWXBFXUVRUB�� tag and makes the 3LFWXUH�:LQGRZ�object visible.

The EXWWRQ is further provided with a hot key. In our example this is the keycombination &75/�(. The 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\ settings areset to 1R. This means the button itself is not visible but the configured hot key iseffective.

C action at the Press Key event

#include "apdefap.h"void OnKeyDown(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName, UINT nChar, UINT nRepCnt, UINTnFlags)

{if (nChar==VK_SPACE)

SetTagWord("U16i_pictu_cursor_05",0);}

• If the runtime cursor is positioned over the status display, this &�DFWLRQ is executedwhen a key is pressed. The nChar tag contains the key code of the corresponding key. Ifthis the spacebar, the value for the cursor behavior is written to the tag. In the presentexample this is the value for normal cursor behavior.

• This &�DFWLRQ has to be configured at the 3UHVV�.H\ event, as it not a question of aEXWWRQ with this object but of a VWDWXV�GLVSOD\. If it were not, the 0RXVH�&OLFN eventmight be used.

• To design the object for mouse operation too, a further &�DFWLRQ has to be created at theMouse Click event - without key code query, however.

Page 176: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-98 WinCC Configuration ManualC79000-G8276-C140-01

C action for the OK button

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){//load DLL#pragma code ("pdlrtapi.dll")#include <pdlrtapi.h>#pragma code ()

//set selected cursor mode to tagSetTagWord("U16i_pictu_cursor_04",

GetTagWord("U16i_pictu_cursor_05"));

//set cursor modePDLRTSetCursorKeys(VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT,0,

GetTagWord("U16i_pictu_cursor_04"),NULL,(LPVOID)1,NULL);

//set focus to A-buttonSet_Focus("pictu_3_chapter_08a.PDL","Button92");

//close windowSetVisible("pictu_3_chapter_08a.PDL","Picture Window1", FALSE);}

• Load the DLL containing the 3'/576HW&XUVRU.H\V function.

• The selected cursor behavior is stored in the 8��LBSLFWXBFXUVRUB�� tag.

• Perform the cursor setting with the AP function 3'/576HW&XUVRU.H\V. The first fourparameters of the function contain the key codes for the keys required for up and down,and for left and right movements. The sixth parameter transfers the required cursorbehavior to the function. This is already contained, in properly coded form, in the8��LBSLFWXBFXUVRUB�� tag.

• The focus is again set to the $�EXWWRQ of the keyboard and the dialog box is closed.

• Upon the event Open Picture, the function called 3'/576HW&XUVRU.H\V is called andthe cursor behavior is set to normal. Loading of the DLL is already performed at thistime. It does not have to be reloaded. This is mentioned again for the sake ofcompleteness, however.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The key combinations and hot keys used must be adapted to suit your own needs.

• Two other keyboards are available in the library. These are a keyboard for enteringnumerals and one for numbers and characters. They are in the same way as the keyboardused in this example.

Page 177: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-99C79000-G8276-C140-01

������ 9DOXH�LQSXW��FRQWURO�DFWLRQV��H[DPSOH����

The present example is obtained in the picture called SLFWXB�BFKDSWHUB��D�SGO using the

key combination &75/�: or by choosing the top button with 8. It is configured in thepicture with the name SLFWXB�BFKDSWHUB��E�SGO.

7DVN�GHILQLWLRQ

Various control actions are to be performed in a plant picture without using a mouse.Values are to be input and a number of switching operations performed.

,PSOHPHQWDWLRQ�FRQFHSW

To implement these control actions, a number of buttons created under :LQGRZV�2EMHFWV�→%XWWRQ is used, under which hot keys are configured. Values are to be able to be entered inI/O fields created under 6PDUW�2EMHFWV�→�,�2�)LHOG, and valves are to be able to be turnedon and off.

,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��LPSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

1 In tag management, create six tags of the VLJQHG����ELW�YDOXH type for performingand storing inputs. In our example we use the tags 6��LBSLFWXBFXUVRUB�� to6��LBSLFWXBFXUVRUB��.

2 In a picture, configure three I/O fields at 6PDUW�2EMHFWV�→�,�2�)LHOGV in whichthe fill-level setpoints have to be entered. In our example these are the objects ,�2)LHOG�, ,�2�)LHOG� and ,�2�)LHOG�.

At object �,�2�)LHOG�, create a tag connection to tag 6��LBSLFWXBFXUVRUB�� at3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH. Choose 3URSHUWLHV→�/LPLWV and setthe 8SSHU�OLPLW to ���� and the /RZHU�OLPLW to �.

Proceed in a similar manner at the other ,�2�ILHOGV, but set tags6��LBSLFWXBFXUVRUB�� and 6��LBSLFWXBFXUVRUB��. At the ,�2�)LHOG� object,however, set the 8SSHU�OLPLW to ����.

3 Configure three buttons at :LQGRZV�2EMHFWV�→�%XWWRQwhich are to be used forapplying the values entered in the ,�2�ILHOGV. In our example, we use the objectscalled %XWWRQ)�, %XWWRQ)� and %XWWRQ)�.

At object %XWWRQ)�, create a &�DFWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ thatwrites the value entered in tag 6��LBSLFWXBFXUVRUB�� to tag6��LBSLFWXBFXUVRUB��. Choose 3URSHUWLHV→�0LVFHOODQHRXV→�+RW�.H\ set hotkey )� for the EXWWRQ.

Proceed in a similar manner with the other EXWWRQV.

At %XWWRQ)�, create a &�DFWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�:LGWK that switchesthe focus to its own object.

Page 178: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-100 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��LPSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

4 Configure three rectangle at 6WDQGDUG�2EMHFWV�→�5HFWDQJOHV� to represent enteredvalues. In our example, we use the objects 5HFWDQJOH�, 5HFWDQJOH��, and5HFWDQJOH��.

Set the 3URSHUWLHV�→�)LOOLQJ�→�'\QDPLF�)LOOLQJ to <HV. At 3URSHUWLHV�→�)LOOLQJ→�)LOO�/HYHO, create in each instance a G\QDPLF�GLDORJ�ER[ for converting the tagvalue into a fill level.

The graphical display of the containers is performed with several VWDQGDUGREMHFWV, which are combined to form a group in each instance.

5 Configure four more buttons under :LQGRZV�2EMHFWV�→�%XWWRQ. They are to beused to turn valves on and off. In our example, we use the objects called%XWWRQ)�, %XWWRQ)��, %XWWRQ)�� and %XWWRQ)��.

At the (YHQW→�0RXVH→�0RXVH�&OLFN, create a &�DFWLRQ to invert a binary tagrepresenting a valve state. Every EXWWRQ is linked to a hot key.

6 In the picture, configure four valves which are connected with the correspondingbinary tags. You will find a detailed description of how to create these valves inthe section called 'LVSOD\LQJ�DQG�KLGLQJ�LQIRUPDWLRQ in example 6KRZLQJ�DQGKLGLQJ�REMHFWV��H[DPSOH����.

7 With the exception of the EXWWRQV provided with hot keys, all the other objects areremoved from the TAB order.

Set the order of selection of the ,�2�ILHOGV with the TAB key by choosing (GLW�→7$%�2UGHU�→�$OSKD�&XUVRU�→�2UGHU from the menu.

8 In the &RQWURO�&HQWHU, set a key combination for fore toggling between the Tab

Orders and the alpha cursor. 85 &RPSXWHU to call the shortcut menu and choose

Page 179: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-101C79000-G8276-C140-01

6WHS 3URFHGXUH��LPSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

3URSHUWLHV. In the &RPSXWHU�OLVW�SURSHUWLHV dialog box that appears, 8 the3URSHUWLHV button. Then select the *UDSKLFV�5XQWLPH tab.

To toggle between 7DE�2UGHUV�DQG�DOSKD�FXUVRU, set the key combination6+,)7�$. Further, to turn the runtime cursor on and off, set the key combination6+,)7�5.

1RWH�You can exit the example just described by choosing the following button or by pressing(6&.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The key combinations and hot keys used must be adapted to suit your own needs.

• Only the red-colored control elements are provided with functions. The other elementsdo not have functions. The whole picture represents a diagram of operator panel 6LPDWLF23��.

Page 180: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-102 WinCC Configuration ManualC79000-G8276-C140-01

����� 6KRZLQJ�DQG�KLGLQJ�LQIRUPDWLRQ

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

Page 181: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-103C79000-G8276-C140-01

������� 6KRZLQJ�DQG�KLGLQJ�REMHFWV��H[DPSOH����

In many plant pictures, it sometimes makes sense if certain items of information are notconstantly displayed in the picture, but can be shown when required or when specific eventsoccur.

7DVN�GHILQLWLRQ

Certain objects or object groups in a picture are to be able to be hidden by the user.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use a picture in which several valves are displayed.Each valve is assigned a button created under :LQGRZV�2EMHFWV�→�%XWWRQ which is used tocontrol the valve, a static text created under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W with the nameof the valve, and a group object which displays the state of the valve. In addition, thepicture also depicts containers whose fill levels are displayed by means of I/O fields createdunder 6PDUW�2EMHFWV�→�,�2�)LHOG. All I/O fields, all buttons and all static texts can beshown and hidden by clicking the corresponding one of the buttons created for this purposeunder :LQGRZV�2EMHFWV�→�%XWWRQ.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��VKRZLQJ�DQG�KLGLQJ�REMHFWV

1 In Tag Management, create three tags of type %LQDU\�WDJ, which control thevisibility of the various object groups. In our example, we use%,1LBSLFWXBLQIRB��, %,1LBSLFWXBLQIRB��, and %,1LBSLFWXBLQIRB��.

2 In Tag Management, create further tags of type %LQDU\�WDJ, which contain thecurrent states of the valves. The number of tags required depends on the numberof valves. In our example, we use %,1LBSLFWXBLQIRB� through%,1LBSLFWXBPXOWLB��; we have, then, configured a total of 11 valves.

3 To display the valves in their open state, configure an object under 6WDQGDUG2EMHFWV�→�3RO\JRQ, which has the shape of a valve. Under 3URSHUWLHV�→�&RORUV

→�%DFNJURXQG�&RORU, select the color GDUN�JUHHQ.

4 To display the valves in their closed state, configure an object under 6WDQGDUG2EMHFWV�→�3RO\OLQH, which has the shape of a valve.

5 Configure two identical objects under 6WDQGDUG�2EMHFWV�→�5HFWDQJOH and setthem to display the background color of the picture under 3URSHUWLHV�→�&RORUV→�%DFNJURXQG�&RORU. The rectangles should be slightly larger than the valves, sothat they can hide them.

6 Position a rectangle and an open valve over each other and position the open

valve in the foreground by clicking the button. Select menu item (GLW�→*URXS�REMHFW�→�*URXS and group the two objects. For the group object thisgenerates, configure a tag connection to tag %,1LBSLFWXBLQIRB� under 3URSHUWLHV→�0LVFHOODQHRXV�→�9LHZ.

Page 182: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-104 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��VKRZLQJ�DQG�KLGLQJ�REMHFWV

7 Position the closed valve over the second UHFWDQJOH and position it in theforeground. Then position the JURXS�REMHFW generated under Step 6 over this andposition it in the foreground. Now group these three objects. This new JURXSREMHFW can then be copied to enable you to configure the remaining valvesquickly. The only adaptation you have to make is to the WDJ�FRQQHFWLRQ.

8 For each valve, configure a button under :LQGRZV�2EMHFWV�→�%XWWRQ and under(YHQWV�→�0RXVH�→�3UHVV�OHIW, create a &�DFWLRQ which negates the correspondingtag value.

9 Configure a static text for each valve under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W,which contains the name of the valve.

10 Configure a number of containers whose fill levels are displayed by means of I/Ofields created under 6PDUW�2EMHFWV�→�,�2�)LHOG.

11 Configure three objects under :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, weuse the objects called %XWWRQ��, %XWWRQ��, and %XWWRQ��. For %XWWRQ��, create a &DFWLRQ under (YHQWV�→�0RXVH�→�3UHVV�OHIW, which negates the value of tag%,1LBSLFWXBLQIRB��. Then create identical &�DFWLRQV for tags %,1LBSLFWXBLQIRB��and %,1LBSLFWXBLQIRB�� under the remaining EXWWRQV.

12 Configure a WDJ�FRQQHFWLRQ to tag �%,1LBSLFWXBLQIRB�� under all of the objectswhich are to be shown and hidden by means of �%XWWRQ��. Do exactly the samefor the other objects. In our example, %XWWRQ�� is used to show the ,�2�ILHOGV,%XWWRQ�� to show the VWDWLF�WH[WV, and %XWWRQ�� to show the EXWWRQV.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The basic method of showing and hiding objects can be adopted.

• The method of displaying the valves can be adopted directly.

Page 183: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-105C79000-G8276-C140-01

������� 'LVSOD\LQJ�WKH�GDWH�DQG�WLPH��H[DPSOH����

7DVN�GHILQLWLRQ

Different ways of displaying the time and date are to be presented.

,PSOHPHQWDWLRQ�FRQFHSW

We implement this by means of an OLE Control object which we create under 6PDUW2EMHFWV�→�2/(�&RQWURO and which is used to display an OCX object. We also use twostatic texts created under 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W to display the date and the time.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��GLVSOD\LQJ�WKH�GDWH�DQG�WLPH

1 Configure an OLE Control object under 6PDUW�2EMHFWV�→�2/(�&RQWURO. In ourexample, we use the object called 2/(�&RQWURO�. Select the :LQ&&'LJLWDO�$QDORJ�&ORFN�&RQWURO object from the window that appears. Thisgenerates a time display which you now only have to adjust to the size and typeof display you want.

2 Configure an object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W. In our example, weuse the object called 6WDWLF�7H[W��. Create a &�DFWLRQ under 3URSHUWLHV�→�)RQW�→7H[W, which reads out the current computer or system time and returns this as thereturn value. Set the trigger for this action to 1 second.

3 Configure another object of type 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[W. In ourexample, we use the object called 6WDWLF�7H[W��. Create a &�DFWLRQ under3URSHUWLHV�→�)RQW�→�7H[W, which reads out the current date and returns this asthe return value.

Page 184: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-106 WinCC Configuration ManualC79000-G8276-C140-01

C action for reading out the time

#include "apdefap.h"char* _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){time_t timer;struct tm *ptm;char *p;

time(&timer);ptm=localtime(&timer);p=SysMalloc(9);sprintf(p,"%02d:%02d:%02d",ptm->tm_hour,ptm->tm_min,ptm->tm_sec);return(p);}

• WLPH�WLPHU� returns the current system time in seconds.

• ORFDOWLPH�WLPHU� returns a pointer to the system time structure.

• 6\V0DOORF reserves a memory area.

• VSULQWI generates a text consisting of a static segment and several numerical segments.

C action for reading out the date

#include "apdefap.h"char* _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){time_t timer;struct tm *ptm;char *p;

time(&timer);ptm=localtime(&timer);p=SysMalloc(9);sprintf(p,"%02d:%02d:%02d",ptm->tm_mday,ptm->tm_mon,ptm->tm_year);return(p);}

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:• The 6PDUW�2EMHFWV→�2/(�&RQWURO can be directly applied.

• The &�DFWLRQV at 6WDQGDUG�2EMHFWV→�6WDWLF�7H[W can be directly applied.

Page 185: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-107C79000-G8276-C140-01

����� &RQILJXULQJ�PHVVDJHV

You access the examples that relate to this topic in our SLFWXB�� project by 8 the EXWWRQdepicted above. The examples are configured in the picture named SLFWXB�BFKDSWHUB���SGO.

7DVN�GHILQLWLRQ

Specific messages are to be output depending on the tag state. These messages are to beoutput depending on changes of state in bits and limit violations. In addition, automaticpicture changes are to be enabled in the event of an error.All messages are to be displayed in a message picture. In an overview picture, messages areto be displayed selectively.

,PSOHPHQWDWLRQ�FRQFHSW

To implement this control action, we use two application windows created under 6PDUW2EMHFWV�→�$SSOLFDWLRQ�:LQGRZ, in which we display the message pictures. In addition, wealso use three slider objects created under :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW and a checkbox created under :LQGRZV�2EMHFWV�→�&KHFN�%R[, with which we enter values andsimulate error messages.

,PSOHPHQWLQJ�LQ�WKH�:LQ&&�SURMHFW

6WHS 3URFHGXUH��FRQILJXULQJ�PHVVDJHV

1 Create four tags of type 8QVLJQHG����ELW�YDOXH in Tag Management. In ourexample, we use 8��LBSLFWXBPHVVDJHB�� through 8��LBSLFWXBPHVVDJHB��.

2 Configure a check box under :LQGRZV�2EMHFWV�→�&KHFN�%R[; in our example,we use &KHFN�%R[�. Under 3URSHUWLHV�→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV, createa WDJ�FRQQHFWLRQ to tag 6��LBSLFWXBPHVVDJHB��.

3 Configure three objects of type :LQGRZV�2EMHFWV�→�6OLGHU�2EMHFW. in ourexample, we use 6OLGHU�2EMHFW�, 6OLGHU�2EMHFW�, and 6OLGHU�2EMHFW�. Under&RQILJXUDWLRQ�'LDORJ���, select tag 6��LBSLFWXBPHVVDJHB�� and set the trigger to8SRQ�FKDQJH. Change the 0D[LPXP�9DOXH to ���. In the same way, configurethe remaining tags for the other VOLGHU�REMHFWV.

4 Open the $ODUP�/RJJLQJ editor in the &RQWURO�&HQWHU by clicking it with the

85.

5 Select menu item )LOH�→�6WDUW�0HVVDJH�:L]DUG��� and close the first page of the

Page 186: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-108 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�PHVVDJHV

wizard by clicking 1H[W.

6 On the page entitled 6HOHFWLQJ�0HVVDJH�%ORFNV in the section called 6\VWHPEORFNV, select the 'DWH��7LPH��1XPEHU option. Leave the remaining settings asthey are and close the page by clicking 1H[W. On the page entitled &UHDWLQJ�D/LQH, leave the settings as they are and close the page by clicking 1H[W. On thepage entitled 0HVVDJH�:LQGRZV, leave the settings as they are and close the pageby clicking 1H[W. On the page entitled 3UHVHWWLQJ�&ODVVHV, leave the settings asthey are and close the page by clicking 1H[W. On the page entitled &KRRVLQJ$UFKLYHV, select the 6KRUW�7HUP�$UFKLYH�)RU�����0HVVDJHV and close the page byclicking 1H[W. Close the )LQDOH� page by clicking $SSO\.

7 Select 0HVVDJH�OLQH�IRUPDW, 85 the 0HVVDJH�OLQH�H[DPSOH option in the right-hand window and open the properties dialog.

Add the message blocks 0HVVDJH�WH[W and 3RLQW�RI�HUURU by clicking the button and close the window by clicking 2..

8 Select 0HVVDJH�EORFNV and 8' the 8VHU�WH[W�EORFN option in the right-hand

window. 85 the 0HVVDJH�WH[W option and call the properties dialog. Change thelength to 40 characters. In the same way, change the length of the 3RLQW�RI�HUURUblock to 20 characters.

9 Select 0HVVDJH�ZLQGRZ�WHPSODWHV, 85 the 0HVVDJH�ZLQGRZ�H[DPSOH option inthe right-hand window and open the properties dialog. In the *HQHUDO,QIRUPDWLRQ tab, enter the window name and the window title and select 6KRUW�7HUP�$UFKLYH�:LQGRZ in the :LQGRZ�7\SH section. In our example, we havechosen )LOOLQJ�V\VWHP�PRQLWRULQJ as the window name and )LOOLQJ�V\VWHP as thewindow title. On the 0HVVDJH�/LQH tab, set the message line format you require -

Page 187: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-109C79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�PHVVDJHV

in the example, the previously created H[DPSOH�PHVVDJH�OLQH format. On the3DUDPHWHUV tab, select the items /LQH�7LWOH and &ROXPQ�7LWOH. In the 6WDWXV�%DUtab, select 'LVSOD\�6WDWXV�%DU, set %RWWRP in the $OLJQPHQW section, and under(OHPHQWV�2I�7KH�6WDWXV�%DU, select 'DWH and 7LPH. In the 7RROEDU tab, select'LVSOD\�7RROEDU, set 7RS in the $OLJQPHQW section, select DOO�NH\ERDUG�IXQFWLRQV,but deselect the &LW\�&DOO�IXQFWLRQV check box. Close the window by clicking 2..

10 Define messages in the table window. To do this, 85 the 1XPEHU column andclick $SSHQG�1HZ�/LQH. Enter (UURU in the &ODVV column and $ODUP in the 7\SHcolumn. In the (YHQW�WDJ column, select tag 8��LBSLFWXBPHVVDJHB�� and under(YHQW�ELW, set the bit number �. Enter EUHDNGRZQ as the PHVVDJH�WH[W and SXPS��as the ORFDWLRQ. Configure further messages in the same way, using (UURU and:DUQLQJ also as message types. These are all generated by individual bits of thetag written to by the FKHFN�ER[.

11 Select menu item 2SWLRQV�→�$GG�,QV��� and click /LPLW�YDOXH�PRQLWRULQJ if this

hasn’t already been done. Now 85 the new /LPLW�YDOXH�PRQLWRULQJ option thathas appeared and click the 1HZ��� option. Select 8��LBSLFWXBPHVVDJHB�� as the

tag to be monitored. 85 the new option generated for the tag, select 1HZ��� anddefine a limit value and the message number that belongs to it. In our example,we use a +LJK�/LPLW�9DOXH of ��� and the 0HVVDJH�QXPEHU �. A new line hasnow been added in the table window, in which all you have to enter now is the0HVVDJH�WH[W and the 3RLQW�RI�HUURU. In the same way, configure other messagesfor the low limit value and the other tags.

12 To configure the message colors, select the 0HVVDJH�FODVVHV item and 8' the

)DLOXUH option in the right-hand window. 85 the $ODUP option, open theproperties dialog and enter the color settings you want. Do the same for the)DLOXUH and :DUQLQJ options. In our example, we use the following color schemefor the message type $ODUP:

We use the following color scheme for the message type )DLOXUH:

We use the following color scheme for the message type :DUQLQJ:

13 Save the settings in the $ODUP�/RJJLQJ editor.

14 In the picture, configure an application window under 6PDUW�2EMHFWV�→$SSOLFDWLRQ�:LQGRZ, select $ODUP�/RJJLQJ as the :LQGRZ�&RQWHQWV and )LOOLQJPRQLWRULQJ as the 7HPSODWH. In our example, we use the object called $SSOLFDWLRQ:LQGRZ�.

Page 188: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-110 WinCC Configuration ManualC79000-G8276-C140-01

Configuring Loop in Alarm

6WHS 3URFHGXUH��FRQILJXULQJ�/RRS�LQ�$ODUP

1 The pictures we use in our example to display a /RRS�LQ�$ODUP areSLFWXB�BZLQGRZB�� through SLFWXB�BZLQGRZB����For each of the containerobjects in the three pictures, a WDJ�FRQQHFWLRQ is configured to one of the threetags supplied by the VOLGHU�REMHFWV; this is done under 3URSHUWLHV�→�7DJ$VVLJQPHQW�→�)LOO�/HYHO.

2 In the picture in which the VOLGHU�REMHFWV and the FKHFN�ER[HV are also configured,configure a picture window (6PDUW�2EMHFWV�→�3LFWXUH�:LQGRZ). In our example,we use 3LFWXUH�:LQGRZ� and set SLFWXB�BZLQGRZB���SGO as the picture name.

3 To implement a /RRS�LQ�$ODUP, create a SURMHFW�IXQFWLRQ in the *OREDO�6FULSWeditor, which uses the name of the picture in which the error has arisen as thetransfer parameter. In our sample project, this is the function$ODUP3LFWXUH&KDQJH. The $ODUP�/RJJLQJ editor uses the 2SHQ3LFWXUH functionby default.

4 Create three alarm lines which react, for example, to a limit value inquiry. In our

example, these are messages � through �. 8' in the /RRS�LQ�$ODUP column andset the picture name. The picture set is the one in which the corresponding tag,whose limit value is monitored, is displayed��The function�$ODUP3LFWXUH&KDQJHis selected as the function name at 3URMHFW�IXQFWLRQ. If a relevant error now arises

during runtime, you can click the button (’Short-Term Archive’) in thetoolbar of the message window to execute a picture change in the picture.

Configuring a message window in the overview section

6WHS 3URFHGXUH��FRQILJXULQJ�D�PHVVDJH�ZLQGRZ�LQ�WKH�RYHUYLHZ�VHFWLRQ

1 In the $ODUP�/RJJLQJ editor, create a new message window template; in ourexample, we use the template 2YHUYLHZ�PHVVDJH. Select 0HVVDJH�ZLQGRZ

WHPSODWHV, 85 it, and then click 1HZ���. In the *HQHUDO�,QIRUPDWLRQ tab, enterthe window name and the window title. In our example, we have chosen2YHUYLHZ�PHVVDJH as the window name and DODUPV as the window title. Selectthe 0HVVDJH�:LQGRZ option in the :LQGRZ�7\SH section. Choose the 6HOHFWLRQ���button to open the 6HW�6HOHFWLRQ window and deselect message types (UURU and:DUQLQJ�via the folder called 0HVVDJH�&ODVV�→�(UURU in the window on theright. This means that only messages of type $ODUP are displayed in the overviewwindow.

Page 189: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���SLFWXB��

WinCC Configuration Manual 3-111C79000-G8276-C140-01

6WHS 3URFHGXUH��FRQILJXULQJ�D�PHVVDJH�ZLQGRZ�LQ�WKH�RYHUYLHZ�VHFWLRQ

Inthe 0HVVDJH�/LQH tab, set the format entitled 0HVVDJH�OLQH�H[DPSOH. The3DUDPHWHUV, 6WDWXV�%DU and 7RROEDU tabs can be applied unchanged.

2 In an overview window which is displayed in every plant status, configure anapplication window under 6PDUW�2EMHFWV�→�$SSOLFDWLRQ�:LQGRZ and set $ODUP/RJJLQJ as the :LQGRZ�&RQWHQWV and 2YHUYLHZ�PHVVDJH as the 7HPSODWH. In ourexample, we use the object called $SSOLFDWLRQ�:LQGRZ� in pictureSLFWXB�BRYHUYLHZB���SGO. Set the size of the window large enough that a messagecan be displayed.

3 In the overview picture, configure a button object under :LQGRZV�2EMHFWV�→%XWWRQ. In our example, we use the object called %XWWRQ�. For this button, create a&�DFWLRQ under (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which opens the messagepicture SLFWXB�BFKDSWHUB��. This EXWWRQ can, therefore, be used in every plantstatus to switch to the message window if an alarm message has been displayed.

4 In the sample project in picture SLFWXB�BNH\ERDUGB���SGO, a further EXWWRQ hasbeen configured, which can be used to start an automatic message simulationfunction which generates a message every 10 seconds.

Page 190: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���SLFWXB�� �����

3-112 WinCC Configuration ManualC79000-G8276-C140-01

Project function AlarmPictureChange

void AlarmPictureChange(char* lpszPicture){SetPictureName("pictu_3_chapter_10","Picture Window1", lpszPicture);}

• Calling the 6HW3LFWXUH1DPH function with a preset name for the picture name andpicture window name. The name of the picture that is to be displayed in the 3LFWXUH:LQGRZ is the transfer parameter.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made before this button can be put to general use:

• The tag names and message texts must be adapted.

• The color coding of the message types must be adapted to suit your own needs.

Page 191: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-1C79000-G8276-C140-01

��$GGLWLRQDO�)XQFWLRQV�LQ�:LQ&&��3URMHFW�H[DPSOHB���PFS�

This project presents examples to the 7DJ�/RJJLQJ, $ODUP�/RJJLQJ and 5HSRUW�'HVLJQHUeditors.

The examples to this subject are configured in the H[DPSOHB�� WinCC project.

Page 192: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-2 WinCC Configuration ManualC79000-G8276-C140-01

���� 7DJ�/RJJLQJ

In runtime, the examples can be selected by clicking on the button displayed above with the

8. The examples are configured in the pictures H[B�BFKDSWHUB���3'/ toH[B�BFKDSWHUB��I�3'/.

*HQHUDO�,QIRUPDWLRQ

7DJ�/RJJLQJ contains functions for the transfer of data from external and internal WinCCtags. This data can be archived in several ways. In runtime, the data can be displayed intrend or table form.

6LPXODWLRQ�RI�3URFHVV�9DOXHV

For the simulation of process values that are archived by 7DJ�/RJJLQJ in the exampleproject, a project-internal simulator is available. This simulator is activated by clicking onthe corresponding button on the toolbar.

The simulator enables you to supply three distinct internal tags with sinus wave profiles. Anadditional tag is supplied with the sum of the individual tag values. The profiles of the tagvalues are displayed in a small trend window.

Below the trend window are three lines consisting of input and output elements. Each of thelines corresponds to a trend profile.The first I/O field allows you to change the amplitude of a trend. The second I/O field setsthe frequency of the trend in oscillations per minute. Check boxes allow you to stop eachtrend simulation. The last I/O field displays the current trend amplitude.The tags *��BH[BWOJB��,�*��BH[BWOJB�� and *��BH[BWOJB�� are supplied with values. Thetag *��LBH[BWOJB�� is supplied with the sum of these three tags. If the simulator isdeactivated, all tag values will be set to zero again.

Page 193: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-3C79000-G8276-C140-01

������ &\FOLF�&RQWLQXRXV�$UFKLYLQJ��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

Process values are to be stored continuously in an archive. The stored data is to bedisplayed graphically in a trend window. The trend window’s toolbar and status bar arerealized using standard tools. As an authorized user, the online configuration should bepossible.The example uses FRQWUROOHU as user name and WDJORJJLQJ as password.

,PSOHPHQWDWLRQ�&RQFHSW

To archive the displayed data, create a cyclic-continuous process value archive in the 7DJ/RJJLQJ editor.To realize a graphical display, an DSSOLFDWLRQ�ZLQGRZ for displaying a trend window isused. The WUHQG�ZLQGRZ�WHPSODWH is created in the 7DJ�/RJJLQJ editor.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 Creation of the tags to be archived in "Tag Management". In the example, thetags *��BH[BWOJB��,�*��BH[BWOJB�� and *��BH[BWOJB�� are archived. These tagsare supplied with values by the simulator.

2 In the &RQWURO�&HQWHU, open the 7DJ�/RJJLQJ editor via a 85.

3 Creating a new archive. Start the ArchiveWizard via $UFKLYHV 85.

Conclude the first page of the Wizard by clicking on 1H[W.

On the second page, select the 3URFHVV�9DOXH�$UFKLYH as the DUFKLYH�W\SH andname it. In the example, the archive was named =.B3URFHVV9DOXH$UFKLYHB��.Proceed to the next page by clicking on 1H[W.

On the third page, set the tags to be archived via the button. In theexample, the tags *��BH[BWOJB��,�*��BH[BWOJB�� and *��BH[BWOJB�� were

Page 194: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-4 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

selected. Close the page by clicking on )LQLVK.

4 The right window will display the entry of the newly created archive. Open the

properties dialog box of the archive by 85 on this entry.

5 In the *HQHUDO�,QIRUPDWLRQ tab, basic archive parameters can be changed. TheDUFKLYH�QDPH and the DUFKLYH�W\SH have already been set by the Wizard. TheDUFKLYH�W\SH�can not be changed again.

The $UFKLYLQJ�DW�6\VWHP�6WDUW box is HQDEOHG. In the $XWKRUL]DWLRQ�/HYHO box, 1R$FFHVV�3URWHFWLRQ has been set for both access types. This automatically starts thearchiving when the system is started and no separate function is needed to enablethe archive. The data itself can be used by any user and is not subject to specialaccess protection.

No special action is executed while the archive starts. A special action, forexample, could inform you about the status of an archive.

Page 195: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-5C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6 Additional properties are set in the $UFKLYH�3DUDPHWHUV tab.

Set ���� as the number of data records. As the 0HPRU\�/RFDWLRQ, select 2Q�WKHKDUG�GLVN. A function can be set as the $FWLRQ�IRU�H[SRUWLQJ�WKH�VKRUW�WHUPDUFKLYH that is, executed automatically whenever the short-term archive is full. Inthe example, however, no action is planned. Select 6KRUW�WHUP�DUFKLYH as the$UFKLYH�7\SH.

With these settings, 1000 data records are archived to the hard drive. Once thismaximum number of data records has been reached, the oldest archive entries arereplaced by the new ones.

Close the properties dialog box by clicking on 2..

7 85 on the table window to open the properties dialog box of the selectedarchive tag.

8 In the $UFKLYH�7DJ tab, the basic properties of the tag can be set. The process taghas already been set in the Wizard. You can assign a unique name as the 1DPH�RIWKH�$UFKLYH�7DJ, in the example, the name of the corresponding process tag is

Page 196: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-6 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

used.

In the 6XSSO\LQJ�7DJV box, 6\VWHP has been selected and the $UFKLYLQJ�DW�6\VWHP6WDUW has been HQDEOHG. &\FOLF�&RQWLQXRXV has been set as the $UFKLYLQJ�7\SH.These settings define that the acquisition of data is started together with thesystem and performed in constant time cycles until the system is shut down.

Additionally, the archived value is not to written to any tag.

9 In the 3DUDPHWHUV tab, additional settings are made.

In the &\FOH box, set ����PV as the $FTXLVLWLRQ cycle and � ����PV as the$UFKLYLQJ cycle. Set the $FWXDO�YDOXH in the 3URFHVVLQJ box.

8QLW will not be selected. "Last Value" is to be saved on error. $UFKLYH�XSRQFKDQJH is not selected.

Page 197: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-7C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

10 In the 'LVSOD\ tab, the transfer range of the tag into the archive is set. In theexample, 1R�'LVSOD\�/LPLWDWLRQ is set.

11 In the (YHQWV tab, the example uses no action in the '\QDPLF box to change thearchiving cycle.

12 The settings made have to be incorporated into the two other archive tags. To doso, carry out step 7 to 11 for each of the two archive tags.

1RWH�The presettings made by the Archive Wizard for the process value archive and the archivetags can be changed via $UFKLYHV�→3UHVHWWLQJV�→�3URFHVV�$UFKLYH and $UFKLYHV�→3UHVHWWLQJV�→�$QDORJ�7DJ.

This is advantageous, if a large number of similar archives have to be created.

Page 198: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-8 WinCC Configuration ManualC79000-G8276-C140-01

7UHQG�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

1 Create a new trend window template by 85 on the corresponding entry in thenavigation window of the 7DJ�/RJJLQJ editor.

2 The 3URSHUWLHV���7UHQG�:LQGRZ�7HPSODWH dialog box will be displayed. The

button opens the 3URSHUWLHV�RI�WKH�7HPSODWH dialog box. Generalsettings for the entire template are made in this dialog.

As the 1DPH�RI�WKH�7HPSODWH, the example uses =.B3$B7UHQGWHPSODWHB��. Inthe 'LVSOD\ box, select the 6WDWXV�%DU, a 7LWOH�%DU is not needed.

In the 7RROEDU box, the toolbar can be adapted to your needs via the

button. In the example, the $OO�NH\ERDUG�)XQFWLRQV check-box has been selected.

Data is to be read from the archive immediately when the SLFWXUH�LV�RSHQHG. Asthe &RORU, the background color of the picture is set (RGB Value 231/207/199).Apply the settings made by clicking on the 2. button.

3 In the 2SHUDWRU�$XWKRUL]DWLRQ box, you can determine, if a change in theconfiguration data is possible in runtime.

Page 199: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-9C79000-G8276-C140-01

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

The 3HUVLVWHQW�LQ�57 check-box allows you to determine, if setting changes madein runtime are to be maintained after a picture change. The 3HUVLVWHQW�LQ�57�DQG&6 check-box gives the user the possibility to permanently change theconfiguration data in runtime.

The button assigns authorization levels to the functions that only allowauthorized users to make setting changes.

In the example, the 3HUVLVWHQW�LQ�57�DQG�&6 function has been associated with the(GLW�7UHQG�7HPSODWH authorization level. This authorization level must first becreated in the 8VHU$GPLQLVWUDWRU editor and be assigned to an user.

4The button allows you to add two additional trends. The names of thesetrends are displayed in the &KRRVH�2EMHFW box.

5 Select the first trend from the &KRRVH�2EMHFW box.

In the *HQHUDO�,QIRUPDWLRQ tab, the general trend properties are set. In theexample, 7UHQG� is used as the 1DPH�RI�WKH�7UHQG�. In the 'LVSOD\ box, selectthe check-boxes 'LVSOD\�7UHQG, 6KDUHG�;�$[LV and 6KDUHG�<�$[LV. Set 5HG as thetrend color.

Page 200: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-10 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

6 In the 7DJ tab, the archive tag displayed by the trend is selected. In the example,the *��BH[BWOJB�� tag from the =.B3URFHVV9DOXH$UFKLYHB�� archive is used.

7 In the ;�$[LV tab, the properties of the time axis are set.

Enter 7LPH as the /DEHO of the axis.

Select the 8SGDWH check-box from the 6FDOLQJ box. This determines that the trend

Page 201: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-11C79000-G8276-C140-01

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

is displayed dynamically. The end time of the trend display corresponds to thearchiving time of the last archived data record. Newly collected tag values areimmediately incorporated into the display.

Select the 7LPH5DQJH check-box and the ��0LQXWH entry from the list-box. Nochanges are needed for the date of the )URP range. These settings determine that,in runtime, the endpoint of the displayed time range is always one minute inaddition to the current time.

If the 7LPH5DQJH check-box is not selected, the displayed time range isdetermined by the time difference resulting from the IURP and WR dates. However,this is only the case if the 8SGDWH check-box has been selected.

8 In the <�$[LV tab, the properties of the Y-Axis are set.

Enter 7DJ9DOXH as the /DEHO of the axis. In the 'LVSOD\ field, no grid lines areshown is set. In the 6HOHFWLRQ field, ��� is entered as the 6WDUW value and �� as the(QG value. Both input fields only become visible, if the $XWRUDQJH check-box isnot selected. Select &RQQHFW�'RWV�OLQHDUO\�as the 7UHQG�'LVSOD\.

Page 202: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-12 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

9 For this example, filling out the &RORU�/LPLW�9DOXHV tab is not necessary. Thesetting options of this tab are described in the example ������$UFKLYLQJ�LI�9DOXH�LV([FHHGHG��H[B�BFKDSWHUB��E�3'/� in the table 7UHQG�'LVSOD\�&RQILJXUDWLRQ.

10 Carry out step 5 to 8 for the two other trends. Since shared X and Y axes havebeen selected, the corresponding tabs do not have to be filled out, again.However, the 7UHQG�'LVSOD\ property is an exception to this.

The trend color, as well as the archive tag to be displayed, must be changedcorrespondingly.

Apply the settings made by clicking on 2. and save the changes made in the 7DJ/RJJLQJ editor via )LOH�→�6DYH.

1RWH�In the example project, the password protected online configuration, configured in step 3,can be accessed via the login name FRQWUROOHU and the password 7DJ�/RJJLQJ. A new userlogging in is only recognized by 7DJ�/RJJLQJ after a new picture has been selected. Theprocedures for setting up a new user and new authorization levels are explained in thecorresponding chapters of the manual ����6KXWGRZQ�:LQ&&���DFFHVV�SURWHFWLRQ.The "Login" dialog box is opened via the [Ctrl+O] key combination. This key combinationcan be set in the +RW.H\V tab of the project’s properties dialog box.

Page 203: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-13C79000-G8276-C140-01

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB���3'/.

In this picture, a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ is configured. In theexample, the $SSOLFDWLRQ�:LQGRZ� object is used. After placing the object in thepicture, the :LQGRZ�&RQWHQWV dialog box is displayed. Select the 7DJ�/RJJLQJentry. Close the dialog box by clicking on 2..

In the following 7HPSODWH dialog box, select =.B3$B7UHQGWHPSODWHB�� trendwindow template. Close the dialog box by clicking on 2..

In the Graphics Designer, the configured $SSOLFDWLRQ�:LQGRZ will be displayedas a gray rectangle. The rectangle will be labeled with the name of the selectedtrend window template.

2 In the example, a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ is placed below the $SSOLFDWLRQ:LQGRZ. It is the 6WDWXV�'LVSOD\� object.

It displays a picture of an inactive ruler window. A status display is used becausethe displayed picture has to be switched dependent on the set runtime language.The position of the 6WDWXV�'LVSOD\ has been selected in such a way that it will be

covered up by the ruler window, if the ruler button is pressed in runtime.This creates the impression the displayed output fields of the 6WDWXV�'LVSOD\ are

Page 204: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-14 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

supplied with values.

3 To be able to use 7DJ�/RJJLQJ during runtime, 7DJ�/RJJLQJ�5XQWLPH must beenabled first. To do so, check "Tag Logging Runtime" in the "Startup" tab of the&RPSXWHU�3URSHUWLHV dialog box.

If this is not the case, select the "Computer" entry in the &RQWURO�&HQWHU via a 8

and open the &RPSXWHU�3URSHUWLHV�6WDUWXS�7DE by clicking on the button

from the dialog’s toolbar. Click on the button to open the&RPSXWHU�3URSHUWLHV dialog box. In the 6WDUWXS tab, select the 7DJ�/RJJLQJ5XQWLPH check-box.

1RWH�In runtime, the ruler window will be displayed just below the configured DSSOLFDWLRQZLQGRZ. The lower left corner of the DSSOLFDWLRQ�ZLQGRZ will correspond to the upper leftcorner of the ruler window. The width of these two windows is identical.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The tags to be archived have to be adapted to your requirements.

• The fast archiving cycle selected in the example only makes sense, if fast changingvalues are to be displayed. In normal cases, slower cycles are sufficient. Fast archivingcycles cause high system loads.

• Adapt the elements of the toolbar to your own needs. This depends on the extent ofinfluence the user is going to have on the trend display and how much information fromthe archive is needed.

Page 205: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-15C79000-G8276-C140-01

������ &\FOLF�6HOHFWLYH�$UFKLYLQJ��H[B�BFKDSWHUB��D�3'/�

7DVN�'HILQLWLRQ

Multiple process values are to be stored continuously in an archive. In runtime, thearchiving is started and stopped via a button.The values are to be graphically displayed in a trend window. The toolbar and status bar isconfigured in the *UDSKLFV�'HVLJQHU using your own objects. One diagram is to bedisplayed for each process value.

Page 206: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-16 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWDWLRQ�&RQFHSW

To archive the data to be displayed, a cyclic-selective process value archive is created in the7DJ�/RJJLQJ editor.To realize a graphical display, an DSSOLFDWLRQ�ZLQGRZ for displaying a trend window isused. This is created in the 7DJ�/RJJLQJ editor. The required toolbar is made up of multiple:LQGRZV�2EMHFWV�→�%XWWRQ, 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\V and 6PDUW�2EMHFWV�→*UDSKLF�2EMHFWV, the status bar is realized with two :LQGRZV�2EMHFWV�→�%XWWRQ.To control the archive, a project function is needed that starts and stops the archivingprocess.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 Open the 7DJ�/RJJLQJ editor from the &RQWURO�&HQWHU.

Create a new 3URFHVV�9DOXH�$UFKLYH with the archive wizard. In the example, thearchive was named =6B3URFHVV9DOXH$UFKLYHB��.

For the archiving, the tags *��BH[BWOJB��,�*��BH[BWOJB�� and *��BH[BWOJB��are selected.

2 In the properties dialog box of the process value archive, set the size of thearchive to ���� data records. Accept the presettings for the remaining settings.

3 In the properties dialog box of the process tag, select F\FOLF�VHOHFWLYH as $UFKLYLQJ7\SH for each of the three tags. This gives you the option of setting a 6WDUW�(YHQW,as well as a 6WRS�(YHQW, in the (YHQWV tab. In the example, the project function=6B3$B6WDUW is set as the 6WDUW�(YHQW.

In the &\FOH field, enter ����PV as the $FTXLVLWLRQ cycle and � ����PV as the$UFKLYLQJ cycle. Accept the presettings for the remaining settings.

Project Function ZS_PA_Start

BOOL ZS_PA_Start(){

if (GetTagBit("BINi_ex_tlg_00"))return TRUE;

else return FALSE;

}

• The function supplies the value TRUE or FALSE depending on the status of the internaltag %,1LBH[BWOJB��.

• This function is called by 7DJ�/RJJLQJ for every archiving cycle. It determines, via thereturn value, if archiving takes place or not (TRUE = archive).

Page 207: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-17C79000-G8276-C140-01

7UHQG�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

1 Creating a new trend window template. The 3URSHUWLHV���7UHQG�:LQGRZ�7HPSODWHdialog box will be displayed.

2The button opens the 3URSHUWLHV�RI�WKH�7HPSODWH dialog box.

As the template name, the example uses =6B3$B7UHQGWHPSODWHB��. No WLWOH�EDU,VWDWXV�EDU or WRROEDU is required.

As the &RORU, the example uses the background color of the picture (RGB Value231/207/199). Accept the presettings for the remaining settings.

3 No inputs need to be made in the 2SHUDWRU�$XWKRUL]DWLRQ field.

4The button allows you to add two additional trends. The trends will then bedisplayed in the &KRRVH�2EMHFW window.

Select the first trend.

In the *HQHUDO�,QIRUPDWLRQ tab, 7UHQG� is displayed as the 1DPH�RI�WKH�7UHQG. Inthe 'LVSOD\ field, select the 'LVSOD\�7UHQG and 'LVSOD\�7UHQGV�6WDJJHUHG check-boxes. This determines that a separate graph is drawn for each trend. Thepresettings can be accepted for the remaining settings.

In the 7DJ tab, the *��BH[BWOJB�� archive tag from the=6B3URFHVV9DOXH$UFKLYHB�� archive is selected.

The presettings can be accepted in the ;�$[LV tab.

In the <�$[LV tab, use the trend name as the /DEHO. In the 6HOHFWLRQ field, select the$XWRUDQJH check-box. Enter ��� as the 6WDUW and �� as the (QG value. As the7UHQG�'LVSOD\, select 6KRZ�RQO\�GRWV. This type of display facilitates therecognition of time periods where no archiving took place.

Accept the presettings of the &RORU�/LPLW�9DOXHV tab.

5 Follow these steps for the two other trends (steps 5 - 8). The archive tag to bedisplayed must be changed correspondingly, as well as the names and labels ofthe trends.

Click on 2. to apply all the settings made. Save the changes made in the 7DJ/RJJLQJ editor via )LOH�→�6DYH.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 In Tag Management, two internal tags of the %LQDU\�7DJ type are created. In theexample, the %,1LBH[BWOJB�� and %,1LBH[BWOJB�� tags are used.

2 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB��D�3'/.

In this picture, a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ is configured. Select 7DJ/RJJLQJ as the window content and the =6B3$B7UHQGWHPSODWHB�� trend windowtemplate as the 7HPSODWH.

3 To control the update, a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ is configured. In theexample, this is the 6WDWXV�'LVSOD\� object.

Via the 6WDWXV�'LVSOD\�&RQILJXUDWLRQ dialog box, this object is connected to the%,1LBH[BWOJB�� tag and triggered upon change. The states � and � are created andassigned to the corresponding pictures. In the example, the bitmaps VWRS�WOJ�EPS

Page 208: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-18 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

and VWRS�JR�WOJ�EPS are used.

A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which simulates the

pressing of the button from the standard toolbar and toggles the status of the%,1LBH[BWOJB�� tag.

The status of this tag should always be zero at the opening of the picture, sincethe update of the trend window is always initiated at the selection of the picture.This is realized by a 'LUHFW�&RQQHFWLRQ at (YHQWV�→�0LVFHOODQHRXV�→�2SHQ3LFWXUH of the H[B�BFKDSWHUB��D�3'/ picture object, which sets the status of thetag to �.

4 Configure a second 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ following the proceduredescribed in step 3. In the example, this is the 6WDWXV�'LVSOD\� object. It willcontrol the archiving process.

The object is connected to the %,1LBH[BWOJB�� tag and uses the $UFKLYH�EPS /$UFKLYH�LQY�EPS bitmaps.

A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which toggles the%,1LBH[BWOJB�� tag queried by the =6B3$B6WDUW project function.

5 To be able to navigate in the archive while the update is stopped, replicas of thefour navigation buttons of the standard toolbar are required.

To implement this, four :LQGRZV�2EMHFW�→�%XWWRQV are configured. In theexample, these are the %XWWRQ�, %XWWRQ�, %XWWRQ� and %XWWRQ�� objects.

&�$FWLRQV are created at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which simulate theactivation of the standard buttons.

Additionally, a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW is required that disables thebuttons in case of an active update. In the example, this is the *UDSKLF�2EMHFW�object. The bitmap displayed by the object shows the four buttons in aninoperational state (3IHLOH�GLV�EPS). Create a '\QDPLF�'LDORJ at 3URSHUWLHV�→

Page 209: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-19C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

0LVFHOODQHRXV�→�'LVSOD\, which controls the visibility of the buttons dependingon the status of the %,1LBH[BWOJB�� tag (this tag contains information about theupdate).

6 To display the status bar, two :LQGRZV�2EMHFWV�→�%XWWRQV are configured. In theexample, these are the %XWWRQ� and %XWWRQ� objects.

%XWWRQV are used for the text display because it is easy to add 3D borders (noadditional objects are required for generating the button border).

Create a '\QDPLF�'LDORJ at the %XWWRQ� object at 3URSHUWLHV�→�)RQW�→�7H[W,which returns to the property, depending on the %,1LBH[BWOJB�� tag, either thetext $UFKLYLQJ�6WDUWHG or $UFKLYLQJ�6WRSSHG.

Perform the same steps for %XWWRQ� using the %,1LBH[BWOJB�� tag.

1RWH�

The implementation of the buttons for time selection and print preview are explained ingreater detail in the 5HSRUW�'HVLJQHU chapter, example ������3ULQW�2XW�WKH�7UHQG�:LQGRZLQ�5XQWLPH��H[B�BFKDSWHUB��D�3'/�.

C-Action for Status Display5

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){

TlgTrendWindowPressStartStopButton("ZS_PA_Trendtemplate_00");

SetTagBit("BINi_ex_tlg_06",(SHORT)!GetTagBit("BINi_ex_tlg_06"));

}

• Calling the standard function 7OJ7UHQG:LQGRZ3UHVV6WDUW6WRS%XWWRQ has the same effectas clicking on the 6WRS�*R�%XWWRQ of the standard toolbar. The transfer parameterindicates the name of the template to which the function call is referring to.

• Toggles the %,1LBH[BWOJB�� tag to save the current status of the template.

Page 210: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-20 WinCC Configuration ManualC79000-G8276-C140-01

C-Action at Button4

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

TlgTrendWindowPressFirstButton("ZS_PA_Trendtemplate_00");

}

• Calling this standard function has the same effect as clicking on the )LUVW�'DWD�5HFRUGbutton of the standard toolbar. The functions used at the other buttons are:

• 7OJ7UHQG:LQGRZ3UHVV3UHY%XWWRQ

• 7OJ7UHQG:LQGRZ3UHVV1H[W%XWWRQ

• 7OJ7UHQG:LQGRZ3UHVV/DVW%XWWRQ

1RWH�For each button of the standard toolbar there exists a corresponding standard function,which simulates the activation of that button. A detailed description of all functions can befound in the manual of the *OREDO�6FULSW editor.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The tags to be archived have to be adapted to your requirements.

• The fast archiving cycle selected in the example only makes sense, if fast changingvalues are to be displayed. In normal cases, slower cycles are sufficient. Fast archivingcycles cause high system loads.

• The archiving start, as well as the archiving end, can be made dependent on specialevents, which can be something other than the activation of a button.

• The appearance and required elements of the toolbar should be tailored to meet yourneeds. The same applies for the status bar.

• The trend display type selected enhances the visibility of time ranges, during which noarchiving took place. In any other display type, all dots are shown connected to eachother; even ranges where no archiving took place are bridged by a line.

Page 211: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-21C79000-G8276-C140-01

������ $UFKLYLQJ�LI�9DOXH�LV�([FHHGHG��H[B�BFKDSWHUB��E�3'/�

7DVN�'HILQLWLRQ

A process value is to be stored once in the archive at the time of exceeding a set limit value.The stored values are to be displayed in a table. The progress of the process value is to bedisplayed as a trend.The table content should only be displayed if the user has the appropriate authorizationlevel. The option of entering values directly into the table should also be authorizationprotected. The "System Login" dialog box should be accessible by a button. The exampleuses FRQWUROOHU and XVHU as the user names, and WDJORJJLQJ as the password.The toolbar and status must first be created in the *UDSKLFV�'HVLJQHU. The status bar shouldcontain the name of the currently logged in user.

,PSOHPHQWDWLRQ�&RQFHSW

To archive the displayed data, create an acyclic process value archive in the 7DJ�/RJJLQJeditor.To implement the graphical display, two DSSOLFDWLRQ�ZLQGRZV are used. One displays thetrend and the other the table window. The WUHQG�ZLQGRZ�WHPSODWH and the WDEOH�ZLQGRZWHPSODWH to be displayed are created in the 7DJ�/RJJLQJ editor.The required toolbar is made up of multiple :LQGRZV�2EMHFWV�→�%XWWRQ, 6PDUW�2EMHFWV�→6WDWXV�'LVSOD\V and 6PDUW�2EMHFWV�→�*UDSKLF�2EMHFWV, the status bar is realized using two:LQGRZV�2EMHFWV�→�%XWWRQ.To control the archive, a project function is created. This function triggers the archiving ifthe process value exceeds a set limit value.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 Create a new 3URFHVV�9DOXH�$UFKLYH with the archive wizard. In the example, thearchive was named $=B3URFHVV9DOXH$UFKLYHB��.

The tag to be archived was *��LBH[BWOJB��. In the example project, this tag issupplied with the sum of the three sinus wave profiles by the simulator.

2 In the properties dialog box of the process value archive, set the size of thearchive to �� data records. As DXWKRUL]DWLRQ�OHYHO for read and write access, settwo levels which must first be created in the 8VHU�$GPLQLVWUDWRU editor.

Accept the presettings for the remaining settings.

3 In the properties dialog box of the process tag, select DF\FOLF as the $UFKLYLQJ7\SH. This gives you the option of setting a 6WDUW�(YHQW in the (YHQWV tab. In theexample, the project function $UFKLYH&RQWURO is set as the 6WDUW�(YHQW.

Accept the presettings for the remaining settings.

Page 212: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-22 WinCC Configuration ManualC79000-G8276-C140-01

"ArchiveControl" Project Function

BOOL ArchiveControl(){

#define TAG_LIMIT 55

static BOOL state = FALSE;static BOOL overflow = FALSE;double value;

value = GetTagDouble("G64i_ex_tlg_04");

if (value<=TAG_LIMIT) overflow=FALSE;

if ((value>TAG_LIMIT)&&(overflow==FALSE)){

state=!state;overflow=TRUE;

}

return state;

}

• The tag to be archived is read. In an LI structure, the value overflow flag RYHUIORZ isreset, if the tag value is below the limit value.

• If the value is exceeded and the previous function call did not detect a value overflow,the status of the return value will be negated and the value overflow flag RYHUIORZ beset.

• This function is automatically invoked by 7DJ�/RJJLQJ. Archiving is performed if WKHUHWXUQ�YDOXH�VWDWXV�RI�WKH�IXQFWLRQ�GLIIHUV�IURP�WKH�SUHYLRXV�FDOO� (on the other hand,in a cyclic-selective archive, the archiving is started if the return value is TRUE).

7DEOH�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7DEOH�'LVSOD\�&RQILJXUDWLRQ

1 Create a new table window template by 85 on the corresponding entry in thenavigation window of the 7DJ�/RJJLQJ editor.

2 The 3URSHUWLHV���7DEOH�:LQGRZ�7HPSODWH dialog box will be displayed. The

button opens the 3URSHUWLHV�RI�WKH�7HPSODWH dialog box.

As the template name, the example uses $=B3$B7DEOHWHPSODWH. No WLWOH�EDU,VWDWXV�EDU or WRROEDU is required.

As the &RORU, the example uses the background color of the picture (RGB Value231/207/199). Accept the presettings for the remaining settings.

Page 213: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-23C79000-G8276-C140-01

6WHS 3URFHGXUH��7DEOH�'LVSOD\�&RQILJXUDWLRQ

3 No inputs need to be made in the 2SHUDWRU�$XWKRUL]DWLRQ field.

4 In the *HQHUDO�,QIRUPDWLRQ tab, &ROXPQ� is displayed as the &ROXPQ�+HDGLQJ. Inthe 'LVSOD\ field, select the &ROXPQ�FDQ�EH�HGLWHG and 6KDUH�FROXPQ check-boxes. The presettings can be accepted for the remaining settings.

5 In the 7DJ tab, the *��LBH[BWOJB�� archive tag from the$=B3URFHVV9DOXH$UFKLYHB�� archive is selected.

6 Click on 2. to apply all the settings made.

Page 214: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-24 WinCC Configuration ManualC79000-G8276-C140-01

7UHQG�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

1 For the *��LBH[BWOJB�� tag, create a cyclic-continuous process value archivewith 120 data records and an archiving cycle of 500 ms.

In the example, this is the =6B3URFHVV9DOXH$UFKLYHB�� archive.

2 Creating a new trend window template. The 3URSHUWLHV���7UHQG�:LQGRZ�7HPSODWHdialog box will be displayed.

3The button opens the 3URSHUWLHV�RI�WKH�7HPSODWH dialog box.

As the template name, the example uses =.B3$B7UHQGWHPSODWHB��. No WLWOH�EDU,VWDWXV�EDU or WRROEDU is required.

As the &RORU, the example uses the background color of the picture (RGB Value231/207/199). Accept the presettings for the remaining settings.

4 No inputs need to be made in the 2SHUDWRU�$XWKRUL]DWLRQ field.

5 In the *HQHUDO�,QIRUPDWLRQ tab, 7UHQG� is displayed as the 1DPH�RI�WKH�7UHQG. Inthe 'LVSOD\ field, select the 'LVSOD\�WUHQG check-box. Choose blue as the color ofthe trend.

In the 7DJ tab, the *��LBH[BWOJB�� archive tag from the=.B3URFHVV9DOXH$UFKLYHB�� archive is selected.

The presettings can be accepted in the ;�$[LV tab.

In the 6HOHFWLRQ field of the <�$[LV tab, deselect the $XWRUDQJH check-box. Enter ���� as the 6WDUW and ��� as the (QG value. As the 7UHQG�'LVSOD\, select )LOO�DUHDLQWHUSRODWHG�WUHQG. This display type allows you to better emphasize areas, wherevalue overflows have occurred. Accept the presettings for the remaining settings.

In the &RORU�/LPLW�9DOXHV tab, set �� as the upper limit value. Select the color red.This will display in red all parts of the trend which have exceeded the value of55. Accept the presettings for the remaining settings.

Page 215: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-25C79000-G8276-C140-01

6WHS 3URFHGXUH��7UHQG�'LVSOD\�&RQILJXUDWLRQ

6 Click on 2. to apply all the settings made. Save the changes made in the 7DJ/RJJLQJ editor via )LOH�→�6DYH.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 In Tag Management, two internal tags of the %LQDU\�7DJ type are created. In theexample, the %,1LBH[BWOJB�� and %,1LBH[BWOJB�� tags are used. Additionally, the#&XUUHQW8VHU tag of the type 7H[W�7DJ����%LW�&KDUDFWHU�6HW, with a length of ��characters, is required. This tag is automatically supplied with the current username by the system.

2 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB��E�3'/.

In this picture, a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ is configured. In theexample, this is the $SSOLFDWLRQ�:LQGRZ� object. Select 7DJ�/RJJLQJ as thewindow content and the $=B3$B7DEOHWHPSODWH as the 7HPSODWH.

3 To control the update, a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ is configured. In theexample, this is the 6WDWXV�'LVSOD\� object.

Via the &RQILJXUDWLRQ�'LDORJ�%R[, this object is connected to the %,1LBH[BWOJB��tag and triggered upon change. The states � and � are created and assigned to thecorresponding pictures. In the example, the bitmaps VWRS�WOJ�EPS and VWRS�JRWOJ�EPS are used.

A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which simulates the

pressing of the button from the standard toolbar and toggles the status of the%,1LBH[BWOJB�� tag.

The status of this tag should always be zero at the opening of the picture, since

Page 216: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-26 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

the update of the table window is always initiated at the selection of the picture.This is realized by a &�$FWLRQ at (YHQWV�→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH of theH[B�BFKDSWHUB��E�3'/ picture object, which sets the status of the tag to �.

4 Configure a second 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ following the proceduredescribed in step 3. In the example, this is the 6WDWXV�'LVSOD\� object. This objectcontrols the editability of the table.

The object is connected to the %,1LBH[BWOJB�� tag and uses the (GLW�EPS / (GLWLQY�EPS bitmaps.

A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which simulates the

pressing of the edit button from the standard toolbar and toggles the status ofthe %,1LBH[BWOJB�� tag.

Via 3URSHUWLHV�→�0LVFHOODQHRXV�→�3DVVZRUG, set the same authorization levelfor the %XWWRQ as for the archive’s write access. In the example, this is the (GLW7DEOH authorization level.

The status of the %,1LBH[BWOJB�� tag should always be zero at the opening of thepicture, since the editability of the table windows is always turned off at theselection of the picture. This is realized by expanding the &�$FWLRQ at (YHQWV�→0LVFHOODQHRXV�→�2SHQ�3LFWXUH of the H[B�BFKDSWHUB��E�3'/ picture object.Add a statement that sets the status of the tag to �.

5 To be able to navigate in the archive while the update is stopped and theeditability is active, replicas of the four navigation buttons of the standard toolbarare required.

To implement this, four :LQGRZV�2EMHFW�→�%XWWRQV are configured. In theexample, these are the %XWWRQ�, %XWWRQ�, %XWWRQ� and %XWWRQ�� objects.

&�$FWLRQV are created at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which simulate theactivation of the standard buttons.

Additionally, a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW is required that disables thebuttons in case of an active update and active editability. In the example, this isthe *UDSKLF�2EMHFW� object. The bitmap displayed by the object shows the fourbuttons in an inoperational state (3IHLOH�GLV�EPS). Create a '\QDPLF�'LDORJ at3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\, which controls the visibility of thebuttons depending on the states of the %,1LBH[BWOJB�� and %,1LBH[BWOJB�� tags.

6 An additional 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW is needed that disables the buttonfor controlling the update while editability is active. In the example, this is the*UDSKLF�2EMHFW� object. Create a '\QDPLF�'LDORJ at 3URSHUWLHV�→0LVFHOODQHRXV�→�'LVSOD\, which makes the object visible if the %,1LBH[BWOJB��tag receives the status 758(.

In the example, the picture to be displayed is the VWRS�GLV�WOJ�EPS. The objectmust be positioned exactly on top of the 6WDWXV�'LVSOD\� object.

7 Configure two additional :LQGRZV�2EMHFWV�→�%XWWRQV that take on the function

of the buttons for opening the parameter and the 6HOHFW�7LPH�5DQJH dialog boxes. In the example, these are the %XWWRQ�� and %XWWRQ�� objects.

8 Configure an additional :LQGRZV�2EMHFW�→�%XWWRQ. In the example, this is the

Page 217: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-27C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

%XWWRQ� object. This button accesses the 6\VWHP�/RJLQ dialog box. To do so,create a &�$FWLRQ at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which calls the required APIfunction.

9 To display the status bar, two :LQGRZV�2EMHFWV�→�%XWWRQV are configured. In theexample, these are the %XWWRQ� and %XWWRQ�� objects.

Create a '\QDPLF�'LDORJ at the %XWWRQ�� object at 3URSHUWLHV�→�)RQW�→�7H[W,which returns to the property, depending on the %,1LBH[BWOJB�� tag, either thetext 8SGDWH�6WDUWHG or 8SGDWH�6WRSSHG.

At %XWWRQ� at 3URSHUWLHV�→�)RQW�→�7H[W, configure a WDJ�FRQQHFWLRQ to the#&XUUHQW8VHU tag and set the trigger to "upon change". Clicking on this buttondisplays the name of the current user.

10 Configure an additional 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ . In the example,this is the $SSOLFDWLRQ�:LQGRZ� object. Select 7DJ�/RJJLQJ as the windowcontent and the =.B3$B7UHQGWHPSODWHB��as the 7HPSODWH.

1RWH�The usage and changing of data is password protected. In the example project, access to thearchive data is gained via the login name XVHU and the password WDJORJJLQJ. Via the loginname FRQWUROOHU and the password WDJORJJLQJ, changes to the data can also be made.The procedures for setting up a new user and new authorization levels are explained in thecorresponding chapters of the configuration manual.

C-Action for Status Display2

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){

TlgTableWindowPressEditRecordButton("AZ_PA_Tabletemplate");

SetTagBit("BINi_ex_tlg_07",(SHORT)!GetTagBit("BINi_ex_tlg_07"));

}

• Calling the standard function 7OJ7UHQG:LQGRZ3UHVV(GLW%XWWRQ has the same effect asclicking on the (GLW�%XWWRQ of the standard toolbar. The transfer parameter indicates thename of the template to which the function call is referring to.

• Toggles the %,1LBH[BWOJB�� tag to save the current status of the edit function.

Page 218: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-28 WinCC Configuration ManualC79000-G8276-C140-01

C-Action at Button4

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

TlgTableWindowPressFirstButton("AZ_PA_Tabletemplate");

}

• Calling this standard function has the same effect as clicking on the )LUVW�'DWD�5HFRUGbutton of the standard toolbar. The functions used at the other buttons are:

• 7OJ7UHQG:LQGRZ3UHVV3UHY%XWWRQ

• 7OJ7UHQG:LQGRZ3UHVV1H[W%XWWRQ

• 7OJ7UHQG:LQGRZ3UHVV/DVW%XWWRQ

• 7OJ7DEOH:LQGRZ3UHVV2SHQ'OJ%XWWRQ

• 7OJ7DEOH:LQGRZ3UHVV2SHQ7LPH6HOHFW'OJ%XWWRQ

• 7OJ7DEOH:LQGRZ3UHVV6WDUW6WRS%XWWRQ

C-Action at Button5

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

#pragma code ("useadmin.dll")BOOL PWRTLogin(TCHAR);#pragma code ()

PWRTLogin(1);

}

• Integration of the DLL which contains the API function 3:57/RJLQ.

• Call of the API function for opening the 6\VWHP�/RJLQ dialog box.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The tags to be archived have to be adapted to your requirements.

• The event, on which the archiving is depending on, must be defined. A correspondingproject function has to be created.

• The appearance and required elements of the toolbar should be tailored to meet yourneeds. The same applies for the status bar.

Page 219: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-29C79000-G8276-C140-01

������ 8VHU�GHILQHG�WDEOH�OD\RXW��H[B�BFKDSWHUB��F�3'/�

7DVN�'HILQLWLRQ

A process value is to be acquired cyclically and its mean, maximum and minimum valuesare to be generated every 10 seconds. These values are to be stored in the configuredarchive.The stored values are to be displayed in a table. This table is created in the *UDSKLFV'HVLJQHU editor. A table has to be created in the Graphics Designer if the standard tools of7DJ�/RJJLQJ are insufficient to realize a table layout.

,PSOHPHQWDWLRQ�&RQFHSW

To archive the data, create a cyclic-continuous process value archive in the 7DJ�/RJJLQJeditor.To implement the graphical display, each line of the table uses, depending on the type ofdata to be displayed, either a 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W or a 6PDUW�2EMHFW�→�,�2�)LHOG.The data is read from the database table of the appropriate archive via API functions.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 In Tag Management, create three tags of the type )ORDWLQJ�3RLQW�1XPEHU����%LW,(((����. In the example, these are the *��LBH[BWOJB��, �*��LBH[BWOJB�� and*��LBH[BWOJB�� tags. The archived values are to be written into these tags (inaddition).

2 Create a new 3URFHVV�9DOXH�$UFKLYH with the archive wizard. In the example, thearchive was named =.B3URFHVV9DOXH$UFKLYHB��.

As the archiving tag, the *��LBH[BWOJB�� tag was selected three times.

3 In the properties dialog box of the process value archive, set the size of thearchive to ��� data records. Accept the presettings for the remaining settings.

4 In the *HQHUDO�,QIRUPDWLRQ tab of the first process tag’s properties dialog box,enter 0D[LPXP9DOXH as the 1DPH�RI�WKH�$UFKLYH�7DJ. In the $OVR�SXW�DUFKLYHGYDOXH�LQ�WDJ field, select the *��LBH[BWOJB�� tag. This tag allows you to react tothe archiving of a value with a &�$FWLRQ. This is accomplished, if the &�$FWLRQ istriggered upon the change of this tag.

In the &\FOH field of the 3DUDPHWHUV tab, set the $FTXLVLWLRQ to ����PV and the$UFKLYLQJ to �� ����PV. In the 3URFHVVLQJ field, select the 0D[LPXP�9DOXHcheck-box. This causes the selected tag to be acquired every 500ms and bearchived every 10s. The largest value is archived that occurred during the 10speriod.

Page 220: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-30 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

The presettings can be accepted for the remaining settings.

5 Carry out step 3 to 4 for the two other archive tags.

However, for 3URFHVVLQJ select 0LQLPXP�9DOXH and 0HDQ�9DOXH. The 1DPH�RIWKH�$UFKLYH�7DJ should reflect this selection.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 In Tag Management, two internal tags of the %LQDU\�7DJ type are created. In theexample, these are the %,1LBH[BWOJB�� and )/$*B7DEOH*HW2XWSXW9DOXH tags.

2 Create a project function which instructs 7DJ�/RJJLQJ to transfer data from thearchive to another function (callback function). This function is called once foreach data record and receives information about that data record in the form of aspecial structure type. The transferred data is stored in a static array of thisstructure type.

In the example, the (QXPHUDWH6XSHU$UFKLYH'DWD and *HW$UFKLYH'DWD&DOOEDFNfunctions are used.

This example uses two external C tags.

• extern int dwSize

• extern WORD wOffset

These tags must be set up while the project is started. To do so, a separate projectfunction is used. The call of this function is integrated into the &�$FWLRQ at (YHQWV→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH of the H[B�BVWDUWSLFWXUHB���3'/ start picture.In the example, this function is named &UHDWH([WHUQDO.

3 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB��E�3'/.

The user defined table should be able to display 10 lines. To display data in thefirst column, 10 (one for each line) 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[WV are used,which display the time and date. For the additional columns, 6PDUW�2EMHFWV�→,�2�)LHOGV are used.

As object names in the first column, use 6WDWLF�7H[W� to 6WDWLF�7H[W��, where thenumber defines the line. The numbering is from bottom to top, since the last linecontains the most current data.

The ,�2�)LHOGV use code numbers as their name. The first digit indicates thecolumn number, the following digit the line number.

Page 221: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-31C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

4 Create a &�$FWLRQ for each 6WDWLF�7H[W at 3URSHUWLHV�→�)RQW�→�7H[W. This actionreads, with respect to its own object number, the date to be displayed from thecallback function. This function is triggered upon the change of the)/$*B7DEOH*HW2XWSXW9DOXH tag. The status of this tag will be changed, if thearchive has received new data and this data has been read.

Corresponding to that, create a &�$FWLRQ for each ,�2�)LHOG at 3URSHUWLHV�→2XWSXW�,QSXW�→�2XWSXW�9DOXH. This function also has the task to read the datarecord, assigned to their object, from the callback function.

5 To control the update, a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ is configured. In theexample, this is the 6WDWXV�'LVSOD\� object.

Via the &RQILJXUDWLRQ dialog box, this object is connected to the %,1LBH[BWOJB��tag and triggered upon change. The states � and � are created and assigned to thecorresponding pictures. In the example, the bitmaps VWRS�WOJ�EPS and VWRS�JRWOJ�EPS are used.

Create a &�$FWLRQ at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which toggles the status ofthe %,1LBH[BWOJB��. The status 758( means that the update has been started.

The status of this tag should be 758( at the opening of the picture, since theupdate of the table window is always initiated at the selection of the picture. Thisis realized via a &�$FWLRQ at (YHQWV�→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH of theH[B�BFKDSWHUB��F�3'/ picture object. This &�$FWLRQ sets the status of the tag to758( and reads the archive one time.

6 Create a &�$FWLRQ for 6WDWXVGLVSOD\� at 3URSHUWLHV�→�*HRPHWU\�→�:LGWK. Thisaction will, depending on the status of the %,1LBH[BWOJB�� tag, read the archiveand toggle the )/$*B7DEOH*HW2XWSXW9DOXH tag to initiate the update of the table.The &�$FWLRQ is triggered upon the change of the *��LBH[BWOJB�� tag, in whichthis value will be stored (in addition) if a value is archived. It should also be ableto react to the next archiving, if the value archived is identical to the previousone. To do so, the *��LBH[BWOJB�� tag is set to a value, which can not be attained

Page 222: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-32 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

by the process value to be archived, after each pass of the &�$FWLRQ.

7 To be able to navigate in the archive while the update is stopped, four navigationbuttons are required.

To implement this, four :LQGRZV�2EMHFW�→�%XWWRQV are configured. In theexample, these are the %XWWRQ�, %XWWRQ��, %XWWRQ�� and %XWWRQ�� objects.

Create &�$FWLRQV at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ. These actions write anew value to the external C tag GZ2IIVHW. Additionally, the trigger tag)/$*B7DEOH*HW2XWSXW9DOXH is toggled to achieve an update of the display.

Also, a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW is required that disables the buttons incase of an active update. In the example, this is realized via the *UDSKLF�2EMHFW�object. The bitmap displayed by the object shows the four buttons in aninoperational state (3IHLOH�GLV�EPS). At 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\,create a WDJ�FRQQHFWLRQ to the %,1LBH[BWOJB�� tag and trigger it upon change.

Project Function for Reading the Archive

#include "apdefap.h"BOOL EnumerateSuperArchiveData(){extern DWORD dwSize;BOOL fRet;TLG_GETARCHIVEDATA GAD;CMN_ERROR Error;LPTSTR lpszArchiveName = "ZK_ProcessValueArchive_02";LPTSTR lpszVarName3 = "MaximumValue" ;LPTSTR lpszVarName2 = "MinimumValue" ;LPTSTR lpszVarName1 = "MeanValue" ;SYSTEMTIME sysFrom;SYSTEMTIME sysTo;time_t Time;struct tm* TimeStruct;

time(&Time);TimeStruct = localtime(&Time);

sysTo.wYear = (WORD)(TimeStruct->tm_year+1900);sysTo.wMonth = (WORD)(TimeStruct->tm_mon+1);sysTo.wDay = (WORD)(TimeStruct->tm_mday);sysTo.wHour = (WORD)(TimeStruct->tm_hour);sysTo.wMinute = (WORD)(TimeStruct->tm_min);sysTo.wSecond = (WORD)(TimeStruct->tm_sec);

sysFrom.wYear = 1997;sysFrom.wMonth = 1;sysFrom.wDay = 1;sysFrom.wHour = 0;sysFrom.wMinute = 0;sysFrom.wSecond = 0;

Call(&GAD,(PVOID)0);

if (TLGConnect( NULL , &Error )==FALSE) {printf("Error: %s\r\n",Error.szErrorText);

Page 223: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-33C79000-G8276-C140-01

return FALSE;}

else {fRet=TLGGetArchiveData(lpszArchiveName,lpszVarName1,

sysFrom,sysTo,GetArchiveDataCallback,(PVOID)1,0,&Error);

if (fRet==FALSE)printf("Error: %s\r\n",Error.szErrorText);

fRet=TLGGetArchiveData(lpszArchiveName,lpszVarName2,sysFrom,sysTo,GetArchiveDataCallback,(PVOID)2,0,&Error);

if (fRet==FALSE)printf("Error: %s\r\n",Error.szErrorText);

fRet=TLGGetArchiveData(lpszArchiveName,lpszVarName3,sysFrom,sysTo,GetArchiveDataCallback,(PVOID)3,0,&Error);

if (fRet==FALSE)printf("Error: %s\r\n",Error.szErrorText);

Call(&GAD,(PVOID)4);dwSize=GAD.dwFlags;TLGDisconnect( NULL );return TRUE;}

}

• Definition of the values for the start and end time, between which the data is to be readfrom the archive. A fixed time is set for the start time and the current system time forthe end time.

• Initialization of the callback function via the help function &DOO. This function calls the*HW$UFKLYH'DWD&DOOEDFN function, which sets a value of 0 for the OS8VHU parameter.

• Establishes the connection to 7DJ�/RJJLQJ. If this fails, the function is aborted.

• Reading of the archived values of the of the 0D[9DOXH, 0LQ9DOXH and 0HDQ9DOXHarchive tags via the 7/**HW$UFKLYH'DWD function.

• Determines the number of values read. This is done via the help function &DOO, whichcalls the *HW$UFKLYH'DWD&DOOEDFN function and sets a value of 4 for the OS8VHUparameter.

• Abortion of the connection to 7DJ�/RJJLQJ.

Page 224: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-34 WinCC Configuration ManualC79000-G8276-C140-01

Callback Function

BOOL GetArchiveDataCallback (PTLG_GETARCHIVEDATA lpGAD, PVOIDlpUser)

{

static int i1 = 0;static int i2 = 0;static int i3 = 0;

WORD wRecordNumber;WORD wColumnNumber;

static TLG_GETARCHIVEDATA GAD1[100];static TLG_GETARCHIVEDATA GAD2[100];static TLG_GETARCHIVEDATA GAD3[100];

int User;User=(int)lpUser;

if ((User==1)||(User==2)||(User==3)){

switch(User){case 1 : if (i1<=100) {GAD1[i1]=*lpGAD; i1++;} break;case 2 : if (i2<=100) {GAD2[i2]=*lpGAD; i2++;} break;case 3 : if (i3<=100) {GAD3[i3]=*lpGAD; i3++;} break;}//switch

}//if ((User==1)||(User==2)||(User==3))

if (User==0){

i1=0;i2=0;i3=0;

memset(&GAD1[0],0,sizeof(TLG_GETARCHIVEDATA)*100);memset(&GAD2[0],0,sizeof(TLG_GETARCHIVEDATA)*100);memset(&GAD3[0],0,sizeof(TLG_GETARCHIVEDATA)*100);

}//if (User==0)

if (User==4){lpGAD->dwFlags=i1;}//if (User==4)

if (User==7){

wRecordNumber=lpGAD->stTime.wMonth;wColumnNumber=lpGAD->stTime.wDay;

switch(wColumnNumber){case 0 : lpGAD->stTime.wYear = GAD1[wRecordNumber].stTime.wYear; lpGAD->stTime.wMonth = GAD1[wRecordNumber].stTime.wMonth; lpGAD->stTime.wDay = GAD1[wRecordNumber].stTime.wDay;

Page 225: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-35C79000-G8276-C140-01

lpGAD->stTime.wHour = GAD1[wRecordNumber].stTime.wHour; lpGAD->stTime.wMinute =GAD1[wRecordNumber].stTime.wMinute; lpGAD->stTime.wSecond =GAD1[wRecordNumber].stTime.wSecond; break;case 1 : lpGAD->doValue=GAD1[wRecordNumber].doValue; break;case 2 : lpGAD->doValue=GAD2[wRecordNumber].doValue; break;case 3 : lpGAD->doValue=GAD3[wRecordNumber].doValue; break;default : break;}//switch

}//if (User==7)

return TRUE;}

• Declaration of three static counter variables: i1, i2 and i3.

• Declaration of three static arrays consisting of structures of the typeTLG_GETARCHIVEDATA. The archive values are stored in these arrays.

• If the transfer parameter OS8VHU contains the value 1, 2 or 3, the function has been calledby Tag Logging. In this case, the transferred structure OS*$' will be stored in thecorresponding archive.

• If the transfer parameter OS8VHU contains the value 0, an initialization run has beenperformed. The counter variables are then set to 0 and space is reserved for the arrays.

• If the transfer parameter OS8VHU contains the value 4, the number of stored values isrequested. This number is then stored in the transferred structure as the structuremember GZ)ODJV.

• If the transfer parameter OS8VHU contains the value 7, the stored tag value of an ,�2�)LHOGor 6WDWLF�7H[W object is requested. From which position of the table the tag is requested,is determined by the transferred structure via the VW7LPH�Z0RQWK and VW7LPH�Z'D\structure members.

Page 226: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-36 WinCC Configuration ManualC79000-G8276-C140-01

C-Action at Static Texts

#include "apdefap.h" char* _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

int nRecordNumber;WORD wColumnNumber;extern WORD wOffset;char szObject[5];TLG_GETARCHIVEDATA GAD;PVOID lpUser7 = 7;char szTime[20] = "";int nObjectNumber;extern DWORD dwSize;

wColumnNumber=0;

nObjectNumber=atoi(lpszObjectName+15);nRecordNumber=(dwSize-nObjectNumber-wOffset);

if (nRecordNumber<0) return "";

GAD.stTime.wMonth=(WORD)nRecordNumber;GAD.stTime.wDay=wColumnNumber;

GetArchiveDataCallback(&GAD,lpUser7);

sprintf(szTime,"%02d.%02d.%d%02d:%02d:%02d",GAD.stTime.wDay,GAD.stTime.wMonth,GAD.stTime.wYear,GAD.stTime.wHour,GAD.stTime.wMinute,GAD.stTime.wSecond);

return szTime;

}

• The VW7LPH�Z0RQWK and VW7LPH�Z'D\ structure members of the *$' structure to betransferred are supplied with the column number or calculated data record number. Theobject name contains information about the data record number.

• The *HW$UFKLYH'DWD&DOOEDFN function is called with a OS8VHU transfer parameter valueof 7, i.e. a value is requested.

• The date value of the transferred structure *$' is stored in the VW7LPH structuremember. From this, the text to be displayed is formed. The text is returned to theproperty via UHWXUQ.

C-Action at the I/O Fields

#include "apdefap.h" double _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

extern dwSize;int nRecordNumber;WORD wColumnNumber;extern WORD wOffset;char szObject[5];TLG_GETARCHIVEDATA GAD;

Page 227: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-37C79000-G8276-C140-01

PVOID lpUser = 7;

strcpy(szObject,"");sprintf(szObject,"%c",lpszObjectName[0]);wColumnNumber=(WORD)atoi(szObject);

nRecordNumber=(dwSize-atoi(lpszObjectName+1)-wOffset);

if (nRecordNumber<0) return 0;

GAD.stTime.wMonth=(WORD)nRecordNumber;GAD.stTime.wDay=wColumnNumber;

GetArchiveDataCallback(&GAD,lpUser);

return GAD.doValue;

}

• The column and line numbers are determined from the object name. The VW7LPH�Z0RQWKand VW7LPH�Z'D\ structure members of the *$' structure to be transferred are suppliedwith the column number or calculated data record number.

• The *HW$UFKLYH'DWD&DOOEDFN function is called with a OS8VHU transfer parameter valueof 7, i.e. a value is requested.

• The tag value of the transferred structure *$' is stored in the GR9DOXH structuremember and is used as a return value.

1RWH�

The toolbar contains the button to set the parameters of the table. This button accessesa dialog box that allows you to set the colors of the various table elements. A shortdescription on this topic can be found in the example ������'LDORJ�%R[HV�IRU�6HWWLQJ�&RORUV�H[B�BFKDSWHUB��F�.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The archive data to be displayed has to be adapted to your requirements.

• The table layout has to be adapted to your needs. If a different column or line number isneeded, the C-actions and project functions must also be adapted.

Page 228: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-38 WinCC Configuration ManualC79000-G8276-C140-01

������ $UFKLYLQJ�RI�ELQDU\�WDJV��H[B�BFKDSWHUB��G�3'/�

7DVN�'HILQLWLRQ

The switching operations of three motors are to be stored in an archive. If a motor is

selected via 8, a table containing the switching operations for a time period of one daywill be displayed. Only one table can be shown at a time.

,PSOHPHQWDWLRQ�&RQFHSW

To archive the data to be displayed, create a cyclic-continuous process value archive forthree binary tags in the 7DJ�/RJJLQJ editor. Create a separate table window template foreach tag.To realize the graphical display, a 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ is used, which displaysa different picture depending on the selected motor. Each of the pictures contains a 6PDUW2EMHFW�→�$SSOLFDWLRQ�:LQGRZ, which will display the table window template.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 Creation of four tags in "Tag Management". In the example, these are the%,1LBH[BWOJBP�,�%,1LBH[BWOJBP� and %,1LBH[BWOJBP� tags of the %LQDU\�7DJtype, and the 8��LBH[BWOJB�� tag of the 8QVLJQHG���%LW�9DOXH type.

2 Create a new 3URFHVV�9DOXH�$UFKLYH with the archive wizard. In the example, thearchive was named =.B3URFHVV9DOXH$UFKLYHB��.

For the archiving, the %,1LBH[BWOJBP�,�%,1LBH[BWOJBP� and %,1LBH[BWOJBP�tags are selected.

3 In the properties dialog box of the process value archive, set the size of thearchive to �� data records. Accept the presettings for the remaining settings.

4 In the properties dialog box of the first process tag’s 3DUDPHWHUV tab, selectRQ�HYHU\�VLJQDO�FKDQJH from the $UFKLYLQJ� field. In the 1DPH�RI�6WDWHV field,enter 0RWRU�2II for 6WDWH�� and 0RWRU�2Q for 6WDWH��. In the &\FOH field, set the$UFKLYLQJ to � ����PV.

Accept the presettings for the remaining settings.

Perform the same steps for the other archive tags.

Page 229: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-39C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

7DEOH�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7DEOH�'LVSOD\�&RQILJXUDWLRQ

1 Creating a new table window template. The 3URSHUWLHV���7DEOH�:LQGRZ�7HPSODWH

dialog box will be displayed. The button opens the 3URSHUWLHV�RI�WKH7HPSODWH dialog box.

As the template name, the example uses =.B3$B7DEOHWHPSODWHB��D. A WLWOH�EDUand WRROEDU is required. Select the following elements for the WRROEDU via the

button:

• First Data Record

• Previous Data Record

• Next Data Record

• Last Data Record

• Select Time Range

• Start/Stop the Update

2 No inputs need to be made in the 2SHUDWRU�$XWKRUL]DWLRQ field.

3 In the *HQHUDO�,QIRUPDWLRQ tab, enter 6WDWH as the &ROXPQ�+HDGLQJ. In the'LVSOD\ field, select the 6KDUH�&ROXPQ check-box. Also select the 7LPHUDQJHcheck-box and set ��'D\.

The presettings can be accepted for the remaining settings.

Page 230: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-40 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��7DEOH�'LVSOD\�&RQILJXUDWLRQ

4 In the 7DJ tab, the *��LBH[BWOJBP� archive tag from the=.B3URFHVV9DOXH$UFKLYHB�� archive is selected. Click on 2. to apply all thesettings made.

5 Table templates must also be created for the two other archive tags. Follow theprevious configuration steps. The only difference lies in the selection of the tags.

The example uses the names =.B3$B7DEOHWHPSODWHB��E and=.B3$B7DEOHWHPSODWHB��F for the other templates.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 A separate picture must be created for each table template. In the example, theseare the H[B�BDSSOLFDWLRQB��, H[B�BDSSOLFDWLRQB�� and H[B�BDSSOLFDWLRQB��pictures.

Each of these pictures contains a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ. For eachof these objects, 7DJ�/RJJLQJ is set as the :LQGRZ�&RQWHQW and one of thepreviously created table templates as the 7HPSODWH. The geometry of the picturesis tuned to the geometry of the $SSOLFDWLRQ�:LQGRZV.

2 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB��G�3'/picture.

3 The motors to be displayed each consist of a 6WDQGDUG�2EMHFW�→�&LUFOH, a6WDQGDUG�2EMHFW�→�3RO\JRQ and a 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W. Thebackground color of the circle is changed via a '\QDPLF�'LDORJ depending on thestatus of the motor.

These three objects are grouped. In the example, these are the *URXS�, *URXS�and *URXS� objects. Each of these objects has a 'LUHFW�&RQQHFWLRQ at (YHQWV�→0RXVH�→�0RXVH�$FWLRQ, which writes the number of the motor to the8��LBH[BWOJB�� tag.

4 Two :LQGRZV�2EMHFWV�→�%XWWRQV are assigned to each motor. These buttonscontrol the tags assigned to the motors via 'LUHFW�&RQQHFWLRQV.

5 To be able highlight the currently selected motor, assign each motor a 6WDQGDUG2EMHFW�→�5HFWDQJOH.

Select the dotted line via 3URSHUWLHV�→�6W\OHV�→�/LQH�6W\OH and 7UDQVSDUHQW via3URSHUWLHV�→�6W\OHV�→�)LOO�3DWWHUQ.

Use a '\QDPLF�'LDORJ (for each rectangle) at 3URSHUWLHV�→�0LVFHOODQHRXV�→'LVSOD\ to make the 5HFWDQJOH only visible if the content of the 8��LBH[BWOJB��tag agrees with its own object number.

6 Configure a 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ , in the example, the 3LFWXUH:LQGRZ� object is used.

Via 3URSHUWLHV�→�0LVFHOODQHRXV, set the 0RYDEOH, %RUGHU, 7LWOH and &DQ�%H&ORVHG properties to \HV.

Create a '\QDPLF�'LDORJ at 3URSHUWLHV�→�0LVFHOODQHRXV�→�'LVSOD\, whichmakes the 3LFWXUH�:LQGRZ visible if the 8��LBH[BWOJB�� tag has a value greaterthan 0, i.e. a motor has been selected.

Create a '\QDPLF�'LDORJ at 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH,which, depending on the content of the 8��LBH[BWOJB�� tag, displays the

Page 231: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-41C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

corresponding picture in the 3LFWXUH�:LQGRZ.

Create a &�$FWLRQ at (YHQWV�→�3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→�'LVSOD\,which sets the 8��LBH[BWOJB�� tag to 0 if the 3LFWXUH�:LQGRZ is invisible. Thisensures that the selection frame around the current motor is also invisible.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The tags to be archived have to be adapted to your requirements.

• The graphical display of the objects has to be adapted to your requirements.

Page 232: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-42 WinCC Configuration ManualC79000-G8276-C140-01

������ $UFKLYLQJ�DW�6HW�7LPHV��H[B�BFKDSWHUB��H�3'/�

7DVN�'HILQLWLRQ

A cyclic-continuous process value archive is to acquire process values in one secondcycles. Every full minute, the sum of the values is to be archived.The archived values are to be displayed in table form, its toolbar and status bar are to berealized using standard tools.

,PSOHPHQWDWLRQ�&RQFHSW

To archive the displayed data, create a cyclic-continuous process value archive in the 7DJ/RJJLQJ editor. To archive at every full minute, a new &\FOH�7LPH needs to be set up. Thiscycle time is started at a precisely defined time. The archiving is triggered by this cycle.To display the data, a table template is created. This template is displayed in the *UDSKLFV'HVLJQHU via a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ.

&UHDWLQJ�D�QHZ�&\FOH�7LPH

6WHS 3URFHGXUH��&UHDWLQJ�D�QHZ�&\FOH�7LPH��7LPHU�

1 Open the 7DJ�/RJJLQJ editor from the &RQWURO�&HQWHU.

Create a new 7LPHU by 85 on this point in the navigation window.

2 The properties dialog box of the new 7LPHU will be displayed.

The example uses �PLQ�6WDUW���� as the QDPH of the 7LPHU. As the %DVH select �0LQXWH and as the )DFWRU choose �. The )DFWRU also allows you to configure, forexample, cycles of 4 or 6 minutes. In the 6WDUWLQJ�3RLQW�RI�WKH�&\FOH field, selectthe (QWHU�WKH�6WDUWLQJ�3RLQW�RI�WKH�&\FOH check-box. Enter � into every timerinput field. This has the effect that the cycle will be triggered at the first fullminute after runtime has been activated. If an actual time would be entered, thecycle would be triggered for the first time at the indicated time.

Page 233: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-43C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLQJ�D�QHZ�&\FOH�7LPH��7LPHU�

Close the properties dialog box by clicking on 2..

The window to the right will now display the newly created 7LPHU in addition tothe default timers.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 Create a new 3URFHVV�9DOXH�$UFKLYH with the archive wizard. In the example, thearchive was named =.B3URFHVV9DOXH$UFKLYHB��.

For the archiving, the tags *��BH[BWOJB��, *��BH[BWOJB�� and *��BH[BWOJB��are selected. In the example project, these tags are supplied with values by thesimulator.

Page 234: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-44 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

In the properties dialog box of the process value archive, accept the presettingsdisplayed by the wizard.

2 In the properties dialog box of the first process tag’s 3DUDPHWHUV tab, select �6HFRQG as the $FTXLVLWLRQ cycle in the &\FOH field. As $UFKLYLQJ, set � * �PLQ6WDUW����. Select 6XP in the 3URFHVVLQJ field.

The presettings can be accepted for the remaining settings of the first tag.

For the remaining archive tags, carry out the same steps described above.

7DEOH�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7DEOH�'LVSOD\�&RQILJXUDWLRQ

1 Creating a new table window template. The 3URSHUWLHV���7DEOH�:LQGRZ�7HPSODWH

dialog box will be displayed. The button opens the 3URSHUWLHV�RI�WKH7HPSODWH dialog box.

As the template name, the example uses =.B3$B7DEOHWHPSODWHB��. A VWDWXV�EDUand WRROEDU is required. Select the desired elements for the WRROEDU via the

button.

2 No inputs need to be made in the 2SHUDWRU�$XWKRUL]DWLRQ field.

3The button allows you to add two additional columns. The columns will

Page 235: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-45C79000-G8276-C140-01

6WHS 3URFHGXUH��7DEOH�'LVSOD\�&RQILJXUDWLRQ

then be displayed in the &KRRVH�2EMHFW window. Select the first column.

In the *HQHUDO�,QIRUPDWLRQ tab, enter *��BH[BWOJB�� as the &ROXPQ�+HDGLQJ. Inthe 'LVSOD\ field, select the 6KDUH�&ROXPQ check-box. Also select the 7LPHUDQJHcheck-box and set ��+RXU.

The presettings can be accepted for the remaining settings.

4 In the 7DJ tab, the *��BH[BWOJB�� archive tag from the=.B3URFHVV9DOXH$UFKLYHB�� archive is selected. Click on 2. to apply all thesettings made.

5 Carry out step 3 to 4 for the second and third column. However, the &ROXPQ+HDGLQJ and $UFKLYH�7DJ must be adapted.

In the example project, the colors of the individual columns have been adapted tothe colors used in the simulator window for the individual trends.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB��H�3'/picture.

In this picture, a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ is configured. In theexample, this is the $SSOLFDWLRQ�:LQGRZ� object. Select 7DJ�/RJJLQJ as thewindow content and the =.B3$B7DEOHWHPSODWHB��as the 7HPSODWH.

1RWH�A brief explanation about the other configuration settings made for theH[B�BFKDSWHUB��H�3'/ picture in the *UDSKLFV�'HVLJQHU can be found in example �����%DU�*UDSK�'LVSOD\��H[B�BFKDSWHUB��H�.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The described configuration allows you to start archiving at set times. Also, values canbe stored in an archive at every full minute, hour. etc.

• The archiving cycle created in the example should be adapted to your needs in regard tostart time and time base.

Page 236: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-46 WinCC Configuration ManualC79000-G8276-C140-01

������ ([SRUWLQJ�DQ�$UFKLYH��H[B�BFKDSWHUB��I�3'/�

7DVN�'HILQLWLRQ

A cyclic-continuous process value archive is to be exported to a CSV file, once themaximum number of data records the archive can store has been reached. The archive is tobe locked at system start and only be enabled after pressing a button.The archived values are to be displayed in table form, a user defined toolbar and status baris required. The user is to be informed about the export time by a message dialog box.

,PSOHPHQWDWLRQ�&RQFHSW

To archive the displayed data, create a cyclic-continuous process value archive in the 7DJ/RJJLQJ editor. To export the archive and for locking/enabling the archive, separate projectfunctions are created.To display the data, a table template is created. The toolbar is realized using multiple:LQGRZV�2EMHFWV�→�%XWWRQV and 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\V.

&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�3URFHVV�9DOXH�$UFKLYH

1 Create a new 3URFHVV�9DOXH�$UFKLYH with the archive wizard. In the example, thearchive was named =.B3URFHVV9DOXH$UFKLYHB��.

The tag to be archived was *��LBH[BWOJB��. In the example project, this tag issupplied with the sum of the three trend profiles by the simulator.

2 In the properties dialog box of the process value archive, set the size of thearchive to ��� data records. As the $FWLRQ�IRU�([SRUWLQJ�WKH�6KRUW�7HUP�$UFKLYH,the project function $FWLRQ)RU([SRUWLQJ$UFKLYH is set.

Accept the presettings for the remaining settings.

3 Accept the presettings for the properties dialog box of the process tag.

7UHQG�'LVSOD\�&RQILJXUDWLRQ

6WHS 3URFHGXUH��7HQG�'LVSOD\�&RQILJXUDWLRQ

1 Creation of a new table window template. The 3URSHUWLHV���7DEOH�:LQGRZ

7HPSODWH dialog box will be displayed. The button opens the3URSHUWLHV�RI�WKH�7HPSODWH dialog box.

As the template name, the example uses =.B3$B7UHQGWHPSODWHB��. No WLWOH�EDU,VWDWXV�EDU or WRROEDU is required.

Accept the presettings for the remaining settings.

2 No inputs need to be made in the 2SHUDWRU�$XWKRUL]DWLRQ field.

3 In the *HQHUDO�,QIRUPDWLRQ tab, 7UHQG� is displayed as the 1DPH�RI�WKH�7UHQG. In

Page 237: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-47C79000-G8276-C140-01

6WHS 3URFHGXUH��7HQG�'LVSOD\�&RQILJXUDWLRQ

the 'LVSOD\ field, select the 'LVSOD\�7UHQG and 'LVSOD\�7UHQGV�9HUWLFDOO\ check-boxes, and then the IURP�WKH�WRS radio-button.

In the 7DJ tab, the *��LBH[BWOJB�� archive tag from the=.B3URFHVV9DOXH$UFKLYHB�� archive is selected.

In the ;�$[LV tab, select the 8SGDWH check-box in the 6FDOLQJ field and deselect theremaining check-boxes.

In the 6HOHFWLRQ field of the <�$[LV tab, deselect the $XWRUDQJH check-box. Enter ���� as the 6WDUW and ��� as the (QG value. As the 7UHQG�'LVSOD\, select 6WHSSHG7UHQGV. Accept the presettings for the remaining settings.

Accept the presettings of the &RORU�/LPLW�9DOXHV tab.

4 Apply the settings made by clicking on 2. and save the changes made in the 7DJ/RJJLQJ editor via )LOH�→�6DYH.

Project Function for Exporting the Archive

void ActionForExportingArchive (LPTSTR lpszArchivNameReturn, LPTSTRlpszVariablenName , DWORD dwNumberOfRecords)

{BOOL fRet;int iTlgCon = 0;CMN_ERROR Error;char szProj[MAX_PATH];char szFile[MAX_PATH];LPTSTR lpszArchiveName = "PDE#HD#ZK_ProcessValueArchive_04#G64i_ex_tlg_04" ;char szFileName[MAX_PATH] = "";LPTSTR lpszFileName;TLG_IO_BACKUP_SELECT ibs;DWORD dwSize;time_t Time;struct tm* TimeStruct;int nPathLen,nFileLen;

DMGetRuntimeProject( szProj, MAX_PATH, &Error);

nPathLen=strlen(szProj);nFileLen=strlen((strrchr(szProj,\\)+1));

strncat(szFile,szProj,nPathLen-nFileLen);sprintf(szFileName,"%s%s",szFile,"ArchiveBackUp.CSV");lpszFileName=&szFileName[0];

time(&Time);TimeStruct = localtime(&Time);

ibs.sysFrom.wYear = 1997;ibs.sysFrom.wMonth = 1;ibs.sysFrom.wDay = 1;ibs.sysFrom.wHour = 0;ibs.sysFrom.wMinute = 0;ibs.sysFrom.wSecond = 0;

ibs.sysTo.wYear = (WORD)(TimeStruct->tm_year+1900);ibs.sysTo.wMonth = (WORD)(TimeStruct->tm_mon+1);ibs.sysTo.wDay = (WORD)(TimeStruct->tm_mday);

Page 238: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-48 WinCC Configuration ManualC79000-G8276-C140-01

ibs.sysTo.wHour = (WORD)(TimeStruct->tm_hour);ibs.sysTo.wMinute = (WORD)(TimeStruct->tm_min);ibs.sysTo.wSecond = (WORD)(TimeStruct->tm_sec);

fRet = TLGConnect( NULL, &Error );if (fRet==FALSE) printf("Error in TLGConnect(...)\r\n");

fRet=TLGGetBackupSize (lpszArchiveName, &dwSize, &ibs,TLG_BACKUP_EVACUATE, TLG_BAKFMT_CSV, &Error);if (fRet==FALSE) printf("Error inTLGGetBackupSize(...)[%s]\r\n",Error.szErrorText);else SetTagWord("U16i_ex_tlg_00",(WORD)dwSize);

fRet=TLGBackup (lpszArchiveName, lpszFileName, &ibs,TLG_BACKUP_EXPORT, TLG_BAKFMT_CSV, &Error);if (fRet==FALSE) printf("Error in TLGBackup(...)[%s]\r\n",Error.szErrorText);else SetTagBit("BINi_ex_tlg_09",TRUE);

TLGDisconnect( NULL );}

• Determination of the project path

• Generation of the name of the file into which the archive is exported to. This name alsocontains the path.

• Determination of the system time.

• Definition of the start and end time, between which the archiving times of the data to beexported are lying.

• Establishment of a connection to 7DJ�/RJJLQJ via the 7/*&RQQHFW function.

• Determination of the size of the data to be exported via the 7/*%DFNXS6L]H function.This value is stored in an internal tag.

• Exporting of the archive via the 7/*%DFNXS function and setting of the %,1LBH[BWOJB��binary tag, which makes the export visible.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 In Tag Management, three tags of the %LQDU\�7DJ type are created. In theexample, the %,1LBH[BWOJB��,%,1LBH[BWOJB�� and %,1LBH[BWOJB�� tags are used.In addition, the 8��LBH[BWOJB�� tag of the 8QVLJQHG����%LW�9DOXH type isrequired.

2 Creation of a new picture, in the example, this is the H[B�BFKDSWHUB��I�3'/.

In this picture, a 6PDUW�2EMHFW�→�$SSOLFDWLRQ�:LQGRZ is configured. In theexample, this is the $SSOLFDWLRQ�:LQGRZ� object. Select 7DJ�/RJJLQJ as thewindow content and the =.B3$B7UHQGWHPSODWHB��as the 7HPSODWH.

3 The implementation of a toolbar has already been explained in detail in the �����$UFKLYLQJ�LI�9DOXH�LV�([FHHGHG��H[B�BFKDSWHUB��E�3'/� example. This chapterwill only describe the newly added control elements.

4 To control the archiving, a :LQGRZV�2EMHFW�→�%XWWRQ is configured. In theexample, this is the %XWWRQ�� object.

A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which toggles the%,1LBH[BWOJB�� tag and calls the /RFN8QORFN$UFKLYH project function. The binary

Page 239: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-49C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

tag allows the current status of the archive to be stored.

5 Configure a new picture which is displayed if the archive is exported. In theexample, this is the H[B�BZLQGRZB���3'/.

This picture contains a 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W, which displays a text via a&�$FWLRQ. This text consists of a fixed part and the number value of the8��LBH[BWOJB�� tag. The number value contains the size of the exported data.Additionally, the picture contains a :LQGRZV�2EMHFW�→�%XWWRQ and 6PDUW�2EMHFW→�*UDSKLF�2EMHFW, which both turn the %,1LBH[BWOJB�� tag to the constant � viaa 'LUHFW�&RQQHFWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ.

6 Configure a 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ in the initial picture, in theexample, the 3LFWXUH�:LQGRZ� object is used. At 3URSHUWLHV�→�0LVFHOODQHRXV�→3LFWXUH�1DPH, set the H[B�BZLQGRZB���3'/. At 3URSHUWLHV�→�0LVFHOODQHRXV�→'LVSOD\, create a WDJ�FRQQHFWLRQ to the %,1LBH[BWOJB�� tag.

7 To display the status bar, two :LQGRZV�2EMHFWV�→�%XWWRQV are configured. In theexample, these are the %XWWRQ�� and %XWWRQ�� objects.

Create a '\QDPLF�'LDORJ at the %XWWRQ�� object at 3URSHUWLHV�→�)RQW�→�7H[W,which returns to the property, depending on the %,1LBH[BWOJB�� tag, either thetext 8SGDWH�6WDUWHG or 8SGDWH�6WRSSHG.

Create a '\QDPLF�'LDORJ at the %XWWRQ�� object at 3URSHUWLHV�→�)RQW�→�7H[W,which returns to the property, depending on the %,1LBH[BWOJB�� tag, either thetext $UFKLYH�(QDEOHG or $UFKLYH�/RFNHG.

Page 240: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-50 WinCC Configuration ManualC79000-G8276-C140-01

Project Function for Locking and Enabling the Archive

void LockUnlockArchive (BOOL bLock){ BOOL fRet; CMN_ERROR Error; LPTSTR lpszArchiveName = "ZK_ProcessValueArchive_04";

fRet = TLGConnect( NULL, &Error );

if (fRet==FALSE)printf("Error in TLGConnect(...)\r\n");

else{

fRet=TLGLockArchive (NULL,lpszArchiveName,bLock,&Error );if (fRet==FALSE) printf("Error in TLGLockArchive(...)

[%s]\r\n",Error.szErrorText);TLGDisconnect( NULL );

}

}

• Establishment of a connection to 7DJ�/RJJLQJ.

• Call of the 7/*/RFN$UFKLYH function. The E/RFN transfer parameter decides whether thearchive is to be locked or enabled.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The tags to be archived have to be adapted to your requirements.

• The maximum archive size, as well as the path settings and file name of the export filehave to be adapted to meet your needs.

Page 241: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-51C79000-G8276-C140-01

���� $ODUP�/RJJLQJ

In runtime, the examples to this topic can be selected by clicking on the button displayed

above with the 8. The examples are configured in the pictures H[B�BFKDSWHUB���3'/ toH[B�BFKDSWHUB��G�3'/.

*HQHUDO�,QIRUPDWLRQ

The $ODUP�/RJJLQJ editor is responsible for acquiring and archiving messages. It containsfunctions for accepting messages from processes, and for preparing, displaying,acknowledging, and archiving them.This is how $ODUP�/RJJLQJ supports the search for causes of errors.

Page 242: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-52 WinCC Configuration ManualC79000-G8276-C140-01

������ %LW�0HVVDJH�3URFHGXUH��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

Four motors are to be monitored by $ODUP�/RJJLQJ. Errors within motors are displayed bysetting various bits in tags assigned to each motor. The message states of the motors arestored in separate internal tags. Depending on the message state, the display of the motor isto be changed.The messages are to be displayed in a message window. The message window’s toolbar andstatus bar are realized using standard tools.

,PSOHPHQWDWLRQ�&RQFHSW

A message window template is created in $ODUP�/RJJLQJ. Additionally, several singlemessages must be created that refer to the monitored motors.The message window is created in the Graphics Designer via a 6PDUW�2EMHFW�→�$SSOLFDWLRQ:LQGRZ. The individual motors consist of multiple 6WDQGDUG�2EMHFWV. &�$FWLRQV change thedisplays of the motors for the various message states.

6HWXS�RI�WKH�5HTXLUHG�7DJV

6WHS 3URFHGXUH��6HWXS�RI�WKH�5HTXLUHG�7DJV

1 In Tag Management, set up a total of twelve tags of the 8QVLJQHG����%LW�9DOXHtype. Four of these tags serve as event tags. In the example, these are the8��LBH[BDOJB��,�8��LBH[BDOJB��,�8��LBH[BDOJB�� and 8��LBH[BDOJB�� tags.Four tags serve as status tags. In the example, these are the 8��LBH[BDOJB��,8��LBH[BDOJB��,�8��LBH[BDOJB�� and 8��LBH[BDOJB�� tags. The remaining tagsserve as acknowledgment tags. In the example, these are the 8��LBH[BDOJB��,8��LBH[BDOJB��,�8��LBH[BDOJB�� and 8��LBH[BDOJB�� tags.

Page 243: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-53C79000-G8276-C140-01

*HQHUDO�,QIRUPDWLRQ

A message consists of several message blocks. These message blocks can be divided intothree groups:

• 6\VWHP�%ORFNV: These blocks contain system data assigned by $ODUP�/RJJLQJ. Thisincludes date, time, report ID, etc.

• 3URFHVV�9DOXH�%ORFNV: These blocks contain the values transmitted from the process,e.g. critical fill levels, temperatures, etc.

• 8VHU�7H[W�%ORFNV: These blocks contain texts which provide general information andaid the understandability, e.g. error explanations, message sources, point of error, etc.

0HVVDJH�%ORFN�&RQILJXUDWLRQ

6WHS 3URFHGXUH��0HVVDJH�%ORFN�&RQILJXUDWLRQ

1 In the &RQWURO�&HQWHU, open the $ODUP�/RJJLQJ editor via a 85.

2 Selection of the required message blocks. Open the &RQILJXUH�0HVVDJH�%ORFNV

dialog box via 0HVVDJH�%ORFNV 85.

By 8' on one of the three entries in the $YDLODEOH�0HVVDJH�%ORFNV�LQ�WKH0HVVDJH window, the already selected message blocks become visible.

Page 244: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-54 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��0HVVDJH�%ORFN�&RQILJXUDWLRQ

Once a 6\VWHP�%ORFN, 8VHU�7H[W�%ORFN or 3URFHVV�9DOXH�%ORFN entry has selected,

the button allows you to display the dialog box for addingmessage blocks. In the example, the following message blocks are used:

• System Blocks

• Date

• Time

• Number

• User Text Blocks

• Message Text

• Point of Error

Page 245: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-55C79000-G8276-C140-01

6WHS 3URFHGXUH��0HVVDJH�%ORFN�&RQILJXUDWLRQ

The button moves a message block highlighted in the left window to theright window, and thus selects it. Clicking on 2. applies the settings made.

In the &RQILJXUH�0HVVDJH�%ORFNV dialog box, if a block is selected using 8, the

and buttons become operational. The firstbutton allows you to remove already selected message blocks, the second buttonallows you to configure the properties of the individual message blocks.

Clicking on 2. applies the settings made in the 0HVVDJH�%ORFNV dialog boxes.

The &RQILJXUH�0HVVDJH�%ORFNV dialog box is also exited by clicking on 2..

3 The settings made can also be displayed by 8' on the 0HVVDJH�%ORFNV entry.

Page 246: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-56 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��0HVVDJH�%ORFN�&RQILJXUDWLRQ

If one of the three sub-entries, 6\VWHP�%ORFNV, 8VHU�WH[W�%ORFNV or 3URFHVV�9DOXH

%ORFNV, is selected with the 8, the right window will display the selected

message blocks. 85 on the displayed icons and then selecting properties,accesses the 0HVVDJH�%ORFNV dialog box. Message blocks can also be deleted thisway.

If the 0HVVDJH�%ORFNV entry in the left window has been selected with the 8,

85 on one of the icons displayed in the right window, allows you to access the

add/remove or properties dialog box. 8' on one of the displayed icons in theright window, will display the message blocks it contains.

Page 247: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-57C79000-G8276-C140-01

6HWXS�RI�D�QHZ�0HVVDJH�/LQH�)RUPDW

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�/LQH�)RUPDW

1 The $ODUP�/RJJLQJ editor must still be open.

Create a new message line format by 85 on the 0HVVDJH�/LQH�)RUPDW entry.

The 0HVVDJH�/LQH dialog box will be displayed. As the 1DPH�RI�WKH�0HVVDJH/LQH�)RUPDW, the example uses /LQHB��. As the (OHPHQWV�RI�WKH�0HVVDJH, selectthe 1XPEHU, 'DWH, 7LPH, 3RLQW�RI�(UURU and 0HVVDJH�7H[W message blocks via the

button.

The move XS and move GRZQ buttons allow you to change the order of theselected message blocks.

Clicking on 2. applies the settings made and exits the dialog box.

2 If the 0HVVDJH�/LQH�)RUPDW entry is selected with the 8, the right window willdisplay all available message line formats.

Page 248: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-58 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�/LQH�)RUPDW

8' or 85 on the appropriate icon opens the 0HVVDJH�/LQH dialog box.

*HQHUDO�,QIRUPDWLRQ

The message window template defines the structure, display and operation of a messagewindow. Additionally, the template defines if the message window should display thecurrent messages or the message archive.

6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

6WHS 3URFHGXUH��6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

1 The $ODUP�/RJJLQJ editor must still be open.

Create a new message window template by 85 on the 0HVVDJH�:LQGRZ7HPSODWHV entry.

The &RQILJXUH�0HVVDJH�:LQGRZV dialog box will be displayed.

2 In the *HQHUDO�,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB�� in the :LQGRZ entryfield and 0RWRU�0HVVDJH�:LQGRZ in the :LQGRZ�7LWOH entry field. In runtime, the:LQGRZ�7LWOH will be displayed if the $SSOLFDWLRQ�:LQGRZ displaying thistemplate is configured with 7LWOH. If no text is entered in the window title entryfield, the content of the :LQGRZ entry field is used as the :LQGRZ�7LWOH.

As the :LQGRZ�7\SH, select 0HVVDJH�:LQGRZ.

The 6HOHFWLRQ is performed after the single messages have been configured.

Page 249: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-59C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

3 In the 0HVVDJH�/LQH tab, a message line format is selected. In the example, the/LQHB�� message line format has been selected.

A new message line format can be created by clicking on the 1HZ button.

4 In the 3DUDPHWHUV tab, the appearance of the message window is defined.

In the 6HSDUDWLRQ�/LQHV field, select the +RUL]RQWDO and 9HUWLFDO check-boxes.This means that the table will be displayed with horizontal and vertical separation

Page 250: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-60 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

lines.

In the 6HOHFWLRQ field, select 1R�6HOHFWLRQ. This defines that - in runtime - singlemessages can only be selected by using buttons on the toolbar, not with themouse.

Select the /LQH�7LWOH and &ROXPQ�7LWOH check-boxes.

Select the $XWR�6FUROOLQJ check-box.

5 In the 6WDWXV�%DU tab, select the 'LVSOD\�6WDWXV�%DU check-box. In the $OLJQPHQWfield, select %RWWRP. As (OHPHQWV�RI�WKH�6WDWXV�%DU, select the 'DWH, 7LPH and1XPEHU�RI�0HVVDJHV�LQ�WKH�:LQGRZ check-boxes.

Page 251: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-61C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

6 In the 7RROEDU tab, select the 'LVSOD\�7RROEDU check-box. In the $OLJQPHQW field,select 7RS. The following .H\ERDUG�)XQFWLRQV are used:

• Display Process Message Window

• Single Acknowledgement

• Group Acknowledgment

• Auto-Scroll On/Off

• Beginning of the List

• End of the List

• Next Message

• Previous Message

Page 252: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-62 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

7 If the 0HVVDJH�:LQGRZ�7HPSODWHV entry is selected with the 8, the rightwindow will display all available message window templates.

8' or 85 on the appropriate icon opens the &RQILJXUH�0HVVDJH�:LQGRZVdialog box.

The :LQGRZ�3UHYLHZ function, accessed by right-clicking on the desired messagewindow template, allows you to check all the settings made without activatingruntime.

Page 253: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-63C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�0HVVDJH�:LQGRZ�7HPSODWH

1RWH�The creation of a new message window template can also be performed using the wizard.The wizard allows you to make the most important settings.

All settings made so far in $ODUP�/RJJLQJ can also be performed, in a very simplified andabbreviated form, by the Message Wizard. This wizard is activated via the menu points )LOH→�6WDUW�0HVVDJH�:L]DUG. However, for a detailed configuration, the dialog boxes describedin this example are necessary.

The creation of a message system using the Message Wizard is described in chapter ����&RQILJXULQJ�PHVVDJHV.

Page 254: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-64 WinCC Configuration ManualC79000-G8276-C140-01

������ %LW�0HVVDJH�3URFHGXUH��&RQWLQXHG�

6HWXS�RI�6LQJOH�0HVVDJHV

6WHS 3URFHGXUH��6HWXS�RI�6LQJOH�0HVVDJHV

1 In the $ODUP�/RJJLQJ editor, the lower part of the window is called the tablewindow. In this window, the individual messages are configured, and the already

configured ones displayed. By 85, new lines can be added.

For this example, 12 different single messages are configured.

Each line in the table window represents one message and contains severalcolumns. Changes can be made directly in the individual columns. In the examplehowever, the settings are made via the 6LQJOH�0HVVDJH dialog box. This dialog

box is accessed via a 85 on the corresponding message line.

2 Access the 6LQJOH�0HVVDJH dialog box as described in the previous step.

In the 3DUDPHWHUV tab, select (UURU as the message class and )DLOXUH as themessage type.

In the 7KLV�0HVVDJH field, select the ZLOO�EH�DUFKLYHG and ZLOO�EH�UHSRUWHG check-boxes.

In the &RQQHFWLRQV field, select the 8��LBH[BDOJB�� tag as the (YHQW�7DJ andenter � as the (YHQW�%LW. This means that the message will be generated if the firstbit of the set tag assumes the status of 1.

Select the 8��LBH[BDOJB�� tag as the $FNQRZOHGJH�7DJ and enter � as the$FNQRZOHGJH�%LW. This means that the first bit of the set tag will be set to 1 if themessage is acknowledged in runtime.

Select the 8��LBH[BDOJB�� tag as the 6WDWXV�7DJ and enter � as the 6WDWXV�%LW.This setting effects that the first bit of the set tag is representing the &DPH,Q�:HQW�2XW�6WDWXV of the message. If the message is pending, the bit will be setto 1. This bit is reset, once the message has been cleared. The ninth bit of the tagcontains the $FNQRZOHGJH�6WDWXV of the message. If the message has not beenacknowledged, the bit has the status of 1. If the message has been acknowledged,the bit has the status of 0.

A 16-bit status tag can represent the states of 8 single messages. The low-bytealways contains the &DPH�,Q�:HQW�2XW�6WDWHV, the high-byte the $FNQRZOHGJH6WDWHV�

Page 255: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-65C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�6LQJOH�0HVVDJHV

3 In the 7H[W tab, enter ,QWHUORFN�(UURU as the 0HVVDJH�7H[W and 0RWRU�� as the3RLQW�RI�(UURU. No ,QIRWH[W is used.

No entries need to made in the 7DJ�$FWLRQ tab.

Apply the settings made by clicking on the 2. button.

4 The just created message monitors the first of the four motors. Create twoadditional message lines for the first motor.

The settings are made as described in step 2 to 3, however, the (YHQW�%LWV,$FNQRZOHGJH�%LWV and 6WDWXV�%LWV have to be adjusted. Additionally, )HHGEDFN(UURU and %LPHWDO�(UURU are used as the 0HVVDJH�7H[WV.

5 The other three motors also require three message lines each.

Page 256: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-66 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�6LQJOH�0HVVDJHV

The (YHQW�7DJV, $FNQRZOHGJH�7DJV and 6WDWXV�7DJV, as well as the texts for the3RLQW�RI�(UURU, must be adapted for each motor.

6 The configured message window template should only display messages thatrefer to one of the four motors. Therefore, a selection must be made in theproperties dialog box, *HQHUDO�,QIRUPDWLRQ tab, of the created message windowtemplate.

To do so, open the appropriate properties dialog box. In the *HQHUDO�,QIRUPDWLRQ

tab, clicking on the accesses the 6HW�WKH�6HOHFWLRQ dialog box.

Message block selections are made in this dialog box. In the example, onlymessages with a message number from 1 to 12 are to be displayed. That is, theselection is concerned with the 1XPEHU system block.

A 8' on the 6\VWHP�%ORFNV folder displays all available system blocks. By

selecting a block with the 8, all possible selections are displayed in the rightside of the window. For the 1XPEHU system block, a 6WDUW�9DOXH and a 6WRS�9DOXHcan be entered - the message numbers lie in this range.

In the example, � is entered as the 6WDUW�9DOXH and �� as the 6WRS�9DOXH.

Close the properties dialog box by clicking on 2.. If a selection has been made,

a check-mark will be displayed next to the "Selection" button. The&RQILJXUH�0HVVDJH�:LQGRZV dialog box is also exited by clicking on 2..

Page 257: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-67C79000-G8276-C140-01

&RQILJXUDWLRQ�RI�WKH�RI�WKH�0HVVDJH�&RORU�6FKHPHV

6WHS 3URFHGXUH��&RQILJXUDWLRQ�RI�WKH�RI�WKH�0HVVDJH�&RORU�6FKHPHV

1 The configured single messages are of the (UURU message class and the )DLOXUHmessage type.

8 on the 0HVVDJH�&ODVVHV entry to display all available message classes in the

right window. 8' on the message class icon (UURU to display all available

message types. 8' or 85 on the message type icon )DLOXUH opens the 7\SHdialog box.

2 In the 7\SH dialog box, a color scheme can be defined for each message state.

In the example, the following color schemes have been used:

Came In: Text Color = yellow, Background Color = orange

Went Out: Text Color = orange, Background Color = light gray

Acknowledged: Text Color = white, Background Color = orange

Page 258: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-68 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXUDWLRQ�RI�WKH�RI�WKH�0HVVDJH�&RORU�6FKHPHV

3 The configurations made in $ODUP�/RJJLQJ are saved via the )LOH�→�6DYH menupoints.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Each motor to be displayed consist of a 6WDQGDUG�2EMHFW�→�&LUFOH, a 6WDQGDUG2EMHFW�→�3RO\JRQ and a 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W.

The motors are to change color whenever an error message is displayed or thismessage is being acknowledged. The colors are to correspond to the ones usedfor the came in, went out and acknowledged message states.

To do so, create a &�$FWLRQ for the 6WDWLF�7H[W at 3URSHUWLHV�→�&RORUV�→�)RQW&RORU, which changes the font color depending on the current state of the motor’sstatus tag.

In the same manner, create a &�$FWLRQ for the &LUFOH at 3URSHUWLHV�→�&RORUV�→%DFNJURXQG�&RORU.

2 The occurrence of an error at a motor is simulated using a :LQGRZV�2EMHFW�→&KHFN�%R[.

At 3URSHUWLHV�→�*HRPHWU\�→�1XPEHU�RI�%R[HV enter �.

Page 259: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-69C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

At 3URSHUWLHV�→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV, create a 7DJ�&RQQHFWLRQ to thecorresponding event tag of the motor.

3 To display the created message window template, a 6PDUW�2EMHFW�→�$SSOLFDWLRQ:LQGRZ is configured. In the example, the $SSOLFDWLRQ�:LQGRZ� object is used.After placing the object in the picture, the :LQGRZ�&RQWHQWV dialog box isdisplayed. Select the $ODUP�/RJJLQJ entry. Close the dialog box by clicking on2..

In the following 7HPSODWH dialog box, select 0HVVDJH:LQGRZB�� trend windowtemplate. Close the dialog box by clicking on 2..

In the Graphics Designer, the configured $SSOLFDWLRQ�:LQGRZ will be displayedas a gray rectangle. The rectangle will be labeled with the name of the selectedtrend window template. At 3URSHUWLHV�→�0LVFHOODQHRXV, set the %RUGHU and 7LWOHproperties of the $SSOLFDWLRQ�:LQGRZ� object to <HV.

4 To be able to use $ODUP�/RJJLQJ during runtime, $ODUP�/RJJLQJ�5XQWLPH mustbe enabled first. To do so, check "Alarm Logging Runtime" in the "Startup" tabof the &RPSXWHU�3URSHUWLHV dialog box.

If this is not the case, select the "Computer" entry in the &RQWURO�&HQWHU via a 8

and open the &RPSXWHU�3URSHUWLHV�6WDUWXS�7DE by clicking on the button

Page 260: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-70 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

from the dialog’s toolbar. Click on the button to open the&RPSXWHU�3URSHUWLHV dialog box. In the 6WDUWXS tab, select the $ODUP�/RJJLQJ5XQWLPH check-box.

C-Action at the Circle

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){DWORD state;

state=GetTagDWord ("U16i_ex_alg_02");

if ((state&1)||(state&2)||(state&4))return 0x80FF;

elsereturn 0xFFFFFF;

}

• This &�$FWLRQ adds dynamics to the background color property of the &LUFOH assigned tothe first motor.

• The 8��LBH[BDOJB�� status tag assigned to the first motor is read. The low-byte of thistag contains the came in/went out message states. This means that a message is pendingand the circle’s background color is set to orange (hex 80ff) if the first, second or thirdbit of this tag is set to 1. If the message goes out again, the background color will be setto white (hex ffffff).

• This &�$FWLRQ is triggered upon the change of the 8��LBH[BDOJB�� status tag.

Page 261: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-71C79000-G8276-C140-01

C-Action at Static Text

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){DWORD state;

state=GetTagDWord ("U16i_ex_alg_02");

if ( ((state&1)&&(state&256)) || ((state&2)&&(state&512)) ||((state&4)&&(state&1024)) )

return 0xFFFF;else if ((state&1)||(state&2)||(state&4))

return 0xFFFFFF;else if ((state&256)||(state&512)||(state&1024))

return 0x80FF;else return 0x800000;

}

• This &�$FWLRQ adds dynamics to the font color property of the 6WDWLF�7H[W assigned to thefirst motor.

• The 8��LBH[BDOJB�� status tag assigned to the first motor is read. The low-byte of thistag contains the came in/went out message states, the high-byte the acknowledgedmessage states. In the case of an unacknowledged, pending message, the font color willbe set to yellow (hex ffff). In the case of an acknowledged message, the font color willbe set to white (hex ffffff). In the case of an unacknowledged, but went out message, thefont color will be set to orange (hex 80ff). In the normal state, the font color is dark blue(hex 800000).

• This &�$FWLRQ is triggered upon the change of the 8��LBH[BDOJB�� status tag.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The required message blocks, and with it the used message line formats, must beadapted to your needs.

• The message window template must be adapted to the desired display type.

• The event, status and acknowledge tags, as well as their bits, must be adapted to meetyour requirements. The same applies for the user texts.

Page 262: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-72 WinCC Configuration ManualC79000-G8276-C140-01

������ $QDORJ�$ODUPV��H[B�BFKDSWHUB��D�3'/�

7DVN�'HILQLWLRQ

The pressure and temperature values of three containers are to be monitored by $ODUP/RJJLQJ. If the monitored analog values approach the critical zone, warnings are to begenerated. If the values reach the critical zone, alarms are to be generated. The occurrenceof an alarm should also be indicated optically and acoustically in the *UDSKLFV�'HVLJQHU.A user-friendly message window layout should be used. That is, a custom toolbar should beconfigured. The table should have a user-defined color scheme.

,PSOHPHQWDWLRQ�&RQFHSW

A message window template is created in $ODUP�/RJJLQJ. Additionally, several singlemessages must be created that refer to the three monitored containers.In the *UDSKLFV�'HVLJQHU, the message window is displayed using a 6PDUW�2EMHFW�→$SSOLFDWLRQ�:LQGRZ. The height of this window, controlled by a &�$FWLRQ, depends on theon the number of messages. The background of this table is formed by a 6PDUW�2EMHFW�→*UDSKLF�2EMHFW. The toolbar consists of multiple :LQGRZV�2EMHFWV�→�%XWWRQV and 6PDUW2EMHFWV�→�6WDWXV�'LVSOD\V.

6HWXS�RI�WKH�5HTXLUHG�7DJV

6WHS 3URFHGXUH��6HWXS�RI�WKH�5HTXLUHG�7DJV

1 In Tag Management, set up a total of six tags of the 8QVLJQHG����%LW�9DOXH type.Three of these tags contain the temperature values of the individual containers. Inthe example, these are the 8��LBH[BDOJBW�,�8��LBH[BDOJBW� and 8��LBH[BDOJBW�tags. The remaining three tags contain the pressure values. In the example, theseare the 8��LBH[BDOJBS�,�8��LBH[BDOJBS� and 8��LBH[BDOJBS� tags.

Three additional tags of the 8QVLJQHG����%LW�9DOXH tags are required that serve asstatus tags. In the example, these are the 8��LBH[BDOJB��,�8��LBH[BDOJB�� and8��LBH[BDOJB�� tags.

One additional tag of the 8QVLJQHG����%LW�9DOXH type is needed to control acentral signaling device. In the example, this is the 8��LBH[BDOJB�� tag.

Two %LQDU\�7DJV are required. In the example, these are the %,1LBH[BDOJB�� and%,1LBH[BDOJB�� tags.

1RWH�The configurations carried out in the &RQILJXUH�0HVVDJH�%ORFNV table example areconsidered complete and will not be described again.

Page 263: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-73C79000-G8276-C140-01

6HWXS�RI�D�QHZ�0HVVDJH�:LQGRZ�7HPSODWH

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�:LQGRZ�7HPSODWH

1 Open the $ODUP�/RJJLQJ editor.

The message window should display the current value of the monitored tag if amessage arrives. To do so, a new process value block must be created.

Access the &RQILJXUH�0HVVDJH�%ORFNV dialog box by 85 on the 0HVVDJH�%ORFNVentry. Select the 3URFHVV�9DOXH�%ORFNV entry from the list and access the $GG

3URFHVV�9DOXH�%ORFNV dialog box by clicking on the button.This will add a new process value block. Close the dialog box by clicking on 2..

8' on the 3URFHVV�9DOXH�%ORFNV entry will display the new block. If you select

this block, its properties can be displayed by clicking on the button. In the example, 9DOXH has been entered as the 1DPH of the block and �has been set as its /HQJWK.

Clicking on 2. accepts the settings made in the 0HVVDJH�%ORFNV and &RQILJXUH0HVVDJH�%ORFNV dialog boxes.

2 Since a new message block has been configured, a new message line format isneeded. The /LQHB�� format, created in the first example, can not be usedanymore.

Create a new message line format by 85 on the 0HVVDJH�/LQH�)RUPDW entry.

The 0HVVDJH�/LQH dialog box will be displayed. As the 1DPH�RI�WKH�0HVVDJH/LQH�)RUPDW, the example uses /LQHB��. As the (OHPHQWV�RI�WKH�0HVVDJH, selectthe 1XPEHU, 'DWH, 7LPH, 3RLQW�RI�(UURU, 0HVVDJH�7H[W and 9DOXH message blocks

Page 264: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-74 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�:LQGRZ�7HPSODWH

via the button.

Clicking on 2. applies the settings made and exits the dialog box.

3 Create a new message window template by 85 on the 0HVVDJH�:LQGRZ7HPSODWHV entry.

The &RQILJXUH�0HVVDJH�:LQGRZV dialog box will be displayed.

4 In the *HQHUDO�,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB�� in the :LQGRZ entryfield. A separate :LQGRZ�7LWOH is not needed. As the :LQGRZ�7\SH, select0HVVDJH�:LQGRZ. The 6HOHFWLRQ is performed after the single messages havebeen configured.

In the 0HVVDJH�/LQH tab, select the /LQHB�� message line format.

In the 3DUDPHWHUV tab, the appearance of the message window is defined. In the6HSDUDWLRQ�/LQHV field, select the +RUL]RQWDO and 9HUWLFDO check-boxes. In the6HOHFWLRQ field, select /LQH. This determines that in runtime individual messagelines can be selected using the mouse if $XWR�6FUROOLQJ is turned off. Deselect the/LQH�7LWOH and &ROXPQ�7LWOH check-boxes. Select the $XWR�6FUROOLQJ check-box.

In the 6WDWXV�%DU and 7RROEDU tabs, deselect the check-boxes for displaying thestatus bar and toolbar.

Close the dialog box by clicking on 2..

*HQHUDO�,QIRUPDWLRQ

With the help of message classes,

• the acknowledgement type

• the corresponding status text

• the output of acoustical/optical signalsof all message types (belonging to a message class) are set.

Page 265: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-75C79000-G8276-C140-01

6HWXS�RI�D�QHZ�0HVVDJH�&ODVV

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�&ODVV

1 85 on the 0HVVDJH�&ODVVHV entry to access the $GG�0HVVDJH�&ODVV dialog box.

Clicking on the button adds a new message class. The dialog box isclosed by clicking on 2..

2 8 on the 0HVVDJH�&ODVVHV entry to display all available message classes,

including newly created ones, in the right window. 85 on one of the messageclass icons to open the &RQILJXUH�0HVVDJH�&ODVVHV dialog box.

3 In the *HQHUDO�,QIRUPDWLRQ tab, enter &RQWDLQHU�(UURU as the 1DPH�RI�WKH�&ODVV.

Access the $GG�0HVVDJH�7\SH dialog box by clicking on the button. In this dialog box, move two message types from the left to the right side

of the window using the button. The dialog box is closed by clicking on2..

Select one of the two new message types from the 0HVVDJH�7\SHV field and

display its properties by clicking on the button.

Enter &RQWDLQHU�$ODUP as the name of the first message type. The color schemeof the individual message states is as follows:

Came In: Text Color = black, Background Color = red

Went Out: Text Color = black, Background Color = green

Acknowledged: Text Color = black, Background Color = orange

Enter &RQWDLQHU�:DUQLQJ as the name of the second message type. The colorscheme of the individual message states is as follows:

Came In: Text Color = yellow, Background Color = blue

Went Out: Text Color = blue, Background Color = RGB(207,163,146)

Acknowledged: Text Color = white, Background Color = blue

Page 266: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-76 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�&ODVV

4 In the $FNQRZOHGJHPHQW tab, select the $FNQRZOHGJHPHQW�&DPH�,Q check-boxfrom the $FNQRZOHGJHPHQW�3KLORVRSK\ field.

In the &HQWUDO�6LJQDOLQJ�'HYLFHV field, select 6HSDUDWH�$FNQRZOHGJHPHQW�.H\. Asthe 7DJ, set the 8��LBH[BDOJB�� tag. This tag triggers a central signaling device.To acknowledge this signaling device, a button must be provided on the toolbar.This is the +RUQ�$FNQRZOHGJHPHQW button, if a standard toolbar is configured.

Page 267: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-77C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�D�QHZ�0HVVDJH�&ODVV

5 In the 6WDWXV�7H[WV tab, no changes need to be made.

The dialog box is closed by clicking on 2..

Page 268: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-78 WinCC Configuration ManualC79000-G8276-C140-01

������ $QDORJ�$ODUPV��FRQWLQXHG�

6HWXS�RI�6LQJOH�0HVVDJHV

6WHS 3URFHGXUH��6HWXS�RI�6LQJOH�0HVVDJHV

1 85 in the table window and add 12 new lines.

Select the first of the newly added lines via a 8. 85 on this line opens the6LQJOH�0HVVDJH dialog box.

2 In the 3DUDPHWHUV tab, select &RQWDLQHU�(UURU as the message class and &RQWDLQHU$ODUP as the message type. In the 7KLV�0HVVDJH field, select the ,V�6LQJOH$FNQRZOHGJHPHQW�2QO\, 7ULJJHU�+RUQ, ZLOO�EH�DUFKLYHG and ZLOO�EH�UHSRUWHGcheck-boxes. In the &RQQHFWLRQV field, select the 8��LBH[BDOJB�� tag as the6WDWXV�7DJ and enter � as the 6WDWXV�%LW. No (YHQW�7DJ is set, since the message isgenerated by an analog alarm. Also, no $FNQRZOHGJH�7DJ is set.

In the 7H[W tab, enter &ULWLFDO�2YHUSUHVVXUH as the 0HVVDJH�7H[W and &RQWDLQHU��as the 3RLQW�RI�(UURU. As the ,QIRWH[W enter 7KH�SUHVVXUH�LQ�FRQWDLQHU���KDVH[FHHGHG�WKH�FULWLFDO�YDOXH.

In the 7DJ�$FWLRQ tab, a tag can be set for the 9DOXH process value block.However, since the message is generated by an analog alarm, the first processvalue block of the message line is automatically supplied with the limit valuewhich triggered the message.

Apply the settings made by clicking on the 2. button.

3 The just created message monitors the pressure in the first of three containers.Three additional message lines must be configured for the first container.

Proceed as described in step 2. Create an additional message of the &RQWDLQHU(UURU message type. Enter &ULWLFDO�7HPSHUDWXUH as the 0HVVDJH�7H[W and changethe ,QIRWH[W correspondingly. Create two messages of the &RQWDLQHU�:DUQLQJmessage type and enter 3UHVVXUH�:DUQLQJ and 7HPSHUDWXUH�:DUQLQJ as the0HVVDJH�7H[WV. For these warnings select all check-boxes from the 7KLV�0HVVDJHfield of the 3DUDPHWHUV tab (of the 6LQJOH�0HVVDJH dialog box). All messagespertaining to container 1 use the same status tag. Their status bits, though, mustbe adapted.

4 The other two containers also require four message each.

Page 269: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-79C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�6LQJOH�0HVVDJHV

The 6WDWXV�7DJV, as well as the 3RLQW�RI�(UURU texts, must adapted to eachcontainer.

5 The configured message window template should only display messages thatrefer to one of the three containers. Therefore, a selection must be made in theproperties dialog box, *HQHUDO�,QIRUPDWLRQ tab, of the created message windowtemplate.

To do so, open the appropriate properties dialog box. In the *HQHUDO�,QIRUPDWLRQ

tab, clicking on the accesses the 6HW�WKH�6HOHFWLRQ dialog box.For the 1XPEHU system block, enter �� as the 6WDUW�9DOXH and �� as the 6WRS9DOXH.

Close the properties dialog box by clicking on 2.. If a selection has been made,

a check-mark will be displayed next to the "Selection" button. The&RQILJXUH�0HVVDJH�:LQGRZV dialog box is also exited by clicking on 2..

Page 270: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-80 WinCC Configuration ManualC79000-G8276-C140-01

&RQILJXUDWLRQ�RI�$QDORJ�$ODUPV

6WHS 3URFHGXUH��&RQILJXUDWLRQ�RI�$QDORJ�$ODUPV

1 If the $QDORJ�$ODUP entry is not present in the navigation window, it must beloaded first. This is done from the 2SWLRQV�→�$GG�,QV menu of the $ODUP/RJJLQJ editor. In the following dialog, select the analog alarm entry.

2 85 on the $QDORJ�$ODUP entry and select "New" to open the 3URSHUWLHV dialogbox of the tag. In this dialog box, a new tag for the analog alarm can be selected.

Set the 8��LBH[BDOJBW� tag, which contains the temperature value of the firstcontainer, as the 7DJ�WR�EH�PRQLWRUHG. The $�0HVVDJH�IRU�DOO�/LPLW�9DOXHV check-box is not selected. Keep � as the 'HOD\�7LPH.

Close the dialog box by clicking on 2..

Page 271: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-81C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXUDWLRQ�RI�$QDORJ�$ODUPV

3 In the right window, the icon of the new tag to be monitored will be displayed.

85 on this icon and select "New" to open the 3URSHUWLHV dialog box of the limitvalues. In this dialog box, a new limit value can be assigned to the tag.

Select 8SSHU�/LPLW in the /LPLW�9DOXH field. Enter ��� in the /LPLW�9DOXH�RU�7DJentry box. Keep � as the +\VWHUHVLV. Enter �� as the 1XPEHU in the 0HVVDJH field.This is the alarm message for the first container if the temperature has beenexceeded.

Close the dialog box by clicking on 2..

Page 272: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-82 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXUDWLRQ�RI�$QDORJ�$ODUPV

For the same tag, set a second limit value. In the /LPLW�9DOXH field, select 8SSHU/LPLW again. Enter ��� in the /LPLW�9DOXH�RU�7DJ entry box. Enter �� as the1XPEHU in the 0HVVDJH field. This is the warning message for the first containerif the temperature has been exceeded.

4 The other five tags to be monitored are created as described in step 2 and 3 andhave two limit values each.

8' on the $QDORJ�$ODUP entry to display all created tags.

Page 273: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-83C79000-G8276-C140-01

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 The simulation of the process values to be monitored is realized using :LQGRZV2EMHFWV�→�6OLGHU�2EMHFWV. In the example, these are the 6OLGHU�2EMHFW� to 6OLGHU2EMHFW� objects.

Create a 'LUHFW�&RQQHFWLRQ for the 6OLGHU�2EMHNF� at (YHQWV�→�3URSHUW\�7RSLFV→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ, which directs the currentprocess value of the 6OLGHU to the 8��LBH[BDOJBW� tag. This 6OLGHU has the task ofsimulating the temperature value of the first container. In the same manner,configure a 6OLGHU for each tag.

To synchronize the slider positions with the current tag values at the opening ofthe picture, create a &�$FWLRQ at (YHQWV�→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH.

2 Assign each 6OLGHU a 6PDUW�2EMHFW�→�,�2�)LHOG , which displays its current tagvalue. In the example, these are the ,�2�)LHOG� to ,�2�)LHOG� objects.

Create a 7DJ�&RQQHFWLRQ for the ,�2�)LHOG� at 3URSHUWLHV�→�0LVFHOODQHRXV�→3LFWXUH�1DPH to the 8��LBH[BDOJBW� tag and trigger it upon change. This is the,�2�)LHOG assigned to the first 6OLGHU. In the same manner, assign an ,�2�)LHOG toeach 6OLGHU.

3 The display of the individual containers is accomplished via the 7DQN� smartobject from the global library. In the example, these are the 7DQN��, 7DQN�� and7DQN�� objects.

In the example, these objects contain no dynamics. They only serve displaypurposes.

4 A 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ is assigned to each container to represent awarning light. In the example, these are the 6WDWXV�'LVSOD\� to 6WDWXV�'LVSOD\�objects.

In the example, via 3URSHUWLHV�→�6WDWH of the 6WDWXV�'LVSOD\� for the &XUUHQW

6WDWXV �, set the bitmap ,QGLFDWRU�LV�QRW�IODVKLQJ�EPS as the %DVLF�3LFWXUH

and the bitmap ,QGLFDWRU�LV�IODVKLQJ�EPS as the )ODVK�3LFWXUH. The3URSHUWLHV�→�6WDWH�→�)ODVKLQJ�)ODVK�3LFWXUH�DFWLYH is set to 1R. At the sameproperty, create a &�$FWLRQ, which turns on the flashing if an alarm messageconcerning a container is pending. Configure the two other 6WDWXV�'LVSOD\V in thesame manner.

5 Configure an additional 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\ to represent a horn. Inthe example, this is the 6WDWXV�'LVSOD\� object. At this object, via 3URSHUWLHV�→

6WDWH for the &XUUHQW�6WDWXV �, set the bitmap +RUQ�LV�QRW�VRXQGLQJ�EPS as the %DVLF�3LFWXUH and the bitmap +RUQ�LV�VRXQGLQJ�EPS as the )ODVK�3LFWXUH.

Page 274: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-84 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

The 3URSHUWLHV�→�6WDWH�→�)ODVKLQJ�)ODVK�3LFWXUH�DFWLYH is set to 1R.At the same property, create a &�$FWLRQ, which turns on the flashing if an alarmmessage arrives for one of the three containers, i.e. if the tag set in $ODUP/RJJLQJ for the &RQWDLQHU�(UURU message class (which triggers a centralsignaling device) receives the status of �. In the example, this is the8��LBH[BDOJB�� tag.

Create a &�$FWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�:LGWK, which emits acousticalsignals if the object is flashing.

6 Design of the message table background. The example uses a bitmap which isdisplayed by a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW.

7 To display the configured message window template, a 6PDUW�2EMHFW�→$SSOLFDWLRQ�:LQGRZ is used. In the example, this is the $SSOLFDWLRQ�:LQGRZ�object. Select $ODUP�/RJJLQJ as the :LQGRZ�&RQWHQW and 0HVVDJH:LQGRZB�� asthe 7HPSODWH. Create a &�$FWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW,which controls the height of the message window depending on the number ofmessages to be displayed.

8 For the toolbar, configure several :LQGRZV�2EMHFWV�→�%XWWRQV, which simulatethe pressing of individual buttons of the standard toolbar via special standardfunctions.

The %XWWRQ� object replaces the button for the horn acknowledgement. Create a&�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which calls the2Q%WQ+RUQ$FNQ�SV]0VJ:LQ� standard function. As SV]0VJ:LQ transferparameter, enter the name of the message window template. This buttonacknowledges the central signaling device. Using a 6PDUW�2EMHFW�→�*UDSKLF2EMHFW, which is placed on top of the button, this button can be madeinoperational. This occurs, if no signal is present at the tag triggering the centralsignaling device.

9 Additionally, configure a %XWWRQ for single acknowledgement, a %XWWRQ for groupacknowledgement and a %XWWRQ for calling the infotext dialog box. Thecorresponding standard functions are:

2Q%WQ6LQJO$FNQ�SV]0VJ:LQ�

2Q%WQ9LVLEOH$FNQ�SV]0VJ:LQ�

2Q%WQ,QIR�SV]0VJ:LQ�

10 As replacement for the button turning the auto-scroll function on/off, a 6PDUW2EMHFW�→�6WDWXV�'LVSOD\ is used. In the example, this is the 6WDWXV�'LVSOD\�

Page 275: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-85C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

object.

At 3URSHUWLHV�→�6WDWH�→�&XUUHQW�6WDWXV, create a 7DJ�&RQQHFWLRQ to the%,1LBH[BDOJB�� tag. This tag contains information whether auto-scrolling isturned on or off. A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, whichtoggles the %,1LBH[BWOJB�� tag and calls the 2Q%WQ6FUROO�SV]0VJ:LQ� standardfunction. At the opening of the picture, the %,1LBH[BDOJB�� tag is set to �, sinceauto-scroll is turned on if the message window is newly selected.

C-Action for Status Display1

#include "apdefap.h" BOOL _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){WORD state;

state=GetTagWord("U16i_ex_alg_01");

if ((state&1)||(state&2)) return TRUE;else return FALSE;}

• Input of the status tag of the first container. If an alarm message is pending, 758( isreturned to the property, that is, the warning light is flashing.

• This &�$FWLRQ is triggered upon the change of the first container’s status tag.

C-Action for Status Display4

#include "apdefap.h" BOOL _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){if (GetTagWord("U16i_ex_alg_10")&1) return TRUE;else return FALSE;}

• If the central signaling device is triggered, 758( is returned to the property, that is, thehorn is also displayed optically.

• This &�$FWLRQ is triggered upon the change of the tag triggering the central audibleindicator.

Page 276: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-86 WinCC Configuration ManualC79000-G8276-C140-01

C-Action for the Generation of Acoustical Signals

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

#pragma code ("winmm.dll")BOOL PlaySound(LPCSTR pszSound,HMODULE hMod,DWORD fdwSound);#define SND_FILENAME 0x00020000L#define SND_ASYNC 0x0001#pragma code ()

char szProjectName[MAX_PATH];CMN_ERROR Error;

char szSoundFilePath[MAX_PATH] = "";char szSoundFile[MAX_PATH] = "Hupe.wav";

if (GetFlashFlashPicture(lpszPictureName,lpszObjectName)) {if (DMGetRuntimeProject( szProjectName, MAX_PATH, &Error)) {

strncat(szSoundFilePath,szProjectName,strlen(szProjectName)-strlen(strrchr(szProjectName,\\)+1));

strcat(szSoundFilePath,szSoundFile);//MessageBeep((WORD)-1);PlaySound(szSoundFilePath,NULL,SND_FILENAME| SND_ASYNC);

}}

return 56;}

• Loading of the ZLQPP�GOO. This DLL contains the function for playing sound files.

• If the 6WDWXV�'LVSOD\� object is flashing, the +XSH�ZDY file, located in the project folder,is played. To do so, the project folder and file path must be determined via the'0*HW5XQWLPH3URMHFW function.

• Calling of the 3OD\6RXQG function.

• The present &�$FWLRQ is executed in one second cycles.

C-Action for Controlling the Height of the Message Window

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){#define MAX_LINES 8#define LINE_HEIGHT 18

WORD state1,state2,state3;WORD count = 0;static WORD Scount = 0;

state1=GetTagWord("U16i_ex_alg_01");state2=GetTagWord("U16i_ex_alg_04");state3=GetTagWord("U16i_ex_alg_07");

if (state1)

Page 277: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-87C79000-G8276-C140-01

{if ((state1&1)||(state1& 256)) count++;if ((state1&2)||(state1& 512)) count++;if ((state1&4)||(state1&1024)) count++;if ((state1&8)||(state1&2048)) count++;

}

if (state2){

if ((state2&1)||(state2& 256)) count++;if ((state2&2)||(state2& 512)) count++;if ((state2&4)||(state2&1024)) count++;if ((state2&8)||(state2&2048)) count++;

}

if (state3){

if ((state3&1)||(state3& 256)) count++;if ((state3&2)||(state3& 512)) count++;if ((state3&4)||(state3&1024)) count++;if ((state3&8)||(state3&2048)) count++;

}

if ((count==MAX_LINES)&&(Scount==(MAX_LINES+1))){Scount=count;SetTagBit("BINi_ex_alg_03",

(SHORT)!GetTagBit("BINi_ex_alg_03"));return (2+LINE_HEIGHT+LINE_HEIGHT*count);}

else if (count<=MAX_LINES){Scount=count;return (2+LINE_HEIGHT*count);}

else{Scount=count;return ((LINE_HEIGHT*MAX_LINES)+2);}

}

• Definition of the line height and the maximum number of lines to be displayed.

• Input of the status tags of the three containers.

• Determination of the number of messages visible in the window.

• Calculation of the window height. If all messages do not fit in the message window, themessage window will temporarily be expanded beyond its maximum size. This allowsthe scroll bars to be removed if auto-scroll is deactivated. If the message windowcontains fewer lines than can be displayed, the height of the window is calculated bymultiplying the number of lines by the line height. If the number of lines is greater thanthe maximum value, a maximum height is preset.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The created message class must be adapted to your needs.

• The type of message window display must meet your requirements.

Page 278: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-88 WinCC Configuration ManualC79000-G8276-C140-01

������ 0HVVDJH�:LQGRZ��H[B�BFKDSWHUB��E�3'/�

7DVN�'HILQLWLRQ

Several processes are to be monitored via a message window. If a message comes in, abutton on the toolbar should allow you to jump to the window in which the error occurred.The message window is created using the standard tools of the $ODUP�/RJJLQJ editor, thatis, the standard toolbar and status bar are used.

,PSOHPHQWDWLRQ�&RQFHSW

A message window template is created in $ODUP�/RJJLQJ. This example will use themessages and pictures created in the previous examples. A project function is required thatexecutes a picture change if the /RRS,Q�$ODUP button on the toolbar is pressed.In the *UDSKLFV�'HVLJQHU, the message window is displayed using a 6PDUW�2EMHFW�→$SSOLFDWLRQ�:LQGRZ. No additional objects are needed.

1RWH�The configurations carried out in the previous two examples are considered complete. Theywill not be described again, however, this example is based on them.

,PSOHPHQWDWLRQ�RI�WKH�([DPSOH

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�RI�WKH�([DPSOH

1 Open the $ODUP�/RJJLQJ editor from the &RQWURO�&HQWHU.

Create a new message window template by 85 on the 0HVVDJH�:LQGRZ7HPSODWHV entry.

The &RQILJXUH�0HVVDJH�:LQGRZV dialog box will be displayed.

2 In the *HQHUDO�,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB�� in the :LQGRZ entryfield and 0HVVDJH�:LQGRZ in the :LQGRZ�7LWOH entry field. As the :LQGRZ�7\SH,select 0HVVDJH�:LQGRZ. 6HOHFWLRQ must not be performed, since all singlemessages that occur are to be displayed.

In the 0HVVDJH�/LQH tab, select the /LQHB�� message line format.

In the 3DUDPHWHUV tab, select the +RUL]RQWDO and 9HUWLFDO check-boxes from the6HSDUDWLRQ�/LQHV field. In the 6HOHFWLRQ field, select 1R�6HOHFWLRQ. Select the /LQH7LWOH and &ROXPQ�7LWOH check-boxes. Select the $XWR�6FUROOLQJ check-box.

In the 6WDWXV�%DU tab, select the 'LVSOD\�6WDWXV�%DU check-box and %RWWRP fromthe $OLJQPHQW field. As the (OHPHQWV�RI�WKH�6WDWXV�%DU, select 'DWH, 7LPH,1XPEHU�RI�0HVVDJHV�LQ�WKH�:LQGRZ, /RFN and 6HOHFWLRQ.

In the 7RROEDU tab, select the 'LVSOD\�7RROEDU check-box and 7RS from the

Page 279: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-89C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�RI�WKH�([DPSOH

$OLJQPHQW field. As elements of the toolbar, select everything but the keys for'LVSOD\�3URFHVV�0HVVDJH�:LQGRZ, 'LVSOD\�6KRUW�7HUP�$UFKLYH, 'LVSOD\6HTXHQFH�$UFKLYH and &LW\�&DOO�)XQFWLRQV.

Close the dialog box by clicking on 2..

3 For each single message, /RRS�LQ�$ODUP must be set. This function enables adirect picture change to the corresponding picture of the message. By default, thefunction 2SHQ3LFWXUH is set for executing the picture change. In this example,though, a separate function must be created that can execute a picture change in apicture window. The calling parameters of this function are given by $ODUP/RJJLQJ. In this example, the $/*/RRS,Q$ODUP function is created in the *OREDO

6FULSW editor. In the message window’s toolbar, the button for /RRS�LQ�$ODUPmust have been selected.

In the table window of $ODUP�/RJJLQJ, 8' on the /RRS�LQ�$ODUP column todisplay the /RRS�LQ�$ODUP dialog box of the selected single message.

As )XQFWLRQ�1DPH, the $/*/RRS,Q$ODUP function is used. For the messages thatrefer to the motors of the first example, the H[B�BFKDSWHUB���3'/ picture is usedas the 3LFWXUH�1DPH�3DUDPHWHU, for messages of the second example, theH[B�BFKDSWHUB��D�3'/ picture is used.

The configuration of the /RRS�LQ�$ODUP function can also be made from thesingle message’s properties dialog box in the 7DJ�$FWLRQ tab, /RRS�LQ�$ODUP field.

Save the configurations made in $ODUP�/RJJLQJ.

4 Open the *UDSKLFV�'HVLJQHU and create a new picture. In the example, this is the

Page 280: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-90 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�RI�WKH�([DPSOH

H[B�BFKDSWHUB��E�3'/.

To display the configured message window template, a 6PDUW�2EMHFW�→$SSOLFDWLRQ�:LQGRZ is used. In the example, this is the $SSOLFDWLRQ�:LQGRZ�object. Select $ODUP�/RJJLQJ as the :LQGRZ�&RQWHQW and 0HVVDJH:LQGRZB�� asthe 7HPSODWH. Via 3URSHUWLHV�→�0LVFHOODQHRXV, the attributes 7LWOH and %RUGHUare set to <HV.

ALGLoopInAlarm Project Function

void ALGLoopInAlarm(char* PictureName){

SetPictureName("ex_0_startpicture_00.PDL","workspace", PictureName);

}

• Call of the 6HW3LFWXUH1DPH function to execute the picture change. This function cannot be used directly in $ODUP�/RJJLQJ, since the number and type of the call parametersdo not agree with the previous ones.

1RWH�In the message window template, a button in the toolbar has been provided to access thereport functions. The implementation of a message sequence report and its activation isdescribed in the example ������0HVVDJH�6HTXHQFH�5HSRUW��H[B�BFKDSWHUB��E�3'/�, in the5HSRUW�'HVLJQHU chapter.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The functions, configured for the individual messages, pertaining to the /RRS�LQ�$ODUP,must be adapted to meet your needs.

• The type of message window display must meet your requirements.

Page 281: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-91C79000-G8276-C140-01

������ 0HVVDJH�$UFKLYLQJ��H[B�BFKDSWHUB��F�3'/�

7DVN�'HILQLWLRQ

A message archive is to be created, which is designed to hold 200 messages in the form of ashort-term archive. All archived messages are to be displayed in a message window.The message window is to be controlled from a newly created toolbar. This toolbar shouldcontain two special buttons that allow the user to either display archived messages fromexample 1 or example 2.

,PSOHPHQWDWLRQ�&RQFHSW

A message window template is created in $ODUP�/RJJLQJ. This example will use themessages created in the previous examples. In addition, a message archive is configured.In the *UDSKLFV�'HVLJQHU, the message window is displayed using a 6PDUW�2EMHFW�→$SSOLFDWLRQ�:LQGRZ. The toolbar is implemented using multiple :LQGRZV�2EMHFWV�→%XWWRQV, 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\V and 6PDUW�2EMHFWV�→�*UDSKLF�2EMHFWV. Aproject function is needed that performs a defined selection in the message window if theselection buttons are activated.

6HWXS�RI�WKH�5HTXLUHG�7DJV

6WHS 3URFHGXUH��6HWXS�RI�WKH�5HTXLUHG�7DJV

1 Create a total of three tags of the %LQDU\�7DJ type. In the example, these are the%,1LBH[BDOJB��, %,1LBH[BDOJB�� and %,1LBH[BDOJB�� tags.

1RWH�The configurations carried out in the previous two examples are considered complete. Theywill not be described again, however, this example is based on them.

,PSOHPHQWDWLRQ�LQ�$ODUP�/RJJLQJ

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�$ODUP�/RJJLQJ

1 Open the $ODUP�/RJJLQJ editor from the &RQWURO�&HQWHU.

Create a new message window template by 85 on the 0HVVDJH�:LQGRZ7HPSODWHV entry. The &RQILJXUH�0HVVDJH�:LQGRZV dialog box will be displayed.

In the *HQHUDO�,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB�� in the :LQGRZ entryfield, a separate :LQGRZ�7LWOH is not needed. As the :LQGRZ�7\SH, select 6KRUW�7HUP�$UFKLYH�:LQGRZ. 6HOHFWLRQ must not be performed, since all archivemessages are to be displayed.

In the 0HVVDJH�/LQH tab, select the /LQHB�� message line format.

In the 3DUDPHWHUV tab, select the +RUL]RQWDO and 9HUWLFDO check-boxes from the6HSDUDWLRQ�/LQHV field. In the 6HOHFWLRQ field, select &HOO. Select the /LQH�7LWOH and&ROXPQ�7LWOH check-boxes. Select the $XWR�6FUROOLQJ check-box.

In the 6WDWXV�%DU and 7RROEDU tabs, deselect the check-boxes for displaying thestatus bar and toolbar.

Close the dialog box by clicking on 2..

Page 282: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-92 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�$ODUP�/RJJLQJ

2 85 on the $UFKLYHV entry and select "Add/Remove" to open the $UFKLYH3DUDPHWHU�$VVLJQPHQW dialog box.

Select the "Short-Term Archive Active" check-box.

In the right window, the icon for the short-term archive will now be displayed.

85 on this icon will display its properties.

The archive is to be stored on the hard disk. In the 1XPEHU�RI�0HVVDJHV entrybox, enter ���. 6HOHFWLRQ is not performed.

Page 283: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-93C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�$ODUP�/RJJLQJ

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 To display the configured message window template, a 6PDUW�2EMHFW�→$SSOLFDWLRQ�:LQGRZ is used. In the example, this is the $SSOLFDWLRQ�:LQGRZ�object. Select $ODUP�/RJJLQJ as the :LQGRZ�&RQWHQW and 0HVVDJH:LQGRZB�� asthe 7HPSODWH.

2 For the toolbar, configure several :LQGRZV�2EMHFWV�→�%XWWRQV, which simulatethe pressing of individual buttons of the standard toolbar via special standardfunctions.

The %XWWRQ� object replaces the button for the horn acknowledgement. Create a&�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which calls the2Q%WQ+RUQ$FNQ�SV]0VJ:LQ� standard function. As SV]0VJ:LQ transferparameter, enter the name of the message window template. This buttonacknowledges the central signaling device, which is triggered by some of theconfigured messages. Using a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW, which is placedon top of the button, this button can be made inoperational. This occurs, if nosignal is present at the tag triggering the central signaling device.

3 Additionally, configure a %XWWRQ for single acknowledgement, a %XWWRQ for groupacknowledgement, a %XWWRQ for calling the selection dialog box and a %XWWRQ forcalling the infotext dialog box. The corresponding standard functions are:

2Q%WQ6LQJO$FNQ�SV]0VJ:LQ�

2Q%WQ9LVLEOH$FNQ�SV]0VJ:LQ�

2Q%WQ,QIR�SV]0VJ:LQ�

Page 284: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-94 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

2Q%WQ6HOHFW�SV]0VJ:LQ�

4 As replacement for the button turning the auto-scroll function on/off, a 6PDUW2EMHFW�→�6WDWXV�'LVSOD\ is used. In the example, this is the 6WDWXV�'LVSOD\�object.

At 3URSHUWLHV�→�6WDWH�→�&XUUHQW�6WDWXV, create a 7DJ�&RQQHFWLRQ to the%,1LBH[BDOJB�� tag. This tag contains information whether auto-scrolling isturned on or off. A &�$FWLRQ is created at (YHQWV�→�0RXVH�→�3UHVV�/HIW, whichtoggles the %,1LBH[BWOJB�� tag and calls the 2Q%WQ6FUROO�SV]0VJ:LQ� standardfunction. At the opening of the picture, the %,1LBH[BDOJB�� tag is set to �, sinceauto-scroll is turned on if the message window is newly selected.

5 If auto-scroll is turned off, four special keys should enable you to navigate in themessage window. These keys replace the corresponding keys of the standardtoolbar with the following standard functions:

2Q%WQ0VJ)LUVW�SV]0VJ:LQ�

2Q%WQ0VJ/DVW�SV]0VJ:LQ�

2Q%WQ0VJ1H[W�SV]0VJ:LQ�

2Q%WQ0VJ3UHY�SV]0VJ:LQ�

These buttons can be made inoperational via a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW,which positions itself over the buttons if auto-scrolling is turned on. This isaccomplished via a 7DJ�&RQQHFWLRQ to the %,1LBH[BDOJB�� tag at 3URSHUWLHV�→0LVFHOODQHRXV�→�'LVSOD\.

6 Use of two 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\V to switch between the 0HVVDJH:LQGRZ and 6KRUW�7HUP�$UFKLYH�:LQGRZ display types. The current status of themessage window is stored in the %,1LBH[BDOJB�� tag, which must be set to zeroat the opening of the picture, since the message window is displayed as 6KRUW�7HUP�$UFKLYH�:LQGRZ first if called.

Create a 7DJ�&RQQHFWLRQ for the 6WDWXV�'LVSOD\� object at 3URSHUWLHV�→�6WDWH�→&XUUHQW�6WDWXV to the %,1LBH[BDOJB�� tag. Create a '\QDPLF�'LDORJ at 3URSHUWLHV→�0LVFHOODQHRXV�→�2SHUDWRU�&RQWURO�(QDEOH, which enables the operation ofthe object only, if the message window displays the short-term archive, i.e. the%,1LBH[BDOJB�� tag has the status of 0. Create a &�$FWLRQ at (YHQWV�→�0RXVH�→3UHVV�/HIW, which simulates the pressing of the corresponding button on thestandard toolbar and toggles the %,1LBH[BDOJB�� tag. Do the same to configurethe 6WDWXV�'LVSOD\� object. The following standard functions are used:

2Q%WQ0VJ:LQ�SV]0VJ:LQ�

2Q%WQ$UF6KRUWW�SV]0VJ:LQ�

7 Use two additional :LQGRZV�2EMHFWV�→�%XWWRQV to allow direct selections to bemade in the message window. It should be possible to select messages referringto the motors or messages referring to the containers. The selection is executedby a project function created in the *OREDO�6FULSW editor, which receives themessage numbers between which the displayed messages are lying. In the

Page 285: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-95C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

example, this function is named 6HW0VJ1U6HOHFWLRQ.

8 An additional :LQGRZV�2EMHFW�→�%XWWRQ is used to call the2Q%WQ3ULQW�SV]0VJ:LQ� function for reporting. If this button is activated, thecontent of the short-term archive will be printed out. If a selection has been madein the window, only the selected messages will be printed.

The system print job 5HSRUW�$ODUP�/RJJLQJ�57�5HYROYLQJ�$UFKLYH is called. Bydefault, the 3DJH�/D\RXW DOJXPD�USO is used. This page layout must be adapted orexchanged. The steps to do this are described in the example ������0HVVDJH$UFKLYH�5HSRUW��H[B�BFKDSWHUB��F�3'/�, in the 5HSRUW�'HVLJQHU chapter.

Project Function for Setting a Selection

BOOL SetMsgNrSelection(DWORD dwFrom, DWORD dwTo, LPSTR MsgTem){

PCMN_ERROR pError; BOOL fRet; MSG_FILTER_STRUCT Filter;

memset(&Filter, \0, sizeof( MSG_FILTER_STRUCT ) ); strcpy( Filter.szFilterName, MsgTem); Filter.dwFilter = MSG_FILTER_NR_FROM|MSG_FILTER_NR_TO; Filter.dwMsgNr[0] = dwFrom; Filter.dwMsgNr[1] = dwTo;

fRet = MSRTSetMsgWinFilter( &Filter, pError );

if (fRet == FALSE) {

printf("Error MSRTSetMsgWinFilter\r\n" );return FALSE;

} else

return TRUE;

}

• Reservation of space for the created )LOWHU filter structure.

• Assignment of values to the, for this application relevant, structure member of the filestructure. As the V])LOWHU1DPH, the name of the message window template, to which thefilter is referring to, must be used. In the GZ0VJ1U array, enter the start and end valuesof the message numbers to be selected. These values are supplied as transfer parameterswhile the function is called. The GZ)LOWHU switch is set to identify the file structure as anumber filter.

• Call of the 06576HW0VJ:LQ)LOWHU API function, which applies the created filter to theselected message window template.

Page 286: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-96 WinCC Configuration ManualC79000-G8276-C140-01

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The type of message window display must meet your requirements.

• The appearance and elements of the toolbar should be adapted to meet your needs.

Page 287: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-97C79000-G8276-C140-01

������ :LQ&&�$ODUP�&RQWURO��H[B�BFKDSWHUB��G�3'/�

7DVN�'HILQLWLRQ

A message window is to be configured that switches between the short-term archivewindow and message window display types. However, no message window template is tobe used to display the window, but the :LQ&&�$ODUP�&RQWURO OCX. By using this object,the toolbar and status bar must be created in the *UDSKLFV�'HVLJQHU.

,PSOHPHQWDWLRQ�&RQFHSW

By using an OCX, no message line format or message window template must be created in$ODUP�/RJJLQJ. However, single messages must still be created. In the example, the singlemessages created in the first two examples of this chapter are used.In the *UDSKLFV�'HVLJQHU, the message window is configured as a 6PDUW�2EMHFW�→�2/(&RQWURO. The toolbar is implemented using multiple :LQGRZV�2EMHFWV�→�%XWWRQV, 6PDUW2EMHFWV�→�6WDWXV�'LVSOD\V and 6PDUW�2EMHFWV�→�*UDSKLF�2EMHFWV.

1RWH�The configurations carried out in the previous two examples are considered complete. Theywill not be described again, however, this example is based on them. The configuration ofthe short-term archive is described in the example ������0HVVDJH�$UFKLYLQJ�H[B�BFKDSWHUB��F�3'/�.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 In Tag Management, create two tags of the %LQDU\�7DJ type. In the example,these are the %,1LBH[BDOJB�� and %,1LBH[BDOJB�� tags.

2 To display the message window, a 6PDUW�2EMHFW�→�2/(�&RQWURO is used. In theexample, this is the &&$OJ:LQ&WUO� object.

After placing the object, the ,QVHUW�2/(�&RQWURO��2&;� dialog box isautomatically displayed. Select the :LQ&&�$ODUP�&RQWURO entry from the list andexit the dialog box by clicking on 2..

Page 288: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-98 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

3 The 2/(�2EMHFW will be displayed as follows:

8' on this object to open the :LQ&&�$ODUP�&RQWURO�3URSHUWLHV dialog box.Settings are made in this dialog box that are normally made in $ODUP�/RJJLQJwhile creating a message window template and message line format.

In the 6W\OH tab, select 6KRUW�7HUP�$UFKLYH�:LQGRZ from the :LQGRZ�7\SH field.

In the 3DUDPHWHUV tab, select the +RUL]RQWDO and 9HUWLFDO check-boxes from the6HSDUDWLRQ�/LQHV field. Select line and column title, as well as auto-scrolling. Inthe 6HOHFWLRQ field, set 1R�6HOHFWLRQ.

Page 289: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-99C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

In the 0HVVDJH/LQH tab, the message blocks displayed in the message line areselected. The message blocks configured in $ODUP�/RJJLQJ are marked by a atthe beginning. For this example, all message blocks created in $ODUP�/RJJLQJ areselected for the message line.

Apply the settings made in this dialog box by clicking on 2..

4 8' on the just created object while holding down the CRTL key, activates theOCX in the *UDSKLFV�'HVLJQHU and gives you a preview of its appearance.

If runtime is activated, the OCX will receive relevant data of the $ODUP�/RJJLQJ.

Page 290: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-100 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

5 To control the :LQ&&�$ODUP�&RQWURO, a user-defined toolbar must used. Theconfiguration of the individual elements of the toolbar has been described indetail in the example ������0HVVDJH�$UFKLYLQJ��H[B�BFKDSWHUB��F�3'/�, in thetable ,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU. The standard functions usedthere are to be replaced by functions that control the :LQ&&�$ODUP�&RQWURO.These functions have the same names as their counterparts used to controlmessage window templates in application windows, however, the character string$;&B precedes them. They also differ in the way they are supplied withparameters. These functions require the picture and object names as transferparameters. The functions used in the example are:

• $;&B2Q%WQ+RUQ$FNQ�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ6LQJO$FNQ�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ9LVLEOH$FNQ�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ6FUROO�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ0VJ)LUVW�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ0VJ/DVW�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ0VJ1H[W�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ0VJ3UHY�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ0VJ:LQ�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

• $;&B2Q%WQ$UF6KRUWW�OSV]3LFWXUH1DPH�OSV]2EMHFW1DPH�

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The type of message window display must meet your requirements.

• The appearance and elements of the toolbar should be adapted to meet your needs.

Page 291: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-101C79000-G8276-C140-01

������ *URXS�0HVVDJHV��H[B�BJHQHUDWRUB���3'/�

In runtime, this example is accessed by clicking on the %XWWRQ displayed above using the

8. The message generator can be turned on by selecting the $FWLYH check-box contained inthis picture. Messages will then be generated in 10 second cycles.

7DVN�'HILQLWLRQ

Warnings are to be displayed in a picture that point out the presence of a certain type ofmessage.The messages have already been created in the examples ������%LW�0HVVDJH�3URFHGXUH�&RQWLQXHG� and ������$QDORJ�$ODUPV��FRQWLQXHG� and can be taken over. Warnings andalarms pending in the container picture and errors occurring in the motor picture are to bepointed out. The alarm has priority over the error and warning. If a message is pending, abutton should enable the user to jump to the corresponding picture.

,PSOHPHQWDWLRQ�&RQFHSW

The single messages to be monitored are combined into one group message. If one of thesingle messages is generated, the group message will also be generated. A status tag andstatus bit is assigned to this message.Via a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\, the current status of this tag is analyzed and acorresponding symbol displayed.

1RWH�The configurations carried out in the previous two examples are considered complete. Theywill not be described again, however, this example is based on them.

6HWXS�RI�WKH�5HTXLUHG�7DJV

6WHS 3URFHGXUH��6HWXS�RI�WKH�5HTXLUHG�7DJV

1 In Tag Management, set up a total of three tags of the 8QVLJQHG����%LW�9DOXHtype. In the example, these are the 8��LBH[BDOJB��, 8��LBH[BDOJB�� and8��LBH[BDOJB�� tags. They serve as status, lock and acknowledge tags.

*HQHUDO�,QIRUPDWLRQ

If a new message class is created, a group message for this message class will also becreated automatically. All messages within this message class are accepted into the groupmessage. The properties of the message classes and message types of the group messagecan be changed independently of each other and therefore be linked to various status, lockand acknowledge tags.

This example assumes that there are additional pictures using the same message classes.This means that the automatically generated group messages can not be used, since thegroup messages also try to identify the picture, from which the message originated.Therefore, user-defined group messages must be created.

Page 292: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-102 WinCC Configuration ManualC79000-G8276-C140-01

&UHDWLRQ�RI�QHZ�*URXS�0HVVDJHV

6WHS 3URFHGXUH��&UHDWLRQ�RI�QHZ�*URXS�0HVVDJHV

1 Open the $ODUP�/RJJLQJ editor.

8' on the *URXS�0HVVDJHV entry. This will display the 0HVVDJH�&ODVV and

8VHU�'HILQHG entries. 85 on the 8VHU�'HILQHG entry and select "Add GroupMessage" to display the 1HZ�*URXS�0HVVDJH dialog box.

2 Enter &RQWDLQHU�$ODUP in the 1DPH entry field. As the 6WDWXV, /RFN and$FNQRZOHGJH tags, set the tags created previously. Enter � as the bit numbers.

Close the dialog box by clicking on 2.. Create two additional group messagesthat use the same 6WDWXV, /RFN and $FNQRZOHGJH tags, but enter the bitnumber 1and 2, respectively. The right window will display the icons of the newly createdgroup messages.

Page 293: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-103C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLRQ�RI�QHZ�*URXS�0HVVDJHV

3 85 on one of the icons and select "Add Single Message" to open the 1HZ6LQJOH�0HVVDJH�V� dialog box. For each group message, enter the messagenumbers of the corresponding single messages and close the dialog boxes byclicking on 2..

4 In the navigation window, 8' on the 8VHU�'HILQHG entry will display theindividual group messages as sub entries. If one of these group messages is

selected using the 8, the right window will display the icons of all added singlemessages.

The following picture displays the single messages of the &RQWDLQHU�$ODUP groupmessage.

Page 294: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-104 WinCC Configuration ManualC79000-G8276-C140-01

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Create a new picture in the *UDSKLFV�'HVLJQHU. In the example, this is theH[B�BJHQHUDWRUB���3'/.

In this picture, configure a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\, which displays thecurrent status of the group messages. In the example, this is the 6WDWXV�'LVSOD\�object. The status of the group messages is stored in the 8��LBH[BDOJB�� tag, asconfigured in $ODUP�/RJJLQJ.

A bitmap must be designed for each status. This means bitmaps are required forthe three unacknowledged states, the three acknowledged states and the "nomessage present" state. Create a &�$FWLRQ at 3URSHUWLHV�→�6WDWH�→�&XUUHQW6WDWXV, which controls the status depending on the 8��LBH[BDOJB�� tag and therequested priority.

2 Additionally, configure a :LQGRZV�2EMHFW�→�%XWWRQ, which performs, in the caseof a displayed group message, the picture change to the picture in which themessage occurred. In the example, this is the %XWWRQ� object.

Using a &�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, the current status of thegroup messages is retrieved and the picture change performed accordingly. If nomessage is pending, a :LQGRZV�2EMHFW�→�%XWWRQ is placed on top of the justdescribed %XWWRQ. This new button has the purpose of making the other buttoninoperational and of optically displaying that inoperability. Set the 3URSHUWLHV�→0LVFHOODQHRXV�→�2SHUDWRU�&RQWURO�(QDEOH to 1R.

3 Configure an additional :LQGRZV�2EMHFW�→�%XWWRQ, which allows the currentlydisplayed group message to be acknowledged. In the example, this is the %XWWRQ�object.

Configure &�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which determines if agroup message is to be acknowledged (and if yes, which one). If a message is tobe acknowledged, the corresponding bit in the configured 8��LBH[BDOJB��acknowledge tag is set and then reset. If no unacknowledged message is pending,an additional :LQGRZV�2EMHFW�→�%XWWRQ is positioned on top of the just described%XWWRQ to make it inoperational and optically display that inoperability. Set the3URSHUWLHV�→�0LVFHOODQHRXV�→�2SHUDWRU�&RQWURO�(QDEOH to 1R.

4 Configure an additional picture. In the example, this is theH[B�BJHQHUDWRUB���3'/.

In this picture, three :LQGRZV�2EMHFWV�→�&KHFN�%R[HV are configured. In theexample, these are the &KHFN�%R[�, &KHFN�%R[� and &KHFN�%R[� objects.

Create a &�$FWLRQ each at (YHQWV�→�3URSHUW\�7RSLFV�→�2XWSXW�,QSXW�→�6HOHFWHG%R[HV, which locks are enables the corresponding group message. Each lock isdisplayed in the 8��LBH[BDOJB�� tag as configured in $ODUP�/RJJLQJ. Since alock can also be set from the other side, a &�$FWLRQ must be created at 3URSHUWLHV→�2XWSXW�,QSXW�→�6HOHFWHG�%R[HV. This action is triggered upon the change ofthe 8��LBH[BDOJB�� tag and checks, if the status of the lock controlled by the

Page 295: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-105C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

&KHFN�%R[ has changed.

5 In the picture created first (H[B�BJHQHUDWRUB���3'/), create a 6PDUW�2EMHFW�→3LFWXUH�:LQGRZ and set the H[B�BJHQHUDWRUB���3'/ at 3URSHUWLHV�→0LVFHOODQHRXV�→�3LFWXUH�1DPH. Set 1R at 3URSHUWLHV�→�0LVFHOODQHRXV�→'LVSOD\.

An additional :LQGRZV�2EMHFW�→�%XWWRQ is needed that makes the previouslyconfigured 3LFWXUH�:LQGRZ visible via a 'LUHFW�&RQQHFWLRQ at (YHQWV�→�0RXVH→�0RXVH�$FWLRQ.

C-Action for Determining the Current Status

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){WORD state;

state = GetTagWord("U16i_ex_alg_20");

if ((state&1)&&(state&256)) return 6;else if ((state&2)&&(state&512)) return 5;else if (state&1) return 3;else if ((state&4)&&(state&1024)) return 4;else if (state&2) return 2;else if (state&4) return 1;else return 0;}

• Reading out of the status tag described by $ODUP�/RJJLQJ.

• Setting of the current status depending on this tag. If multiple group messages arepending, the user-definable order of priority decides which message will be displayed.In this example, the order of priority, starting with the highest priority level, looks asfollows:

• Container Alarm

• Motor Error

• Acknowledged Container Alarm

• Container Warning

• Acknowledged Motor Error

• Acknowledged Container Warning

Page 296: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-106 WinCC Configuration ManualC79000-G8276-C140-01

C-Action for Performing the Picture Change

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){int value;

value = GetIndex(lpszPictureName,"Status Display1");

if ((value==2)||(value==5))SetPictureName("ex_0_startpicture_00.PDL","workspace","ex_3_chapter_02.PDL");

else if (value>0)SetPictureName("ex_0_startpicture_00.PDL","workspace","ex_3_chapter_02a.PDL");

}

• Determination of the currently displayed status of the status display.

• Depending on the displayed status, the picture change is performed. If the status is 0, noaction will be performed.

C-Action for the Acknowledgement of a Displayed Message

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){WORD state;

state = GetTagWord("U16i_ex_alg_20");

if ((state&1)&&(state&256)){SetTagWord("U16i_ex_alg_22",

(WORD)(1|GetTagWord("U16i_ex_alg_22")));SetTagWord("U16i_ex_alg_22",

(WORD)(~1&GetTagWord("U16i_ex_alg_22")));}

else if ((state&2)&&(state&512)){SetTagWord("U16i_ex_alg_22",

(WORD)(2|GetTagWord("U16i_ex_alg_22")));SetTagWord("U16i_ex_alg_22",

(WORD)(~2&GetTagWord("U16i_ex_alg_22")));}

else if ((state&4)&&(state&1024)){SetTagWord("U16i_ex_alg_22",

(WORD)(4|GetTagWord("U16i_ex_alg_22")));SetTagWord("U16i_ex_alg_22",

(WORD)(~4&GetTagWord("U16i_ex_alg_22")));}

}

• Reading in of the current status of the group messages.

• If a message to be acknowledged is pending, it will be acknowledged. If multiplemessages to be acknowledged are pending, the on with the highest priority will beacknowledged.

Page 297: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-107C79000-G8276-C140-01

C-Action for Setting a Lock

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, long value){DWORD dwServiceID;MSG_RTGROUPSET_STRUCT mGroup;CMN_ERROR Error;BOOL fRet;time_t Time;struct tm* TimeStruct;

time(&Time);TimeStruct = localtime(&Time);

mGroup.stTime.wYear=(WORD)(TimeStruct->tm_year+1900);mGroup.stTime.wMonth=(WORD)(TimeStruct->tm_mon+1);mGroup.stTime.wDay=(WORD)(TimeStruct->tm_mday);mGroup.stTime.wHour=(WORD)(TimeStruct->tm_hour);mGroup.stTime.wMinute=(WORD)(TimeStruct->tm_min);mGroup.stTime.wSecond=(WORD)(TimeStruct->tm_sec+1);

mGroup.fIDUsed=FALSE;strcpy(mGroup.szName,"Container Alarm");mGroup.dwData=value;

MSRTStartMsgService(&dwServiceID,NULL,NULL,MSG_NOTIFY_MASK_ALL,(LPVOID)0,&Error);

fRet=MSRTLockGroup (dwServiceID,&mGroup,&Error);if (fRet==FALSE)

printf("Error in MSRTLockGroup(:::)%s\r\n",Error.szErrorText);else printf("Executed MSRTLockGroup(:::) \r\n");

MSRTStopMsgService (dwServiceID,&Error );}

• Definition of the required tags. P*URXS is a structure that must be transferred to thefunction setting the lock.

• Determination of the current system time. This value is given to the VW7LPH structuremember of the SYSTEMTIME type.

• The I,'8VHG structure member indicates, if the desired group message, which is to belocked or enabled, is identified using its name or ID. The value of FALSE determinesthat the group message is to be identified using its name.

• V]1DPH contains the name of the desired group message.

• GZ'DWH indicates, if it should be set or enabled. The current status is transferred to thecheck-box.

• Starting of the message service via the 06576WDUW0VJ6HUYLFH function.

• Calling of the function for locking or enabling the 0657/RFN*URXS group message.

• Termination of the message service via the 06576WRS0VJ6HUYLFH function.

Page 298: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-108 WinCC Configuration ManualC79000-G8276-C140-01

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The single messages grouped into a group message must be adapted to meet your needs.

• The display of the group messages, the display priority order as well as the picturechanges to be performed must be adapted.

Page 299: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-109C79000-G8276-C140-01

���� 5HSRUW�'HVLJQHU

In runtime, the examples pertaining to this topic can be selected by clicking on the button

displayed above with the 8. The examples are configured in the H[B�BFKDSWHUB���3'/.Additional examples are spread out throughout the example project.

*HQHUDO�,QIRUPDWLRQ

The 5HSRUW�'HVLJQHU is part of the WinCC basic package and offers functions for thecreation and output of reports. Creation comprises the creation of the report layout in theconfiguration system of the 5HSRUW�'HVLJQHU, output comprises the printing of these reports.

1RWH�The supplied system layouts can be used directly, or be copied and modified to meet yourneeds. The names of the system layouts and system print jobs are always preceded by the# symbol.

Page 300: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-110 WinCC Configuration ManualC79000-G8276-C140-01

������ 3LFWXUH�'RFXPHQWDWLRQ��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

Comprehensive documentation of all pictures contained in a project is to be generated. Thepicture documentation should contain a graphical display, general information about thepicture, a listing of all contained objects and a listing of all set picture properties.

,PSOHPHQWDWLRQ�&RQFHSW

A system layout is available that satisfies all of these requirements. It is the #3'/3LF�USOlayout. This layout is copied and adapted to meet your needs.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 Open the 5HSRUW�'HVLJQHU editor from the &RQWURO�&HQWHU.

Open the #3'/3LF�USO system layout via )LOH�→�2SHQ and save it under a newname via )LOH�→�6DYH�$V. In the example, the name 3'/SLFWXUH�USO is used.

2 85 on a blank area within the layout to open its properties dialog box.

In the 3URSHUWLHV tab, general geometric properties can be set at the *HRPHWU\entry.

Page 301: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-111C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

The 0LVFHOODQHRXV entry allows you to add a cover sheet or final page. In theexample, a cover sheet is used.

3Clicking on the button from the toolbar enables the editing of the static

picture part, while clicking on the button enables the editing of the dynamicpicture part.

The dynamic part of the report contains a '\QDPLF�2EMHFW�→�(PEHGGHG�/D\RXW.In the example, this is the (PEHG/D\RXW dynamic object, which is not to bechanged. The embedded layout is the #3'/�SLFWXUH��FRPSDFW��USO layout.

This layout can be opened and its elements be changed to meet your needs. It isrecommended to make a copy of this layout first and then to edit the copy. Ifchanges are made to the layout, this layout must be set in the initial layout at the(PEHG/D\RXW object via 3URSHUWLHV�→�0LVFHOODQHRXV�→�/D\RXW�)LOH.

4 The static part of the report contains a header and a footer.

The footer contains the 6\VWHP�2EMHFWV 'DWH�7LPH, 3DJH�1XPEHU, 3URMHFW�1DPHand /D\RXW�1DPH.

The header contains two 6WDWLF�2EMHFWV�→�6WDWLF�7H[WV and one 6\VWHP�2EMHFW�→3URMHFW�1DPH. Additionally, a logo is displayed via a 6WDWLF�2EMHFW�→�2/((OHPHQW. Change the text of the 6WDW7H[W� to 3LFWXUH�'RFXPHQWDWLRQ. To displayyour own logo, delete the current 2OH2EMHFW�. Configure a new 6WDWLF�2EMHFW�→2/(�(OHPHQW. In the ,QVHUW�2EMHFW dialog box, which is displayed after placingthe object in the report, select &UHDWH�IURP�)LOH and set the bitmap file containingyour logo. Close the dialog box by clicking on 2..

Page 302: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-112 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

Save the configurations made in the 5HSRUW�'HVLJQHU.

5Clicking on the button on the toolbar switches among the coversheet, report contents and final page.

The example’s cover sheet contains two 6WDWLF�2EMHFWV�→�6WDWLF�7H[WV and a 6WDWLF2EMHFW�→��2/(�(OHPHQW.

Page 303: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-113C79000-G8276-C140-01

6HWXS�RI�3ULQW�-RE

6WHS 3URFHGXUH��6HWXS�RI�3ULQW�-RE

1 In the &RQWURO�&HQWHU, 85 on "Print Job" and select "New Print Job".

The right window will display the new print job using the default name 3ULQW

-RE���, in addition to the already existing print jobs. 8' or 85 on the newprint job to display its properties dialog box.

2 In the 3ULQW�-RE tab, replace the default name in the 1DPH entry field by3ULQWMREB3'/. As the /D\RXW, set the previously created layout 3'/SLFWXUH�USO.

In the 6HOHFWLRQ tab, the area to be printed is set. In the 3DJH�5DQJH field, select$OO. In the example, a set 7LPH�5DQJH has no influence on the print job.

In the 3ULQWHU�6HWXS tab, the printer is selected. You can also choose to print thedata to a file.

3 In the &RQWURO�&HQWHU, 85 on the print job and selecting "Print the Print Job"starts the print job. The print job can also be previewed first.

4 In the example project, a print job preview can be displayed via a :LQGRZV2EMHFW�→�%XWWRQ. This is the %XWWRQ�� object in the H[B�BFKDSWHUB���3'/.

Create a &�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which activates thepreview of the corresponding print job.

Page 304: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-114 WinCC Configuration ManualC79000-G8276-C140-01

C-Action for Starting a Print Job

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

RPTJobPreview("PrintJob_PDL");

}

• Calls the 537-RE3UHYLHZ standard function. As transfer parameter, the name of theprint job is used.

1RWH�If the layout, inserted into the report layout of the 5HSRUW�'HVLJQHU editor, is open, thepreview and the print job can not be started.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The created layout can be accepted without modifications. However, changes mightbecome necessary for the logo and the information displayed in the report. Thesechanges are carried out as described in step 3 and 4 of ,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW'HVLJQHU.

Page 305: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-115C79000-G8276-C140-01

������ 5HSRUWLQJ�WKH�3URMHFW�)XQFWLRQ��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

All created project functions of a project are to be reported. General information and thesource code of each project function are to be printed out.

,PSOHPHQWDWLRQ�&RQFHSW

A system layout is available that satisfies all of these requirements. It is the#*6&B53)&�USO layout. This layout is copied and adapted to meet your needs. This layoutcontains an inserted layout that must also be adapted.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, open the #*6&B53)&�USO system layout by 85 on it.

Save this system layout under a new name via )LOH�→�6DYH�$V. In the example,the name JVFBSURMHFWIXQFWLRQ�USO is used.

2 In the properties dialog box of the layout, which is accessed by 85 on a blankarea within the report, select the &RYHU�6KHHW entry from 0LVFHOODQHRXV. Acceptthe remaining settings.

3 The static part of the report contains a header and a footer.

The footer contains the 6\VWHP�2EMHFWV 'DWH�7LPH, 3DJH�1XPEHU, 3URMHFW�1DPHand /D\RXW�1DPH.

The header and footer both contain a 6WDWLF�2EMHFW�→�5HFWDQJOH as thebackground. Via 3URSHUWLHV�→�&RORUV�→�%DFNJURXQG�&RORU, set the backgroundcolor of these rectangles to /LJKW�*UD\.

The header contains two additional 6WDWLF�2EMHFWV�→�6WDWLF�7H[WV and one 6\VWHP2EMHFW�→�3URMHFW�1DPH. The existing 2OH2EMHFW�, which displays the logo, isdeleted. It is replaced by a 6WDWLF�2EMHFW�→�6WDWLF�0HWDILOH. In the example, this isthe 6WDW0HWDILOH�. Via 3URSHUWLHV�→�0LVFHOODQHRXV�→�0HWDILOH�1DPH, anexisting metafile is set. In the example, this is the ORJR�HPI file containing theWinCC logo.

If 6WDWLF�0HWDILOHV are used, be sure to link them to the report layout. If the path tothe corresponding file changes, the layout must be updated.

4 The example’s cover sheet contains two 6WDWLF�2EMHFWV�→�6WDWLF�7H[WV and a 6WDWLF2EMHFW�→��2/(�(OHPHQW.

Page 306: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-116 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

5 The dynamic part of the report consists of a '\QDPLF�2EMHFW�→�(PEHGGHG/D\RXW. In the example, this is the (PEHG/D\RXW object. As the embedded layout,the system layout #JVFUSIF�USO is used.

Open the system layout #JVFUSIF�USO and save it under a new name. In theexample, the name JVFBSURM�LQWHUQ��USO is used.

The static part of this layout contains no objects.

The dynamic part of this report contains two '\QDPLF�2EMHFWV�→�'\QDPLF�7H[WV.In the example, these are the '\Q7H[W� and '\Q7H[W� objects.

The connection of the '\Q7H[W� object to the *OREDO�6FULSW data was establishedas follows:

• Open the properties dialog box of the '\Q7H[W� object.

• Select the &RQQHFW tab.

• Click on the button to open the &RQQHFW dialog box.

• In the *OREDO�6FULSW folder, select ,QIR from the 3URMHFW�)XQFWLRQV and close

the dialog box by clicking on 2..

• The selected connection will then be displayed in the left window of the&RQQHFW tab. If the 3URMHFW�)XQFWLRQV entry is selected, the 6HOHFWLQJ�(OHPHQWVentry will be displayed. This means that a selection can be made. Click on this

entry using the 8 to activate the button. This button opens the6HOHFWLQJ�(OHPHQWV dialog box.

• In this dialog box, select $OO�$YDLODEOH�(OHPHQWV.For the '\Q7H[W� object, a connection was established as described above. Theexception being that 6RXUFH�&RGH, instead of ,QIR, was selected.

6 Configuration of appropriate fonts. In the example, the '\Q7H[W� object uses thefont $ULDO with a font size of ��SW. The font is also displayed 8QGHUOLQHG. The'\Q7H[W� object uses the &RXULHU�1HZ font with a font size of ��SW. This font isdisplayed in %ROG. The entire '\Q7H[W� object was framed by a border using a/LQH�:HLJKW of �.

Save the changes made to the embedded layout. Close the layout.

7 In the still open layout JVFBSURMHFWIXQFWLRQ�USO, set the just created layout at the(PEHG/D\RXW object via 3URSHUWLHV�→�0LVFHOODQHRXV�→�/D\RXW�)LOH. Thislayout replaces the previously set system layout.

Via &RQQHFW�→�3URMHFW�)XQFWLRQV (in the 2EMHFW�3URSHUWLHV dialog box of the(PEHG/D\RXW object), a selection can now be made. Select the 6HOHFWLQJ

(OHPHQWV entry. This makes the button operational, by which the6HOHFWLQJ�(OHPHQWV dialog box is accessed. In the example, $OO�$YDLODEOH(OHPHQWV has been selected. It is also possible to directly select the projectfunctions to be reported.

Page 307: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-117C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

Save the configurations made in the 5HSRUW�'HVLJQHU.

1RWH�The procedure of creating a new print job and executing that print job from the &RQWURO&HQWHU or runtime, is described in the previous example under 6HWXS�RI�3ULQW�-RE. Thesettings can be made correspondingly.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The created layout can be accepted without modifications.

Page 308: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-118 WinCC Configuration ManualC79000-G8276-C140-01

������ 5HSRUWLQJ�RI�WKH�&RQWURO�&HQWHU��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

All tags of certain tag groups used in a project are to be documented. The tagdocumentation should contain the tag name, tag type, its group, tag parameters and processconnection information.

,PSOHPHQWDWLRQ�&RQFHSW

Configure a new layout in the 5HSRUW�'HVLJQHU editor. This layout is not based on anyexisting layout.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, create a new layout by 85 on /D\RXW.

The right window will display the new layout, using the default name

1HZ53/���53/, in addition to the already existing ones. 85 on this layout andselect "Rename Layout" to give it a new name. In the example, the name&RQWURO&HQWHU�USO is used.

2 Open the new layout in the 5HSRUW�'HVLJQHU.

In the properties dialog box of the layout, which is accessed by 85 on a blankarea within the report, select the &RYHU�6KHHW entry from 0LVFHOODQHRXV. Acceptthe remaining settings.

3 In the static part of the report, various 6WDWLF�2EMHFWV and 6\VWHP�2EMHFWV areconfigured for the header and footer.

The design of the cover sheet is a suggestion on which your own concept can bebased.

4 In the dynamic part of the report, a '\QDPLF�2EMHFW�→�'\QDPLF�7DEOH isconfigured. In the example, this is the '\Q7DEOH� object.

After the object is placed in the report, the &RQQHFW dialog box is displayed.Select the 7DJV entry from the &RQWURO�&HQWHU�&6 folder. Close the dialog box byclicking on 2..

Page 309: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-119C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6 In the &RQQHFW tab of the table’s properties dialog box, several selection optionsare available.

8' on one of the entries brings up its corresponding dialog box for selecting

data. If a selection was made, a red check-mark will be displayed.

In the dialog box for selecting the tag parameters, select the 'DWD�7\SH, *URXS,3DUDPHWHUV and ([WHUQDO�7DJ�'DWD check-boxes. Also, select the &RPSDFW check-box. This causes all tag data to be displayed in one line.

In the example, the following tag groups are selected: $ODUP/RJJLQJ� and$ODUP/RJJLQJ�. However, this selection is only possible, if the $OO�7DJ�*URXSVcheck-box has not been selected.

To make the selection of the tag groups effective, the $OO�7DJV check-box must bedeselected in the tag selection’s dialog box.

Page 310: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-120 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

Save the settings made in the 5HSRUW�'HVLJQHU.

1RWH�The procedure of creating a new print job and executing that print job from the &RQWURO&HQWHU or runtime, is described in the first example of the 5HSRUW�'HVLJQHU chapter under6HWXS�RI�3ULQW�-RE. The settings can be made correspondingly.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The created layout can be accepted without modifications.

Page 311: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-121C79000-G8276-C140-01

������ 5HSRUWLQJ�RI�7DJ�/RJJLQJ�&6��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

The configuration data of all process value archives created in a project are to bedocumented. The documentation should contain the general archive data and theconfiguration data of the individual archive tags.

,PSOHPHQWDWLRQ�&RQFHSW

Configure a new layout in the 5HSRUW�'HVLJQHU editor. This layout is not based on anyexisting layout.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, create a new layout by 85 on /D\RXW.

The right window will display the new layout, using the default name

1HZ53/���53/, in addition to the already existing ones. 85 on this name andrename the layout to WOJBFV�USO.

2 Open the new layout in the 5HSRUW�'HVLJQHU.

In the properties dialog box of the layout, which is accessed by 85 on a blankarea within the report, select the &RYHU�6KHHW entry from 0LVFHOODQHRXV. Acceptthe remaining settings.

3 In the static part of the report, various 6WDWLF�2EMHFWV and 6\VWHP�2EMHFWV areconfigured for the header and footer.

The design of the cover sheet is a suggestion on which your own concept can bebased.

4 In the dynamic part of the report, a '\QDPLF�2EMHFW�→�'\QDPLF�7DEOH isconfigured. In the example, this is the '\Q7DEOH� object.

After the object is placed in the report, the &RQQHFW dialog box is displayed.Select the 3URFHVV�9DOXH�$UFKLYH entry from the 7DJ�/RJJLQJ�&6 folder. Closethe dialog box by clicking on 2..

Page 312: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-122 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6 In the &RQQHFW tab of the table’s properties dialog box, several selection optionsare available.

8' on one of the entries brings up its corresponding dialog box for selectingdata. If a selection was made, a red check-mark will be displayed.

In the archive selection dialog box of the "Archive Names" entry, select the $OO$UFKLYHV check-box. In the process archive selection dialog box of the "ProcessArchive Data" entry, select all data available.

Save the settings made in the 5HSRUW�'HVLJQHU.

1RWH�The procedure of creating a new print job and executing that print job from the &RQWURO&HQWHU or runtime, is described in the first example of the 5HSRUW�'HVLJQHU chapter under6HWXS�RI�3ULQW�-RE. The settings can be made correspondingly.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The created layout can be accepted without modifications.

Page 313: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-123C79000-G8276-C140-01

������ 3ULQW�2XW�WKH�7UHQG�:LQGRZ�LQ�5XQWLPH��H[B�BFKDSWHUB��D�3'/�

7DVN�'HILQLWLRQ

A trend window is to be printed out in runtime. It should be possible to set a time range forthe data to be printed.This example is based on the ������&\FOLF�6HOHFWLYH�$UFKLYLQJ��H[B�BFKDSWHUB��D�3'/�example in the 7DJ�/RJJLQJ chapter. Its concepts will be utilized to print out the tabledisplayed in this example.

,PSOHPHQWDWLRQ�&RQFHSW

Configure a new layout in the 5HSRUW�'HVLJQHU editor. The time selection is not made in thelayout, but in runtime via a project function. This function will carry out the time selectiondirectly in the print job.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, create a new layout by 85 on /D\RXW.

The right window will display the new layout in addition to the already existing

ones. Rename the layout to WOJB=6B3$B���USO by 85 on it.

2 Open the new layout in the 5HSRUW�'HVLJQHU.

In the static part of the report, various 6WDWLF�2EMHFWV and 6\VWHP�2EMHFWV areconfigured for the header and footer.

3 In the dynamic part of the report, three '\QDPLF�2EMHFWV�→�'\QDPLF�0HWDILOHVare configured. In the example, these are the '\Q0HWDILOH�, '\Q0HWDILOH� and'\Q0HWDILOH� objects.

After placing the objects in the report, the &RQQHFW dialog box is displayed. Forall three objects, select the 7DJ�7UHQG entry from the 7DJ�/RJJLQJ�5XQWLPHfolder. Close the dialog boxes by clicking on 2..

Page 314: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-124 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

4 In the &RQQHFW tab of the '\QDPLF�0HWDILOHV properties dialog box, severalselection options are available.

8' on one of the entries brings up its corresponding dialog box for selectingdata. If a selection was made, a red check-mark will be displayed.

A 7LPH�6HOHFWLRQ will not be performed.

In the $UFKLYH�'DWD�6HOHFWLRQ dialog box, the =6B3URFHVV9DOXH$UFKLYHB��archive is selected. For the '\Q0HWDILOH� object, select the *��BH[BWOJB�� tag asthe archive tag. For the other two objects, set the other two available tags,respectively.

Page 315: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-125C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

Save the settings made in the 5HSRUW�'HVLJQHU.

6HWXS�RI�3ULQW�-RE

6WHS 3URFHGXUH��6HWXS�RI�3ULQW�-RE

1 In the &RQWURO�&HQWHU, 85 on the 3ULQW�-RE entry and select "New Print Job".

The right window will display the new print job using the default name 3ULQW

-RE���, in addition to the already existing print jobs. 8' or 85 on the newprint job to display its properties dialog box.

In the 3ULQW�-RE tab, enter 3ULQWMREB=6B3$B�� in the 1DPH entry field. As the/D\RXW, set the previously created layout WOJB=6B3$B���USO.

In the 6HOHFWLRQ tab, the print range is set. In the 3DJH�5DQJH field, select $OO. Inthe 7LPH�5DQJH field, select $EVROXWH. An exact time range is not set until runtimeis activated.

In the 3ULQWHU�6HWXS tab, the printer to be used is set.

2 In the example project, a print job preview can be displayed via a :LQGRZV2EMHFW�→�%XWWRQ. This is the %XWWRQ�� object in the H[B�BFKDSWHUB��D�3'/.

Create a &�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which activates the

Page 316: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-126 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�3ULQW�-RE

preview of the corresponding print job.

3 To perform a time selection, a setup dialog box is necessary. This dialog box isconfigured as a separate picture. In the example project, this is theH[B�BZLQGRZB���3'/.

In this picture, configure six 6PDUW�2EMHFWV�→�,�2�)LHOGV each for entering thestart and end times. These are the ,�2�)LHOG� to ,�2�)LHOG� objects for setting thestart time, and the ,�2�)LHOG� to ,�2�)LHOG�� objects for setting the end time.

To buffer the made settings, a tag of the 8QVLJQHG����%LW�9DOXH type must becreated for each ,�2�)LHOG in 7DJ�0DQDJHPHQW. In the example, these are the8��LBH[BUHSBI� to 8��LBH[BUHSBI� tags for the start time, and the8��LBH[BUHSBW� to 8��LBH[BUHSBW� tags for the end time.

For each ,�2�)LHOG, a 7DJ�&RQQHFWLRQ to the corresponding tag must be createdvia 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH.

At 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�)RUPDW, the format ��� is set for each,�2�)LHOG. One exception are the ,�2�)LHOGV for setting the year. They use theoutput format �����.

4 In the H[B�BZLQGRZB���3'/, create a &�$FWLRQ at (YHQWV�→�0LVFHOODQHRXV�→2SHQ�3LFWXUH, which supplies the time selection tags with preset time values. Asthe end time, the current system time is set, as the start time, the current systemtime minus one minute is set.

5 Configure two :LQGRZV�2EMHFWV�→�%XWWRQV in the H[B�BZLQGRZB���3'/. In theexample, these are the %XWWRQ� and %XWWRQ� objects.

%XWWRQ� serves as the cancel button. Create a 'LUHFW�&RQQHFWLRQ at (YHQWV�→0RXVH�→�0RXVH�$FWLRQ, which switches the &RQVWDQW of � to the 'LVSOD\ of the&XUUHQW�:LQGRZ.

%XWWRQ� serves as the OK button. It also contains a 'LUHFW�&RQQHFWLRQ at (YHQWV→�0RXVH�→�0RXVH�$FWLRQ for closing the window. Configure a &�$FWLRQ at(YHQWV�→�0RXVH�→�3UHVV�/HIW. This action calls a previously created projectfunction that sets the time selection of a certain print job. The name of the printjob is read from a tag of the 7H[W�7DJ����%LW�&KDUDFWHU�6HW type that must becreated in 7DJ�0DQDJHPHQW. In the example, this is the 7��LBH[BUHSB�� tag.

6 To display the just created picture in the H[B�BFKDSWHUB��D�3'/, a 6PDUW�2EMHFW→�3LFWXUH�:LQGRZ must be created. In the example, this is the 3LFWXUH�:LQGRZ�object. At 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, set theH[B�BZLQGRZB���3'/. Set the 'LVSOD\ to 1R.

7 To display the 3LFWXUH�:LQGRZ, an additional :LQGRZV�2EMHFW�→�%XWWRQ isneeded. In the example, this is the %XWWRQ�� object. Create a &�$FWLRQ for thisbutton at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ, which writes the print job name to

Page 317: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-127C79000-G8276-C140-01

6WHS 3URFHGXUH��6HWXS�RI�3ULQW�-RE

be processed to the 7��LBH[BUHSB�� tag and makes the 3LFWXUH�:LQGRZ� objectvisible.

C-Action at the OK-Button

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){

ModifyPrintJob(TimeFrom(),TimeTo(),GetTagChar("T16i_ex_rep_00"));

}

• Calling of the 0RGLI\3ULQW-RE project function. This project function requires as transferparameters two time values in the form of the SYSTEMTIME structure. These valuesare determined via two project functions from the time values 7LPH)URP�� and7LPH7R�� stored in the internal tags. In addition, the name of the print job to beprocessed is required. This name is stored in the 7��LBH[BUHSB�� tag.

ModifyPrintJob Project Function

BOOL ModifyPrintJob(SYSTEMTIME st1,SYSTEMTIME st2,char jobname[200]){BOOL fRet;PCMN_ERROR pError;HPROPERTIES hProp;LPVOID ptr1,ptr2;DWORD typ;DWORD dwVal;char propname1[200],propname2[200];TCHAR g_szProj[MAX_PATH+1];

typ = VT_DATE;strcpy( propname1, "ABSOLUTESELECTIONFROM");strcpy( propname2, "ABSOLUTESELECTIONTO");ptr1 = (LPVOID)&st1;ptr2 = (LPVOID)&st2;

//-----get project pathif( !DMGetRuntimeProject( g_szProj, MAX_PATH, pError)) {

printf("Error DMGetRuntimeProject(...)\r\n");return FALSE;}

//-----create property handlehProp = RPJCreatePropertyHandle ( g_szProj, pError );if( !hProp) {

printf("Error RPJCreatePropertyHandle(...)\r\n");return FALSE;}

//-----get job propertiesif ( !RPJGetJobProps ( hProp, jobname, pError )) {

printf("Error RPJGetProps(...)\r\n");

Page 318: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-128 WinCC Configuration ManualC79000-G8276-C140-01

RPJDeletePropertyHandle ( hProp, pError);return FALSE;}

//-----set propertyif ( !RPJSetProperty ( hProp, propname1, ptr1,

(VARTYPE) typ, 200, pError )) {printf("Error RPJSetProperty(...)\r\n");RPJDeletePropertyHandle ( hProp, pError);return FALSE;}

//-----save job propertiesif ( !RPJSetJobProps ( hProp, jobname, pError)) {

printf("Error RPJSetProps(...)\r\n");RPJDeletePropertyHandle ( hProp, pError);return FALSE;}

//-----get job propertiesif ( !RPJGetJobProps ( hProp, jobname, pError )) {

printf("Error RPJGetProps(...)\r\n");RPJDeletePropertyHandle ( hProp, pError);return FALSE;}

//-----set propertyif ( !RPJSetProperty ( hProp, propname2, ptr2,

(VARTYPE) typ, 200, pError )) {printf("Error RPJSetProperty(...)\r\n");RPJDeletePropertyHandle ( hProp, pError);return FALSE;}

//-----save job propertiesif ( !RPJSetJobProps ( hProp, jobname, pError)) {

printf("Error RPJSetProps(...)\r\n");RPJDeletePropertyHandle ( hProp, pError);return FALSE;}

//-----delete property handlefRet = RPJDeletePropertyHandle ( hProp, pError);return TRUE;}

• As the transfer parameters VW� and VW�, the function will receive the start and end timesto be set in the form of the SYSTEMTIME structure.

• Determination of the project path using the '0*HW5XQWLPH3URMHFW function.

• Setting and storing of the start time. This is the $%62/8(6(/(&7,21)520 property.

• Setting and storing of the end time. This is the $%62/8(6(/(&7,2172 property.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• In the layout for printing out the trend profiles, the archive to be reported and thearchive tags must be adapted.

• The time selection dialog box can be accepted without modifications. The0RGLI\3ULQW-RE, 7LPH)URP and 7LPH7R project functions are required to ensurefunctionality. The tags for buffering the time values are to be configured using the samenames. Otherwise, the 7LPH)URP and 7LPH7R project functions need to be adapted. Toutilize the dialog box for multiple print jobs, the creation of a text tag for storing theprint job name is advisable.

Page 319: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-129C79000-G8276-C140-01

������ 3ULQWLQJ�2XW�WKH�7DEOH�LQ�5XQWLPH��H[B�BFKDSWHUB��F�3'/�

7DVN�'HILQLWLRQ

A table is to be printed out in runtime. It should be possible to set a time range for the datato be printed.This example is based on the ������8VHU�GHILQHG�WDEOH�OD\RXW��H[B�BFKDSWHUB��F�3'/�example in the 7DJ�/RJJLQJ chapter. Its concepts will be utilized to print out the tabledisplayed in this example.

,PSOHPHQWDWLRQ�&RQFHSW

Configure a new layout in the 5HSRUW�'HVLJQHU editor. The time selection is not made in thelayout, but in runtime via a project function. This function will carry out the time selectiondirectly in the print job.The procedure for making a time selection in runtime is described in the previous 6HWXS�RI3ULQW�-RE table.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, create a new layout by 85 on /D\RXW.

The right window will display the new layout in addition to the already existing

ones. Rename the layout to WOJB=.B3$B���USO by 85 on it.

2 Open the new layout in the 5HSRUW�'HVLJQHU.

In the static part of the report, various 6WDWLF�2EMHFWV and 6\VWHP�2EMHFWV areconfigured for the header and footer.

3 In the dynamic part of the report, a '\QDPLF�2EMHFW�→�'\QDPLF�7DEOH isconfigured. In the example, this is the '\Q7DEOH� object.

After placing the objects in the report, the &RQQHFW dialog box is displayed. Selectthe 7DJ�7DEOH entry from the 7DJ�/RJJLQJ�5XQWLPH folder. Close the dialog boxby clicking on 2..

Page 320: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-130 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

4 In the &RQQHFW tab of the '\QDPLF�0HWDILOHV properties dialog box, severalselection options are available.

8' on one of the entries brings up its corresponding dialog box for selectingdata. If a selection was made, a red check-mark will be displayed. A 7LPH6HOHFWLRQ is not performed.

In the $UFKLYH�'DWD�6HOHFWLRQ dialog box, the =.B3URFHVV9DOXH$UFKLYHB��archive is selected. Select all available columns of the table.

Page 321: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-131C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

Save the settings made in the 5HSRUW�'HVLJQHU.

6HWXS�RI�3ULQW�-RE

6WHS 3URFHGXUH��6HWXS�RI�3ULQW�-RE

1 In the &RQWURO�&HQWHU, 85 on "Print Job" and select "New Print Job".

The right window will display the new print job using the default name 3ULQW

-RE���, in addition to the already existing print jobs. 8' or 85 on the newprint job to display its properties dialog box.

In the 3ULQW�-RE tab, enter 3ULQWMREB=.B3$B�� in the 1DPH entry field. As the/D\RXW, set the previously created layout WOJB=.B3$B���USO.

In the 6HOHFWLRQ tab, the print range is set. In the 3DJH�5DQJH field, select $OO. Inthe 7LPH�5DQJH field, select $EVROXWH. An exact time range is not set until runtimeis activated.

In the 3ULQWHU�6HWXS tab, the printer to be used is set.

2 The procedure for making a time selection in runtime is described in the previousexample in the 6HWXS�RI�3ULQW�-RE table.

Adaptations must be made to the button for the time selection in the&�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH�$FWLRQ. The 7��LBH[BUHSB�� text tag is tobe supplied with the name of the just created print job.

The print job name must be changed in the function call for the button(which activates the print preview) in the &�$FWLRQ at (YHQWV�→�0RXVH�→�0RXVH$FWLRQ.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The created layout can directly be used after making adaptations to the archiveselection.

Page 322: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-132 WinCC Configuration ManualC79000-G8276-C140-01

������ 0HVVDJH�6HTXHQFH�5HSRUW��H[B�BFKDSWHUB��E�3'/�

7DVN�'HILQLWLRQ

A message sequence report is to be created. The user should be able to activate the printingof the report via a button. However, if the messages in the report exceed one layout page,the message sequence report will be printed out automatically.This example is based on the ������0HVVDJH�:LQGRZ��H[B�BFKDSWHUB��E�3'/� example inthe $ODUP�/RJJLQJ chapter. In that example, the toolbar of the message window usedalready provided a button for the report functions, and the message sequence report hasbeen activated.

,PSOHPHQWDWLRQ�&RQFHSW

A system layout and system print job are available, which meet the set requirements. Theseare the #DOUWPHI�USO layout and #5HSRUW�$ODUP�/RJJLQJ�57�0HVVDJH�6HTXHQFH print job.The layout is copied and adapted to meet your own requirements. As the print job, theabove system print job must be used, only its layout is replaced.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, open the #DOUWPHI�USO system layout by 85 on it.

Save this system layout under a new name via )LOH�→�6DYH�$V. In the example,the name DOJBPHI�USO is used.

2 The static part of the report contains a header and a footer.

The elements of the static part can be adapted to meet your own requirements.

3 The dynamic part of the report consists of a '\QDPLF�2EMHFW�→�'\QDPLF�7DEOH("Alarm Logging Runtime" -> "Message Sequence Report"). In the example, thisis the '\Q7DEOH� object.

Open the '\Q7DEOH� object’s properties dialog box and select the &RQQHFW tab.The table is already connected to the 0HVVDJH�6HTXHQFH�5HSRUW of $ODUP/RJJLQJ�5XQWLPH. A selection has also been already performed.

Page 323: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-133C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

4The button or 8' on the 6HOHFWLRQ entry opens the dialog box forselecting message blocks. The 'DWH, 7LPH and 1XPEHU system blocks are already

selected. In the example, clicking on the button adds all remainingmessage blocks.

Close the dialog box by clicking on 2.. Save the layout.

$GDSWLQJ�WKH�3ULQW�-RE

6WHS 3URFHGXUH��$GDSWLQJ�WKH�3ULQW�-RE

1 Open the system print job #5HSRUW�$ODUP�/RJJLQJ�57�0HVVDJH�6HTXHQFH by

8' or 85 on its name (and then selecting "Properties") in the &RQWURO�&HQWHU.

2 In the 3ULQW�-RE tab, set the just created /D\RXW DOUWPHI�USO. In the 3ULQWHU�6HWXStab, set the printer to be used. No further changes need to be made. Close thedialog box by clicking on 2..

3 The message sequence report must be activated in the $ODUP�/RJJLQJ editor.

Open the Alarm Logging editor. 85 on the 5HSRUWV entry and select"Add/Remove" to open the $VVLJQLQJ�5HSRUW�3DUDPHWHUV dialog box.

In this dialog box, select the 0HVVDJH�6HTXHQFH�5HSRUW check-box.

4 If the user does not activate the print job, the message sequence report will beprinted automatically once a layout page has been filled.

Page 324: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-134 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��$GDSWLQJ�WKH�3ULQW�-RE

To allow the user to activate the message sequence report at any time, acorresponding button must be configured in the toolbar of the message windowtemplate. This is the 5HSRUW�)XQFWLRQV button. In the example project, this buttonhas already been configured in the 0HVVDJH:LQGRZB�� template used in theH[B�BFKDSWHUB��E�3'/.

Save the settings made in $ODUP�/RJJLQJ.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed

• In the layout created, the message blocks of the message sequence report must beadapted to meet your needs.

Page 325: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-135C79000-G8276-C140-01

������ 0HVVDJH�6HTXHQFH�5HSRUW�RQ�D�/LQH�3ULQWHU

7DVN�'HILQLWLRQ

A message sequence report is to be created which is suitable for the output of a line printer.If a message to be reported comes in, this message is to be printed automatically.

,PSOHPHQWDWLRQ�&RQFHSW

Create a line printer layout. This layout will be set in the #5HSRUW�$ODUP�/RJJLQJ�570HVVDJH�6HTXHQFH system print job.

&UHDWLRQ�RI�D�/LQH�3ULQWHU�/D\RXW

6WHS 3URFHGXUH��&UHDWLRQ�RI�D�/LQH�3ULQWHU�/D\RXW

1 Create a new line printer layout by 85 on the corresponding entry in the&RQWURO�&HQWHU.

2 A new line printer layout with the default name 1HZ53����53� is created. In the

example, this name is kept. 8' on the name of the new line printer layout (inthe right window), opens the /LQH�/D\RXW�(GLWRU.

In this editor, general settings pertaining to page margins, headers, footers, etc.can be made.

In the 7DEOH field, the button opens a dialog box for selecting themessage blocks to be used in the message sequence report. In the example, allavailable message blocks are selected.

3 The number of columns and their width is automatically adjusted according to theselected message blocks and their order.

Save the settings made and close the line layout editor.

Page 326: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-136 WinCC Configuration ManualC79000-G8276-C140-01

$GDSWLQJ�WKH�3ULQW�-RE

6WHS 3URFHGXUH��$GDSWLQJ�WKH�3ULQW�-RE

1 Open the system print job #5HSRUW�$ODUP�/RJJLQJ�57�0HVVDJH�6HTXHQFH by

8' or 85 on its name (and then selecting "Properties") in the &RQWURO�&HQWHU.

2 In the 3ULQW�-RE tab, select the /LQH�/D\RXW�IRU�/LQH�3ULQWHU check-box and set thejust created /D\RXW 1HZ53����53�. In the 3ULQWHU�6HWXS tab, set the line printerto be used. No further changes need to be made. The dialog box is closed byclicking on 2..

3 The message sequence report must be activated in the $ODUP�/RJJLQJ editor.

Open the Alarm Logging editor. 85 on the 5HSRUWV entry and select"Add/Remove" to open the $VVLJQLQJ�5HSRUW�3DUDPHWHUV dialog box. In thisdialog box, select the 0HVVDJH�6HTXHQFH�5HSRUW check-box.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The desired page settings and message blocks to be printed must be adapted to meetyour needs.

Page 327: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-137C79000-G8276-C140-01

������ 0HVVDJH�$UFKLYH�5HSRUW��H[B�BFKDSWHUB��F�3'/�

7DVN�'HILQLWLRQ

A message archive report is to be created. The user should be able to activate the printing ofthe report via a button.This example is based on the ������0HVVDJH�$UFKLYLQJ��H[B�BFKDSWHUB��F�3'/� examplein the $ODUP�/RJJLQJ chapter. In that example, the user-defined toolbar of the short-termarchive window already provided a button for the report function, and the messagesequence report has been activated.

,PSOHPHQWDWLRQ�&RQFHSW

A system layout and system print job are available, which meet the set requirements. Theseare the #DOUWXPD�USO layout and #5HSRUW�$ODUP�/RJJLQJ�57�5HYROYLQJ�$UFKLYH print job.The layout is copied and adapted to meet your requirements. As the print job, the abovesystem print job must be used, only its layout is replaced.

,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�5HSRUW�'HVLJQHU

1 In the &RQWURO�&HQWHU, open the #DOUWXPD�USO system layout by 85 on it.

Save this system layout under a new name via )LOH�→�6DYH�$V. In the example,the name DOJBXPD is used.

2 The static part of the report contains a header and a footer.

The elements of the static part can be adapted to meet your own requirements.

3 The dynamic part of the report consists of a '\QDPLF�2EMHFW�→�'\QDPLF�7DEOH("Alarm Logging Runtime" -> "Short-Term Archive Report"). In the example,this is the '\Q7DEOH� object.

Open the '\Q7DEOH� object’s properties dialog box and select the &RQQHFW tab.The table is already connected to the 6KRUW�7HUP�$UFKLYH�5HSRUW of $ODUP/RJJLQJ�5XQWLPH. A selection has also been already performed.

4The button or 8' on the 6HOHFWLRQ entry opens the dialog box forselecting message blocks. The 'DWH, 7LPH and 1XPEHU system blocks are already

selected. In the example, clicking on the button adds all remainingmessage blocks.

Close the dialog box by clicking on 2.. Save the layout.

Page 328: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-138 WinCC Configuration ManualC79000-G8276-C140-01

$GDSWLQJ�WKH�3ULQW�-RE

6WHS 3URFHGXUH��$GDSWLQJ�WKH�3ULQW�-RE

1 Open the system print job #5HSRUW�$ODUP�/RJJLQJ�57�5HYROYLQJ�$UFKLYH by

8' or 85 on its name (and then selecting "Properties") in the &RQWURO�&HQWHU.

2 In the 3ULQW�-RE tab, set the just created /D\RXW DOUWXPD�USO. In the 3ULQWHU�6HWXStab, set the printer to be used. No further changes need to be made. The dialogbox is closed by clicking on 2..

3 The archive report must be activated in the $ODUP�/RJJLQJ editor. Open the

Alarm Logging editor. 85 on the 5HSRUWV entry and select "Add/Remove" toopen the $VVLJQLQJ�5HSRUW�3DUDPHWHUV dialog box.

In this dialog box, select the $UFKLYH�5HSRUW�$FWLYH check-box. Save the settingsmade in $ODUP�/RJJLQJ.

4 To allow the user to activate the report at any time, a corresponding button mustbe configured in the toolbar of the message window template. If a user-definedtoolbar is used, the pressing of this button must be simulated my a standardfunction. This would be the standard function 2Q%WQ3ULQW�SV]0VJ:LQ�. In theexample project, this button has already been configured in theH[B�BFKDSWHUB��E�3'/.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• In the layout created, the message blocks of the archive report must be adapted to meetyour needs.

Page 329: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-139C79000-G8276-C140-01

���� 2/(�&RPPXQLFDWLRQ�WR�(;&(/

In runtime, the examples to this topic can be selected by clicking on the button displayed

above with the 8. These examples are configured in the H[B�BFKDSWHUB���3'/ and the2/(B&RPPXQLFDWLRQ�[OV Excel spreadsheet.

Page 330: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-140 WinCC Configuration ManualC79000-G8276-C140-01

������ 5HDGLQJ�DQG�:ULWLQJ�7DJ�9DOXHV��H[B�BFKDSWHUB���3'/�

7DVN�'HILQLWLRQ

The values of internal tags of different types are to be read into an Excel spreadsheet. In asecond column of the spreadsheet, it should be possible to enter set point values for thesetags. These values are then written into the WinCC project.

,PSOHPHQWDWLRQ�&RQFHSW

In a picture, one I/O field is configured for each tag in which the value of the tag can bedisplayed and written.Create a spreadsheet in Excel (Version 8.0). In a column of this spreadsheet, the names ofthe tags to be read and written are entered. Add two buttons to the spreadsheet. Macros areassigned to these buttons, which read the tag names to be processed and either read orassign set point values to these tags.

,PSOHPHQWDWLRQ�LQ�:LQ&&

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�:LQ&&

1 In Tag Management, create tags of several types. In the example, the followingtags are used:

2 In a picture, a 6PDUW�2EMHFW�→�,�2�)LHOG is configured for each tag created. At3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH, create a 7DJ�&RQQHFWLRQ to thecorresponding tag.

Page 331: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-141C79000-G8276-C140-01

,PSOHPHQWDWLRQ�LQ�([FHO��9HUVLRQ�����

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�([FHO

1 Create a new Excel spreadsheet. In the example, this spreadsheet is named2/(B&RPPXQLFDWLRQ�[OV.

In the spreadsheet, fill out a column with the names of the tags to be processed.

2 Configure a button for reading tag values.

For this purpose, activate the &RQWURO�7RROER[ toolbar from the 9LHZ�→�7RROEDUVmenu (if it is not activated yet). Select the "Command Button" element and placeit in the table.

The properties of this control element can be set after clicking on the button.The example uses *HW9DOXH as the name of the object and *HW9DOXH�� as thecaption.

8' on the created command button opens the Visual Basic Editor, where thedetailed procedure code can be entered.

3 Create an additional button, as described in step 2, for writing tag values.

Page 332: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-142 WinCC Configuration ManualC79000-G8276-C140-01

Procedure for Reading Tag Values

Rem Read Tag Values in WinCC-Project

Private Sub GetValue_Click()

Dim mcp As Object Dim var As String Dim value As Variant Dim cell As Variant Dim i As Integer

Set mcp = CreateObject("WinCC-Runtime-Project")

Cell = "C3" i = 1

Do While Not Range(cell) = "" var = Range(cell) value = mcp.GetValue(var) Range("D" & 2 + i).value = value cell = "C" & 3 + i i = i + 1 Loop

End Sub

• Creation of a WinCC object, which is stored in the PFS tag.

• Using a loop, the individual cells of the column (containing the names of the tags to beprocessed) are read. In the WinCC project, the tag values are read using the *HW9DOXH��function and entered into the column next to it. The loop is continued until an emptycell (of the columns containing the tag names) is reached.

Page 333: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-143C79000-G8276-C140-01

Procedure for Writing Tag Values

Rem Set Tag Values in WinCC-Project

Private Sub SetValue_Click()

Dim mcp As Object Dim var As String Dim value As Variant Dim cell As Variant Dim i As Integer Dim bRet As Integer

Set mcp = CreateObject("WinCC-Runtime-Project")

Cell = "C3" i = 1

Do While Not Range(cell) = "" var = Range(cell) value = Range("E" & 2 + i).value bRet = mcp.SetValue(var, value) cell = "C" & 3 + i i = i + 1 Loop

End Sub

• Creation of a WinCC object, which is stored in the PFS tag.

• Using a loop, the individual cells of the column (containing the names of the tags to beprocessed) are read. Additionally, a column, containing the tag values to be set, is read.These tag values are written into the WinCC project using the 6HW9DOXH�� function. Theloop is continued until an empty cell (of the columns containing the tag names) isreached.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• Data is exchanged between WinCC and Excel using the GetValue() and SetValue()functions.

Page 334: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-144 WinCC Configuration ManualC79000-G8276-C140-01

���� $GGLWLRQDO�&RQILJXUDWLRQV�LQ�WKH�([DPSOHV

This chapter describes the additional elements used in some of the pictures. The descriptionof these elements in the examples where they occur would distract from the main topic.This chapter completes the description of the sample projects.

Page 335: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-145C79000-G8276-C140-01

������ 3LFWXUH�5HJLVWHU

7DVN�'HILQLWLRQ

The order of the last 10 selected pictures in the project are to be stored. A "Back" buttonshould allow the selection of these pictures in reverse order. A "Forward" button shouldallow the selection of the current picture.In a separate picture, all pictures of the register are to be displayed in the right order. Adirect selection of the pictures can be made from there.

,PSOHPHQWDWLRQ�&RQFHSW

The picture order is stored in 10 static C-tags of a project function. This project function iscalled at every picture change. It controls the picture selection performed by the "Back" and"Forward" buttons and the direct picture selection.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Two tags of the %LQDU\�7DJ type are required. In the example, these are the%,1LBH[BRUJB�� and %,1LBH[BRUJB�� tags. These tags control the operation ofthe "Forward" and "Back" buttons.

A tag of the 8QVLJQHG����%LW�9DOXH type is required. In the example, this is the8��LBH[BRUJB�� tag. This tag stores the current position in the picture register.

A tag of the 7H[W�7DJ����%LW�&KDUDFWHU�6HW type is required. In the example, thisis the 7��[BH[BRUJB�� tag. This tag stores the current picture name.

2 A project function for controlling the picture register is available. This is the&UHDWH3LFWXUH6HTXHQFH function, which is called at every picture change. This isaccomplished by a &�$FWLRQ at (YHQWV�→�3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→3LFWXUH�1DPH of the :RUNVSDFH object in the H[B�BVWDUWSLFWXUHB���3'/. Everytime a call is made, the new picture name is stored in the register and theremaining names are moved back by one position.

3 In the keyboard layout H[B�BNH\ERDUGB���3'/, two control elements forscrolling backward and forward are configured.

If one of these elements is operated, the &UHDWH3LFWXUH6HTXHQFH project functionwill be called. This function performs the picture change. The two controlelements can be disabled via two 6PDUW�2EMHFWV�→�*UDSKLF�2EMHFWV.

4 The following button displays a picture containing the current picture register. Inthe example, this is the H[B�BUHJLVWHUB���3'/.

In this picture, 10 6WDQGDUG�2EMHFWV�→�6WDWLF�7H[WV are configured. The set text isdeleted at all objects. For the picture object, create a &�$FWLRQ at 3URSHUWLHV�→*HRPHWU\�→�3LFWXUH�:LGWK�, which calls the &UHDWH3LFWXUH6HTXHQFH project

Page 336: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-146 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

function. This function transfers the stored picture names to the 6WDWLF�7H[WV. The&�$FWLRQ is triggered upon the change of the 7��[BH[BRUJB�� tag. This updatesthe display at a picture change.

For each 6WDWLF�7H[W, create &�$FWLRQ at (YHQWV�→�0RXVH�→�3UHVV�/HIW, whichcalls the project function and performs the picture change to the displayedpicture. The selected picture is highlighted in color. This is accomplished via a'\QDPLF�'LDORJ at 3URSHUWLHV�→�&RORUV�→�)RQW�&RORUV of each static text.

5 The project function uses a parameter to identify from where it was called. Forthis parameter, some constants have been defined in the $3'()$3�+ file. Thisfile is located in the /LEUDU\ project folder.

The following constants have been defined:

• #define REG_INSERTPICTURE 0

• #define REG_BACK 1

• #define REG_FORWARD 2

• #define REG_DIRECT 3

• #define REG_SHOWREGISTER 4

Project Function for Controlling the Picture Register

#include "APDEFAP.H"#define MAX_REG 10void CreatePictureSequence(char* PicName,int nFlag,int nPos){static char PictureName[MAX_REG][40] ={"","","","","","","","","",""};int i;static int pos = 0;static int st = 0;static int biz = 0;

if (nFlag==REG_INSERTPICTURE){ if (st == 0 ){ pos = 0; if (biz < MAX_REG) biz++; for ( i=(MAX_REG-1) ; i>0 ; i-- ){ strcpy(PictureName[i],PictureName[i-1]); } strcpy(PictureName[0],PicName); }

Page 337: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-147C79000-G8276-C140-01

else st=0; }if (nFlag==REG_BACK){ pos++; if ( pos > (MAX_REG-1) ) pos=(MAX_REG-1); st = 1; SetPictureName("ex_0_startpicture_00.PDL", "workspace",PictureName[pos]); }if (nFlag==REG_FORWARD){ pos--; if ( pos < 0 ) pos=0; st = 1; SetPictureName("ex_0_startpicture_00.PDL", "workspace",PictureName[pos]); }if (nFlag==REG_SHOWREGISTER){ SetText("ex_9_register_00.PDL", "Static Text1",PictureName[0]); SetText("ex_9_register_00.PDL", "Static Text2",PictureName[1]); SetText("ex_9_register_00.PDL", "Static Text3",PictureName[2]); SetText("ex_9_register_00.PDL", "Static Text4",PictureName[3]); SetText("ex_9_register_00.PDL", "Static Text5",PictureName[4]); SetText("ex_9_register_00.PDL", "Static Text6",PictureName[5]); SetText("ex_9_register_00.PDL", "Static Text7",PictureName[6]); SetText("ex_9_register_00.PDL", "Static Text8",PictureName[7]); SetText("ex_9_register_00.PDL", "Static Text9",PictureName[8]); SetText("ex_9_register_00.PDL", "Static Text10",PictureName[9]); }if (nFlag==REG_DIRECT){ st=1; pos=nPos; }if ((nFlag!=REG_SHOWREGISTER) && (nFlag!=REG_DIRECT)){ if (pos<(biz-1)) SetTagBit("BINi_ex_org_00",FALSE); else SetTagBit("BINi_ex_org_00",TRUE);

if (pos>0) SetTagBit("BINi_ex_org_01",FALSE); else SetTagBit("BINi_ex_org_01",TRUE); }SetTagWord("U16i_ex_org_00",(WORD)pos);}

• If the transfer parameter Q)ODJ has the value of 5(*B,16(573,&785(, the functionwas called by the &�$FWLRQ at (YHQWV�→�3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→�3LFWXUH1DPH of the :RUNVSDFH object in the H[B�BVWDUWSLFWXUHB���3'/. The :RUNVSDFH objectis the picture window in which all the example pictures are displayed. If the picturechange is not to be entered into the register, the VW tag must be set to � in a previousfunction call. The register itself consists of a static array having 10 text tags.

Page 338: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-148 WinCC Configuration ManualC79000-G8276-C140-01

• If the transfer parameter Q)ODJ has the value of 5(*B%$&., the "Back" button hasbeen pressed. The picture change is performed by the function itself and is not enteredinto the register.

• If the transfer parameter Q)ODJ has the value of 5(*B)25:$5', the "Forward" buttonhas been pressed. The picture change is performed by the function itself and is notentered into the register.

• If the transfer parameter Q)ODJ has the value of 5(*B6+2:5(*,67(5, the 6WDWLF7H[WV in the H[B�BUHJLVWHUB���3'/ are to be updated. This is the case if the namedpicture has been selected or if a picture change has been performed in an openedpicture.

• If the transfer parameter Q)ODJ has the value of 5(*B',5(&7, a direct picture selectionvia the 6WDWLF�7H[WV has been performed. The picture change is performed by the&�$FWLRQ at the 6WDWLF�7H[W and is not entered into the register.

*HQHUDO�$SSOLFDWLRQ�1RWHV

For the general application, the following adaptations must be performed:

• The configurations made can be accepted without changes. To ensure functionality, the5 tags used must be created, the project function be incorporated and the controlelements be added.

• If the direct picture selection and the display of the picture register is not needed, thesections 5(*B',5(&7 and 5(*B6+2:5(*,67(5 from the project function can beomitted.

• If the number of stored pictures is to be modified, the definition 0$;B5(* (for themaximum number of pictures) in the project function must be changed.

Page 339: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-149C79000-G8276-C140-01

������ 7DEOH�RI�&RQWHQWV

The example project’s table of contents can be displayed by clicking on the above button

with the 8.

7DVN�'HILQLWLRQ

The entire contents of the project is to be displayed in a dialog box. One window shoulddisplay the main chapters. Another window should display the examples belonging to aselected chapter.It should be possible to directly select an example. The selection should be activated by adouble-click.

,PSOHPHQWDWLRQ�&RQFHSW

The selection of the contents dialog box is made via a button from the overview bar. Thisdialog box is displayed via a picture window. The dialog box contains an additional picturewindow, which displays, depending on the chapter selected, another picture.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Two tags of the 8QVLJQHG����%LW�9DOXH type are required. In the example, theseare the 8��LBH[BFRQB�� and 8��LBH[BFRQB�� tags. These tags store the currentlyselected chapter number and example number.

2 A picture of the dialog box’s layout is available. This is theH[B�BUHJLVWHUB���3'/. For each chapter, a 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W and a6PDUW�2EMHFW�→�*UDSKLF�2EMHFW is configured.

At the opening of the picture, no chapter is selected. The 8��LBH[BFRQB�� tag

has the value of zero. If a 6WDWLF�7H[W is selected with the 8, the correspondingchapter number is written into the tag. Using multiple '\QDPLF�'LDORJV, thecoloring of the selected 6WDWLF�7H[W is changed.

Page 340: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-150 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

3 A separate picture is configured for each chapter, which, depending on theselected chapter number, is displayed in a 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ. If nochapter is selected, the picture window will not be displayed.

Each example also contains a 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W. If a chapter is

selected, no example is selected at first. If a 6WDWLF�7H[W is selected with the 8,the corresponding example number is written into the 8��LBH[BFRQB�� tag.Using multiple '\QDPLF�'LDORJV, the coloring of the selected 6WDWLF�7H[W ischanged.

4 To realize the picture selection via double-click, three external C-tags have beencreated. They are generated using the &UHDWH([WHUQDO project function. Thisfunction is executed once at the start of the project:

• extern BOOL bPress1,bPress2

• extern int nButtonID

A &�$FWLRQ at the picture’s 3URSHUWLHV�→�*HRPHWU\�→�3LFWXUH�:LGWK� queries, in500 ms cycles, if a double-click has been performed. If this is the case, an actionis performed depending on the Q%XWWRQ,' tag.

C-Action at an Example Project

#include "apdefap.h"void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, UINT nFlags, int x, int y){extern BOOL bPress1,bPress2;static BOOL bToggle = FALSE;extern int nButtonID;

nButtonID=1;

if (bToggle) bPress1=TRUE;else bPress2=TRUE;

bToggle=!bToggle;

SetTagWord("U16i_ex_cont_01",(WORD)nButtonID);

}

• The external C-tag is supplied with the identification number of the 6WDWLF�7H[W. Thiswill determine the action to be performed.

• At each mouse click, E3UHVV� and E3UHVV� are alternately set to 758(.

Page 341: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-151C79000-G8276-C140-01

C-Action to Determine a Double-Click

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){extern BOOL bPress1,bPress2;extern int nButtonID;

if ((bPress1)&&(bPress2)) switch(nButtonID){ case1:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01.PDL"); break; case2:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01a.PDL"); break; case3:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01b.PDL"); break; case4:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01c.PDL"); break; case5:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01d.PDL"); break; case6:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01e.PDL"); break; case7:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01f.PDL"); break; case8:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01g.PDL"); break; case9:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01i.PDL"); break; case10:SetPictureName("ex_0_startpicture_00.PDL", "workspace","ex_3_chapter_01j.PDL"); break; default:break; }

bPress1=FALSE;bPress2=FALSE;

return 242;}

• The two external C-tags are queried. If both have the status of 758(, a double-click hasbeen performed on a 6WDWLF�7H[W in the past 500 ms. The &�$FWLRQ is executed every 500ms. After every call, both external C-tags are reset to )$/6(.

• If a double-click is detected, an action is performed depending on the Q%XWWRQ,' tag.This tag contains information about which 6WDWLF�7H[W was selected.

• Return of the picture width.

Page 342: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-152 WinCC Configuration ManualC79000-G8276-C140-01

������ 'LDORJ�%R[HV�IRU�6HWWLQJ�&RORUV��H[B�BFKDSWHUB��F�

The dialog boxes for setting colors described in this example are displayed by selecting the

above button from the H[B�BFKDSWHUB��F�3'/ with the 8.

7DVN�'HILQLWLRQ

Using several dialog boxes, the color settings of the table described in the 7DJ�/RJJLQJchapter, example ������8VHU�GHILQHG�WDEOH�OD\RXW��H[B�BFKDSWHUB��F�3'/�, can be changed.The background color of the table as well as each column’s font color are to be changeable.

,PSOHPHQWDWLRQ�&RQFHSW

The setting colors dialog boxes are realized using three pictures. The first picture, which isdisplayed by pressing on the button above, shows a dialog box containing the current colorsettings. From this dialog box, a dialog box for selecting a color from among the 16 basic

colors can be displayed for each settable table property via a 8'. From this dialog box inturn, an additional dialog box can be reached for selecting a color from a total of 50 colors.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Five tags of the 8QVLJQHG����%LW�9DOXH type are used. In the example, these arethe &2B7,0(, &2B0$;, &2B0,1, &2B0($1 and &2B%$&. tags. These tagsstore the current color values.

A tag of the 8QVLJQHG����%LW�9DOXH type is required. In the example, this is the&2B7(03 tag. This tag serves as a buffer for the color value to be accepted withan 2.�%XWWRQ.

A tag of the 7H[W�7DJ����%LW�&KDUDFWHU�6HW type is used as an address tag. Thename of the color tag to be processed is stored in this tag. In the example, this isthe &2B$GGUHVV7DJ.

2 The table configured in the H[B�BFKDSWHUB��F�3'/ consists of several individualobjects. All properties of these objects that are changeable have a 7DJ&RQQHFWLRQ to one of the color tags.

3 A picture of the first dialog box’s layout is available. This is theH[B��B)'B���3'/. For each property that can be set, a 6WDQGDUG�2EMHFW�→6WDWLF�7H[W and a 6WDQGDUG�2EMHFW�→�5HFWDQJOH is configured.

The rectangle displays the currently set color of each property. This is realizedvia a 7DJ�&RQQHFWLRQ to the corresponding color tag. Create a &�$FWLRQ for the5HFWDQJOHV and 6WDWLF�7H[WV at (YHQWV�→�0RXVH�→�3UHVV�/HIW, which writes thename of the corresponding color tag into the address tag.

Double-clicking on one of these rectangles opens a dialog box for selecting acolor from among the 16 basic colors. The double-click is queried at 3URSHUWLHV→�*HRPHWU\�→�3RVLWLRQ�; of the *UDSKLF�2EMHFW�.

Page 343: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-153C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

4 The layout of the second dialog box has been configured in another picture. Thisis the H[B��B)'B���3'/. For each color that can be selected, a 6WDQGDUG�2EMHFW→�5HFWDQJOH is configured whose background color matches the color to be set.

Also configure a 'LUHFW�&RQQHFWLRQ for each color at (YHQWV�→�0RXVH�→�3UHVV/HIW. This direct connection switches the value of the %DFNJURXQG�&RORU 3URSHUW\of the selected object to the color tag contained in the address tag.

Configure a 'LUHFW�&RQQHFWLRQ for each 5HFWDQJOH at (YHQWV�→�0RXVH�→�0RXVH$FWLRQ, which turns the current window invisible.

Via a separate :LQGRZV�2EMHFW�→�%XWWRQ, the next dialog box can be opened.

Page 344: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-154 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

5 The layout of the third dialog box has been configured in another picture. This isthe H[B��B)'B���3'/. Just as described in step 4, a 6WDQGDUG�2EMHFW�→5HFWDQJOH is configured for each color that can be selected. However, the 'LUHFW&RQQHFWLRQ at (YHQWV�→�0RXVH�→�3UHVV�/HIW is not writing the color tagindicated by the address tag, but the temporary color tag &2B7(03.

The value contained in this tag will only be written to the processing color tagafter activation of the OK button.

In the picture, a 6PDUW�2EMHFW�→�*UDSKLF�2EMHFW is configured, which displaysthe current color value contained in the &2B7(03 tag. In the example, this is the6HOHFWLRQ object. The position of this object is changed, if a rectangle is selected,via a &�$FWLRQ at (YHQWV�→�0RXVH�→�3UHVV�/HIW.

6 In the H[B�BFKDSWHUB��F�3'/, a 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ is configuredfor each dialog box. The 3LFWXUH�:LQGRZ containing the first dialog box isopened via a :LQGRZV�2EMHFW�→�%XWWRQ.

Page 345: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 6DPSOH�3URMHFW���H[DPSOHB��

WinCC Configuration Manual 4-155C79000-G8276-C140-01

������ %DU�*UDSK�'LVSOD\��H[B�BFKDSWHUB��H�

The bar graph display described in this example was used in the 7DJ/RJJLQJ chapter, �����$UFKLYLQJ�DW�6HW�7LPHV��H[B�BFKDSWHUB��H�3'/� example.

7DVN�'HILQLWLRQ

The current values of the tags archived in a corresponding picture are to be displayed usingthree bar graphs. It should be possible to deactivate each bar graph via a button.

,PSOHPHQWDWLRQ�&RQFHSW

Each bar graph consists of a 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\, which displays the foregroundof the bar graph, and a 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ, in which the background of thebar graph is displayed. A '\QDPLF�'LDORJ controls the height of the 3LFWXUH�:LQGRZdepending on the value of the tag to be displayed.

,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

1 Three pictures are available, each consisting of a 6PDUW�2EMHFW�→�*UDSKLF2EMHFW. These are the H[B��B%+B���3'/, H[B��B%+B���3'/ andH[B��B%+B���3'/. Each *UDSKLF�2EMHFW contains a bitmap, which displays thebackground of the bar graph.

2 In the H[B�BFKDSWHUB��H�3'/, three 6PDUW�2EMHFWV�→�6WDWXV�'LVSOD\V areconfigured, which display the foreground of each bar graph. If the bar graph isdeactivated, the background of the bar graph is displayed.

3 A 6PDUW�2EMHFW�→�3LFWXUH�:LQGRZ is placed over each 6WDWXV�'LVSOD\. Thepictures described in step 1 are set at 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH1DPH.

Configure a '\QDPLF�'LDORJ at 3URSHUWLHV�→�*HRPHWU\�→�:LQGRZ�+HLJKW,which controls the height of the picture window depending on the value of the tagto be displayed.

Page 346: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

6DPSOH�3URMHFW���H[DPSOHB�� �����

4-156 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�WKH�*UDSKLFV�'HVLJQHU

Only positive values can be displayed. Therefore, the absolute value of the tag isformed using the DEV�� function. The maximum value that can be displayed is100. Since the 3LFWXUH�:LQGRZ displays the background of the bar graph, the tagvalue must be subtracted from the maximum value to maintain the backgroundheight. One unit of the bar graph consists of 3 pixels in the bitmap, therefore thecalculated height of the bar graph height must be multiplied by 3. Above the bargraph background, there are 14 free pixels, which must be added to the pictureheight.

4 Via three 6PDUW�2EMHFWV�→�6WDWXV�GLVSOD\V on the toolbar, the bar graphs can bedeactivated. This is done via &�$FWLRQ at (YHQWV�→�0RXVH�→�3UHVV�/HIW. This&�$FWLRQ toggles the visibility of the SLFWXUH�ZLQGRZ, toggles the visibility of thepicture displayed in the status display (which displays the bar graph), and togglesthe picture displayed by its own object.

Page 347: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-1C79000-G8276-C140-01

��8VHU�$UFKLYH

This manual describes the way in which the new User Archive works and the procedure forconfiguring and using it.

Page 348: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-2 WinCC Configuration ManualC79000-G8276-C140-01

���� 8VHU�$UFKLYH

At runtime you can access the examples concerning this subject by choosing the button

illustrated above using the 8 in the H[DPSOHB8$ project. The examples are configured inpictures H[B�BFKDSWHUB���SGO to H[B�BFKDSWHUB��F�SGO.

*HQHUDO�LQIRUPDWLRQ

User Archive makes a database available for storing data in a user-defined tabular structure.

These data can be transferred to a subordinate PLC in different ways. You can use WinCCtags and WinCC raw data tags for communication with the PLC. User Archive can also beconfigured without communication, however.

At the present time four data types are available for the different data fields. They are:

• number (integer)

• number (double)

• string

• date/time

An OLE control can be used to display the data of User Archive at runtime in tabular form.This OLE control can further be used, among other things, to edit the data of User Archive,write them to the PLC, read them from the PLC, export them to a CSV file and import themfrom a CSV file. Displayed data can be filtered according to different criteria and sortedaccording to your specific requirements.The OLE control has a freely configurable toolbar and status bar. Different display formatscan be assigned to the various columns of the table.

By configuring views, you can display fused data from different archives.

Page 349: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-3C79000-G8276-C140-01

������ &UHDWLQJ�D�8VHU�$UFKLYH��H[B�BFKDSWHUB���3'/�

7DVN�GHILQLWLRQ

You wish to create an archive having data records consisting of five integer boxes and atext box for storing a data record name. You want the data of the archive to be availablerecord for record throughout the project.

,PSOHPHQWDWLRQ�FRQFHSW

An archive is created in the user archive editor for archiving the data. Archivecommunications will be configured with WinCC tags. Six data fields of the requisite fieldtypes will be created in the archive. An internal WinCC tag will be assigned to each datafield and will be used by the archive to communicate with the rest of the project.

1RWH�The following example is a general description of the procedure for configuring a userarchive. A connection is not established to the subordinate PLC and, instead, internalWinCC tags will be used to demonstrate the method of working.Examples containing a fully configured connection will be found further below.

&UHDWLQJ�DQ�DUFKLYH

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

1 Create one internal tag for each data record in the archive. Communicationsbetween the archive and the rest of the system will take place by means of thesetags.

In the example, use is made of tags 6��LBH[B8$LB�� to 6��LBH[B8$LB�� of theVLJQHG����ELW�YDOXH type. Further, a type ��ELW�IRQW�WH[W�WDJ is created for storingthe data record name. In our example, this is tag 7��LBH[B8$LB��.

2 Open the XVHU�DUFKLYH�HGLWRU. You do this by clicking 85 on the entry called8VHU�$UFKLYH in &RQWURO�&HQWHU.

3 Create a new archive. Click 85 on the $UFKLYH entry to start a wizard. Thiswizard guides the user through the process of creating a new archive.

Page 350: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-4 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

4 Fill out the wizard’s page called *HQHUDO�,QIRUPDWLRQ. At this stage you givegeneral details about the archive you want to create.

You have to enter the DUFKLYH�QDPH. The archive name length may be as many as20 characters. You must not use any ANSI C (programming language) or SQL(database query language) keywords. In our example, we enter 8VHU�$UFKLYHBL asthe name in the $UFKLYH�1DPH box.

In the $OLDV box, we can enter a piece of text that describes the archive in greaterdetail. All alpha and numeric entries are accepted in this box. Completion of thisbox is optional, however. In our example, we will leave the $OLDV box blank.

Further, we have to select the DUFKLYH�W\SH. If this is set to /LPLWHG, we will haveto specify the maximum number of GDWD�UHFRUGV that the archive will be allowedto hold. In our example, we will set 8QOLPLWHG as the DUFKLYH�W\SH.

The wizard’s page is closed by clicking 1H[W.

5 Fill out the wizard’s &RPPXQLFDWLRQV page. At this stage we have to specify howour new archive will communicate with the rest of the project.

If we select &RPPXQLFDWLRQV�YLD�:LQ&&�5DZ�'DWD�7DJ, we have to set a WinCCraw data tag on this page. A complete data record is transferred via this set tagwith this type of communication. Further, we have to enter a 3/&,', which maycontain up to eight characters. This ID can be used to assign a block of raw datathat has been sent by the programmable logic controller to a specific archive.

If we select &RPPXQLFDWLRQV�YLD�:LQ&&�7DJ�V�, we will have to assign a WinCCtag to every data field in the archive. However, we cannot do this until we createthe corresponding data fields.

Further, there is the possibility of configuring an archive with the option 1R&RPPXQLFDWLRQV.

In the present example, we select 7\SH as &RPPXQLFDWLRQV�YLD�:LQ&&�7DJ�V�.

The wizard’s page is closed by clicking 1H[W.

Page 351: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-5C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

6 Fill out the wizard’s &RQWURO�7DJV page. Here you can set four internal or externalWinCC tags. The archive can be controlled at runtime by means of these tags.

In our example, we will not use the control tags options. The example used in������:RUNLQJ�ZLWK�&RQWURO�7DJV��H[B�BFKDSWHUB����3'/� contains a detaileddescription of this subject.

The wizard’s page is closed by clicking 1H[W.

7 Fill out the wizard’s 3ULYLOHJHV�DQG�)ODJV page.

In the 3ULYLOHJHV box, we can set authorization levels for the UHDG and ZULWH types

of access. Clicking the button opens a dialog box containing a listof all the authorization levels created using the 8VHU$GPLQLVWUDWRU editor. Youcan choose the authorization level you require from the list. Section ����6KXWGRZQ:LQ&&���DFFHVV�SURWHFWLRQ contains an in-depth description of configuring usersand authorization levels with the 8VHU$GPLQLVWUDWRU editor.

Pre-defined columns can be inserted into the archive in the )ODJV box. A columnis available for storing the date when the data record was last accessed. Further,there is a column for saving the name of the last user to access the data record.

Page 352: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-6 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

In our example, we will not perform any settings on this page of the wizard.

The wizard’s page is closed by clicking )LQLVK.

8 The archive you have just configured now appears in the tree structure under theentry $UFKLYHV.

Click 85 on the entry of the new archive or the button while the entry isselected to open the Properties dialog box of the archive. The dialog box showsall the wizard’s pages and the details we made on them in the form of tabs. Inaddition, there is another tab for setting the archive order. However, there is onlya single archive at this stage of configuration.

Page 353: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-7C79000-G8276-C140-01

1RWH�By default, the user archive editor is set such that when you have completed one archiveyou are prompted as to whether you wish to create another one. This feature can bemodified by choosing (GLW�→�2SWLRQV from the menu and deselecting the correspondingcheck box. The same applies to boxes, views and columns.

&RQILJXULQJ�GDWD�ILHOGV

6WHS 3URFHGXUH��&RQILJXULQJ�'DWD�)LHOGV

1 Create the individual boxes of the archive. Click 85 on the entry of the newarchive to start a wizard. This wizard guides the user through the process ofcreating a new box.

2 Fill out the wizard’s page called *HQHUDO�,QIRUPDWLRQ. At this stage you providegeneral details about the box you want to create.

You have to enter the ER[�QDPH. The box name is subject to the same constraintsas the archive name. In our example, we will use the name 5HFRUG1DPH as theER[�QDPH.

In the $OLDV box, you can enter a long name that is not subject to any constraints.If a name is entered in the $OLDV box, it is used at runtime as a column heading. Ifyou do not enter a name, the ER[�QDPH is used as the column heading. There isalso the possibility of entering the DOLDV directly or of using a reference to a textin the WH[W�OLEUDU\. The second possibility is sensible only when you want tocreate multi-lingual projects.

Clicking the button opens a dialog box for entering text in the WH[WOLEUDU\ or selecting text from the WH[W�OLEUDU\. Text entered in the 7H[W box isentered in the WH[W�OLEUDU\ by clicking 2.. The DOLDV used is then a reference tothis text.

You can search for existing text in the 6HOHFW box, too. When doing so, you entera word or a piece of text that you require to be contained in the text you arelooking for as a ILOWHU. In this case the � character is used a wildcard character. Ifyou just enter �, the whole contents of the WH[W�OLEUDU\ is displayed in the list

box. Clicking 8 on the list box updates its contents.

In our example, we will enter ER[�QDPH as WH[W. Close the 7H[W�/LEUDU\ dialog boxby clicking 2..

Page 354: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-8 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�'DWD�)LHOGV

Further, we have to select the W\SH of box. At the present time the types availableare QXPEHU�LQWHJHU�, QXPEHU�GRXEOH�, VWULQJ and GDWH�WLPH. In our example, wewill set the W\SH of box to VWULQJ. We also have to set the string OHQJWK for thistype. In our example, we will set the value to ��.

The wizard’s page is closed by clicking 1H[W.

3 Fill out the wizard’s page called 9DOXHV. Here we can set numeric box types to0D[LPXP, 0LQLPXP and also 6WDUW�9DOXH. In the case of text boxes, we can entera default value for the VWDUW�YDOXH that is dependent upon the defined length.

If &RPPXQLFDWLRQ�YLD�:LQ&&�7DJ�V� has been configured, we have to set acorresponding tag for every box. In our example, we will select the text tag called7��LBH[B�8$LB��, which we configured earlier.

The wizard’s page is closed by clicking 1H[W.

Page 355: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-9C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�'DWD�)LHOGV

4 Fill out the wizard’s 3ULYLOHJHV�DQG�)ODJV page.

In the 3ULYLOHJHV box we can set authorization levels for the UHDG and ZULWH typesof access. The authorization levels set at this stage refer to a single box. It istherefore possible to protect individual boxes from unauthorized access.

In the )ODJV box, we can assign various properties to the box. The followingproperties can be assigned:

• The PXVW�KDYH�D�YDOXH, which was must not be zero.

• The PXVW�KDYH�D�XQLTXH�YDOXH, the values of this column must all differ fromeach other.

• The ER[�VKRXOG�EH�VXSSRUWHG�E\�DQ�LQGH[.In our example, we will not perform any settings on this page of the wizard.

The page is closed by clicking )LQLVK.

5 In our example, let us now create five more boxes. We want them to beQXPEHU�LQWHJHU� type boxes. The names of the boxes will range from 3UHVVXUHBDto 3UHVVXUHBH; the aliases of the boxes will range from 3UHVVXUH� to 3UHVVXUH�. A

Page 356: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-10 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�'DWD�)LHOGV

VLJQHG����ELW�WDJ, which we created earlier, will be set as the tag. The remainingbox settings will be similar to those of the first box.

The new boxes are displayed in the list when 8VHU�$UFKLYHBL archive is selectedin the tree structure.

6Click 85 on the entry of a box or the button while the box is selected toopen the Properties dialog box associated with the box. The dialog box shows allthe wizard’s pages and the details we provided on them in the form of tabs. Inaddition, there is another tab for setting the archive box order.

7Save the configurations you have performed. To do this, you can use the button on the toolbar or you can choose 3URMHFW�→�6DYH from the menu.

When doing so, make sure that the XVHU�DUFKLYH�HGLWRU is not in the mode forentering data in the different archives. This means that you must not click the

button. Only then can you apply the configuration data to the database.

Page 357: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-11C79000-G8276-C140-01

������ 'DWD�(QWU\��H[B�BFKDSWHUB���3'/�

7DVN�GHILQLWLRQ

The present example is based on the previous example ������&UHDWLQJ�D�8VHU�$UFKLYH�H[B�BFKDSWHUB���3'/�.We want to supply the archive we created earlier with data. In doing so, we want to availourselves of the possibilities provided by direct data entry in the user archive editor and thatof data import from an external file.

'DWD�HQWU\�LQ�WKH�XVHU�DUFKLYH�HGLWRU

6WHS 3URFHGXUH��'DWD�(QWU\�LQ�WKH�8VHU�$UFKLYH�(GLWRU

1 Open the user archive editor. Before we can enter data records in an archive, we

have to select it in the left tree structure with 8.

2 Switch the archive to Runtime Data mode. You do this by clicking the button onthe toolbar or by choosing (GLW�→�5XQWLPH�'DWD from the menu. The data of anarchive can be modified in this mode only.

A blank table, whose columns correspond to the data structure of the archive weconfigured, appears in the lower table window.

3 Enter the data. Before we can enter data in a box, we have to select the box by

8'. If the focus is in the table window, entry of a new data record can be

initiated by clicking the button on the toolbar.

4If the focus is in the table window and if you click the button on the toolbar,

the table window is in Change mode. It suffices to select a box with the 8 inorder to enable data entry.

If the focus is in the table window, you can delete the currently selected data

record by clicking the button on the toolbar. You cannot delete more thanone data record at a time.

Page 358: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-12 WinCC Configuration ManualC79000-G8276-C140-01

,PSRUWLQJ�GDWD�IURP�&69�ILOHV

6WHS 3URFHGXUH��,PSRUWLQJ�'DWD�IURP�&69�)LOHV

1 Determine the structure of an import file. To do this, we need to export data

records, which we entered earlier, to a CSV file. We do this by clicking the button on the toolbar. The ([SRUW dialog box is displayed.

In the )LOH�6HOHFWLRQ box, we specify the name of the file to which we wish to

export our archive data records. Click the button to select an existing file.In our example, the file we will set in the )LOH�6HOHFWLRQ box is the one calledH[B8$L�FVY.

We leave &69 (comma separated values) set as the file format. We can modify

the separator used for the file by clicking the button. In ourexample, we will keep to the default semicolon, however.

In the $UFKLYH�6HOHFWLRQ box we set the 8VHU�$UFKLYHBL archive.

We will keep $OO as the ILOWHU so that all the data stored in the archive areexported. There is also the possibility of setting a filter to the values of a specific

Page 359: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-13C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSRUWLQJ�'DWD�IURP�&69�)LOHV

box or making a selection by means of an SQL expression.

Clicking the button starts the export operation of the data to thefile we selected.

2 The file we just selected can be opened only with a text editor of somedescription. In our example, the file was opened with the Microsoft editor. It willbe retained for importing the necessary file structure.

When creating a file which you want to use as a basis for importing data, makesure the quotation marks enclosing text boxes are removed, since otherwiseerrors will occur during the import operation. Existing data records are notoverwritten during the import operation. Data records are identified by the IDsdisplayed in the first column. Imported files should contain only data recordshaving IDs that have not been assigned so far.

3 There is now the possibility of opening and editing the file we received in Excel.In Excel’s Open dialog box, change the file type setting from 0LFURVRIW�([FHO)LOHV to WH[W�ILOHV.

The different boxes in the archive are then displayed in such a manner that theyare distributed over various columns in a table. Various new data records can becreated in a user-friendly manner as illustrated below.

In our example, we will now save the file by choosing )LOH�→�6DYH�$V��� from themenu as LPB8$L�FVY. Excel automatically removes the quotation marksencompassing the text boxes during the operation. We can now exit Excel. Thefinal query on the save operation can be answered by selecting 1R, since the datahave already been saved in a new file.

4Import the data into the user archive editor. We do this by clicking the button on the toolbar. The Import dialog box opens.

Page 360: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-14 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSRUWLQJ�'DWD�IURP�&69�)LOHV

In the )LOH�6HOHFWLRQ box, we set the file receiving the data by clicking the button. In our example, the file we set in the )LOH�6HOHFWLRQ box will be the onewe created earlier, in other words LPB8$L�FVY.

In the )LOH�)RUPDW box, we left &69 as it was. Click the button tospecify the separator to be used in the file. In our example, we can keep to thedefault semicolon, however.

We set the destination archive in the $UFKLYH�6HOHFWLRQ box; In our example, itwill be 8VHU�$UFKLYHBL.

The data import operation is started by clicking the button.

5 Imported data are written directly to the database. They therefore do not have tobe saved separately.

1RWH�During the import operation, make sure the file is not still open in Excel. If it is, an errorwill occur. The same error message is issued when the file contains existing data records orthe file structure of the file does not match that of the archive.

Page 361: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-15C79000-G8276-C140-01

������ &RQILJXULQJ�D�7DEOH�9LHZ��H[B�BFKDSWHUB���3'/�

7DVN�GHILQLWLRQ

The present example is based on the two preceding examples, ������&UHDWLQJ�D�8VHU$UFKLYH��H[B�BFKDSWHUB���3'/� and ������'DWD�(QWU\��H[B�BFKDSWHUB���3'/�.The data of the archive configured in these examples are required to be made available tothe user at runtime. The archive data are to be displayed in tabular form.

,PSOHPHQWDWLRQ�FRQFHSW

The archive will be displayed at runtime by means of a special OLE control. The data willbe displayed in tabular form. Using the control it will be possible to place various editoptions for the archive at the disposal of the user.

,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

1 Open *UDSKLFV�'HVLJQHU and create a new picture. In our example, this is thepicture called H[B�BFKDSWHUB���SGO.

2 Configure an OLE control at 6PDUW�2EMHFW�→�2/(�&RQWURO. The ,QVHUW2OH�&RQWURO dialog box is opened.

In this dialog box, we select the entry :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO fromthe list of available OLE controls and close the dialog box by clicking 2.. Thedeactivated :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO appears. In our example, we usethe object called 2/(�&RQWURO�.

3 Click 8' on the object known as 2/(�&RQWURO� to open its Properties dialogbox.

Page 362: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-16 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

4 On the *HQHUDO�,QIRUPDWLRQ tab, we select the $UFKLYH option in the 6RXUFH box.In the present example, we cannot select 9LHZ since we have not configured anyviews as yet. The archive we select is 8VHU�$UFKLYHBL.

In the (GLW box, we can set the edit options for the archive that the user will beable to access. In our example, we will make the full range of edit optionsavailable to the user.

We can display the OLE control with %RUGHU. In addition, we can also display theobject in form view. In our example, we select the %RUGHU check box. But we donot select the )RUP check box.

5 We can select the data fields, which we want to have displayed in the table, onthe &ROXPQV tab. In our example, we select all the boxes available.

Further, there is the possibility of setting certain properties for every data field inthe 3URSHUWLHV box. In our example, however, we will leave the default settingsfor all the data fields as they are.

Page 363: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-17C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6 On the 7RROEDU tab, we can configure the elements we require on the toolbar. Inour example, we will leave all the functions selected. There is the possibility ofassigning an authorization level to every button on the toolbar so that it can beoperated only by authorized users.

If the &OHDU check box is selected, the toolbar is not displayed. If, however, onlyindividual buttons are deselected from the list by means of the check boxes, theywill be displayed nevertheless, though it will not be possible to operate them.

7 On the 6WDWXV�%DU tab, we can set the status bar to look as we wish it to. In ourexample, we will leave all the elements selected.

If the &OHDU check box is selected, the status bar is not displayed.

Page 364: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-18 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

8 On the )RQWV tab, we can customize the font used by the OLE control. In ourexample, we will reduce the VL]H of the font to ���� in order to be ablesimultaneously to display all the columns of the table at runtime. We will leaveall the other settings as they are.

9 On the )LOWHU�6RUW tab, we will not perform any settings for our example. You canset filters and sorts at runtime, too, if the corresponding buttons have beenprovided on the toolbar.

10 On the &RORUV tab, we can modify the colors of individual elements in a table. Aconvenient place for settings colors, especially when more than 16 colors arerequired to be available, is the 2/(�&RQWURO� object Properties dialog boxprovided by WinCC.

Page 365: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-19C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

11 Complete the settings in the 3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWUROdialog box by clicking 2..

12 Set the table color scheme. Click 85 to open the Properties dialog box of the2/(�&RQWURO� object.

In our example, we will adapt the colors *ULG%DFN&RORU, %DFN&RORU and+HDGHU%DFN&RORU to the color scheme used in the project. The default settingswill be applied for the remaining colors.

There is a possibility of performing almost all the other settings performed in the3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO dialog box at this stage as well.This is not practical for some setting options, however.

Page 366: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-20 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

4 We can check some of the configurations we have performed in *UDSKLFV

'HVLJQHU. Click 8' on the 2/(�&RQWURO� object while keeping CTRL pressedto open the object.

5 Configure five pointer-type instruments to display the tags that have to be writtenby 8VHU�$UFKLYH. These are :LQ&&�JDXJH�FRQWURO type OLE controls configuredat 6PDUW�2EMHFWV�→�2/(�&RQWUROV. In our example, these are objects 2/(&RQWURO� to 2/(�&RQWURO�.

Page 367: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-21C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

At each of the objects, we create a WDJ�FRQQHFWLRQ to one of the five integer tagsthat have to be written by the archive at 3URSHUWLHV�→�2/(�&RQWURO�3URSHUWLHV�→9DOXH.

To be in a position to simulate a change of the values of these tags, five sliderobjects are configured at 6PDUW�2EMHFWV�→�6OLGHU�2EMHFWV. In our example, theseare objects�6OLGHU�2EMHFW� to 6OLGHU�2EMHFW�.

At each of these objects, we create one WDJ�FRQQHFWLRQ to one of thecorresponding tags at 3URSHUWLHV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU&RQQHFWLRQ. Further, a GLUHFW�FRQQHFWLRQ to the same tag is created at (YHQW�→3URSHUW\�7RSLFV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ�→�&KDQJH. Forthese GLUHFW�FRQQHFWLRQV, the VRXUFH WKLV�REMHFW�→�3URFHVV�'ULYHU�&RQQHFWLRQ�isconnected to the GHVWLQDWLRQ of the corresponding WDJ. This is performed so that achange of the tag value is achieved for every change in the position of the slider.

6 We configure a standard object at 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W to display thedata record that is currently being loaded to the tags. In our example, we use theobject called 6WDWLF�7H[W�. At this object, we create a WDJ�FRQQHFWLRQ to7��LBH[B8$LB�� tag containing the name of the data record at 3URSHUWLHV�→�)RQW→�7H[W.

If the tag still does not contain text when a picture is opened, a data record hasnot been loaded as yet, and we want this to be displayed likewise. This isperformed by means of a &�DFWLRQ at picture object H[B�BFKDSWHUB�� by selecting(YHQW�→�0LVFHOODQHRXV�→�2SHQ�3LFWXUH. This &�DFWLRQ writes the words 1R�GDWDUHFRUG to the tag if it is blank.

Page 368: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-22 WinCC Configuration ManualC79000-G8276-C140-01

1RWHV�RQ�JHQHUDO�XVH

The OLE control toolbar buttons illustrated below perform the following tasks at runtime:

• You can toggle between table view and form view at runtime by means of theForm button.

• You can modify archive data at runtime, too, using the edit buttons. Youcan delete and modify data records, or add new ones. The extent to which the user isauthorized to modify data will depend on the OLE control settings in *UDSKLFV'HVLJQHU.

• Using the navigation buttons, you can move in the table and selectdifferent data records. Selection of data records also works by directly selecting datarecords with the mouse.

• The data transfer buttons are used to read and write data. The :ULWH�7DJVbutton is used to write the data record selected in the table to the tags set in 8VHU$UFKLYH. The 5HDG�7DJV button is used to read in the current values of the tag set in8VHU�$UFKLYH to the data record selected in the table.

• We can use the Export and Import buttons to export archive data to CSV files,or import new data from CSV files. The buttons have the same function as thecorresponding buttons in the user archive editor. The procedure for importing andexporting data is described in the example contained in ������'DWD�(QWU\�H[B�BFKDSWHUB���3'/�.

• We can use the )LOWHU and 6RUW buttons to define the data records we want tohave displayed and the order in which we want to have them displayed. These settingsfor OLE control can also be performed in *UDSKLFV�'HVLJQHU.

Page 369: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-23C79000-G8276-C140-01

������ &RQILJXULQJ�D�)RUP�9LHZ��H[B�BFKDSWHUB����3'/�

7DVN�GHILQLWLRQ

The present example is based on the two preceding examples, ������&UHDWLQJ�D�8VHU$UFKLYH��H[B�BFKDSWHUB���3'/� and ������'DWD�(QWU\��H[B�BFKDSWHUB���3'/��.The data of the archive configured in these examples are required to be made available tothe user at runtime. We want the archive data to be displayed as a form, by means of whichit will be possible to display one data record at a time.

,PSOHPHQWDWLRQ�FRQFHSW

The archive will be displayed at runtime by means of a special OLE control. The data willbe displayed as a form.By means of several buttons, it will be possible to place various edit options for the archiveat the disposal of the user.

,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

1 Open *UDSKLFV�'HVLJQHU and create a new picture. In our example, this is thepicture called H[B�BFKDSWHUB����SGO.

2 Configure an OLE Control object at 6PDUW�2EMHFWV�→�2/(�&RQWURO. The ,QVHUW2OH�&RQWURO dialog box is opened.

In this dialog box, we select the entry :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO fromthe list of available OLE controls and close the dialog box by clicking 2.. Thedeactivated :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO appears. In our example, we usethe object called 2/(�&RQWURO�.

3 Click 8' on the object known as 2/(�&RQWURO� to open its Properties dialogbox.

Page 370: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-24 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

4 On the *HQHUDO�,QIRUPDWLRQ tab, we select the $UFKLYH option in the 6RXUFH box.In the present example we cannot select 9LHZ since we have not configured anyviews as yet. The archive we select is 8VHU�$UFKLYHBL.

In the (GLW box, we can set the edit options for the archive that the user will beable to access. In our example, we will not allow the user to modify archive databy selecting the 5HDG�2QO\ check box.

We can display the OLE control with %RUGHU. In addition, we can also display theobject in form view. In our example, we select the %RUGHU and )RUP check boxes.

5 On the 7RROEDU tab, we can configure a toolbar. In our example, however, weselect the &OHDU check box. This means that the toolbar will not be displayed atruntime.

On the 6WDWXV�%DU tab, we can configure a status bar. In our example, we willleave all the elements selected. But, as on the previous tab, we select the &OHDUtab. This means that the status bar will not be displayed at runtime, either.

6 In our example, the VL]H of the font was reduced to ���� on the )RQWV�tab. It is truethat this setting refers to table view, which is not being used, but it also indirectlyaffects form view too.

If the size of the OLE control is too small to display the entire table view, scrollbars are shown. They are likewise shown when the OLE control happens to be inform view. To circumvent this annoying effect, the font size is reduced to allowthe entire table view to be shown.

7 On the other tabs, we will not perform any more settings for our example.

Complete the settings in the 3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWUROdialog box by clicking 2..

8 For us to be able to configure the form view, OLE control has to be activated in

*UDSKLFV�'HVLJQHU. This is done by clicking 8' on the object while keepingCTRL pressed.

Clicking 85 on the activated object opens a shortcut menu, which can be usedto insert text boxes, editing boxes and buttons in the form. To insert a text box,choose 7H[W from the menu.

9 A text box is displayed on the form and, at the same time, its Properties dialogbox is opened. There is also the possibility of entering a piece of text in the 7H[Winput box, or selecting the name of a data field from the drop-down list.

In our example, the box name 5HFRUG1DPH has been selected from the drop-

Page 371: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-25C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

down list for the 7H[W box.

10 Configure the editing box that matches the text box. This is accomplished by

clicking 85 on the activated OLE control. We choose (GLW from the shortcutmenu that appears.

11 An editing box is displayed on the form and, at the same time, its Propertiesdialog box is opened. From the drop-down list, we can now select the requiredbox whose data we want to have displayed in the editing box.

In our example, the 5HFRUG1DPH box has been selected from the drop-down listfor the )LHOG box.

12 As with the procedure described in the preceding four steps, a text box and anediting box will be configured for each archive box in our example.

13 It must then be possible to navigate through the boxes in the archive. This isaccomplished by configuring buttons. On the form, all the functions available onthe toolbar can be triggered by buttons.

Click 85 on the activated OLE control to insert a EXWWRQ in the form.

14 A button is displayed on the form and, at the same time, its Properties dialog boxis opened. It is possible to enter a piece of text for labeling the button in the 7H[Winput box. In our example, the WH[W we use is the string ��. Its purpose is tosymbolize the function of the button for going to the first data record.

In the $FWLRQ box, we set the function we want the button to trigger. A list of allthe functions available is shown as a drop-down list. In our example, we set the6WDUW function.

Page 372: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-26 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

15 We then configure three more buttons. We want them to trigger %DFN, )RUZDUGand (QG functions.

In our example, we configure a further two buttons which the user can use towrite single data records to the tags assigned to the data fields. The functions wehave to set for them are 5HDG�7DJV and :ULWH�7DJV.

16 Configure five pointer-type instruments to display the tags that have to be writtenby 8VHU�$UFKLYH. These are :LQ&&�JDXJH�FRQWURO type OLE controls configuredat 6PDUW�2EMHFWV�→�2/(�&RQWUROV. In our example, these are objects 2/(&RQWURO� to 2/(�&RQWURO�.

At each of the objects, we create a WDJ�FRQQHFWLRQ to one of the five integer tagsthat have to be written by the archive at 3URSHUWLHV�→�2/(�&RQWURO�3URSHUWLHV�→9DOXH.

To be in a position to simulate a change of the values of these tags, five sliderobjects are configured at 6PDUW�2EMHFWV�→�6OLGHU�2EMHFWV. In our example, theseare objects�6OLGHU�2EMHFW� to 6OLGHU�2EMHFW�.

At each of these objects, we create a WDJ�FRQQHFWLRQ to one of the correspondingtags at 3URSHUWLHV�→�0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ. Further, aGLUHFW�FRQQHFWLRQ to the same tag is created at (YHQW�→�3URSHUW\�7RSLFV�→0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ�→�&KDQJH. For these GLUHFWFRQQHFWLRQV, the VRXUFH WKLV�REMHFW�→�3URFHVV�'ULYHU�&RQQHFWLRQ�is connected tothe GHVWLQDWLRQ of the corresponding WDJ. This is performed so that a change ofthe tag value is achieved for every change in the position of the slider.

17 We configure static text at 6WDQGDUG�2EMHFW�→�6WDWLF�7H[W to display the datarecord that is currently being loaded to the tags. In our example, we use theobject called 6WDWLF�7H[W�. At this object, we create a WDJ�FRQQHFWLRQ to the

Page 373: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-27C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

7��LBH[B8$LB�� tag containing the name of the data record at 3URSHUWLHV→�)RQW→�7H[W.

If the tag still does not contain text when a picture is opened, a data record hasnot been loaded as yet, and we want this to be displayed likewise. This isperformed by means of a &�DFWLRQ at picture object H[B�BFKDSWHUB�� at (YHQW�→0LVFHOODQHRXV�→�2SHQ�3LFWXUH. This &�DFWLRQ writes the words 1R�GDWD�UHFRUGto the tag if it is blank.

Page 374: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-28 WinCC Configuration ManualC79000-G8276-C140-01

������ :RUNLQJ�ZLWK�&RQWURO�7DJV��H[B�BFKDSWHUB����3'/�

7DVN�GHILQLWLRQ

We wish to create an archive having data records consisting of three double boxes and atext box for storing a data record name. We want to keep the number of data records tothree.We want the archive data to be made available throughout the project by using the controltags on a record-by-record basis.

,PSOHPHQWDWLRQ�FRQFHSW

An archive is created in the user archive editor for archiving the data. Archivecommunication will be configured with WinCC tags. We will assign four control tags to thearchive. Their purpose is to control writing of the data to the WinCC tags and reading of thedata from the WinCC tags.Four data fields of the requisite field types will be created in the archive. An internal tagwill be assigned to each data field and will be used by the archive to communicate with therest of the project.We then configure several buttons and I/O fields in Graphics Designer, which will be usedto write to the control tags. The contents of the control tags set the data record forprocessing and whether data should be read or written.

&UHDWLQJ�DQ�DUFKLYH

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

1 Create a single internal tag for each data record in the archive. Communicationbetween the archive and the rest of the system will take place by means of thesetags.

In our example, we use tags *��LB8$FWB�� to *��LB8$FWB�� of the IORDWLQJSRLQW����ELW�,(((���� type. Further, a type ��ELW�IRQW�WH[W� tag is created forstoring the data record name. In our example, this is tag 7��LB8$FWB��.

2 Open the user archive editor. We create a new archive in the user archive editor.

Click 85 on the $UFKLYHV entry to open a wizard for this purpose.

3 We enter the DUFKLYH�QDPH on the wizard’s first page. In our example, we enter8VHU�$UFKLYHBFW as the name in the $UFKLYH�QDPH box. We will leave the $OLDVbox blank.

We choose /LPLWHG as the DUFKLYH�W\SH. In keeping with the task set, themaximum number of GDWD�UHFRUGV is set to �.

The wizard’s page is closed by clicking 1H[W.

4 On the wizard’s second page, we select the type of communication. In the presentexample, we select 7\SH as &RPPXQLFDWLRQ�YLD�:LQ&&�7DJ�V�.

The wizard’s page is closed by clicking 1H[W.

5 On the third page of the wizard, we can set four control tags. The archive can becontrolled at runtime by means of these tags.

If the tags have not been created previously, you can have the wizard do it

Page 375: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-29C79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

automatically. Click the button to open a dialog box for setting afew details concerning the tags which we want to create.

We have to set whether we want to create internal or external tags. If we want thewizard to create external tags, then we must also specify the FRQQHFWLRQ for whichwe want to have them created.

The wizard generates the tags in a tag group. We have to set the name of thegroup and also the names of the individual tags. However, the wizard alsoproposes names without being prompted to do so.

In our example, we select LQWHUQDO as the type of tag. We will keep to the namesfor the tag group and individual tags as proposed by the wizard. Click 2. toclose the &UHDWH�&RQWURO�7DJV dialog box.

The tags you have just created are then automatically entered in thecorresponding boxes for ,', -RE, )LHOG and 9DOXH.

Since we will not perform any more settings on the next page of the wizard in ourexample, we can close the wizard at this stage already by clicking )LQLVK.

Page 376: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-30 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&UHDWLQJ�DQ�$UFKLYH

6 The boxes listed in the table that follows are created in our example for thearchive you have just configured. The tags configured in step 1 are set as theassigned tags.

For the double boxes, we set a PLQLPXP�YDOXH of -�� and a PD[LPXP�YDOXH of ��.We set the OHQJWK of the text box to ��.

7 A total of three data records can now be created for the archive in the bottomwindow of the table.

,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

1 Open *UDSKLFV�'HVLJQHU and create a new picture. In our example, this is thepicture called H[B�BFKDSWHUB����SGO.

2 Configure an OLE Control object at 6PDUW�2EMHFWV�→�2/(�&RQWURO. It will onlybe used in our example to display archive data and will not be given any controlelements.

The ,QVHUW�2OH��&RQWURO dialog box is opened.

Page 377: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-31C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

In this dialog box, we select the entry :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO fromthe list of available OLE controls and close the dialog box by clicking 2.. Thedeactivated :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO appears. In our example, we usethe object called 2/(�&RQWURO�.

3 Click 8' on the object known as 2/(�&RQWURO� to open its Properties dialogbox.

On the *HQHUDO�,QIRUPDWLRQ tab, we set the 6RXUFH field to 8VHU�$UFKLYHBFW, theDUFKLYH you configured earlier.

Keep 5HDG�2QO\ as the setting in the (GLW box.

In our example, we deselect the %RUGHU check box. The )RUP check box likewiseremains deselected.

4 On the 7RROEDU tab, we select the &OHDU check box. Similarly, we select the &OHDUcheck box on the 6WDWXV�%DU tab. This results in the table being displayed withoutthe toolbar or the status bar.

Complete the settings in the 3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWUROdialog box by clicking 2..

5 Configure three bar graphs to display the tags that have to be written by 8VHU$UFKLYH by selecting 6PDUW�2EMHFWV�→�%DU�*UDSK. In our example, these objectsare %DU� to %DU�.

We create a WDJ�FRQQHFWLRQ to one of the three double tags that have to be writtenby the archive at each of the objects by selecting�3URSHUWLHV�→�0LVFHOODQHRXV�→3URFHVV�'ULYHU�&RQQHFWLRQ.

For us to be in a position to simulate any change of values for these tags, twobuttons are configured at :LQGRZV�2EMHFWV�→�%XWWRQ for each bar graph. One ofthese buttons is used to increment the corresponding tag value in typing modeand the other to decrease it.

Page 378: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-32 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6 We then have to configure control elements with which the user can, firstly,select a specific data record and, secondly, trigger a specific function for thatfunction.

Selection of the data record by means of control tags can be done in two differentways. It is possible to write to the tag set for the ID. The second version consistsof writing a field name for the tag set for the field and, in addition, a search valueto the tag set for the value.

7 To select the data record by means of the ID, we configure three buttons at:LQGRZV�2EMHFWV�→�%XWWRQ in our example. They write a suitable value, viaGLUHFW�FRQQHFWLRQV, to the tag, #8$B8VHU�$UFKLYHBFWB,', set for the ID. Thecurrent tag value is displayed by means of an I/O field created at 6PDUW�2EMHFW�→,�2�)LHOG.

8 To select the data record using the field name and a search value, we configurefour buttons at :LQGRZV�2EMHFWV�→�%XWWRQ. They write a suitable field name, viaGLUHFW�FRQQHFWLRQV, to the tag, #8$B8VHU�$UFKLYHBFWB)LHOG, set for the fieldname. The current tag value is displayed by means of an I/O field created at6PDUW�2EMHFWV�→�,�2�)LHOG.

We configure another I/O field at 6PDUW�2EMHFW�→�,�2�)LHOG for entering thesearch value. Make sure you enter dots rather than commas for double values. Ifyou want to use text as a search value, it must be encompassed in quotationmarks.

Page 379: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-33C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

9 In our example, we can switch to and fro between two possible selections for datarecords by means of two buttons configured at :LQGRZV�2EMHFWV�→�%XWWRQ. AELQDU\�WDJ type is used to disable the input objects of the one version and then theother.

10 To trigger jobs for the data record we selected, we configure two buttons at:LQGRZV�2EMHFWV�→�%XWWRQ. They write a suitable value, via GLUHFW�FRQQHFWLRQV,to the tag, #8$B8VHU�$UFKLYHBFWB-RE, set for the job. Permissible values in thisinstance are:

• 6, for the job of reading the record from the tags

• 7, for the job of writing the record to the tags

• 8, for the job of deleting the record from the archiveIn the present example, however, we use only the read tags and write tags jobs.

Successful triggering of the job can similarly be checked by means of the tag setfor the job. If the job has been completed successfully, the tag is set to zero. If thejob fails, the tag is set to -1.

This is evaluated in our example using a G\QDPLF�GLDORJ�ER[ created at 6PDUW2EMHFW�→�,�2�)LHOG.

Page 380: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-34 WinCC Configuration ManualC79000-G8276-C140-01

������ &RQQHFWLQJ�YLD�:LQ&&�7DJV��H[B�BFKDSWHUB��D�SGO�

7DVN�GHILQLWLRQ

We want to establish a connection to a programmable logic controller. The programmablelogic controller we are going to use is the S5. The following description refers to the use ofan S5-115U (CPU 944B) with a CP1430 communication processor. Communication willtake place via a SIMATIC Industrial Ethernet.

Further, we wish to create an archive. The data records in this archive will consist of a textbox, two integer fields, two double fields and a date field. We want the archive data to bedisplayed in tabular form at runtime. They are required to be made available to theprogrammable logic controller on a record-by-record basis.

1RWH�The option of communication between User Archive and the programmable logic controllervia WinCC tags should be preferred when the majority of the activities are to be controlledby WinCC.

,PSOHPHQWDWLRQ�FRQFHSW

We establish a connection to an S5 over a SIMATIC Industrial Ethernet. Several externaltags are created for the connection we configured. We want to use them for communicationbetween the programmable logic controller and the User Archive that we are going tocreate.We create a User Archive which we want to communicate with the PLC by means ofWinCC tags. Created beforehand, the tags are assigned to the individual data fields of thearchive.The archive data are displayed at runtime by means of an OLE control. The current valuesof the tags we are using are displayed for information purposes and for checking by meansof I/O fields and bar graphs.

6,0$7,&�6��(WKHUQHW�/D\HU���FRPPXQLFDWLRQ�GULYHU

This driver will be used for communication with the programmable logic controller in ourexample. It is suitable for connections to the SIMATIC S5-115U, -135U and -155U withthe CP 1430 communication processor. We will use a CP-1413 card as the PC interface.With not more than two modules, it can communicate with as many as 30 programmablelogic controllers.

&RQILJXULQJ�WKH�&3������FRPPXQLFDWLRQ�SURFHVVRU

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&3������&RPPXQLFDWLRQ�3URFHVVRU

1 Install the driver for the network connection between the PC and the PLC. Forthis we will require the SIMATIC Drivers CD (SIMATIC NET). After specifyinga few general details in the installation wizard concerning the installation, weselect the entry ,(�6������ in the list box displayed on the page labeled&RPSRQHQWV. Installation is completed by clicking 1H[W. Following this, thecomputer has to be rebooted.

Page 381: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-35C79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&3������&RPPXQLFDWLRQ�3URFHVVRU

2 Install the CP 1413 card on the PC. Install the CP 1413 card on the PC exactly inthe manner stated in the installation instructions enclosed with the card.Following this, software installation of the card has to be performed, again byprecisely following the instructions.

Start the 6HW�3URJUDPPLQJ�'HYLFH�3&�,QWHUIDFH program on the Control Panel.

The access point for the Industrial Ethernet connection was entered by defaultwhen you installed the card. This is the access point labeled &3�+�B��.

Page 382: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-36 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&3������&RPPXQLFDWLRQ�3URFHVVRU

3 Assign a module to the access point. The module has to be installed first,

however. This is accomplished by means of the button in the0RGXOHV box. The ,QVWDOO�8QLQVWDOO�0RGXOH dialog box opens. In the left list box,

we select the &3����� entry and install the card using the button.

Page 383: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-37C79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&3������&RPPXQLFDWLRQ�3URFHVVRU

4 The &3������5HVRXUFHV dialog box opens. The set memory area ���(��������()))) can frequently not be used. We recommend the ���'��������')))) area. By default, the I/O area is set to ��(����(� and can beinfluenced by jumpers on the card.

5 To avoid duplicate assignment of the memory area and interrupts, it is sensible tolook in :LQGRZV�17�'LDJQRVWLFV. You do this by choosing the 6WDUW�PHQX�→3URJUDPV�→�$GPLQLVWUDWLYH�7RROV��&RPPRQ��→�:LQGRZV�17�'LDJQRVWLFV.

The :LQGRZV�17�'LDJQRVWLFV program appears. In this program, select the5HVRXUFHV tab.

You can determine the interrupts in use by clicking the button. If

you click the button, you can determine which memory locationsare in use.

6 The settings in the &3������5HVRXUFHV dialog box are now completed by clicking2. and the ,QVWDOO�8QLQVWDOO�0RGXOHV dialog box is closed.

7 Assign the card you have just installed to the access point. To do this, in the 6HW3URJUDPPLQJ�'HYLFH�3&�,QWHUIDFH program, select access point &3B+�B�� in thetop list box and select the entry for the &3����� in the bottom list.

Page 384: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-38 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&3������&RPPXQLFDWLRQ�3URFHVVRU

8 Set the properties of the &3����� card. We do this by clicking the

button. In the CP 1413 Properties dialog box that appears, wehave to enter the Ethernet address of the card on the (WKHUQHW�0$&��$GGUHVV tab.

&RQILJXULQJ�WKH�FRQQHFWLRQ�RQ�WKH�SURJUDPPDEOH�ORJLF�FRQWUROOHU

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF&RQWUROOHU

1 Configure the connection on the programmable logic controller. This is done withthe 6,1(&�1&0 COM package for the processor we are using.

Open the 'HIDXOW�6HWWLQJV dialog box by choosing )LOH�→�6HOHFW�from the menu.For the &3�7\SH, we enter &3����. The GDWDEDVH�ILOH we create in our example isthe file called $865$5&. The file name must start with an A character. Applythe settings you have performed with )�.

2 Choose (GLW�→�&3�,QLW from the menu to open the &3�%DVLF�,QLWLDOL]DWLRQ dialogbox. We will leave the 0$&�$GGUHVV in our example at ������������. This isalso the default Ethernet address set by WinCC for the programmable logiccontroller when a new connection is created. Apply the settings you haveperformed with )�.

3 Create two transport connections. This is accomplished by choosing (GLW�→&RQQHFWLRQV�→�7UDQVSRUW�&RQQHFWLRQV from the menu. The 7UDQVSRUW

Page 385: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-39C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF&RQWUROOHU

&RQQHFWLRQ dialog box opens.

A transport connection is now created for requesting data from the programmablelogic controller to be transferred to WinCC. Specify )(7&+ as the job type.Further, we set the programmable logic controller to 3DVVLYH. In the 7UDQVSRUW$GGUHVVHV box, we enter $*')(7&+ for the local parameter of 76$3�in ourexample. In addition to the 76$3, &&')(7&+ in our example, we also have toenter the Ethernet address of the CP-1413 card as the 0$&�DGGUHVV for theremote device parameter.

A transport connection is now created for sending data to the programmable logiccontroller from WinCC. We can enter a new transport connection by pressing )�.Specify 5(&(,9( as the job type. We set the programmable logic controller to3DVVLYH. In the 7UDQVSRUW�$GGUHVVHV box, we enter $*':5,7( for the localparameter of 76$3�in our example. We enter &&':5,7( as the 76$3 for theremote device parameter. We also have to specify the Ethernet address of thecard at this stage. Apply the settings you have performed with )�.

It is always necessary to create read and write jobs. This also applies when one orthe other type of job is not required.

4 The data must now be transferred to the CP. This is accomplished by choosing'RZQORDG�→�)'�!&3 from the menu. However, this can be done only when theprogrammable logic controller has been stopped.

&RQILJXULQJ�WKH�FRQQHFWLRQ�LQ�&RQWURO�&HQWHU

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

1 Install the required communication driver for the requisite programmable logic

controller and the requisite driver connections. In &RQWURO�&HQWHU, click 85 on7DJ�0DQDJHPHQW to open the $GG�1HZ�'ULYHU dialog box.

Select 6,0$7,&�6��(WKHUQHW�/D\HU� from the list shown in the dialog box. Exitthe dialog box by clicking 2SHQ.

Page 386: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-40 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

2 Configure a connection for the communication driver you have just added. This

is accomplished in &RQWURO�&HQWHU by clicking 85 on the entry of one of thetwo channel units that are displayed. In our example, we will use the6��7UDQVSRUW��&3������� channel unit.

The &RQQHFWLRQ�3URSHUWLHV dialog box is displayed.

Enter the name of the new connection on the *HQHUDO�,QIRUPDWLRQ tab. In ourexample, we use the name 6�����8�:LQ&&�$FWLYH.

We set the properties of the connection on the &RQQHFWLRQ tab. In our example,we will keep to the default setting for the (WKHUQHW�$GGUHVV�RI�3/&.

In the 5($'�)XQFWLRQ box, we select )HWFK�$FWLYH. This means that WinCC is theactive peer and it is possible for WinCC to read data from the programmablelogic controller. In our example, our 2ZQ�76$3 will be called &&')(7&+ andthe 3HHU�76$3 will be called $*')(7&+.

In the :5,7(�)XQFWLRQ box, our 2ZQ�76$3 will be called &&':5,7( and the3HHU�76$3 will be called $*':5,7( in our example.

TSAPs always consist of eight characters. If less than eight characters areentered, the other positions are filled with 0x0. The hexadecimal code of theTSAP is displayed next to the name we entered. Be careful with upper-case andlower-case characters, and also with distinguishing an entered space and a non-entered character.

Page 387: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-41C79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

Close the dialog box by clicking 2..

3 Set the system parameters for the channel unit being used. To do this, click 85

on their entry.

The 6\VWHP�3DUDPHWHUV dialog box opens.

On the 'HYLFH�1DPH tag, you can enter the name of the access point via whichyou wish communication to take place. However, this is not necessary in ourexample, since by default a name was assigned already when the driver for theCP-1413 card was installed. That name is used in this instance.

On the 7UDQVSRUW�3DUDPHWHUV tab, we can modify different settings relating tocommunication management. These settings should always agree with the CP´sconfiguration on the programmable logic controller. A check always gives addedsecurity.

Close the dialog box by clicking 2.. If modifications have been performed, exit

Page 388: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-42 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

WinCC and reboot. A complete restart is the only way to enable application ofthe parameters to the CP.

4 We create a new tag group in the example for the new connection we havecreated. All the tags for communication between User Archive and theprogrammable logic controller will be combined in this group. In our example,we will call the new tag group 8VHU�$UFKLYHBGP.

5 Create the tags to be used for communication in the new tag group. Each of thetags corresponds to a box in the User Archive we have yet to create. We create atype ��ELW�IRQW�WH[W tag. In our example, it is called 7��ZBH[B8$GPB��. Its OHQJWKis set to ��.

Page 389: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-43C79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

Click the button to open the dialog box for setting the DGGUHVV of thetag on the programmable logic controller.

In the $GGUHVV�'HVFULSWLRQ box, we select '% for the GDWD�DUHD in our example.We set the '%�1R� to ��. Select :RUG for the addressing, and set ':���.

Exit the dialog box by clicking 2..

Page 390: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-44 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

Further, we create two VLJQHG����ELW�YDOXH type tags and two IORDWLQJ�SRLQW����ELW,(((���� type tags.

The assigned names and the parameters assigned to the addresses comply withthe following table.

For VLJQHG����ELW�YDOXH type tags, we set $GDSW�6FDOH�/RQJ7R6LJQHG':RUG in the7DJ�3URSHUWLHV dialog box.

For VLJQHG����ELW�,(((���� type tags, we set $GDSW�6FDOH�'RXEOH7R6�)ORDW inthe 7DJ�3URSHUWLHV dialog box. This means that these tags only require 4 bytes onthe programmable logic controller.

6 Check the connection to the programmable logic controller. To do this, switch theWinCC project to Runtime and start the programmable logic controller. A dialogbox, which you can open by choosing 2SWLRQV�→�6WDWXV�RI�'ULYHU�&RQQHFWLRQV in&RQWURO�&HQWHU, keeps you informed of the status of the connection.

Page 391: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-45C79000-G8276-C140-01

6WHS 3URFHGXUH�&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

&UHDWLQJ�DQG�FRQILJXULQJ�WKH�'%����LQ�WKH�6,0$7,&�6��FRQILJXUDWLRQ

DB 20 User Archive via DM Tags 0:KH = 0000 1:KH = 0000 2:KH = 0000 3:KH = 0000 4:KH = 0000 5:KH = 0000 6:KH = 0000 7:KH = 0000 8:KH = 0000 9:KH = 0000 10:KC =’Record_001’ RecordName 15:KH = 0000 Pressure_a High 16:KH = 01C9 Pressure_a Low 17:KG = +1025400+03 Temperature_a 19:KH = 0000 Pressure_b High 20:KH = 0381 Pressure_b Low 21:KG = +4959800+03 Temperature_b

• The tags for communication are addressed in '%���. This DB therefore contains thedata sent by User Archive.

• With a text length of 10 characters, the text box is assigned a data area from ':��� to':���. The memory allocation for the other data fields can be taken from the programexcerpt from the SIMATIC S5 configuration software shown above.

Page 392: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-46 WinCC Configuration ManualC79000-G8276-C140-01

&RQILJXULQJ�WKH�8VHU�$UFKLYH

6WHS 3URFHGXUH��&RQILJXULQJ�8VHU�$UFKLYH

1 Open the 8VHU�$UFKLYH editor and create a new archive by clicking 85 on$UFKLYHV.

On the wizard’s first page, we enter 8VHU�$UFKLYHBGP as the DUFKLYH�QDPH andspecify the DUFKLYH�W\SH as 8QOLPLWHG. On the second page, we set&RPPXQLFDWLRQ�YLD�:LQ&&�7DJV. On the other pages we will not perform anymore settings.

2 The boxes listed in the table that follows are created in our example for thearchive you have just configured. The external tags we configured earlier are setas the assigned tags.

3 Several data records can now be created for the archive in the bottom window ofthe User Archive table editor.

1RWH�You cannot assign tags to a date/time type of data field. The data entered in this data fieldare used merely as additional details elating to a data record.

&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

1 Create a new picture in *UDSKLFV�'HVLJQHU. In our example, this is the picturecalled H[B�BFKDSWHUB��D�SGO.

We configure an OLE control in this picture at 6PDUW�2EMHFW�→�2/(�&RQWURO. Inthe ,QVHUW�2OH�&RQWURO dialog box that appears, we select the entry :LQ&&�8VHU$UFKLYH�7DEOH�&RQWURO from the list displayed. Close the dialog box by clicking2.. The deactivated :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO appears. In ourexample, we use the object called 2/(�&RQWURO�.

Page 393: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-47C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

2 Click 8' on the object known as 2/(�&RQWURO� to open its Properties dialogbox.

On the *HQHUDO�,QIRUPDWLRQ tab, we select $UFKLYH�8VHU�$UFKLYHBGP as the6RXUFH. In the (GLW field, we select the check boxes labeled 3DVWH, &KDQJH and'HOHWH to make all the editing options available to the user. In addition, we selectthe %RUGHU check box.

On the &ROXPQV tab, we select all the existing data fields of the archive.

On the 7RROEDU and 6WDWXV�%DU tabs, we apply the presettings and thus use all theexisting elements.

On the )RQWV tab, we will reduce the VL]H of the font to ���� in order to be ablesimultaneously to display all columns of the table at runtime.

On the )LOWHU�6RUW tab, we will not perform any settings for our example.

Complete the settings in the 3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWUROdialog box by clicking 2..

The color scheme of the table has been adapted in our example to the colorscheme used throughout the project by means of the Properties dialog box of the2/(�&RQWURO� object.

3 We configure an I/O field at 6PDUW�2EMHFW�→�,�2�)LHOG to display the data recordname. In our example, we use the object called ,�2�)LHOG�.

At 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH, we create a WDJ�FRQQHFWLRQ to tag7��ZBH[B8$GPB��. Select 3URSHUWLHV�→�2XWSXW�,QSXW to modify the GDWDIRUPDW to VWULQJ on the object.

The other four tags are all displayed by means of an I/O field created at 6PDUW2EMHFW�→�,�2�)LHOG and a bar graph created at 6PDUW�2EMHFW�→�%DU�*UDSK.

At the ,�2�ILHOGV, create a WDJ�FRQQHFWLRQ to every one of the four tags at3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH. In the case of the bars, createcorresponding WDJ�FRQQHFWLRQV in a similar manner at 3URSHUWLHV�→0LVFHOODQHRXV�→�3URFHVV�'ULYHU�&RQQHFWLRQ.

Page 394: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-48 WinCC Configuration ManualC79000-G8276-C140-01

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made with regard to general use:

• The configurations performed for the connection can be directly applied to privateapplications, provided that the hardware used is identical. If not, adjustments have to bemade in this area.

• Adapt the structure and format of the archive to your own requirements.

Page 395: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-49C79000-G8276-C140-01

������ &RQQHFWLRQ�YLD�:LQ&&�5DZ�'DWD�7DJV�WR�WKH�6��H[B�BFKDSWHUB��E�SGO�

7DVN�GHILQLWLRQ

We want to establish a connection to a programmable logic controller. The programmablelogic controller we are going to use is the S5. The description below refers to the use of anS5-115U (CPU 944B) with a CP1430 processor. Communication is required to take placeover a SIMATIC Industrial Ethernet.

Further, we wish to create an archive. The data records in this archive will consist of a textbox, an integer field and a double field. We want the archive data to be displayed in tabularform at runtime. They are required to be made available to the programmable logiccontroller on a record-by-record and field-by-field basis.

1RWH�The option of communication between User Archive and the programmable logic controllervia WinCC raw data tags should be preferred when the majority of the activities are to becontrolled by the programmable logic controller.In the present example, however, the WinCC user takes the initiative. The programmablelogic controller will be prompted to send job message frames to WinCC by setting a controltag. In this way the functionality otherwise present in the programmable logic controller issimulated.

,PSOHPHQWDWLRQ�FRQFHSW

We establish a connection to an S5 over a SIMATIC Industrial Ethernet. We will create aWinCC raw data tag for the configured connection. We want to use this tag forcommunication between the programmable logic controller and User Archive.We create a User Archive which we want to communicate with the PLC by means ofWinCC raw data tags. The tag we created earlier is assigned to the archive.The archive data are displayed at runtime by means of an OLE control. Control bits are seton the programmable logic controller by means of various buttons. They trigger the transferof raw data message frames for writing, reading and deleting different data records and datafields.

1RWH�The present example of connecting via WinCC raw data tags is based on the previousexample of connecting via WinCC tags. The configurations performed with regard to theconnection are regarded as completed. These are the sections on configuration ofcommunication processor CP 1413, configuration of the connection on the programmablelogic controller and configuration of the connection in Control Center. Completion of theother sections of the preceding example is not assumed.

Page 396: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-50 WinCC Configuration ManualC79000-G8276-C140-01

&RQILJXULQJ�WKH�&3������&RPPXQLFDWLRQ�3URFHVVRU

The configuration of the CP 1413 communication processor has already been described atlength in the preceding section. The approach to configuring is identical in as far as therequirements of this example are concerned and can thus be adopted without any changeshaving to be made to it.

&RQILJXULQJ�WKH�FRQQHFWLRQ�RQ�WKH�SURJUDPPDEOH�ORJLF�FRQWUROOHU

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF&RQWUROOHU

1 In the 6,1(&�1&0�IRU�&20V communication package, choose )LOH�→�6HOHFW� toopen the 'HIDXOW�6HWWLQJV dialog box. For the &3�7\SH, we enter &3����. TheGDWDEDVH�ILOH we open is the $8$5&+,9 file we used in the previous example.Apply the settings you have performed with )�.

2 Create two new transport connections. This is accomplished by choosing (GLW�→&RQQHFWLRQV�→�7UDQVSRUW�&RQQHFWLRQV from the menu. The 7UDQVSRUW&RQQHFWLRQ dialog box opens.

A transport connection is now created for the active transmission of data from theprogrammable logic controller to WinCC. We can enter a new transportconnection by pressing )�. Specify 6(1' as the job type. We set theprogrammable logic controller to $FWLYH.

In the 7UDQVSRUW�$GGUHVVHV box, we enter $*5)(7&+ for the local parameter of76$3�in our example. In addition to the 76$3, &&5)(7&+ in our example, wealso have to enter the Ethernet address of the &3���� card as the 0$&�DGGUHVVfor the remote device parameter.

A transport connection is now created for sending data to the programmable logiccontroller from WinCC. Specify 5(&(,9( as the job type. We set theprogrammable logic controller to 3DVVLYH.

In the 7UDQVSRUW�$GGUHVVHV box, we enter $*5:5,7( for the local parameter of76$3�in our example. We enter &&5:5,7( as the 76$3 for the remote deviceparameter. We also have to specify the Ethernet address of the card again. Applythe settings you have performed with )�.

3 The data must now be transferred to the CP. This is accomplished by choosing'RZQORDG�→�)'�!&3 from the menu. However, this can be done only when theprogrammable logic controller has been stopped.

&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

1 Configure a new connection for the 6,0$7,&�6��(7+(51(7�/$<(5�� driver.The driver was installed in the preceding example already. Create the new

connection in &RQWURO�&HQWHU by clicking 85 on the entry of one of the twochannel units displayed. In our example, we will use the6��7UDQVSRUW��&3������� channel unit.

Page 397: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-51C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

The &RQQHFWLRQ�3URSHUWLHV dialog box opens.

Enter the name of the new connection on the *HQHUDO�,QIRUPDWLRQ tab. In ourexample, we use the name 6�����8�:LQ&&�3DVVLYH.

We set the properties of the connection on the &RQQHFWLRQ tab. In our example,we will keep to the default setting for the (WKHUQHW�$GGUHVV�RI�3/&.

In the 5($'�)XQFWLRQ box, we select )HWFK�3DVVLYH. This means that WinCC isthe passive peer. Data are sent on the initiative of the programmable logiccontroller.

Enter the TSAPs which we defined when we configured the connection on theprogrammable logic controller. In our example, our 2ZQ�76$3 will be called&&5)(7&+ and the 3HHU�76$3 will be called $*5)(7&+.

In the :5,7(�)XQFWLRQ box, our 2ZQ�76$3 will be called &&5:5,7( and the3HHU�76$3 will be called $*5:5,7( in our example.

TSAPs always consist of eight characters. If less than eight characters areentered, the other positions are filled with 0x0. The hexadecimal code of theTSAP is displayed next to the name we entered. Be careful with upper-case andlower-case characters, and also with distinguishing an entered space and a non-entered character.

Close the dialog box by clicking 2..

Page 398: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-52 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

2 Create the WinCC raw data tag for communication between User Archive and the

programmable logic controller. You do this by clicking 85 on the entry of thenew connection 6�����8�:LQ&&�3DVVLYH. The 7DJ�3URSHUWLHV dialog box opens.

3 Set the tag properties. The QDPH of the tag we use in our example is5$:BH[B8$UGB��. We select the UDZ�GDWD�W\SH from the list of GDWD�W\SHV.

Page 399: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-53C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

Open the dialog box for assigning parameters to addresses by clicking the

button.

In the $GGUHVV�'HVFULSWLRQ box, we select in our example the GDWD�DUHD as '%and '%�1R����. Further, we enter :RUG�$GGUHVVLQJ and ':��. We select the 5DZ'DWD check box and set a OHQJWK of ��� for the tag. In the 5DZ�'DWD box, weselect the 6HQG�5HFHLYH�%ORFN option.

Exit the $GGUHVV�3URSHUWLHV dialog box by clicking 2.. Similarly, click 2. toclose the 7DJ�3URSHUWLHV dialog box.

4 Create external tags for triggering actions on the programmable logic controllerand for checking correct functioning of the connection.

We create these tags in a new tag group, which we will have to create, in the 6�����8�:LQ&&�$FWLYH connection. We configured this connection in the precedingexample.

In our example, the tag group in which we are going to create the tags will becalled 8VHU�$UFKLYHBUG.

Page 400: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-54 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

5 The tags we need to create and their addressing on the programmable logiccontroller are shown at length in the list below.

Tags 7��ZBH[B8$UGB��, *��ZBH[B8$UGB�� and 6��ZBH[B8$UGB�� arerequired to accommodate data sent to and from User Archive.

Tags 8��ZBH[B8$UGB�� and 8��ZBH[B8$UGB�� are to be used to set the recordnumber that has to be edited or the field number that needs editing.

Tag 8��ZBH[B8$UGB�� is used as a control tag. We wish to use it to set andtrigger the type of job that has to be performed.

&RQILJXULQJ�8VHU�$UFKLYH

6WHS 3URFHGXUH��&RQILJXULQJ�8VHU�$UFKLYH

1 Open the 8VHU�$UFKLYH editor and create a new archive. Do this by clicking 85

on $UFKLYHV. The wizard for creating a new archive appears.

2 On the *HQHUDO�,QIRUPDWLRQ page, we enter the DUFKLYH�QDPH as 8VHU�$UFKLYHBUGand specify the DUFKLYH�W\SH as 8QOLPLWHG.

3 On the &RPPXQLFDWLRQ page, we set &RPPXQLFDWLRQ�YLD�:LQ&&�5DZ�'DWD�7DJV.

Once this item has been selected, the 3/&,' input field can be used. In ourexample, we will use the name 865$5&5' as the 3/&,'. This ID must not belonger than eight characters. This ID can be used to assign, to a specific archive,a block of raw data that has been sent by the programmable logic controller.

Click the button to set the WinCC raw data tag used forcommunication. In our example, we set the tag we created earlier,5$:BH[B8$UGB��, in the 7DJ box.

Page 401: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-55C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�8VHU�$UFKLYH

4 In our example, we will not perform any more settings on the remaining pages ofthe wizard.

3 The boxes listed in the table that follows are created in our example for thearchive you have just configured. We now save the settings we have performed.

5 Several data records can now be created for the archive in the bottom window ofthe User Archive table editor.

3URJUDP�JHQHUDWLRQ�RQ�WKH�SURJUDPPDEOH�ORJLF�FRQWUROOHU

6WHS 3URFHGXUH��3URJUDP�*HQHUDWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF�&RQWUROOHU

1 We have to create a data block in which we store the data for controlling andmonitoring communication.This is control tag 8��ZBH[B8$UGB��, which contains the job type. Further,there are the communication monitoring tags, 7��ZBH[B8$UGB��,*��ZBH[B8$UGB�� and 6��ZBH[B8$UGB��, as well as the tags for setting therecord number and field number for editing, 8��ZBH[B8$UGB�� and8��ZBH[B8$UGB��.In our example, this data block is '%��.

2 Create a further data block which we can use to handle communication with UserArchive. In our example, this is '%��. The address of the WinCC raw data tagset in the user archive editor refers to this memory area.

Page 402: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-56 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��3URJUDP�*HQHUDWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF�&RQWUROOHU

WinCC sends to it the acknowledgement of the raw data message framesreceived from the programmable logic controller. The structure of theacknowledgement message frames can be taken from the section that follows,�������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV.

3 To illustrate the example more clearly, a separate raw data message frame isstored in a separate data data block for every job type. The structure of these jobmessage frames is explained in the section that follows, �������6WUXFWXUH�RI�UDZGDWD�PHVVDJH�IUDPHV.

4 Every job message frame has an area for accommodating the data record numberand data field number. In WinCC, we enter the values for these specifications intags 8��ZBH[B8$UGB�� and 8��ZBH[B8$UGB��. The tag types have beenchosen in accordance with the length specified in the message frame structure forthe different values. The data record number requires 4 bytes, while the data fieldnumber requires 2 bytes.

In the PLC program, these values are reloaded to the different job messageframes by means of a separate program block. The data record number is requiredfor all job types except the 'HOHWH�$OO�'DWD�5HFRUGV type. The data field numberis required only for job types :ULWH�)LHOG and 5HDG�)LHOG. The program blockresponsible for reloading the values is 3%� in our example.

5 All communication handling is performed by another program block. In ourexample, this is 3%�. It is processed on a cyclic basis by means of 2%�.

The contents of the control tag are transferred to a specific memory byte in 3%�.In our example, this is memory byte 30. Depending on the states of the differentbit memories, job message frames are sent to WinCC. This is accomplished ineach case by send block )%���.

The different transmit data for )%��� are stored in a separate data block. In ourexample, '%� is used for this purpose.

Description of PB5 (communication with archive)

PB 5 Communication with archiveNetwork 10000 :A DB 21 Reload job tag0001 :L DW 2 to memory word 300002 :T MW 300003 :L KF +00005 :T DW 20006 :0007 :SPA PB 7 Load record number and field number0008 : in job message frames0009 :A DB 5 Open data block000A :*** containing transmit data

NETWORK 2 Send All000B :JU FB 244000C NAME :SEND000D SSNR : KY 000,000000E A-NR : KY 000,000 Job number zero for Send All

Page 403: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-57C79000-G8276-C140-01

000F SW : DW 00010 QTYP : KC DB0011 DBNR : KY 000,0000012 QANF : KF +00013 QLAE : KF +00014 PAFE : MB 1000015 :***

NETWORK 3 Receive All0016 :SPA FB 2450017 NAME :RECEIVE0018 SSNR : KY 000,0000019 A-NR : KY 000,000 Job number zero for Receive All001A SW : DW 2001B ZTYP : KC DB001C DBNR : KY 000,000001D ZANF : KF +0001E ZLAE : KF +0001F PAFE : MB 1000020 :***

NETWORK 4 Delete all records0021 :U M 30.1 If the bit memory set is Send0022 :JC FB 244 the job0023 NAME :SEND0024 SSNR : KY 000,0000025 A-NR : KY 000,0030026 SW: DW 40027 QTYP : KC RW0028 DBNR : KY 000,005 Transmitted data from DB5 startingat DW 500029 QANF : KF +50002A QLAE : KF +0002B PAFE : MB 100002C :***

NETWORK 5 Read data record002D :U M 30.2 If the bit memory set is Send002E :SPB FB 244 the job002F NAME :SEND0030 SSNR : KY 000,0000031 A-NR : KY 000,0030032 SW : DW 60033 QTYP : KC RW0034 DBNR : KY 000,005 Transmitted data from DB5 startingat DW 600035 QANF : KF +600036 QLAE : KF +00037 PAFE : MB 1000038 :***

NETWORK 6 Write record0039 :U M 30.3 If the bit memory set is Send003A :JC FB 244 the job003B NAME :SEND003C SSNR : KY 000,000003D A-NR : KY 000,003003E SW : DW 8003F QTYP : KC RW0040 DBNR : KY 000,005 Transmitted data from DB5 startingat DW 70

Page 404: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-58 WinCC Configuration ManualC79000-G8276-C140-01

0041 QANF : KF +700042 QLAE : KF +00043 PAFE : MB 1000044 :***

NETWORK 7 Delete data record0045 :U M 30.4 If the bit memory set is Send0046 :JC FB 244 the job0047 NAME :SEND0048 SSNR : KY 000,0000049 A-NR : KY 000,003004A SW : DW 10004B QTYP : KC RW004C DBNR : KY 000,005 Transmitted data from DB5 startingat DW 80004D QANF : KF +80004E QLAE : KF +0004F PAFE : MB 1000050 :***

NETWORK 8 Read field0051 :U M 30.5 If the bit memory set is Send0052 :JC FB 244 the job0053 NAME :SEND0054 SSNR : KY 000,0000055 A-NR : KY 000,0030056 SW : DW 120057 QTYP : KC RW0058 DBNR : KY 000,005 Transmitted data from DB5 startingat DW 900059 QANF : KF +90005A QLAE : KF +0005B PAFE : MB 100005C :***

NETWORK 9 Write field005D :U M 30.6 If the bit memory set is Send005E :SPB FB 244 the job005F NAME :SEND0060 SSNR : KY 000,0000061 A-NR : KY 000,0030062 SW : DW 140063 QTYP : KC RW0064 DBNR : KY 000,005 Transmitted data from DB5 startingat DW 1000065 QANF : KF +1000066 QLAE : KF +00067 PAFE : MB 1000068 :BE

• This program block is called in OB1. This means that it is processed on a cyclic basis.

• On Network1, the address area of the control tag sent by WinCC, 8��ZBH[B8$UGB��,is transferred first to memory word 30. The contents of the control tag is then reset tozero. Further, the record number and field number entered in WinCC is entered in thedifferent message frames by means of PB7. In this case we must remember that the byteorder has to be changed. Finally, the data block containing the transmit data is openedfor processing on the subsequent networks.

• On Network 2, a Send All job is executed.

• On Network 3, a Receive All job is executed.

Page 405: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-59C79000-G8276-C140-01

• On Network 4, a job message frame is sent to WinCC in the event of bit memory 30.1being set. In this case the message frame is used to delete all the data records from anarchive. The transmit data are taken by FB244 from DB5 starting at DW50. Thetransmit data contained in this block are shown in the program excerpt below.

• On the subsequent networks, other job message frames are sent to WinCC, dependingon the state of memory byte 30. The only differences in the calls relate to the addressingif the display word and the start of the transmit data in DB5.

Transmit data in DB5 (excerpt)

DB 5 Transmit data for FB244

48:KH = 0000 49:KH = 0000 ### Transmit data Delete All Records 50:KC =’DB’ Source type DB 51:KY = 000,025 of DB 25 52:KF = +00000 DW 0 53:KF = +00050 with length of 50 words 54:KC =’DB’ Destination type DB 55:KY = 000,023 to DB 23 56:KF = +00000 DW 0 57:KF = +00050 with length of 50 words 58:KH = 0000 59:KH = 0000

• The program excerpt above contains the transmit data of the job for deleting the archive.The contents of DB25, which contains the job message frame, is sent to DB23. This isthe block in which the raw data tag of User Archive is addressed

• This block similarly contains the transmit data for all the other send jobs of PB5.

&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

1 Create a new picture in *UDSKLFV�'HVLJQHU. In our example, this is the picturecalled H[B�BFKDSWHUB��E�SGO.

We configure an OLE control in this picture at 6PDUW�2EMHFW�→�2/(�&RQWURO. Inthe ,QVHUW�2OH�&RQWURO dialog box that appears, we select the entry :LQ&&�8VHU$UFKLYH�7DEOH�&RQWURO from the list displayed. Close the dialog box by clicking2.. The deactivated :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO appears. In ourexample, we use the object called 2/(�&RQWURO�.

2 Click 8' on the object known as 2/(�&RQWURO� to open its Properties dialogbox.

On the *HQHUDO�,QIRUPDWLRQ tab, we select $UFKLYH�8VHU�$UFKLYHBUG as the6RXUFH. In the (GLW field, we select check boxes 3DVWH, &KDQJH and 'HOHWH to

Page 406: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-60 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

make all the editing options available to the user. In addition, we select the%RUGHU check box.

On the &ROXPQV tab, we select all the existing data fields of the archive.

On the 7RROEDU tab, we deselect the two buttons :ULWH�7DJ and 5HDG�7DJ.Control is performed by the programmable logic controller in the presentexample. All the other buttons on the toolbar will be used.

On the 6WDWXV�%DU tabs, we apply the presettings and thus use all the existingelements.

On the )RQWV tab, we will reduce the VL]H of the font to ���� in order to be ablesimultaneously to display all columns of the table at runtime.

On the )LOWHU�6RUW tab, we will not perform any settings for our example.

Complete the settings in the 3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWUROdialog box by clicking 2..

The color scheme of the table has been adapted in our example to the colorscheme used throughout the project by means of the Properties dialog box of the2/(�&RQWURO� object.

3 To display the data transferred from User Archive to the programmable logiccontroller, we configure three I/O fields at 6PDUW�2EMHFWV�→�,�2�)LHOGV. In ourexample, these are the objects ,�2�)LHOG�, ,�2�)LHOG� and ,�2�)LHOG�.

At the ,�2�ILHOGV, we create - at 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH - aWDJ�FRQQHFWLRQ for each of the three tags 7��ZBH[B8$UGB��, 6��ZBH[B8$UGB��and *��ZBH[B8$UGB��.

4 To set the record number that has to edited and the field number, we create twomore I/O fields at 6PDUW�2EMHFWV�→�,�2�)LHOGV. In our example, these are theobjects ,�2�)LHOG� and ,�2�)LHOG�.

At the object ,�2�)LHOG�, we create at 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW9DOXH a WDJ�FRQQHFWLRQ to tag 8��ZBH[B8$UGB��. This is used to accommodatethe record number.

At the object ,�2�)LHOG�, we create at 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW9DOXH a WDJ�FRQQHFWLRQ to tag 8��ZBH[B8$UGB��. This is used to accommodatethe field number.

To trigger actions on the programmable logic controller, we configure six buttonsat :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, these objects are %XWWRQ�� to%XWWRQ��.

When a button is clicked, a different value is written to tag 8��ZBH[B8DUGB��.Every value corresponds to a different type of job for the programmable logiccontroller. Refer to the list below for the assignment of individual values to thecorresponding jobs. The values are specified as hexadecimal.

• 0x0200 = Delete All Records

• 0x0400 = Write Record to PLC

Page 407: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-61C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

• 0x0800 = Read Record from PLC

• 0x1000 = Delete Record from Archive

• 0x2000 = Write Field to PLC

• 0x4000 = Read Field from PLCThis tag is periodically queried in the PLC program. A corresponding job istriggered depending on the contents of the tag.

1RWH�In our example, we want to test the exchange of data between User Archive and theprogrammable logic controller. A complex program that sends and receives would gobeyond the framework of a basic description of the connection.Tags 7��ZBH[B8$UGB��, *��ZBH[B8$UGB�� and 6��ZBH[B8$UGB�� have been createdfor checking communication. I/O field data are used to make entries in these tags atruntime. These data are then re-stored in the data area of a job message frame using projectfunctions.The procedure for data arriving at the programmable logic controller is similar. They are re-stored from the data area of the acknowledgement message frame in the corresponding tagsby means of a project function.

-REV�IRU�ZULWLQJ�WR�WKH�3/&

6WHS 3URFHGXUH��-REV�IRU�:ULWLQJ�WR�WKH�3/&

1 With write jobs (write to the programmable logic controller), the data arriving atthe programmable logic controller in our example are re-stored in tags7��ZBH[B8$UGB��, *��ZBH[B8$UGB�� and 6��ZBH[B8$UGB��. This is done tocheck the function and is not necessary in normal practice. In the presentexample, the storage of data at the WinCC end is solved by means of projectfunctions.

Two raw data tags were created. One of the tags is tag 5$:BH[B8$UGB�� in ourexample. With regard to its address, it corresponds to the data area of theacknowledgement message frame sent to the requesting programmable logiccontroller by WinCC in response to a job. The second tag is tag5$:BH[B8$UGB�� in our example. With regard to its addressing, it correspondsto the memory area on the programmable logic controller in which the threeWinCC tags used for checking are addressed.

When the data are re-stored, we have to make sure that the first byte of a numberoccurring in a raw data message frame is the least significant byte. In the case ofWinCC tags, the byte order is exactly the reverse of this.

If object %XWWRQ� (write record to PLC) is operated by clicking 8, an internaltag of the ELQDU\�WDJ type is set. In our example, this is tag %,1LBH[B8$UGB��.

Page 408: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-62 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��-REV�IRU�:ULWLQJ�WR�WKH�3/&

Further, control tag 8��ZBH[B8$UGB�� is set to a value of 0x0400.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC, which requests a specificdata record. The requested data are then sent by means of the raw data tag set inUser Archive to the programmable logic controller (acknowledgement messageframe).

We configure a &�DFWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ; of the buttonthat is triggered when tag 5$:BH[B8$UGB�� is modified. Any change to this tagsignifies that new data have been sent.

Tag %,1LBH[B8$UGB�� is checked in the &�DFWLRQ. If it has been set, a new datarecord (as opposed to a new data field) has been sent. Project function$FWXDOLVH'DWD6HW�� is then triggered and performs the re-store operation of thesent data to the WinCC tags. Further, tag %,1LBH[B8$UGB�� is reset.

2 The procedure for writing fields to the PLC is similar to step 1. However, only asingle field is processed.

If object %XWWRQ�� (write field to PLC) is operated by clicking 8, an internal tagof the ELQDU\�WDJ type is set. In our example, this is tag %,1LBH[B8$UGB��.Further, control tag 8��ZBH[B8$UGB�� is set to a value of 0x2000.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC. This message framerequests a specific data field of a data record. The requested data are then sent bymeans of the raw data tag set in User Archive to the programmable logiccontroller (acknowledgement message frame).

We configure a &�DFWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ; of the buttonthat is triggered when tag 5$:BH[B8$UGB�� is modified. Any change to this tagsignifies that new data have been sent.

Tag %,1LBH[B8$UGB�� is checked in the &�DFWLRQ. If it has been set, a new datafield (as opposed to a new data record) has been sent. Project function$FWXDOLVH'DWD)LHOG�� is then triggered and performs the re-store operation of thesent field to the corresponding WinCC tag. This is performed in function of thecurrently set field number. Further, tag %,1LBH[B8$UGB�� is reset.

Page 409: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-63C79000-G8276-C140-01

C action on Button9 at a click of the mouse

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

SetTagWord("U16w_ex_UArd_01",0x0400);

SetTagBit("BINi_ex_UArd_01",TRUE);

}

• Trigger a job on the programmable logic controller. This is done by setting tag8��ZBH[B8$UGB�� to a defined value. In this instance we use the value �[����. Itcauses the programmable logic controller to request a record.

• Set tag %,1LBH[B8$UGB��. This indicates that a data record has been requested.

C action on Button9 at the PositionX property

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

if (GetTagBit("BINi_ex_UArd_01") == TRUE){

ActualiseDataSet();SetTagBit("BINi_ex_UArd_01",FALSE);

}

return 470;}

• Check tag%,1LBH[B8$UGB��.

• If it has been set, a data record has been sent. In this instance project function$FWXDOLVH'DWD6HW�� is called. It re-stores the data area of the sent acknowledgementmessage frame in the WinCC tags. Further, tag %,1LBH[B8$UGB�� is reset.

• This action is triggered upon a change to tag 5$:BH[B8$UGB��. This tag is addressedto the data area of the acknowledgement message frame sent by WinCC. If its valuechanges, it means that new data have arrived on the programmable logic controller.

Page 410: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-64 WinCC Configuration ManualC79000-G8276-C140-01

Project function ActualiseDataSet()

void ActualiseDataSet(){BYTE byData[22];BYTE bySet[22];int i;

GetTagRaw("RAW_ex_UArd_02",&byData[0],22);

//load text datafor (i=0; i<10; i++){

bySet[i]=byData[i];}//load double datafor (i=0; i<8; i++){

bySet[17-i]=byData[10+i];}//load integer datafor (i=0; i<4; i++){

bySet[21-i]=byData[18+i];}

SetTagRaw("RAW_ex_UArd_08",&bySet[0],22);

//init telegram datafor (i=0; i<22; i++){

byData[i] = 0;}SetTagRaw("RAW_ex_UArd_02",&byData[0],22);}

• Declaration of two byte fields. They are required to store the data of the raw data tags.

• Read the data sent to the programmable logic controller to the E\'DWD byte field.

• Reload the text box to the E\6HW byte field. These data correspond to data field5HFRUG1DPH, which is present in the 8VHU�$UFKLYHBUG archive. The 10-character field isthe equivalent of ten bytes.

• Reload the double field to the E\6HW byte field. These data correspond to data field7HPSHUDWXUH, which is present in the archive. A double field requires an area of eightbytes. The byte order has to be reversed.

• Reload the integer field to the E\6HW byte field. These data correspond to data field3UHVVXUH, which is present in the archive. An integer field requires an area of four bytes.The byte order has to be reversed.

• The E\6HW byte field is now written to the raw data tag that corresponds to the threeWinCC tags used for checking.

• The data sent by the archive are now deleted. For this purpose, a byte field consisting ofzeroes is written to tag 5$:BH[B8$UGB��.

Page 411: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-65C79000-G8276-C140-01

Job message frame in DB26 (read data record)

DB 26 Read data record 0:KY = 028,000 Message frame length low 1:KY = 000,000 Message frame length high 2:KY = 002,000 Transfer type, reserve 3:KY = 001,000 Number of jobs 4:KC =’USRARCRD’ PLCID 8:KY = 012,000 Job length 9:KY = 006,000 Job type 10:KY = 000,000 Field number 11:KY = 002,000 Data record number low 12:KY = 000,000 Data record number high 13:KY = 000,000 Selection criterion 14:KH = 0000 15:KH = 0000

• The program excerpt above shows the job message frame for reading a data record fromthe archive. The structure of the job message frames can be taken from Section �������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV. Attention must be paid to the coding of thenumerical values. The least significant byte is sent first.

• The number of the data record that has to be read is entered in the message frame bymeans of 3%�.

1RWH�'%�� stores the message frame for reading a data field. This differs from the messageframe for reading a data record only in respect of a different value for the job type (9). Thedata field number is entered in this message frame by means of 3%�, in addition to the datarecord number.

Acknowledgement message frame in DB23

DB 23 Receive block 0:KY = 046,000 Message frame length low 1:KY = 000,000 Message frame length high 2:KY = 002,000 Transfer type, Reserve 3:KY = 001,000 Error code,job type 4:KY = 000,000 Reserved 5:KY = 001,000 Field number 6:KY = 002,000 Data record number low 7:KY = 000,000 Data record number high 8:KC =’USRARCRD’ PLCID 12:C =’Record_001’ RecordName 10 bytes -> 17:KH = 0000 Temperature 8 bytes -> 18:KH = 0000 19:KH = 0000 20:KH = 0000 21:KH = 0000 Pressure 4 bytes -> 22:KH = 0000 23:KH = 0000 24:KH = 0000 25:KH = 0000

Page 412: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-66 WinCC Configuration ManualC79000-G8276-C140-01

• The program excerpt above shows the acknowledgement message frame for reading adata record from the archive. The structure of the acknowledgement message framescan be taken from the section that follows, �������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJHIUDPHV.

• The data are re-stored from the data area of the message frame by means of projectfunction $FWXDOLVH'DWD6HW�� to the WinCC tags. This means that successful sending ofdata is immediately visible in the example project.

• In the case of a job to send a data field, the data area of the acknowledgement messageframe does not contain more than a single data field. The data field is re-stored in thecorresponding WinCC tag by means of project function $FWXDOLVH'DWD)LHOG��.

-REV�IRU�UHDGLQJ�IURP�WKH�3/&

6WHS 3URFHGXUH��-REV�IRU�5HDGLQJ�IURP�WKH�3/&

1 In the case of read jobs (read from the programmable logic controller), the datastored in tags 7��ZBH[B8$UGB��, *��ZBH[B8$UGB�� and 6��ZBH[B8$UGB��have to be re-stored in the data areas of the write message frames of the PLCprogram. In the present example, this is performed at the WinCC end by meansof project functions.

Create two raw data tags. A tag, in our example tag 5$:BH[B8$UGB��,corresponds with regard to its addressing to the data area of the message framefor sending a data record in the PLC program. A second tag, in our example tag5$:BH[B8$UGB��, corresponds with regard to its addressing to the data area ofthe message frame for sending a data field in the PLC program.

If object %XWWRQ�� (read record from PLC) is operated by clicking 8, projectfunction /RDG'DWD6HW�� is called. These re-stores the current data of the tags inthe data area of the message frame for writing a data record.

Further, control tag 8��ZBH[B8DUGB�� is set to a hexadecimal value of �[����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC to send a data record. In ourexample, the message frame we are referring to is located in '%��.

2 The procedure for reading from fields on the PLC is similar to that for readingrecords. However, only a single field is processed.

If object %XWWRQ�� (read record from PLC) is operated by clicking 8, projectfunction /RDG'DWD)LHOG�� is called. This function re-stores the current data of thetag corresponding to the currently set field number in the data area of themessage frame for writing a data field.

Further, control tag 8��ZBH[B8DUGB�� is set to a hexadecimal value of �[����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC to send a data field. In ourexample, the message frame we are referring to is located in '%��.

Page 413: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-67C79000-G8276-C140-01

Job message frame in DB27 (write data record)

DB 28 Write data record 0:KY = 050,000 Message frame length low 1:KY = 000,000 Message frame length high 2:KY = 002,000 Transfer type, reserve 3:KY = 001,000 Number of jobs 4:KC =’USRARCRD’ PLCID 8:KY = 034,000 Job length 9:KY = 007,000 Job type 10:KY = 000,000 Field number 11:KY = 003,000 Data record number low 12:KY = 000,000 Data record number high 13:KY = 000,000 Selection criterion 14:KC =’Record_001’ RecordName 10 bytes -> 19:KH = 0000 Temperature 8 bytes -> 20:KH = 0000 21:KH = 0000 22:KH = 5940 23:KH = 2D00 Pressure 4 bytes-> 24:KH = 0000 25:KH = 0000 26:KH = 0000

• The program excerpt above shows the job message frame for sending a data record tothe archive. The structure of the job message frames can be taken from Section �������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV. Attention must be paid to the coding of thenumerical values. The least significant byte is sent first.

• The number of the data record, to which the message frame data are required to bewritten, is written to the message frame by means of 3%�.

• The data from the tags are entered in the data area of the message frame by means ofproject function /RDG'DWD6HW��.

1RWH�'%�� stores the message frame for writing a data field. This differs from the messageframe from writing a data record only in respect of a different value for the job type (10).Further, the data area of the message frame contains only the data of one message field.The data field number is entered in this message frame by means of 3%�, in addition to thedata record number.

Page 414: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-68 WinCC Configuration ManualC79000-G8276-C140-01

-REV�IRU�GHOHWLQJ�IURP�WKH�DUFKLYH

6WHS 3URFHGXUH��-REV�IRU�'HOHWLQJ�IURP�WKH�DUFKLYH

1 If object %XWWRQ�� (delete record) is operated by pressing 8, control tag8��ZBH[B8$UGB�� is set by means of a GLUHFW�FRQQHFWLRQ to a hexadecimal valueof �[����. However, decimal values have to be entered in the &RQVWDQW inputfield of the 'LUHFW�&RQQHFWLRQ dialog box. In the present case, the value is ����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC to delete a data record. Inour example, the message frame we are referring to is located in '%��.

2 If object %XWWRQ�� (delete record) is operated by pressing 8, control tag8��ZBH[B8$UGB�� is similarly set by means of a GLUHFW�FRQQHFWLRQ to ahexadecimal value of �[����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to delete all data records. In ourexample, the message frame we are referring to is located in '%��.

Page 415: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-69C79000-G8276-C140-01

Job message frame in DB28 (Delete data record)

DB 28 Delete data record 0:KY = 026,000 Message frame length low 1:KY = 000,000 Message frame length high 2:KY = 002,000 Transfer type, reserve 3:KY = 001,000 Number of jobs 4:KC =’USRARCRD’ PLCID 8:KY = 010,000 Job length 9:KY = 008,000 Job type 10:KY = 000,000 Field number 11:KY = 001,000 Data record number low 12:KY = 000,000 Data record number high 13:KH = 0000 14:KH = 0000

• The program excerpt above shows the job message frame for deleting a data recordfrom the archive. The structure of the job message frames can be taken from Section��������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV. Attention must be paid to the coding ofthe numerical values. The least significant byte is sent first.

• The number of the data record that has to be deleted is entered in the message frame bymeans of 3%�.

Job message frame in DB25 (Delete all data records)

DB 25 Delete all data records 0:KY = 020,000 Message frame length low 1:KY = 000,000 Message frame length high 2:KY = 002,000 Transfer type, reserve 3:KY = 001,000 Number of jobs 4:KC =’USRARCRD’ PLCID 8:KY = 004,000 Job length 9:KY = 005,000 Job type 10:KH = 0000 11:KH = 0000

• The program excerpt above shows the job message frame for deleting all data recordsfrom the archive.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made for general use:

• The configurations performed for the connection can be directly applied to privateapplications, provided that the hardware used is identical. If not, adjustments have to bemade in this area.

• Adapt the structure and format of the archive to your own requirements.

• You can adopt the type of organization of the job message frames. It is sufficient,however, to configure a single job message frame if the job type is entered in it by theprogram.

Page 416: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-70 WinCC Configuration ManualC79000-G8276-C140-01

������ &RQQHFWLRQ�YLD�:LQ&&�5DZ�'DWD�7DJV�WR�WKH�6��H[B�BFKDSWHUB��F�SGO�

7DVN�GHILQLWLRQ

We want to establish a connection to a programmable logic controller. The programmablelogic controller we are going to use is the S7. The following description refers to the use ofan S7-400 (CPU 414-2D). We want communication to take place via the MPI.

Further, we wish to create an archive. The data records in this archive will consist of a textfield, an integer field and a double field. We want the archive data to be displayed in tabularform at runtime. They are required to be made available to the programmable logiccontroller on a record-by-record and field by field basis.

1RWH�The option of communication between User Archive and the programmable logic controllervia WinCC raw data tags should be preferred when the majority of the activities are to becontrolled by the programmable logic controller.In the present example, however, the WinCC user takes the initiative. The programmablelogic controller will be prompted to send job message frames to WinCC by way of setting acontrol tag. In this way the functionality otherwise present in the programmable logiccontroller is simulated.

,PSOHPHQWDWLRQ�FRQFHSW

We establish a connection to an S7 via the MPI. Two connections are created in ControlCenter. Create a WinCC raw data tag for this connection. We want to use this tag forcommunication between the programmable logic controller and the User Archive that weare going to create. The second connection is used to connect WinCC tags.

We create a User Archive which we want to communicate with the PLC by means ofWinCC raw data tags. The tag we created earlier is assigned to the archive.The archive data are displayed at runtime by means of an OLE control. Control bits are seton the programmable logic controller by means of various buttons. They trigger the transferof raw data message frames for writing, reading and deleting different data records and datafields.

6,0$7,&�6��SURWRFRO�VXLWH�FRPPXQLFDWLRQ�GULYHU

This driver will be used for communication with the programmable logic controller in ourexample. The driver contains five different channel units. In our example, we use the MPIchannel unit. It is suitable for connections to a SIMATIC S7-300 and S7-400 through theMPI. An MPI ISA card is used as the PC interface. Not more than one module can be used.It should communicate with not more than four programmable logic controllers.

Page 417: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-71C79000-G8276-C140-01

&RQILJXULQJ�WKH�03,�FDUG

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�03,�&DUG

1 Install the WinCC component called 6�'RV. If this was not done at the time whenWinCC was installed, the 6�'RV component can be installed later.

2 Install the MPI ISA card on the PC. Install the card on the PC exactly as stated inthe installation instructions enclosed with the card. Following this, softwareinstallation of the card has to be performed, again by precisely following theinstructions.

Start the 6HW�3URJUDPPLQJ�'HYLFH�3&�,QWHUIDFH program on the Control Panel.

The access point for the MPI was entered by default at the time WinCC wasinstalled. This is the access point labeled 03,��:LQ&&�.

Page 418: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-72 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�03,�&DUG

3 Assign a module to the access point. The module has to be installed first,

however. This is accomplished by means of the button in the0RGXOHV box. The ,QVWDOO�8QLQVWDOO�0RGXOH dialog box is opened. In the left listbox, we select the �03,�,6$�&DUG entry and install the card using the

button.

Page 419: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-73C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�03,�&DUG

4 The 03,�,6$�&DUG�5HVRXUFHV dialog box opens. The set memory area canfrequently not be used. We recommend the ���'��������'��)). area

5 To avoid duplicate assignment of the memory area and interrupts, it is sensible tolook in :LQGRZV�17�'LDJQRVWLFV. You do this by choosing the 6WDUW�PHQX�→3URJUDPV�→�$GPLQLVWUDWLYH�7RROV��&RPPRQ��→�:LQGRZV�17�'LDJQRVWLFV.

The :LQGRZV�17�'LDJQRVWLFV program appears. In this program, select the5HVRXUFHV card.

You can determine the interrupts in use by clicking the button. If

you click the button, you can determine which the memorylocations are in use.

6 The settings in the 03,�,6$�&DUG�5HVRXUFHV dialog box are now completed byclicking 2. and the ,QVWDOO�8QLQVWDOO�0RGXOHV dialog box is closed.

7 Assign the card you have just installed to the access point. To do this, in the 6HW3URJUDPPLQJ�'HYLFH�3&�,QWHUIDFH program select access point 03,��:LQ&&� inthe top list box and select the entry for the 03,�,6$�&DUG in the bottom list.

Page 420: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-74 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�03,�&DUG

8 Set the properties of the MPI ISA card. We do this by clicking the

button. In the 03,�,6$�&DUG�03,� Properties dialog box thatappears, set a ORFDO�QRGH�DGGUHVV for the card on the 03,�1HWZRUN tab. TheWUDQVPLVVLRQ�UDWH we use on the S7-300 must be ������NELW�VHF. On the S7-400,even ����0ELW�VHF would be possible.

Page 421: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-75C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�03,�&DUG

&RQILJXULQJ�WKH�FRQQHFWLRQ�RQ�WKH�SURJUDPPDEOH�ORJLF�FRQWUROOHU

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF&RQWUROOHU

1 In our example, we use the default programming device interface of theprogrammable logic controller for the MPI connection. In this instance noadditional card is required at the programmable logic controller end. All we haveto do is create the MPI node and define the MPI address of the programmablelogic controller.

To do this, open +DUGZDUH in 6,0$7,&�0DQDJHU. The +:�&RQILJ program isopened. In the present example, the CPU is in slot 3. Open the Properties dialog

box for the CPU module we are using by clicking 85.

2 In the &38������'3�3URSHUWLHV dialog box that appears, select the *HQHUDO

,QIRUPDWLRQ tab. Click the button to open the 03,�8VHU�3URSHUWLHVdialog box.

Page 422: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-76 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF&RQWUROOHU

On the 3RZHU�6XSSO\ tab, enter a � as the value for the DGGUHVV in the 8VHU box.This value also has to be specified later in WinCC when we configure theconnection.

Finish the settings in the 03,�8VHU�3URSHUWLHV dialog box by clicking 2.. Closethe &38������'3�3URSHUWLHV dialog box similarly by clicking 2.. We can thenexit the +:�&RQILJ program.

&RQILJXULQJ�WKH�FRQQHFWLRQ�LQ�&RQWURO�&HQWHU

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

1 Install the required driver for the necessary programmable logic controller and

necessary driver connections. In &RQWURO�&HQWHU, click 85 on option 7DJ0DQDJHPHQW to open the $GG�1HZ�'ULYHU dialog box.

Select the 6,0$7,&�6��3URWRFRO�6XLWH driver from the list shown in the dialogbox. Exit the dialog box by clicking 2SHQ.

Page 423: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-77C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

2 Configure a connection for the driver you have just added. This is accomplished

in &RQWURO�&HQWHU by clicking 85 on the 03, channel unit entry.

The &RQQHFWLRQ�3URSHUWLHV dialog box is displayed.

Enter the name of the new connection on the *HQHUDO�,QIRUPDWLRQ tab. In ourexample, we use the QDPH� 6������:LQ&&�3DVVLYH.

We set the properties of the connection on the &RQQHFWLRQ tab. In our example,we set the VWDWLRQ�DGGUHVV to the value of � that is set on the PLC.

We have to set the values of the VHJPHQW�,', UDFN�QXPEHU and VORW�QXPEHU inaccordance with the conditions prevalent on the programmable logic controller.

Select the 6HQG�5HFHLYH�5DZ�'DWD�%ORFN check box. We want this connection tobe responsible for communication via WinCC raw data tags. The FRQQHFWLRQUHVRXUFH we enter in our example is ��.

Close the dialog box by clicking 2..

Page 424: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-78 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

3 Set the system parameters for the channel unit being used. To do this, click 85

on their entry.

The 6\VWHP�3DUDPHWHUV dialog box opens.

Close the dialog box by clicking 2..

Page 425: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-79C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

4 We create a new tag group in our example for the new connection we havecreated. In the 1HZ�7DJ dialog box, we use the name 5$:BH[B8$6�B�� in ourexample. We set the tag type to 5DZ�'DWD�7\SH.

Click the button to open the $GGUHVV�3URSHUWLHV dialog box. Weselect the 5DZ�'DWD check box. The value of the 5B,' we use in our example is�. %6(1'�%5&9 is used in the Raw Data Type box.

Complete the settings in the $GGUHVV�3URSHUWLHV dialog box by clicking 2..Similarly, click 2. to close the 7DJ�3URSHUWLHV dialog box.

We want to use the tag we have just created for communication between the UserArchive and the programmable logic controller.

Page 426: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-80 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

5 Configure a further connection for the 6,0$7,&�6��3URWRFRO�6XLWH driver. Wewant to use it for communication for the normal WinCC tags.

In the &RQQHFWLRQ�3URSHUWLHV dialog box, enter the name of the new connectionon the *HQHUDO�,QIRUPDWLRQ tab. In our example, we use the QDPH�6������:LQ&&�$FWLYH.

We set the properties of the connection on the &RQQHFWLRQ tab. In our example,we set the VWDWLRQ�DGGUHVV to the value of � that is set on the PLC.

We have to set the values of the VHJPHQW�,', UDFN�QXPEHU and VORW�QXPEHU inaccordance with the conditions prevalent on the programmable logic controller.

Close the dialog box by clicking 2..

Page 427: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-81C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

6 Create external tags for triggering actions on the programmable logic controllerand for checking correct functioning of the connection.

We create these tags in a new tag group, which we have yet to create, in the 6�����8�:LQ&&�$FWLYH connection.

In our example, the tag group in which we are going to create the tags will becalled 8VHU�$UFKLYHB6�.

7 The tags we need to create and their addressing on the programmable logiccontroller are shown at length in the list below.

Tags 7��ZBH[B8$6�B��, *��ZBH[B8$6�B�� and 6��ZBH[B8$6�B�� arerequired to accommodate data sent to and from User Archive.

Tags 8��ZBH[B8$6�B�� and 8��ZBH[B8$6�B�� are to be used to set therecord number that has to be edited or the field number that needs editing.

Tag 8��ZBH[B8$��B�� is used as a control tag. We wish to use it to set the typeof job that has to be performed and to trigger it.

Page 428: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-82 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�WKH�&RQQHFWLRQ�LQ�&RQWURO�&HQWHU

8 Check the connection to the programmable logic controller. To do this, switch theWinCC project to Runtime and start the programmable logic controller. A dialogbox, which you can open by choosing 2SWLRQV�→�6WDWXV�RI�'ULYHU�&RQQHFWLRQV in&RQWURO�&HQWHU, keeps you informed of the status of the connection.

For the 6,0$7,&�3URWRFRO�6XLWH driver, however, a separate status dialog box isavailable for the different connections of the channel unit. It is opened by

clicking 85 on the button of the corresponding channel unit and the V\VWHPSDUDPHWHUV entry in the shortcut menu that is displayed. The 6\VWHP�3DUDPHWHUVdialog box opens. The &RQQHFWLRQV tab displays the current states of the differentconnections.

Page 429: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-83C79000-G8276-C140-01

&RQILJXULQJ�WKH�8VHU�$UFKLYH

6WHS 3URFHGXUH��&RQILJXULQJ�8VHU�$UFKLYH

1 Open the 8VHU�$UFKLYH editor and create a new archive. Do this by clicking 85

on $UFKLYHV. The wizard for creating a new archive appears.

2 On the *HQHUDO�,QIRUPDWLRQ page, we enter 8VHU�$UFKLYHB6� as the DUFKLYH�QDPHand specify the DUFKLYH�W\SH as 8QOLPLWHG.

3 On the &RPPXQLFDWLRQ page, we set &RPPXQLFDWLRQ�YLD�:LQ&&�5DZ�'DWD�7DJV.

Once this item has been selected, the 3/&,' input field can be used. In ourexample, we will use the name 865$5&6� as the 3/&,'. This ID must not belonger than eight characters. This ID can be used to assign, to a specific archive,a block of raw data that has been sent by the programmable logic controller.

Click the button to set the WinCC raw data tag used forcommunication. In our example, we set the tag we created earlier,5$:BH[B8$6�B��, in the 7DJ box.

4 In our example, we will not perform any more settings on the remaining pages ofthe wizard.

3 The boxes listed in the table that follows are created in our example for thearchive you have just configured. We now save the settings we have performed.

5 Several data records can now be created for the archive in the bottom window ofthe User Archive table editor.

Page 430: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-84 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�8VHU�$UFKLYH

3URJUDP�JHQHUDWLRQ�RQ�WKH�SURJUDPPDEOH�ORJLF�FRQWUROOHU

6WHS 3URFHGXUH��3URJUDP�*HQHUDWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF�&RQWUROOHU

1 We have to create a data block in which we store the data for controlling andmonitoring communication.This is control tag 8��ZBH[B8$6�B��, which contains the job type. Further,there are the communication monitoring tags, 7��ZBH[B8$6�B��,*��ZBH[B8$6�B�� and 6��ZBH[B8$6�B��, as well as the tags for setting therecord number and field number for editing, 8��ZBH[B8$6�B�� and8��ZBH[B8$6�B��.In our example, this data block is '%��.

2 Create a further data block which we can use to handle communication with UserArchive. In our example, this is '%��. The address of the raw data tag set in theuser archive editor refers to this memory area.

WinCC sends to it the acknowledgement of the raw data message framesreceived from the programmable logic controller. The structure of theacknowledgement message frames can be taken from the section that follows,�������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV.

3 To illustrate the example more clearly, a separate raw data message frame isstored in a separate data data block for every job type. The structure of these jobmessage frames is explained in the section that follows, �������6WUXFWXUH�RI�UDZGDWD�PHVVDJH�IUDPHV.

4 Every job message frame has an area for accommodating the data record numberand data field number. In WinCC, we enter the values for these specifications intags 8��ZBH[B8$6�B�� and 8��ZBH[B8$6�B��. The tag types have beenchosen in accordance with the length specified in the message frame structure forthe different values. The data record number requires 4 bytes, while the data fieldnumber requires 2 bytes.

In the PLC program, these values are reloaded to the different job messageframes by means of a separate program block. The data record number is requiredfor all job types except the 'HOHWH�$OO�'DWD�5HFRUGV type. The data field numberis required only for job types :ULWH�)LHOG and 5HDG�)LHOG. The program blockresponsible for reloading the values is )&� in our example.

5 All communication handling is performed by another program block. In ourexample, this is )&�. It is processed on a cyclic basis by means of 2%�.

The contents of the control tag are transferred to a specific memory byte in )&�.In our example, this is memory byte 30. Depending on the states of the differentbit memories, job message frames are sent to WinCC. This is accomplished in

Page 431: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-85C79000-G8276-C140-01

6WHS 3URFHGXUH��3URJUDP�*HQHUDWLRQ�RQ�WKH�3URJUDPPDEOH�/RJLF�&RQWUROOHU

each case by the send block known as %6(1'.

Description of FC5 (communication with archive)

FUNCTION FC 5 : VOIDTITLE = Communication with User Archiver//Communication with User Archive via raw data message framesVERSION : 0.0

VAR_TEMP stat : WORD ; len : WORD ;END_VARBEGIN

NETWORKTITLE = Preparations for communication//Load the job type in memory word 30, reset job type,//reload record number and field number via FC7 L DB21.DBW 0; T MW 30; L 0; T DB21.DBW 0; CALL FC 7 ;NETWORKTITLE = Transmit data length//Set tag #len (length of transmit data) to a value of 50 L 50; T #len; NOP 0;NETWORKTITLE = Delete all records//If bit memory 30.1 set, send job "Delete all records" U M 30.1; = L 4.0; BLD 103; CALL SFB 12 , DB 12 ( REQ := L 4.0, ID := W#16#10, R_ID := DW#16#5, STATUS := #stat, SD_1 := P#DB25.DBX 0.0 BYTE 4, LEN := #len); NOP 0;NETWORKTITLE = Read data record//If bit memory 30.2 set, send job "Read data record" U M 30.2; = L 4.0; BLD 103; CALL SFB 12 , DB 12 ( REQ := L 4.0, ID := W#16#10, R_ID := DW#16#5, STATUS := #stat, SD_1 := P#DB26.DBX 0.0 BYTE 4, LEN := #len); NOP 0;NETWORK

Page 432: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-86 WinCC Configuration ManualC79000-G8276-C140-01

TITLE = Write data record//If bit memory 30.3 set, send job "Write data record" U M 30.3; = L 4.0; BLD 103; CALL SFB 12 , DB 12 ( REQ := L 4.0, ID := W#16#10, R_ID := DW#16#5, STATUS := #stat, SD_1 := P#DB27.DBX 0.0 BYTE 4, LEN := #len); NOP 0;NETWORKTITLE = Delete data record//If bit memory 30.4 set, send job "Delete data record" U M 30.4; = L 4.0; BLD 103; CALL SFB 12 , DB 12 ( REQ := L 4.0, ID := W#16#10, R_ID := DW#16#5, STATUS := #stat, SD_1 := P#DB28.DBX 0.0 BYTE 4, LEN := #len); NOP 0;NETWORKTITLE = Read data field//If bit memory 30.5 set, send job "Read data field" U M 30.5; = L 4.0; BLD 103; CALL SFB 12 , DB 12 ( REQ := L 4.0, ID := W#16#10, R_ID := DW#16#5, STATUS := #stat, SD_1 := P#DB29.DBX 0.0 BYTE 4, LEN := #len); NOP 0;NETWORKTITLE = Write data field//If bit memory 30.6 set, send job "Write data field" U M 30.6; = L 4.0; BLD 103; CALL SFB 12 , DB 12 ( REQ := L 4.0, ID := W#16#10, R_ID := DW#16#5, STATUS := #stat, SD_1 := P#DB30.DBX 0.0 BYTE 4, LEN := #len); NOP 0;NETWORKTITLE = Receive acknowledgement//Acknowledgement message frames received from WinCC are stored in DB23 CALL SFB 13 , DB 13 ( ID := W#16#10, R_ID := DW#16#5, STATUS := #stat,

Page 433: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-87C79000-G8276-C140-01

RD_1 := P#DB23.DBX 0.0 BYTE 100, LEN := #len); NOP 0;END_FUNCTION

• This program block is called in OB1. This means that it is processed on a cyclic basis.

• On the first network, the address area of the control tag sent by WinCC,8��ZBH[B8$UGB��, is transferred to memory word 30. The contents of the control tagis then reset to zero. Further, the record number and field number entered in WinCC areentered in the different message frames by means of FC7. In this case we mustremember that the byte order has to be changed.

• On the second network, the tag called #len, which transfers the length of the messageframes that have to be transmitted to subsequent send jobs, is set to 50.

• On the third network, a job message frame is sent to WinCC in the event of bit memory30.1 being set. In this case the message frame is used to delete all the data records froman archive.

• On subsequent networks, other job message frames are sent to WinCC depending on thestate of memory byte 30. The only differences between the calls relate to the addressingof the start of the data that have to be transmitted.

• On the final network, acknowledgement message frames originating from WinCC areforwarded to DB23.

&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

1 Create a new picture in *UDSKLFV�'HVLJQHU. In our example, this is the picturecalled H[B�BFKDSWHUB��F�SGO.

We configure an OLE control in this picture at 6PDUW�2EMHFW�→�2/(�&RQWURO. Inthe ,QVHUW�2OH�&RQWURO dialog box that appears, we select the entry :LQ&&�8VHU$UFKLYH�7DEOH�&RQWURO from the list displayed. Close the dialog box by clicking2.. The deactivated :LQ&&�8VHU�$UFKLYH�7DEOH�&RQWURO appears. In ourexample, we use the object called 2/(�&RQWURO�.

2 Click 8' on the object known as 2/(�&RQWURO� to open its Properties dialogbox.

On the *HQHUDO�,QIRUPDWLRQ tab, we select $UFKLYH�8VHU�$UFKLYHB6� as the6RXUFH. In the (GLW field, we select check boxes 3DVWH, &KDQJH and 'HOHWH tomake all the editing options available to the user. In addition, we select the%RUGHU check box.

On the &ROXPQV tab, we select all the existing data fields of the archive.

On the 7RROEDU tab, we deselect the two buttons :ULWH�7DJ and 5HDG�7DJ.Control is performed by the programmable logic controller in the presentexample. All the other buttons on the toolbar will be used.

On the 6WDWXV�%DU tabs, we apply the presettings and thus use all the existing

Page 434: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-88 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

elements.

On the )RQWV tab, we will reduce the VL]H of the font to ���� in order to be ablesimultaneously to display all columns of the table at runtime.

On the )LOWHU�6RUW tab, we will not perform any settings for our example.

Complete the settings in the 3URSHUWLHV�RI�:LQ&&�8VHU�$UFKLYH�7DEOH�&RQWUROdialog box by clicking 2..

The color scheme of the table has been adapted in our example to the colorscheme used throughout the project by means of the Properties dialog box of the2/(�&RQWURO� object.

3 To display the data transferred from User Archive to the programmable logiccontroller, we configure three I/O fields at 6PDUW�2EMHFWV�→�,�2�)LHOGV. In ourexample, these are the objects ,�2�)LHOG�, ,�2�)LHOG� and ,�2�)LHOG�.

At the ,�2�ILHOGV, we create - at 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW�9DOXH - aWDJ�FRQQHFWLRQ for each of the three tags 7��ZBH[B8$6�B��, 6��ZBH[B8$6�B��and *��ZBH[B8$6�B��.

4 To set the record number that has to edited and the field number, we create twomore I/O fields at 6PDUW�2EMHFWV�→�,�2�)LHOGV. In our example, these are theobjects ,�2�)LHOG� and ,�2�)LHOG�.

At the object ,�2�)LHOG�, we create at 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW9DOXH a WDJ�FRQQHFWLRQ to tag 8��ZBH[B8$6�B��. This is used to accommodatethe record number.

At the object ,�2�)LHOG�, we create at 3URSHUWLHV�→�2XWSXW�,QSXW�→�2XWSXW9DOXH a WDJ�FRQQHFWLRQ to tag 8��ZBH[B8$6�B��. This is used to accommodatethe field number.

To trigger actions on the programmable logic controller, we configure six buttonsat :LQGRZV�2EMHFWV�→�%XWWRQ. In our example, these objects are %XWWRQ�� to%XWWRQ��.

When a button is clicked, a different value is written to tag 8��ZBH[B8DUGB��.Every value corresponds to a different type of job for the programmable logiccontroller. Refer to the list below for the assignment of individual values to thecorresponding jobs. The values are specified as hexadecimal.

• 0x0200 = Delete All Records

• 0x0400 = Write Record to PLC

• 0x0800 = Read Record from PLC

• 0x1000 = Delete Record from Archive

• 0x2000 = Write Field to PLC

• 0x4000 = Read Field from PLCThis tag is periodically queried in the PLC program. A corresponding job istriggered depending on the contents of the tag.

Page 435: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-89C79000-G8276-C140-01

6WHS 3URFHGXUH��&RQILJXULQJ�LQ�*UDSKLFV�'HVLJQHU

1RWH�In our example, we want to test the exchange of data between User Archive and theprogrammable logic controller. A complex program that sends and receives would gobeyond the framework of a basic description of the connection.For checking communication, tags 7��ZBH[B8$6�B��, *��ZBH[B8$6�B�� and6��ZBH[B8$6�B�� have been created. I/O field data are used to make entries in these tagsat runtime. These data are then re-stored in the data area of a job message frame usingproject functions.The procedure with data arriving at the programmable logic controller is similar. They arere-stored from the data area of the acknowledgement message frame in the correspondingtags by means of a project function.

-REV�IRU�ZULWLQJ�WR�WKH�3/&

6WHS 3URFHGXUH��-REV�IRU�:ULWLQJ�WR�WKH�3/&

1 With write jobs (write to the programmable logic controller), the data arriving atthe programmable logic controller in our example are re-stored in tags7��ZBH[B8$6�B��, *��ZBH[B8$6�B�� and 6��ZBH[B8$6�B��. This is doneto check the function and is not necessary in normal practice. In the presentexample, the storage of data at the WinCC end is solved by means of projectfunctions.

Two raw data tags were created. One of the tags is 5$:BH[B8$UGB�� in ourexample. With regard to its address, it corresponds to the data area of theacknowledgement message frame sent to the requesting programmable logiccontroller by WinCC in response to a job. The second tag is 5$:BH[B8$UGB��in our example. With regard to its addressing, it corresponds to the memory areaon the programmable logic controller in which the three WinCC tags used forchecking are addressed.

When the data are re-stored, we have to make sure that the first byte of a numberoccurring in a raw data message frame is the least significant byte. In the case ofWinCC tags, the byte order is exactly the reverse of this.

If object %XWWRQ� (write record to PLC) is operated by clicking 8, an internaltag of the ELQDU\�WDJ type is set. In our example, this is tag %,1LBH[B8$6�B��.Further, control tag 8��ZBH[B8$6�B�� is set to a value of 0x0400.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC, which requests a specificdata record. The requested data are then sent by means of the raw data tag set inUser Archive to the programmable logic controller (acknowledgement messageframe).

We configure a &�DFWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ; of the button

Page 436: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-90 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��-REV�IRU�:ULWLQJ�WR�WKH�3/&

that is triggered when tag 5$:BH[B8$6�B�� is modified. Any change to this tagsignifies that new data have been sent.

Tag %,1LBH[B8$6�B�� is checked in the &�DFWLRQ. If it has been set, a new datarecord (as opposed to a new data field) has been sent. Project function$FWXDOLVH6�'DWD6HW�� is then triggered and performs the re-store operation of thesent data to the WinCC tags. Further, tag %,1LBH[B8$UGB�� is reset.

2 The procedure for writing fields to the PLC is similar to step 1. However, only asingle field is processed.

If object %XWWRQ�� (write field to PLC) is operated by clicking 8, an internal tagof the ELQDU\�WDJ type is set. In our example, this is tag %,1LBH[B8$6�B��.Further, control tag 8��ZBH[B8$6�B�� is set to a value of 0x2000.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC, which requests a specificdata field of a data record. The requested data are then sent by means of the rawdata tag set in User Archive to the programmable logic controller(acknowledgement message frame).

We configure a &�DFWLRQ at 3URSHUWLHV�→�*HRPHWU\�→�3RVLWLRQ; of the buttonthat is triggered when tag 5$:BH[B8$6�B�� is modified. Any change to this tagsignifies that new data have been sent.

Tag %,1LBH[B8$6�B�� is checked in the &�DFWLRQ. If it has been set, a new datafield (as opposed to a new data record) has been sent. Project function$FWXDOLVH6�'DWD)LHOG�� is then triggered and performs the re-store operation ofthe sent field to the corresponding WinCC tag. This is performed as a function ofthe currently set field number. Further, tag %,1LBH[B8$6�B�� is reset.

C action on Button9 at a click of the mouse

#include "apdefap.h"void OnClick(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

SetTagWord("U16w_ex_UAS7_01",0x0400);

SetTagBit("BINi_ex_UAS7_01",TRUE);

}

• Trigger a job on the programmable logic controller. This is done by setting tag8��ZBH[B8$6�B�� to a defined value. In this instance we use the value �[����. Itcauses the programmable logic controller to request a record.

• Set tag %,1LBH[B8$6�B��. This indicates that a data record has been requested.

Page 437: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-91C79000-G8276-C140-01

C action on Button9 at the PositionX property

#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char*

lpszPropertyName){

if (GetTagBit("BINi_ex_UAS7_01") == TRUE){

ActualiseS7DataSet();SetTagBit("BINi_ex_UAS7_01",FALSE);

}

return 470;}

• Check tag %,1LBH[B8$6�B��.

• If it has been set, a data record has been sent. In this instance project function$FWXDOLVH6�'DWD6HW�� is called. It re-stores the data area of the sent acknowledgementmessage frame in the WinCC tags. Further, tag %,1LBH[B8$6�B�� is reset.

• This action is triggered upon a change to tag 5$:BH[B8$6�B��. This tag is addressedto the data area of the acknowledgement message frame sent by WinCC. If its valuechanges, it means that new data have arrived on the programmable logic controller.

Project function ActualiseS7DataSet()

void ActualiseDataSet(){BYTE byData[22];BYTE bySet[22];int i;

GetTagRaw("RAW_ex_UAS7_02",&byData[0],22);

//load text datafor (i=0; i<10; i++){

bySet[i]=byData[i];}//load double datafor (i=0; i<8; i++){

bySet[17-i]=byData[10+i];}//load integer datafor (i=0; i<4; i++){

bySet[21-i]=byData[18+i];}

SetTagRaw("RAW_ex_UAS7_08",&bySet[0],22);

//init telegram datafor (i=0; i<22; i++){

byData[i] = 0;}SetTagRaw("RAW_ex_UAS7_02",&byData[0],22);}

Page 438: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-92 WinCC Configuration ManualC79000-G8276-C140-01

• Declaration of two byte fields. They are required to store the data of the raw data tags.

• Read the data sent to the programmable logic controller to the E\'DWD byte field.

• Reload the text box to the E\6HW byte field. These data correspond to data field5HFRUG1DPH, which is present in the 8VHU�$UFKLYHBUG archive. The 10-character field isthe equivalent of ten bytes.

• Reload the double field to the E\6HW byte field. These data correspond to data field7HPSHUDWXUH, which is present in the archive. A double field requires an area of eightbytes. The byte order has to be reversed.

• Reload the integer field to the E\6HW byte field. These data correspond to data field3UHVVXUH, which is present in the archive. An integer field requires an area of four bytes.The byte order has to be reversed.

• The E\6HW byte field is now written to the raw data tag that corresponds to the threeWinCC tags used for checking.

• The data sent by the archive are now deleted. For this purpose, a byte field consisting ofzeroes is written to tag 5$:BH[B8$6�B��.

Job message frame in DB26 (read data record)

DATA_BLOCK DB 26Name : SReadVersion : 0.0

struct TLngLow : WORD := W#16#1C00; //Frame length low TLngHigh : WORD := W#16#0; //Frame length high Transfer : WORD := W#16#200; //Transfer type, Reserve AAnz : WORD := W#16#100; //Number of jobs PLCID : ARRAY [1 .. 8 ] OF //PLCID of archive CHAR := ’U’,’S’,’R’,’A’,’R’,’C’,’S’,’7’; ALng : WORD := W#16#C00; //Job length ATyp : WORD := W#16#600; //Job type, Reserve FNr : WORD := W#16#0; //Field number SNrLow : WORD := W#16#200; //Data record number low SNrHigh : WORD := W#16#0; //Data record number high SelKrit : WORD := W#16#0: //Selection criterion Date1 : WORD; Date2 : WORD;

END_STRUCT ;

• The program excerpt above shows the job message frame for reading a data record fromthe archive. The structure of the job message frames can be taken from Section �������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV. Attention must be paid to the coding of thenumerical values. The least significant byte is sent first.

• The number of the data record that has to be read is entered in the message frame bymeans of )&�.

1RWH�'%�� stores the message frame for reading a data field. This differs from the messageframe from reading a data record only in respect of a different value for the job type (9).The data field number is entered in this message frame by means of )&�, in addition to thedata record number.

Page 439: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-93C79000-G8276-C140-01

Acknowledgement message frame in DB23

DATA_BLOCK DB 23NAME : QuitVersion : 0.1

struct TLngLow : WORD := W#16#2C00; //Frame length low TLngHigh : WORD := W#16#0; //Frame length high TTyp : WORD := W#16#100; //Transfer type, Reserve FCode : WORD := W#16#0; //Error code, job type Res : WORD := W#16#0; //Reserve FNr : WORD := W#16#100; //Field number SNrLow : WORD := W#16#300; //Data record number low SNrHigh : WORD := W#16#0; //Data record number high PLCID : ARRAY [1 .. 8 ] OF //PLCID CHAR := ’U’,’S’,’R’,’A’,’R’,’C’,’S’,’7’; Text : ARRAY [1 .. 10 ] OF //Text box CHAR := ’R’,’E’,’C’,’O’,’R’,’D’,’_’,’0’,’0’,’1’; Double0 : WORD := W#16#0; //Double field low Double1 : WORD := W#16#0; Double2 : WORD := W#16#0; Double4 : WORD := W#16#0; //Double field high IntLow : WORD := W#16#0; //Integer field low IntHigh : WORD := W#16#0; //Integer field high Data1 : WORD; Data2 : WORD;

END_STRUCT ;

• The program excerpt above shows the acknowledgement message frame for reading adata record from the archive. The structure of the acknowledgement message framescan be taken from the section that follows, �������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJHIUDPHV.

• The data are re-stored from the data area of the message frame by means of projectfunction $FWXDOLVH6�'DWD6HW�� to the WinCC tags. This means that successful sendingof data is immediately visible in the example project.

• In the case of a job to send a data field, the data area of the acknowledgement messageframe does not contain more than a single data field. The data field is re-stored in thecorresponding WinCC tag by means of project function $FWXDOLVH6�'DWD)LHOG��.

-REV�IRU�UHDGLQJ�IURP�WKH�3/&

6WHS 3URFHGXUH��-REV�IRU�5HDGLQJ�IURP�WKH�3/&

1 In the case of read jobs (read from the programmable logic controller), the datastored in tags 7��ZBH[B8$6�B��, *��ZBH[B8$6�B�� and 6��ZBH[B8$6�B��have to be re-stored in the data areas of the write message frames of the PLCprogram. In the present example, this is performed at the WinCC end by meansof project functions.

Create two raw data tags. A tag, in our example tag 5$:BH[B8$6�B��,corresponds with regard to its addressing to the data area of the message framefor sending a data record in the PLC program. A second tag, in our example tag5$:BH[B8$6�B��, corresponds with regard to its addressing to the data area ofthe message frame for sending a data field in the PLC program.

Page 440: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-94 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��-REV�IRU�5HDGLQJ�IURP�WKH�3/&

If object %XWWRQ�� (read record from PLC) is operated by clicking 8, projectfunction /RDG6�'DWD6HW�� is called. This re-stores the current data of the tags inthe data area of the message frame for writing a data record.

Further, control tag 8��ZBH[B8D6�B�� is set to a hexadecimal value of �[����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC to send a data record. In ourexample, the message frame we are referring to is located in '%��.

2 The procedure for reading from fields on the PLC is similar to that for readingrecords. However, only a single field is processed.

If object %XWWRQ�� (read field from PLC) is operated by clicking 8, projectfunction /RDG6�'DWD)LHOG�� is called. This function re-stores the current data ofthe tag corresponding to the currently set field number inn the data area of themessage frame for writing a data field.

Further, control tag 8��ZBH[B8D6�B�� is set to a hexadecimal value of �[����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to WinCC to send a data field. In ourexample, the message frame we are referring to is located in '%��.

Job message frame in DB27 (write data record)

DATA_BLOCK DB 27NAME : SWriteVersion : 0.0

struct TLngLow : WORD := W#16#3200; //Frame length low TLngHigh : WORD := W#16#0; //Frame length high TTyp : WORD := W#16#200; //Transfer type, Reserve AAnz : WORD := W#16#100; //Number of jobs PLCID : ARRAY [1 .. 8 ] OF //PLCID CHAR := ’U’,’S’,’R’,’A’,’R’,’C’,’S’,’7’; ALng : WORD := W#16#2200; //Job length ATyp : WORD := W#16#700; //Job type, Reserve FNr : WORD := W#16#0; //Field number SNrLow : WORD := W#16#300; //Data record number low SNrHigh : WORD := W#16#0; //Data record number high SelKrit : WORD := W#16#0; //Selection criterion Text : ARRAY [1 .. 10 ] OF //Text box CHAR := ’R’,’E’,’C’,’O’,’R’,’D’,’_’,’0’,’0’,’1’; Double0 : WORD := W#16#0; //Double field low Double1 : WORD := W#16#0; Double2 : WORD := W#16#0; Double4 : WORD := W#16#0; //Double field high IntLow : WORD := W#16#0; //Integer field low IntHigh : WORD := W#16#0; //Integer field high

Page 441: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-95C79000-G8276-C140-01

Data1 : WORD ; Data2 : WORD ;

END_STRUCT;

• The program excerpt above shows the job message frame for sending a data record tothe archive. The structure of the job message frames can be taken from Section �������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV. Attention must be paid to the coding of thenumerical values. The least significant byte is sent first.

• The number of the data record, to which the message frame data are required to bewritten, is written to the message frame by means of )&�.

• The data from the tags are entered in the data area of the message frame by means ofproject function /RDG6�'DWD6HW��.

1RWH�'%�� stores the message frame for writing a data field. This differs from the messageframe for writing a data record only in in as much as a there is a different value for the jobtype (10). Further, the data area of the message frame contains only the data of one messagefield.The data field number is entered in this message frame by means of )&�, in addition to thedata record number.

-REV�IRU�GHOHWLQJ�IURP�WKH�DUFKLYH

6WHS 3URFHGXUH��-REV�IRU�'HOHWLQJ�IURP�WKH�DUFKLYH

1 If object %XWWRQ�� (delete record) is operated by pressing 8, control tag8��ZBH[B8$6�B�� is set by means of a GLUHFW�FRQQHFWLRQ to a hexadecimalvalue of �[����. However, decimal values have to be entered in the &RQVWDQWinput field of the 'LUHFW�&RQQHFWLRQ dialog box. In the present case, the value is����.

By means of the write operation to the control tag, the programmable logic

Page 442: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-96 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��-REV�IRU�'HOHWLQJ�IURP�WKH�DUFKLYH

controller then sends a job message frame to WinCC to delete a data record. Inour example, the message frame we are referring to is located in '%��.

2 If object %XWWRQ�� (delete record) is operated by pressing 8, control tag8��ZBH[B8$6�B�� is similarly set by means of a GLUHFW�FRQQHFWLRQ to ahexadecimal value of �[����.

By means of the write operation to the control tag, the programmable logiccontroller then sends a job message frame to delete all data records. In ourexample, the message frame we are referring to is located in '%��.

Job message frame in DB28 (delete data record)

DATA_BLOCK DB 28NAME : SDeleteVersion : 0.0

struct TLngLow : WORD := W#16#1A00; //Frame length low TLngHigh : WORD := W#16#0; //Frame length high TTyp : WORD := W#16#200; //Transfer type, Reserve AAnz : WORD := W#16#100; //Number of jobs PLCID : ARRAY [1 .. 8 ] OF //PLCID CHAR := ’U’,’S’,’R’,’A’,’R’,’C’,’S’,’7’; ALng : WORD := W#16#A00; //Job length ATyp : WORD := W#16#800; //Job type, Reserve FNr : WORD := W#16#0; //Field number SNrLow : WORD := W#16#100; //Data record number low SNrHigh : WORD := W#16#0; //Data record number high Date1 : WORD; Date2 : WORD;

END_STRUCT ;

• The program excerpt above shows the job message frame for deleting a data recordfrom the archive. The structure of the job message frames can be taken from Section��������6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV. Attention must be paid to the coding ofthe numerical values. The least significant byte is sent first.

• The number of the data record that has to be deleted is entered in the message frame bymeans of )&�.

Page 443: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-97C79000-G8276-C140-01

Job message frame in DB25 (Delete all data records)

DATA_BLOCK DB 25NAME : ASDeleteVersion : 0.0

struct TLngLow : WORD := W#16#1400; //Frame length low TLngHigh : WORD := W#16#0; //Frame length high TTyp : WORD := W#16#200; //Transfer type, Reserve AAnz : WORD := W#16#100; //Number of jobs PLCID : ARRAY [1 .. 8 ] OF //PLCID CHAR := ’U’,’S’,’R’,’A’,’R’,’C’,’S’,’7’; ALng : WORD := W#16#400; //Job length ATyp : WORD := W#16#500; //Job type, Reserve Date1 : WORD; Date2 : WORD;

END_STRUCT ;

• The program excerpt above shows the job message frame for deleting the archive.

1RWH�A dialog box for monitoring the status of individual tags can be opened by means of abutton. However, the configuration of this dialog box does not depend on theprogrammable logic controller being used and is therefore described in a separate section(Section ������6WDWXV�0RQLWRULQJ�RI�([WHUQDO�7DJV��H[B�BFKDSWHUB��F�SGO�).

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made for general use:

• The configurations performed for the connection can be directly applied to privateapplications, provided that the hardware used is identical. If not, adjustments have to memade in this area.

• Adapt the structure and format of the archive to your own requirements.

• You can adopt the type of organization of the job message frames. It is sufficient,however, to configure a single job message frame if the job type is entered in it by thePLC program.

Page 444: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-98 WinCC Configuration ManualC79000-G8276-C140-01

������ 6WDWXV�0RQLWRULQJ�RI�([WHUQDO�7DJV��H[B�BFKDSWHUB��F�SGO�

7DVN�GHILQLWLRQ

The status of several external tags is required to be monitored at runtime. We want thestatus to be displayed in a separate dialog box, which we want to be accessible by means ofa button.

,PSOHPHQWDWLRQ�FRQFHSW

The dynamic dialog box is used to monitor the status of individual tags. For every tag wewant to have monitored, static text is used to display the static text and a status displaypresents a symbolic representation of the status. These objects are configured in a separatepicture.This picture is displayed at runtime by means of a picture window that can be shown bymeans of a button.

,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

1 Create a new picture in *UDSKLFV�'HVLJQHU. In our example, this is the picturecalled H[B�BZLQGRZB���SGO.

2 In the picture we have just created, we configure static text at 6WDQGDUG�2EMHFW�→6WDWLF�7H[W. In our example, we use the object called 6WDWLF�7H[W�. Its purpose is todisplay the status of tag 7��ZBH[B8$6�B��, which was created in the �����&RQQHFWLRQ�YLD�:LQ&&�5DZ�'DWD�7DJV�WR�WKH�6���H[B�BFKDSWHUB��F�SGO�example. The procedure is the same for any other external tag, however.

At 3URSHUWLHV�→�)RQW�→�7H[W, we create a G\QDPLF�GLDORJ�ER[. In the

([SUHVVLRQ�)RUPXOD box, we click the button to set the tag we want tomonitor, namely 7��ZBH[B8$6�B��.

Select the (YDOXDWH�7DJ�6WDWXV check box. The dialog box is then expanded.There is then the possibility of defining text for every tag status possible. If thetag assumes the corresponding status, this text is displayed in the 6WDWLF�7H[W�object. If no status on the list is in fact current - in other words, the connection isin order - the text entered on the 2WKHU line is displayed. In our example, this is&RQQHFWLRQ�2..

Page 445: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-99C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

3 Configure a status display at 6PDUW�2EMHFW�→�6WDWXV�'LVSOD\. In our example, weuse the object called 6WDWLF�'LVSOD\�. The purpose of the object is to symbolicallydisplay the status of tag 7��ZBH[B8$6�B��. Following placement, theFRQILJXUDWLRQ�GLDORJ�ER[ of the object is displayed. A further status is added by

clicking the button. We then set a suitable picture for every status.In our example, the pictures are 9HUELQGXQJ2.�EPS for status � and9HUELQGXQJ6723�EPS for status �.

Complete the settings in the FRQILJXUDWLRQ�GLDORJ�ER[ by clicking 2..

Page 446: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-100 WinCC Configuration ManualC79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

4 We want the 6WDWXV�'LVSOD\� object to be supplied at runtime with informationabout the status of the tag. This is accomplished by means of the 6WDWLF�7H[W�object, which monitors the status.

At this object, we create a C action at (YHQW�→�3URSHUW\�7RSLFV�→�)RQW�→�7H[W→�&KDQJH. This is executed upon a change of the displayed text - in other words,when the status of tag changes. The &�DFWLRQ checks the text being displayed. If itis identical with the string &RQQHFWLRQ�2., the status of object 6WDWXV�'LVSOD\� isset to �. In other words, the green check mark is displayed. If this is not the case,the STOP symbol is displayed.

The &�DFWLRQ described has to be executed once when the picture is opened inorder to display the status display with the current status. This is accomplished bythe text entered in object 6WDWLF�7H[W� being deleted. In this way, the text ismodified at all events following opening of the picture and the action is executed.

5 In our example, tags *��ZBH[B8$6�B�� and 6��ZBH[B8$6�B�� are likewisemonitored. To configure them for monitoring, proceed in a similar manner to thesteps just described. When configuring several similar tag monitors, pay attentionto the note that follows this table.

6 We want to display the picture we have just created in a picture window. For thispurpose, we configure in our example a picture window at 6PDUW�2EMHFW�→3LFWXUH�:LQGRZ� in another picture, H[B��BFKDSWHUB��F�SGO in our example. Thispicture window is object 3LFWXUH�:LQGRZ�.

At 3URSHUWLHV�→�0LVFHOODQHRXV�→�3LFWXUH�1DPH, set H[B�BZLQGRZB���SGO, thepicture you created earlier. At 3URSHUWLHV�→�0LVFHOODQHRXV, the GLVSOD\ of theobject is set to 1R.

Page 447: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-101C79000-G8276-C140-01

6WHS 3URFHGXUH��,PSOHPHQWDWLRQ�LQ�*UDSKLFV�'HVLJQHU

7 In order to be able to display it at runtime all the same, we configure a button at:LQGRZV�2EMHFW�→�%XWWRQ. In our example, we use the object called %XWWRQ��. Atthis button, we create a GLUHFW�FRQQHFWLRQ at (YHQW�→�0RXVH�→�0RXVH�$FWLRQ.This switches &RQVWDQW�� to the GLVSOD\ property of object 3LFWXUH�:LQGRZ�.

1RWH�If you wish to use several objects in the same manner for monitoring the status of differenttags, it is advantageous to fully configure these objects and then copy them. In the presentcase, however, this is not possible - at least not directly possible. If, namely, the tag name ismodified in the dynamic dialog box, the values entered for each status of the tag willsimilarly be lost.There is a possibility, however, of transforming the dynamic dialog box into a C action. Forthis purpose, only the created dynamic dialog box is opened as a C action in the Propertiesdialog box of the object.

The C action received can now be copied. Only the tag name in the code of the copy has tobe modified and the C action triggered on this tag.

Page 448: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-102 WinCC Configuration ManualC79000-G8276-C140-01

C action upon modification of text in object Static Text1

#include "apdefap.h"void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName,

char* lpszPropertyName, char* value){

if (strcmp(value,"Connection OK") != 0){

SetIndex("ex_5_window_03.pdl","Status Display1",1);}else{

SetIndex("ex_5_window_03.pdl","Status Display1",0);}}

• Compares the new text with the string &RQQHFWLRQ�2..

• If they are identical, object 6WDWXV�'LVSOD\� is set to status �. This means that the greencheck mark is displayed.

• If they are not identical, object 6WDWXV�'LVSOD\� is set to status �. This means that theSTOP symbol is displayed.

1RWHV�RQ�JHQHUDO�XVH

The following adaptations must be made for general use:

• The procedure described above can be applied directly to your own project.

Page 449: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-103C79000-G8276-C140-01

������� 6WUXFWXUH�RI�UDZ�GDWD�PHVVDJH�IUDPHV

*HQHUDO

The raw data message frames can be sent by the programmable logic controller by means ofan active sender to WinCC. The message frames contain one or more requests on theWinCC archive system. These may be read or write jobs. In response to these requests,WinCC returns a processing acknowledgement with any data that may have been requested.

Requests consist of a message frame header and subsequent requests. The requests consistin their turn of a job header and possibly subsequent data - where write jobs are concerned.

Processing acknowledgements consist of an acknowledgement header and possiblysubsequent data - where read jobs are concerned.

6WUXFWXUH�RI�WKH�PHVVDJH�IUDPH�KHDGHU

%\WH 'HVFULSWLRQ�

0 Message frame length in byte LSB (frame length requires a total of 4 bytes)

1 Message frame length in byte

2 Message frame length in byte

3 Message frame length in byte MSB

4 Transfer type: 2 corresponds to Send Data from the programmable logiccontroller

5 Reserved

6 Number of jobs LSB (number of jobs requires a total of 2 bytes)

7 Number of jobs MSB

8 1st character of archive PLCID (PLCID is eight characters long)

9 2nd character of archive PLCID

10 3rd character of archive PLCID

11 4th character of archive PLCID

12 5th character of archive PLCID

13 6th character of archive PLCID

14 7th character of archive PLCID

15 8th character of archive PLCID

Page 450: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-104 WinCC Configuration ManualC79000-G8276-C140-01

6WUXFWXUH�RI�WKH�MRE�KHDGHU

%\WH 'HVFULSWLRQ�

0 Job length LSB (job length requires a total of 2 bytes)

1 Job length in byte MSB

2 Job type: refer to description of job types below

3 Reserved

4 Field number LSB (field number requires a total of 2 bytes)

5 Field number MSB

6 Data record number LSB (data record number requires a total of 4 byte)

7 Data record number

8 Data record number

9 Data record number MSB

10 Selection criterion LSB (selection criterion requires a total of 2 bytes)

11 Selection criterion MSB

1RWH�The field number that has to be specified in the job header is applicable only to jobsinvolving reading from and writing to different fields. Data fields are numbered from zero.The data record number specified in the job header is identical to the number specified inthe ID column of User Archive. Data record numbering starts at 1. If 0 is entered, a newdata record is added in the case of a job writing a data record to User Archive.

-RE�W\SHV

A byte is set for the job type in the job header. The following job types are available.

7\SH 'HVFULSWLRQ

4 Test archive for presence

5 Delete all data records from the archive

6 Read data record (archive to programmable logic controller)

7 Write data record (programmable logic controller to archive)

8 Delete data record

9 Read data field (archive to programmable logic controller)

10 Write data field (programmable logic controller to archive)

Page 451: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� 8VHU�$UFKLYH

WinCC Configuration Manual 5-105C79000-G8276-C140-01

-RE�GDWD

In the case of write jobs, the archive data come next. They correspond to the contents of adata record with a ZULWH�GDWD�UHFRUG job or the contents of a data field with a ZULWH�GDWDILHOG job. No other data follow for the remaining jobs.Numbers are transmitted in Intel format. This means that the LSB is transferred first and theMSB last. Integer fields are 4 bytes long, double fields are 8 bytes long. Text fields are notterminated with \0.

$FNQRZOHGJHPHQW�KHDGHU

%\WH 'HVFULSWLRQ�

0 Message frame length in byte LSB (frame length requires a total of 4 bytes)

1 Message frame length in byte

2 Message frame length in byte

3 Message frame length in byte MSB

4 Transfer type: 1 corresponds to the data sent by WinCC

5 Reserved

6 Error code: refer to the description of error types below

7 Job type: refer to description of job types above

8 Reserved

9 Reserved

10 Field number LSB (field number requires a total of 2 bytes)

11 Field number MSB

12 Data record number LSB (data record number requires a total of 4 byte)

13 Data record number

14 Data record number

15 Data record number MSB

16 1st character of archive PLCID (PLCID is eight characters long)

17 2nd character of archive PLCID

18 3rd character of archive PLCID

19 4th character of archive PLCID

20 5th character of archive PLCID

21 6th character of archive PLCID

22 7th character of archive PLCID

23 8th character of archive PLCID

Page 452: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

8VHU�$UFKLYH �����

5-106 WinCC Configuration ManualC79000-G8276-C140-01

$FNQRZOHGJHPHQW�GDWD

In the case of read jobs, the requested data then follow. They correspond to the contents ofa data record with a UHDG�GDWD�UHFRUG job or the contents of a data field with a UHDG�GDWDILHOG job. No other data follow for the remaining jobs.

(UURU�FRGHV

If an error occurs during communication, WinCC returns an error code to theprogrammable logic controller in the acknowledgement message frame. The following errorcodes are defined.

&RGH 'HVFULSWLRQ

0 Function triggered

1 Invalid data (archive)

2 Non-existent data (archive)

101 Invalid data (data record)

102 Non-existent data (data record)

201 Invalid data (field)

202 Non-existent data (field)

254 Function not available

255 Undefined error

Page 453: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� ,QGH[

WinCC Configuration Manual Index-1C79000-G8276-C140-01

Index

AAcknowledgement, 3-57

Horn, 4-76Messages, 4-76

Addressingindirect, 2-47, 2-50

AlarmAnalog Alarms, 4-72Archiving of, 4-91Bit Message Procedure, 4-52Create with Wizard, 4-63Enter Alarm Logging in the Startup tab, 4-69line, 3-5Loop in, 4-89Loop in, 3-109Setup, 4-52Use OCX, 4-97

Aliasarchive, 5-4data fields, 5-7

Analog ValuesMonitor, 4-72

APIFor Message Filter, 4-95Use, 4-28

Application window, 3-107Archive

Every full Minute, 4-42Export, 4-46

archivingCyclic-Continuous, 4-3

ArchivingAcyclic, 4-21Alarms, 4-91

Authorization level, 3-27

BBit editing, 2-39Bit Message Procedure, 4-52, 4-64Bit pattern, 2-40Buttons

For Message Filter, 4-91

CCallback Function

Use, 4-30Changeover switch, 2-17Color

change, 3-70, 3-79scheme, 3-109

Communicationdriver, 5-39processor, 5-34

Communicationsuser archives, 5-4

CommunikationOLE with Excel, 4-139

ConfigurationColor Scheme of the Messages, 4-67Loop in Alarm, 4-89Trend Display, 4-24, 4-46

Connectionin Control Center, 5-39on PLC, 5-38raw data tags, 5-49To Excel, 4-139to S5, 2-66WinCC tags, 5-34

ContentPrint Short-Term Archive, 4-95

Control tags, 5-28Controllable

access protection, 3-24, 3-27Create

data fields, 5-7user archives, 5-3

Creatingtags, 2-2

CreationGroup Messages, 4-102Process Value Archive, 4-3

CSVExport Archive Automatically, 4-46user archives, 5-12

CurrentUser, 4-25

DData

Archive, 4-29Archiving, 4-16data fields, 5-7data type, 5-2transfer to PLC, 5-2

Data importuser archives, 5-12

Decrementing, 2-7, 2-19

Page 454: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

,QGH[ �����

Index-2 WinCC Configuration ManualC79000-G8276-C140-01

Direct connection, 2-13, 2-29, 2-40, 3-7Direct link, 1-1Display Contents

Of Example_01, 4-149DLL

Integration, 4-86Documentation

Pictures, 4-110Project Function, 4-115Tags, 4-118Trend Window, 4-123

DynamicPart of the Report, 4-132

Dynamic DialogUse, 4-40

Dynamic dialog boxstatus monitoring, 5-98

Dynamic Wizard, 3-12, 3-15

EEditor

user archive editor, 5-3Embedding

OCX, 5-15Entry

data entry, 5-11Error

error code, 5-106Excel

user archives, 5-13Export

Process Valie Archive, 4-46tags, 2-61

FForm view, 5-23

GGauge control, 5-20Group

Tag Management, 2-2user group, 3-28

Group Messages, 4-101

HHiding

information, 3-74, 3-102

picture window, 3-33, 3-35, 3-36HMI, 3-1Hot key

configuring, 3-86

IImport

tags, 2-61Incrementing, 2-7, 2-19Info (instruction) box

configuring, 3-39Information

hiding, 3-74, 3-102showing, 3-74, 3-102

InitialisationOf the Callback Function with Call, 4-33

Initializationin the project, 3-50picture, 1-2simulation, 2-56

Inputby means of a check box, 2-36by means of a slider, 2-29by means of an option group, 2-34check, 3-59, 3-61

IntegrationDLL, 4-28

JJogging, 2-7

KKey combination

Logon, Logoff, 3-28switching between windows, 3-93

Key CombinationFor Login, 4-12

LLanguage

in runtime, 3-83Library, 3-7

project, 3-11Login, 3-27, 3-30

Name in the project example_01, 4-12Loop in Alarm, 4-89

Page 455: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

����� ,QGH[

WinCC Configuration Manual Index-3C79000-G8276-C140-01

MMessage

Wizard, 4-63Message box, 2-56Message Window, 4-52, 4-58, 4-72, 4-88, 4-97Messages

Archiving, 4-91Bit Message Procedure, 4-52Configure, 4-64configuring, 3-107Define Colors, 4-67Print, 4-95, 4-137

MPI, 5-71Multiplex display, 2-50

OOCX

Use Alarm OCX, 4-97using, 3-105

OLEConnection to Excel, 4-139insert, 5-15OLE control, 5-2

Operator AuthorizationFor Trend Display, 4-9

Operator panels, 3-52Operator-controllable

archives, 5-5Output

Message Sequence Report, 4-135Overview

picture, 3-3, 3-107

Ppassword

In the project example_01, 4-3Password, 3-2

In the project example_01, 4-21Performance, 1-1Picture

adjust size, 3-46buildup, 3-1change, 3-6change size, 3-49changing, 3-3displaying the picture name, 3-7Documentation, 4-110geometry, 3-46initialization, 1-2opening, 3-1, 3-7

Picture Register Creation, 4-145project, 3-1windows, 3-5

Picture windowtime-controlled hiding, 3-36

Pragma, 3-29, 4-28, 4-86Print Job

Time Selection, 4-126Process

connection, 2-1Process Value Archive

Create, 4-3Project

start, 2-23Project library, 3-11

RRaw data tags

raw data message frames, 5-103user archives, 5-49, 5-70

Resolutionscreen, 1-1, 3-1

Runtimelanguage change, 3-83Print out table, 4-129Print out trend window, 4-123shutting down (exiting), 3-25Start, stop archiving, 4-15

SScreen

layout, 3-3, 3-4Section

screen, 3-4Selection

data types, 2-3Set value

changing, 2-8, 2-29Setup

Message Class, 4-75Message Line Format, 4-57Message Window Template, 4-58Single Messages, 4-64

Short-term archive, 3-108Short-Term Archive

Create, 4-92Print Messages, 4-137

Showingpicture window, 3-32

ShutdownWinCC, 3-24

Page 456: WinCC Configuration Manual - Siemens AG · WinCC, SIMATIC, SINEC, STEP are ... This information is of course also available as an on-line document in HTML format and ... WinCC Configuration

,QGH[ �����

Index-4 WinCC Configuration ManualC79000-G8276-C140-01

Simulation, 2-55, 4-2Slider, 2-29SmartTools, 2-59Sound, 4-86Startup Tab, 4-14, 4-69Status display, 3-80Status monitoring, 5-98Structure

tags, 2-5, 2-63Switching operation

binary, 3-53Sysmalloc, 3-106System Time

Determination, 4-48

TTable

configuring, 5-15Display process values, 4-21User Defined, 4-30

Table Layout, 4-29Tags

Archive, 4-38Document, 4-118simulation, 2-55

Texttext library, 5-7

Text input, 3-43Time

display, 3-105Time Selection, 4-126Tool tip, 2-3Toolbar

user archives, 5-22User Archives, 5-2

TrendsDisplaying Process Values, 4-2

UUpdate

Stopped, 4-26Trend Window, 4-18

UserAs the project example, 4-3authorization, 3-27groups, 3-29

User archivecreating, 5-3editor, 5-3

User Archives database, 5-2User level, 3-30

VView, 5-2

WWinCC

Shutdown, 3-24Without a mouse

working, 3-85Wizard

For Process Value Archive, 4-3Message Wizard, 4-63

Workingwithout a mouse, 3-85