You are on page 1of 456

WinCC Configuration Manual

Manual Volume 2

C79000-G8276-C140-01

Edition February 1999

WinCC, SIMATIC, SINEC, STEP are Siemens registered trademarks. All other product and system names in this manual are (registered) trademarks of their respective owners and must be treated accordingly.

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

(We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed.)

Siemens AG 1994 - 1999 All rights reserved C79000-G8276-C140-01 Printed in the Federal Republic of Germany

Technical data subject to change

Siemens Aktiengesellschaft

Table of Contents
1 2 Configuration - Examples ......................................................... Tags (Project: varia_00.mcp)....................................................
2.1 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.6 2.6.1 2.6.2 2.7 2.8 2.8.1 2.9 2.9.1 Creating, grouping and moving tags............................................. Incrementing, decrementing and jogging ...................................... Jogging - changing a set value (example 01)................................ Jogging - changing a set value using Global Script (example 02) . Jogging - buttons (example 05).................................................... Jogging - changeover switch (example 06)................................... Incrementing and decrementing (example 01).............................. Incrementing and decrementing using Global Script (example 02) The other examples related to this topic ....................................... Changing tag value using Windows Objects................................. Inputting by means of a slider with direct connection (example 01)................................................................................ Inputting by means of slider and tag connection (example 03)...... Inputting by means of an Option Group (example 02)................... Inputting by means of check box (example 04)............................. Bit editing in words....................................................................... Directly setting a bit with the aid of a check box and direct connection (example 06).............................................................. Selecting a bit and changing its state (example 01) ...................... The other examples related to this topic ....................................... Indirect addressing of tags ........................................................... Indirect addressing by means of a direct connection (example 01)................................................................................ Multiplex display using indirect addressing and a C action (example 02)................................................................................ Indirect addressing by means of C action (example 03)................ The other examples related to this topic ....................................... Simulation of tags ........................................................................ Simulating a triangular oscillation by means of a C action (example 01)................................................................................ Simulation by means of an external program (example 02) .......... Importing / exporting tags............................................................. Using structure tags ..................................................................... Valve control by means of a structure tag (example 01) ............... Serial connection to S5 ................................................................ The other examples related to this topic .......................................

1-1 2-1
2-2 2-7 2-8 2-10 2-13 2-17 2-19 2-22 2-27 2-28 2-29 2-32 2-34 2-36 2-39 2-40 2-43 2-46 2-47 2-48 2-50 2-52 2-54 2-55 2-56 2-59 2-61 2-63 2-64 2-67 2-68

Picture configuration (Project: pictu_00.mcp) ........................


3.1 3.1.1 3.2 3.2.1 Screen layout and changing pictures............................................ Laying out the screen................................................................... Picture change............................................................................. Opening a picture by means of a direct connection and displaying the picture name (example 01) ....................................

3-1
3-3 3-4 3-6 3-7

WinCC Configuration Manual C79000-G8276-C140-01

7DEOHRI&RQWHQWV



3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.3 3.3.1 3.3.2 3.3.3 3.4 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5 3.5.1 3.5.2 3.5.3 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.7 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8

Opening a picture by means of the Dynamic Wizard (example 02) ............................................................................... Opening a picture by means of internal function (example 02)...... Single picture change by means of the Dynamic Wizard (example 03) ............................................................................... Single picture change by means of a direct connection (example 04) ............................................................................... Opening a picture by means of the object name and an internal function (example 05) .................................................................. Opening a picture by means of the object name and a tag connection, with display of the picture name (example 06) ........... Shutdown WinCC / access protection .......................................... Shutting down (exiting) runtime and the system (example 01) ...... Access protection, login by means of a standard box (example 02) ............................................................................... Operator-Control Enable, login in a separate dialog box (example 03) ............................................................................... Showing a picture window............................................................ Showing and hiding from outside a picture window (example 01) . Showing from outside and hiding from inside a picture window (example 02) .............................................................................. Time-controlled hiding of a picture window (example 03).............. Showing a picture window while holding down the right mouse button (example 04)..................................................................... Configuring info (instruction) boxes with the wizard (example 05). Showing a dialog box for entering text (example 06) .................... Zoom........................................................................................... Changing picture geometry between two sizes (example 01) ....... Changing the picture geometry steplessly (smooth zoom) (example 02) ............................................................................... Configuring adjustable picture geometry by means of the properties dialog (example 03)..................................................... Operator panels........................................................................... Binary switching operation (two-step control) (example 01) .......... Binary S/R switching operation (two-step control) (example 02) ... Binary switching operation with acknowledgement (example 03).. Automatic input check (example 04) ............................................ Enhanced automatic input check (example 05) ............................ Multiple operation (example 06) ................................................... Dynamics .................................................................................... Color change (example 01).......................................................... Text exchange (example 02)........................................................ Animation of movement (example 03).......................................... Showing and hiding objects by means of bit evaluation (example 04) ............................................................................... Animation of movement by means of a C action (example 05) ..... Create animation of movement by means of a wizard (example 06) ............................................................................... Color change by means of a C action (example 06) ..................... Animation of movement by means of a status display (example 07) ...............................................................................

3-12 3-14 3-15 3-17 3-19 3-21 3-25 3-26 3-28 3-31 3-33 3-34 3-36 3-37 3-39 3-40 3-44 3-46 3-47 3-50 3-52 3-53 3-54 3-56 3-58 3-60 3-62 3-66 3-70 3-71 3-73 3-74 3-75 3-77 3-79 3-81 3-82

ii

WinCC Configuration Manual C79000-G8276-C140-01



7DEOHRI&RQWHQWV

3.8 3.8.1 3.8.2 3.9 3.9.1 3.9.2 3.9.3 3.10 3.10.1 3.10.2 3.11

Language switch.......................................................................... Change runtime language (example 01)....................................... Dialog box for changing the runtime and Control Center language (example 02)................................................................................ Working without a mouse............................................................. Operation with the TAB key or hot key (example 01) .................... Cursor keyboard (example 02)..................................................... Value input, control actions (example 03)..................................... Showing and hiding information ................................................... Showing and hiding objects (example 01) .................................... Displaying the date and time (example 02)................................... Configuring messages .................................................................

3-84 3-85 3-86 3-87 3-88 3-96 3-101 3-104 3-105 3-107 3-109

Additional Functions in WinCC (Project: example_01.mcp)..


4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.3 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4 4.4.1 4.5 4.5.1 4.5.2 4.5.3 4.5.4 Tag Logging................................................................................. Cyclic-Continuous Archiving (ex_3_chapter_01.PDL) ................... Cyclic-Selective Archiving (ex_3_chapter_01a.PDL) .................... Archiving if Value is Exceeded (ex_3_chapter_01b.PDL) ............. User defined table layout (ex_3_chapter_01c.PDL)...................... Archiving of binary tags (ex_3_chapter_01d.PDL) ........................ Archiving at Set Times (ex_3_chapter_01e.PDL) ......................... Exporting an Archive (ex_3_chapter_01f.PDL) ............................. Alarm Logging.............................................................................. Bit Message Procedure (ex_3_chapter_02.PDL) .......................... Bit Message Procedure (Continued)............................................. Analog Alarms (ex_3_chapter_02a.PDL)...................................... Analog Alarms (continued) ........................................................... Message Window (ex_3_chapter_02b.PDL)................................. Message Archiving (ex_3_chapter_02c.PDL) ............................... WinCC Alarm Control (ex_3_chapter_02d.PDL)........................... Group Messages (ex_8_generator_00.PDL) ................................ Report Designer........................................................................... Picture Documentation (ex_3_chapter_03.PDL)........................... Reporting the Project Function (ex_3_chapter_03.PDL) ............... Reporting of the Control Center (ex_3_chapter_03.PDL).............. Reporting of Tag Logging CS (ex_3_chapter_03.PDL) ................. Print Out the Trend Window in Runtime (ex_3_chapter_01a.PDL) Printing Out the Table in Runtime (ex_3_chapter_01c.PDL) ......... Message Sequence Report (ex_3_chapter_02b.PDL) .................. Message Sequence Report on a Line Printer ............................... Message Archive Report (ex_3_chapter_02c.PDL) ...................... OLE Communication to EXCEL.................................................... Reading and Writing Tag Values (ex_3_chapter_04.PDL) ............ Additional Configurations in the Examples.................................... Picture Register ........................................................................... Table of Contents ........................................................................ Dialog Boxes for Setting Colors (ex_3_chapter_01c).................... Bar Graph Display (ex_3_chapter_01e) .......................................

4-1
4-2 4-3 4-18 4-24 4-33 4-42 4-46 4-50 4-55 4-56 4-69 4-78 4-84 4-95 4-98 4-105 4-109 4-117 4-118 4-124 4-127 4-130 4-132 4-139 4-143 4-146 4-148 4-150 4-151 4-155 4-156 4-160 4-163 4-166

User Archive ..............................................................................

5-1
iii

WinCC Configuration Manual C79000-G8276-C140-01

7DEOHRI&RQWHQWV



5.1 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.10

User Archive................................................................................ Creating a User Archive (ex_3_chapter_01.PDL) ......................... Data Entry (ex_3_chapter_01.PDL) ............................................. Configuring a Table View (ex_3_chapter_01.PDL) ....................... Configuring a Form View (ex_3_chapter_011.PDL)...................... Working with Control Tags (ex_3_chapter_012.PDL) ................... Connecting via WinCC Tags (ex_3_chapter_01a.pdl) .................. Connection via WinCC Raw Data Tags to the S5 (ex_3_chapter_01b.pdl) ............................................................... Connection via WinCC Raw Data Tags to the S7 (ex_3_chapter_01c.pdl) ............................................................... Status Monitoring of External Tags (ex_3_chapter_01c.pdl)......... Structure of raw data message frames.........................................

5-2 5-3 5-12 5-16 5-24 5-29 5-35 5-50 5-71 5-100 5-105

iv

WinCC Configuration Manual C79000-G8276-C140-01



7DEOHRI&RQWHQWV

3UHIDFH
3XUSRVHRIWKHPDQXDO

The purpose of this manual is to show you the options open to you when configuring with WinCC 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 and with enhanced search functions. You will find general information on effective and efficient configuration with WinCC in the :LQ&&&RQILJXUDWLRQ0DQXDO3DUW.

5HTXLUHPHQWVIRUXVLQJWKLVPDQXDO

Knowledge of WinCC *HWWLQJ6WDUWHG) or practical configuration experience using WinCC.

$GGLWLRQDO6XSSRUW

For technical questions, please contact your local Siemens representative at the responsible branch office. Their addresses can be found at the "Siemens Worlwide Appendix" of the "S7-300 Programmable Controller System, Hardware and Installtion Manual", in catalogs, and at CompuServe ("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.

WinCC Configuration Manual C79000-G8276-C140-01

7DEOHRI&RQWHQWV



,QIRUPDWLRQDERXW6,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 0876593 02 77 95 00 Additionally, the SIMATIC Customer Support provides you with current information and downloads 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) 8957100 To access the mailbox, use a modem up to V.34 (28.8 kBaud). Set its parameters as follows: 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) 8957000 and by fax at +49 (911) 8957002. Inquiries can also be made via Internet mail or to the above mailbox.

vi

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWV

 &RQILJXUDWLRQ  ([DPSOHV
In this section of the manual, we describe configuration using WinCC on the basis of sample projects. Taking into account the multitude of potential applications WinCC has to offer, the projects described below are to be seen only as examples of what can be done with WinCC.

1RWH

The projects have been configured for a resolution of 1024 x 768. If you would prefer to start the projects with a resolution of 800 x 600, you must select the window attributes )XOO 6FUHHQand6OLGHU under &RQWURO&HQWHU&RPSXWHU3URSHUWLHV3URSHUWLHV *UDSKLFV5XQWLPH.

The partitioning of the screen and the associated presettings and scripts associated with this are described in more detail in Chapter /D\LQJRXWWKHVFUHHQ nher beschrieben.
1RWH

There is frequently more than just a single method of tackling a particular task. If a task can be implemented by means of a direct link, you should DOZD\V choose this type of dynamization, since this is the method which offers the best level of performance in runtime. The consequence of configuring a direct link for an event is that when this event occurs during runtime, the valueof a source element (source) is taken over for a destination element (destination). Sources can take the form of constants, tags or the attributes of the objects in the picture, while the dynamizable attributes of objects, the dynamizable attributes 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 in the link's time response during runtime.

WinCC Configuration Manual C79000-G8276-C140-01

1-1

6DPSOHSURMHFWV



,QLWLDOL]DWLRQ

If required, initialization procedures are performed for the individual pictures. These initialization procedures are configured under (YHQWV 0LVFHOODQHRXV 2SHQ3LFWXUH.

1-2

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 7DJV 3URMHFW YDULDBPFS


In this project, we will show you a number of ways of creating, changing and reusing WinCC tags. There are three different types of tag in WinCC. ,QWHUQDOWDJV without process driver connection, ([WHUQDOWDJV with process driver connection, and in the scripts, &WDJV. In our examples, we will mainly be using LQWHUQDOWDJV and &WDJV. The examples used for these topics are configured in the WinCC project entitled YDULDB.

WinCC Configuration Manual C79000-G8276-C140-01

2-1

6DPSOH3URMHFWYDULDB



 &UHDWLQJJURXSLQJDQGPRYLQJWDJV

In WinCC, tags can be created in the &RQWURO&HQWHU under the items 7DJ0DQDJHPHQW and 'DWD7\SHV.

7DJPDQDJHPHQW

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

To create a tag group for LQWHUQDOWDJV, ' the item. Then 5 the subitem ,QWHUQDOWDJV that appears in order to open the pop-up menu. Select the 1HZ *URXS item.

In the window that appears, enter a suitable name (e.g. button). A new group symbol with the name you have just entered now appears in the right window of ' the ,QWHUQDOWDJV item, this group symbol the &RQWURO&HQWHU. If you now and name will also appear as a further subitem in the left window. In our sample project, grouping has been carried out in accordance with the sequence of the chapters.

To create a tag in a tag group,

the corresponding symbol in the left window. Then pop-up menu and select the 1HZ7DJ item.

8'

the group symbol in the right window or

85

this symbol to open the

2-2

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHFUHDWLQJWDJVLQWKH7DJ0DQDJHPHQW

On the *HQHUDO,QIRUPDWLRQ tab in the window that appears, enter a tag name. Then select the GDWDW\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 by means of a tool tip while runtime is active.

'DWDW\SHV

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

6WHS

3URFHGXUHFUHDWLQJWDJVE\PHDQVRIWKH'DWD7\SHVPHQXLWHP

1 2

By

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

8' 85

the 'DWD7\SHV item, a list of the data types available appears.

WinCC Configuration Manual C79000-G8276-C140-01

2-3

6DPSOH3URMHFWYDULDB



6WHS

3URFHGXUHFUHDWLQJWDJVE\PHDQVRIWKH'DWD7\SHVPHQXLWHP

When you click the 2. button, you are returned to the *HQHUDO,QIRUPDWLRQ tab in the 7DJSURSHUWLHV window under the Tag Management item.

0RYLQJWDJV

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


6WHS

1 2

Switch to the group to which the tag is to be moved. Open the pop-up menu in this group and select 3DVWH. The same procedure can also be used for several tags simultaneously.

85

3URFHGXUHPRYLQJWDJV

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

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 be numbered consecutively, you only have to create one tag of this type. You can copy this tag using the pop-up menu and then insert (paste) it as often as you want. The tags will be numbered automatically in ascending order. You should take this possibility into account when defining the name convention for tags.

([WHUQDOWDJV

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

1 2

85

3URFHGXUH

'ULYHU

the Tag Management item to open the pop-up menu and select the $GG1HZ item.

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

' this new subitem, a further subitem appears. 5 this new subitem If you to open the pop-up menu and select the 1HZ'ULYHU&RQQHFWLRQ item.

2-4

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUH

On the *HQHUDO,QIRUPDWLRQ tab, give the connection a name. The tab named after the driver is used to make the connection settings. The connection is created when you click the 2. button.

5 the new subitem created, which represents the Open the pop-up menu by new connection. This menu enables you to create tag groups and tags in the usual way.
When you create an H[WHUQDOWDJ, you must also define the addressing and format adjustment in addition to the settings for LQWHUQDOWDJV. The addressing refers to the address of the tag in the programmable controller.

6WUXFWXUHWDJV

Structure tags are used to enable a larger number of different tags and tag types which form a logical unit to be combined. These tag and tag types can then be addressed under one name. A structure tag consists of a number of individual tags, which can represent the most varied out data types.
6WHS 3URFHGXUH

5 the 6WUXFWXUHWDJ item to open the pop-up menu To create a new structure, and select the 1HZ6WUXFWXUH7\SH item.

2 3

In the window that appears, 5 1HZ6WUXFWXUH and select 5HQDPH in the pop-up menu that appears. Give the new structure a name. You can then add a new structure element by clicking the 1HZHOHPHQW button.

WinCC Configuration Manual C79000-G8276-C140-01

2-5

6DPSOH3URMHFWYDULDB



6WHS

3URFHGXUH

By 5 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 an external tag. You conclude configuration and create the structure type by clicking the 2. button.

1RWH

Once a structure type has been created, it cannot be reconfigured. The complete structure type must be redefined. A structure tag is created in the same way as all other types of tag, but the data type used must be structure type created. The name of the individual elements of the structure tag created is composed of the structure name assigned when creating the tag and the element name assigned when creating the structure type. The two are separated in the name by a dot.

2-6

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 ,QFUHPHQWLQJGHFUHPHQWLQJDQGMRJJLQJ

In runtime, you access the examples that relate to these topics in the button depicted above. The examples are configured in the our YDULDB project by pictures YDULDBBFKDSWHUBSGO and YDULDBBFKDSWHUBDSGO.

'HILQLWLRQ

refers to the increasing of a tag value by a fixed or variable increment. 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 with pressing a pushbutton). In the case of binary signals, this represents, as a rule, the triggering of a device. With analog values, a set value can be changed by means of jogging.
,QFUHPHQWLQJ 'HFUHPHQWLQJ

WinCC Configuration Manual C79000-G8276-C140-01

2-7

6DPSOH3URMHFWYDULDB



 -RJJLQJFKDQJLQJDVHWYDOXH H[DPSOH

7DVNGHILQLWLRQ

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 value is to be restricted to fixed limits. The changes are to be implemented locally in the picture.

,PSOHPHQWDWLRQFRQFHSW

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

; changing is event-driven. When the EXWWRQ is , the value of an LQWHUQDOWDJ is changed to the extent of one increment. The increment is specified beforehand and cannot be 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 6PDUW2EMHFWV,2)LHOG. The output value of the,2ILHOG is linked to the LQWHUQDOWDJ.
,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJDVHWYDOXHLQIL[HGVWHSV

1 2

Create a tag of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tag called 6LBYDULDBEXWB In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 6LBYDULDBEXWB, change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW.

3 4

In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ To change the set value, create a &DFWLRQ by the object and selecting 3URSHUWLHV(YHQWV0RXVH3UHVVOHIW. This &DFWLRQ changes the value of the tag each time the button is clicked with the and checked in the &DFWLRQ.

. The limit value is specified

Configure decrementation of the set value in the same way. In our example, we use the object called %XWWRQ.

2-8

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

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 value if (value>1300) (value=1400); //check limit else value=value+100; //inc value SetTagDWord("S32i_varia_but_00",value); //set new value }

Declare the C tag value. Use the LQWHUQDOIXQFWLRQ *HW7DJ':RUG to read out the current value from tag 6LBYDULDBEXWB.

In the LI inquiry, check whether the value of the tag is greater than 1300. If it is, 1400 will be specified as the upper limit. If the value of the tag is less than 1300, the instruction in the HOVH branch is executed and the value is raised in this way by 100. The LQWHUQDOIXQFWLRQ 6HW7DJ':RUG then returns the changed value to the 6LBYDULDBEXWB tag.

1RWHVRQJHQHUDOXVH

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

WinCC Configuration Manual C79000-G8276-C140-01

2-9

6DPSOH3URMHFWYDULDB



 -RJJLQJFKDQJLQJDVHWYDOXHXVLQJ*OREDO6FULSW H[DPSOH

7DVNGHILQLWLRQ

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 value is to be restricted to fixed limits. It is to be implemented with the aid of a SURMHFWIXQFWLRQ.

,PSOHPHQWDWLRQFRQFHSW

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

; changing is event-driven. When the EXWWRQ is , the value of an LQWHUQDOWDJ is changed to the extent of one increment. The increment is specified beforehand and cannot be altered during runtime. The change in the set value is implemented by means of a SURMHFW IXQFWLRQ. The change in the set value is displayed by means of a 6PDUW2EMHFWV,2)LHOG. The output value of the,2ILHOG is linked to the LQWHUQDOWDJ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFUHDWLQJWKHSURMHFWIXQFWLRQ

1 2 3 4

Open the *OREDO6FULSW editor from the &RQWURO&HQWHU. Create a new function by selecting )LOH1HZ3URMHFW)XQFWLRQ. Assign this new function the name ,QF'HF9DOXH and save the function by selecting )LOH6DYH$V,QF'HF9DOXHIFW. Program and compile the function.

Project function IncDecValue


void IncDecValue(DWORD *value,DWORD low,DWORD high,DWORD step,DWORD a) { DWORD v; v=*value; //get current value switch (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 }

2-10

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

The function header with the name of the project function ,QF'HF9DOXH and the transfer parameters. We use the same SURMHFWIXQFWLRQ 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 the transfer 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 or minimum 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 3URFHGXUHFKDQJLQJDVHWYDOXHLQIL[HGVWHSV

1 2

Create a tag of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tag called 6LBYDULDBEXWB In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called I/O Field2. When configuring the,2 ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 6LBYDULDBEXWB. change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW.

3 4

In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ To change the set value, create a &DFWLRQ by the object and selecting 3URSHUWLHV(YHQWV0RXVH3UHVVOHIW. This &DFWLRQ calls the SURMHFW IXQFWLRQ ,QF'HF9DOXH and transfers the required parameters to it. The changes the . The limits are value of the tag each time the EXWWRQ is clicked with the specified as the transfer parameters when the SURMHFWIXQFWLRQ is called. They are checked in the SURMHFWIXQFWLRQ.

Configure decrementation of the set value in the same way. In our example, we use the object called %XWWRQ.

WinCC Configuration Manual C79000-G8276-C140-01

2-11

6DPSOH3URMHFWYDULDB



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 LQWHUQDOIXQFWLRQ *HW7DJ':RUG to read out the current value of the LQWHUQDO WDJV. Call the SURMHFWIXQFWLRQ ,QF'HF9DOXHand transfer the parameters (3RLQWHUWRWDJ, /RZHUOLPLW8SSHUOLPLW,QFUHPHQW'LUHFWLRQ . Use the LQWHUQDOIXQFWLRQ 6HW7DJ':RUG to transfer the changed value to the LQWHUQDO WDJ.

1RWHVRQJHQHUDOXVH

The SURMHFWIXQFWLRQ can be used immediately without any further changes being required. In the &DFWLRQ used for calling the SURMHFWIXQFWLRQ, adapt the transfer parameters to suit your own requirements.

2-12

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 -RJJLQJEXWWRQV H[DPSOH

You access the solutions to these subjects in our project called YDULDBby choosing the two EXWWRQVwith the . They are configured in the picture with the name SLFWXBBFKDSWHUBDSGO.

7DVNGHILQLWLRQ

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.

,PSOHPHQWDWLRQFRQFHSW

We implement the button along event-driven lines by means of a button, which we create under :LQGRZV2EMHFWV%XWWRQ. We visualize this implementation by means of a GLUHFWFRQQHFWLRQ and a &DFWLRQ.
1RWH

Implementing a button by means of a GLUHFWFRQQHFWLRQ offers the best level of performance during runtime.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFWGLUHFWFRQQQHFWLRQ
6WHS 3URFHGXUHKRZDEXWWRQZRUNVGLUHFWFRQQHFWLRQ

1 2 3

Create a tag of type %LQDU\WDJ in Tag Management. In our example, we use the tag called %,1LBYDULDBEXWB In a picture, we configure :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW 9DULDEOH%,1LBYDULDBEXWB. Accept the settings by clicking the 2. button. Configure another GLUHFW FRQQHFWLRQ under (YHQWV0RXVH5HOHDVHOHIW, but this time for the VRXUFH &RQVWDQW.

WinCC Configuration Manual C79000-G8276-C140-01

2-13

6DPSOH3URMHFWYDULDB



6WHS

3URFHGXUHKRZDEXWWRQZRUNVGLUHFWFRQQHFWLRQ

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

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

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW&DFWLRQ
6WHS 3URFHGXUHKRZDEXWWRQZRUNV&DFWLRQ

1 2 3

Create a tag of type %LQDU\WDJ in Tag Management. In our example, we use the tag called %,1LBYDULDBEXWB In a picture, we configure :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ Under (YHQWV0RXVH3UHVVOHIW, generate a &DFWLRQ which sets the value of the %,1LBYDULDBEXWB tag to . Under (YHQWV0RXVH5HOHDVHOHIW, generate a 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 LQWHUQDOIXQFWLRQ 6HW7DJ':RUG to set the tag to .

2-14

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

$QLPDWLRQRIRXUH[DPSOH

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

The color wheel consists of several 6WDQGDUG2EMHFWV3LH6HJPHQW. The 3URSHUWLHV*HRPHWU\6WDUW$QJOH and 3URSHUWLHV*HRPHWU\(QG$QJOH of 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 rotation with a fixed time base. We effect this changing of the value by means of a &DFWLRQ for 3LH6HJPHQW under 3URSHUWLHV&RORUV/LQH&RORU. We set the trigger for the action to PV. In this case, we do QRW dynamize the /LQH&RORU. The reason a &DFWLRQ is linked to this property is that we require a trigger to start changing of the value. We could also use a different property of the object instead of the .
The current angle of rotation is changed in the LQWHUQDOWDJ called 6LBYDUDBEXWB.

WinCC Configuration Manual C79000-G8276-C140-01

2-15

6DPSOH3URMHFWYDULDB



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); }//if return(0x0); //black }

Declare the &WDJ L as a VWDWLF':25', since its value must remain constant while the picture 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 LQWHUQDOWDJ. Return the input configured for the background color with UHWXUQ. It isn't supposed to be changed.

1RWHVRQJHQHUDOXVH

The EXWWRQ with the GLUHFWFRQQHFWLRQ can be used after changes have been made to the tag.

2-16

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 -RJJLQJFKDQJHRYHUVZLWFK H[DPSOH

You access the example that relates to this topic in our YDULDB project by EXWWRQV depicted above. They are configured in the picture with the name SLFWXBBFKDSWHUBDSGO.

the two

7DVNGHILQLWLRQ

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 when the button is released. Pressing the button again will switch the unit off.

,PSOHPHQWDWLRQFRQFHSW

We implement the changeover switch along event-driven lines by means of a button, which we create under :LQGRZV2EMHFWV%XWWRQ.
1RWH

Implementing a changeover switch by means of a GLUHFWFRQQHFWLRQ offers the best performance during runtime, but it requires two buttons.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFWGLUHFWFRQQQHFWLRQ
6WHS 3URFHGXUHKRZDFKDQJHRYHUVZLWFKZRUNVGLUHFWFRQQHFWLRQ

1 2

Create a tag of type %LQDU\WDJ in Tag Management. In our example, we use the tag called %,1LBYDULDBEXWB In a picture, configure two buttons under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object %XWWRQ for switching on and the object %XWWRQ for switching off. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW 9DULDEOH%,1LBYDULDBEXWB. Accept the settings by clicking the 2. button. Configure a GLUHFWFRQQHFWLRQ linked to %XWWRQ in the same way, but this time with the VRXUFH &RQVWDQW. The GLUHFWFRQQHFWLRQ under Events Mouse Mouse Action only synchronizes the labeling on %XWWRQ and isnt essential for the changeover switch to be able to function.

WinCC Configuration Manual C79000-G8276-C140-01

2-17

6DPSOH3URMHFWYDULDB



,PSOHPHQWLQJLQWKH:LQ&&SURMHFW&DFWLRQ
6WHS 3URFHGXUHKRZDFKDQJHRYHUVZLWFKZRUNV&DFWLRQ

1 2 3

Create a tag of type %LQDU\WDJ in Tag Management. In our example, we use the tag called %,1LBYDULDBEXWB In a picture, configure a :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Under (YHQWV0RXVH3UHVVOHIW, generate a &DFWLRQ which negates the status 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 LQWHUQDOIXQFWLRQ *HW7DJ%LW reads out the value of the LQWHUQDOWDJ, inverts it and returns it with 6HW7DJ%LW.

1RWHVRQJHQHUDOXVH

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

2-18

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 ,QFUHPHQWLQJDQGGHFUHPHQWLQJ H[DPSOH

7DVNGHILQLWLRQ

The value of a tag is to be changed. This changing of the value is to be restricted to fixed limits. 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 the button is pressed. The value set must be retained when the button is released.

,PSOHPHQWDWLRQFRQFHSW

We create a button along event-driven lines using :LQGRZV2EMHFWV%XWWRQ. When the button is pressed with the , the value of an LQWHUQDOWDJ is incremented by the

increment set; when the button is pressed with the 5, the value of thistag is decremented by the increment set. The value keeps changing as long as the button is pressed. The increment is specified beforehand and cannot be altered during runtime. The change in the value is displayed by means of a 6PDUW2EMHFWV,2)LHOG. The output value of the,2ILHOG is linked to the LQWHUQDOWDJ.

Changing the value


To change the value, we need an action which changes the value of an LQWHUQDOWDJ with a fixed time base. We effect this changing of the value by means of a &DFWLRQ on the ,2 ILHOG under 3URSHUWLHV*HRPHWU\3RVLWLRQ;. We set the trigger for the action to PV. We are QRW dynamizing the position of the ,2ILHOG. The reason a &DFWLRQ is linked to 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 JOREDODFWLRQ.

WinCC Configuration Manual C79000-G8276-C140-01

2-19

6DPSOH3URMHFWYDULDB



,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHLQFUHPHQWLQJGHFUHPHQWLQJ

1 2

Creating the tag in the Tag Management. In our example, we use the tags called
6LBYDULDBEXWBDQG6LBYDULDBEXWB

In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG When creating the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, set the tag called 6LBYDULDBEXWB. change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. In the same picture, configure a :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ To modify a setpoint at the click of a mouse, we create several GLUHFWFRQQHFWLRQV at thisEXWWRQ. These GLUHFWFRQQHFWLRQVmodify the value of tag 6LBYDULDBEXWBevery time the EXWWRQ is chosen with the or R. Set (YHQWV0RXVH3UHVVOHIW to incrementation ON (set tag to ). Set (YHQWV 0RXVH5HOHDVHOHIW to incrementation OFF (set tag to ). Set (YHQWV 0RXVH3UHVVULJKW to decrementation ON (set tag to ) and (YHQWV0RXVH 5HOHDVHULJKW to decrementation OFF (set tag to ).

3 4

8 8

5 6

The value of the 6LBYDULDBEXWB tag is changed by a &DFWLRQ for the object ,2)LHOG under 3URSHUWLHV*HRPHWU\3RVLWLRQ;. We then change the trigger for calling the &DFWLRQ to PV.

2-20

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

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"); if ((count==1) || (count==2)){
//current value //inc or dec

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 count return(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 incremented or decremented. The value of the tag is changed depending on the result of this evaluation. After the value has been changed, the limit value check is performed. Return the value configured for position X with UHWXUQ. It isnt supposed to be changed.

1RWHVRQJHQHUDOXVH

The button with the GLUHFWFRQQHFWLRQV can be used after changes have been made to the tag and in conjunction with the &DFWLRQ for the ,2ILHOG. The limits and tags must be adapted in the &DFWLRQ.

WinCC Configuration Manual C79000-G8276-C140-01

2-21

6DPSOH3URMHFWYDULDB



 ,QFUHPHQWLQJDQGGHFUHPHQWLQJXVLQJ*OREDO6FULSW H[DPSOH

7DVNGHILQLWLRQ

The value of a tag is to be changed. This changing of the value is to be restricted to fixed limits. 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 the button is pressed. The value set must be retained when the button is released.

,PSOHPHQWDWLRQFRQFHSW

We create a button along event-driven lines using :LQGRZV2EMHFWV%XWWRQ. It is to be implemented with the aid of a JOREDODFWLRQ. , the value of an LQWHUQDOWDJ is incremented by the When the button is pressed with the increment set; when the button is pressed with the R, the value of thistag is decremented by the increment set. The value keeps changing as long as the button is pressed. The increment is specified beforehand and cannot be altered during runtime. The change in the value is displayed by means of a 6PDUW2EMHFWV,2)LHOG. The output value of the,2ILHOG is linked to the LQWHUQDOWDJ.

2-22

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

Changing the value


To change the value, we need an action which changes the value of an LQWHUQDOWDJ with a fixed time base. We implement the change in the value by means of a JOREDODFWLRQ. The action is activated when the WinCC runtime is started and is then processed with the set cycle. The action is programmed in such a way that the actual program component is only processed when the button is pressed. One unusual feature of this action is that it uses external &WDJV. External &WDJV are recognized throughout the entire WinCC runtime, but they must be declared outside the function header. Since in WinCC this is only possible in a SURMHFWIXQFWLRQ, a separate SURMHFWIXQFWLRQ is created for declaring these tags. This project function must be executed once when the project is started and is then no longer required.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW

Configuration is divided into the following three steps.

6WHS

&UHDWLQJWKHSURMHFWIXQFWLRQ
6WHS 3URFHGXUHFUHDWLQJWKHSURMHFWIXQFWLRQIRULQLWLDOL]DWLRQ

1 2 3 4

Open the *OREDO6FULSW editor from the &RQWURO&HQWHU. Create a new function by selecting )LOH1HZ3URMHFW)XQFWLRQ. Assign this new function the name ,QLW$FWLRQ and save the function by selecting )LOH6DYH$V,QLW$FWLRQIFW. Program and compile the function.

Project function InitAction


//declaration for counter.pas

extern extern extern extern extern

char tagname[30] = " "; SHORT count = 0; DWORD low = 0; DWORD high = 0; 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 longer required. A good way of executing it is in the Start Picture, and this can be set under (YHQWV0LVFHOODQHRXV2SHQ3LFWXUH.

WinCC Configuration Manual C79000-G8276-C140-01

2-23

6DPSOH3URMHFWYDULDB



6WHS

&UHDWLQJWKHJOREDODFWLRQ
6WHS 3URFHGXUHFUHDWLQJWKHJOREDODFWLRQ

1 2 3 4 5

Open the *OREDO6FULSW editor from the &RQWURO&HQWHU. Create a new action by selecting )LOH1HZ$FWLRQ. Save the file by selecting )LOH6DYH$VFRXQWHUSDV. Program and compile the action. Set the trigger. You do this by clicking the tab. Add 7LPHU&\FOLFPV on this tab.
EXWWRQ

and selecting the 7ULJJHU

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 value

value = GetTagDWord(tagname); if (count==1){ //inc value = value+step; if (value>high) (value=high); //high limit }//if if (count==2){ //dec value = 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 incremented or decremented. The value of the &WDJYDOXH is changed depending on the result of this evaluation. After the value has been changed, the limit value check is performed. Use the LQWHUQDOIXQFWLRQ 6HW7DJ':RUG to assign the new value to the tag to be processed.

2-24

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

&RQILJXULQJWKHEXWWRQV
6WHS 3URFHGXUHLQFUHPHQWLQJDQGGHFUHPHQWLQJXVLQJ*OREDO6FULSW

1 2

Creating the tag in the Tag Management. In our example, we use the tag called
6LBYDULDBEXWB

In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG When creating the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, set the tag called 6LBYDULDBEXWB. change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ To modify a setpoint at the click of a mouse, we create several &DFWLRQV at this EXWWRQThese &DFWLRQV provide the JOREDODFWLRQ, FRXQWHUSDVwith the relevant parameters. This happens each time the button is clicked with the or R. Set (YHQWV0RXVH3UHVVOHIW to incrementation ON, (YHQWV0RXVH 5HOHDVHOHIW to incrementation OFF, (YHQWV0RXVH3UHVVULJKW to decrementation ON and (YHQWV0RXVH5HOHDVHULJKW to decrementation OFF.

3 4

8 8

The value of the 6LBYDULDBEXWB tag is changed in the JOREDODFWLRQ FRXQWHUSDV.

C action for Button8for incrementation ON


#include "apdefap.h" void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y) {
//inc on

extern extern extern extern extern

char tagname[30]; SHORT count; DWORD low; DWORD high; DWORD step;

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

WinCC Configuration Manual C79000-G8276-C140-01

2-25

6DPSOH3URMHFWYDULDB



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 off

extern SHORT count; count=0; }

The declaration of the external &WDJV in the &DFWLRQ. These tags are generated in the project function ,QLW$FWLRQ. Provide the tags with the relevant values. This is comparable with transferring parameters to a SURMHFWIXQFWLRQ. The content of the FRXQW tag is responsible for processing the program in the JOREDODFWLRQ. When switching off the incrementation process, there is no need to set all the tags.

1RWHVRQJHQHUDOXVH

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 SURMHFWIXQFWLRQ ,QLW$FWLRQ and the JOREDODFWLRQ FRXQWHUSDV must both be transferred over together with the button.

2-26

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 7KHRWKHUH[DPSOHVUHODWHGWRWKLVWRSLF

H[DPSOH

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

H[DPSOH

The functionality of this example results from combining H[DPSOH and H[DPSOH. The value is changed with the help of the JOREDODFWLRQ FRXQWHUSDV.

H[DPSOH

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

WinCC Configuration Manual C79000-G8276-C140-01

2-27

6DPSOH3URMHFWYDULDB



 &KDQJLQJWDJYDOXHXVLQJ:LQGRZV2EMHFWV

In runtime, you access the solutions that relate to these topics in the EXWWRQ depicted above. The examples are configured in the our YDULDB project by picture named YDULDBBFKDSWHUBSGO.

2-28

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 ,QSXWWLQJE\PHDQVRIDVOLGHUZLWKGLUHFWFRQQHFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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.

,PSOHPHQWDWLRQFRQFHSW

We use a slider object created under :LQGRZV2EMHFWV6OLGHU2EMHFW to implement changing of the set values. By means of a GLUHFWFRQQHFWLRQ, the value of an LQWHUQDOWDJ is changed when the position of the slider is changed. The change in the set value is displayed by means of a 6PDUW2EMHFWV,2)LHOG.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJVHWYDOXHE\PHDQVRIDVOLGHUGLUHFWFRQQHFWLRQ

1 2

Create a tag in Tag Management. In our example, we use the tag called
6LBYDULDBZLQB

In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 6LBYDULDBZLQB. change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW.

WinCC Configuration Manual C79000-G8276-C140-01

2-29

6DPSOH3URMHFWYDULDB



6WHS

3URFHGXUHFKDQJLQJVHWYDOXHE\PHDQVRIDVOLGHUGLUHFWFRQQHFWLRQ

In the same picture, configure an object under :LQGRZV2EMHFWV6OLGHU2EMHFW. In our example, we use the object called 6OLGHU2EMHFW. Create aGLUHFW FRQQHFWLRQ under (YHQWV0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ.

In the 'LUHFW&RQQHFWLRQ dialog box, connect the VRXUFH WKLVREMHFW3URFHVV 'ULYHU&RQQHFWLRQ to the WDUJHW 9DULDEOH6BYDULDBZLQB. Accept the settings by clicking the 2. button.

2-30

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHFKDQJLQJVHWYDOXHE\PHDQVRIDVOLGHUGLUHFWFRQQHFWLRQ

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: Change the tag in the GLUHFWFRQQHFWLRQ. The value range of the 6OLGHU2EMHFW can be changed under 3URSHUWLHV0LVFHOODQHRXV 0D[LPXP9DOXH and0LQLPXP9DOXH. This can also be done under &RQILJXUDWLRQ
'LDORJ

WinCC Configuration Manual C79000-G8276-C140-01

2-31

6DPSOH3URMHFWYDULDB



 ,QSXWWLQJE\PHDQVRIVOLGHUDQGWDJFRQQHFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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.

,PSOHPHQWDWLRQFRQFHSW

We use a slider object created under :LQGRZV2EMHFWV6OLGHU2EMHFW to implement changing of the set values. By means of a WDJFRQQHFWLRQ, the value of an LQWHUQDOWDJ is changed when the position of the slider is changed. The tag is only written to when the slider is released. The change in the set value is displayed by means of a 6PDUW2EMHFWV,2)LHOG.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJVHWYDOXHE\PHDQVRIDVOLGHUWDJFRQQHFWLRQ

1 2

Create a tag in Tag Management. In our example, we use the tag called
6LBYDULDBZLQB

In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 6LBYDULDBZLQB. Change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. In the same picture, configure an object under :LQGRZV2EMHFWV6OLGHU2EMHFW. In our example, we use the object called 6OLGHU2EMHFW. When configuring the VOLGHUREMHFW in the FRQILJXUDWLRQGLDORJ, select the tag named 6LBYDULDBZLQB. Change the entry in the 8SGDWH list box from the default value of 2s to 8SRQFKDQJH.

2-32

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: Change the tag in theWDJFRQQHFWLRQ. The value range of the 6OLGHU2EMHFW can be changed under 3URSHUWLHV0LVFHOODQHRXV 0D[LPXP9DOXH and0LQLPXP9DOXH. This can also be done under &RQILJXUDWLRQ 'LDORJ.

WinCC Configuration Manual C79000-G8276-C140-01

2-33

6DPSOH3URMHFWYDULDB



 ,QSXWWLQJE\PHDQVRIDQ2SWLRQ*URXS H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

We implement this changing of the set value by means of an option group, which we create under :LQGRZV2EMHFWV2SWLRQ*URXS. When one of the specified set values is selecting using the , the value in an LQWHUQDOWDJ is 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 6PDUW2EMHFWV,2)LHOG. The output value of the,2ILHOG is linked to the LQWHUQDOWDJ. The change in the set value is implemented by means of a &DFWLRQ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJVHWYDOXHXVLQJDQRSWLRQJURXS

1 2

Create a tag in Tag Management. In our example, we use the tag called
6LBYDULDBZLQB

In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 6LBYDULDBZLQB. Change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. In the same picture, configure a :LQGRZV2EMHFWV2SWLRQ*URXS. In our example, this is 2SWLRQ*URXS. Under 3URSHUWLHV*HRPHWU\1XPEHURI %R[HV, change the default value 3 to . Select the index value 1 under 3URSHUWLHV)RQW,QGH[. Enter the appropriate text for the selected index under 3URSHUWLHV)RQW7H[W. In the same way, configure the values for the remaining index inputs. Under (YHQWV3URSHUW\7RSLFV2XWSXW,QSXW6HOHFWHG%R[HV, create a & DFWLRQ, which set tag 6LBYDULDBZLQB to a specific value depending on the field selected.

2-34

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHFKDQJLQJVHWYDOXHXVLQJDQRSWLRQJURXS

C action for the option group


void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, long value) {
//set tag according to selected box

switch(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 6LBYDULDBZLQB in accordance with the input state. The input state is stored in the predefined tag YDOXH.

1RWHVRQJHQHUDOXVH

The following adaptation must be made before the 2SWLRQ*URXS can be put to general use: Adapt the tag in the &DFWLRQ under (YHQWV3URSHUW\7RSLFV2XWSXW,QSXW 6HOHFWHG%R[HV.

WinCC Configuration Manual C79000-G8276-C140-01

2-35

6DPSOH3URMHFWYDULDB



 ,QSXWWLQJE\PHDQVRIFKHFNER[ H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

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 objects created 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.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHLQSXWWLQJE\PHDQVRIDFKHFNER[

1 2

Create a tag of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tag called 6LBYDULDBZLQB Configure a number of objects under 6WDQGDUG2EMHFWV3RO\JRQ; in our example, we use 3RO\JRQ through 3RO\JRQ. These objects are to be shown or hidden depending on the selection state of the FKHFNER[.

In the same picture, configure a :LQGRZV2EMHFWV&KHFN%R[. In our example, &KHFN%R[. Under 3URSHUWLHV*HRPHWU\1XPEHURI%R[HV, change the default value 3 to . Select the index value 1 under 3URSHUWLHV)RQW,QGH[. Enter the appropriate text for the selected index under 3URSHUWLHV)RQW7H[W, this text being the name of the object you want to control by selecting this field. In the same way, configure the values for the remaining index inputs. Under (YHQWV3URSHUW\7RSLFV2XWSXW,QSXW6HOHFWHG%R[HV create a & DFWLRQ which assigns the binary state of &KHFN%R[ to tag S32i_varia_win_03 and controls the "visibility" of the individual SRO\JRQREMHFWV.

2-36

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHLQSXWWLQJE\PHDQVRIDFKHFNER[

Configure an I/O field under 6PDUW2EMHFWV,2)LHOG; in our example, we use ,2)LHOG. Under &RQILJXUDWLRQ'LDORJ, select tag 6LBYDULDBZLQB. Change the entry in the 8SGDWH list box from the default value of 2s to 8SRQFKDQJH. Under 3URSHUWLHV2XWSXW,QSXW, change the 'DWD)RUPDW to %LQDU\ and change the Output Format to .

WinCC Configuration Manual C79000-G8276-C140-01

2-37

6DPSOH3URMHFWYDULDB



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 6LBYDULDBZLQB to the new input state of the FKHFNER[. Control the visibility of the objects in accordance with the input state. The input state is stored in the predefined tag YDOXH. To read out the respective bit, you have to perform bit masking to the relevant bit.
1RWH

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

1RWHVRQJHQHUDOXVH

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 (YHQWV3URSHUW\7RSLFV 2XWSXW,QSXW6HOHFWHG%R[HV.

2-38

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 %LWHGLWLQJLQZRUGV

You access the solutions that relate to these topics in our YDULDB project by the EXWWRQ depicted above. The examples are configured in the pictures YDULDBBFKDSWHUBSGO and YDULDBBFKDSWHUBDSGO.

'HILQLWLRQ

The term ELWHGLWLQJ refers to changing the state of bits in a word.

WinCC Configuration Manual C79000-G8276-C140-01

2-39

6DPSOH3URMHFWYDULDB



 'LUHFWO\VHWWLQJDELWZLWKWKHDLGRIDFKHFNER[DQGGLUHFW FRQQHFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

We implement changing of the bit states by means of a check box, which we create under :LQGRZV2EMHFWV&KHFN%R[. When we one of the fields of the &KHFN%R[, the bit assigned to it in the LQWHUQDOWDJ is changed with the aid of a GLUHFWFRQQHFWLRQ. The bit pattern is displayed by means of an I/O field created under 6PDUW2EMHFWV,2 )LHOG. The output value of the ,2ILHOG is linked to an LQWHUQDOWDJ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHGLUHFWO\VHWWLQJDELWZLWKWKHDLGRIDFKHFNER[DQGGLUHFW FRQQHFWLRQ

1 2

Create a tag of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use the tag called 8LBYDULDBVHWB In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 8LBYDULDBVHWB. Change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. Under 3URSHUWLHV2XWSXW,QSXW, change the 'DWD)RUPDW to %LQDU\ and change the 2XWSXW)RUPDW to .

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

2-40

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHGLUHFWO\VHWWLQJDELWZLWKWKHDLGRIDFKHFNER[DQGGLUHFW FRQQHFWLRQ RI%R[HV

, change the default value 3 to .

Select the index value 1 under 3URSHUWLHV)RQW,QGH[. Enter the appropriate text for the selected index under 3URSHUWLHV)RQW7H[WELW. In the same way, configure the values for the remaining index inputs.
GLUHFWFRQQHFWLRQ

Under (YHQWV3URSHUW\7RSLFV6HOHFWHG%R[HV, dynamize this event using a .

In the 'LUHFW&RQQHFWLRQ dialog box, connect the VRXUFH 3URSHUW\WKLVREMHFW 6HOHFWHG%R[HV to the target 9DULDEOH8LBYDULDBVHWB. Accept the settings by clicking the 2. button.

WinCC Configuration Manual C79000-G8276-C140-01

2-41

6DPSOH3URMHFWYDULDB



6WHS

3URFHGXUHGLUHFWO\VHWWLQJDELWZLWKWKHDLGRIDFKHFNER[DQGGLUHFW FRQQHFWLRQ

7 8

Configure two :LQGRZV2EMHFWV%XWWRQ. In our example, we use the objects called %XWWRQ and %XWWRQ. These will be used to set and reset all bits. Create a GLUHFWFRQQHFWLRQ for under (YHQWV0RXVH0RXVH$FWLRQ. Connect the VRXUFH &RQVWDQW to the WDUJHW 2EMHFWLQ3LFWXUH&KHFN%R[ 6HOHFWHG%R[HV. Accept the settings by clicking the 2. button. The constant selected corresponds to the binary number 1111111111111111. Create a GLUHFWFRQQHFWLRQ linked to the object %XWWRQ in the same way, but this time with the VRXUFH &RQVWDQW.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tags must be adapted in the GLUHFWFRQQHFWLRQV.

2-42

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 6HOHFWLQJDELWDQGFKDQJLQJLWVVWDWH H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

We implement changing of the bit states by means of a button, which we create under :LQGRZV2EMHFWV%XWWRQ. To enter the bit number and display the bit pattern, we use a 6PDUW2EMHFWV,2)LHOG. When we enter the bit number and the EXWWRQ, the selected bit in an LQWHUQDOWDJ is changed. The change is implemented by means of a &DFWLRQ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJDELWLQDZRUG

1 2

Create two tags of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use the tags called 8LBYDULDBVHWB and 8LBYDULDBVHWB In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG, connect it to tag 8LBYDULDBVHWB. Change the entry in the 8SGDWH list box from the default value of 2s to 8SRQFKDQJH. The bit number is entered in this input field.

WinCC Configuration Manual C79000-G8276-C140-01

2-43

6DPSOH3URMHFWYDULDB



6WHS

3URFHGXUHFKDQJLQJDELWLQDZRUG

Configure a second ,2ILHOG for displaying the bit states. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG, connect it to tag 8LBYDULDBVHWB. Change the entry in the 8SGDWH list box from the default value of 2s to 8SRQFKDQJH. Change the field type to 2XWSXW. Under 3URSHUWLHV 2XWSXW,QSXW, change the 'DWD)RUPDW to %LQDU\ and change the 2XWSXW )RUPDW to . In the same picture, configure three buttons under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the objects called %XWWRQ, %XWWRQ and %XWWRQ. Create a &DFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. This &DFWLRQ is to be used to set the bit selected in the ,2ILHOG in an LQWHUQDOWDJ. In the same way, create &DFWLRQV under the other EXWWRQV for resetting and toggling the bit.

4 5

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 position

pos=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 LQWHUQDOIXQFWLRQ *HW7DJ:RUG to read out the bit position entered and the current 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 are retained. Assign the new value to the LQWHUQDOWDJ.

2-44

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

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 position

pos=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 LQWHUQDOIXQFWLRQ *HW7DJ:RUG to read out the bit position entered and the current value of the tag. The bit shift function (<<) is used to generate the corresponding bit mask. This is complemented with the operator (~) and ANDed (&) bit-by-bit with the contents of the tag to be processed. Assign the new value to the LQWHUQDOWDJ.

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 position

pos=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 LQWHUQDOIXQFWLRQ *HW7DJ:RUG to read out the bit position entered and the current value of the tag. The bit shift function (<<) is used to generate the corresponding bit mask. This is EXORed (^) bit-by-bit with the contents of the tag to be processed. The states of the other bits are retained. Assign the new value to the LQWHUQDOWDJ.

WinCC Configuration Manual C79000-G8276-C140-01

2-45

6DPSOH3URMHFWYDULDB



 7KHRWKHUH[DPSOHVUHODWHGWRWKLVWRSLF

H[DPSOH

The functionality of this example is similar to that of example H[DPSOH. The basic difference is in the way the bit to be switched is selected. In this example, the bit is switched by selecting an object which represents this bit. Each object is able to read out which 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 . Here too, the objects are 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 difference here is that an option group is used. Use of this object type means that only one bit can be set in each data word.

2-46

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 ,QGLUHFWDGGUHVVLQJRIWDJV

You access the solutions that relate to these topics in our YDULDB project by the EXWWRQ depicted above. The examples are configured in the picture named YDULDBBFKDSWHUBSGO.

WinCC Configuration Manual C79000-G8276-C140-01

2-47

6DPSOH3URMHFWYDULDB



 ,QGLUHFWDGGUHVVLQJE\PHDQVRIDGLUHFWFRQQHFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

We implement selection of the corresponding process values by means of a button, which we create under :LQGRZV2EMHFWV%XWWRQ. We use an I/O field created under 6PDUW2EMHFWV,2)LHOG and indirect addressing in WinCC to display the process values. Three more I/O fields created under 6PDUW2EMHFWV ,2ILHOGValso enable you to enter the process value directly.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHLQGLUHFWDGGUHVVLQJE\PHDQVRIDGLUHFWFRQQHFWLRQ

Create three tags of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tags called 6LBYDULDBDGUB6LBYDULDBDGUB and 6LBYDULDBDGUB. These contain the process values to be displayed. Create a tag of type 7H[WWDJELWFKDUDFWHUVHW with a length of 20 characters in Tag Management. In our example, we use the tag called 7[BYDULDBDGUB. This will be used as an address tag. In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named 7[BYDULDBDGUB. Change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. Under 3URSHUWLHV2XWSXW,QSXW2XWSXW 9DOXH, select the box in the , ,QGLUHFW column. Select the box.

Configure an object of type 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, we

2-48

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHLQGLUHFWDGGUHVVLQJE\PHDQVRIDGLUHFWFRQQHFWLRQ

use the object called 6WDWLF7H[W. This object indicates which process value is currently being displayed. The text in the object is automatically supplied by the EXWWRQ. 5 6 In the same picture, configure three buttons under :LQGRZV2EMHFWV%XWWRQIn our example, we use the objects called %XWWRQ, %XWWRQ and %XWWRQ. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW6LBYDULDBDGUB to the WDUJHW 9DULDEOH 7[BYDULDBDGUB. Accept the settings by clicking the 2. button.

Create a further GLUHFWFRQQHFWLRQ under (YHQWV0RXVH0RXVH$FWLRQ. Connect the VRXUFH 3URSHUW\WKLVREMHFW7H[W to the WDUJHW 2EMHFWLQ3LFWXUH 6WDWLF7H[W7H[W. Accept the settings by clicking the 2. button. Configure %XWWRQ and %XWWRQin the same way as %XWWRQ. In the first GLUHFW FRQQHFWLRQ, the tag name in the VRXUFH must be changed. The second GLUHFW FRQQHFWLRQ can be applied without any change.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tag names must be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

2-49

6DPSOH3URMHFWYDULDB



 0XOWLSOH[GLVSOD\XVLQJLQGLUHFWDGGUHVVLQJDQGD&DFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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 be displayed by selecting the corresponding container.

,PSOHPHQWDWLRQFRQFHSW

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

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHPXOWLSOH[GLVSOD\ZLWKLQGLUHFWDGGUHVVLQJ

Create nine tags of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tags called 6LBYDULDBDGUB through 6LBYDULDBDGUB. These tags contain the corresponding process values of the container. Create three tags of type 7H[WWDJELWFKDUDFWHUVHW in Tag Management. In our example, we use the tags called 7[BYDULDBDGUB, 7[BYDULDBDGUB and 7[BYDULDBDGUB. They will be used as address tags for the,2ILHOGV. Configure three I/O fields under 6PDUW2EMHFWV,2)LHOG. In our example, we use ,2)LHOG, ,2)LHOG and ,2)LHOG. For object ,2)LHOG, change the )LHOG7\SH to 2XWSXW under 3URSHUWLHV 2XWSXW,QSXW. Under the property 2XWSXW9DOXH, configure a WDJFRQQHFWLRQ to tag 7[BYDULDBDGUB and select the box in the , ,QGLUHFW column. Select the box. In the same way, configure the other ,2ILHOGV, but connect each field to a different address tag. Configure an option group under :LQGRZV2EMHFWV2SWLRQ*URXS. In our example, we use the object called 2SWLRQ*URXS. Select the index 1 under 3URSHUWLHV)RQW,QGH[. Enter the appropriate text for the selected index under 3URSHUWLHV)RQW7H[W&RQWDLQHU. In the same way, configure the texts for the remaining index values. Create a &DFWLRQ under (YHQWV3URSHUW\7RSLFV2XWSXW,QSXW6HOHFWHG %R[HV. This action describes the address tag depending on the field selected.

3 4

5 6 7

2-50

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

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 2 break; case 4: { strcpy(address1,"S32i_varia_adr_04"); strcpy(address2,"S32i_varia_adr_07"); strcpy(address3,"S32i_varia_adr_10"); }//case 4 break; default: { strcpy(address1,"S32i_varia_adr_05"); strcpy(address2,"S32i_varia_adr_08"); strcpy(address3,"S32i_varia_adr_11"); }//default break; }//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 input state. The input state is stored in the predefined tag YDOXH. Assign the corresponding tag names to the address tags.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tag names must be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

2-51

6DPSOH3URMHFWYDULDB



 ,QGLUHFWDGGUHVVLQJE\PHDQVRI&DFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

We implement selection of the corresponding process value by means of an option group, which we create under :LQGRZV2EMHFWV2SWLRQ*URXS. We use an I/O field created under 6PDUW2EMHFWV,2)LHOG and indirect addressing in WinCC to display the process value.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHLQGLUHFWDGGUHVVLQJE\PHDQVRID&DFWLRQ

Create three tags of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tags called 6LBYDULDBDGUB6LBYDULDBDGUB and 6LBYDULDBDGUB. These contain the process values to be displayed. Create a tag of type 7H[WWDJELWFKDUDFWHUVHW with a length of 20 characters in Tag Management. In our example, we use the tag called 7[BYDULDBDGUB. This will be used as an address tag. In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. When configuring the ,2ILHOG in the FRQILJXUDWLRQGLDORJ, select the tag named7[BYDULDBDGUB. Change the entry in the list box from the default value of 2s to 8SRQFKDQJH and change the field type entry (7\SH) to 2XWSXW. Under 3URSHUWLHV2XWSXW,QSXW2XWSXW 9DOXH, select the box in the , ,QGLUHFW column. Select the box. In the same picture, configure a :LQGRZV2EMHFWV2SWLRQ*URXS. In our example, we use the object called 2SWLRQ*URXS. Select the index 1 under 3URSHUWLHV)RQW,QGH[. Enter the appropriate text for the selected index under 3URSHUWLHV)RQW7H[W)LOO/HYHO. In the same way, configure the texts for the remaining index values. Create a &DFWLRQ under (YHQWV3URSHUW\7RSLFV2XWSXW,QSXW6HOHFWHG %R[HV. This action describes the address tag depending on the field selected.

4 5

2-52

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

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 value

switch(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"); }//switch SetTagChar("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.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tag names must be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

2-53

6DPSOH3URMHFWYDULDB



 7KHRWKHUH[DPSOHVUHODWHGWRWKLVWRSLF

H[DPSOH

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

2-54

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 6LPXODWLRQRIWDJV

You access the solutions that relate to these topics in our YDULDB project by the EXWWRQ depicted above. The examples are configured in the picture named YDULDBBFKDSWHUBSGO.

'HILQLWLRQ

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

WinCC Configuration Manual C79000-G8276-C140-01

2-55

6DPSOH3URMHFWYDULDB



 6LPXODWLQJDWULDQJXODURVFLOODWLRQE\PHDQVRID&DFWLRQ H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

We implement starting of the simulation and initialization by means of two buttons, which we create under :LQGRZV2EMHFWV%XWWRQ. To display the tag value and to input the maximum and minimum values, we will create three I/O fields under 6PDUW2EMHFWV,2 )LHOG. If simulation is started while the maximum and minimum values set are identical, a message box pops up.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVLPXODWLQJDWULDQJXODURVFLOODWLRQE\PHDQVRID&DFWLRQ

Create three tags of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tags called 6LBYDULDBVLPB6LBYDULDBVLPB and
6LBYDULDBVLPB

2 3 4

Create two tags of type %LQDU\WDJ in Tag Management. In our example, we use the tags called %,1LBYDULDBVLPB and %,1LBYDULDBVLPB. Configure three I/O fields under 6PDUW2EMHFWV,2)LHOG. In our example, we use ,2)LHOG, ,2)LHOG and ,2)LHOG. For object ,2)LHOG, create a WDJFRQQHFWLRQ to tag 6LBYDULDBVLPB under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH and set the trigger to 8SRQFKDQJH. Change the 2XWSXW)RUPDW to . In the same way, configure ,2)LHOG, but set tag 6LBYDULDBVLPB , create a WDJFRQQHFWLRQ to tag under 3URSHUWLHV/LPLWV+LJK/LPLW9DOXH. In the same way, configure the tag 6LBYDULDBVLPB as the /RZ/LPLW9DOXH for ,2)LHOG.
7RFKHFNWKHSODXVLELOLW\RI,2)LHOG 6LBYDULDBVLPB

For object ,2)LHOG, create a WDJFRQQHFWLRQ to tag 6LBYDULDBVLPB under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH and set the trigger to 8SRQFKDQJH. Change the 2XWSXW)RUPDW to  and the )LHOG7\SH to 2XWSXW. Configure a picture window at 6PDUW2EMHFWV3LFWXUH:LQGRZ; in our example we use GLDORJER[ Select 3URSHUWLHV0LVFHOODQHRXVand modify the properties 0RYHDEOH and %RUGHU to <HV and the 3LFWXUH1DPH to YDULDBBZLQGRZB. You can take this picture from the sample project for use in your own projects; the info text and title can be changed to whatever you want. Configure a button under :LQGRZV2EMHFWV%XWWRQ; in our example, we use %XWWRQ. Create a further GLUHFWFRQQHFWLRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW9DULDEOH%,1LBYDULDBVLPB. This EXWWRQ is used for initialization. Configure another :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object

2-56

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHVLPXODWLQJDWULDQJXODURVFLOODWLRQE\PHDQVRID&DFWLRQ

called %XWWRQ. Under (YHQWVB0RXVH3UHVVOHIW, generate a &DFWLRQ which negates the status of the %,1LBYDULDBVLPB tag. Under 3URSHUWLHV*HRPHWU\ 3RVLWLRQ;, create a &DFWLRQ, which executes tag simulation. 10 Create a status display under 6PDUW2EMHFWV6WDWXV'LVSOD\ to display the status of simulation. In our example, we use the object called 6WDWXV'LVSOD\. Under &RQILJXUDWLRQ'LDORJ, set tag %,1LBYDULDBVLPB and set the trigger to 8SRQFKDQJH. Add another status. For status , set the picture JOKELUQHBB%LWEPS, and for status , set the picture JOKELUQHBB%LWEPS.

&DFWLRQIRUWDJVLPXODWLRQ

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

if (low!=lowstore){ lowstore = low; i=low; }//if


//if limits different

if (high!=low) { box=0;
//if simulator is activated

if (state==TRUE) {
//inc or dec according to direction

if (r==1) (i=i+1); else (i=i-1);


//set direction

WinCC Configuration Manual C79000-G8276-C140-01

2-57

6DPSOH3URMHFWYDULDB



if (i==high) (r=0); if (i==low) (r=1);


//init simulator if limit overflow

if ((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 box

if ((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 minimum value stored, the counter direction to ascending, the value of the LQWHUQDOWDJ 6LBYDULDBVLPB 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 pop up, and simulation is performed when the simulator is turned on. Counting up or counting down depends on the direction tag; when the limits are reached, the direction is reversed; if the limit values are exceeded, initialization takes place and tag S32i_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 the maximum 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.

2-58

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 6LPXODWLRQE\PHDQVRIDQH[WHUQDOSURJUDP H[DPSOH

WinCC provides its own simulation program, which can simulate tags using a number of different methods. This simulation program must be installed using the 6HWXSH[H program in the folder called 6PDUW7RROV&&B6LPXODWRU on the WinCC CD.

7DVNGHILQLWLRQ

Tags are to be simulated using the WinCC tag simulator.

,PSOHPHQWDWLRQFRQFHSW

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

WinCC Configuration Manual C79000-G8276-C140-01

2-59

6DPSOH3URMHFWYDULDB



,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVLPXODWLQJE\PHDQVRIDQH[WHUQDOSURJUDP

1 2 3

Create two LQWHUQDOWDJV of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tags called 6LBYDULDBVLPB and 6LBYDULDBVLPB Configure two I/O fields under 6PDUW2EMHFWV,2)LHOG. In our example, we use ,2)LHOG and ,2)LHOG. For object ,2)LHOG, create a WDJFRQQHFWLRQ to tag 6LBYDULDBVLPB under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH and set the trigger to 8SRQFKDQJH. Change the 2XWSXW)RUPDW to  and the )LHOG7\SH to 2XWSXW)LHOG. In the same way, configure ,2)LHOG, but set tag 6LBYDULDBVLPB. Start the tag simulator by means of the 6LPXODWRU button. If the tag simulator has not been installed under the default path, set the correct path by means of the 3DWK button. If the simulation program is started using a method other than the one described, you must ensure that the project in question is running in runtime mode. In the simulator, select tag 6LBYDULDBVLPB under the menu item (GLW1HZ 7DJ from the Tag Management screen which appears. Select the ,QF tab and enter the 6WDUW9DOXH and (QG9DOXH. In our example, the values  and  have been used. Simulation is started by selecting the item DFWLYH. The value of the tag is increased from 0 to 20, after which simulation is restarted at 0. Proceed in the same way with tag 6LBYDULDBVLPB. In our example, the 6LQXV tab has been selected and $PSOLWXGH set to , 2IIVHW to  and 2VFLOODWLRQWLPH to .

1RWH

In the sample project, you can use the flag icon to select the English or German version of the tag simulator.

1RWHVRQJHQHUDOXVH

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 your own requirements.

2-60

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 ,PSRUWLQJH[SRUWLQJWDJV

You access the solutions that relate to these topics in our YDULDB project by the EXWWRQ depicted above. The examples are configured in the picture named YDULDBBFKDSWHUBSGO.

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

To implement this in the project, we use two buttons which we create under :LQGRZV 2EMHFWV%XWWRQ; these buttons are used to start the import/export program YDUBLPH[H[H and H[FHOH[H. The path to each of these programs can be set by means of two I/O fields created under 6PDUW2EMHFWV,2)LHOG.

WinCC Configuration Manual C79000-G8276-C140-01

2-61

6DPSOH3URMHFWYDULDB



,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHLPSRUWLQJH[SRUWLQJWDJV

1 2

Set the correct paths to the programs H[FHOH[H and YDUBLPH[H[H. Call the YDUBH[LPH[H program by clicking the ,PS([S EXWWRQ during runtime. The program can also be started directly in Explorer, without runtime being active. Use the
YDULDBPFS EXWWRQ

3 4

to set the path to project YDULDB and select the file

there.

Select the selection field ([SRUW. Then click ([HFXWH2.. Exporting of the tags is now performed. The program generates a file with the extension YH[, which contains the information relating to the tags. It also creates a second file with the extension FH[, which contains the information relating to the connections to the programmable controller, and a third file with the extension GH[, which contains the information relating to tags of type 'DWD6WUXFWXUH. Start ([FHO and open the YDULDBYD[FVY file just generated by selecting )LOH 2SHQ. To configure 100 tags of type 8QVLJQHGELWYDOXH, proceed as described below. The names to be assigned to these tags are to range from 8LBYDULDBLPSH[B through 8LBYDULDBLPSH[B. In the first column of the first empty line, enter the name 8LBYDULDBLPSH[B. Select the cell and move the mouse pointer to the bottom right corner. Press and and drag the mouse pointer downward to fill in the remaining hold down the 99 cells automatically.

5 6

In the second column, enter a ; in the third column, LQWHUQDOWDJ; in the fourth, LPSH[S as the group name; in the fifth column, ; and in the sixth column,  as the code for an 8QVLJQHGELWYDOXH. In the remaining Columns, enter the value . Fill in the remaining 99 lines automatically. Open YDUBLPH[H[H again via the task bar and select the selection field ,PSRUW. Then click ([HFXWH2.. After completing import of the tags, exit the program. 100 new tags have now been created in Tag Management.

9 10
1RWH

Runtime doesnt have to be active to enable the importing and exporting of tags.

2-62

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 8VLQJVWUXFWXUHWDJV

You access the solutions that relate to these topics in our YDULDB project by the EXWWRQ depicted above. The examples are configured in the picture named YDULDBBFKDSWHUBSGO.

'HILQLWLRQ

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

WinCC Configuration Manual C79000-G8276-C140-01

2-63

6DPSOH3URMHFWYDULDB



 9DOYHFRQWUROE\PHDQVRIDVWUXFWXUHWDJ H[DPSOH

7DVNGHILQLWLRQ

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

,PSOHPHQWDWLRQFRQFHSW

To implement this, we use two buttons created under :LQGRZV2EMHFWV%XWWRQ, with which we will turn the valve on and off and simulate a fault condition. We will also use polygons created under 6WDQGDUG2EMHFWV3RO\JRQ

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHYDOYHFRQWUROE\PHDQVRIDVWUXFWXUHWDJ

Define a new structure tag in the &RQWURO&HQWHU. Select 1HZ6WUXFWXUH at 'DWD 5. 7\SHV6WUXFWXUH7\SHV using

In the window that appears, 5 1HZ6WUXFWXUH and select 5HQDPH in the pop-up menu that appears. The name YDOYH has been selected in our example. Add a new structure element by clicking the 1HZHOHPHQW button. Then 5 this new structure element and select the data type %,7.

2-64

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

6WHS

3URFHGXUHYDOYHFRQWUROE\PHDQVRIDVWUXFWXUHWDJ

Using 5HQDPH, change the name to DFWLYDWHG and select the selection field LQWHUQDOWDJ. Define further structure elements as follows:

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

Configure two buttons under :LQGRZV2EMHFWV%XWWRQ; in our example, we use %XWWRQ and %XWWRQ. Create a &DFWLRQ for %XWWRQ, which turns the valve on and off. Create a &DFWLRQIRU %XWWRQ, which turns the error bit on and off. Under %XWWRQ, configure a &DFWLRQ under 3URSHUWLHV*HRPHWU\3RVLWLRQ ;, which simulates the external processes on the valve. We then create three different pictures to display the on, off, and error states of the valve. In our example, each of these pictures consists of two polygons created under 6WDQGDUG2EMHFWV3RO\JRQ. These are positioned one on top of the other and shown or hidden depending on the state of the valve.

6 7

1RWHVRQJHQHUDOXVH

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 structure element names must be adapted.
&DFWLRQV

for simulating the external processes on the valve are not necessary in practical applications.

WinCC Configuration Manual C79000-G8276-C140-01

2-65

6DPSOH3URMHFWYDULDB



 6HULDOFRQQHFWLRQWR6

You access the solutions that relate to these topics in our YDULDB project by the EXWWRQ depicted above. The examples are configured in the picture named YDULDBBFKDSWHUBSGO.

7DVNGHILQLWLRQ

Planning, configuring and testing a serial connection. To connection partner to be used is a Simatic 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).

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVHULDOFRQQHFWLRQWR6

In the &RQWURO&HQWHU under 7DJ0DQDJHPHQW, add a new driver. In our example, we use the driver 6,0$7,&66(5,$/5.

Click the name of the driver with the 5, select 1HZ'ULYHU&RQQHFWLRQ and give the connection a name on the *HQHUDO,QIRUPDWLRQ tab; in our example, we use 3/&&RQQHFWLRQ. On the *URXSV tab, create a new group; in our example, we use FRQQHFW. On the 6HULDO5 tab, make the settings you want; in our example, the standard values are set. In the tag group, create three new tags of type 8QVLJQHGELWYDOXH. The tags must be assigned an address in the PLC, this being set by means of the 6HOHFW button. The type of format adaptation selected in our example is :RUG7R8QVLJQHG:RUG. Tags 8ZBYDULDBFRQB, 8ZBYDULDBFRQB and 8ZBYDULDBFRQB are used. These tags are also used in the following examples.

3 4

2-66

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWYDULDB

 7KHRWKHUH[DPSOHVUHODWHGWRWKLVWRSLF

H[DPSOH

The functionality of this example corresponds to the example named 6HOHFWLQJDELW DQGFKDQJLQJLWVVWDWH H[DPSOH in the section called %LWHGLWLQJLQZRUGV. The tag in which the bit is set is, however, the external data word 8ZBYDULDBFRQB.

H[DPSOH

The functionality of this example corresponds to the example named 'LUHFWO\VHWWLQJ DELWZLWKWKHDLGRIDFKHFNER[DQGGLUHFWFRQQHFWLRQ H[DPSOH in the section called %LWHGLWLQJLQZRUGV. The tag in which the bit is set is, however, the external data word 8ZBYDULDBFRQB.

H[DPSOH

The functionality corresponds to the example named  7KHRWKHUH[DPSOHVUHODWHGWR WKLVWRSLF in the section called ,QFUHPHQWLQJGHFUHPHQWLQJDQGMRJJLQJ. The tag which is incremented or decremented is, however, the external data word 8ZBYDULDBFRQB.

WinCC Configuration Manual C79000-G8276-C140-01

2-67

6DPSOH3URMHFWYDULDB



2-68

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 3LFWXUH FRQILJXUDWLRQ 3URMHFW SLFWXBPFS


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 (an industry PC in the form of an operator panel with integrated keyboard -OP47- or a PC in the control room with mouse and standard keyboard) and on the application. A manufacturer 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 a larger base (e.g. 1600x1028, 2000x1500, etc.). WinCC allows you to create pictures with a maximum resolution of 4096 x 4096 pixels. If these dimensions are greater than the maximum resolution of the graphics system being used (video card with monitor), these pictures can be moved round using scroll bars.

WinCC Configuration Manual C79000-G8276-C140-01

3-1

6DPSOH3URMHFWSLFWXB



Assumption
The resolution of the graphics system being used is assumed to be 1024x768 pixels. This resolution corresponds to the recommendations with regard to ergonomics for a graphics system 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, SLFWXBA simpler way to log in is to click /RJLQ in the title bar, click the input field 3DVVZRUG and then to confirm the input.

3-2

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6FUHHQOD\RXWDQGFKDQJLQJSLFWXUHV

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 layout are also used in the other projects.

WinCC Configuration Manual C79000-G8276-C140-01

3-3

6DPSOH3URMHFWSLFWXB



 /D\LQJRXWWKHVFUHHQ

7DVNGHILQLWLRQ

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.

,PSOHPHQWDWLRQFRQFHSW

The screen is set to a resolution of 1024x768 pixels. We will divide the screen into three sections. We will use two different layouts for the three sections.

Layout 1
Overview Area

Plant Representations

Button Area

3-4

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

Layout 2
Logo Overview Area

Button Area

Plant Representations

/D\RXWSULQFLSOH

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 over during runtime as required. This gives us a solution which is very flexible and simple to modify.

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 every picture and buttons which will be displayed depending on the plant picture displayed.

Plant section
In the plant section, we configure the respective plant pictures.

WinCC Configuration Manual C79000-G8276-C140-01

3-5

6DPSOH3URMHFWSLFWXB



 3LFWXUHFKDQJH

In runtime, you access the examples that relate to these topics in our SLFWXB project by the button depicted above. The examples are configured in the pictures SLFWXBBFKDSWHUBSGO and SLFWXBBFKDSWHUBDSGO.

3-6

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 2SHQLQJDSLFWXUHE\PHDQVRIDGLUHFWFRQQHFWLRQDQGGLVSOD\LQJ WKHSLFWXUHQDPH H[DPSOH

7DVNGHILQLWLRQ

The picture in the picture window is to be changed by clicking a EXWWRQ with the mouse; this change is to be executed with the aid of a direct connection.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV , which we click with the to change the picture displayed in the 6PDUW2EMHFWV 3LFWXUH:LQGRZ. We display the picture name in the picture by means of 6WDQGDUG 2EMHFWV6WDWLF7H[W.
%XWWRQ

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIDGLUHFWFRQQHFWLRQDQGGLVSOD\LQJ WKHSLFWXUHQDPH

Create a new picture by selecting)LOH1HZ and then select )LOH6DYHDV to save it under the name SLFWXBBZLQGRZBSGO. Change the picture geometry by setting 3URSHUWLHV*HRPHWU\3LFWXUH:LGWK to  and 3URSHUWLHV *HRPHWU\3LFWXUH+HLJKW to . In picture SLFWXBBZLQGRZBSGO, configure the 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, we use the object called 6WDWLF7H[W. Change 3URSHUWLHV)RQW %ROG to <HV. Under 3URSHUWLHV)RQW7H[W, delete the default text in the 6WDWLF column. This prevents an incorrect text from being output at the moment of picture buildup. Dynamize the object using a &DFWLRQ7KLV&DFWLRQ returns the current picture name as the return value. The trigger we use for the &DFWLRQ is the 6WDQGDUG F\FOHK (low system load, no change).

In picture SLFWXBBZLQGRZBSGO, configure the information to be displayed. In our example, we use 7DQN from the Global Library. The library is opened by choosing 9LHZ/LEUDU\ from the menu or by choosing the toolbar. button on the ,

Make sure that the symbol view function is selected by means of the so that a preview of the individual objects is displayed.

EXWWRQ

WinCC Configuration Manual C79000-G8276-C140-01

3-7

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIDGLUHFWFRQQHFWLRQDQGGLVSOD\LQJ WKHSLFWXUHQDPH

Configure two more pictures by saving the picture you have just configured once again, but this time under the name SLFWXBBZLQGRZBSGO, and then saving this picture under the name SLFWXBBZLQGRZBSGO ()LOH6DYH$V). This gives us two copies of SLFWXBBZLQGRZBSGONow insert the content you want into the new pictures created. Theres no need to change the 6WDWLF7H[W object for displaying the picture name. Configure a new picture by selecting )LOH1HZ. In this picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUHZLQGRZ to the size of the pictures just created by means of 3URSHUWLHV*HRPHWU\:LQGRZ:LGWK and 3URSHUWLHV*HRPHWU\:LQGRZ+HLJKW. In order to display the window with a border during runtime, change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. This sets the picture to be displayed by the 3LFWXUH:LQGRZ object when the picture is opened.

3-8

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIDGLUHFWFRQQHFWLRQDQGGLVSOD\LQJ WKHSLFWXUHQDPH

In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Create a further GLUHFW FRQQHFWLRQ under (YHQWV0RXVH3UHVVOHIW. button to display a Under 6RXUFH, select &RQVWDQW and click the now active selection list of all the pictures available. Select the SLFWXBBZLQGRZBSGO picture and under 7DUJHW, select 2EMHFWLQ3LFWXUH, 3LFWXUH:LQGRZ as the object and 3LFWXUH1DPH as the property. Accept the settings by clicking the 2. button.

WinCC Configuration Manual C79000-G8276-C140-01

3-9

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIDGLUHFWFRQQHFWLRQDQGGLVSOD\LQJ WKHSLFWXUHQDPH

Select the now configured %XWWRQ by clicking it with the and duplicate the object by means of (GLW'XSOLFDWH. Repeat this procedure once more. We now have two more buttons, %XWWRQ and %XWWRQ. Under (YHQWV0RXVH3UHVV OHIW, modify the GLUHFWFRQQHFWLRQ configured. Change the 6RXUFH for %XWWRQ to SLFWXBBZLQGRZBSGO and the 6RXUFH for %XWWRQ to SLFWXBBZLQGRZBSGO.

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 char

pdest = strrchr( lpszPictureName, ch );


//read only picture name without path

if ( 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 the function VWUUFKU. This function searches through OSV]3LFWXUH1DPH. If the picture is displayed in a SLFWXUHZLQGRZ, OSV]3LFWXUH1DPH contains the picture name with the complete path of the picture. In the first case, return OSV]3LFWXUH1DPH directly as the return value.

3-10

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

In the latter case, read only the picture name out of the picture path and return this name as the return value.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The object 6WDWLF7H[W can be transferred directly to any other SLFWXUHZLQGRZ. This object is also suitable for being stored in the project library. In this way, it can quite simply be inserted into any picture by means of drag&drop. The picture name to be displayed and the object name of the SLFWXUHZLQGRZ must be adapted in the GLUHFWFRQQHFWLRQ for %XWWRQ. Pictures, picture contents and SLFWXUHZLQGRZV that are to be displayed must be laid out as you need them. The height and width of the picture and the SLFWXUHZLQGRZ should agree.

WinCC Configuration Manual C79000-G8276-C140-01

3-11

6DPSOH3URMHFWSLFWXB



 2SHQLQJDSLFWXUHE\PHDQVRIWKH'\QDPLF:L]DUG H[DPSOH

7DVNGHILQLWLRQ

The picture in the SLFWXUHZLQGRZ 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.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV


%XWWRQ

, which we click with the 5 to change the picture displayed in the 6PDUW2EMHFWV 3LFWXUH:LQGRZ. We will use the pictures already configured in the previous example.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIWKH'\QDPLF:L]DUG

In a picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUHZLQGRZ to the size of the screen and change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. If the '\QDPLF:L]DUG isnt visible, activate it by selecting 9LHZ7RROEDUV In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. With the object selected, select ' the 3LFWXUH the 3LFWXUH)XQFWLRQV tab from the '\QDPLF:L]DUG and &KDQJHLQWKH:LQGRZ option. In the '\QDPLF:L]DUG on the page entitled 6HOHFW WULJJHU, select 5LJKWPRXVHEXWWRQ and choose 1H[W to close the page. Fill in the 6HWRSWLRQV page as follows:

2 3

3-12

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIWKH'\QDPLF:L]DUG

Click the EXWWRQ to display a list of the pictures available in the project. Close the )LQLVKHG page by clicking )LQLVK. 4 Configure two more buttons under :LQGRZV2EMHFWV%XWWRQ; in our example, we use %XWWRQ and %XWWRQ. Apply the '\QDPLF:L]DUG to these buttons, too. In the 6HWRSWLRQV window, set SLFWXBBZLQGRZBSGO as the GHVWLQDWLRQSLFWXUH QDPH for %XWWRQ and SLFWXBBZLQGRZBSGO 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","Picture Window2", "PictureName",VT_LPSTR,&tmp,NULL,NULL,0,NULL, NULL); }

1RWHVRQJHQHUDOXVH

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.

WinCC Configuration Manual C79000-G8276-C140-01

3-13

6DPSOH3URMHFWSLFWXB



 2SHQLQJDSLFWXUHE\PHDQVRILQWHUQDOIXQFWLRQ H[DPSOH

7DVNGHILQLWLRQ

The picture in the SLFWXUHZLQGRZ 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.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV , which we click with the to change the picture displayed in the 6PDUW2EMHFWV 3LFWXUH:LQGRZ. We will use the pictures from the previous example.
%XWWRQ

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRILQWHUQDOIXQFWLRQ

In a picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUHZLQGRZ to the size of the screen and change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Under (YHQWV0RXVH 3UHVVOHIW, configure the &DFWLRQ for changing picture. Configure two more EXWWRQV; in our example, we use %XWWRQand %XWWRQ, which are equipped with an 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", "Picture Window2","pictu_5_window_00"); }

Using the LQWHUQDOIXQFWLRQ 6HW3LFWXUH1DPH, switch the picture SLFWXBZLQGRZBSGO to the object 3LFWXUH:LQGRZ. SLFWXBBFKDSWHUBSGO is the name of the picture in which the SLFWXUHZLQGRZ is located.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The parameters of the LQWHUQDOIXQFWLRQ6HW3LFWXUH1DPH must be adapted to suit your own needs.

3-14

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6LQJOHSLFWXUHFKDQJHE\PHDQVRIWKH'\QDPLF:L]DUG H[DPSOH

7DVNGHILQLWLRQ

The picture displayed during runtime is to be changed by clicking a EXWWRQ. Configuration is to be implemented using the '\QDPLF:L]DUG.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV


%XWWRQ

, which we click with the

to change the picture displayed during runtime.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVLQJOHSLFWXUHFKDQJHE\PHDQVRIWKH'\QDPLF:L]DUG

In our example, the picture change is from SLFWXBBVWDUWSLFWXUHBSGO to SLFWXBBFKDSWHUBDSGO. In the sample project, picture SLFWXBBVWDUWSLFWXUHBSGO is always selected and only picture changes between windows are performed there. By using the &DFWLRQ generated by the '\QDPLF :L]DUG, the entire picture system displayed during runtime is replaced by the one called. Changing back to SLFWXBBVWDUWSLFWXUHBSGO is like completely restarting the picture project. In the picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ.

With the object selected, select the 3LFWXUH)XQFWLRQV tab from the '\QDPLF ' the 6LQJOHSLFWXUHFKDQJH option. In the '\QDPLF:L]DUG on :L]DUG and the page entitled 6HOHFWWULJJHU, select the /HIWPRXVHEXWWRQ list entry and choose 1H[W to close the page. Fill in the 6HWRSWLRQV page as follows:

Click the EXWWRQ to display a list of 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 the project by clicking the

button.

WinCC Configuration Manual C79000-G8276-C140-01

3-15

6DPSOH3URMHFWSLFWXB



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 VWDQGDUGIXQFWLRQ called 2SHQ3LFWXUH, thus switching the picture SLFWXBBFKDSWHUBDSGO to runtime. The &DFWLRQ generated can itself also be programmed.

1RWHVRQJHQHUDOXVH

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.

3-16

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6LQJOHSLFWXUHFKDQJHE\PHDQVRIDGLUHFWFRQQHFWLRQ H[DPSOH

You access this example in our project SLFWXB by clicking the twoEXWWRQV.

7DVNGHILQLWLRQ

In contrast to the previous examples, clicking a EXWWRQ will in this case lead to the entire picture being changed. This isnt intended to just change the contents of a picture window; a new picture is opened.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, which we click with the to change the picture. The button is configure using a GLUHFWFRQQHFWLRQ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVLQJOHSLFWXUHFKDQJHE\PHDQVRIDGLUHFWFRQQHFWLRQ

1 2

In our example, the picture change is from SLFWXBBFKDSWHUBDSGO to SLFWXBBVWDUWSLFWXUHBSGO. In the picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ.

In the &KDQJH3LFWXUHRQ0RXVH&OLFN section of the %XWWRQ&RQILJXUDWLRQ dialog, select the picture SLFWXBBVWDUWSLFWXUHB by means of the selection window. This automatically leads to the generation of a GLUHFWFRQQHFWLRQ under (YHQWV0RXVH0RXVH$FWLRQ. This connection can also be generated by means of the 2EMHFW3URSHUWLHV dialog box.

WinCC Configuration Manual C79000-G8276-C140-01

3-17

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHVLQJOHSLFWXUHFKDQJHE\PHDQVRIDGLUHFWFRQQHFWLRQ

1RWHVRQJHQHUDOXVH

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 be adapted in the GLUHFWFRQQHFWLRQ for %XWWRQ.

3-18

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 2SHQLQJDSLFWXUHE\PHDQVRIWKHREMHFWQDPHDQGDQLQWHUQDO IXQFWLRQ H[DPSOH

You access this example in our project SLFWXB by clicking the twoEXWWRQV.

7DVNGHILQLWLRQ

The picture in a SLFWXUHZLQGRZ is to be changed by clicking a button. The EXWWRQ is to recognize which picture it is to call by means of its object name, and is consequently only supposed to be reusable for making further copies after its object name is changed.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV , which we click with the to change the picture displayed in the 6PDUW2EMHFWV . 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.
%XWWRQ 3LFWXUH:LQGRZ

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIWKHREMHFWQDPHDQGDQLQWHUQDO IXQFWLRQ

In a picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUHZLQGRZ to match the size of the pictures previously created. In order to display the window with a border during runtime, change 3URSHUWLHV0LVFHOODQHRXV %RUGHU to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Under (YHQWV0RXVH 3UHVVOHIW, configure a &DFWLRQ which reads out the name and number of the EXWWRQ and displays the picture you want in accordance with the agreed name conventions. Duplicate %XWWRQ twice and change the object names to %XWWRQ and %XWWRQ.

WinCC Configuration Manual C79000-G8276-C140-01

3-19

6DPSOH3URMHFWSLFWXB



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 character

pdest = 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. The objects 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 not found. Reading the number out of the button name. The function VWUUFKU searches backward through the name for the character and the character string that follows the Q is picked up and converted into an integer value by the function DWRL. The VSULQWI function uses the two components, namely the picture name to be called and the picture number, to generate the complete picture name to be called up by the EXWWRQ. The LQWHUQDOIXQFWLRQ 6HW3LFWXUH1DPHis then used to switch the picture to be called to the object 3LFWXUH:LQGRZ.

1RWHVRQJHQHUDOXVH

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 in accordance with your own name conventions. Make sure that these name conventions are always strictly observed, both in object names and picture names, in order to guarantee perfect accessing of the picture you want to open.

3-20

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 2SHQLQJDSLFWXUHE\PHDQVRIWKHREMHFWQDPHDQGDWDJ FRQQHFWLRQZLWKGLVSOD\RIWKHSLFWXUHQDPH H[DPSOH

You access this example in our project SLFWXB by clicking the twoEXWWRQV.

7DVNGHILQLWLRQ

The picture in a SLFWXUHZLQGRZ is to be changed by clicking a EXWWRQ. The EXWWRQ is to recognize which picture it is to call by means of its object name, and is consequently only supposed to be reusable for making further copies after its object name is changed. The picture name is to be stored in a text tag and displayed in a text field which isnt in the actual picture.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV , which we click with the to change the picture displayed in the 6PDUW2EMHFWV 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 6WDQGDUG2EMHFWV6WDWLF7H[W to display the picture name.
%XWWRQ

WinCC Configuration Manual C79000-G8276-C140-01

3-21

6DPSOH3URMHFWSLFWXB



,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHRSHQLQJDSLFWXUHE\PHDQVRIWKHREMHFWQDPHDQGDWDJ FRQQHFWLRQZLWKGLVSOD\RIWKHSLFWXUHQDPH

Create a tag of type 7H[WWDJELWFKDUDFWHUVHW with a length of 30 characters in Tag Management. In our example, we use the tag called 7[BVHOHFB. This tag contains the name of the picture displayed in the SLFWXUHZLQGRZ. Call the properties dialog box of the picture object with the name SLFBFKDSWHUBDSGO. Under (YHQWV0LVFHOODQHRXV2SHQ3LFWXUH, configure a &DFWLRQ which assigns the picture name SLFWXBBZLQGRZBSGO to tag 7[BVHOHFB. This corresponds to the picture that is to be displayed the first time a picture is opened. In a picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUHZLQGRZ to match the size of the pictures previously created. In order to display the window with a border during runtime, change 3URSHUWLHV0LVFHOODQHRXV %RUGHU to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select SLFWXBBZLQGRZBSGO and create a WDJFRQQHFWLRQ to tag 7[BVHOHFB. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQB. Under (YHQWV0RXVH 3UHVVOHIW, configure a &DFWLRQ which reads out the name and number of the EXWWRQ and assigns this name to the LQWHUQDOWDJ 7[BVHOHFB. Duplicate %XWWRQB twice and change the object names to %XWWRQB and %XWWRQB. In the picture, configure a static text (6PDUW2EMHFWV6WDWLF7H[W above 3LFWXUH :LQGRZ; in our example, we use the object 6WDWLF7H[W. Change 3URSHUWLHV )RQW%ROG to <HV. Under 3URSHUWLHV)RQW7H[W, delete the default text in the 6WDWLF column and create a WDJFRQQHFWLRQ to tag 7[BVHOHFB. Set updating to take place 8SRQFKDQJH. Deleting the static entry prevents an incorrect text from being output at the moment of picture buildup.

5 6

3-22

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

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

pdest = 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 LQWHUQDOWDJV. Check whether the object has been named in accordance with the agreed guidelines. The objects 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 not found. Reading the number out of the button name. The function VWUUFKU searches backward through the name for the character B and the character string that follows the B is picked up and converted into an integer value by the function DWRL. The VSULQWI function uses the two components, namely the picture name to be called and the picture number, to generate the complete picture name to be called up by the EXWWRQ. The LQWHUQDOIXQFWLRQ 6HW7DJ&KDUis then used to transfer the picture name to be called to tag 7[BVHOHFB.

1RWHVRQJHQHUDOXVH

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 in accordance with your own name conventions. Make sure that these name conventions are always strictly observed, both in object names and picture names, in order to guarantee perfect accessing of a picture you want to open.

WinCC Configuration Manual C79000-G8276-C140-01

3-23

6DPSOH3URMHFWSLFWXB



 6KXWGRZQ:LQ&&DFFHVVSURWHFWLRQ

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

3-24

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6KXWWLQJGRZQ H[LWLQJ UXQWLPHDQGWKHV\VWHP H[DPSOH

7DVNGHILQLWLRQ

Two EXWWRQV are to be used by means of the mouse to select two windows via which either runtime or the complete system is shut down.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, each of which displays a picture in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click it with the . In the individual pictures, two buttons created under :LQGRZV2EMHFWV %XWWRQ are to enable either the corresponding system function to be called or the procedure to be canceled.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKXWWLQJGRZQ H[LWLQJ UXQWLPHDQGWKHV\VWHP

1 2

Configure a picture that is to be used to shut down (exit) runtime; in our example, we use picture SLFWXBBZLQGRZBSGO. In this picture, configure a button under :LQGRZV2EMHFWV%XWWRQ; in our example, we use %XWWRQ.With the object selected, select the 6\VWHP)XQFWLRQV tab from the '\QDPLF:L]DUG and ' the ([LW:LQ&&RU:LQGRZV option. In the '\QDPLF:L]DUG on the page entitled 6HOHFWWULJJHU, select /HIWPRXVHEXWWRQ and 1H[W. On the 6HWRSWLRQV page, select ([LW:LQGRZV. Close the )LQLVKHG page by clicking )LQLVK.

Configure another :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. This is used to cancel the procedure. Under (YHQWV0RXVH 3UHVVOHIW, configure a GLUHFWFRQQHFWLRQ which hides the picture. Configure another picture that is to be used to shut down the system; in our example, we use picture SLFWXBBZLQGRZBSGO. In this picture, configure a :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. With the object selected, select the 6\VWHP)XQFWLRQV tab from the '\QDPLF:L]DUG and ' the ([LW:LQ&&5XQWLPH option. In the '\QDPLF:L]DUG on the page entitled 6HOHFWWULJJHU, select /HIWPRXVHEXWWRQ and 1H[W. Close the )LQLVKHG page by clicking )LQLVK. Configure another :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. This is used to cancel the procedure. Under (YHQWV0RXVH 3UHVVOHIW, configure a GLUHFWFRQQHFWLRQ which hides the picture. In another picture, configure two picture windows under 6PDUW2EMHFWV 3LFWXUH:LQGRZ; in our example, we use the objects 3LFWXUH:LQGRZ and 3LFWXUH:LQGRZ, which, however are tiled. Adjust the size of the SLFWXUH ZLQGRZV to match the size of the pictures just configured. If the SLFWXUHZLQGRZV are to be displayed with borders, :LQGRZ+HLJKW and the :LQGRZ:LGWK of the SLFWXUHZLQGRZV must be set 10 pixels greater than those of the pictures, so that the entire picture can be displayed. Enter the respective picture names under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH. Change 3URSHUWLHV

4 5

WinCC Configuration Manual C79000-G8276-C140-01

3-25

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHVKXWWLQJGRZQ H[LWLQJ UXQWLPHDQGWKHV\VWHP 0LVFHOODQHRXV

'LVSOD\ to 1R.

In the same picture, configure two button objects under :LQGRZV2EMHFWV %XWWRQ. In our example, these are %XWWRQ and %XWWRQ. Configure a GLUHFW FRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. In the same way, create a GLUHFW FRQQHFWLRQ for %XWWRQ, but set the WDUJHW to 2EMHFWLQ3LFWXUH3LFWXUH :LQGRZ'LVSOD\.

1RWHVRQJHQHUDOXVH

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 other projects. The object names in the GLUHFWFRQQHFWLRQV of the SLFWXUHZLQGRZV which make up the EXWWRQV for calling the picture windows must be changed.

3-26

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 $FFHVVSURWHFWLRQORJLQE\PHDQVRIDVWDQGDUGER[ H[DPSOH

7DVNGHILQLWLRQ

A picture should only be able to be changed by means of two EXWWRQV if the user has the appropriate authorization.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, each of which displays a picture in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click it with the . The necessary settings for assigning user authorization are to be made in the 8VHU$GPLQLVWUDWRU editor.

WinCC Configuration Manual C79000-G8276-C140-01

3-27

6DPSOH3URMHFWSLFWXB



,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHDFFHVVSURWHFWLRQORJLQE\PHDQVRIDVWDQGDUGER[

Open the 8VHU$GPLQLVWUDWRUeditor in the &RQWURO&HQWHU using

85

2 3

EXWWRQ to create a new user group and give it a name; in our Click the example, we use the name VHUYLFH.

Under the menu item 7DEOH$GGQHZDXWKRUL]DWLRQOHYHO, define the authorization level &KDQJHSLFWXUH under line 9. This authorization level is assigned to the VHUYLFH group. For this, select the group with . In the table

containing the authorization levels, ' the SLFWXUHFKDQJH line in the (QDEOH column. An authorization level assigned to a group or a user is identified by a red dot in the (QDEOH column.

EXWWRQ and create a new user. With the VHUYLFH user group selected, click the User ZLOOL having the password SLFWXB was used in the example project. The &RS\JURXSVHWWLQJVDOVR check box is selected in order to transfer the authorization levels applicable to the group to the user.

$GPLQLVWUDWRU

editor by choosing )LOH([LW from the menu.

Close the 8VHU

In the &RQWURO&HQWHU, call the 3URMHFWSURSHUWLHV dialog box.

In the window now displayed, select the tab and enter the desired settings for calling the login (Log on) dialog box and for logoff (Log off). In our example, we use the key combination CTRL+O for Log on and CTRL+F for Log off.
+RW.H\V

In a picture, configure two buttons under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the objects called %XWWRQ and %XWWRQ. Configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ, into which

3-28

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHDFFHVVSURWHFWLRQORJLQE\PHDQVRIDVWDQGDUGER[

various pictures are inserted by means of GLUHFWFRQQHFWLRQV linked to the two EXWWRQV. 7 Under 3URSHUWLHV0LVFHOODQHRXV8VHUOHYHO, select the authorization level &KDQJHSLFWXUH for the objects %XWWRQand %XWWRQ and change 3URSHUWLHV 0LVFHOODQHRXV2SHUDWRU&RQWURO(QDEOH to 1R. Selectthe tab labeled 0LVFHOODQHRXV on %XWWRQ for an object selected in the '\QDPLF:L]DUGand ' 2SHUDEOHLIDXWKRUL]HG. Close the '\QDPLF:L]DUG by choosing )LQLVK. Apply the same procedure to %XWWRQ. In tag management, create the system tag #&XUUHQW8VHUof type WH[WWDJELW FKDUDFWHUVHW with a length of 20 characters. This tag is automatically assigned the user name currently logged in. Trigger the &DFWLRQV generated by the '\QDPLF:L]DUG at %XWWRQand %XWWRQ on change of this tag. This means that the &DFWLRQ is no longer processed every two seconds but only when there is a change of user name.

10

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 1 CMN_ERROR err; DWORD pwlevel = 0; pwlevel = (DWORD) GetPasswordLevel(lpszPictureName,lpszObjectName); if (pwlevel==0) return (TRUE); else return(PWRTCheckPermissionOnPicture(pwlevel,lpszPictureName,NO_MESSA GEBOX,&err)); }

1RWHVRQJHQHUDOXVH

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.

WinCC Configuration Manual C79000-G8276-C140-01

3-29

6DPSOH3URMHFWSLFWXB



 2SHUDWRU&RQWURO(QDEOHORJLQLQDVHSDUDWHGLDORJER[ H[DPSOH

7DVNGHILQLWLRQ

Runtime should only be able to be exited by means of a EXWWRQ if the user has the appropriate authorization. A dialog box for logging in is to pop up when a EXWWRQ is clicked.

,PSOHPHQWDWLRQFRQFHSW

For implementation we use two buttons created under :LQGRZV2EMHFWV%XWWRQ; with the first button a picture window, created under 6PDUW2EMHFW3LFWXUH:LQGRZ, is opened for logging on upon clicking

. The second button is to be used to shut down runtime.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHDFFHVVSURWHFWLRQ 2SHUDWRU&RQWURO(QDEOH ORJLQE\PHDQVRI DVHSDUDWHGLDORJER[

In the 8VHU$GPLQLVWUDWRU editor, create a new user group and give it a name; in our example, we use the name XVHU. Under line 10, define a new authorization level with the name 5XQWLPHHQG (= Exit runtime). This authorization level is assigned to the XVHU group. Create a user for the group. User XOULFK having the password SLFWXB was used in the example project. In a picture, configure two buttons under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the objects called %XWWRQ and %XWWRQ. Under object %XWWRQ, configure the call for a picture window created under 6PDUW2EMHFWV3LFWXUH:LQGRZ to be used to exit runtime; in our example, we use 3LFWXUH:LQGRZ Under 3URSHUWLHV0LVFHOODQHRXV8VHUOHYHO, select the authorization level 5XQWLPHHQG for the object %XWWRQ and change 3URSHUWLHV0LVFHOODQHRXV 2SHUDWRU&RQWURO(QDEOH to 1R. At %XWWRQ, apply the '\QDPLF:L]DUG labeled 2SHUDEOHLIDXWKRUL]HG. Set the & DFWLRQ generated to be triggered by the system tag, #&XUUHQW8VHU, to be created in Tag Management. Configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use the object called 3LFWXUH:LQGRZ. Change 3URSHUWLHV *HRPHWU\:LQGRZ:LGWK to  and 3URSHUWLHV*HRPHWU\:LQGRZ +HLJKW to . In the 3URSHUWLHV0LVFHOODQHRXV:LQGRZFKDQJH0RYDEOH, %RUGHU, 7LWOH and )RUHJURXQG to <HV. Under 3URSHUWLHV0LVFHOODQHRXV 3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. This picture can be taken directly from project SLFWXB.

2 3

3-30

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHDFFHVVSURWHFWLRQ 2SHUDWRU&RQWURO(QDEOH ORJLQE\PHDQVRI DVHSDUDWHGLDORJER[

7 8

Under %XWWRQ, configure a GLUHFWFRQQHFWLRQ for displaying the SLFWXUHZLQGRZ just configured. 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 also triggered 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 texts results in 758(, the text /RJRII is returned, otherwise /RJRQ.

1RWHVRQJHQHUDOXVH

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.

WinCC Configuration Manual C79000-G8276-C140-01

3-31

6DPSOH3URMHFWSLFWXB



 6KRZLQJDSLFWXUHZLQGRZ

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

3-32

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6KRZLQJDQGKLGLQJIURPRXWVLGHDSLFWXUHZLQGRZ H[DPSOH

7DVNGHILQLWLRQ

A picture window is to be shown and hidden again by means of two EXWWRQV for clicking.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, to show and hide the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click one of them with the

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKRZLQJDQGKLGLQJIURPRXWVLGHDSLFWXUHZLQGRZ

Configure a picture that is to be shown and hidden, e.g. a help text or an info box. In our example, we use SLFWXBBZLQGRZB, a pure info box without any additional control elements. In another picture, configure a 6PDUW2EMHFWV3LFWXUH:LQGRZ with the same geometric dimensions as the picture created before. 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 during runtime, change 3URSHUWLHV0LVFHOODQHRXV %RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV 0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH 1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure two button objects under :LQGRZV2EMHFWV %XWWRQ. In our example, these are %XWWRQ and %XWWRQ. Configure a GLUHFW FRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button.

WinCC Configuration Manual C79000-G8276-C140-01

3-33

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHVKRZLQJDQGKLGLQJIURPRXWVLGHDSLFWXUHZLQGRZ

In the same way as for %XWWRQ, configure a direct connection for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Enter the value  as the &RQVWDQW.

1RWHVRQJHQHUDOXVH

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 SLFWXUHZLQGRZ must be adapted in the GLUHFWFRQQHFWLRQV for %XWWRQ and %XWWRQ. The picture SLFWXBBZLQGRZB can be integrated directly into another project, where its title and information text are changed.

3-34

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6KRZLQJIURPRXWVLGHDQGKLGLQJIURPLQVLGHDSLFWXUHZLQGRZ H[DPSOH

7DVNGHILQLWLRQ

A picture window is to be shown (displayed) by clicking a EXWWRQ. The picture window is to be hidden by clicking a button inside theSLFWXUHZLQGRZ.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, to show and hide the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click one of them with the

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKRZLQJIURPRXWVLGHDQGKLGLQJIURPLQVLGHWKHSLFWXUHZLQGRZ

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 SLFWXBBZLQGRZB, an info box with an additional button which will be used to hide the picture. In our example, this is %XWWRQ. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the source &RQVWDQW to the target &XUUHQW:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. In another picture, configure a 6PDUW2EMHFWV3LFWXUH:LQGRZ with the same geometric dimensions as the picture created before. 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 during runtime, change 3URSHUWLHV0LVFHOODQHRXV %RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV 0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH 1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW  to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button.

1RWHVRQJHQHUDOXVH

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 SLFWXUHZLQGRZ must be adapted in the GLUHFWFRQQHFWLRQ for %XWWRQ. The picture SLFWXBBZLQGRZB can be integrated directly into another project, where its title and info text are changed. There is no need to make any changes to the GLUHFW FRQQHFWLRQ under %XWWRQ.

WinCC Configuration Manual C79000-G8276-C140-01

3-35

6DPSOH3URMHFWSLFWXB



 7LPHFRQWUROOHGKLGLQJRIDSLFWXUHZLQGRZ H[DPSOH

7DVNGHILQLWLRQ

A SLFWXUHZLQGRZ is to be shown and hidden by clicking a EXWWRQ. This picture window is then to be hidden automatically after a set time.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, to show and hide the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click it with the

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHWLPHFRQWUROOHGKLGLQJRIDSLFWXUHZLQGRZ

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 SLFWXBBZLQGRZB, a pure info box without any additional control elements. To implement time-controlled hiding of the object called *UDSKLF2EMHFW at 3URSHUWLHV*HRPHWU\3RVLWLRQ;, configure a &DFWLRQ. This &DFWLRQ can be positioned anywhere, since only a WULJJHU is required. Set VHFRQG as the trigger.

In another picture, configure a 6PDUW2EMHFWV3LFWXUH:LQGRZ with the same geometric dimensions as the picture created before. 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 during runtime, change 3URSHUWLHV0LVFHOODQHRXV %RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV 0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH 1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In our example, this is %XWWRQ. Under (YHQWV0RXVH3UHVVOHIW, configure a &DFWLRQ for %XWWRQ, which shows and hides the SLFWXUHZLQGRZ.

3-36

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

C action for Graphic Object1


#include "apdefap.h" long _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName) { staticint i = 0;
//count time

i++;
//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 1 second, the SLFWXUHZLQGRZ is hidden. The return value is the X position of *UDSKLF2EMHFW, since the &DFWLRQ is attached to this 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","Picture Window3",(SHORT)!GetVisible("pictu_3_chapter_03.PDL","Picture Window3")); }

The LQWHUQDOIXQFWLRQ 6HW9LVLEOH assigns the inverse of the current state of visibility to the state of visibility of 3LFWXUH:LQGRZ. The current state is queried by the LQWHUQDO IXQFWLRQ *HW9LVLEOH.

1RWHVRQJHQHUDOXVH

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 SLFWXUHZLQGRZ must be adapted in the &DFWLRQ for %XWWRQ. The picture SLFWXBBZLQGRZB can be integrated directly into another project, where its title and info text are changed. The time until the picture is hidden can be defined in the &DFWLRQ under *UDSKLF2EMHFW either by changing the trigger or by changing the condition in the LI statement itself.

WinCC Configuration Manual C79000-G8276-C140-01

3-37

6DPSOH3URMHFWSLFWXB



 6KRZLQJDSLFWXUHZLQGRZZKLOHKROGLQJGRZQWKHULJKWPRXVH EXWWRQ H[DPSOH

7DVNGHILQLWLRQ

A SLFWXUHZLQGRZ is to be shown while the is to be hidden again when the

85

is released.

85

is pressed and held down on a EXWWRQ, and

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV


%XWWRQ, to show the picture in the 6PDUW2EMHFWV3LFWXUH:LQGRZ while the pressed and held down on this button.

R is being

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKRZLQJDSLFWXUHZLQGRZZKLOHKROGLQJGRZQWKHULJKWPRXVH EXWWRQ

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 SLFWXBBZLQGRZB, a pure info box without any additional control elements. In another picture, configure a 6PDUW2EMHFWV3LFWXUH:LQGRZ with the same geometric dimensions as the picture created before. 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 during runtime, change 3URSHUWLHV0LVFHOODQHRXV %RUGHU to <HV. To allow the window to be moved round, change 3URSHUWLHV 0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH 1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure a button under :LQGRZV2EMHFWV%XWWRQ; in our example, this is %XWWRQ. Configure a GLUHFWFRQQHFWLRQIRU %XWWRQ under (YHQWV 0RXVH3UHVVULJKW. Connect the VRXUFH &RQVWDQW to the WDUJHW 2EMHFW LQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. In the same way, configure a GLUHFWFRQQHFWLRQ under (YHQWV0RXVH 5HOHDVHULJKW. Enter the value  as the &RQVWDQW.

1RWHVRQJHQHUDOXVH

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 SLFWXUHZLQGRZ must be adapted in the GLUHFWFRQQHFWLRQV for %XWWRQ. The picture SLFWXBBZLQGRZB can be integrated directly into another project, where its title and information text are changed.

3-38

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &RQILJXULQJLQIR LQVWUXFWLRQ ER[HVZLWKWKHZL]DUG H[DPSOH

You access this example by the EXWWRQ depicted above. The example is configured in the picture named SLFWXBBFKDSWHUBDSGO.

7DVNGHILQLWLRQ

An info (instruction) box is to be shown (pop up) if a tag exceeds the value 100; an emergency box is to be shown if it exceeds 150.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a slider object created under :LQGRZV2EMHFWV 6OLGHU2EMHFW to input the tag value and an I/O field created under 6PDUW2EMHFWV,2 )LHOG to display the tag value.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFRQILJXULQJLQIR LQVWUXFWLRQ ER[HVZLWKWKHZL]DUG

1 2

If the '\QDPLF:L]DUG isnt visible, activate it by selecting 9LHZ7RROEDUV In a picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. With the object selected, select the 3LFWXUH)XQFWLRQV tab from the '\QDPLF:L]DUG and ' the 'LVSOD\ ,QVWUXFWLRQ%R[ option. In the '\QDPLF:L]DUG on the page entitled 6HOHFW 1H[W. Fill in the 6HWRSWLRQV page as WULJJHU, select /HIWPRXVHEXWWRQ and follows:

WinCC Configuration Manual C79000-G8276-C140-01

3-39

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHFRQILJXULQJLQIR LQVWUXFWLRQ ER[HVZLWKWKHZL]DUG

Close the )LQLVKHG page by clicking )LQLVK. 3 Use the '\QDPLF:L]DUG on ,2)LHOG once again. On the page entitled 6HOHFW WULJJHU, select 5LJKWPRXVHEXWWRQ. On the page entitled 6HWRSWLRQV, select the (PHUJHQF\%R[ option and enter the text to be displayed. Create a tag of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tag called 6LBSLFWXBER[HVB. In the same picture, configure an object under :LQGRZV2EMHFWV6OLGHU2EMHFW. in our example, this is 6OLGHU2EMHFW. Create a GLUHFWFRQQHFWLRQ for 6OLGHU 2EMHFW under (YHQWV3URSHUW\7RSLFV0LVFHOODQHRXV3URFHVV'ULYHU &RQQHFWLRQ. Connect the VRXUFH 3URSHUW\6OLGHU2EMHFW3URFHVV'ULYHU &RQQHFWLRQ to the WDUJHW 9DULDEOH6LBSLFWXBER[HVB. Accept the settings by clicking the 2. button. For object ,2)LHOG, create a tag connection to tag 6LBSLFWXBER[HVB under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH and set the trigger to 8SRQFKDQJH.

4 5

3-40

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRQILJXULQJLQIR LQVWUXFWLRQ ER[HVZLWKWKHZL]DUG

For object ,2)LHOG, create a &DFWLRQ under (YHQWV3URSHUW\7RSLFV 2XWSXW,QSXW2XWSXW9DOXH, which displays an info box if tag 6LBSLFWXBER[HVB exceeds a value of 100 and an emergency box if the tag exceeds a value of 150. The &DFWLRQV generated by the '\QDPLF:L]DUG can be copied at (YHQWV0RXVH3UHVVOHIWand 3UHVVULJKW and inserted into this & DFWLRQ. Delete the &DFWLRQV under (YHQWV0RXVH3UHVVOHIWand 3UHVVULJKW.

WinCC Configuration Manual C79000-G8276-C140-01

3-41

6DPSOH3URMHFWSLFWXB



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 box

if

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

if

((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 LQWHUQDOIXQFWLRQ *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 is fallen 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 fallen below, the static &WDJ j has been reset to zero.

1RWHVRQJHQHUDOXVH

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 own needs.

3-42

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6KRZLQJDGLDORJER[IRUHQWHULQJWH[W H[DPSOH

You access this example by the EXWWRQ depicted above. The example is configured in the picture named SLFWXBBFKDSWHUBDSGO.

7DVNGHILQLWLRQ

When aEXWWRQ is clicked with the , a dialog box is to be displayed to enable you to enter a text. The text entered is displayed in the picture.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ to display the dialog box and a static text created under 6WDQGDUG2EMHFWV6WDWLF 7H[W to display the text. An I/O field created under 6PDUW2EMHFWV,2)LHOG is used to enter the text in the dialog box, and two buttons created under :LQGRZV2EMHFWV%XWWRQ are used apply or cancel the input.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKRZLQJDGLDORJER[IRUHQWHULQJWH[W

1 2 3

Create two tags of type 7H[WWDJELWFKDUDFWHUVHW in Tag Management. In our example, we use 7LBSLFWXBZLQB and 7LBSLFWXBZLQB. Configure a picture in which text input is to be carried out. in our example, we use picture SLFWXBBZLQGRZBSGO. In this picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. Under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH, configure a WDJFRQQHFWLRQ to tag 7LBSLFWXBZLQB and set the trigger to 8SRQFKDQJH. Change 3URSHUWLHV 2XWSXW,QSXW'DWD)RUPDW to 6WULQJ and 3URSHUWLHV2XWSXW,QSXW$SSO\ RQ([LW to <HV. This means that the Return key doesnt have to be pressed to accept the text entered. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. This is used to accept (apply) the text entered. Under (YHQWV0RXVH3UHVVOHIW, configure a &DFWLRQ which transfer the contents of tag 7LBSLFWXBZLQB to the tag which contains the text to be displayed, i.e. tag7LBSLFWXBZLQB. Under (YHQWV0RXVH 0RXVH$FWLRQ, configure a GLUHFWFRQQHFWLRQ which hides the picture. Configure another button under :LQGRZV2EMHFWV%XWWRQ; in our example, we use %XWWRQ. This is used to cancel the input; the text previously entered is retained. Configure a &DFWLRQ under (YHQWV0RXVH3UHVVOHIW. This transfers the contents of tag 7LBSLFWXBZLQB (which contains the previous text) to tag7LBSLFWXBZLQB. Under (YHQWV0RXVH0RXVH$FWLRQ, configure a GLUHFWFRQQHFWLRQ which hides the picture. In a second picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUH ZLQGRZ to match the size of the picture just configured. If the picture window is

WinCC Configuration Manual C79000-G8276-C140-01

3-43

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHVKRZLQJDGLDORJER[IRUHQWHULQJWH[W

to be displayed with borders, the :LQGRZ+HLJKW and the :LQGRZ:LGWK of the SLFWXUHZLQGRZ must be set 10 pixels greater than those of the picture. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. 7 In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Create a further GLUHFW FRQQHFWLRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW  to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. In the same picture, configure an object of type 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, this is 6WDWLF7H[W. Under 3URSHUWLHV)RQW7H[W, configure a WDJFRQQHFWLRQ to tag 7LBSLFWXBZLQB and set the trigger to 8SRQFKDQJH.

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 7LBSLFWXBZLQB to tag 7LBSLFWXBZLQB.

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 7LBSLFWXBZLQB to tag 7LBSLFWXBZLQB.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: Picture SLFWXBBZLQGRZBSGO can be used directly for entering text. The &DFWLRQV under the EXWWRQV, however, must be adapted to your own tag names.

3-44

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 =RRP

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

WinCC Configuration Manual C79000-G8276-C140-01

3-45

6DPSOH3URMHFWSLFWXB



 &KDQJLQJSLFWXUHJHRPHWU\EHWZHHQWZRVL]HV H[DPSOH

7DVNGHILQLWLRQ

A SLFWXUHZLQGRZis 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 by means of another EXWWRQ.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, to show and hide the picture displayed in the 6PDUW2EMHFWV3LFWXUH . Two further buttons created under :LQGRZ when we click one of them with the :LQGRZV2EMHFWV%XWWRQ are used to enlarge and reduce the size of the picture.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJSLFWXUHJHRPHWU\EHWZHHQWZRVL]HV

Configure a picture that is to be shown and hidden. In our example, we use the picture with the name SLFWXBBFKDSWHUB (the start picture of picture project SLFWXB . In another picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ; in our example, we use 3LFWXUH:LQGRZ. Change 3URSHUWLHV *HRPHWU\:LQGRZ:LGWK to  and 3URSHUWLHV*HRPHWU\:LQGRZ +HLJKW to . Change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV and 3URSHUWLHV0LVFHOODQHRXV$GDSW3LFWXUH to <HV. In this way, the picture, which has a geometry of 859*698, is adapted to the size of the picture window. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBFKDSWHUB. Change 3URSHUWLHV0LVFHOODQHRXV'LVSOD\ to 1R. In the same picture, configure two more button objects under :LQGRZV2EMHFWV %XWWRQ. In our example, these are %XWWRQ and %XWWRQ. Configure a GLUHFW FRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. Configure two more buttons under :LQGRZV2EMHFWV%XWWRQ. In our example, these are %XWWRQ and %XWWRQ. Under %XWWRQ, select (YHQWV0RXVH3UHVV OHIW and configure a &DFWLRQ which enlarges the SLFWXUHZLQGRZ, then hides %XWWRQ and shows %XWWRQ. Under %XWWRQ, likewise select (YHQWV0RXVH 3UHVVOHIW and configure a &DFWLRQ which reduces the SLFWXUHZLQGRZ, then hides %XWWRQ and shows %XWWRQ. The 3URSHUWLHV0LVFHOODQHRXV'LVSOD\ settings of both EXWWRQV are set to 1R. Create a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH0RXVH$FWLRQ. Connect the VRXUFH &RQVWDQW to the WDUJHW 2EMHFWLQ3LFWXUH%XWWRQ 'LVSOD\. Accept the settings by clicking the 2. button. Under %XWWRQ, select (YHQWV 0RXVH3UHVVOHIW and configure a &DFWLRQ which hides %XWWRQ and %XWWRQ, reduces the size of 3LFWXUH:LQGRZ and then hides the SLFWXUHZLQGRZ.

3-46

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFKDQJLQJSLFWXUHJHRPHWU\EHWZHHQWZRVL]HV

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 theLQWHUQDOIXQFWLRQV 6HW+HLJKW and 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 theLQWHUQDOIXQFWLRQV 6HW+HLJKW and 6HW:LGWK. Show the HQODUJH button (%XWWRQ). Hide the UHGXFH button (%XWWRQ).

WinCC Configuration Manual C79000-G8276-C140-01

3-47

6DPSOH3URMHFWSLFWXB



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 theLQWHUQDOIXQFWLRQV 6HW+HLJKW and 6HW:LGWK. Hide 3LFWXUH:LQGRZ.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The object names in the GLUHFWFRQQHFWLRQV under %XWWRQ must be adapted. The object names and the picture dimensions to be set must be adapted in the &DFWLRQV for %XWWRQ, %XWWRQ and %XWWRQ.

3-48

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &KDQJLQJWKHSLFWXUHJHRPHWU\VWHSOHVVO\ VPRRWK]RRP H[DPSOH

7DVNGHILQLWLRQ

A SLFWXUHZLQGRZ is to be shown and hidden again by means of two EXWWRQV for clicking. In addition, the size of the picture is to be made steplessly adjustable by means of a VOLGHU REMHFW.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, to show and hide the picture displayed in the 6PDUW2EMHFWV3LFWXUH
:LQGRZ 2EMHFWV

when we click one of them with the , and a slider object created under :LQGRZV 6OLGHU2EMHFW, with which we change the size of the picture.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJLQJWKHSLFWXUHJHRPHWU\VWHSOHVVO\
VPRRWK]RRP

1 2

Configure a picture that is to be shown and hidden. In our example, we use the picture named SLFWXBBZLQGRZBSGO, whose width:height ratio is 2:1. In another picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :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 window with a border during runtime, change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV and 3URSHUWLHV0LVFHOODQHRXV$GDSW3LFWXUH to <HV. In this way, the picture is adapted to the size of the SLFWXUHZLQGRZ. Under 3URSHUWLHV 0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. Change 3URSHUWLHV0LVFHOODQHRXV'LVSOD\ to 1R. In the same picture, configure two more button objects under :LQGRZV2EMHFWV %XWWRQ. In our example, these are %XWWRQ and %XWWRQ. Configure a GLUHFW FRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. In the same way, configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV 0RXVH3UHVVOHIW. Enter the value  as the &RQVWDQW. Create a tag of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use the tag called 8LBSLFWXB]RRPB. Configure a slider object under :LQGRZV2EMHFWV6OLGHU2EMHFW; in our example, this is 6OLGHU2EMHFW. Change 3URSHUWLHV0LVFHOODQHRXV 0D[LPXP9DOXH to . Change 3URSHUWLHV0LVFHOODQHRXV3URFHVV 'ULYHU&RQQHFWLRQ to . Create a GLUHFWFRQQHFWLRQ under (YHQWV3URSHUW\ 7RSLFV0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ. Connect the VRXUFH 3URSHUW\WKLVREMHFW3URFHVV'ULYHU&RQQHFWLRQ to the WDUJHW9DULDEOH 8LBSLFWXB]RRPB. Accept the settings by clicking the 2. button.

4 5 6

WinCC Configuration Manual C79000-G8276-C140-01

3-49

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHFKDQJLQJWKHSLFWXUHJHRPHWU\VWHSOHVVO\
VPRRWK]RRP

Create a G\QDPLFGLDORJ for 3LFWXUH:LQGRZ under 3URSHUWLHV*HRPHWU\


:LQGRZ+HLJKW

. Click

7DJ

and select 8LBSLFWXB]RRPB. Click the

button and confirm tag 8LBSLFWXB]RRPB as the trigger name in the dialog box. Select 8SRQFKDQJH as the standard cycle and confirm by clicking 2.. In the 'DWD7\SH field, select 'LUHFW and close the '\QDPLF'LDORJ by clicking $SSO\.
&KDQJHWULJJHU

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 value assigned to the window height will be twice that of the window width. 9 In picture object SLFWXBBFKDSWHUB, configure a &DFWLRQunder (YHQWV 0LVFHOODQHRXV2SHQ3LFWXUH, which sets tag 8LBSLFWXB]RRPB to  when the picture is opened. Without this initialization, the value of the tag would remain 0 until the object 6OLGHU2EMHFW is operated for the first time. If the %XWWRQ object were operated, 3LFWXUH:LQGRZ with the dimensions 0x0 would be 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 8LBSLFWXB]RRPB to .

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tag name in the GLUHFWFRQQHFWLRQ under 6OLGHU2EMHFW must be adapted. The tag names in the G\QDPLFGLDORJV under 3LFWXUH:LQGRZ must be adapted. The multiplier must be adapted to the width:height ratio used.

3-50

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &RQILJXULQJDGMXVWDEOHSLFWXUHJHRPHWU\E\PHDQVRIWKHSURSHUWLHV GLDORJ H[DPSOH

7DVNGHILQLWLRQ

A SLFWXUHZLQGRZ is to be able to be dragged to any size using the mouse. In addition, the picture is to be able to be moved to any position on the screen. It can be maximized and hidden by clicking a EXWWRQ.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two buttons created under :LQGRZV2EMHFWV %XWWRQ, to show and hide the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click one of them with the the properties dialog box.

. The necessary picture properties are configured in

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFRQILJXULQJDGMXVWDEOHSLFWXUHJHRPHWU\E\PHDQVRIWKH SURSHUWLHVGLDORJ

Configure a picture that is to be shown and hidden. In our example, we use the picture with the name SLFWXBBFKDSWHUB (the start picture of picture project SLFWXB . In another picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ; in our example, we use 3LFWXUH:LQGRZ. Change 3URSHUWLHV *HRPHWU\:LQGRZ:LGWK to  and 3URSHUWLHV*HRPHWU\:LQGRZ +HLJKW to . Under 3URSHUWLHV0LVFHOODQHRXV, change the attributes 6L]HDEOH, 0RYDEOH, %RUGHU, 7LWOH, &DQ%H0D[LPL]HG, $GDSW3LFWXUH and &DQ%H &ORVHG to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select SLFWXBBFKDSWHUB. Change 3URSHUWLHV0LVFHOODQHRXV'LVSOD\ to 1R. In the same picture, configure two buttons under :LQGRZV2EMHFWV%XWWRQ. In our example, these are %XWWRQ and %XWWRQ. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. In the same way, configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV 0RXVH3UHVVOHIW. However, enter the value  as the &RQVWDQW.

1RWHVRQJHQHUDOXVH

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 SLFWXUHZLQGRZ must be adapted in the GLUHFWFRQQHFWLRQV for %XWWRQ and %XWWRQ. The picture shown in 3LFWXUH:LQGRZ must be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

3-51

6DPSOH3URMHFWSLFWXB



 2SHUDWRUSDQHOV

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

3-52

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 %LQDU\VZLWFKLQJRSHUDWLRQ WZRVWHSFRQWURO H[DPSOH

7DVNGHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is to contain a EXWWRQ which can be used to turn a valve on and off, and the panel itself is to be closed by clicking another EXWWRQ.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, to show the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click the button with the , and two more EXWWRQV which are used in the operator panel for performing the switching operation and for closing the panel.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHELQDU\VZLWFKLQJRSHUDWLRQ WZRVWHSFRQWURO

1 2

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. Configure a picture with two buttons created under :LQGRZV2EMHFWV%XWWRQ. In our example, we use picture SLFWXBBZLQGRZB with %XWWRQ and %XWWRQ. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW &XUUHQW:LQGRZ'LVSOD\ Accept the settings by clicking the 2. button.

3 4

Under the second EXWWRQ, in our example %XWWRQ, configure a &DFWLRQ which reverses the status of the binary tag %,1LBSLFWXBLQSXWB. In another picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ; in our example, we use 3LFWXUH:LQGRZ. Change 3URSHUWLHV *HRPHWU\:LQGRZ:LGWK to  and 3URSHUWLHV*HRPHWU\:LQGRZ

WinCC Configuration Manual C79000-G8276-C140-01

3-53

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHELQDU\VZLWFKLQJRSHUDWLRQ WZRVWHSFRQWURO +HLJKW to . In order to display the window with a border and make it movable during runtime, change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV and 3URSHUWLHV0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV 0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZB. Change 3URSHUWLHV0LVFHOODQHRXV0LVFHOODQHRXV to 1R.

In the picture, configure a button under :LQGRZV2EMHFWV%XWWRQ. In our example, this is %XWWRQ in picture SLFWXBBFKDSWHUB. Configure a GLUHFW FRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH: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 usingLQWHUQDOIXQFWLRQ *HW7DJ%LW, negate it and reset it using LQWHUQDOIXQFWLRQ 6HW7DJ%LW.

1RWHVRQJHQHUDOXVH

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 GLUHFW FRQQHFWLRQ for %XWWRQ. The tag name in the &DFWLRQ under %XWWRQ in the operator panel must be adapted.

3-54

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 %LQDU\65VZLWFKLQJRSHUDWLRQ WZRVWHSFRQWURO H[DPSOH

7DVNGHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is to contain one EXWWRQ for turning a valve on and a second EXWWRQ for turning the same valve off again. The panel itself is to be closed by clicking another EXWWRQ in the panel.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, to show the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click the button with the , and three more EXWWRQV which are used in the operator panel for performing the switching operation and for closing the panel.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHELQDU\65VZLWFKLQJRSHUDWLRQ WZRVWHSFRQWURO

1 2

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. Configure a picture with three buttons created under :LQGRZV2EMHFWV%XWWRQ. In our example, we use picture SLFWXBBZLQGRZB with %XWWRQ, %XWWRQ and %XWWRQ. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH 3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW &XUUHQW:LQGRZ
'LVSOD\

Accept the settings by clicking the 2. button. 3 Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW 9DULDEOH%,1LBSLFWXBLQSXWB. Accept the settings by clicking the 2. button. In the same way, configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV 0RXVH3UHVVOHIW. Enter the value  as the &RQVWDQW. In another picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :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 movable during runtime, change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV and 3URSHUWLHV0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV 0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZB. In a picture, configure a :LQGRZV2EMHFWV%XWWRQ. In our example, this is %XWWRQ in picture SLFWXBBFKDSWHUB. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button.

4 5

WinCC Configuration Manual C79000-G8276-C140-01

3-55

6DPSOH3URMHFWSLFWXB



1RWHVRQJHQHUDOXVH

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 GLUHFW FRQQHFWLRQ for %XWWRQ. The tag names in the GLUHFWFRQQHFWLRQV under %XWWRQ and %XWWRQ in the operator panel must be adapted.

3-56

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 %LQDU\VZLWFKLQJRSHUDWLRQZLWKDFNQRZOHGJHPHQW H[DPSOH

7DVNGHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is to contain a EXWWRQ which can be used to turn a valve on and off. Actual switching operation is only to take effect when a separate 2. button is clicked, which at the same time closes the operator panel.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, to show the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click the button with the , and two more EXWWRQVwhich are used in the operator panel for performing the switching operation and for closing the panel.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHELQDU\VZLWFKLQJRSHUDWLRQZLWKDFNQRZOHGJHPHQW

Create two tags of type %LQDU\WDJ in Tag Management. In our example, we use %,1LBSLFWXBLQSXWB and %,1LBSLFWXBLQSXWB. %,1LBSLFWXBLQSXWB is to contain the current state of the valve, %,1LBSLFWXBLQSXWBis to act as a buffer memory for the switching operation before acknowledgement. Configure a picture with two buttons created under :LQGRZV2EMHFWV%XWWRQ. In our example, we use picture SLFWXBBZLQGRZB with %XWWRQ and %XWWRQ. Create a GLUHFWFRQQHFWLRQIRU%XWWRQ under (YHQWV0RXVH$FWLRQ. Connect the VRXUFH &RQVWDQW to the WDUJHW &XUUHQW:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. Under (YHQWV0RXVH3UHVVOHIW, configure another GLUHFWFRQQHFWLRQ. Connect the VRXUFH%,1LBSLFWXBLQSXWB to the WDUJHW %,1LBSLFWXBLQSXWB. Accept the settings by clicking the 2. button. Under the second button, in our example %XWWRQ, configure a &DFWLRQ which reverses the status of the binary tag %,1LBSLFWXBLQSXWB. In another picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :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 movable during runtime, change 3URSHUWLHV0LVFHOODQHRXV%RUGHU to <HV and 3URSHUWLHV0LVFHOODQHRXV0RYDEOH to <HV. Under 3URSHUWLHV 0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZB. In a picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, this is %XWWRQ in picture SLFWXBBFKDSWHUB. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW 2EMHFWLQ3LFWXUH3LFWXUH :LQGRZ'LVSOD\. Accept the settings by clicking the 2. button.

3 4

WinCC Configuration Manual C79000-G8276-C140-01

3-57

6DPSOH3URMHFWSLFWXB



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 LQWHUQDOIXQFWLRQ *HW7DJ%LW, negate it and reset it using LQWHUQDOIXQFWLRQ 6HW7DJ%LW.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The object name of the SLFWXUHZLQGRZ to be opened must be adapted in the GLUHFW FRQQHFWLRQ for %XWWRQ. The tag names in the GLUHFWFRQQHFWLRQV under %XWWRQ in the operator panel must be adapted. The tag name in the &DFWLRQ under %XWWRQ in the operator panel must be adapted.

3-58

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 $XWRPDWLFLQSXWFKHFN H[DPSOH

You access this example in our SLFWXB project by the button depicted above. The example is configured in the picture named SLFWXBBFKDSWHUBDSGO.
7DVNGHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is to be 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 the maximum fill level of the container or not.
,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, to show the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click it with the . Furthermore, we use three buttons created under :LQGRZV2EMHFWV , to turn the valve on and off and to closed the operator panel. An I/O field created under 6PDUW2EMHFWV,2)LHOG is used to enter the fill level.
%XWWRQ

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHDXWRPDWLFLQSXWFKHFN

1 2

In Tag Management, create a tag of type %LQDU\WDJ, which contains the current state of the valve. in our example, we use %,1LBSLFWXBLQSXWB. Create two tags of type 8QVLJQHGELWYDOXH. In our example, these are 8LBSLFWXBLQSXWB and 8LBSLFWXBLQSXWB. The first of these two tags contains the set value for the container fill level, the second the actual value. Configure a picture with three buttons created under :LQGRZV2EMHFWV%XWWRQ and one I/O field created under 6PDUW2EMHFWV,2)LHOG. In our example, we use %XWWRQ, %XWWRQ and %XWWRQ and the object ,2)LHOG The picture we use is SLFWXBBZLQGRZBSGO. For object ,2)LHOG, create a WDJFRQQHFWLRQ to tag 8LBSLFWXBLQSXWB under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH and set the trigger to 8SRQFKDQJH. We assume the container has a maximum fill level of 40 liters. The,2ILHOG must therefore only accept inputs between 0 and 40. To set these limits, set 3URSHUWLHV /LPLWV/RZ/LPLW9DOXHWR and 3URSHUWLHV/LPLWV+LJK/LPLW9DOXH WR. For object %XWWRQ, configure a GLUHFWFRQQHFWLRQ under (YHQWV0RXVH 3UHVVOHIW, which hides the picture. For object %XWWRQ, configure a GLUHFWFRQQHFWLRQ under (YHQWV0RXVH 3UHVVOHIW, which assigns the value  to tag %,1LBSLFWXBLQSXWB. Under %XWWRQ, configure a GLUHFWFRQQHFWLRQ which assigns the value  to the tag. In a second picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUH ZLQGRZ to match the size of the picture just configured. If the SLFWXUHZLQGRZ is to be displayed with borders, the :LQGRZ+HLJKW and the :LQGRZ:LGWK of the SLFWXUHZLQGRZ must be set 10 pixels greater than those of the picture. Under

4 5

6 7

WinCC Configuration Manual C79000-G8276-C140-01

3-59

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHDXWRPDWLFLQSXWFKHFN

10

11

0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name . In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Create a further GLUHFW FRQQHFWLRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW  to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button. 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 3URSHUWLHV7DJ$VVLJQPHQW)LOO/HYHO, configure a WDJFRQQHFWLRQ to tag 8LBSLFWXBLQSXWB. As a second method of displaying the fill level, configure an I/O field under 6PDUW2EMHFWV,2)LHOG; in our example, this is ,2)LHOG
3URSHUWLHV SLFWXBBZLQGRZBSGO

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 }//if return(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 the valve. Set the tag which contains the actual value. The return value is the width of the object.
1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tag names and the limits of the ,2ILHOG in picture SLFWXBBZLQGRZB must be adapted to suit your own needs.

3-60

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 (QKDQFHGDXWRPDWLFLQSXWFKHFN H[DPSOH

You access this example in our SLFWXB project by the EXWWRQ depicted above. The example is configured in the picture named SLFWXBBFKDSWHUBDSGO.

7DVNGHILQLWLRQ

An operator panel is to be shown (displayed) by clicking a EXWWRQ. This operator panel is to be used to fill a container with two liquids in a specific ratio. The sum of the two values entered is to be checked automatically to determine whether it exceeds the maximum fill level of the container.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a button created under :LQGRZV2EMHFWV %XWWRQ, to show the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click it with the . The amounts of liquid to be filled into the container are entered by means of three I/O fields created under 6PDUW2EMHFWV,2)LHOG. In addition, we use two buttons created under :LQGRZV2EMHFWV%XWWRQ, one to apply the settings in the,2 ILHOGV, the other to cancel the inputs and close the operator panel.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHHQKDQFHGDXWRPDWLFLQSXWFKHFN

In Tag Management, create two tags of type %LQDU\WDJ, which contain the current states of the valves via which the container is filled. In our example, we use %,1LBSLFWXBLQSXWB and %,1LBSLFWXBLQSXWB Create four tags of type 8QVLJQHGELWYDOXH; in our example, these are 8LBSLFWXBLQSXWB, 8LBSLFWXBLQSXWB, 8LBSLFWXBLQSXWB, and 8LBSLFWXBLQSXWB. The first two contain the set values for the container fill levels, the last two the actual values. Create two tags of type 8QVLJQHGELWYDOXH. In our example, these are 8LBSLFWXBLQSXWB and 8LBSLFWXBLQSXWB. These contain the values entered in the ,2ILHOGV. Configure a picture with two buttons created under :LQGRZV2EMHFWV%XWWRQ and three I/O fields created under 6PDUW2EMHFWV,2)LHOG. In our example, we use %XWWRQ and %XWWRQ and ,2)LHOG, ,2)LHOG, and ,2)LHOG. The picture we use is SLFWXBBZLQGRZBSGO. For ,2)LHOG, create a WDJFRQQHFWLRQ to tag 8LBSLFWXBLQSXWB under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH and set the trigger to 8SRQFKDQJH. For ,2)LHOG, create a WDJFRQQHFWLRQ to tag 8LBSLFWXBLQSXWB. For ,2)LHOG, configure a dynamic dialog under 3URSHUWLHV2XWSXW,QSXW 2XWSXW9DOXH. Enter the settings shown in the figure below. Set the trigger to Upon change.

WinCC Configuration Manual C79000-G8276-C140-01

3-61

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHHQKDQFHGDXWRPDWLFLQSXWFKHFN

7 8

For %XWWRQ, configure a GLUHFWFRQQHFWLRQ under (YHQWV0RXVH3UHVVOHIW, which hides the picture. For %XWWRQ, configure a &DFWLRQ under (YHQWV0RXVH3UHVVOHIW, which assigns the contents of input tags 8LBSLFWXBLQSXWB and 8LBSLFWXBLQSXWB to set value tags 8LBSLFWXBLQSXWB and 8LBSLFWXBLQSXWB. Under (YHQWV 0RXVH0RXVH$FWLRQ, configure a GLUHFWFRQQHFWLRQ which closes the picture. In the same picture, configure two objects of type 6WDQGDUG2EMHFWV6WDWLF 7H[W. In our example, we use 6WDWLF7H[W and 6WDWLF7H[W. These are used to display whether the maximum fill level is exceeded or not. Under 6WDWLF7H[W, which contains the error message, change 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\ to 1R.
2XWSXW,QSXW

10

For ,2)LHOG, create a &DFWLRQ under (YHQWV3URSHUW\7RSLFV 2XWSXW9DOXH, which makes %XWWRQ operable only if the maximum fill level is not exceeded and displays the error text if the maximum fill level is exceeded.

11

In a second picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUH ZLQGRZ to match the size of the picture just configured. Under 3URSHUWLHV 0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure a button object under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Create a further GLUHFW FRQQHFWLRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW  to theWDUJHW 2EMHFWLQ3LFWXUH3LFWXUH:LQGRZ'LVSOD\. Accept the settings by clicking the 2. button.
&DFWLRQ

12

13

Select the 7DQN object from the library and use it display the fill level. Create a under 3URSHUWLHV*HRPHWU\:LGWK and under 3URSHUWLHV

3-62

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHHQKDQFHGDXWRPDWLFLQSXWFKHFN

14

+HLJKW to simulate the filling process. Under 3URSHUWLHV7DJ )LOO/HYHO, create a G\QDPLFGLDORJ which returns the sum of the two actual value tags 8LBSLFWXBLQSXWB and 8LBSLFWXBLQSXWB as the return value. As a second method of displaying the fill level, configure an I/O field under 6PDUW2EMHFWV,2)LHOG; in our example, this is ,2)LHOG
*HRPHWU\ $VVLJQPHQW

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 ,2ILHOGV. If the value entered exceeds the current set value, it is transferred to the set value and the valve is turned on.

WinCC Configuration Manual C79000-G8276-C140-01

3-63

6DPSOH3URMHFWSLFWXB



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,2ILHOGV. If the sum of the value entered exceeds the maximum fill level of the container, %XWWRQ is made inoperable and 6WDWLF7H[W, which contains the error message, is displayed.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The tag names and the limits of the,2ILHOG in picture SLFWXBBZLQGRZB must be adapted to suit your own needs.

3-64

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 0XOWLSOHRSHUDWLRQ H[DPSOH

You access this example in our SLFWXB project by the EXWWRQ depicted above. The example is configured in the picture named SLFWXBBFKDSWHUBESGO.

7DVNGHILQLWLRQ

One operator panel is to be able to be displayed by clicking several different EXWWRQV. If the SLFWXUHZLQGRZ is opened by clicking a EXWWRQ, it can be used to control a valve assigned to the respective EXWWRQ. The operator window is as a rule displayed next to the EXWWRQ used to call the window. It can, however, also be anchored at any position.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use buttons created under :LQGRZV2EMHFWV%XWWRQ, to show the picture displayed in the 6PDUW2EMHFWV3LFWXUH:LQGRZ when we click them with the . The valve is controlled by means of two buttons created under :LQGRZV %XWWRQ; another EXWWRQ is used to close the window. The name of the valve and the valve state are displayed by means of two static texts created under 6WDQGDUG2EMHFWV 6WDWLF7H[W. The picture is anchored by means of a status display created under 6PDUW 2EMHFWV6WDWXV'LVSOD\.
2EMHFWV

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHPXOWLSOHRSHUDWLRQ

In Tag Management, create tags of type %LQDU\WDJ, which contain the current states of the valves. The number of tags required depends on the number of valves. In our example, we use tags %,1LBSLFWXBPXOWLB, %,1LBSLFWXBPXOWLB, %,1LBSLFWXBPXOWLB, and %,1LBSLFWXBLQSXWB. Create a tag of type 7H[WWDJELWFKDUDFWHUVHW with a length of 20 characters. In our example, this is 7[BSLFWXBLQSXWB. This will be used as an address tag. Create a tag of type %LQDU\WDJ. In our example, this is %,1LBSLFWXBPXOWLB. The contents of this tag inform us whether the window has been anchored. Configure a picture with three buttons created under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the objects %XWWRQ, %XWWRQ, and %XWWRQ The picture we use is SLFWXBBZLQGRZBSGO. For %XWWRQ, configure a &DFWLRQ under (YHQWV0RXVH3UHVVOHIW, which sets the position of the picture outside the visible area, closes the picture and cancels the anchoring of the picture. Configure a GLUHFWFRQQHFWLRQ for %XWWRQ under (YHQWV0RXVH3UHVVOHIW. Connect the VRXUFH &RQVWDQW to the WDUJHW9DULDEOH7[BSLFWXBLQSXWB. Select the LQGLUHFW option. Accept the settings by clicking the 2. button. In this way, you have carried out indirect addressing. In the same way, create a GLUHFW FRQQHFWLRQ under %XWWRQ with the VRXUFH &RQVWDQW. Create a status display under 6PDUW2EMHFWV6WDWXV'LVSOD\. In our example, we use 6WDWXV'LVSOD\. Under &RQILJXUDWLRQ'LDORJ, select tag

2 3 4

WinCC Configuration Manual C79000-G8276-C140-01

3-65

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHPXOWLSOHRSHUDWLRQ

and set the trigger in the 8SGDWH list box to 8SRQFKDQJH. Click the $GG button to add another state. For state , select picture SXWBXSEPS, and for state , picture SXWBGRZQEPS.
%,1LBSLFWXBPXOWLB

8 9

For 6WDWXV'LVSOD\FUHDWHD&DFWLRQ under (YHQWV0RXVH3UHVVOHIW, which negates the state of tag %,1LBSLFWXBPXOWLB. Configure an object of type 6WDQGDUG2EMHFWV6WDWLF7H[W as the title. In our example, we use the object called 6WDWLF7H[W. Create a &DFWLRQ under 3URSHUWLHV)RQW7H[W, which reads the current valve number out of the address tag 7[BSLFWXBLQSXWB and returns an appropriate text as the return value. Configure another object under 6WDQGDUG2EMHFWV6WDWLF7H[W to display the valve state. In our example, we use the object called 6WDWLF7H[W. Create a& DFWLRQ under 3URSHUWLHV)RQW7H[W, which reads the state of the valve in question and returns an appropriate text as the return value. Under 3URSHUWLHV &RORUV)RQW&RORU, create a &DFWLRQ which controls the font color in accordance with the state of the valve. In a second picture, configure a picture window under 6PDUW2EMHFWV3LFWXUH :LQGRZ. In our example, we use 3LFWXUH:LQGRZ. Adjust the size of the SLFWXUH ZLQGRZ to match the size of the picture just configured. In the 3URSHUWLHV 0LVFHOODQHRXV window, change the attributes 0RYDEOH and %RUGHU to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. In the same picture, configure a button under :LQGRZV2EMHFWV%XWWRQ for each 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 the EXWWRQ and assigns the corresponding tag name to the address tag. Depending on whether the picture is anchored or not, the picture is either positioned on the right next to the button that calls it or not.

10

11

12

3-66

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

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_0 0")); }

Negate the state tag for picture anchoring.

WinCC Configuration Manual C79000-G8276-C140-01

3-67

6DPSOH3URMHFWSLFWXB



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 n

pdest = strrchr( lpszObjectName, ch ); if ( pdest == NULL )(printf("ObjectNameError"));


//read object number

else { 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 position

y=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 SLFWXUHZLQGRZ. If the SLFWXUHZLQGRZ is not anchored, determine the position of theEXWWRQand set the position of the picture to the right next to the EXWWRQ. When its position is changed, the SLFWXUHZLQGRZ is set outside the visible area, in order to prevent it from being briefly displayed in the picture after the first change of position.

1RWHVRQJHQHUDOXVH

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 the name conventions. The button number must be able to be uniquely assigned to the tag number to be switched.

3-68

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 '\QDPLFV

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

WinCC Configuration Manual C79000-G8276-C140-01

3-69

6DPSOH3URMHFWSLFWXB



 &RORUFKDQJH H[DPSOH

7DVNGHILQLWLRQ

The color of a text is to change through various colors depending on the value of a tag.

,PSOHPHQWDWLRQFRQFHSW

We implement this by means of a slider object created under :LQGRZV2EMHFWV6OLGHU 2EMHFW, which we use to change the value in a tag. The text is displayed by means of 6WDQGDUG2EMHFWV6WDWLF7H[W.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFRORUFKDQJH

1 2

Create a tag of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tag called 6LBSLFWXBG\QB. Configure a slider object under :LQGRZV2EMHFWV6OLGHU2EMHFW; In our example, we use the object called 6OLGHU2EMHFW. Under 3URSHUWLHV 0LVFHOODQHRXV, set the 0D[LPXP9DOXH to  and the 0LQLPXP9DOXH to . Under (YHQWV3URSHUW\7RSLFV0LVFHOODQHRXV3URFHVV'ULYHU &RQQHFWLRQ, create a GLUHFWFRQQHFWLRQ to tag 6LBSLFWXBG\QB. Configure an object of type 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, we use the object called 6WDWLF7H[W. Under 3URSHUWLHV)RQW7H[W, create a & DFWLRQ which outputs a text with the corresponding tag value. and set the trigger to 8SRQFKDQJH. Create a G\QDPLFGLDORJ under 3URSHUWLHV&RORUV)RQW&RORU. In the ([SUHVVLRQ)RUPXOD field, set tag 6LBSLFWXBG\QB and set the trigger to 8SRQ FKDQJH. In the 'DWD7\SH field, select $QDORJ and add 4 value ranges by means of the $GG button. Set the value ranges as follows.

Create a G\QDPLFGLDORJ under 3URSHUWLHV)ODVKLQJ)ODVKLQJ%DFNJURXQG $FWLYH. In the ([SUHVVLRQ)RUPXOD field, set tag 6LBSLFWXBG\QB and set the trigger to 8SRQFKDQJH. In the 'DWD7\SH field, select $QDORJ and add a value range by means of the $GG button. Set the value ranges as follows.

3-70

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRORUFKDQJH

C action for Static Text


#include "apdefap.h" char *_main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName) { char text[100]; DWORD temp;
//get tag value

temp = GetTagDWord("S32i_pictu_dyn_00");
//generate text

switch (GetTagDWord("@CurrentLanguage")) { case 0x407: sprintf(text,"The boiler temperature is \r\n%d degrees",temp); return text; case 0x409: sprintf(text,"Container Temperature is\r\n%d degree",temp); return text; case 0x40C: sprintf(text,"La temprature de chaudire 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 value component using the VSULQWI function. It is performed independently of the current runtime language. The return value is the generated text.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The value ranges and tag used in the G\QDPLFGLDORJV must be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

3-71

6DPSOH3URMHFWSLFWXB



 7H[WH[FKDQJH H[DPSOH

7DVNGHILQLWLRQ

The texts attached to different objects are to be changed automatically depending on the state of a tag. The tool tip text is likewise to be changed.

,PSOHPHQWDWLRQFRQFHSW

button created under :LQGRZV2EMHFWV%XWWRQ, to turn a valve on and off. A static text created under 6WDQGDUG2EMHFWV6WDWLF7H[W displays whether the valve is on or off.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHWH[WH[FKDQJH

1 2

Create a tag of type %LQDU\WDJ in Tag Management. In our example, we use the tag called %,1LBSLFWXBG\QB. Configure a button under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Under (YHQWV0RXVH3UHVVOHIW, generate a &DFWLRQ which negates the status of the %,1LBSLFWXBG\QB tag. Create a G\QDPLFGLDORJ under 3URSHUWLHV0LVFHOODQHRXV7RROWLS7H[W. In the ([SUHVVLRQ)RUPXOD field, set tag %,1LBSLFWXBG\QB and set the trigger to 8SRQFKDQJH. In the 'DWD7\SH field, select the %RRO option. In the 7RROWLS7H[W column, enter the text FORVH next to the valid range <HV758( and the text RSHQ next to 1R)$/6(. Configure an object of type 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, we use the object called 6WDWLF7H[W. Create a G\QDPLFGLDORJ under 3URSHUWLHV )RQW7H[W. In the ([SUHVVLRQ)RUPXOD field, set tag %,1LBSLFWXBG\QB and set the trigger to 8SRQFKDQJH. In the 'DWD7\SH field, select the %RRO option. In the 7RROWLS7H[W column, enter the text RSHQ next to the valid range <HV758( and the text FORVH next to 1R)$/6(.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The texts and tag used in the G\QDPLFGLDORJV must be adapted to suit your own needs.

3-72

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 $QLPDWLRQRIPRYHPHQW H[DPSOH

7DVNGHILQLWLRQ

An object is to be moved to a specific position on the screen depending on a tag value.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a picture window created under 6PDUW2EMHFWV 3LFWXUH:LQGRZ, whose position we control by means of a tag. We change the value in the tag by means of a slider object created under :LQGRZV2EMHFWV6OLGHU2EMHFW.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHDQLPDWLRQRIPRYHPHQW

1 2

Create a tag of type 6LJQHGELWYDOXH in Tag Management. In our example, we use the tag called 6LBSLFWXBG\QB. Configure a slider object under :LQGRZV2EMHFWV6OLGHU2EMHFW; in our example, we use 6OLGHU2EMHFW. Under 3URSHUWLHV0LVFHOODQHRXV, set the 0D[LPXP9DOXH to  and the 0LQLPXP9DOXH to . Under (YHQWV3URSHUW\ 7RSLFV0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ, create a GLUHFW FRQQHFWLRQ to tag 6LBSLFWXBG\QB. Configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, we use the object called 3LFWXUH:LQGRZ. Under 3URSHUWLHV 0LVFHOODQHRXV, change the attributes %RUGHU and $GDSW3LFWXUH to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBFKDSWHUB. Create a G\QDPLFGLDORJ under 3URSHUWLHV*HRPHWU\3RVLWLRQ;. In the ([SUHVVLRQ)RUPXOD field, set the expression 6LBSLFWXBG\QB   . Set the trigger to 8SRQFKDQJH of tag 6LBSLFWXBG\QB. In the 'DWD7\SH field, select the 'LUHFW option. Create a G\QDPLFGLDORJ under 3URSHUWLHV*HRPHWU\3RVLWLRQ<. In the ([SUHVVLRQ)RUPXOD field, set the expression 6LBSLFWXBG\QB . Set the trigger to 8SRQFKDQJH of tag 6LBSLFWXBG\QB. In the 'DWD7\SH field, select the 'LUHFW option.

1RWHVRQJHQHUDOXVH

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\QDPLFGLDORJV to suit your own needs. The tag name must also be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

3-73

6DPSOH3URMHFWSLFWXB



 6KRZLQJDQGKLGLQJREMHFWVE\PHDQVRIELWHYDOXDWLRQ H[DPSOH

7DVNGHILQLWLRQ

Objects are to be shown and hidden depending on a specific bit position in a tag value.

,PSOHPHQWDWLRQFRQFHSW

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 polygons created under 6WDQGDUG 2EMHFWV 3RO\JRQV are displayed or hidden depending on these bits.
,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKRZLQJDQGKLGLQJREMHFWVE\PHDQVRIELWHYDOXDWLRQ

1 2

Create a tag of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use the tag called 8BSLFWXBG\QB. Configure a check box under :LQGRZV2EMHFWV&KHFN%R[; in our example we use &KHFN%R[. Under 3URSHUWLHV*HRPHWU\1XPEHURI%R[HV, enter the number 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 question for each index value; Configure a number of objects under 6WDQGDUG2EMHFWV3RO\JRQ. In our example, we use the objects called 3RO\JRQ through 3RO\JRQ. Create a G\QDPLFGLDORJ for 3RO\JRQ under 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\. In the ([SUHVVLRQ)RUPXOD field, set tag 8LBSLFWXBG\QB and set the trigger to 8SRQFKDQJH. In the 'DWD7\SH field, select the %LW option. Click the button to call bit selection and select the first bit.

3 4

Follow the same procedure for the other SRO\JRQREMHFWV and change the bit number for each one.

1RWHVRQJHQHUDOXVH

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\QDPLFGLDORJV to suit your own needs.

3-74

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 $QLPDWLRQRIPRYHPHQWE\PHDQVRID&DFWLRQ H[DPSOH

You access the following examples that relate to the Dynamics chapter in our SLFWXB project by the button depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBDSGO.

7DVNGHILQLWLRQ

An object is to be moved in one direction by clicking a EXWWRQ and in another direction by clicking another EXWWRQ.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a status display created under 6PDUW2EMHFWV 6WDWXV'LVSOD\ to display two pictures. Two buttons created under :LQGRZV2EMHFWV %XWWRQ are used to move this status display in two different directions.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHDQLPDWLRQRIPRYHPHQWE\PHDQVRID&DFWLRQ

1 2

In Tag Management, create three tags of type %LQDU\WDJ; in our example, we use tags %,1LBSLFWXBG\QB, %,1LBSLFWXBG\QB and %,1LBSLFWXBG\QB. Create a status display under 6PDUW2EMHFWV6WDWXV'LVSOD\. In our example, we use the object called 6WDWXV'LVSOD\. Under &RQILJXUDWLRQ'LDORJ, select tag %,1LBSLFWXBG\QB and set the trigger to 8SRQFKDQJH. Add another status. Set picture )HUUDULEPS under state  and picture )HUUDULEPS under state  by means of drag&drop.

Under 3URSHUWLHV6WDWH%DVLF3LFWXUH7UDQVSDUHQW&RORU, set the color :KLWH for both states ( and ) and set 3LFWXUH7UDQVSDUHQW&RORU2Q to <HV. This means that the picture is not shown with a white background. Configure a button under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Under (YHQWV0RXVH3UHVVOHIW, create a GLUHFW FRQQHFWLRQ which sets tag %,1LBSLFWXBG\QB to , and under (YHQWV0RXVH 3UHVVULJKW, create another GLUHFWFRQQHFWLRQ which resets the same tag to . Create a second button under :LQGRZV2EMHFWVDQGLQWKHVDPHZD\DV
GHVFULEHGLQWKHSUHYLRXVVWHSFUHDWHWZRGLUHFWFRQQHFWLRQVWRWDJ %,1LBSLFWXBG\QB

. In our example, we use the object called %XWWRQ.

Under 3URSHUWLHV*HRPHWU\3RVLWLRQ;, create a &DFWLRQ for 6WDWXV 'LVSOD\ which executes animation of the movement depending on which EXWWRQ is clicked. Set the trigger for this action to PV.

WinCC Configuration Manual C79000-G8276-C140-01

3-75

6DPSOH3URMHFWSLFWXB



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

return a; }

Define a tag of type VWDWLFLQW 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 displayed in 6WDWXV'LVSOD\. Check whether %XWWRQ is clicked and if the X position is less than -200. If yes, decrease the value that contains the X position by 10. Then change the picture displayed in 6WDWXV 'LVSOD\. The return value is the new X position.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The principle of animation can be adopted.

3-76

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &UHDWHDQLPDWLRQRIPRYHPHQWE\PHDQVRIDZL]DUG H[DPSOH

7DVNGHILQLWLRQ

An object is to change its position on the screen when changes are made to a tag. Separate tags are to be used for the X and Y positions. Configuration is to be implemented using the '\QDPLF:L]DUG.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a circle created under 6WDQGDUG2EMHFWV&LUFOH, which is to be moved on the screen. We use two slider objects created under :LQGRZV 2EMHFWV6OLGHU2EMHFW to enter the tag.
,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFUHDWHDQLPDWLRQRIPRYHPHQWE\PHDQVRIDZL]DUG

1 2

Create two tags of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use the tags called 6LBSLFWXBG\QB and 6LBSLFWXBG\QB. Configure two slider objects under :LQGRZV2EMHFWV6OLGHU2EMHFW; in our example, we use 6OLGHU2EMHFW and 6OLGHU2EMHFW. Create a GLUHFWFRQQHFWLRQ under 6OLGHU2EMHFW. Connect the VRXUFH 3URSHUW\6OLGHU2EMHFW3URFHVV 'ULYHU&RQQHFWLRQ to the target Variable 6LBSLFWXBG\QB. In the same way, create a GLUHFWFRQQHFWLRQ to tag 6LBSLFWXBG\QB under 6OLGHU2EMHFW. Under 3URSHUWLHV0LVFHOODQHRXV0D[LPXP9DOXH, change the setting to  for both slider objects. Configure an object of type 6WDQGDUG2EMHFWV&LUFOH. In our example, we use &LUFOH. With the object selected, select the 6WDQGDUG'\QDPLFV tab from the '\QDPLF:L]DUG and ' the 0RYH2EMHFW option. Select 7DJ as the trigger. On the 6HWRSWLRQV page, select tag 6LBSLFWXBG\QB for the X direction and tag 6LBSLFWXBG\QB for the Y direction. Enter  and  as the low and high limits for formatting, respectively. On the next page, specify the picture area within which the object is to be moved. Close the Finished ! page by clicking )LQLVK.

3 4

Under 3URSHUWLHV*HRPHWU\3RVLWLRQ; and 3URSHUWLHV*HRPHWU\ 3RVLWLRQ<, set the trigger to 8SRQFKDQJH of the respective tag in the &DFWLRQV generated by the '\QDPLF:L]DUG.

WinCC Configuration Manual C79000-G8276-C140-01

3-77

6DPSOH3URMHFWSLFWXB



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); }

1RWHVRQJHQHUDOXVH

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 be adapted to suit your own needs.

3-78

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &RORUFKDQJHE\PHDQVRID&DFWLRQ H[DPSOH

7DVNGHILQLWLRQ

The color of an object is to change smoothly from a dark to a light shade as a tag value changes.

,PSOHPHQWDWLRQFRQFHSW

We implement this by means of a circle, which we create under 6WDQGDUG2EMHFWV &LUFOH, whose color changes as a tag value changes. We use a slider object created under :LQGRZV2EMHFWV6OLGHU2EMHFW to enter the tag.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUH

1 2

Create a tag of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use tag 6LBSLFWXBG\QB. Configure a slider object under :LQGRZV2EMHFWV6OLGHU2EMHFW; In our example, we use the object called 6OLGHU2EMHFW. Create a GLUHFWFRQQHFWLRQ for 6OLGHU2EMHFW under (YHQWV3URSHUW\7RSLFV0LVFHOODQHRXV3URFHVV 'ULYHU&RQQHFWLRQ. Connect the VRXUFH 3URSHUW\6OLGHU2EMHFW3URFHVV 'ULYHU&RQQHFWLRQ to the target Variable 6LBSLFWXBG\QB. Under 3URSHUWLHV0LVFHOODQHRXV0D[LPXP9DOXH, change the setting for 6OLGHU2EMHFW to . Configure a circle under 6WDQGDUG2EMHFWV&LUFOH; in our example, we use &LUFOH. Under 3URSHUWLHV&RORUV%DFNJURXQG&RORU, create a &DFWLRQ which provides a color value depending on tag 6LBSLFWXBG\QB. This action is triggered 8SRQFKDQJH of this tag.

3 4

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, 6LBSLFWXBG\QB, shifted 8 bit positions to the left.

1RWHVRQJHQHUDOXVH

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 are reserved for each of these values in the 24-bit color value. In our example, the tag has been shifted 8 bits to the left and therefore represents the green value. If this isnt done, the color will change from black to red; if the tag is shifted 16 bits, from black to blue.

WinCC Configuration Manual C79000-G8276-C140-01

3-79

6DPSOH3URMHFWSLFWXB



 $QLPDWLRQRIPRYHPHQWE\PHDQVRIDVWDWXVGLVSOD\ H[DPSOH

7DVNGHILQLWLRQ

Movement is to be simulated by turning on different pictures in a 6PDUW2EMHFWV6WDWXV GLVSOD\.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a status display created under 6PDUW2EMHFWV 6WDWXV'LVSOD\, in which we display different pictures one after the other after turning on the display by means of another status display created under 6PDUW2EMHFWV6WDWXV GLVSOD\.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHDQLPDWLRQRIPRYHPHQWE\PHDQVRIDVWDWXVGLVSOD\

1 2

Create a tag of type %LQDU\WDJ in Tag Management. In our example, we use the tag called %,1LBSLFWXBG\QB. Create a status display under 6PDUW2EMHFWV6WDWXV'LVSOD\. in our example, we use the object called 6WDWXV'LVSOD\. Under &RQILJXUDWLRQ'LDORJ, select tag %,1LBSLFWXBG\QB and set the trigger to 8SRQFKDQJH. Add another status. Set picture 6PLOLEPS under state  and picture &RROEPS under state . For 6WDWXV'LVSOD\, create a &DFWLRQXQGHU (YHQWV0RXVH3UHVVOHIW, which negates the state of tag %,1LBSLFWXBG\QB. Configure another status display under 6PDUW2EMHFWV6WDWXV'LVSOD\; in our example, we use 6WDWXV'LVSOD\. Under 3URSHUWLHV6WDWH&XUUHQW6WDWXV, configure seven more statuses with the respective pictures. For each status, change the %DVLF3LFWXUH7UDQVSDUHQW&RORU attribute to :KLWH and the %DVLF 3LFWXUH7UDQVSDUHQW&RORU2Q to <HV. Statuses  through  are each assigned one of the pictures from 6BEPS through 6BEPS.

3 4

For 6WDWXV'LVSOD\, create a &DFWLRQ under 3URSHUWLHV6WDWH&XUUHQW 6WDWXV, which causes current statuses 0 through 7 to be run through. Set the trigger for this action to PV.

3-80

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

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

1RWHVRQJHQHUDOXVH

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 the status pictures and the tag name are adapted.

WinCC Configuration Manual C79000-G8276-C140-01

3-81

6DPSOH3URMHFWSLFWXB



 /DQJXDJHVZLWFK

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

3-82

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &KDQJHUXQWLPHODQJXDJH H[DPSOH

7DVNGHILQLWLRQ

The runtime language is to be able to be changed by means of one button for each language set.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use three buttons, which we can take ready-configured from the library when creating them under :LQGRZV2EMHFWV%XWWRQ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFKDQJHUXQWLPHODQJXDJH

In the *UDSKLFV'HVLJQHU, a picture (any picture) is configured in a certain language. By selecting the menu item View Language, the next language to be configured 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 the ODQJXDJHH[H program on the WinCC CD. They can then be translated and imported back into the project. 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 If you require a language that is not contained in the library, create a button under :LQGRZV2EMHFWV%XWWRQ and configure a &DFWLRQ under (YHQWV0RXVH 3UHVVOHIW, 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 ' the /DQJXDJH6ZLWFK option in the 6\VWHP)XQFWLRQV tab of 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 respective language code to do so.

1RWHVRQJHQHUDOXVH

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.

WinCC Configuration Manual C79000-G8276-C140-01

3-83

6DPSOH3URMHFWSLFWXB



 'LDORJER[IRUFKDQJLQJWKHUXQWLPHDQG&RQWURO&HQWHUODQJXDJH H[DPSOH

7DVNGHILQLWLRQ

A EXWWRQ is to be created, which when clicked calls a dialog box in which one of the languages set can be selected.

,PSOHPHQWDWLRQFRQFHSW

To implement this control on, we use a button created under :LQGRZV2EMHFWV%XWWRQ, which shows or hides a picture window created under 6PDUW2EMHFWV3LFWXUH:LQGRZ. This dialog box can be taken directly from the project with the name SLFWXB.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHGLDORJER[IRUFKDQJLQJWKHUXQWLPHDQG&RQWURO&HQWHU ODQJXDJH

In the *UDSKLFV'HVLJQHU, a picture (any picture) is configured in a certain language. By selecting the menu item 9LHZ/DQJXDJH, the next language to be configured is selected and all the texts translated into the language in question. Configure a picture window under 6PDUW2EMHFWV3LFWXUH:LQGRZ. In our example, 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&ORVHG to <HV. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. This picture can be taken directly from project SLFWXB. Change 3URSHUWLHV0LVFHOODQHRXV0LVFHOODQHRXV to 1R. Configure a button under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ. Configure a GLUHFWFRQQHFWLRQ under (YHQWV0RXVH 3UHVVOHIW, which shows 3LFWXUH:LQGRZ.

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: Picture SLFWXBBZLQGRZBSGO can be integrated directly into another project without any changes.

3-84

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 :RUNLQJZLWKRXWDPRXVH

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the pictures SLFWXBBFKDSWHUBSGO, SLFWXBBFKDSWHUBDSGOand SLFWXBBFKDSWHUBESGO.

WinCC Configuration Manual C79000-G8276-C140-01

3-85

6DPSOH3URMHFWSLFWXB



 2SHUDWLRQZLWKWKH7$%NH\RUKRWNH\ H[DPSOH

7DVNGHILQLWLRQ

Lettering is required to be capable of formatting across several dialog boxes in different ways. There is a requirement for it to be possible to set the font color, different font attributes and the font size. Further, it should be possible to reset the settings to specified default settings. Operation of all the elements in the picture is to be performed solely on the keyboard.

,PSOHPHQWDWLRQFRQFHSW

To implement these control actions, we use four buttons created under :LQGRZV2EMHFWV %XWWRQ. They are used to display the dialog boxes. They can be operated on the keyboard when the runtime cursor is activated. Select the EXWWRQ you want to operate with the TAB key. Further, a hot key is assigned to every button. Three picture windows created under 6PDUW2EMHFWV3LFWXUH:LQGRZ are used to display the dialog boxes.

&RQILJXULQJFXUVRUFRQWURO
6WHS 3URFHGXUHFRQILJXULQJFXUVRUFRQWURO

5 Make the relevant settings in the &RQWURO&HQWHU to enable cursor control. &RPSXWHU to call the shortcut menu and choose 3URSHUWLHV. In the &RPSXWHUOLVW the 3URSHUWLHV button. SURSHUWLHV dialog box that appears,

Then select the *UDSKLFV5XQWLPH tab. 2 Make the hot key settings as follows. A hot key is not configured to FKDQJH ZLQGRZV since setting of the control focus is performed with &DFWLRQV in the examples. To switch between 7DE2UGHU$OSKD&XUVRU, set 6+,)7$, and set 6+,)75 for turning the runtime cursor on and off.

Do not set any keys in the segment &XUVRUFRQWURONH\V. If they are required in

3-86

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRQILJXULQJFXUVRUFRQWURO

the examples, they are set by means of an API function. This is performed because several control concepts are shown in the examples. Normally, a certain control concept is selected for a project and set here.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFRQILJXULQJFRQWUROE\PHDQVRIKRWNH\V

In tag management, create three tags of the 8QVLJQHGELWYDOXH type, which contain the set font attributes. In our example, we use 8LBSLFWXBFXUVRUB through 8LBSLFWXBFXUVRUB. In the picture SLFWXBBFKDSWHUBSGO, create four objects of the :LQGRZV2EMHFW %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 the settings performed. Further, configure static text under 6WDQGDUG2EMHFWV6WDWLF7H[W, the font attributes of which have been set in the dialog boxes. In our example, we use the object called 6WDWLF7H[W. Configure another picture, which will be used as a dialog box for setting colors. In our example, we use the picture named SLFWXBBZLQGRZBSGO. In this picture, configure a :LQGRZV2EMHFWV2SWLRQ*URXS. In our example, we use the object called 2SWLRQ*URXS. 3URSHUWLHV*HRPHWU\1XPEHURI )LHOGV is set to . This means it is possible to select four different colors. Under 3URSHUWLHV2XWSXW,QSXW6HOHFWHG%R[HV, create a WDJFRQQHFWLRQ to tag 8LBSLFWXBFXUVRUB. At 3URSHUWLHV*HRPHWU\3RVLWLRQ;, create a &DFWLRQ which switches the focus to its own object. This &DFWLRQ is triggered at K. If the 2SWLRQ*URXS has the operation focus when the runtime cursor is switched on, it is displayed with a border. If quadrangles are placed over the edges of the object that have the same color as the background, the border around the object can be hidden. In the same picture, configure two button objects under :LQGRZV2EMHFWV %XWWRQ. In our example, we use the objects called %XWWRQ and %XWWRQ. %XWWRQis used as the 2.EXWWRQ. At the (YHQW0RXVH0RXVHFOLFN, create a &DFWLRQ which changes the color of the lettering as a function of the value of the 8LBSLFWXBFXUVRUBtag. Further, its own window is switched to be made invisible. %XWWRQis used as the (6&EXWWRQ. At (YHQW0RXVH0RXVH&OLFN, create a GLUHFWFRQQHFWLRQ to hide the separate window. Performing settings for keyboard control. Set the tabulator order. It can be set by choosing (GLW7$%2UGHU6ZLWFK &XUVRU6HTXHQFH from the menu.

WinCC Configuration Manual C79000-G8276-C140-01

3-87

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHFRQILJXULQJFRQWUROE\PHDQVRIKRWNH\V

Every controllable object is now represented by a number. The order of numbering represents the tabulator sequence. This is the order in which the objects are addressed when the tabulator key is operated. The order can be modified 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 DUURZNH\V. A color is selected with VSDFHEDU. You can switch to and fro between the control elements with the WDEXODWRUNH\. The buttons are operated with the VSDFHEDU. The two EXWWRQV are further provided with a hot key. The dialog box for configuring a hot key is opened by choosing 3URSHUWLHV0LVFHOODQHRXV+RW .H\. (17(5 and (6& are set for 2. &DQFHO, respectively.

3-88

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRQILJXULQJFRQWUROE\PHDQVRIKRWNH\V

In the picture called SLFWXBBFKDSWHUBSGO, configure a picture window by choosing 6PDUW2EMHFWV3LFWXUH:LQGRZ in which you want to display the picture you have just configured. In our example, we use the object called 3LFWXUH :LQGRZ. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. Set 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\ to 1R. At the %XWWRQ object, create a &DFWLRQ which queries the currently set color of the lettering and, depending on that, describes the 8LBSLFWXBFXUVRUB tag. This is used to set the selection of the 2SWLRQ*URXS in the dialog box to the currently set value. Further, the 3LFWXUH:LQGRZ object is displayed. At %XWWRQ create at 3URSHUWLHV*HRPHWU\3RVLWLRQ; a &DFWLRQ that switches the control focus to that object. This &DFWLRQ is triggered at K, but setting of the focus is performed only the first time.

The EXWWRQ is further provided with a hot key. In our example, this is the function key ). 8 Configure a picture which is to be used as a dialog box for creating different font attributes. In our example, we use the picture named SLFWXBBZLQGRZBSGO. In this picture, configure a :LQGRZV2EMHFWV&KHFN%R[. In our example, we use the object called &KHFN%R[. 3URSHUWLHV*HRPHWU\1XPEHURI)LHOGV is set to . It should be possible to choose the attributes EROG, LWDOLF, XQGHUVFRUH and ERUGHU. Under 3URSHUWLHV2XWSXW,QSXW6HOHFWHG%R[HV, create a WDJFRQQHFWLRQ to tag 8LBSLFWXBFXUVRUB. At 3URSHUWLHV*HRPHWU\3RVLWLRQ;, create a &DFWLRQ which switches the control focus to its own object. The selection frame can be hidden in a manner similar to the 2SWLRQ*URXS configured beforehand. As with the picture called SLFWXBBZLQGRZBSGO, two buttons are created by choosing :LQGRZV2EMHFWV%XWWRQ. Choosing 2. reads in the 8LBSLFWXBFXUVRUB tag and depending on that, the appropriate settings are

WinCC Configuration Manual C79000-G8276-C140-01

3-89

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHFRQILJXULQJFRQWUROE\PHDQVRIKRWNH\V

applied to the lettering. The settings for keyboard control are performed in the same way as for the picture called SLFWXBBZLQGRZBSGO. 9 In the picture called SLFWXBBFKDSWHUBSGO, configure a further picture window by choosing 6PDUW2EMHFWV3LFWXUH:LQGRZ in which you want to display the picture you have just configured. In our example, we use the object called 3LFWXUH :LQGRZ. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. Set 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\ to 1R. At the %XWWRQ object, create a &DFWLRQ which queries the currently set font attributes you want to modify and, depending on that, describes the 8LBSLFWXBFXUVRUB tag. This is used to set the selection of the FKHFNER[ in the dialog box to the currently set values. Further, the 3LFWXUH:LQGRZ object is displayed. The EXWWRQ is further provided with a hot key. In our example, this is the function key ).

10

11

Configure a further picture which is to be used as a dialog box for setting the font sizeSmart-Objekt. In our example, we use the picture named SLFWXBBZLQGRZBSGO. In this picture, configure an object by selecting 6PDUW2EMHFWV,2)LHOG. In our example, we use the object called ,2)LHOG. Under 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH, create a WDJFRQQHFWLRQ to tag 8LBSLFWXBFXUVRUB. At 3URSHUWLHV*HRPHWU\3RVLWLRQ;, create a &DFWLRQ which switches the control focus to its own object. Hiding the selection list-box is accomplished in the current example by a JUDSKLFREMHFW being placed across the ,2ILHOG. In our example, we use the object called *UDSKLF2EMHFW. The bitmap displayed by the JUDSKLFREMHFW has a specific color in the area in which the ,2ILHOG has to be displayed. This color is set in the JUDSKLFREMHFW as the picture transparent color at 3URSHUW\3LFWXUH3LFWXUH7UDQVSDUHQW&RORU. Further, the SURSHUW\ 3LFWXUH3LFWXUH7UDQVSDUHQW&RORU2Q has to be set to<HV. The bitmap used is displayed below.

12

As with the picture called SLFWXBBZLQGRZBSGO, two buttons are created by choosing :LQGRZV2EMHFWV%XWWRQ. Click 2. or &DQFHO to close the dialog box. Both EXWWRQV are removed from the TAB order, however. This is accomplished by choosing (GLW7$%2UGHU6ZLWFK&XUVRU6HTXHQFH. An object can be removed from the TAB order by selecting it with

with key combination

3-90

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRQILJXULQJFRQWUROE\PHDQVRIKRWNH\V &75/6+,)7

pressed. Instead of the number, an * appears in the white

rectangle.

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 ,2ILHOG is applied to tag 8LBSLFWXBFXUVRUB simultaneously. At object 6WDWLF7H[W in the picture called SLFWXBBFKDSWHUBSGO, create a WDJ FRQQHFWLRQ at 3URSHUWLHV)RQW)RQW6L]H at tag 8LBSLFWXBFXUVRUB. 13 In the picture called SLFWXBBFKDSWHUBSGO, configure a further picture window by choosing 6PDUW2EMHFWV3LFWXUH:LQGRZ in which you want to display the picture you have just configured. In our example, we use the object called 3LFWXUH :LQGRZ. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. Set 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\ to 1R. 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 function key ).

14

15

At object %XWWRQ, create a &DFWLRQ that resets the settable properties of the object called 6WDWLF7H[W to the presettings. The EXWWRQ is provided with hot key ).

16

Choose (GLW7$%2UGHU6ZLWFK&XUVRU6HTXHQFH from the menu to set objects %XWWRQ to %XWWRQ in the corresponding order. All other objects are removed from the TAB order. Press the VSDFHEDU or operate the appropriate hot keys to choose the EXWWRQV.

WinCC Configuration Manual C79000-G8276-C140-01

3-91

6DPSOH3URMHFWSLFWXB



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 run

if (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 is called 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 SLFWXBBZLQGRZBSGO 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 value

wValue=GetTagWord("U16i_pictu_cursor_00");
//set text color

switch (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 window

SetVisible("pictu_3_chapter_08.PDL","Picture Window1", FALSE); }

The IRQWFRORU property of object 6WDWLF7H[W is set as a function of the value of tag 8LBSLFWXBFXUVRUB. This &DFWLRQ is executed by choosing 2. in the picture called SLFWXBBZLQGRZBSGO.

3-92

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

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 SLFWXBBFKDSWHUBSGO applies a cursor setting by means of API-function 3'/576HW&XUVRU.H\V. The first four parameters of the function contain the key codes for the keys required for up and down, and for left and right movements. In the present example, the WIN key for all four directions of movement is selected in order to disable cursor movement by means of the keyboard. Movement of the runtime cursor is therefore allowed only by means of the TAB in the set TAB order.

1RWHVRQJHQHUDOXVH

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 a key combination for switching between these windows. In the present example, the control concept was chosen, however, so that switching from one dialog box to another is 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 to move the runtime cursor but simply TAB. However, the arrow keys are used by default to operate option groups and check boxes.

WinCC Configuration Manual C79000-G8276-C140-01

3-93

6DPSOH3URMHFWSLFWXB



 &XUVRUNH\ERDUG H[DPSOH

The present example is obtained in the picture called SLFWXBBFKDSWHUBSGO using the key . It is configured in the combination &75/: or by choosing the top button with picture with the name SLFWXBBFKDSWHUBDSGO.

7DVNGHILQLWLRQ

Text has to be entered using the arrow keys on a keyboard projected in a picture. The different 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 to open the dialog box by operating a hot key.

,PSOHPHQWDWLRQFRQFHSW

A ready-made keyboard from the library is used for the implementation. It is personalized. A picture window created at 6PDUW2EMHFWV3LFWXUH:LQGRZ is used to display the dialog box. A button created at :LQGRZV2EMHFW%XWWRQ provided with a hot key is used to display the dialog box. TheEXWWRQ itself is not displayed at runtime, however.

3-94

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUHLPSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

In tag management, create two tags of the 8QVLJQHGELWYDOXH type for storing cursor behavior. In the example we use the tags 8LBSLFWXBFXUVRUB and 8LBSLFWXBFXUVRUB. Further, create a tag of the WH[WWDJELWFKDUDFWHUVHW type for transferring the entered text. In our example, we use the tag called 7LBSLFWXBFXUVRUB. button on the toolbar. Open the library with the In the .H\ERDUGV folder, select the .H\ERDUG&KDU object and drag and drop it into a picture. In our example, this is the picture named SLFWXBBFKDSWHUBDSGO. The explanatory objects can be deleted; only the elements displayed below are required.

At (17(5, a &DFWLRQ is created at (YHQWV0RXVH0RXVH$FWLRQ to write entered text to a text tag. This tag is called &RQQHFWHG9DU&KDU. It has to be modified in the picture called 7LBSLFWXBFXUVRUB. The contents of the 7LBSLFWXBFXUVRUB tag are displayed in the example in the 6WDWLF7H[W, which forma the picture heading. This is performed by means of a WDJ FRQQHFWLRQ to that tag. 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 have to be set since operation is intended to be performed with the arrow keys rather than the TAB key. The arrow keys for cursor control are set in a &DFWLRQ at (YHQWV 0LVFHOODQHRXV2SHQ3LFWXUH. 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 5 to open the shortcut menu at the item &RPSXWHU and select 3URSHUWLHV. In the &RPSXWHUOLVWSURSHUWLHV dialog box that appears, the 3URSHUWLHV button. Then select the *UDSKLFV5XQWLPH tab. You can choose between three different settings in the &XUVRUFRQWUROEHKDYLRU box.

WinCC Configuration Manual C79000-G8276-C140-01

3-95

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHLPSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

Create a new picture to be used as a dialog box. In our example, we use the picture named SLFWXBBZLQGRZBSGO. Configure three status displays at 6PDUW2EMHFWV6WDWXV'LVSOD\V in this picture. In our example these are the objects called 6WDWXV'LVSOD\, 6WDWXV 'LVSOD\ and 6WDWXV'LVSOD\. The &RQILJXUDWLRQGLDORJER[ is used to set for every VWDWXVGLVSOD\ one bitmap which displays the pressed state of a button, and one bitmap which displays the non-pressed state of a button. 6WDWH  is intended to display the pressed button, while VWDWH  is intended to display the non-pressed state. At 3URSHUWLHV6WDWH&XUUHQW6WDWXV, create in each case a G\QDPLFGLDORJ ER[ that control the current status of tag 8LBSLFWXBFXUVRUB. This tag contains the temporary setting for the cursor behavior. At (YHQWV.H\ERDUG3UHVV, create a &DFWLRQ that describes tag 8LBSLFWXBFXUVRUB with a value representing a specific selection. These values are: 0...Normal 1...Normal without roll-back 10...Extended In the same picture, configure two button objects under :LQGRZV2EMHFWV %XWWRQ. In our example, we use the objects called %XWWRQ and %XWWRQ. %XWWRQis used as the 2.EXWWRQ. At (YHQWV0RXVH0RXVH$FWLRQ, create a &DFWLRQ that writes the value of tag 8LBSLFWXBFXUVRUBto tag 8LBSLFWXBFXUVRUB. This is intended to represent the currently set cursor behavior. Following that, the cursor behavior is changed using the API function 3'/576HW&XUVRU.H\V. The value stored in the 8LBSLFWXBFXUVRUBtag corresponds to the numerical value demanded by the function for specific cursor behavior. Further, the focus is set to the $EXWWRQ and the separate window is switched to become invisible. %XWWRQis used as the (6&EXWWRQ. At (YHQWV0RXVH0RXVH$FWLRQ, create a &DFWLRQ that sets the focus to the $EXWWRQ and hides its own window.. In the picture called SLFWXBBFKDSWHUBDSGO, configure a picture window by choosing 6PDUW2EMHFWV3LFWXUH:LQGRZ in which you want to display the picture you have just configured. In our example, we use the object called 3LFWXUH :LQGRZ. Under 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, select the picture with the name SLFWXBBZLQGRZBSGO. Set 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\ to 1R. In the picture called SLFWXBBFKDSWHUBDSGO, create a button at :LQGRZV 2EMHFWV%XWWRQ. In our example, we use the object called %XWWRQ.

3-96

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHLPSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

At object %XWWRQ, create a &DFWLRQ which writes the value for the currently set cursor behavior to the 8LBSLFWXBFXUVRUB tag and makes the 3LFWXUH:LQGRZ object visible. The EXWWRQ is further provided with a hot key. In our example this is the key combination &75/(. The 3URSHUWLHV0LVFHOODQHRXV'LVSOD\ settings are set to 1R. This means the button itself is not visible but the configured hot key is effective.

C action at the Press Key event


#include "apdefap.h" void OnKeyDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar==VK_SPACE) SetTagWord("U16i_pictu_cursor_05",0); }

If the runtime cursor is positioned over the status display, this &DFWLRQ is executed when a key is pressed. The nChar tag contains the key code of the corresponding key. If this the spacebar, the value for the cursor behavior is written to the tag. In the present example 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 a EXWWRQ with this object but of a VWDWXVGLVSOD\. If it were not, the 0RXVH&OLFN event might be used. To design the object for mouse operation too, a further &DFWLRQ has to be created at the Mouse Click event - without key code query, however.

WinCC Configuration Manual C79000-G8276-C140-01

3-97

6DPSOH3URMHFWSLFWXB



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 tag

SetTagWord("U16i_pictu_cursor_04", GetTagWord("U16i_pictu_cursor_05"));
//set cursor mode

PDLRTSetCursorKeys(VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT,0, GetTagWord("U16i_pictu_cursor_04"),NULL, (LPVOID)1,NULL);


//set focus to A-button

Set_Focus("pictu_3_chapter_08a.PDL","Button92");
//close window

SetVisible("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 8LBSLFWXBFXUVRUB tag. Perform the cursor setting with the AP function 3'/576HW&XUVRU.H\V. The first four parameters 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 cursor behavior to the function. This is already contained, in properly coded form, in the 8LBSLFWXBFXUVRUB 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 and the cursor behavior is set to normal. Loading of the DLL is already performed at this time. It does not have to be reloaded. This is mentioned again for the sake of completeness, however.

1RWHVRQJHQHUDOXVH

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 entering numerals and one for numbers and characters. They are in the same way as the keyboard used in this example.

3-98

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 9DOXHLQSXWFRQWURODFWLRQV H[DPSOH

The present example is obtained in the picture called SLFWXBBFKDSWHUBDSGO using the . It is configured in the key combination &75/: or by choosing the top button with picture with the name SLFWXBBFKDSWHUBESGO.

7DVNGHILQLWLRQ

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.

,PSOHPHQWDWLRQFRQFHSW

To implement these control actions, a number of buttons created under :LQGRZV2EMHFWV %XWWRQ is used, under which hot keys are configured. Values are to be able to be entered in I/O fields created under 6PDUW2EMHFWV,2)LHOG, and valves are to be able to be turned on and off.

,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUHLPSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

In tag management, create six tags of the VLJQHGELWYDOXH type for performing and storing inputs. In our example we use the tags 6LBSLFWXBFXUVRUB to 6LBSLFWXBFXUVRUB. In a picture, configure three I/O fields at 6PDUW2EMHFWV,2)LHOGV in which the 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 6LBSLFWXBFXUVRUB at 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH. Choose 3URSHUWLHV/LPLWV and set the 8SSHUOLPLW to  and the /RZHUOLPLW to . Proceed in a similar manner at the other ,2ILHOGV, but set tags 6LBSLFWXBFXUVRUB and 6LBSLFWXBFXUVRUB. At the ,2)LHOG object, however, set the 8SSHUOLPLW to .

Configure three buttons at :LQGRZV2EMHFWV%XWWRQwhich are to be used for applying the values entered in the ,2ILHOGV. In our example, we use the objects called %XWWRQ), %XWWRQ) and %XWWRQ). At object %XWWRQ), create a &DFWLRQ at (YHQWV0RXVH0RXVH$FWLRQ that writes the value entered in tag 6LBSLFWXBFXUVRUB to tag 6LBSLFWXBFXUVRUB. Choose 3URSHUWLHV0LVFHOODQHRXV+RW.H\ set hot key ) for the EXWWRQ. Proceed in a similar manner with the other EXWWRQV. At %XWWRQ), create a &DFWLRQ at 3URSHUWLHV*HRPHWU\:LGWK that switches the focus to its own object.

WinCC Configuration Manual C79000-G8276-C140-01

3-99

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHLPSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

Configure three rectangle at 6WDQGDUG2EMHFWV5HFWDQJOHV to represent entered values. In our example, we use the objects 5HFWDQJOH, 5HFWDQJOH, and 5HFWDQJOH. Set the 3URSHUWLHV)LOOLQJ'\QDPLF)LOOLQJ to <HV. At 3URSHUWLHV)LOOLQJ )LOO/HYHO, create in each instance a G\QDPLFGLDORJER[ for converting the tag value into a fill level. The graphical display of the containers is performed with several VWDQGDUG REMHFWV, which are combined to form a group in each instance.

Configure four more buttons under :LQGRZV2EMHFWV%XWWRQ. They are to be used to turn valves on and off. In our example, we use the objects called %XWWRQ), %XWWRQ), %XWWRQ) and %XWWRQ). At the (YHQW0RXVH0RXVH&OLFN, create a &DFWLRQ to invert a binary tag representing a valve state. Every EXWWRQ is linked to a hot key. In the picture, configure four valves which are connected with the corresponding binary tags. You will find a detailed description of how to create these valves in the section called 'LVSOD\LQJDQGKLGLQJLQIRUPDWLRQ in example 6KRZLQJDQG KLGLQJREMHFWV H[DPSOH . With the exception of the EXWWRQV provided with hot keys, all the other objects are removed from the TAB order. Set the order of selection of the ,2ILHOGV with the TAB key by choosing (GLW 7$%2UGHU$OSKD&XUVRU2UGHU from the menu.

In the &RQWURO&HQWHU, set a key combination for fore toggling between the Tab 5 &RPSXWHU to call the shortcut menu and choose Orders and the alpha cursor.

3-100

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHLPSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU 3URSHUWLHV 3URSHUWLHV

. In the &RPSXWHUOLVWSURSHUWLHV dialog box that appears, the button. Then select the *UDSKLFV5XQWLPH tab. To toggle between 7DE2UGHUVDQGDOSKDFXUVRU, set the key combination 6+,)7$. Further, to turn the runtime cursor on and off, set the key combination 6+,)75.

1RWH

You can exit the example just described by choosing the following button or by pressing (6&.

1RWHVRQJHQHUDOXVH

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 elements do not have functions. The whole picture represents a diagram of operator panel 6LPDWLF 23.

WinCC Configuration Manual C79000-G8276-C140-01

3-101

6DPSOH3URMHFWSLFWXB



 6KRZLQJDQGKLGLQJLQIRUPDWLRQ

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

3-102

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 6KRZLQJDQGKLGLQJREMHFWV H[DPSOH

In many plant pictures, it sometimes makes sense if certain items of information are not constantly displayed in the picture, but can be shown when required or when specific events occur.

7DVNGHILQLWLRQ

Certain objects or object groups in a picture are to be able to be hidden by the user.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use a picture in which several valves are displayed. Each valve is assigned a button created under :LQGRZV2EMHFWV%XWWRQ which is used to control the valve, a static text created under 6WDQGDUG2EMHFWV6WDWLF7H[W with the name of the valve, and a group object which displays the state of the valve. In addition, the picture also depicts containers whose fill levels are displayed by means of I/O fields created under 6PDUW2EMHFWV,2)LHOG. All I/O fields, all buttons and all static texts can be shown and hidden by clicking the corresponding one of the buttons created for this purpose under :LQGRZV2EMHFWV%XWWRQ.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHVKRZLQJDQGKLGLQJREMHFWV

In Tag Management, create three tags of type %LQDU\WDJ, which control the visibility of the various object groups. In our example, we use %,1LBSLFWXBLQIRB, %,1LBSLFWXBLQIRB, and %,1LBSLFWXBLQIRB. In Tag Management, create further tags of type %LQDU\WDJ, which contain the current states of the valves. The number of tags required depends on the number of valves. In our example, we use %,1LBSLFWXBLQIRB through %,1LBSLFWXBPXOWLB; we have, then, configured a total of 11 valves. To display the valves in their open state, configure an object under 6WDQGDUG 2EMHFWV3RO\JRQ, which has the shape of a valve. Under 3URSHUWLHV&RORUV

%DFNJURXQG&RORU, select the color GDUNJUHHQ.


4 To display the valves in their closed state, configure an object under 6WDQGDUG 2EMHFWV3RO\OLQH, which has the shape of a valve.

Configure two identical objects under 6WDQGDUG2EMHFWV5HFWDQJOH and set them to display the background color of the picture under 3URSHUWLHV&RORUV %DFNJURXQG&RORU. The rectangles should be slightly larger than the valves, so that they can hide them. 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 *URXSREMHFW*URXS and group the two objects. For the group object this generates, configure a tag connection to tag %,1LBSLFWXBLQIRB under 3URSHUWLHV 0LVFHOODQHRXV9LHZ.

WinCC Configuration Manual C79000-G8276-C140-01

3-103

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHVKRZLQJDQGKLGLQJREMHFWV

Position the closed valve over the second UHFWDQJOH and position it in the foreground. Then position the JURXSREMHFW generated under Step 6 over this and position it in the foreground. Now group these three objects. This new JURXS REMHFW can then be copied to enable you to configure the remaining valves quickly. The only adaptation you have to make is to the WDJFRQQHFWLRQ. For each valve, configure a button under :LQGRZV2EMHFWV%XWWRQ and under (YHQWV0RXVH3UHVVOHIW, create a &DFWLRQ which negates the corresponding tag value. Configure a static text for each valve under 6WDQGDUG2EMHFWV6WDWLF7H[W, which contains the name of the valve. Configure a number of containers whose fill levels are displayed by means of I/O fields created under 6PDUW2EMHFWV,2)LHOG. Configure three objects under :LQGRZV2EMHFWV%XWWRQ. In our example, we use the objects called %XWWRQ, %XWWRQ, and %XWWRQ. For %XWWRQ, create a & DFWLRQ under (YHQWV0RXVH3UHVVOHIW, which negates the value of tag %,1LBSLFWXBLQIRB. Then create identical &DFWLRQV for tags %,1LBSLFWXBLQIRB and %,1LBSLFWXBLQIRB under the remaining EXWWRQV. Configure a WDJFRQQHFWLRQ to tag %,1LBSLFWXBLQIRB under all of the objects which are to be shown and hidden by means of %XWWRQ. Do exactly the same for the other objects. In our example, %XWWRQ is used to show the ,2ILHOGV, %XWWRQ to show the VWDWLFWH[WV, and %XWWRQ to show the EXWWRQV.

9 10 11

12

1RWHVRQJHQHUDOXVH

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.

3-104

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 'LVSOD\LQJWKHGDWHDQGWLPH H[DPSOH

7DVNGHILQLWLRQ

Different ways of displaying the time and date are to be presented.

,PSOHPHQWDWLRQFRQFHSW

We implement this by means of an OLE Control object which we create under 6PDUW 2EMHFWV2/(&RQWURO and which is used to display an OCX object. We also use two static texts created under 6WDQGDUG2EMHFWV6WDWLF7H[W to display the date and the time.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHGLVSOD\LQJWKHGDWHDQGWLPH

Configure an OLE Control object under 6PDUW2EMHFWV2/(&RQWURO. In our example, we use the object called 2/(&RQWURO. Select the :LQ&& 'LJLWDO$QDORJ&ORFN&RQWURO object from the window that appears. This generates a time display which you now only have to adjust to the size and type of display you want. Configure an object of type 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, we use the object called 6WDWLF7H[W. Create a &DFWLRQ under 3URSHUWLHV)RQW 7H[W, which reads out the current computer or system time and returns this as the return value. Set the trigger for this action to 1 second. Configure another object of type 6WDQGDUG2EMHFWV6WDWLF7H[W. In our example, we use the object called 6WDWLF7H[W. Create a &DFWLRQ under 3URSHUWLHV)RQW7H[W, which reads out the current date and returns this as the return value.

WinCC Configuration Manual C79000-G8276-C140-01

3-105

6DPSOH3URMHFWSLFWXB



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. returns a pointer to the system time structure.

ORFDOWLPH WLPHU 6\V0DOORF VSULQWI

reserves a memory area.

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); }

1RWHVRQJHQHUDOXVH

The following adaptations must be made before this button can be put to general use: The 6PDUW2EMHFWV2/(&RQWURO can be directly applied. The &DFWLRQV at 6WDQGDUG2EMHFWV6WDWLF7H[W can be directly applied.

3-106

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

 &RQILJXULQJPHVVDJHV

You access the examples that relate to this topic in our SLFWXB project by the EXWWRQ depicted above. The examples are configured in the picture named SLFWXBBFKDSWHUBSGO.

7DVNGHILQLWLRQ

Specific messages are to be output depending on the tag state. These messages are to be output depending on changes of state in bits and limit violations. In addition, automatic picture 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 are to be displayed selectively.

,PSOHPHQWDWLRQFRQFHSW

To implement this control action, we use two application windows created under 6PDUW 2EMHFWV$SSOLFDWLRQ:LQGRZ, in which we display the message pictures. In addition, we also use three slider objects created under :LQGRZV2EMHFWV6OLGHU2EMHFW and a check box created under :LQGRZV2EMHFWV&KHFN%R[, with which we enter values and simulate error messages.

,PSOHPHQWLQJLQWKH:LQ&&SURMHFW
6WHS 3URFHGXUHFRQILJXULQJPHVVDJHV

1 2

Create four tags of type 8QVLJQHGELWYDOXH in Tag Management. In our example, we use 8LBSLFWXBPHVVDJHB through 8LBSLFWXBPHVVDJHB. Configure a check box under :LQGRZV2EMHFWV&KHFN%R[; in our example, we use &KHFN%R[. Under 3URSHUWLHV2XWSXW,QSXW6HOHFWHG%R[HV, create a WDJFRQQHFWLRQ to tag 6LBSLFWXBPHVVDJHB. Configure three objects of type :LQGRZV2EMHFWV6OLGHU2EMHFW. in our example, we use 6OLGHU2EMHFW, 6OLGHU2EMHFW, and 6OLGHU2EMHFW. Under &RQILJXUDWLRQ'LDORJ, select tag 6LBSLFWXBPHVVDJHB and set the trigger to 8SRQFKDQJH. Change the 0D[LPXP9DOXH to . In the same way, configure the remaining tags for the other VOLGHUREMHFWV. Open the $ODUP/RJJLQJ editor in the &RQWURO&HQWHU by clicking it with the 5.

Select menu item )LOH6WDUW0HVVDJH:L]DUG and close the first page of the

WinCC Configuration Manual C79000-G8276-C140-01

3-107

6DPSOH3URMHFWSLFWXB



6WHS

3URFHGXUHFRQILJXULQJPHVVDJHV

wizard by clicking 1H[W.

On the page entitled 6HOHFWLQJ0HVVDJH%ORFNV in the section called 6\VWHP EORFNV, select the 'DWH7LPH1XPEHU option. Leave the remaining settings as they are and close the page by clicking 1H[W. On the page entitled &UHDWLQJD /LQH, leave the settings as they are and close the page by clicking 1H[W. On the page entitled 0HVVDJH:LQGRZV, leave the settings as they are and close the page by clicking 1H[W. On the page entitled 3UHVHWWLQJ&ODVVHV, leave the settings as they are and close the page by clicking 1H[W. On the page entitled &KRRVLQJ $UFKLYHV, select the 6KRUW7HUP$UFKLYH)RU0HVVDJHV and close the page by clicking 1H[W. Close the )LQDOH page by clicking $SSO\. Select 0HVVDJHOLQHIRUPDW, 5 the 0HVVDJHOLQHH[DPSOH option in the righthand window and open the properties dialog.

Add the message blocks 0HVVDJHWH[W and 3RLQWRIHUURU by clicking the button and close the window by clicking 2.. 8 Select 0HVVDJHEORFNV and window. 5 the 0HVVDJHWH[W option and call the properties dialog. Change the length to 40 characters. In the same way, change the length of the 3RLQWRIHUURU block to 20 characters.

8'

the 8VHUWH[WEORFN option in the right-hand

5 the 0HVVDJHZLQGRZH[DPSOH option in Select 0HVVDJHZLQGRZWHPSODWHV, the 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 :LQGRZ7\SH section. In our example, we have chosen )LOOLQJV\VWHPPRQLWRULQJ as the window name and )LOOLQJV\VWHP as the window title. On the 0HVVDJH/LQH tab, set the message line format you require WinCC Configuration Manual C79000-G8276-C140-01

3-108



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRQILJXULQJPHVVDJHV

in the example, the previously created H[DPSOHPHVVDJHOLQH format. On the 3DUDPHWHUV tab, select the items /LQH7LWOH and &ROXPQ7LWOH. In the 6WDWXV%DU tab, select 'LVSOD\6WDWXV%DU, set %RWWRP in the $OLJQPHQW section, and under (OHPHQWV2I7KH6WDWXV%DU, select 'DWH and 7LPH. In the 7RROEDU tab, select 'LVSOD\7RROEDU, set 7RS in the $OLJQPHQW section, select DOONH\ERDUGIXQFWLRQV, but deselect the &LW\&DOOIXQFWLRQV check box. Close the window by clicking 2.. 10 Define messages in the table window. To do this, 5 the 1XPEHU column and click $SSHQG1HZ/LQH. Enter (UURU in the &ODVV column and $ODUP in the 7\SH column. In the (YHQWWDJ column, select tag 8LBSLFWXBPHVVDJHB and under (YHQWELW, set the bit number . Enter EUHDNGRZQ as the PHVVDJHWH[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 the tag written to by the FKHFNER[. hasnt already been done. Now 5 the new /LPLWYDOXHPRQLWRULQJ option that has appeared and click the 1HZ option. Select 8LBSLFWXBPHVVDJHB as the tag to be monitored. 5 the new option generated for the tag, select 1HZ and define a limit value and the message number that belongs to it. In our example, we use a +LJK/LPLW9DOXH of  and the 0HVVDJHQXPEHU . A new line has now been added in the table window, in which all you have to enter now is the 0HVVDJHWH[W and the 3RLQWRIHUURU. In the same way, configure other messages for the low limit value and the other tags. Select menu item 2SWLRQV$GG,QV and click /LPLWYDOXHPRQLWRULQJ if this

11

12

option in the right-hand window. 5 the $ODUP option, open the properties 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 scheme for the message type $ODUP:
)DLOXUH

To configure the message colors, select the 0HVVDJHFODVVHV item and

8'

the

We use the following color scheme for the message type )DLOXUH:

We use the following color scheme for the message type :DUQLQJ:

13 14

Save the settings in the $ODUP/RJJLQJ editor.


$SSOLFDWLRQ:LQGRZ

In the picture, configure an application window under 6PDUW2EMHFWV , select $ODUP/RJJLQJ as the :LQGRZ&RQWHQWV and )LOOLQJ PRQLWRULQJ as the 7HPSODWH. In our example, we use the object called $SSOLFDWLRQ :LQGRZ.

WinCC Configuration Manual C79000-G8276-C140-01

3-109

6DPSOH3URMHFWSLFWXB



Configuring Loop in Alarm


6WHS 3URFHGXUHFRQILJXULQJ/RRSLQ$ODUP

The pictures we use in our example to display a /RRSLQ$ODUP are SLFWXBBZLQGRZB through SLFWXBBZLQGRZBFor each of the container objects in the three pictures, a WDJFRQQHFWLRQ is configured to one of the three tags supplied by the VOLGHUREMHFWV; this is done under 3URSHUWLHV7DJ $VVLJQPHQW)LOO/HYHO. In the picture in which the VOLGHUREMHFWV and the FKHFNER[HV are also configured, configure a picture window (6PDUW2EMHFWV3LFWXUH:LQGRZ). In our example, we use 3LFWXUH:LQGRZ and set SLFWXBBZLQGRZBSGO as the picture name. To implement a /RRSLQ$ODUP, create a SURMHFWIXQFWLRQ in the *OREDO6FULSW editor, which uses the name of the picture in which the error has arisen as the transfer parameter. In our sample project, this is the function $ODUP3LFWXUH&KDQJH. The $ODUP/RJJLQJ editor uses the 2SHQ3LFWXUH function by default. Create three alarm lines which react, for example, to a limit value inquiry. In our example, these are messages  through . ' in the /RRSLQ$ODUP column and set the picture name. The picture set is the one in which the corresponding tag, whose limit value is monitored, is displayedThe function$ODUP3LFWXUH&KDQJH is selected as the function name at 3URMHFWIXQFWLRQ. If a relevant error now arises during runtime, you can click the button (Short-Term Archive) in the toolbar of the message window to execute a picture change in the picture.

Configuring a message window in the overview section


6WHS 3URFHGXUHFRQILJXULQJDPHVVDJHZLQGRZLQWKHRYHUYLHZVHFWLRQ

In the $ODUP/RJJLQJ editor, create a new message window template; in our example, we use the template 2YHUYLHZPHVVDJH. Select 0HVVDJHZLQGRZ

5 it, and then click 1HZ. In the *HQHUDO,QIRUPDWLRQ tab, enter WHPSODWHV, the window name and the window title. In our example, we have chosen 2YHUYLHZPHVVDJH as the window name and DODUPV as the window title. Select the 0HVVDJH:LQGRZ option in the :LQGRZ7\SH section. Choose the 6HOHFWLRQ button to open the 6HW6HOHFWLRQ window and deselect message types (UURU and :DUQLQJvia the folder called 0HVVDJH&ODVV(UURU in the window on the right. This means that only messages of type $ODUP are displayed in the overview window.

3-110

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWSLFWXB

6WHS

3URFHGXUHFRQILJXULQJDPHVVDJHZLQGRZLQWKHRYHUYLHZVHFWLRQ

In the 0HVVDJH/LQH tab, set the format entitled 0HVVDJHOLQHH[DPSOH. The 3DUDPHWHUV, 6WDWXV%DU and 7RROEDU tabs can be applied unchanged. 2 In an overview window which is displayed in every plant status, configure an application window under 6PDUW2EMHFWV$SSOLFDWLRQ:LQGRZ and set $ODUP /RJJLQJ as the :LQGRZ&RQWHQWV and 2YHUYLHZPHVVDJH as the 7HPSODWH. In our example, we use the object called $SSOLFDWLRQ:LQGRZ in picture SLFWXBBRYHUYLHZBSGO. Set the size of the window large enough that a message can be displayed. In the overview picture, configure a button object under :LQGRZV2EMHFWV %XWWRQ. In our example, we use the object called %XWWRQ. For this button, create a &DFWLRQ under (YHQWV0RXVH0RXVH$FWLRQ, which opens the message picture SLFWXBBFKDSWHUB. This EXWWRQ can, therefore, be used in every plant status to switch to the message window if an alarm message has been displayed. In the sample project in picture SLFWXBBNH\ERDUGBSGO, a further EXWWRQ has been configured, which can be used to start an automatic message simulation function which generates a message every 10 seconds.

WinCC Configuration Manual C79000-G8276-C140-01

3-111

6DPSOH3URMHFWSLFWXB



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 and picture window name. The name of the picture that is to be displayed in the 3LFWXUH :LQGRZ is the transfer parameter.

1RWHVRQJHQHUDOXVH

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.

3-112

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 $GGLWLRQDO )XQFWLRQV LQ :LQ&& 3URMHFW H[DPSOHBPFS


This project presents examples to the 7DJ/RJJLQJ, $ODUP/RJJLQJ and 5HSRUW'HVLJQHU editors. The examples to this subject are configured in the H[DPSOHB WinCC project.

WinCC Configuration Manual C79000-G8276-C140-01

4-1

6DPSOH3URMHFWH[DPSOHB



 7DJ/RJJLQJ

In runtime, the examples can be selected by clicking on the button displayed above with the . The examples are configured in the pictures H[BBFKDSWHUB3'/ to H[BBFKDSWHUBI3'/.

*HQHUDO,QIRUPDWLRQ
7DJ/RJJLQJ

contains functions for the transfer of data from external and internal WinCC tags. This data can be archived in several ways. In runtime, the data can be displayed in trend or table form.

6LPXODWLRQRI3URFHVV9DOXHV

For the simulation of process values that are archived by 7DJ/RJJLQJ in the example project, a project-internal simulator is available. This simulator is activated by clicking on the corresponding button on the toolbar.

The simulator enables you to supply three distinct internal tags with sinus wave profiles. An additional tag is supplied with the sum of the individual tag values. The profiles of the tag values are displayed in a small trend window.

Below the trend window are three lines consisting of input and output elements. Each of the lines corresponds to a trend profile. The first I/O field allows you to change the amplitude of a trend. The second I/O field sets the frequency of the trend in oscillations per minute. Check boxes allow you to stop each trend simulation. The last I/O field displays the current trend amplitude. The tags *BH[BWOJB,*BH[BWOJB and *BH[BWOJB are supplied with values. The tag *LBH[BWOJB is supplied with the sum of these three tags. If the simulator is deactivated, all tag values will be set to zero again.

4-2

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 &\FOLF&RQWLQXRXV$UFKLYLQJ H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

Process values are to be stored continuously in an archive. The stored data is to be displayed graphically in a trend window. The trend windows toolbar and status bar are realized using standard tools. As an authorized user, the online configuration should be possible. 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 DSSOLFDWLRQZLQGRZ for displaying a trend window is used. The WUHQGZLQGRZWHPSODWH is created in the 7DJ/RJJLQJ editor.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Creation of the tags to be archived in "Tag Management". In the example, the tags *BH[BWOJB,*BH[BWOJB and *BH[BWOJB are archived. These tags are supplied with values by the simulator. In the &RQWURO&HQWHU, open the 7DJ/RJJLQJ editor via a

85

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 3URFHVV9DOXH$UFKLYH as the DUFKLYHW\SH and name 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 the example, the tags *BH[BWOJB,*BH[BWOJB and *BH[BWOJB were

WinCC Configuration Manual C79000-G8276-C140-01

4-3

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

selected. Close the page by clicking on )LQLVK. 4 The right window will display the entry of the newly created archive. Open the 5 on this entry. properties dialog box of the archive by

In the *HQHUDO,QIRUPDWLRQ tab, basic archive parameters can be changed. The DUFKLYHQDPH and the DUFKLYHW\SH have already been set by the Wizard. The DUFKLYHW\SHcan not be changed again. The $UFKLYLQJDW6\VWHP6WDUW box is HQDEOHG. In the $XWKRUL]DWLRQ/HYHO box, 1R $FFHVV3URWHFWLRQ has been set for both access types. This automatically starts the archiving when the system is started and no separate function is needed to enable the archive. The data itself can be used by any user and is not subject to special access protection. No special action is executed while the archive starts. A special action, for example, could inform you about the status of an archive.

4-4

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Additional properties are set in the $UFKLYH3DUDPHWHUV tab. Set  as the number of data records. As the 0HPRU\/RFDWLRQ, select 2QWKH KDUGGLVN. A function can be set as the $FWLRQIRUH[SRUWLQJWKHVKRUWWHUP DUFKLYH that is, executed automatically whenever the short-term archive is full. In the example, however, no action is planned. Select 6KRUWWHUPDUFKLYH as the $UFKLYH7\SH. With these settings, 1000 data records are archived to the hard drive. Once this maximum number of data records has been reached, the oldest archive entries are replaced 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 selected archive tag.

In the $UFKLYH7DJ tab, the basic properties of the tag can be set. The process tag has already been set in the Wizard. You can assign a unique name as the 1DPHRI WKH$UFKLYH7DJ, in the example, the name of the corresponding process tag is

WinCC Configuration Manual C79000-G8276-C140-01

4-5

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

used. In the 6XSSO\LQJ7DJV box, 6\VWHP has been selected and the $UFKLYLQJDW6\VWHP 6WDUW has been HQDEOHG. &\FOLF&RQWLQXRXV has been set as the $UFKLYLQJ7\SH. These settings define that the acquisition of data is started together with the system and performed in constant time cycles until the system is shut down. Additionally, the archived value is not to written to any tag.

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 $FWXDOYDOXH in the 3URFHVVLQJ box. 8QLW will not be selected. "Last Value" is to be saved on error. $UFKLYHXSRQ FKDQJH is not selected.

4-6

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

10 11 12

In the 'LVSOD\ tab, the transfer range of the tag into the archive is set. In the example, 1R'LVSOD\/LPLWDWLRQ is set. In the (YHQWV tab, the example uses no action in the '\QDPLF box to change the archiving cycle. The settings made have to be incorporated into the two other archive tags. To do so, 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 archive tags can be changed via $UFKLYHV3UHVHWWLQJV3URFHVV$UFKLYH and $UFKLYHV 3UHVHWWLQJV$QDORJ7DJ.

This is advantageous, if a large number of similar archives have to be created.

WinCC Configuration Manual C79000-G8276-C140-01

4-7

6DPSOH3URMHFWH[DPSOHB



7UHQG'LVSOD\&RQILJXUDWLRQ
6WHS 3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

Create a new trend window template by 5 on the corresponding entry in the navigation window of the 7DJ/RJJLQJ editor.

The 3URSHUWLHV7UHQG:LQGRZ7HPSODWH dialog box will be displayed. The button opens the 3URSHUWLHVRIWKH7HPSODWH dialog box. General settings for the entire template are made in this dialog. As the 1DPHRIWKH7HPSODWH, the example uses =.B3$B7UHQGWHPSODWHB. In the '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 $OONH\ERDUG)XQFWLRQV checkbox has been selected. Data is to be read from the archive immediately when the SLFWXUHLVRSHQHG. As the &RORU, the background color of the picture is set (RGB Value 231/207/199). Apply the settings made by clicking on the 2. button.

In the 2SHUDWRU$XWKRUL]DWLRQ box, you can determine, if a change in the configuration data is possible in runtime.

4-8

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

The 3HUVLVWHQWLQ57 check-box allows you to determine, if setting changes made in runtime are to be maintained after a picture change. The 3HUVLVWHQWLQ57DQG &6 check-box gives the user the possibility to permanently change the configuration data in runtime. button assigns authorization levels to the functions that only allow The authorized users to make setting changes. In the example, the 3HUVLVWHQWLQ57DQG&6 function has been associated with the (GLW7UHQG7HPSODWH authorization level. This authorization level must first be created in the 8VHU$GPLQLVWUDWRU editor and be assigned to an user.

4 button allows you to add two additional trends. The names of these The trends are displayed in the &KRRVH2EMHFW box.

Select the first trend from the &KRRVH2EMHFW box. In the *HQHUDO,QIRUPDWLRQ tab, the general trend properties are set. In the example, 7UHQG is used as the 1DPHRIWKH7UHQG. In the 'LVSOD\ box, select the check-boxes 'LVSOD\7UHQG, 6KDUHG;$[LV and 6KDUHG<$[LV. Set 5HG as the trend color.

WinCC Configuration Manual C79000-G8276-C140-01

4-9

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

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.

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

4-10

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

is displayed dynamically. The end time of the trend display corresponds to the archiving time of the last archived data record. Newly collected tag values are immediately incorporated into the display. Select the 7LPH5DQJH check-box and the 0LQXWH entry from the list-box. No changes 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 in addition to the current time. If the 7LPH5DQJH check-box is not selected, the displayed time range is determined 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.

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 are shown 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 is not selected. Select &RQQHFW'RWVOLQHDUO\as the 7UHQG'LVSOD\.

WinCC Configuration Manual C79000-G8276-C140-01

4-11

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

For this example, filling out the &RORU/LPLW9DOXHV tab is not necessary. The setting options of this tab are described in the example $UFKLYLQJLI9DOXHLV ([FHHGHG H[BBFKDSWHUBE3'/ in the table 7UHQG'LVSOD\&RQILJXUDWLRQ. Carry out step 5 to 8 for the two other trends. Since shared X and Y axes have been 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 changed correspondingly. Apply the settings made by clicking on 2. and save the changes made in the 7DJ /RJJLQJ editor via )LOH6DYH.

10

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 user logging in is only recognized by 7DJ/RJJLQJ after a new picture has been selected. The procedures for setting up a new user and new authorization levels are explained in the corresponding chapters of the manual 6KXWGRZQ:LQ&&DFFHVVSURWHFWLRQ. The "Login" dialog box is opened via the [Ctrl+O] key combination. This key combination can be set in the +RW.H\V tab of the projects properties dialog box.

4-12

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Creation of a new picture, in the example, this is the H[BBFKDSWHUB3'/. In this picture, a 6PDUW2EMHFW$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 is displayed. Select the 7DJ/RJJLQJ entry. Close the dialog box by clicking on 2..

In the following 7HPSODWH dialog box, select =.B3$B7UHQGWHPSODWHB trend window template. Close the dialog box by clicking on 2..

In the Graphics Designer, the configured $SSOLFDWLRQ:LQGRZ will be displayed as a gray rectangle. The rectangle will be labeled with the name of the selected trend window template.

In the example, a 6PDUW2EMHFW6WDWXV'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 because the 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

WinCC Configuration Manual C79000-G8276-C140-01

4-13

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

supplied with values. 3 To be able to use 7DJ/RJJLQJ during runtime, 7DJ/RJJLQJ5XQWLPH must be enabled first. To do so, check "Tag Logging Runtime" in the "Startup" tab of the &RPSXWHU3URSHUWLHV dialog box. If this is not the case, select the "Computer" entry in the &RQWURO&HQWHU via a and open the &RPSXWHU3URSHUWLHV6WDUWXS7DE by clicking on the
&RPSXWHU3URSHUWLHV

button

button to open the from the dialogs toolbar. Click on the dialog box. In the 6WDUWXS tab, select the 7DJ/RJJLQJ 5XQWLPH check-box.

1RWH

In runtime, the ruler window will be displayed just below the configured DSSOLFDWLRQ ZLQGRZ. The lower left corner of the DSSOLFDWLRQZLQGRZ will correspond to the upper left corner of the ruler window. The width of these two windows is identical.

*HQHUDO$SSOLFDWLRQ1RWHV

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 changing values are to be displayed. In normal cases, slower cycles are sufficient. Fast archiving cycles cause high system loads. Adapt the elements of the toolbar to your own needs. This depends on the extent of influence the user is going to have on the trend display and how much information from the archive is needed.

4-14

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 &\FOLF6HOHFWLYH$UFKLYLQJ H[BBFKDSWHUBD3'/

7DVN'HILQLWLRQ

Multiple process values are to be stored continuously in an archive. In runtime, the archiving is started and stopped via a button. The values are to be graphically displayed in a trend window. The toolbar and status bar is configured in the *UDSKLFV'HVLJQHU using your own objects. One diagram is to be displayed for each process value.

WinCC Configuration Manual C79000-G8276-C140-01

4-15

6DPSOH3URMHFWH[DPSOHB



,PSOHPHQWDWLRQ&RQFHSW

To archive the data to be displayed, a cyclic-selective process value archive is created in the 7DJ/RJJLQJ editor. To realize a graphical display, an DSSOLFDWLRQZLQGRZ for displaying a trend window is used. This is created in the 7DJ/RJJLQJ editor. The required toolbar is made up of multiple :LQGRZV2EMHFWV%XWWRQ, 6PDUW2EMHFWV6WDWXV'LVSOD\V and 6PDUW2EMHFWV *UDSKLF2EMHFWV, the status bar is realized with two :LQGRZV2EMHFWV%XWWRQ. To control the archive, a project function is needed that starts and stops the archiving process.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Open the 7DJ/RJJLQJ editor from the &RQWURO&HQWHU. Create a new 3URFHVV9DOXH$UFKLYH with the archive wizard. In the example, the archive was named =6B3URFHVV9DOXH$UFKLYHB. For the archiving, the tags *BH[BWOJB,*BH[BWOJB and *BH[BWOJB are selected. In the properties dialog box of the process value archive, set the size of the archive to  data records. Accept the presettings for the remaining settings. In the properties dialog box of the process tag, select F\FOLFVHOHFWLYH as $UFKLYLQJ 7\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.

2 3

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 internal tag %,1LBH[BWOJB. This function is called by 7DJ/RJJLQJ for every archiving cycle. It determines, via the return value, if archiving takes place or not (TRUE = archive).

4-16

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

7UHQG'LVSOD\&RQILJXUDWLRQ
6WHS 3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

1 2

Creating a new trend window template. The 3URSHUWLHV7UHQG:LQGRZ7HPSODWH dialog box will be displayed. button opens the 3URSHUWLHVRIWKH7HPSODWH dialog box. The As the template name, the example uses =6B3$B7UHQGWHPSODWHB. No WLWOHEDU, VWDWXVEDU or WRROEDU is required. As the &RORU, the example uses the background color of the picture (RGB Value 231/207/199). Accept the presettings for the remaining settings. No inputs need to be made in the 2SHUDWRU$XWKRUL]DWLRQ field. button allows you to add two additional trends. The trends will then be The displayed in the &KRRVH2EMHFW window. Select the first trend. In the *HQHUDO,QIRUPDWLRQ tab, 7UHQG is displayed as the 1DPHRIWKH7UHQG. In the 'LVSOD\ field, select the 'LVSOD\7UHQG and 'LVSOD\7UHQGV6WDJJHUHG checkboxes. This determines that a separate graph is drawn for each trend. The presettings 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 the 7UHQG'LVSOD\, select 6KRZRQO\GRWV. This type of display facilitates the recognition of time periods where no archiving took place. Accept the presettings of the &RORU/LPLW9DOXHV tab.

3 4

Follow these steps for the two other trends (steps 5 - 8). The archive tag to be displayed must be changed correspondingly, as well as the names and labels of the trends. Click on 2. to apply all the settings made. Save the changes made in the 7DJ /RJJLQJ editor via )LOH6DYH.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

1 2

In Tag Management, two internal tags of the %LQDU\7DJ type are created. In the example, the %,1LBH[BWOJB and %,1LBH[BWOJB tags are used. Creation of a new picture, in the example, this is the H[BBFKDSWHUBD3'/. In this picture, a 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ is configured. Select 7DJ /RJJLQJ as the window content and the =6B3$B7UHQGWHPSODWHB trend window template as the 7HPSODWH. To control the update, a 6PDUW2EMHFW6WDWXV'LVSOD\ is configured. In the example, 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 and assigned to the corresponding pictures. In the example, the bitmaps VWRSWOJEPS

WinCC Configuration Manual C79000-G8276-C140-01

4-17

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

and VWRSJRWOJEPS are used.

A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which simulates the button from the standard toolbar and toggles the status of the tag. The status of this tag should always be zero at the opening of the picture, since the update of the trend window is always initiated at the selection of the picture. This is realized by a 'LUHFW&RQQHFWLRQ at (YHQWV0LVFHOODQHRXV2SHQ 3LFWXUH of the H[BBFKDSWHUBD3'/ picture object, which sets the status of the tag to . pressing of the
%,1LBH[BWOJB

Configure a second 6PDUW2EMHFW6WDWXV'LVSOD\ following the procedure described in step 3. In the example, this is the 6WDWXV'LVSOD\ object. It will control the archiving process. The object is connected to the %,1LBH[BWOJB tag and uses the $UFKLYHEPS / $UFKLYHLQYEPS bitmaps. A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which toggles the %,1LBH[BWOJB tag queried by the =6B3$B6WDUW project function.

To be able to navigate in the archive while the update is stopped, replicas of the four navigation buttons of the standard toolbar are required. To implement this, four :LQGRZV2EMHFW%XWWRQV are configured. In the example, these are the %XWWRQ, %XWWRQ, %XWWRQ and %XWWRQ objects. &$FWLRQV are created at (YHQWV0RXVH0RXVH$FWLRQ, which simulate the activation of the standard buttons. Additionally, a 6PDUW2EMHFW*UDSKLF2EMHFW is required that disables the buttons in case of an active update. In the example, this is the *UDSKLF2EMHFW object. The bitmap displayed by the object shows the four buttons in an inoperational state (3IHLOHGLVEPS). Create a '\QDPLF'LDORJ at 3URSHUWLHV

4-18

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU 0LVFHOODQHRXV

'LVSOD\, which controls the visibility of the buttons depending on the status of the %,1LBH[BWOJB tag (this tag contains information about the update).

To display the status bar, two :LQGRZV2EMHFWV%XWWRQV are configured. In the example, these are the %XWWRQ and %XWWRQ objects. %XWWRQV are used for the text display because it is easy to add 3D borders (no additional objects are required for generating the button border). Create a '\QDPLF'LDORJ at the %XWWRQ object at 3URSHUWLHV)RQW7H[W, which returns to the property, depending on the %,1LBH[BWOJB tag, either the text $UFKLYLQJ6WDUWHG or $UFKLYLQJ6WRSSHG.

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 in greater detail in the 5HSRUW'HVLJQHU chapter, example 3ULQW2XWWKH7UHQG:LQGRZ LQ5XQWLPH H[BBFKDSWHUBD3'/ .

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 effect as clicking on the 6WRS*R%XWWRQ of the standard toolbar. The transfer parameter indicates 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.

WinCC Configuration Manual C79000-G8276-C140-01

4-19

6DPSOH3URMHFWH[DPSOHB



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'DWD5HFRUG button 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 be found in the manual of the *OREDO6FULSW editor.

*HQHUDO$SSOLFDWLRQ1RWHV

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 changing values are to be displayed. In normal cases, slower cycles are sufficient. Fast archiving cycles cause high system loads. The archiving start, as well as the archiving end, can be made dependent on special events, which can be something other than the activation of a button. The appearance and required elements of the toolbar should be tailored to meet your needs. The same applies for the status bar. The trend display type selected enhances the visibility of time ranges, during which no archiving took place. In any other display type, all dots are shown connected to each other; even ranges where no archiving took place are bridged by a line.

4-20

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 $UFKLYLQJLI9DOXHLV([FHHGHG H[BBFKDSWHUBE3'/

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 be displayed as a trend. The table content should only be displayed if the user has the appropriate authorization level. The option of entering values directly into the table should also be authorization protected. The "System Login" dialog box should be accessible by a button. The example uses 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 should contain the name of the currently logged in user.

,PSOHPHQWDWLRQ&RQFHSW

To archive the displayed data, create an acyclic process value archive in the 7DJ/RJJLQJ editor. To implement the graphical display, two DSSOLFDWLRQZLQGRZV are used. One displays the trend and the other the table window. The WUHQGZLQGRZWHPSODWH and the WDEOHZLQGRZ WHPSODWH to be displayed are created in the 7DJ/RJJLQJ editor. The required toolbar is made up of multiple :LQGRZV2EMHFWV%XWWRQ, 6PDUW2EMHFWV 6WDWXV'LVSOD\V and 6PDUW2EMHFWV*UDSKLF2EMHFWV, the status bar is realized using two :LQGRZV2EMHFWV%XWWRQ. To control the archive, a project function is created. This function triggers the archiving if the process value exceeds a set limit value.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Create a new 3URFHVV9DOXH$UFKLYH with the archive wizard. In the example, the archive was named $=B3URFHVV9DOXH$UFKLYHB. The tag to be archived was *LBH[BWOJB. In the example project, this tag is supplied with the sum of the three sinus wave profiles by the simulator. In the properties dialog box of the process value archive, set the size of the archive to  data records. As DXWKRUL]DWLRQOHYHO for read and write access, set two 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 $UFKLYLQJ 7\SH. This gives you the option of setting a 6WDUW(YHQW in the (YHQWV tab. In the example, the project function $UFKLYH&RQWURO is set as the 6WDUW(YHQW. Accept the presettings for the remaining settings.

WinCC Configuration Manual C79000-G8276-C140-01

4-21

6DPSOH3URMHFWH[DPSOHB



"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 is reset, 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 be set. This function is automatically invoked by 7DJ/RJJLQJ. Archiving is performed if WKH UHWXUQYDOXHVWDWXVRIWKHIXQFWLRQGLIIHUVIURPWKHSUHYLRXVFDOO (on the other hand, in a cyclic-selective archive, the archiving is started if the return value is TRUE).

7DEOH'LVSOD\&RQILJXUDWLRQ
6WHS 3URFHGXUH7DEOH'LVSOD\&RQILJXUDWLRQ

Create a new table window template by 5 on the corresponding entry in the navigation window of the 7DJ/RJJLQJ editor.

The 3URSHUWLHV7DEOH:LQGRZ7HPSODWH dialog box will be displayed. The button opens the 3URSHUWLHVRIWKH7HPSODWH dialog box. As the template name, the example uses $=B3$B7DEOHWHPSODWH. No WLWOHEDU, VWDWXVEDU or WRROEDU is required. As the &RORU, the example uses the background color of the picture (RGB Value 231/207/199). Accept the presettings for the remaining settings.

4-22

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH7DEOH'LVSOD\&RQILJXUDWLRQ

3 4

No inputs need to be made in the 2SHUDWRU$XWKRUL]DWLRQ field. In the *HQHUDO,QIRUPDWLRQ tab, &ROXPQ is displayed as the &ROXPQ+HDGLQJ. In the 'LVSOD\ field, select the &ROXPQFDQEHHGLWHG and 6KDUHFROXPQ checkboxes. The presettings can be accepted for the remaining settings.

In the 7DJ tab, the *LBH[BWOJB archive tag from the $=B3URFHVV9DOXH$UFKLYHB archive is selected.

Click on 2. to apply all the settings made.

WinCC Configuration Manual C79000-G8276-C140-01

4-23

6DPSOH3URMHFWH[DPSOHB



7UHQG'LVSOD\&RQILJXUDWLRQ
6WHS 3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

For the *LBH[BWOJB tag, create a cyclic-continuous process value archive with 120 data records and an archiving cycle of 500 ms. In the example, this is the =6B3URFHVV9DOXH$UFKLYHB archive. Creating a new trend window template. The 3URSHUWLHV7UHQG:LQGRZ7HPSODWH dialog box will be displayed. button opens the 3URSHUWLHVRIWKH7HPSODWH dialog box. The As the template name, the example uses =.B3$B7UHQGWHPSODWHB. No WLWOHEDU, VWDWXVEDU or WRROEDU is required. As the &RORU, the example uses the background color of the picture (RGB Value 231/207/199). Accept the presettings for the remaining settings. No inputs need to be made in the 2SHUDWRU$XWKRUL]DWLRQ field. In the *HQHUDO,QIRUPDWLRQ tab, 7UHQG is displayed as the 1DPHRIWKH7UHQG. In the 'LVSOD\ field, select the 'LVSOD\WUHQG check-box. Choose blue as the color of the 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 )LOODUHD LQWHUSRODWHGWUHQG. This display type allows you to better emphasize areas, where value overflows have occurred. Accept the presettings for the remaining settings. In the &RORU/LPLW9DOXHV 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 of 55. Accept the presettings for the remaining settings.

2 3

4 5

4-24

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH7UHQG'LVSOD\&RQILJXUDWLRQ

Click on 2. to apply all the settings made. Save the changes made in the 7DJ /RJJLQJ editor via )LOH6DYH.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

In Tag Management, two internal tags of the %LQDU\7DJ type are created. In the example, the %,1LBH[BWOJB and %,1LBH[BWOJB tags are used. Additionally, the #&XUUHQW8VHU tag of the type 7H[W7DJ%LW&KDUDFWHU6HW, with a length of  characters, is required. This tag is automatically supplied with the current user name by the system. Creation of a new picture, in the example, this is the H[BBFKDSWHUBE3'/. In this picture, a 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ is configured. In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select 7DJ/RJJLQJ as the window content and the $=B3$B7DEOHWHPSODWH as the 7HPSODWH. To control the update, a 6PDUW2EMHFW6WDWXV'LVSOD\ is configured. In the example, 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 the corresponding pictures. In the example, the bitmaps VWRSWOJEPS and VWRSJR WOJEPS are used. A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which simulates the pressing of the
%,1LBH[BWOJB

button from the standard toolbar and toggles the status of the tag. The status of this tag should always be zero at the opening of the picture, since

WinCC Configuration Manual C79000-G8276-C140-01

4-25

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

the update of the table window is always initiated at the selection of the picture. This is realized by a &$FWLRQ at (YHQWV0LVFHOODQHRXV2SHQ3LFWXUH of the H[BBFKDSWHUBE3'/ picture object, which sets the status of the tag to . 4 Configure a second 6PDUW2EMHFW6WDWXV'LVSOD\ following the procedure described in step 3. In the example, this is the 6WDWXV'LVSOD\ object. This object controls the editability of the table. The object is connected to the %,1LBH[BWOJB tag and uses the (GLWEPS / (GLW LQYEPS bitmaps. A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which simulates the edit button from the standard toolbar and toggles the status of pressing of the the %,1LBH[BWOJB tag. Via 3URSHUWLHV0LVFHOODQHRXV3DVVZRUG, set the same authorization level for the %XWWRQ as for the archives write access. In the example, this is the (GLW 7DEOH authorization level. The status of the %,1LBH[BWOJB tag should always be zero at the opening of the picture, since the editability of the table windows is always turned off at the selection of the picture. This is realized by expanding the &$FWLRQ at (YHQWV 0LVFHOODQHRXV2SHQ3LFWXUH of the H[BBFKDSWHUBE3'/ 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 the editability is active, replicas of the four navigation buttons of the standard toolbar are required. To implement this, four :LQGRZV2EMHFW%XWWRQV are configured. In the example, these are the %XWWRQ, %XWWRQ, %XWWRQ and %XWWRQ objects. &$FWLRQV are created at (YHQWV0RXVH0RXVH$FWLRQ, which simulate the activation of the standard buttons. Additionally, a 6PDUW2EMHFW*UDSKLF2EMHFW is required that disables the buttons in case of an active update and active editability. In the example, this is the *UDSKLF2EMHFW object. The bitmap displayed by the object shows the four buttons in an inoperational state (3IHLOHGLVEPS). Create a '\QDPLF'LDORJ at 3URSHUWLHV0LVFHOODQHRXV'LVSOD\, which controls the visibility of the buttons depending on the states of the %,1LBH[BWOJB and %,1LBH[BWOJB tags. 6 An additional 6PDUW2EMHFW*UDSKLF2EMHFW is needed that disables the button for controlling the update while editability is active. In the example, this is the *UDSKLF2EMHFW 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 VWRSGLVWOJEPS. The object must be positioned exactly on top of the 6WDWXV'LVSOD\ object.

Configure two additional :LQGRZV2EMHFWV%XWWRQV that take on the function and the 6HOHFW7LPH5DQJH of the buttons for opening the parameter dialog boxes. In the example, these are the %XWWRQ and %XWWRQ objects.

Configure an additional :LQGRZV2EMHFW%XWWRQ. In the example, this is the

4-26

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

object. This button accesses the 6\VWHP/RJLQ dialog box. To do so, create a &$FWLRQ at (YHQWV0RXVH3UHVV/HIW, which calls the required API function.
%XWWRQ

To display the status bar, two :LQGRZV2EMHFWV%XWWRQV are configured. In the example, these are the %XWWRQ and %XWWRQ objects. Create a '\QDPLF'LDORJ at the %XWWRQ object at 3URSHUWLHV)RQW7H[W, which returns to the property, depending on the %,1LBH[BWOJB tag, either the text 8SGDWH6WDUWHG or 8SGDWH6WRSSHG. At %XWWRQ at 3URSHUWLHV)RQW7H[W, configure a WDJFRQQHFWLRQ to the #&XUUHQW8VHU tag and set the trigger to "upon change". Clicking on this button displays the name of the current user. Configure an additional 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ . In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select 7DJ/RJJLQJ as the window content and the =.B3$B7UHQGWHPSODWHBas the 7HPSODWH.

10

1RWH

The usage and changing of data is password protected. In the example project, access to the archive data is gained via the login name XVHU and the password WDJORJJLQJ. Via the login name 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 the corresponding 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 as clicking on the (GLW%XWWRQ of the standard toolbar. The transfer parameter indicates 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 edit function.

WinCC Configuration Manual C79000-G8276-C140-01

4-27

6DPSOH3URMHFWH[DPSOHB



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'DWD5HFRUG button 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$SSOLFDWLRQ1RWHV

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 corresponding project function has to be created. The appearance and required elements of the toolbar should be tailored to meet your needs. The same applies for the status bar.

4-28

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 8VHUGHILQHGWDEOHOD\RXW H[BBFKDSWHUBF3'/

7DVN'HILQLWLRQ

A process value is to be acquired cyclically and its mean, maximum and minimum values are to be generated every 10 seconds. These values are to be stored in the configured archive. 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 of 7DJ/RJJLQJ are insufficient to realize a table layout.

,PSOHPHQWDWLRQ&RQFHSW

To archive the data, create a cyclic-continuous process value archive in the 7DJ/RJJLQJ editor. To implement the graphical display, each line of the table uses, depending on the type of data to be displayed, either a 6WDQGDUG2EMHFW6WDWLF7H[W or a 6PDUW2EMHFW,2)LHOG . The data is read from the database table of the appropriate archive via API functions.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

In Tag Management, create three tags of the type )ORDWLQJ3RLQW1XPEHU%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 (in addition). Create a new 3URFHVV9DOXH$UFKLYH with the archive wizard. In the example, the archive was named =.B3URFHVV9DOXH$UFKLYHB. As the archiving tag, the *LBH[BWOJB tag was selected three times. In the properties dialog box of the process value archive, set the size of the archive to  data records. Accept the presettings for the remaining settings. In the *HQHUDO,QIRUPDWLRQ tab of the first process tags properties dialog box, enter 0D[LPXP9DOXH as the 1DPHRIWKH$UFKLYH7DJ. In the $OVRSXWDUFKLYHG YDOXHLQWDJ field, select the *LBH[BWOJB tag. This tag allows you to react to the archiving of a value with a &$FWLRQ. This is accomplished, if the &$FWLRQ is triggered 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[LPXP9DOXH check-box. This causes the selected tag to be acquired every 500ms and be archived every 10s. The largest value is archived that occurred during the 10s period.

3 4

WinCC Configuration Manual C79000-G8276-C140-01

4-29

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

The presettings can be accepted for the remaining settings. Carry out step 3 to 4 for the two other archive tags. However, for 3URFHVVLQJ select 0LQLPXP9DOXH and 0HDQ9DOXH. The 1DPHRI WKH$UFKLYH7DJ should reflect this selection.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

1 2

In Tag Management, two internal tags of the %LQDU\7DJ type are created. In the example, these are the %,1LBH[BWOJB and )/$*B7DEOH*HW2XWSXW9DOXH tags. Create a project function which instructs 7DJ/RJJLQJ to transfer data from the archive to another function (callback function). This function is called once for each data record and receives information about that data record in the form of a special structure type. The transferred data is stored in a static array of this structure type. In the example, the (QXPHUDWH6XSHU$UFKLYH'DWD and *HW$UFKLYH'DWD&DOOEDFN functions 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 project function is used. The call of this function is integrated into the &$FWLRQ at (YHQWV 0LVFHOODQHRXV2SHQ3LFWXUH of the H[BBVWDUWSLFWXUHB3'/ start picture. In the example, this function is named &UHDWH([WHUQDO.

Creation of a new picture, in the example, this is the H[BBFKDSWHUBE3'/. The user defined table should be able to display 10 lines. To display data in the first column, 10 (one for each line) 6WDQGDUG2EMHFWV6WDWLF7H[WV are used, which display the time and date. For the additional columns, 6PDUW2EMHFWV ,2)LHOGV are used. As object names in the first column, use 6WDWLF7H[W to 6WDWLF7H[W, where the number defines the line. The numbering is from bottom to top, since the last line contains the most current data. The ,2)LHOGV use code numbers as their name. The first digit indicates the column number, the following digit the line number.

4-30

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Create a &$FWLRQ for each 6WDWLF7H[W at 3URSHUWLHV)RQW7H[W. This action reads, with respect to its own object number, the date to be displayed from the callback function. This function is triggered upon the change of the )/$*B7DEOH*HW2XWSXW9DOXH tag. The status of this tag will be changed, if the archive has received new data and this data has been read. Corresponding to that, create a &$FWLRQ for each ,2)LHOG at 3URSHUWLHV 2XWSXW,QSXW2XWSXW9DOXH. This function also has the task to read the data record, assigned to their object, from the callback function. To control the update, a 6PDUW2EMHFW6WDWXV'LVSOD\ is configured. In the example, 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 the corresponding pictures. In the example, the bitmaps VWRSWOJEPS and VWRSJR WOJEPS are used. Create a &$FWLRQ at (YHQWV0RXVH3UHVV/HIW, which toggles the status of the %,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 the update of the table window is always initiated at the selection of the picture. This is realized via a &$FWLRQ at (YHQWV0LVFHOODQHRXV2SHQ3LFWXUH of the H[BBFKDSWHUBF3'/ picture object. This &$FWLRQ sets the status of the tag to 758( and reads the archive one time.

Create a &$FWLRQ for 6WDWXVGLVSOD\ at 3URSHUWLHV*HRPHWU\:LGWK. This action will, depending on the status of the %,1LBH[BWOJB tag, read the archive and 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 which this value will be stored (in addition) if a value is archived. It should also be able to react to the next archiving, if the value archived is identical to the previous one. To do so, the *LBH[BWOJB tag is set to a value, which can not be attained

WinCC Configuration Manual C79000-G8276-C140-01

4-31

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*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 navigation buttons are required. To implement this, four :LQGRZV2EMHFW%XWWRQV are configured. In the example, these are the %XWWRQ, %XWWRQ, %XWWRQ and %XWWRQ objects. Create &$FWLRQV at (YHQWV0RXVH0RXVH$FWLRQ. These actions write a new value to the external C tag GZ2IIVHW. Additionally, the trigger tag )/$*B7DEOH*HW2XWSXW9DOXH is toggled to achieve an update of the display. Also, a 6PDUW2EMHFW*UDSKLF2EMHFW is required that disables the buttons in case of an active update. In the example, this is realized via the *UDSKLF2EMHFW object. The bitmap displayed by the object shows the four buttons in an inoperational state (3IHLOHGLVEPS). At 3URSHUWLHV0LVFHOODQHRXV'LVSOD\, create a WDJFRQQHFWLRQ 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 sysTo.wMonth sysTo.wDay sysTo.wHour sysTo.wMinute sysTo.wSecond = = = = = = (WORD)(TimeStruct->tm_year+1900); (WORD)(TimeStruct->tm_mon+1); (WORD)(TimeStruct->tm_mday); (WORD)(TimeStruct->tm_hour); (WORD)(TimeStruct->tm_min); (WORD)(TimeStruct->tm_sec); = = = = = = 1997; 1; 1; 0; 0; 0;

sysFrom.wYear sysFrom.wMonth sysFrom.wDay sysFrom.wHour sysFrom.wMinute sysFrom.wSecond

Call(&GAD,(PVOID)0); if (TLGConnect( NULL , &Error )==FALSE) { printf("Error: %s\r\n",Error.szErrorText);

4-32

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 read from the archive. A fixed time is set for the start time and the current system time for the 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 0HDQ9DOXH archive tags via the 7/**HW$UFKLYH'DWD function. Determines the number of values read. This is done via the help function &DOO, which calls the *HW$UFKLYH'DWD&DOOEDFN function and sets a value of 4 for the OS8VHU parameter. Abortion of the connection to 7DJ/RJJLQJ.

WinCC Configuration Manual C79000-G8276-C140-01

4-33

6DPSOH3URMHFWH[DPSOHB



Callback Function
BOOL GetArchiveDataCallback (PTLG_GETARCHIVEDATA lpUser) { 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; lpGAD, PVOID

4-34

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 type TLG_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 called by Tag Logging. In this case, the transferred structure OS*$' will be stored in the corresponding archive. If the transfer parameter OS8VHU contains the value 0, an initialization run has been performed. 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 is requested. This number is then stored in the transferred structure as the structure member GZ)ODJV. If the transfer parameter OS8VHU contains the value 7, the stored tag value of an ,2)LHOG or 6WDWLF7H[W object is requested. From which position of the table the tag is requested, is determined by the transferred structure via the VW7LPHZ0RQWK and VW7LPHZ'D\ structure members.

WinCC Configuration Manual C79000-G8276-C140-01

4-35

6DPSOH3URMHFWH[DPSOHB



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,G AD.stTime.wHour,GAD.stTime.wMinute,GAD.stTime.wSecond); return szTime; }

The VW7LPHZ0RQWK and VW7LPHZ'D\ structure members of the *$' structure to be transferred are supplied with the column number or calculated data record number. The object name contains information about the data record number. The *HW$UFKLYH'DWD&DOOEDFN function is called with a OS8VHU transfer parameter value of 7, i.e. a value is requested. The date value of the transferred structure *$' is stored in the VW7LPH structure member. From this, the text to be displayed is formed. The text is returned to the property 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;

4-36

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 VW7LPHZ0RQWK and VW7LPHZ'D\ structure members of the *$' structure to be transferred are supplied with the column number or calculated data record number. The *HW$UFKLYH'DWD&DOOEDFN function is called with a OS8VHU transfer parameter value of 7, i.e. a value is requested. The tag value of the transferred structure *$' is stored in the GR9DOXH structure member and is used as a return value.
1RWH

The toolbar contains the button to set the parameters of the table. This button accesses a dialog box that allows you to set the colors of the various table elements. A short description on this topic can be found in the example 'LDORJ%R[HVIRU6HWWLQJ&RORUV H[BBFKDSWHUBF .

*HQHUDO$SSOLFDWLRQ1RWHV

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 is needed, the C-actions and project functions must also be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

4-37

6DPSOH3URMHFWH[DPSOHB



 $UFKLYLQJRIELQDU\WDJV H[BBFKDSWHUBG3'/

7DVN'HILQLWLRQ

The switching operations of three motors are to be stored in an archive. If a motor is selected via , a table containing the switching operations for a time period of one day will 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 for three binary tags in the 7DJ/RJJLQJ editor. Create a separate table window template for each tag. To realize the graphical display, a 6PDUW2EMHFW3LFWXUH:LQGRZ is used, which displays a different picture depending on the selected motor. Each of the pictures contains a 6PDUW 2EMHFW$SSOLFDWLRQ:LQGRZ, which will display the table window template.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Creation of four tags in "Tag Management". In the example, these are the %,1LBH[BWOJBP,%,1LBH[BWOJBP and %,1LBH[BWOJBP tags of the %LQDU\7DJ type, and the 8LBH[BWOJB tag of the 8QVLJQHG%LW9DOXH type. Create a new 3URFHVV9DOXH$UFKLYH with the archive wizard. In the example, the archive was named =.B3URFHVV9DOXH$UFKLYHB. For the archiving, the %,1LBH[BWOJBP,%,1LBH[BWOJBP and %,1LBH[BWOJBP tags are selected. In the properties dialog box of the process value archive, set the size of the archive to  data records. Accept the presettings for the remaining settings. In the properties dialog box of the first process tags 3DUDPHWHUV tab, select RQHYHU\VLJQDOFKDQJH from the $UFKLYLQJ field. In the 1DPHRI6WDWHV field, enter 0RWRU2II for 6WDWH and 0RWRU2Q 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.

3 4

4-38

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

7DEOH'LVSOD\&RQILJXUDWLRQ
6WHS 3URFHGXUH7DEOH'LVSOD\&RQILJXUDWLRQ

Creating a new table window template. The 3URSHUWLHV7DEOH:LQGRZ7HPSODWH dialog box will be displayed. The button opens the 3URSHUWLHVRIWKH 7HPSODWH dialog box. As the template name, the example uses =.B3$B7DEOHWHPSODWHBD. A WLWOHEDU and 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 No inputs need to be made in the 2SHUDWRU$XWKRUL]DWLRQ field. In the *HQHUDO,QIRUPDWLRQ tab, enter 6WDWH as the &ROXPQ+HDGLQJ. In the 'LVSOD\ field, select the 6KDUH&ROXPQ check-box. Also select the 7LPHUDQJH check-box and set 'D\. The presettings can be accepted for the remaining settings.

2 3

WinCC Configuration Manual C79000-G8276-C140-01

4-39

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH7DEOH'LVSOD\&RQILJXUDWLRQ

In the 7DJ tab, the *LBH[BWOJBP archive tag from the =.B3URFHVV9DOXH$UFKLYHB archive is selected. Click on 2. to apply all the settings made. Table templates must also be created for the two other archive tags. Follow the previous configuration steps. The only difference lies in the selection of the tags. The example uses the names =.B3$B7DEOHWHPSODWHBE and =.B3$B7DEOHWHPSODWHBF for the other templates.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

A separate picture must be created for each table template. In the example, these are the H[BBDSSOLFDWLRQB, H[BBDSSOLFDWLRQB and H[BBDSSOLFDWLRQB pictures. Each of these pictures contains a 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ. For each of these objects, 7DJ/RJJLQJ is set as the :LQGRZ&RQWHQW and one of the previously created table templates as the 7HPSODWH. The geometry of the pictures is tuned to the geometry of the $SSOLFDWLRQ:LQGRZV. Creation of a new picture, in the example, this is the H[BBFKDSWHUBG3'/ picture. The motors to be displayed each consist of a 6WDQGDUG2EMHFW&LUFOH, a 6WDQGDUG2EMHFW3RO\JRQ and a 6WDQGDUG2EMHFW6WDWLF7H[W. The background color of the circle is changed via a '\QDPLF'LDORJ depending on the status 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 0RXVH0RXVH$FWLRQ, which writes the number of the motor to the 8LBH[BWOJB tag. Two :LQGRZV2EMHFWV%XWWRQV are assigned to each motor. These buttons control the tags assigned to the motors via 'LUHFW&RQQHFWLRQV. To be able highlight the currently selected motor, assign each motor a 6WDQGDUG 2EMHFW5HFWDQJOH.
3URSHUWLHV

2 3

4 5

Select the dotted line via 3URSHUWLHV6W\OHV/LQH6W\OH and 7UDQVSDUHQW via 6W\OHV)LOO3DWWHUQ.

Use a '\QDPLF'LDORJ (for each rectangle) at 3URSHUWLHV0LVFHOODQHRXV to make the 5HFWDQJOH only visible if the content of the 8LBH[BWOJB tag agrees with its own object number.
'LVSOD\

Configure a 6PDUW2EMHFW3LFWXUH:LQGRZ , in the example, the 3LFWXUH :LQGRZ object is used. Via 3URSHUWLHV0LVFHOODQHRXV, set the 0RYDEOH, %RUGHU, 7LWOH and &DQ%H &ORVHG properties to \HV. Create a '\QDPLF'LDORJ at 3URSHUWLHV0LVFHOODQHRXV'LVSOD\, which makes the 3LFWXUH:LQGRZ visible if the 8LBH[BWOJB tag has a value greater than 0, i.e. a motor has been selected. Create a '\QDPLF'LDORJ at 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, which, depending on the content of the 8LBH[BWOJB tag, displays the

4-40

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

corresponding picture in the 3LFWXUH:LQGRZ.

Create a &$FWLRQ at (YHQWV3URSHUW\7RSLFV0LVFHOODQHRXV'LVSOD\, which sets the 8LBH[BWOJB tag to 0 if the 3LFWXUH:LQGRZ is invisible. This ensures that the selection frame around the current motor is also invisible.

*HQHUDO$SSOLFDWLRQ1RWHV

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.

WinCC Configuration Manual C79000-G8276-C140-01

4-41

6DPSOH3URMHFWH[DPSOHB



 $UFKLYLQJDW6HW7LPHV H[BBFKDSWHUBH3'/

7DVN'HILQLWLRQ

A cyclic-continuous process value archive is to acquire process values in one second cycles. 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 be realized 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 &\FOH7LPH needs to be set up. This cycle 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 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ.

&UHDWLQJDQHZ&\FOH7LPH
6WHS 3URFHGXUH&UHDWLQJDQHZ&\FOH7LPH 7LPHU

Open the 7DJ/RJJLQJ editor from the &RQWURO&HQWHU. Create a new 7LPHU by on this point in the navigation window.

85

The properties dialog box of the new 7LPHU will be displayed. The example uses PLQ6WDUW as the QDPH of the 7LPHU. As the %DVH select  0LQXWH and as the )DFWRU choose . The )DFWRU also allows you to configure, for example, cycles of 4 or 6 minutes. In the 6WDUWLQJ3RLQWRIWKH&\FOH field, select the (QWHUWKH6WDUWLQJ3RLQWRIWKH&\FOH check-box. Enter  into every timer input field. This has the effect that the cycle will be triggered at the first full minute after runtime has been activated. If an actual time would be entered, the cycle would be triggered for the first time at the indicated time.

4-42

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH&UHDWLQJDQHZ&\FOH7LPH 7LPHU

Close the properties dialog box by clicking on 2.. The window to the right will now display the newly created 7LPHU in addition to the default timers.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Create a new 3URFHVV9DOXH$UFKLYH with the archive wizard. In the example, the archive 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 the simulator.

WinCC Configuration Manual C79000-G8276-C140-01

4-43

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

In the properties dialog box of the process value archive, accept the presettings displayed by the wizard. 2 In the properties dialog box of the first process tags 3DUDPHWHUV tab, select  6HFRQG as the $FTXLVLWLRQ cycle in the &\FOH field. As $UFKLYLQJ, set  * PLQ 6WDUW. 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 3URFHGXUH7DEOH'LVSOD\&RQILJXUDWLRQ

Creating a new table window template. The 3URSHUWLHV7DEOH:LQGRZ7HPSODWH dialog box will be displayed. The button opens the 3URSHUWLHVRIWKH 7HPSODWH dialog box. As the template name, the example uses =.B3$B7DEOHWHPSODWHB. A VWDWXVEDU and WRROEDU is required. Select the desired elements for the WRROEDU via the button. No inputs need to be made in the 2SHUDWRU$XWKRUL]DWLRQ field. The button allows you to add two additional columns. The columns will

2 3

4-44

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH7DEOH'LVSOD\&RQILJXUDWLRQ

then be displayed in the &KRRVH2EMHFW window. Select the first column. In the *HQHUDO,QIRUPDWLRQ tab, enter *BH[BWOJB as the &ROXPQ+HDGLQJ. In the 'LVSOD\ field, select the 6KDUH&ROXPQ check-box. Also select the 7LPHUDQJH check-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 the settings made. Carry out step 3 to 4 for the second and third column. However, the &ROXPQ +HDGLQJ and $UFKLYH7DJ must be adapted. In the example project, the colors of the individual columns have been adapted to the colors used in the simulator window for the individual trends.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Creation of a new picture, in the example, this is the H[BBFKDSWHUBH3'/ picture. In this picture, a 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ is configured. In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select 7DJ/RJJLQJ as the window content and the =.B3$B7DEOHWHPSODWHBas the 7HPSODWH.

1RWH

A brief explanation about the other configuration settings made for the H[BBFKDSWHUBH3'/ picture in the *UDSKLFV'HVLJQHU can be found in example  %DU*UDSK'LVSOD\ H[BBFKDSWHUBH .

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The described configuration allows you to start archiving at set times. Also, values can be 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 to start time and time base.

WinCC Configuration Manual C79000-G8276-C140-01

4-45

6DPSOH3URMHFWH[DPSOHB



 ([SRUWLQJDQ$UFKLYH H[BBFKDSWHUBI3'/

7DVN'HILQLWLRQ

A cyclic-continuous process value archive is to be exported to a CSV file, once the maximum number of data records the archive can store has been reached. The archive is to be 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 bar is 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 project functions are created. To display the data, a table template is created. The toolbar is realized using multiple :LQGRZV2EMHFWV%XWWRQV and 6PDUW2EMHFWV6WDWXV'LVSOD\V.

&UHDWLRQRID3URFHVV9DOXH$UFKLYH
6WHS 3URFHGXUH&UHDWLRQRID3URFHVV9DOXH$UFKLYH

Create a new 3URFHVV9DOXH$UFKLYH with the archive wizard. In the example, the archive was named =.B3URFHVV9DOXH$UFKLYHB. The tag to be archived was *LBH[BWOJB. In the example project, this tag is supplied with the sum of the three trend profiles by the simulator. In the properties dialog box of the process value archive, set the size of the archive to  data records. As the $FWLRQIRU([SRUWLQJWKH6KRUW7HUP$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 3URFHGXUH7HQG'LVSOD\&RQILJXUDWLRQ

Creation of a new table window template. The 3URSHUWLHV7DEOH:LQGRZ dialog box will be displayed. The button opens the dialog box. As the template name, the example uses =.B3$B7UHQGWHPSODWHB. No WLWOHEDU, VWDWXVEDU or WRROEDU is required. Accept the presettings for the remaining settings.
7HPSODWH 3URSHUWLHVRIWKH7HPSODWH

2 3

No inputs need to be made in the 2SHUDWRU$XWKRUL]DWLRQ field. In the *HQHUDO,QIRUPDWLRQ tab, 7UHQG is displayed as the 1DPHRIWKH7UHQG. In

4-46

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH7HQG'LVSOD\&RQILJXUDWLRQ

the 'LVSOD\ field, select the 'LVSOD\7UHQG and 'LVSOD\7UHQGV9HUWLFDOO\ checkboxes, and then the IURPWKHWRS 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 the remaining 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 6WHSSHG 7UHQGV. Accept the presettings for the remaining settings. Accept the presettings of the &RORU/LPLW9DOXHV tab. 4 Apply the settings made by clicking on 2. and save the changes made in the 7DJ /RJJLQJ editor via )LOH6DYH.

Project Function for Exporting the Archive


void ActionForExportingArchive (LPTSTR lpszArchivNameReturn, LPTSTR lpszVariablenName , 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 ibs.sysFrom.wMonth ibs.sysFrom.wDay ibs.sysFrom.wHour ibs.sysFrom.wMinute ibs.sysFrom.wSecond ibs.sysTo.wYear ibs.sysTo.wMonth ibs.sysTo.wDay = = = = = = 1997; 1; 1; 0; 0; 0;

= (WORD)(TimeStruct->tm_year+1900); = (WORD)(TimeStruct->tm_mon+1); = (WORD)(TimeStruct->tm_mday);

WinCC Configuration Manual C79000-G8276-C140-01

4-47

6DPSOH3URMHFWH[DPSOHB



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 in TLGGetBackupSize(...)[%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 also contains the path. Determination of the system time. Definition of the start and end time, between which the archiving times of the data to be exported 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.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

In Tag Management, three tags of the %LQDU\7DJ type are created. In the example, the %,1LBH[BWOJB,%,1LBH[BWOJB and %,1LBH[BWOJB tags are used. In addition, the 8LBH[BWOJB tag of the 8QVLJQHG%LW9DOXH type is required. Creation of a new picture, in the example, this is the H[BBFKDSWHUBI3'/. In this picture, a 6PDUW2EMHFW$SSOLFDWLRQ:LQGRZ is configured. In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select 7DJ/RJJLQJ as the window content and the =.B3$B7UHQGWHPSODWHBas the 7HPSODWH. The implementation of a toolbar has already been explained in detail in the  $UFKLYLQJLI9DOXHLV([FHHGHG H[BBFKDSWHUBE3'/ example. This chapter will only describe the newly added control elements. To control the archiving, a :LQGRZV2EMHFW%XWWRQ is configured. In the example, this is the %XWWRQ object. A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which toggles the %,1LBH[BWOJB tag and calls the /RFN8QORFN$UFKLYH project function. The binary

4-48

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

tag allows the current status of the archive to be stored.

Configure a new picture which is displayed if the archive is exported. In the example, this is the H[BBZLQGRZB3'/. This picture contains a 6WDQGDUG2EMHFW6WDWLF7H[W, which displays a text via a &$FWLRQ. This text consists of a fixed part and the number value of the 8LBH[BWOJB tag. The number value contains the size of the exported data. Additionally, the picture contains a :LQGRZV2EMHFW%XWWRQ and 6PDUW2EMHFW *UDSKLF2EMHFW, which both turn the %,1LBH[BWOJB tag to the constant  via a 'LUHFW&RQQHFWLRQ at (YHQWV0RXVH0RXVH$FWLRQ.

Configure a 6PDUW2EMHFW3LFWXUH:LQGRZ in the initial picture, in the example, the 3LFWXUH:LQGRZ object is used. At 3URSHUWLHV0LVFHOODQHRXV 3LFWXUH1DPH, set the H[BBZLQGRZB3'/. At 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\, create a WDJFRQQHFWLRQ to the %,1LBH[BWOJB tag. To display the status bar, two :LQGRZV2EMHFWV%XWWRQV are configured. In the example, these are the %XWWRQ and %XWWRQ objects. Create a '\QDPLF'LDORJ at the %XWWRQ object at 3URSHUWLHV)RQW7H[W, which returns to the property, depending on the %,1LBH[BWOJB tag, either the text 8SGDWH6WDUWHG or 8SGDWH6WRSSHG. Create a '\QDPLF'LDORJ at the %XWWRQ object at 3URSHUWLHV)RQW7H[W, which returns to the property, depending on the %,1LBH[BWOJB tag, either the text $UFKLYH(QDEOHG or $UFKLYH/RFNHG.

WinCC Configuration Manual C79000-G8276-C140-01

4-49

6DPSOH3URMHFWH[DPSOHB



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 the archive is to be locked or enabled.

*HQHUDO$SSOLFDWLRQ1RWHV

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 file have to be adapted to meet your needs.

4-50

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 $ODUP/RJJLQJ

In runtime, the examples to this topic can be selected by clicking on the button displayed . The examples are configured in the pictures H[BBFKDSWHUB3'/ to above with the H[BBFKDSWHUBG3'/.

*HQHUDO,QIRUPDWLRQ

The $ODUP/RJJLQJ editor is responsible for acquiring and archiving messages. It contains functions 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.

WinCC Configuration Manual C79000-G8276-C140-01

4-51

6DPSOH3URMHFWH[DPSOHB



 %LW0HVVDJH3URFHGXUH H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

Four motors are to be monitored by $ODUP/RJJLQJ. Errors within motors are displayed by setting various bits in tags assigned to each motor. The message states of the motors are stored in separate internal tags. Depending on the message state, the display of the motor is to be changed. The messages are to be displayed in a message window. The message windows toolbar and status bar are realized using standard tools.

,PSOHPHQWDWLRQ&RQFHSW

A message window template is created in $ODUP/RJJLQJ. Additionally, several single messages must be created that refer to the monitored motors. The message window is created in the Graphics Designer via a 6PDUW2EMHFW$SSOLFDWLRQ :LQGRZ. The individual motors consist of multiple 6WDQGDUG2EMHFWV. &$FWLRQV change the displays of the motors for the various message states.

6HWXSRIWKH5HTXLUHG7DJV
6WHS 3URFHGXUH6HWXSRIWKH5HTXLUHG7DJV

In Tag Management, set up a total of twelve tags of the 8QVLJQHG%LW9DOXH type. Four of these tags serve as event tags. In the example, these are the 8LBH[BDOJB,8LBH[BDOJB,8LBH[BDOJB and 8LBH[BDOJB tags. Four tags serve as status tags. In the example, these are the 8LBH[BDOJB, 8LBH[BDOJB,8LBH[BDOJB and 8LBH[BDOJB tags. The remaining tags serve as acknowledgment tags. In the example, these are the 8LBH[BDOJB, 8LBH[BDOJB,8LBH[BDOJB and 8LBH[BDOJB tags.

4-52

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

*HQHUDO,QIRUPDWLRQ

A message consists of several message blocks. These message blocks can be divided into three groups: 6\VWHP%ORFNV: These blocks contain system data assigned by $ODUP/RJJLQJ. This includes date, time, report ID, etc. : These blocks contain the values transmitted from the process, e.g. critical fill levels, temperatures, etc.
3URFHVV9DOXH%ORFNV 8VHU7H[W%ORFNV: These blocks contain texts which provide general information and aid the understandability, e.g. error explanations, message sources, point of error, etc.

0HVVDJH%ORFN&RQILJXUDWLRQ
6WHS 3URFHGXUH0HVVDJH%ORFN&RQILJXUDWLRQ

In the &RQWURO&HQWHU, open the $ODUP/RJJLQJ editor via a

85

Selection of the required message blocks. Open the &RQILJXUH0HVVDJH%ORFNV dialog box via 0HVVDJH%ORFNV 5.

By

0HVVDJH

8'

on one of the three entries in the $YDLODEOH0HVVDJH%ORFNVLQWKH window, the already selected message blocks become visible.

WinCC Configuration Manual C79000-G8276-C140-01

4-53

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH0HVVDJH%ORFN&RQILJXUDWLRQ

Once a 6\VWHP%ORFN, 8VHU7H[W%ORFN or 3URFHVV9DOXH%ORFN entry has selected, the button allows you to display the dialog box for adding message blocks. In the example, the following message blocks are used: System Blocks Date Time Number User Text Blocks Message Text Point of Error

4-54

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH0HVVDJH%ORFN&RQILJXUDWLRQ

The button moves a message block highlighted in the left window to the right window, and thus selects it. Clicking on 2. applies the settings made. In the &RQILJXUH0HVVDJH%ORFNV dialog box, if a block is selected using

, the

and buttons become operational. The first button allows you to remove already selected message blocks, the second button allows you to configure the properties of the individual message blocks.

Clicking on 2. applies the settings made in the 0HVVDJH%ORFNV dialog boxes. The &RQILJXUH0HVVDJH%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.

WinCC Configuration Manual C79000-G8276-C140-01

4-55

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH0HVVDJH%ORFN&RQILJXUDWLRQ

message blocks. 5 on the displayed icons and then selecting properties, accesses the 0HVVDJH%ORFNV dialog box. Message blocks can also be deleted this way.

If one of the three sub-entries, 6\VWHP%ORFNV, 8VHUWH[W%ORFNV or 3URFHVV9DOXH , the right window will display the selected %ORFNV, is selected with the

add/remove or properties dialog box. ' on one of the displayed icons in the right window, will display the message blocks it contains.

85

If the 0HVVDJH%ORFNV entry in the left window has been selected with the

on one of the icons displayed in the right window, allows you to access the

4-56

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6HWXSRIDQHZ0HVVDJH/LQH)RUPDW
6WHS 3URFHGXUH6HWXSRIDQHZ0HVVDJH/LQH)RUPDW

The $ODUP/RJJLQJ editor must still be open. Create a new message line format by on the 0HVVDJH/LQH)RUPDW entry.

85

The 0HVVDJH/LQH dialog box will be displayed. As the 1DPHRIWKH0HVVDJH /LQH)RUPDW, the example uses /LQHB. As the (OHPHQWVRIWKH0HVVDJH, select the 1XPEHU, 'DWH, 7LPH, 3RLQWRI(UURU and 0HVVDJH7H[W message blocks via the button.

The move XS and move GRZQ buttons allow you to change the order of the selected 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 display all available message line formats.

, the right window will

WinCC Configuration Manual C79000-G8276-C140-01

4-57

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRIDQHZ0HVVDJH/LQH)RUPDW

8' 85
or

on the appropriate icon opens the 0HVVDJH/LQH dialog box.

*HQHUDO,QIRUPDWLRQ

The message window template defines the structure, display and operation of a message window. Additionally, the template defines if the message window should display the current messages or the message archive.

6HWXSRI0HVVDJH:LQGRZ7HPSODWH
6WHS 3URFHGXUH6HWXSRI0HVVDJH:LQGRZ7HPSODWH

The $ODUP/RJJLQJ editor must still be open. Create a new message window template by 7HPSODWHV entry.

85

on the 0HVVDJH:LQGRZ

The &RQILJXUH0HVVDJH:LQGRZV dialog box will be displayed. 2 In the *HQHUDO,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB in the :LQGRZ entry field and 0RWRU0HVVDJH:LQGRZ in the :LQGRZ7LWOH entry field. In runtime, the :LQGRZ7LWOH will be displayed if the $SSOLFDWLRQ:LQGRZ displaying this template is configured with 7LWOH. If no text is entered in the window title entry field, the content of the :LQGRZ entry field is used as the :LQGRZ7LWOH. As the :LQGRZ7\SH, select 0HVVDJH:LQGRZ. The 6HOHFWLRQ is performed after the single messages have been configured.

4-58

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRI0HVVDJH:LQGRZ7HPSODWH

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.

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

WinCC Configuration Manual C79000-G8276-C140-01

4-59

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRI0HVVDJH:LQGRZ7HPSODWH

lines. In the 6HOHFWLRQ field, select 1R6HOHFWLRQ. This defines that - in runtime - single messages can only be selected by using buttons on the toolbar, not with the mouse. Select the /LQH7LWOH and &ROXPQ7LWOH check-boxes. Select the $XWR6FUROOLQJ check-box.

In the 6WDWXV%DU tab, select the 'LVSOD\6WDWXV%DU check-box. In the $OLJQPHQW field, select %RWWRP. As (OHPHQWVRIWKH6WDWXV%DU, select the 'DWH, 7LPH and 1XPEHURI0HVVDJHVLQWKH:LQGRZ check-boxes.

4-60

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRI0HVVDJH:LQGRZ7HPSODWH

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

WinCC Configuration Manual C79000-G8276-C140-01

4-61

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRI0HVVDJH:LQGRZ7HPSODWH

, the right If the 0HVVDJH:LQGRZ7HPSODWHV entry is selected with the window will display all available message window templates.

8' 85
or dialog box.

on the appropriate icon opens the &RQILJXUH0HVVDJH:LQGRZV

The :LQGRZ3UHYLHZ function, accessed by right-clicking on the desired message window template, allows you to check all the settings made without activating runtime.

4-62

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRI0HVVDJH:LQGRZ7HPSODWH

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 and abbreviated form, by the Message Wizard. This wizard is activated via the menu points )LOH 6WDUW0HVVDJH:L]DUG. However, for a detailed configuration, the dialog boxes described in this example are necessary.

The creation of a message system using the Message Wizard is described in chapter  &RQILJXULQJPHVVDJHV.

WinCC Configuration Manual C79000-G8276-C140-01

4-63

6DPSOH3URMHFWH[DPSOHB



 %LW0HVVDJH3URFHGXUH &RQWLQXHG

6HWXSRI6LQJOH0HVVDJHV
6WHS 3URFHGXUH6HWXSRI6LQJOH0HVVDJHV

In the $ODUP/RJJLQJ editor, the lower part of the window is called the table window. In this window, the individual messages are configured, and the already 5, new lines can be added. configured ones displayed. By

For this example, 12 different single messages are configured. Each line in the table window represents one message and contains several columns. Changes can be made directly in the individual columns. In the example however, the settings are made via the 6LQJOH0HVVDJH dialog box. This dialog 5 on the corresponding message line. box is accessed via a

Access the 6LQJOH0HVVDJH dialog box as described in the previous step. In the 3DUDPHWHUV tab, select (UURU as the message class and )DLOXUH as the message type. In the 7KLV0HVVDJH field, select the ZLOOEHDUFKLYHG and ZLOOEHUHSRUWHG checkboxes. In the &RQQHFWLRQV field, select the 8LBH[BDOJB tag as the (YHQW7DJ and enter  as the (YHQW%LW. This means that the message will be generated if the first bit of the set tag assumes the status of 1. Select the 8LBH[BDOJB tag as the $FNQRZOHGJH7DJ and enter  as the $FNQRZOHGJH%LW. This means that the first bit of the set tag will be set to 1 if the message is acknowledged in runtime. Select the 8LBH[BDOJB tag as the 6WDWXV7DJ and enter  as the 6WDWXV%LW. This setting effects that the first bit of the set tag is representing the &DPH ,Q:HQW2XW6WDWXV of the message. If the message is pending, the bit will be set to 1. This bit is reset, once the message has been cleared. The ninth bit of the tag contains the $FNQRZOHGJH6WDWXV of the message. If the message has not been acknowledged, 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-byte always contains the &DPH,Q:HQW2XW6WDWHV, the high-byte the $FNQRZOHGJH
6WDWHV

4-64

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRI6LQJOH0HVVDJHV

In the 7H[W tab, enter ,QWHUORFN(UURU as the 0HVVDJH7H[W and 0RWRU as the 3RLQWRI(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 two additional 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 0HVVDJH7H[WV. The other three motors also require three message lines each.

WinCC Configuration Manual C79000-G8276-C140-01

4-65

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRI6LQJOH0HVVDJHV

The (YHQW7DJV, $FNQRZOHGJH7DJV and 6WDWXV7DJV, as well as the texts for the 3RLQWRI(UURU, must be adapted for each motor.

The configured message window template should only display messages that refer to one of the four motors. Therefore, a selection must be made in the properties dialog box, *HQHUDO,QIRUPDWLRQ tab, of the created message window template. To do so, open the appropriate properties dialog box. In the *HQHUDO,QIRUPDWLRQ tab, clicking on the accesses the 6HWWKH6HOHFWLRQ dialog box. Message block selections are made in this dialog box. In the example, only messages with a message number from 1 to 12 are to be displayed. That is, the selection is concerned with the 1XPEHU system block. A selecting a block with the , all possible selections are displayed in the right side of the window. For the 1XPEHU system block, a 6WDUW9DOXH and a 6WRS9DOXH can be entered - the message numbers lie in this range. In the example,  is entered as the 6WDUW9DOXH and  as the 6WRS9DOXH.

8'

on the 6\VWHP%ORFNV folder displays all available system blocks. By

Close the properties dialog box by clicking on 2.. If a selection has been made, a check-mark
&RQILJXUH0HVVDJH:LQGRZV

will be displayed next to the "Selection" button. The dialog box is also exited by clicking on 2..

4-66

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

&RQILJXUDWLRQRIWKHRIWKH0HVVDJH&RORU6FKHPHV
6WHS 3URFHGXUH&RQILJXUDWLRQRIWKHRIWKH0HVVDJH&RORU6FKHPHV

The configured single messages are of the (UURU message class and the )DLOXUH message type.

on the 0HVVDJH&ODVVHV entry to display all available message classes in the on the message class icon (UURU to display all available or on the message type icon )DLOXUH opens the 7\SH

right window.

message types. dialog box.

8' 8' 85

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

WinCC Configuration Manual C79000-G8276-C140-01

4-67

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH&RQILJXUDWLRQRIWKHRIWKH0HVVDJH&RORU6FKHPHV

The configurations made in $ODUP/RJJLQJ are saved via the )LOH6DYH menu points.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Each motor to be displayed consist of a 6WDQGDUG2EMHFW&LUFOH, a 6WDQGDUG 2EMHFW3RO\JRQ and a 6WDQGDUG2EMHFW6WDWLF7H[W.

The motors are to change color whenever an error message is displayed or this message is being acknowledged. The colors are to correspond to the ones used for the came in, went out and acknowledged message states. To do so, create a &$FWLRQ for the 6WDWLF7H[W at 3URSHUWLHV&RORUV)RQW &RORU, which changes the font color depending on the current state of the motors status 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 :LQGRZV2EMHFW &KHFN%R[. At 3URSHUWLHV*HRPHWU\1XPEHURI%R[HV enter .

4-68

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

At 3URSHUWLHV2XWSXW,QSXW6HOHFWHG%R[HV, create a 7DJ&RQQHFWLRQ to the corresponding event tag of the motor. 3 To display the created message window template, a 6PDUW2EMHFW$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 is displayed. Select the $ODUP/RJJLQJ entry. Close the dialog box by clicking on 2..

In the following 7HPSODWH dialog box, select 0HVVDJH:LQGRZB trend window template. Close the dialog box by clicking on 2..

In the Graphics Designer, the configured $SSOLFDWLRQ:LQGRZ will be displayed as a gray rectangle. The rectangle will be labeled with the name of the selected trend window template. At 3URSHUWLHV0LVFHOODQHRXV, set the %RUGHU and 7LWOH properties of the $SSOLFDWLRQ:LQGRZ object to <HV.

To be able to use $ODUP/RJJLQJ during runtime, $ODUP/RJJLQJ5XQWLPH must be enabled first. To do so, check "Alarm Logging Runtime" in the "Startup" tab of the &RPSXWHU3URSHUWLHV dialog box. If this is not the case, select the "Computer" entry in the &RQWURO&HQWHU via a and open the &RPSXWHU3URSHUWLHV6WDUWXS7DE by clicking on the button

WinCC Configuration Manual C79000-G8276-C140-01

4-69

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

from the dialogs toolbar. Click on the button to open the &RPSXWHU3URSHUWLHV dialog box. In the 6WDUWXS tab, select the $ODUP/RJJLQJ 5XQWLPH 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; else return 0xFFFFFF; }

This &$FWLRQ adds dynamics to the background color property of the &LUFOH assigned to the first motor. The 8LBH[BDOJB status tag assigned to the first motor is read. The low-byte of this tag contains the came in/went out message states. This means that a message is pending and the circles background color is set to orange (hex 80ff) if the first, second or third bit of this tag is set to 1. If the message goes out again, the background color will be set to white (hex ffffff). This &$FWLRQ is triggered upon the change of the 8LBH[BDOJB status tag.

4-70

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 6WDWLF7H[W assigned to the first motor. The 8LBH[BDOJB status tag assigned to the first motor is read. The low-byte of this tag contains the came in/went out message states, the high-byte the acknowledged message states. In the case of an unacknowledged, pending message, the font color will be set to yellow (hex ffff). In the case of an acknowledged message, the font color will be set to white (hex ffffff). In the case of an unacknowledged, but went out message, the font 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 8LBH[BDOJB status tag.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The required message blocks, and with it the used message line formats, must be adapted 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 meet your requirements. The same applies for the user texts.

WinCC Configuration Manual C79000-G8276-C140-01

4-71

6DPSOH3URMHFWH[DPSOHB



 $QDORJ$ODUPV H[BBFKDSWHUBD3'/

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 be generated. If the values reach the critical zone, alarms are to be generated. The occurrence of 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 be configured. The table should have a user-defined color scheme.

,PSOHPHQWDWLRQ&RQFHSW

A message window template is created in $ODUP/RJJLQJ. Additionally, several single messages must be created that refer to the three monitored containers. In the *UDSKLFV'HVLJQHU, the message window is displayed using a 6PDUW2EMHFW $SSOLFDWLRQ:LQGRZ. The height of this window, controlled by a &$FWLRQ, depends on the on the number of messages. The background of this table is formed by a 6PDUW2EMHFW *UDSKLF2EMHFW. The toolbar consists of multiple :LQGRZV2EMHFWV%XWWRQV and 6PDUW 2EMHFWV6WDWXV'LVSOD\V.

6HWXSRIWKH5HTXLUHG7DJV
6WHS 3URFHGXUH6HWXSRIWKH5HTXLUHG7DJV

In Tag Management, set up a total of six tags of the 8QVLJQHG%LW9DOXH type. Three of these tags contain the temperature values of the individual containers. In the example, these are the 8LBH[BDOJBW,8LBH[BDOJBW and 8LBH[BDOJBW tags. The remaining three tags contain the pressure values. In the example, these are the 8LBH[BDOJBS,8LBH[BDOJBS and 8LBH[BDOJBS tags. Three additional tags of the 8QVLJQHG%LW9DOXH tags are required that serve as status tags. In the example, these are the 8LBH[BDOJB,8LBH[BDOJB and 8LBH[BDOJB tags. One additional tag of the 8QVLJQHG%LW9DOXH type is needed to control a central signaling device. In the example, this is the 8LBH[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 &RQILJXUH0HVVDJH%ORFNV table example are considered complete and will not be described again.

4-72

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6HWXSRIDQHZ0HVVDJH:LQGRZ7HPSODWH
6WHS 3URFHGXUH6HWXSRIDQHZ0HVVDJH:LQGRZ7HPSODWH

Open the $ODUP/RJJLQJ editor. The message window should display the current value of the monitored tag if a message arrives. To do so, a new process value block must be created.

5 on the 0HVVDJH%ORFNV Access the &RQILJXUH0HVVDJH%ORFNV dialog box by entry. Select the 3URFHVV9DOXH%ORFNV entry from the list and access the $GG
button. 3URFHVV9DOXH%ORFNV dialog box by clicking on the This will add a new process value block. Close the dialog box by clicking on 2..

8'

on the 3URFHVV9DOXH%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 &RQILJXUH 0HVVDJH%ORFNV dialog boxes. 2 Since a new message block has been configured, a new message line format is needed. The /LQHB format, created in the first example, can not be used anymore. Create a new message line format by

85

on the 0HVVDJH/LQH)RUPDW entry.

The 0HVVDJH/LQH dialog box will be displayed. As the 1DPHRIWKH0HVVDJH /LQH)RUPDW, the example uses /LQHB. As the (OHPHQWVRIWKH0HVVDJH, select the 1XPEHU, 'DWH, 7LPH, 3RLQWRI(UURU, 0HVVDJH7H[W and 9DOXH message blocks

WinCC Configuration Manual C79000-G8276-C140-01

4-73

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRIDQHZ0HVVDJH:LQGRZ7HPSODWH

via the button. Clicking on 2. applies the settings made and exits the dialog box. 3 Create a new message window template by 7HPSODWHV entry.

85

on the 0HVVDJH:LQGRZ

The &RQILJXUH0HVVDJH:LQGRZV dialog box will be displayed. 4 In the *HQHUDO,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB in the :LQGRZ entry field. A separate :LQGRZ7LWOH is not needed. As the :LQGRZ7\SH, select 0HVVDJH:LQGRZ. The 6HOHFWLRQ is performed after the single messages have been 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 the 6HSDUDWLRQ/LQHV field, select the +RUL]RQWDO and 9HUWLFDO check-boxes. In the 6HOHFWLRQ field, select /LQH. This determines that in runtime individual message lines can be selected using the mouse if $XWR6FUROOLQJ is turned off. Deselect the /LQH7LWOH and &ROXPQ7LWOH check-boxes. Select the $XWR6FUROOLQJ check-box. In the 6WDWXV%DU and 7RROEDU tabs, deselect the check-boxes for displaying the status 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 signals of all message types (belonging to a message class) are set.

4-74

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6HWXSRIDQHZ0HVVDJH&ODVV
6WHS

85

3URFHGXUH6HWXSRIDQHZ0HVVDJH&ODVV

on the 0HVVDJH&ODVVHV entry to access the $GG0HVVDJH&ODVV dialog box.

Clicking on the button adds a new message class. The dialog box is closed by clicking on 2.. 2 including newly created ones, in the right window. 5 on one of the message class icons to open the &RQILJXUH0HVVDJH&ODVVHV dialog box.

on the 0HVVDJH&ODVVHV entry to display all available message classes,

In the *HQHUDO,QIRUPDWLRQ tab, enter &RQWDLQHU(UURU as the 1DPHRIWKH&ODVV. Access the $GG0HVVDJH7\SH dialog box by clicking on the button. In this dialog box, move two message types from the left to the right side button. The dialog box is closed by clicking on of the window using the 2.. Select one of the two new message types from the 0HVVDJH7\SHV field and button. display its properties by clicking on the Enter &RQWDLQHU$ODUP as the name of the first message type. The color scheme of 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 color scheme 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

WinCC Configuration Manual C79000-G8276-C140-01

4-75

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRIDQHZ0HVVDJH&ODVV

In the $FNQRZOHGJHPHQW tab, select the $FNQRZOHGJHPHQW&DPH,Q check-box from the $FNQRZOHGJHPHQW3KLORVRSK\ field. In the &HQWUDO6LJQDOLQJ'HYLFHV field, select 6HSDUDWH$FNQRZOHGJHPHQW.H\. As the 7DJ, set the 8LBH[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.

4-76

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRIDQHZ0HVVDJH&ODVV

In the 6WDWXV7H[WV tab, no changes need to be made. The dialog box is closed by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-77

6DPSOH3URMHFWH[DPSOHB



 $QDORJ$ODUPV FRQWLQXHG

6HWXSRI6LQJOH0HVVDJHV
6WHS

85

3URFHGXUH6HWXSRI6LQJOH0HVVDJHV

in the table window and add 12 new lines.

Select the first of the newly added lines via a 6LQJOH0HVVDJH dialog box.

8 85
.

on this line opens the

In the 3DUDPHWHUV tab, select &RQWDLQHU(UURU as the message class and &RQWDLQHU $ODUP as the message type. In the 7KLV0HVVDJH field, select the ,V6LQJOH $FNQRZOHGJHPHQW2QO\, 7ULJJHU+RUQ, ZLOOEHDUFKLYHG and ZLOOEHUHSRUWHG check-boxes. In the &RQQHFWLRQV field, select the 8LBH[BDOJB tag as the 6WDWXV7DJ and enter  as the 6WDWXV%LW. No (YHQW7DJ is set, since the message is generated by an analog alarm. Also, no $FNQRZOHGJH7DJ is set. In the 7H[W tab, enter &ULWLFDO2YHUSUHVVXUH as the 0HVVDJH7H[W and &RQWDLQHU as the 3RLQWRI(UURU. As the ,QIRWH[W enter 7KHSUHVVXUHLQFRQWDLQHUKDV H[FHHGHGWKHFULWLFDOYDOXH. 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 process value block of the message line is automatically supplied with the limit value which triggered the message. Apply the settings made by clicking on the 2. button. 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 &ULWLFDO7HPSHUDWXUH as the 0HVVDJH7H[W and change the ,QIRWH[W correspondingly. Create two messages of the &RQWDLQHU:DUQLQJ message type and enter 3UHVVXUH:DUQLQJ and 7HPSHUDWXUH:DUQLQJ as the 0HVVDJH7H[WV. For these warnings select all check-boxes from the 7KLV0HVVDJH field of the 3DUDPHWHUV tab (of the 6LQJOH0HVVDJH dialog box). All messages pertaining to container 1 use the same status tag. Their status bits, though, must be adapted. The other two containers also require four message each.

4-78

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRI6LQJOH0HVVDJHV

The 6WDWXV7DJV, as well as the 3RLQWRI(UURU texts, must adapted to each container.

The configured message window template should only display messages that refer to one of the three containers. Therefore, a selection must be made in the properties dialog box, *HQHUDO,QIRUPDWLRQ tab, of the created message window template. To do so, open the appropriate properties dialog box. In the *HQHUDO,QIRUPDWLRQ tab, clicking on the accesses the 6HWWKH6HOHFWLRQ dialog box. For the 1XPEHU system block, enter  as the 6WDUW9DOXH and  as the 6WRS 9DOXH. Close the properties dialog box by clicking on 2.. If a selection has been made, a check-mark
&RQILJXUH0HVVDJH:LQGRZV

will be displayed next to the "Selection" button. The dialog box is also exited by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-79

6DPSOH3URMHFWH[DPSOHB



&RQILJXUDWLRQRI$QDORJ$ODUPV
6WHS 3URFHGXUH&RQILJXUDWLRQRI$QDORJ$ODUPV

If the $QDORJ$ODUP entry is not present in the navigation window, it must be loaded first. This is done from the 2SWLRQV$GG,QV menu of the $ODUP /RJJLQJ editor. In the following dialog, select the analog alarm entry.

85

on the $QDORJ$ODUP entry and select "New" to open the 3URSHUWLHV dialog box of the tag. In this dialog box, a new tag for the analog alarm can be selected.

Set the 8LBH[BDOJBW tag, which contains the temperature value of the first container, as the 7DJWREHPRQLWRUHG. The $0HVVDJHIRUDOO/LPLW9DOXHV checkbox is not selected. Keep  as the 'HOD\7LPH. Close the dialog box by clicking on 2..

4-80

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH&RQILJXUDWLRQRI$QDORJ$ODUPV

In the right window, the icon of the new tag to be monitored will be displayed. 5 on this icon and select "New" to open the 3URSHUWLHV dialog box of the limit values. In this dialog box, a new limit value can be assigned to the tag.

Select 8SSHU/LPLW in the /LPLW9DOXH field. Enter  in the /LPLW9DOXHRU7DJ entry 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 been exceeded. Close the dialog box by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-81

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH&RQILJXUDWLRQRI$QDORJ$ODUPV

For the same tag, set a second limit value. In the /LPLW9DOXH field, select 8SSHU /LPLW again. Enter  in the /LPLW9DOXHRU7DJ entry box. Enter  as the 1XPEHU in the 0HVVDJH field. This is the warning message for the first container if the temperature has been exceeded. 4 The other five tags to be monitored are created as described in step 2 and 3 and have two limit values each.

8'

on the $QDORJ$ODUP entry to display all created tags.

4-82

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

The simulation of the process values to be monitored is realized using :LQGRZV 2EMHFWV6OLGHU2EMHFWV. In the example, these are the 6OLGHU2EMHFW to 6OLGHU 2EMHFW objects. Create a 'LUHFW&RQQHFWLRQ for the 6OLGHU2EMHNF at (YHQWV3URSHUW\7RSLFV 0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ, which directs the current process value of the 6OLGHU to the 8LBH[BDOJBW tag. This 6OLGHU has the task of simulating 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 of the picture, create a &$FWLRQ at (YHQWV0LVFHOODQHRXV2SHQ3LFWXUH. Assign each 6OLGHU a 6PDUW2EMHFW,2)LHOG , which displays its current tag value. In the example, these are the ,2)LHOG to ,2)LHOG objects. Create a 7DJ&RQQHFWLRQ for the ,2)LHOG at 3URSHUWLHV0LVFHOODQHRXV 3LFWXUH1DPH to the 8LBH[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 to each 6OLGHU. The display of the individual containers is accomplished via the 7DQN smart object from the global library. In the example, these are the 7DQN, 7DQN and 7DQN objects. In the example, these objects contain no dynamics. They only serve display purposes.

A 6PDUW2EMHFW6WDWXV'LVSOD\ is assigned to each container to represent a warning light. In the example, these are the 6WDWXV'LVSOD\ to 6WDWXV'LVSOD\ objects. In the example, via 3URSHUWLHV6WDWH of the 6WDWXV'LVSOD\ for the &XUUHQW
6WDWXV 

, set the bitmap ,QGLFDWRULVQRWIODVKLQJEPS

as the %DVLF3LFWXUH

and the bitmap ,QGLFDWRULVIODVKLQJEPS as the )ODVK3LFWXUH. The 3URSHUWLHV6WDWH)ODVKLQJ)ODVK3LFWXUHDFWLYH is set to 1R. At the same property, create a &$FWLRQ, which turns on the flashing if an alarm message concerning a container is pending. Configure the two other 6WDWXV'LVSOD\V in the same manner. 5 Configure an additional 6PDUW2EMHFW6WDWXV'LVSOD\ to represent a horn. In the example, this is the 6WDWXV'LVSOD\ object. At this object, via 3URSHUWLHV for the &XUUHQW6WDWXV , set the bitmap +RUQLVQRWVRXQGLQJEPS as the %DVLF3LFWXUH and the bitmap +RUQLVVRXQGLQJEPS as the )ODVK3LFWXUH.
6WDWH

WinCC Configuration Manual C79000-G8276-C140-01

4-83

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

The 3URSHUWLHV6WDWH)ODVKLQJ)ODVK3LFWXUHDFWLYH is set to 1R. At the same property, create a &$FWLRQ, which turns on the flashing if an alarm message 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 central signaling device) receives the status of . In the example, this is the 8LBH[BDOJB tag. Create a &$FWLRQ at 3URSHUWLHV*HRPHWU\:LGWK, which emits acoustical signals if the object is flashing. 6 Design of the message table background. The example uses a bitmap which is displayed by a 6PDUW2EMHFW*UDSKLF2EMHFW.

To display the configured message window template, a 6PDUW2EMHFW $SSOLFDWLRQ:LQGRZ is used. In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select $ODUP/RJJLQJ as the :LQGRZ&RQWHQW and 0HVVDJH:LQGRZB as the 7HPSODWH. Create a &$FWLRQ at 3URSHUWLHV*HRPHWU\:LQGRZ+HLJKW, which controls the height of the message window depending on the number of messages to be displayed. For the toolbar, configure several :LQGRZV2EMHFWV%XWWRQV, which simulate the pressing of individual buttons of the standard toolbar via special standard functions.

The %XWWRQ object replaces the button for the horn acknowledgement. Create a &$FWLRQ at (YHQWV0RXVH0RXVH$FWLRQ, which calls the 2Q%WQ+RUQ$FNQ SV]0VJ:LQ standard function. As SV]0VJ:LQ transfer parameter, enter the name of the message window template. This button acknowledges the central signaling device. Using a 6PDUW2EMHFW*UDSKLF 2EMHFW, which is placed on top of the button, this button can be made inoperational. This occurs, if no signal is present at the tag triggering the central signaling device. 9 Additionally, configure a %XWWRQ for single acknowledgement, a %XWWRQ for group acknowledgement and a %XWWRQ for calling 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

10

As replacement for the button turning the auto-scroll function on/off, a 6PDUW 2EMHFW6WDWXV'LVSOD\ is used. In the example, this is the 6WDWXV'LVSOD\

4-84

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

object. At 3URSHUWLHV6WDWH&XUUHQW6WDWXV, create a 7DJ&RQQHFWLRQ to the %,1LBH[BDOJB tag. This tag contains information whether auto-scrolling is turned on or off. A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which toggles the %,1LBH[BWOJB tag and calls the 2Q%WQ6FUROO SV]0VJ:LQ standard function. At the opening of the picture, the %,1LBH[BDOJB tag is set to , since auto-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( is returned to the property, that is, the warning light is flashing. This &$FWLRQ is triggered upon the change of the first containers 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, the horn is also displayed optically. This &$FWLRQ is triggered upon the change of the tag triggering the central audible indicator.

WinCC Configuration Manual C79000-G8276-C140-01

4-85

6DPSOH3URMHFWH[DPSOHB



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 ZLQPPGOO. This DLL contains the function for playing sound files. If the 6WDWXV'LVSOD\ object is flashing, the +XSHZDY 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)

4-86

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

{ if if if if } if (state2) { if ((state2&1)||(state2& 256)) if ((state2&2)||(state2& 512)) if ((state2&4)||(state2&1024)) if ((state2&8)||(state2&2048)) } if (state3) { if ((state3&1)||(state3& 256)) if ((state3&2)||(state3& 512)) if ((state3&4)||(state3&1024)) if ((state3&8)||(state3&2048)) } ((state1&1)||(state1& 256)) ((state1&2)||(state1& 512)) ((state1&4)||(state1&1024)) ((state1&8)||(state1&2048)) count++; count++; count++; count++;

count++; count++; count++; count++;

count++; count++; count++; 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, the message window will temporarily be expanded beyond its maximum size. This allows the scroll bars to be removed if auto-scroll is deactivated. If the message window contains fewer lines than can be displayed, the height of the window is calculated by multiplying the number of lines by the line height. If the number of lines is greater than the maximum value, a maximum height is preset.

*HQHUDO$SSOLFDWLRQ1RWHV

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.

WinCC Configuration Manual C79000-G8276-C140-01

4-87

6DPSOH3URMHFWH[DPSOHB



 0HVVDJH:LQGRZ H[BBFKDSWHUBE3'/

7DVN'HILQLWLRQ

Several processes are to be monitored via a message window. If a message comes in, a button 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, that is, the standard toolbar and status bar are used.

,PSOHPHQWDWLRQ&RQFHSW

A message window template is created in $ODUP/RJJLQJ. This example will use the messages and pictures created in the previous examples. A project function is required that executes 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 6PDUW2EMHFW $SSOLFDWLRQ:LQGRZ. No additional objects are needed.
1RWH

The configurations carried out in the previous two examples are considered complete. They will not be described again, however, this example is based on them.

,PSOHPHQWDWLRQRIWKH([DPSOH
6WHS 3URFHGXUH,PSOHPHQWDWLRQRIWKH([DPSOH

Open the $ODUP/RJJLQJ editor from the &RQWURO&HQWHU. Create a new message window template by 7HPSODWHV entry.

85

on the 0HVVDJH:LQGRZ

The &RQILJXUH0HVVDJH:LQGRZV dialog box will be displayed. 2 In the *HQHUDO,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB in the :LQGRZ entry field and 0HVVDJH:LQGRZ in the :LQGRZ7LWOH entry field. As the :LQGRZ7\SH, select 0HVVDJH:LQGRZ. 6HOHFWLRQ must not be performed, since all single messages 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 the 6HSDUDWLRQ/LQHV field. In the 6HOHFWLRQ field, select 1R6HOHFWLRQ. Select the /LQH 7LWOH and &ROXPQ7LWOH check-boxes. Select the $XWR6FUROOLQJ check-box. In the 6WDWXV%DU tab, select the 'LVSOD\6WDWXV%DU check-box and %RWWRP from the $OLJQPHQW field. As the (OHPHQWVRIWKH6WDWXV%DU, select 'DWH, 7LPH, 1XPEHURI0HVVDJHVLQWKH:LQGRZ, /RFN and 6HOHFWLRQ. In the 7RROEDU tab, select the 'LVSOD\7RROEDU check-box and 7RS from the

4-88

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQRIWKH([DPSOH $OLJQPHQW

'LVSOD\3URFHVV0HVVDJH:LQGRZ

field. As elements of the toolbar, select everything but the keys for , 'LVSOD\6KRUW7HUP$UFKLYH, 'LVSOD\ 6HTXHQFH$UFKLYH and &LW\&DOO)XQFWLRQV. Close the dialog box by clicking on 2..

For each single message, /RRSLQ$ODUP must be set. This function enables a direct picture change to the corresponding picture of the message. By default, the function 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 a picture 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 windows toolbar, the must have been selected.

button for /RRSLQ$ODUP

In the table window of $ODUP/RJJLQJ, ' on the /RRSLQ$ODUP column to display the /RRSLQ$ODUP dialog box of the selected single message.

As )XQFWLRQ1DPH, the $/*/RRS,Q$ODUP function is used. For the messages that refer to the motors of the first example, the H[BBFKDSWHUB3'/ picture is used as the 3LFWXUH1DPH3DUDPHWHU, for messages of the second example, the H[BBFKDSWHUBD3'/ picture is used.

The configuration of the /RRSLQ$ODUP function can also be made from the single messages properties dialog box in the 7DJ$FWLRQ tab, /RRSLQ$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

WinCC Configuration Manual C79000-G8276-C140-01

4-89

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQRIWKH([DPSOH

. To display the configured message window template, a 6PDUW2EMHFW $SSOLFDWLRQ:LQGRZ is used. In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select $ODUP/RJJLQJ as the :LQGRZ&RQWHQW and 0HVVDJH:LQGRZB as the 7HPSODWH. Via 3URSHUWLHV0LVFHOODQHRXV, the attributes 7LWOH and %RUGHU are set to <HV.
H[BBFKDSWHUBE3'/

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 can not be used directly in $ODUP/RJJLQJ, since the number and type of the call parameters do not agree with the previous ones.
1RWH

In the message window template, a button in the toolbar has been provided to access the report functions. The implementation of a message sequence report and its activation is described in the example 0HVVDJH6HTXHQFH5HSRUW H[BBFKDSWHUBE3'/ , in the 5HSRUW'HVLJQHU chapter.
*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The functions, configured for the individual messages, pertaining to the /RRSLQ$ODUP, must be adapted to meet your needs. The type of message window display must meet your requirements.

4-90

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 0HVVDJH$UFKLYLQJ H[BBFKDSWHUBF3'/

7DVN'HILQLWLRQ

A message archive is to be created, which is designed to hold 200 messages in the form of a short-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 should contain two special buttons that allow the user to either display archived messages from example 1 or example 2.

,PSOHPHQWDWLRQ&RQFHSW

A message window template is created in $ODUP/RJJLQJ. This example will use the messages created in the previous examples. In addition, a message archive is configured. In the *UDSKLFV'HVLJQHU, the message window is displayed using a 6PDUW2EMHFW $SSOLFDWLRQ:LQGRZ. The toolbar is implemented using multiple :LQGRZV2EMHFWV %XWWRQV, 6PDUW2EMHFWV6WDWXV'LVSOD\V and 6PDUW2EMHFWV*UDSKLF2EMHFWV. A project function is needed that performs a defined selection in the message window if the selection buttons are activated.

6HWXSRIWKH5HTXLUHG7DJV
6WHS 3URFHGXUH6HWXSRIWKH5HTXLUHG7DJV

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. They will not be described again, however, this example is based on them.

,PSOHPHQWDWLRQLQ$ODUP/RJJLQJ
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ$ODUP/RJJLQJ

Open the $ODUP/RJJLQJ editor from the &RQWURO&HQWHU. Create a new message window template by 5 on the 0HVVDJH:LQGRZ 7HPSODWHV entry. The &RQILJXUH0HVVDJH:LQGRZV dialog box will be displayed. In the *HQHUDO,QIRUPDWLRQ tab, enter 0HVVDJH:LQGRZB in the :LQGRZ entry field, a separate :LQGRZ7LWOH is not needed. As the :LQGRZ7\SH, select 6KRUW 7HUP$UFKLYH:LQGRZ. 6HOHFWLRQ must not be performed, since all archive messages 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 the 6HSDUDWLRQ/LQHV field. In the 6HOHFWLRQ field, select &HOO. Select the /LQH7LWOH and &ROXPQ7LWOH check-boxes. Select the $XWR6FUROOLQJ check-box. In the 6WDWXV%DU and 7RROEDU tabs, deselect the check-boxes for displaying the status bar and toolbar. Close the dialog box by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-91

6DPSOH3URMHFWH[DPSOHB



6WHS

85

3URFHGXUH,PSOHPHQWDWLRQLQ$ODUP/RJJLQJ

3DUDPHWHU$VVLJQPHQW

on the $UFKLYHV entry and select "Add/Remove" to open the $UFKLYH 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. 5 on this icon will display its properties.

The archive is to be stored on the hard disk. In the 1XPEHURI0HVVDJHV entry box, enter . 6HOHFWLRQ is not performed.

4-92

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ$ODUP/RJJLQJ

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

To display the configured message window template, a 6PDUW2EMHFW $SSOLFDWLRQ:LQGRZ is used. In the example, this is the $SSOLFDWLRQ:LQGRZ object. Select $ODUP/RJJLQJ as the :LQGRZ&RQWHQW and 0HVVDJH:LQGRZB as the 7HPSODWH. For the toolbar, configure several :LQGRZV2EMHFWV%XWWRQV, which simulate the pressing of individual buttons of the standard toolbar via special standard functions.

The %XWWRQ object replaces the button for the horn acknowledgement. Create a &$FWLRQ at (YHQWV0RXVH0RXVH$FWLRQ, which calls the 2Q%WQ+RUQ$FNQ SV]0VJ:LQ standard function. As SV]0VJ:LQ transfer parameter, enter the name of the message window template. This button acknowledges the central signaling device, which is triggered by some of the configured messages. Using a 6PDUW2EMHFW*UDSKLF2EMHFW, which is placed on top of the button, this button can be made inoperational. This occurs, if no signal is present at the tag triggering the central signaling device. 3 Additionally, configure a %XWWRQ for single acknowledgement, a %XWWRQ for group acknowledgement, a %XWWRQ for calling the selection dialog box and a %XWWRQ for calling 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

WinCC Configuration Manual C79000-G8276-C140-01

4-93

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU 2Q%WQ6HOHFW SV]0VJ:LQ

As replacement for the button turning the auto-scroll function on/off, a 6PDUW 2EMHFW6WDWXV'LVSOD\ is used. In the example, this is the 6WDWXV'LVSOD\ object. At 3URSHUWLHV6WDWH&XUUHQW6WDWXV, create a 7DJ&RQQHFWLRQ to the %,1LBH[BDOJB tag. This tag contains information whether auto-scrolling is turned on or off. A &$FWLRQ is created at (YHQWV0RXVH3UHVV/HIW, which toggles the %,1LBH[BWOJB tag and calls the 2Q%WQ6FUROO SV]0VJ:LQ standard function. At the opening of the picture, the %,1LBH[BDOJB tag is set to , since auto-scroll is turned on if the message window is newly selected.

If auto-scroll is turned off, four special keys should enable you to navigate in the message window. These keys replace the corresponding keys of the standard toolbar 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 6PDUW2EMHFW*UDSKLF2EMHFW, which positions itself over the buttons if auto-scrolling is turned on. This is accomplished via a 7DJ&RQQHFWLRQ to the %,1LBH[BDOJB tag at 3URSHUWLHV 0LVFHOODQHRXV'LVSOD\. 6 Use of two 6PDUW2EMHFWV6WDWXV'LVSOD\V to switch between the 0HVVDJH :LQGRZ and 6KRUW7HUP$UFKLYH:LQGRZ display types. The current status of the message window is stored in the %,1LBH[BDOJB tag, which must be set to zero at 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 3URSHUWLHV6WDWH &XUUHQW6WDWXV to the %,1LBH[BDOJB tag. Create a '\QDPLF'LDORJ at 3URSHUWLHV 0LVFHOODQHRXV2SHUDWRU&RQWURO(QDEOH, which enables the operation of the 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 (YHQWV0RXVH 3UHVV/HIW, which simulates the pressing of the corresponding button on the standard toolbar and toggles the %,1LBH[BDOJB tag. Do the same to configure the 6WDWXV'LVSOD\ object. The following standard functions are used:
2Q%WQ0VJ:LQ SV]0VJ:LQ 2Q%WQ$UF6KRUWW SV]0VJ:LQ

Use two additional :LQGRZV2EMHFWV%XWWRQV to allow direct selections to be made in the message window. It should be possible to select messages referring to the motors or messages referring to the containers. The selection is executed by a project function created in the *OREDO6FULSW editor, which receives the message numbers between which the displayed messages are lying. In the

4-94

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

example, this function is named 6HW0VJ1U6HOHFWLRQ.

An additional :LQGRZV2EMHFW%XWWRQ is used to call the 2Q%WQ3ULQW SV]0VJ:LQ function for reporting. If this button is activated, the content of the short-term archive will be printed out. If a selection has been made in the window, only the selected messages will be printed. The system print job 5HSRUW$ODUP/RJJLQJ575HYROYLQJ$UFKLYH is called. By default, the 3DJH/D\RXW DOJXPDUSO is used. This page layout must be adapted or exchanged. The steps to do this are described in the example 0HVVDJH $UFKLYH5HSRUW H[BBFKDSWHUBF3'/ , in the 5HSRUW'HVLJQHU chapter.

Project Function for Setting a Selection


BOOL SetMsgNrSelection(DWORD dwFrom, DWORD dwTo, LPSTR MsgTem) { PCMN_ERROR BOOL MSG_FILTER_STRUCT pError; fRet; 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 file structure. As the V])LOWHU1DPH, the name of the message window template, to which the filter is referring to, must be used. In the GZ0VJ1U array, enter the start and end values of the message numbers to be selected. These values are supplied as transfer parameters while the function is called. The GZ)LOWHU switch is set to identify the file structure as a number filter. Call of the 06576HW0VJ:LQ)LOWHU API function, which applies the created filter to the selected message window template.

WinCC Configuration Manual C79000-G8276-C140-01

4-95

6DPSOH3URMHFWH[DPSOHB



*HQHUDO$SSOLFDWLRQ1RWHV

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.

4-96

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 :LQ&&$ODUP&RQWURO H[BBFKDSWHUBG3'/

7DVN'HILQLWLRQ

A message window is to be configured that switches between the short-term archive window and message window display types. However, no message window template is to be 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 single messages created in the first two examples of this chapter are used. In the *UDSKLFV'HVLJQHU, the message window is configured as a 6PDUW2EMHFW2/( &RQWURO. The toolbar is implemented using multiple :LQGRZV2EMHFWV%XWWRQV, 6PDUW 2EMHFWV6WDWXV'LVSOD\V and 6PDUW2EMHFWV*UDSKLF2EMHFWV.
1RWH

The configurations carried out in the previous two examples are considered complete. They will not be described again, however, this example is based on them. The configuration of the short-term archive is described in the example 0HVVDJH$UFKLYLQJ H[BBFKDSWHUBF3'/ .

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

1 2

In Tag Management, create two tags of the %LQDU\7DJ type. In the example, these are the %,1LBH[BDOJB and %,1LBH[BDOJB tags. To display the message window, a 6PDUW2EMHFW2/(&RQWURO is used. In the example, this is the &&$OJ:LQ&WUO object. After placing the object, the ,QVHUW2/(&RQWURO 2&; dialog box is automatically displayed. Select the :LQ&&$ODUP&RQWURO entry from the list and exit the dialog box by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-97

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

The 2/(2EMHFW will be displayed as follows:

' on this object to open the :LQ&&$ODUP&RQWURO3URSHUWLHV dialog box. Settings are made in this dialog box that are normally made in $ODUP/RJJLQJ while creating a message window template and message line format. In the 6W\OH tab, select 6KRUW7HUP$UFKLYH:LQGRZ from the :LQGRZ7\SH field.

In the 3DUDPHWHUV tab, select the +RUL]RQWDO and 9HUWLFDO check-boxes from the 6HSDUDWLRQ/LQHV field. Select line and column title, as well as auto-scrolling. In the 6HOHFWLRQ field, set 1R6HOHFWLRQ.

4-98

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

In the 0HVVDJH/LQH tab, the message blocks displayed in the message line are selected. The message blocks configured in $ODUP/RJJLQJ are marked by a at the beginning. For this example, all message blocks created in $ODUP/RJJLQJ are selected 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 the OCX 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.

WinCC Configuration Manual C79000-G8276-C140-01

4-99

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

To control the :LQ&&$ODUP&RQWURO, a user-defined toolbar must used. The configuration of the individual elements of the toolbar has been described in detail in the example 0HVVDJH$UFKLYLQJ H[BBFKDSWHUBF3'/ , in the table ,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU. The standard functions used there are to be replaced by functions that control the :LQ&&$ODUP&RQWURO. These functions have the same names as their counterparts used to control message window templates in application windows, however, the character string $;&B precedes them. They also differ in the way they are supplied with parameters. These functions require the picture and object names as transfer parameters. The functions used in the example are:

$;&B2Q%WQ+RUQ$FNQ OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ6LQJO$FNQ OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ9LVLEOH$FNQ OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ6FUROO OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ0VJ)LUVW OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ0VJ/DVW OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ0VJ1H[W OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ0VJ3UHY OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ0VJ:LQ OSV]3LFWXUH1DPHOSV]2EMHFW1DPH $;&B2Q%WQ$UF6KRUWW OSV]3LFWXUH1DPHOSV]2EMHFW1DPH

*HQHUDO$SSOLFDWLRQ1RWHV

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.

4-100

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 *URXS0HVVDJHV H[BBJHQHUDWRUB3'/

In runtime, this example is accessed by clicking on the %XWWRQ displayed above using the . The message generator can be turned on by selecting the $FWLYH check-box contained in this 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 of message. The messages have already been created in the examples %LW0HVVDJH3URFHGXUH &RQWLQXHG and $QDORJ$ODUPV FRQWLQXHG and can be taken over. Warnings and alarms pending in the container picture and errors occurring in the motor picture are to be pointed out. The alarm has priority over the error and warning. If a message is pending, a button 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 the single messages is generated, the group message will also be generated. A status tag and status bit is assigned to this message. Via a 6PDUW2EMHFW6WDWXV'LVSOD\, the current status of this tag is analyzed and a corresponding symbol displayed.
1RWH

The configurations carried out in the previous two examples are considered complete. They will not be described again, however, this example is based on them.

6HWXSRIWKH5HTXLUHG7DJV
6WHS 3URFHGXUH6HWXSRIWKH5HTXLUHG7DJV

In Tag Management, set up a total of three tags of the 8QVLJQHG%LW9DOXH type. In the example, these are the 8LBH[BDOJB, 8LBH[BDOJB and 8LBH[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 be created automatically. All messages within this message class are accepted into the group message. The properties of the message classes and message types of the group message can be changed independently of each other and therefore be linked to various status, lock and 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 the group messages also try to identify the picture, from which the message originated. Therefore, user-defined group messages must be created.

WinCC Configuration Manual C79000-G8276-C140-01

4-101

6DPSOH3URMHFWH[DPSOHB



&UHDWLRQRIQHZ*URXS0HVVDJHV
6WHS 3URFHGXUH&UHDWLRQRIQHZ*URXS0HVVDJHV

Open the $ODUP/RJJLQJ editor. entries. 5 on the 8VHU'HILQHG entry and select "Add Group Message" to display the 1HZ*URXS0HVVDJH dialog box.
8VHU'HILQHG

8'

on the *URXS0HVVDJHV entry. This will display the 0HVVDJH&ODVV and

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 messages that use the same 6WDWXV, /RFN and $FNQRZOHGJH tags, but enter the bitnumber 1 and 2, respectively. The right window will display the icons of the newly created group messages.

4-102

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH&UHDWLRQRIQHZ*URXS0HVVDJHV

on one of the icons and select "Add Single Message" to open the 1HZ dialog box. For each group message, enter the message numbers of the corresponding single messages and close the dialog boxes by clicking on 2..
6LQJOH0HVVDJH V

85

In the navigation window, ' on the 8VHU'HILQHG entry will display the individual group messages as sub entries. If one of these group messages is , the right window will display the icons of all added single selected using the messages.

The following picture displays the single messages of the &RQWDLQHU$ODUP group message.

WinCC Configuration Manual C79000-G8276-C140-01

4-103

6DPSOH3URMHFWH[DPSOHB



,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Create a new picture in the *UDSKLFV'HVLJQHU. In the example, this is the H[BBJHQHUDWRUB3'/. In this picture, configure a 6PDUW2EMHFW6WDWXV'LVSOD\, which displays the current status of the group messages. In the example, this is the 6WDWXV'LVSOD\ object. The status of the group messages is stored in the 8LBH[BDOJB tag, as configured in $ODUP/RJJLQJ. A bitmap must be designed for each status. This means bitmaps are required for the three unacknowledged states, the three acknowledged states and the "no message present" state. Create a &$FWLRQ at 3URSHUWLHV6WDWH&XUUHQW 6WDWXV, which controls the status depending on the 8LBH[BDOJB tag and the requested priority.

Additionally, configure a :LQGRZV2EMHFW%XWWRQ, which performs, in the case of a displayed group message, the picture change to the picture in which the message occurred. In the example, this is the %XWWRQ object. Using a &$FWLRQ at (YHQWV0RXVH0RXVH$FWLRQ, the current status of the group messages is retrieved and the picture change performed accordingly. If no message is pending, a :LQGRZV2EMHFW%XWWRQ is placed on top of the just described %XWWRQ. This new button has the purpose of making the other button inoperational and of optically displaying that inoperability. Set the 3URSHUWLHV 0LVFHOODQHRXV2SHUDWRU&RQWURO(QDEOH to 1R. Configure an additional :LQGRZV2EMHFW%XWWRQ, which allows the currently displayed group message to be acknowledged. In the example, this is the %XWWRQ object. Configure &$FWLRQ at (YHQWV0RXVH0RXVH$FWLRQ, which determines if a group message is to be acknowledged (and if yes, which one). If a message is to be acknowledged, the corresponding bit in the configured 8LBH[BDOJB acknowledge tag is set and then reset. If no unacknowledged message is pending, an additional :LQGRZV2EMHFW%XWWRQ is positioned on top of the just described %XWWRQ to make it inoperational and optically display that inoperability. Set the 3URSHUWLHV0LVFHOODQHRXV2SHUDWRU&RQWURO(QDEOH to 1R.

Configure an additional picture. In the example, this is the H[BBJHQHUDWRUB3'/. In this picture, three :LQGRZV2EMHFWV&KHFN%R[HV are configured. In the example, these are the &KHFN%R[, &KHFN%R[ and &KHFN%R[ objects. Create a &$FWLRQ each at (YHQWV3URSHUW\7RSLFV2XWSXW,QSXW6HOHFWHG %R[HV, which locks are enables the corresponding group message. Each lock is displayed in the 8LBH[BDOJB tag as configured in $ODUP/RJJLQJ. Since a lock can also be set from the other side, a &$FWLRQ must be created at 3URSHUWLHV 2XWSXW,QSXW6HOHFWHG%R[HV. This action is triggered upon the change of the 8LBH[BDOJB tag and checks, if the status of the lock controlled by the

4-104

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU &KHFN%R[

has changed.

In the picture created first (H[BBJHQHUDWRUB3'/), create a 6PDUW2EMHFW 3LFWXUH:LQGRZ and set the H[BBJHQHUDWRUB3'/ at 3URSHUWLHV 0LVFHOODQHRXV3LFWXUH1DPH. Set 1R at 3URSHUWLHV0LVFHOODQHRXV 'LVSOD\. An additional :LQGRZV2EMHFW%XWWRQ is needed that makes the previously configured 3LFWXUH:LQGRZ visible via a 'LUHFW&RQQHFWLRQ at (YHQWV0RXVH 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 are pending, 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 as follows: Container Alarm Motor Error Acknowledged Container Alarm Container Warning Acknowledged Motor Error Acknowledged Container Warning

WinCC Configuration Manual C79000-G8276-C140-01

4-105

6DPSOH3URMHFWH[DPSOHB



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, no action 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 multiple messages to be acknowledged are pending, the on with the highest priority will be acknowledged.

4-106

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 the function setting the lock. Determination of the current system time. This value is given to the VW7LPH structure member of the SYSTEMTIME type. The I,'8VHG structure member indicates, if the desired group message, which is to be locked or enabled, is identified using its name or ID. The value of FALSE determines that 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 the check-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.

WinCC Configuration Manual C79000-G8276-C140-01

4-107

6DPSOH3URMHFWH[DPSOHB



*HQHUDO$SSOLFDWLRQ1RWHV

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 picture changes to be performed must be adapted.

4-108

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 5HSRUW'HVLJQHU

In runtime, the examples pertaining to this topic can be selected by clicking on the button . The examples are configured in the H[BBFKDSWHUB3'/. displayed above with the 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 the creation and output of reports. Creation comprises the creation of the report layout in the configuration 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 your needs. The names of the system layouts and system print jobs are always preceded by the # symbol.

WinCC Configuration Manual C79000-G8276-C140-01

4-109

6DPSOH3URMHFWH[DPSOHB



 3LFWXUH'RFXPHQWDWLRQ H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

Comprehensive documentation of all pictures contained in a project is to be generated. The picture documentation should contain a graphical display, general information about the picture, 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'/3LFUSO layout. This layout is copied and adapted to meet your needs.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

Open the 5HSRUW'HVLJQHU editor from the &RQWURO&HQWHU.

Open the #3'/3LFUSO system layout via )LOH2SHQ and save it under a new name via )LOH6DYH$V. In the example, the name 3'/SLFWXUHUSO 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.

4-110

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

The 0LVFHOODQHRXV entry allows you to add a cover sheet or final page. In the example, a cover sheet is used. 3 Clicking on the button from the toolbar enables the editing of the static

picture part, while clicking on the button enables the editing of the dynamic picture part. The dynamic part of the report contains a '\QDPLF2EMHFW(PEHGGHG/D\RXW. In the example, this is the (PEHG/D\RXW dynamic object, which is not to be changed. 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 is recommended to make a copy of this layout first and then to edit the copy. If changes are made to the layout, this layout must be set in the initial layout at the (PEHG/D\RXW object via 3URSHUWLHV0LVFHOODQHRXV/D\RXW)LOH. 4 The static part of the report contains a header and a footer. The footer contains the 6\VWHP2EMHFWV 'DWH7LPH, 3DJH1XPEHU, 3URMHFW1DPH and /D\RXW1DPH. The header contains two 6WDWLF2EMHFWV6WDWLF7H[WV and one 6\VWHP2EMHFW 3URMHFW1DPH. Additionally, a logo is displayed via a 6WDWLF2EMHFW2/( (OHPHQW. Change the text of the 6WDW7H[W to 3LFWXUH'RFXPHQWDWLRQ. To display your own logo, delete the current 2OH2EMHFW. Configure a new 6WDWLF2EMHFW 2/((OHPHQW. In the ,QVHUW2EMHFW dialog box, which is displayed after placing the object in the report, select &UHDWHIURP)LOH and set the bitmap file containing your logo. Close the dialog box by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-111

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

Save the configurations made in the 5HSRUW'HVLJQHU. 5 button on the toolbar switches among the cover Clicking on the sheet, report contents and final page. The examples cover sheet contains two 6WDWLF2EMHFWV6WDWLF7H[WV and a 6WDWLF 2EMHFW2/((OHPHQW.

4-112

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6HWXSRI3ULQW-RE
6WHS 3URFHGXUH6HWXSRI3ULQW-RE

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. print job to display its properties dialog box.

8' 85
or

on the new

In the 3ULQW-RE tab, replace the default name in the 1DPH entry field by 3ULQWMREB3'/. As the /D\RXW, set the previously created layout 3'/SLFWXUHUSO. In the 6HOHFWLRQ tab, the area to be printed is set. In the 3DJH5DQJH field, select $OO. In the example, a set 7LPH5DQJH has no influence on the print job. In the 3ULQWHU6HWXS tab, the printer is selected. You can also choose to print the data to a file. In the &RQWURO&HQWHU, 5 on the print job and selecting "Print the Print Job" starts the print job. The print job can also be previewed first.

In the example project, a print job preview can be displayed via a :LQGRZV 2EMHFW%XWWRQ. This is the %XWWRQ object in the H[BBFKDSWHUB3'/. Create a &$FWLRQ at (YHQWV0RXVH0RXVH$FWLRQ, which activates the preview of the corresponding print job.

WinCC Configuration Manual C79000-G8276-C140-01

4-113

6DPSOH3URMHFWH[DPSOHB



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 the print job is used.
1RWH

If the layout, inserted into the report layout of the 5HSRUW'HVLJQHU editor, is open, the preview and the print job can not be started.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The created layout can be accepted without modifications. However, changes might become necessary for the logo and the information displayed in the report. These changes are carried out as described in step 3 and 4 of ,PSOHPHQWDWLRQLQWKH5HSRUW 'HVLJQHU.

4-114

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 5HSRUWLQJWKH3URMHFW)XQFWLRQ H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

All created project functions of a project are to be reported. General information and the source 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 layout contains an inserted layout that must also be adapted.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQWURO&HQWHU, open the #*6&B53)&USO system layout by

85

on it.

Save this system layout under a new name via )LOH6DYH$V. In the example, the name JVFBSURMHFWIXQFWLRQUSO is used. 2

5 on a blank In the properties dialog box of the layout, which is accessed by area within the report, select the &RYHU6KHHW entry from 0LVFHOODQHRXV. Accept the remaining settings. The static part of the report contains a header and a footer. The footer contains the 6\VWHP2EMHFWV 'DWH7LPH, 3DJH1XPEHU, 3URMHFW1DPH and /D\RXW1DPH. The header and footer both contain a 6WDWLF2EMHFW5HFWDQJOH as the background. Via 3URSHUWLHV&RORUV%DFNJURXQG&RORU, set the background color of these rectangles to /LJKW*UD\. The header contains two additional 6WDWLF2EMHFWV6WDWLF7H[WV and one 6\VWHP 2EMHFW3URMHFW1DPH. The existing 2OH2EMHFW, which displays the logo, is deleted. It is replaced by a 6WDWLF2EMHFW6WDWLF0HWDILOH. In the example, this is the 6WDW0HWDILOH. Via 3URSHUWLHV0LVFHOODQHRXV0HWDILOH1DPH, an existing metafile is set. In the example, this is the ORJRHPI file containing the WinCC logo. If 6WDWLF0HWDILOHV are used, be sure to link them to the report layout. If the path to the corresponding file changes, the layout must be updated.
The examples cover sheet contains two 6WDWLF2EMHFWV6WDWLF7H[WV and a 6WDWLF 2EMHFW2/((OHPHQW.

WinCC Configuration Manual C79000-G8276-C140-01

4-115

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

The dynamic part of the report consists of a '\QDPLF2EMHFW(PEHGGHG /D\RXW. In the example, this is the (PEHG/D\RXW object. As the embedded layout, the system layout #JVFUSIFUSO is used. Open the system layout #JVFUSIFUSO and save it under a new name. In the example, the name JVFBSURM LQWHUQ USO is used. The static part of this layout contains no objects. The dynamic part of this report contains two '\QDPLF2EMHFWV'\QDPLF7H[WV. In the example, these are the '\Q7H[W and '\Q7H[W objects. The connection of the '\Q7H[W object to the *OREDO6FULSW data was established as 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 *OREDO6FULSW 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(OHPHQWV entry will be displayed. This means that a selection can be made. Click on this entry using the
6HOHFWLQJ(OHPHQWV

to activate the dialog box.

button. This button opens the

In this dialog box, select $OO$YDLODEOH(OHPHQWV. For the '\Q7H[W object, a connection was established as described above. The exception being that 6RXUFH&RGH, instead of ,QIR, was selected. Configuration of appropriate fonts. In the example, the '\Q7H[W object uses the font $ULDO with a font size of SW. The font is also displayed 8QGHUOLQHG. The '\Q7H[W object uses the &RXULHU1HZ font with a font size of SW. This font is displayed 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. In the still open layout JVFBSURMHFWIXQFWLRQUSO, set the just created layout at the (PEHG/D\RXW object via 3URSHUWLHV0LVFHOODQHRXV/D\RXW)LOH. This layout replaces the previously set system layout. Via &RQQHFW3URMHFW)XQFWLRQV (in the 2EMHFW3URSHUWLHV dialog box of the (PEHG/D\RXW object), a selection can now be made. Select the 6HOHFWLQJ entry. This makes the button operational, by which the dialog box is accessed. In the example, $OO$YDLODEOH (OHPHQWV has been selected. It is also possible to directly select the project functions to be reported.
(OHPHQWV 6HOHFWLQJ(OHPHQWV

4-116

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'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 6HWXSRI3ULQW-RE. The settings can be made correspondingly.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The created layout can be accepted without modifications.

WinCC Configuration Manual C79000-G8276-C140-01

4-117

6DPSOH3URMHFWH[DPSOHB



 5HSRUWLQJRIWKH&RQWURO&HQWHU H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

All tags of certain tag groups used in a project are to be documented. The tag documentation should contain the tag name, tag type, its group, tag parameters and process connection information.

,PSOHPHQWDWLRQ&RQFHSW

Configure a new layout in the 5HSRUW'HVLJQHU editor. This layout is not based on any existing layout.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

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. 5 on this layout and select "Rename Layout" to give it a new name. In the example, the name &RQWURO&HQWHUUSO is used.

Open the new layout in the 5HSRUW'HVLJQHU. 5 on a blank In the properties dialog box of the layout, which is accessed by area within the report, select the &RYHU6KHHW entry from 0LVFHOODQHRXV. Accept the remaining settings. In the static part of the report, various 6WDWLF2EMHFWV and 6\VWHP2EMHFWV are configured for the header and footer. The design of the cover sheet is a suggestion on which your own concept can be based. In the dynamic part of the report, a '\QDPLF2EMHFW'\QDPLF7DEOH is configured. 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 by clicking on 2..

4-118

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQQHFW tab of the tables properties dialog box, several selection options are available.

data. If a selection was made, a red check-mark will be displayed. In the dialog box for selecting the tag parameters, select the 'DWD7\SH, *URXS, 3DUDPHWHUV and ([WHUQDO7DJ'DWD check-boxes. Also, select the &RPSDFW checkbox. This causes all tag data to be displayed in one line.

8'

on one of the entries brings up its corresponding dialog box for selecting

In the example, the following tag groups are selected: $ODUP/RJJLQJ and $ODUP/RJJLQJ. However, this selection is only possible, if the $OO7DJ*URXSV check-box has not been selected. To make the selection of the tag groups effective, the $OO7DJV check-box must be deselected in the tag selections dialog box.

WinCC Configuration Manual C79000-G8276-C140-01

4-119

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'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 under 6HWXSRI3ULQW-RE. The settings can be made correspondingly.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The created layout can be accepted without modifications.

4-120

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 5HSRUWLQJRI7DJ/RJJLQJ&6 H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

The configuration data of all process value archives created in a project are to be documented. The documentation should contain the general archive data and the configuration data of the individual archive tags.

,PSOHPHQWDWLRQ&RQFHSW

Configure a new layout in the 5HSRUW'HVLJQHU editor. This layout is not based on any existing layout.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQWURO&HQWHU, create a new layout by

on /D\RXW. The right window will display the new layout, using the default name 1HZ53/53/, in addition to the already existing ones. 5 on this name and rename the layout to WOJBFVUSO.

85

Open the new layout in the 5HSRUW'HVLJQHU. 5 on a blank In the properties dialog box of the layout, which is accessed by area within the report, select the &RYHU6KHHW entry from 0LVFHOODQHRXV. Accept the remaining settings. In the static part of the report, various 6WDWLF2EMHFWV and 6\VWHP2EMHFWV are configured for the header and footer. The design of the cover sheet is a suggestion on which your own concept can be based. In the dynamic part of the report, a '\QDPLF2EMHFW'\QDPLF7DEOH is configured. In the example, this is the '\Q7DEOH object. After the object is placed in the report, the &RQQHFW dialog box is displayed. Select the 3URFHVV9DOXH$UFKLYH entry from the 7DJ/RJJLQJ&6 folder. Close the dialog box by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-121

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQQHFW tab of the tables properties dialog box, several selection options are available.

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 archive selection dialog box of the "Archive Names" entry, select the $OO $UFKLYHV check-box. In the process archive selection dialog box of the "Process Archive Data" entry, select all data available. Save the settings made in the 5HSRUW'HVLJQHU.
1RWH

8'

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 under 6HWXSRI3ULQW-RE. The settings can be made correspondingly.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The created layout can be accepted without modifications.

4-122

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 3ULQW2XWWKH7UHQG:LQGRZLQ5XQWLPH H[BBFKDSWHUBD3'/

7DVN'HILQLWLRQ

A trend window is to be printed out in runtime. It should be possible to set a time range for the data to be printed. This example is based on the &\FOLF6HOHFWLYH$UFKLYLQJ H[BBFKDSWHUBD3'/ example in the 7DJ/RJJLQJ chapter. Its concepts will be utilized to print out the table displayed in this example.

,PSOHPHQWDWLRQ&RQFHSW

Configure a new layout in the 5HSRUW'HVLJQHU editor. The time selection is not made in the layout, but in runtime via a project function. This function will carry out the time selection directly in the print job.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQWURO&HQWHU, create a new layout by

5 on /D\RXW. The right window will display the new layout in addition to the already existing 5 on it. ones. Rename the layout to WOJB=6B3$BUSO by

Open the new layout in the 5HSRUW'HVLJQHU. In the static part of the report, various 6WDWLF2EMHFWV and 6\VWHP2EMHFWV are configured for the header and footer. In the dynamic part of the report, three '\QDPLF2EMHFWV'\QDPLF0HWDILOHV are 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. For all three objects, select the 7DJ7UHQG entry from the 7DJ/RJJLQJ5XQWLPH folder. Close the dialog boxes by clicking on 2..

WinCC Configuration Manual C79000-G8276-C140-01

4-123

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQQHFW tab of the '\QDPLF0HWDILOHV


properties dialog box, several selection options are 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. A 7LPH6HOHFWLRQ will not be performed. In the $UFKLYH'DWD6HOHFWLRQ dialog box, the =6B3URFHVV9DOXH$UFKLYHB archive is selected. For the '\Q0HWDILOH object, select the *BH[BWOJB tag as the archive tag. For the other two objects, set the other two available tags, respectively.

4-124

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

Save the settings made in the 5HSRUW'HVLJQHU.

6HWXSRI3ULQW-RE
6WHS 3URFHGXUH6HWXSRI3ULQW-RE

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 ' or 5 on the new -RE, in addition to the already existing print jobs. print 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$BUSO. In the 6HOHFWLRQ tab, the print range is set. In the 3DJH5DQJH field, select $OO. In the 7LPH5DQJH field, select $EVROXWH. An exact time range is not set until runtime is activated. In the 3ULQWHU6HWXS tab, the printer to be used is set. 2 In the example project, a print job preview can be displayed via a :LQGRZV 2EMHFW%XWWRQ. This is the %XWWRQ object in the H[BBFKDSWHUBD3'/. Create a &$FWLRQ at (YHQWV0RXVH0RXVH$FWLRQ, which activates the

8 8

WinCC Configuration Manual C79000-G8276-C140-01

4-125

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH6HWXSRI3ULQW-RE

preview of the corresponding print job.

To perform a time selection, a setup dialog box is necessary. This dialog box is configured as a separate picture. In the example project, this is the H[BBZLQGRZB3'/. In this picture, configure six 6PDUW2EMHFWV,2)LHOGV each for entering the start and end times. These are the ,2)LHOG to ,2)LHOG objects for setting the start time, and the ,2)LHOG to ,2)LHOG objects for setting the end time. To buffer the made settings, a tag of the 8QVLJQHG%LW9DOXH type must be created for each ,2)LHOG in 7DJ0DQDJHPHQW. In the example, these are the 8LBH[BUHSBI to 8LBH[BUHSBI tags for the start time, and the 8LBH[BUHSBW to 8LBH[BUHSBW tags for the end time. For each ,2)LHOG, a 7DJ&RQQHFWLRQ to the corresponding tag must be created via 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH. At 3URSHUWLHV2XWSXW,QSXW2XWSXW)RUPDW, the format  is set for each . One exception are the ,2)LHOGV for setting the year. They use the output format .
,2)LHOG

In the H[BBZLQGRZB3'/, create a &$FWLRQ at (YHQWV0LVFHOODQHRXV 2SHQ3LFWXUH, which supplies the time selection tags with preset time values. As the end time, the current system time is set, as the start time, the current system time minus one minute is set. Configure two :LQGRZV2EMHFWV%XWWRQV in the H[BBZLQGRZB3'/. In the example, these are the %XWWRQ and %XWWRQ objects. %XWWRQ serves as the cancel button. Create a 'LUHFW&RQQHFWLRQ at (YHQWV 0RXVH0RXVH$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 0RXVH0RXVH$FWLRQ for closing the window. Configure a &$FWLRQ at (YHQWV0RXVH3UHVV/HIW. This action calls a previously created project function that sets the time selection of a certain print job. The name of the print job is read from a tag of the 7H[W7DJ%LW&KDUDFWHU6HW type that must be created in 7DJ0DQDJHPHQW. In the example, this is the 7LBH[BUHSB tag. To display the just created picture in the H[BBFKDSWHUBD3'/, a 6PDUW2EMHFW 3LFWXUH:LQGRZ must be created. In the example, this is the 3LFWXUH:LQGRZ object. At 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, set the H[BBZLQGRZB3'/. Set the 'LVSOD\ to 1R. To display the 3LFWXUH:LQGRZ, an additional :LQGRZV2EMHFW%XWWRQ is needed. In the example, this is the %XWWRQ object. Create a &$FWLRQ for this button at (YHQWV0RXVH0RXVH$FWLRQ, which writes the print job name to

4-126

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH6HWXSRI3ULQW-RE

be processed to the 7LBH[BUHSB tag and makes the 3LFWXUH:LQGRZ object visible.

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 transfer parameters two time values in the form of the SYSTEMTIME structure. These values are determined via two project functions from the time values 7LPH)URP and 7LPH7R stored in the internal tags. In addition, the name of the print job to be processed is required. This name is stored in the 7LBH[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 path

if( !DMGetRuntimeProject( g_szProj, MAX_PATH, pError)) { printf("Error DMGetRuntimeProject(...)\r\n"); return FALSE; }


//-----create property handle

hProp = RPJCreatePropertyHandle ( g_szProj, pError ); if( !hProp) { printf("Error RPJCreatePropertyHandle(...)\r\n"); return FALSE; }
//-----get job properties

if ( !RPJGetJobProps ( hProp, jobname, pError )) { printf("Error RPJGetProps(...)\r\n");

WinCC Configuration Manual C79000-G8276-C140-01

4-127

6DPSOH3URMHFWH[DPSOHB



RPJDeletePropertyHandle ( hProp, pError); return FALSE; }


//-----set property

if ( !RPJSetProperty ( hProp, propname1, ptr1, (VARTYPE) typ, 200, pError )) { printf("Error RPJSetProperty(...)\r\n"); RPJDeletePropertyHandle ( hProp, pError); return FALSE; }
//-----save job properties

if ( !RPJSetJobProps ( hProp, jobname, pError)) { printf("Error RPJSetProps(...)\r\n"); RPJDeletePropertyHandle ( hProp, pError); return FALSE; }
//-----get job properties

if ( !RPJGetJobProps ( hProp, jobname, pError )) { printf("Error RPJGetProps(...)\r\n"); RPJDeletePropertyHandle ( hProp, pError); return FALSE; }
//-----set property

if ( !RPJSetProperty ( hProp, propname2, ptr2, (VARTYPE) typ, 200, pError )) { printf("Error RPJSetProperty(...)\r\n"); RPJDeletePropertyHandle ( hProp, pError); return FALSE; }
//-----save job properties

if ( !RPJSetJobProps ( hProp, jobname, pError)) { printf("Error RPJSetProps(...)\r\n"); RPJDeletePropertyHandle ( hProp, pError); return FALSE; }
//-----delete property handle

fRet = RPJDeletePropertyHandle ( hProp, pError); return TRUE; }

As the transfer parameters VW and VW, the function will receive the start and end times to 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$SSOLFDWLRQ1RWHV

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 the archive tags must be adapted. The time selection dialog box can be accepted without modifications. The 0RGLI\3ULQW-RE, 7LPH)URP and 7LPH7R project functions are required to ensure functionality. The tags for buffering the time values are to be configured using the same names. Otherwise, the 7LPH)URP and 7LPH7R project functions need to be adapted. To utilize the dialog box for multiple print jobs, the creation of a text tag for storing the print job name is advisable.

4-128

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 3ULQWLQJ2XWWKH7DEOHLQ5XQWLPH H[BBFKDSWHUBF3'/

7DVN'HILQLWLRQ

A table is to be printed out in runtime. It should be possible to set a time range for the data to be printed. This example is based on the 8VHUGHILQHGWDEOHOD\RXW H[BBFKDSWHUBF3'/ example in the 7DJ/RJJLQJ chapter. Its concepts will be utilized to print out the table displayed in this example.

,PSOHPHQWDWLRQ&RQFHSW

Configure a new layout in the 5HSRUW'HVLJQHU editor. The time selection is not made in the layout, but in runtime via a project function. This function will carry out the time selection directly in the print job. The procedure for making a time selection in runtime is described in the previous 6HWXSRI 3ULQW-RE table.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQWURO&HQWHU, create a new layout by

on /D\RXW. The right window will display the new layout in addition to the already existing on it. ones. Rename the layout to WOJB=.B3$BUSO by

Open the new layout in the 5HSRUW'HVLJQHU. In the static part of the report, various 6WDWLF2EMHFWV and 6\VWHP2EMHFWV are configured for the header and footer. In the dynamic part of the report, a '\QDPLF2EMHFW'\QDPLF7DEOH is configured. In the example, this is the '\Q7DEOH object. After placing the objects in the report, the &RQQHFW dialog box is displayed. Select the 7DJ7DEOH entry from the 7DJ/RJJLQJ5XQWLPH folder. Close the dialog box by clicking on 2..

85 85

WinCC Configuration Manual C79000-G8276-C140-01

4-129

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQQHFW tab of the '\QDPLF0HWDILOHV


properties dialog box, several selection options are available.

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. A 7LPH 6HOHFWLRQ is not performed. In the $UFKLYH'DWD6HOHFWLRQ dialog box, the =.B3URFHVV9DOXH$UFKLYHB archive is selected. Select all available columns of the table.

8'

4-130

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

Save the settings made in the 5HSRUW'HVLJQHU.

6HWXSRI3ULQW-RE
6WHS 3URFHGXUH6HWXSRI3ULQW-RE

In the &RQWURO&HQWHU,

85

on "Print Job" and select "New Print Job".

' or 5 on the new -RE, in addition to the already existing print jobs. print 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$BUSO. In the 6HOHFWLRQ tab, the print range is set. In the 3DJH5DQJH field, select $OO. In the 7LPH5DQJH field, select $EVROXWH. An exact time range is not set until runtime is activated. In the 3ULQWHU6HWXS tab, the printer to be used is set.
2 The procedure for making a time selection in runtime is described in the previous example in the 6HWXSRI3ULQW-RE table. button for the time selection in the Adaptations must be made to the at (YHQWV0RXVH0RXVH$FWLRQ. The 7LBH[BUHSB text tag is to be supplied with the name of the just created print job. button The print job name must be changed in the function call for the (which activates the print preview) in the &$FWLRQ at (YHQWV0RXVH0RXVH $FWLRQ.

The right window will display the new print job using the default name 3ULQW

8 8

&$FWLRQ

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The created layout can directly be used after making adaptations to the archive selection.

WinCC Configuration Manual C79000-G8276-C140-01

4-131

6DPSOH3URMHFWH[DPSOHB



 0HVVDJH6HTXHQFH5HSRUW H[BBFKDSWHUBE3'/

7DVN'HILQLWLRQ

A message sequence report is to be created. The user should be able to activate the printing of 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[BBFKDSWHUBE3'/ example in the $ODUP/RJJLQJ chapter. In that example, the toolbar of the message window used already provided a button for the report functions, and the message sequence report has been activated.

,PSOHPHQWDWLRQ&RQFHSW

A system layout and system print job are available, which meet the set requirements. These are the #DOUWPHIUSO layout and #5HSRUW$ODUP/RJJLQJ570HVVDJH6HTXHQFH print job. The layout is copied and adapted to meet your own requirements. As the print job, the above system print job must be used, only its layout is replaced.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQWURO&HQWHU, open the #DOUWPHIUSO system layout by

85

on it.

Save this system layout under a new name via )LOH6DYH$V. In the example, the name DOJBPHIUSO is used. 2 3 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. The dynamic part of the report consists of a '\QDPLF2EMHFW'\QDPLF7DEOH ("Alarm Logging Runtime" -> "Message Sequence Report"). In the example, this is the '\Q7DEOH object. Open the '\Q7DEOH objects properties dialog box and select the &RQQHFW tab. The table is already connected to the 0HVVDJH6HTXHQFH5HSRUW of $ODUP /RJJLQJ5XQWLPH. A selection has also been already performed.

4-132

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

The button or ' on the 6HOHFWLRQ entry opens the dialog box for selecting message blocks. The 'DWH, 7LPH and 1XPEHU system blocks are already button adds all remaining selected. In the example, clicking on the message blocks. Close the dialog box by clicking on 2.. Save the layout.

$GDSWLQJWKH3ULQW-RE
6WHS 3URFHGXUH$GDSWLQJWKH3ULQW-RE

Open the system print job #5HSRUW$ODUP/RJJLQJ570HVVDJH6HTXHQFH by ' or 5 on its name (and then selecting "Properties") in the &RQWURO&HQWHU.

8 8

In the 3ULQW-RE tab, set the just created /D\RXW DOUWPHIUSO. In the 3ULQWHU6HWXS tab, set the printer to be used. No further changes need to be made. Close the dialog box by clicking on 2.. The message sequence report must be activated in the $ODUP/RJJLQJ editor. Open the Alarm Logging editor. 5 on the 5HSRUWV entry and select "Add/Remove" to open the $VVLJQLQJ5HSRUW3DUDPHWHUV dialog box.

In this dialog box, select the 0HVVDJH6HTXHQFH5HSRUW check-box. 4 If the user does not activate the print job, the message sequence report will be printed automatically once a layout page has been filled.

WinCC Configuration Manual C79000-G8276-C140-01

4-133

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH$GDSWLQJWKH3ULQW-RE

To allow the user to activate the message sequence report at any time, a corresponding button must be configured in the toolbar of the message window template. This is the 5HSRUW)XQFWLRQV button. In the example project, this button has already been configured in the 0HVVDJH:LQGRZB template used in the H[BBFKDSWHUBE3'/. Save the settings made in $ODUP/RJJLQJ.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed In the layout created, the message blocks of the message sequence report must be adapted to meet your needs.

4-134

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 0HVVDJH6HTXHQFH5HSRUWRQD/LQH3ULQWHU

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/RJJLQJ57 0HVVDJH6HTXHQFH system print job.

&UHDWLRQRID/LQH3ULQWHU/D\RXW
6WHS 3URFHGXUH&UHDWLRQRID/LQH3ULQWHU/D\RXW

Create a new line printer layout by &RQWURO&HQWHU.

85

on the corresponding entry in the

A new line printer layout with the default name 1HZ5353 is created. In the example, this name is kept. ' on the name of the new line printer layout (in the 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 the message blocks to be used in the message sequence report. In the example, all available message blocks are selected. 3 The number of columns and their width is automatically adjusted according to the selected message blocks and their order.

Save the settings made and close the line layout editor.

WinCC Configuration Manual C79000-G8276-C140-01

4-135

6DPSOH3URMHFWH[DPSOHB



$GDSWLQJWKH3ULQW-RE
6WHS 3URFHGXUH$GDSWLQJWKH3ULQW-RE

1 2

Open the system print job #5HSRUW$ODUP/RJJLQJ570HVVDJH6HTXHQFH by ' or 5 on its name (and then selecting "Properties") in the &RQWURO&HQWHU. In the 3ULQW-RE tab, select the /LQH/D\RXWIRU/LQH3ULQWHU check-box and set the just created /D\RXW 1HZ5353. In the 3ULQWHU6HWXS tab, set the line printer to be used. No further changes need to be made. The dialog box is closed by clicking on 2..

8 8

The message sequence report must be activated in the $ODUP/RJJLQJ editor. Open the Alarm Logging editor. 5 on the 5HSRUWV entry and select "Add/Remove" to open the $VVLJQLQJ5HSRUW3DUDPHWHUV dialog box. In this dialog box, select the 0HVVDJH6HTXHQFH5HSRUW check-box.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The desired page settings and message blocks to be printed must be adapted to meet your needs.

4-136

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 0HVVDJH$UFKLYH5HSRUW H[BBFKDSWHUBF3'/

7DVN'HILQLWLRQ

A message archive report is to be created. The user should be able to activate the printing of the report via a button. This example is based on the 0HVVDJH$UFKLYLQJ H[BBFKDSWHUBF3'/ example in the $ODUP/RJJLQJ chapter. In that example, the user-defined toolbar of the short-term archive window already provided a button for the report function, and the message sequence report has been activated.

,PSOHPHQWDWLRQ&RQFHSW

A system layout and system print job are available, which meet the set requirements. These are the #DOUWXPDUSO layout and #5HSRUW$ODUP/RJJLQJ575HYROYLQJ$UFKLYH print job. The layout is copied and adapted to meet your requirements. As the print job, the above system print job must be used, only its layout is replaced.

,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH5HSRUW'HVLJQHU

In the &RQWURO&HQWHU, open the #DOUWXPDUSO system layout by

Save this system layout under a new name via )LOH6DYH$V. In the example, the name DOJBXPD is used. 2 3 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. The dynamic part of the report consists of a '\QDPLF2EMHFW'\QDPLF7DEOH ("Alarm Logging Runtime" -> "Short-Term Archive Report"). In the example, this is the '\Q7DEOH object. Open the '\Q7DEOH objects properties dialog box and select the &RQQHFW tab. The table is already connected to the 6KRUW7HUP$UFKLYH5HSRUW of $ODUP /RJJLQJ5XQWLPH. A selection has also been already performed. 4 The button or ' on the 6HOHFWLRQ entry opens the dialog box for selecting message blocks. The 'DWH, 7LPH and 1XPEHU system blocks are already button adds all remaining selected. In the example, clicking on the message blocks. Close the dialog box by clicking on 2.. Save the layout.

85

on it.

WinCC Configuration Manual C79000-G8276-C140-01

4-137

6DPSOH3URMHFWH[DPSOHB



$GDSWLQJWKH3ULQW-RE
6WHS 3URFHGXUH$GDSWLQJWKH3ULQW-RE

1 2

Open the system print job #5HSRUW$ODUP/RJJLQJ575HYROYLQJ$UFKLYH by ' or 5 on its name (and then selecting "Properties") in the &RQWURO&HQWHU. In the 3ULQW-RE tab, set the just created /D\RXW DOUWXPDUSO. In the 3ULQWHU6HWXS tab, set the printer to be used. No further changes need to be made. The dialog box is closed by clicking on 2.. The archive report must be activated in the $ODUP/RJJLQJ editor. Open the 5 on the 5HSRUWV entry and select "Add/Remove" to Alarm Logging editor. open the $VVLJQLQJ5HSRUW3DUDPHWHUV dialog box.

8 8

In this dialog box, select the $UFKLYH5HSRUW$FWLYH check-box. Save the settings made in $ODUP/RJJLQJ. 4 To allow the user to activate the report at any time, a corresponding button must be configured in the toolbar of the message window template. If a user-defined toolbar is used, the pressing of this button must be simulated my a standard function. This would be the standard function 2Q%WQ3ULQW SV]0VJ:LQ . In the example project, this button has already been configured in the H[BBFKDSWHUBE3'/.

*HQHUDO$SSOLFDWLRQ1RWHV

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 meet your needs.

4-138

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 2/(&RPPXQLFDWLRQWR(;&(/

In runtime, the examples to this topic can be selected by clicking on the button displayed . These examples are configured in the H[BBFKDSWHUB3'/ and the above with the 2/(B&RPPXQLFDWLRQ[OV Excel spreadsheet.

WinCC Configuration Manual C79000-G8276-C140-01

4-139

6DPSOH3URMHFWH[DPSOHB



 5HDGLQJDQG:ULWLQJ7DJ9DOXHV H[BBFKDSWHUB3'/

7DVN'HILQLWLRQ

The values of internal tags of different types are to be read into an Excel spreadsheet. In a second column of the spreadsheet, it should be possible to enter set point values for these tags. 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 be displayed and written. Create a spreadsheet in Excel (Version 8.0). In a column of this spreadsheet, the names of the tags to be read and written are entered. Add two buttons to the spreadsheet. Macros are assigned to these buttons, which read the tag names to be processed and either read or assign set point values to these tags.

,PSOHPHQWDWLRQLQ:LQ&&
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ:LQ&&

In Tag Management, create tags of several types. In the example, the following tags are used:

In a picture, a 6PDUW2EMHFW,2)LHOG is configured for each tag created. At 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH, create a 7DJ&RQQHFWLRQ to the corresponding tag.

4-140

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

,PSOHPHQWDWLRQLQ([FHO 9HUVLRQ
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ([FHO

Create a new Excel spreadsheet. In the example, this spreadsheet is named 2/(B&RPPXQLFDWLRQ[OV. In the spreadsheet, fill out a column with the names of the tags to be processed. Configure a button for reading tag values. For this purpose, activate the &RQWURO7RROER[ toolbar from the 9LHZ7RROEDUV menu (if it is not activated yet). Select the "Command Button" element and place it 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 the caption.

8'
3

on the created command button opens the Visual Basic Editor, where the detailed procedure code can be entered.

Create an additional button, as described in step 2, for writing tag values.

WinCC Configuration Manual C79000-G8276-C140-01

4-141

6DPSOH3URMHFWH[DPSOHB



Procedure for Reading Tag Values


Rem Read Tag Values in WinCC-Project

Private Sub GetValue_Click() Dim Dim Dim Dim Dim mcp As Object var As String value As Variant cell As Variant 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 be processed) 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 empty cell (of the columns containing the tag names) is reached.

4-142

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

Procedure for Writing Tag Values


Rem Set Tag Values in WinCC-Project

Private Sub SetValue_Click() Dim Dim Dim Dim Dim Dim mcp As Object var As String value As Variant cell As Variant i As Integer 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 be processed) 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. The loop is continued until an empty cell (of the columns containing the tag names) is reached.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: Data is exchanged between WinCC and Excel using the GetValue() and SetValue() functions.

WinCC Configuration Manual C79000-G8276-C140-01

4-143

6DPSOH3URMHFWH[DPSOHB



 $GGLWLRQDO&RQILJXUDWLRQVLQWKH([DPSOHV

This chapter describes the additional elements used in some of the pictures. The description of these elements in the examples where they occur would distract from the main topic. This chapter completes the description of the sample projects.

4-144

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 3LFWXUH5HJLVWHU

7DVN'HILQLWLRQ

The order of the last 10 selected pictures in the project are to be stored. A "Back" button should allow the selection of these pictures in reverse order. A "Forward" button should allow the selection of the current picture. In a separate picture, all pictures of the register are to be displayed in the right order. A direct 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 is called at every picture change. It controls the picture selection performed by the "Back" and "Forward" buttons and the direct picture selection.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

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 of the "Forward" and "Back" buttons. A tag of the 8QVLJQHG%LW9DOXH type is required. In the example, this is the 8LBH[BRUJB tag. This tag stores the current position in the picture register. A tag of the 7H[W7DJ%LW&KDUDFWHU6HW type is required. In the example, this is the 7[BH[BRUJB tag. This tag stores the current picture name. A project function for controlling the picture register is available. This is the &UHDWH3LFWXUH6HTXHQFH function, which is called at every picture change. This is accomplished by a &$FWLRQ at (YHQWV3URSHUW\7RSLFV0LVFHOODQHRXV 3LFWXUH1DPH of the :RUNVSDFH object in the H[BBVWDUWSLFWXUHB3'/. Every time a call is made, the new picture name is stored in the register and the remaining names are moved back by one position. In the keyboard layout H[BBNH\ERDUGB3'/, two control elements for scrolling backward and forward are configured.

If one of these elements is operated, the &UHDWH3LFWXUH6HTXHQFH project function will be called. This function performs the picture change. The two control elements can be disabled via two 6PDUW2EMHFWV*UDSKLF2EMHFWV. 4 The following button displays a picture containing the current picture register. In the example, this is the H[BBUHJLVWHUB3'/.

In this picture, 10 6WDQGDUG2EMHFWV6WDWLF7H[WV are configured. The set text is deleted at all objects. For the picture object, create a &$FWLRQ at 3URSHUWLHV *HRPHWU\3LFWXUH:LGWK, which calls the &UHDWH3LFWXUH6HTXHQFH project

WinCC Configuration Manual C79000-G8276-C140-01

4-145

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

function. This function transfers the stored picture names to the 6WDWLF7H[WV. The &$FWLRQ is triggered upon the change of the 7[BH[BRUJB tag. This updates the display at a picture change. For each 6WDWLF7H[W, create &$FWLRQ at (YHQWV0RXVH3UHVV/HIW, which calls the project function and performs the picture change to the displayed picture. The selected picture is highlighted in color. This is accomplished via a '\QDPLF'LDORJ at 3URSHUWLHV&RORUV)RQW&RORUV of each static text.

The project function uses a parameter to identify from where it was called. For this parameter, some constants have been defined in the $3'()$3+ file. This file 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 10 void 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); }

4-146

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 function was called by the &$FWLRQ at (YHQWV3URSHUW\7RSLFV0LVFHOODQHRXV3LFWXUH 1DPH of the :RUNVSDFH object in the H[BBVWDUWSLFWXUHB3'/. The :RUNVSDFH object is the picture window in which all the example pictures are displayed. If the picture change is not to be entered into the register, the VW tag must be set to  in a previous function call. The register itself consists of a static array having 10 text tags.

WinCC Configuration Manual C79000-G8276-C140-01

4-147

6DPSOH3URMHFWH[DPSOHB



If the transfer parameter Q)ODJ has the value of 5(*B%$&., the "Back" button has been pressed. The picture change is performed by the function itself and is not entered into the register. If the transfer parameter Q)ODJ has the value of 5(*B)25:$5', the "Forward" button has been pressed. The picture change is performed by the function itself and is not entered into the register. If the transfer parameter Q)ODJ has the value of 5(*B6+2:5(*,67(5, the 6WDWLF 7H[WV in the H[BBUHJLVWHUB3'/ are to be updated. This is the case if the named picture has been selected or if a picture change has been performed in an opened picture. If the transfer parameter Q)ODJ has the value of 5(*B',5(&7, a direct picture selection via the 6WDWLF7H[WV has been performed. The picture change is performed by the &$FWLRQ at the 6WDWLF7H[W and is not entered into the register.

*HQHUDO$SSOLFDWLRQ1RWHV

For the general application, the following adaptations must be performed: The configurations made can be accepted without changes. To ensure functionality, the 5 tags used must be created, the project function be incorporated and the control elements be added. If the direct picture selection and the display of the picture register is not needed, the sections 5(*B',5(&7 and 5(*B6+2:5(*,67(5 from the project function can be omitted. If the number of stored pictures is to be modified, the definition 0$;B5(* (for the maximum number of pictures) in the project function must be changed.

4-148

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 7DEOHRI&RQWHQWV

The example projects table of contents can be displayed by clicking on the above button . with the

7DVN'HILQLWLRQ

The entire contents of the project is to be displayed in a dialog box. One window should display the main chapters. Another window should display the examples belonging to a selected chapter. It should be possible to directly select an example. The selection should be activated by a double-click.

,PSOHPHQWDWLRQ&RQFHSW

The selection of the contents dialog box is made via a button from the overview bar. This dialog box is displayed via a picture window. The dialog box contains an additional picture window, which displays, depending on the chapter selected, another picture.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Two tags of the 8QVLJQHG%LW9DOXH type are required. In the example, these are the 8LBH[BFRQB and 8LBH[BFRQB tags. These tags store the currently selected chapter number and example number. A picture of the dialog boxs layout is available. This is the H[BBUHJLVWHUB3'/. For each chapter, a 6WDQGDUG2EMHFW6WDWLF7H[W and a 6PDUW2EMHFW*UDSKLF2EMHFW is configured. At the opening of the picture, no chapter is selected. The 8LBH[BFRQB tag , the corresponding has the value of zero. If a 6WDWLF7H[W is selected with the chapter number is written into the tag. Using multiple '\QDPLF'LDORJV, the coloring of the selected 6WDWLF7H[W is changed.

WinCC Configuration Manual C79000-G8276-C140-01

4-149

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

A separate picture is configured for each chapter, which, depending on the selected chapter number, is displayed in a 6PDUW2EMHFW3LFWXUH:LQGRZ. If no chapter is selected, the picture window will not be displayed. Each example also contains a 6WDQGDUG2EMHFW6WDWLF7H[W. If a chapter is selected, no example is selected at first. If a 6WDWLF7H[W is selected with the the corresponding example number is written into the 8LBH[BFRQB tag. Using multiple '\QDPLF'LDORJV, the coloring of the selected 6WDWLF7H[W is changed.

To realize the picture selection via double-click, three external C-tags have been created. They are generated using the &UHDWH([WHUQDO project function. This function is executed once at the start of the project: extern BOOL bPress1,bPress2
extern int nButtonID A &$FWLRQ at the pictures 3URSHUWLHV*HRPHWU\3LFWXUH:LGWK queries, in 500 ms cycles, if a double-click has been performed. If this is the case, an action is 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 6WDWLF7H[W. This will determine the action to be performed. At each mouse click, E3UHVV and E3UHVV are alternately set to 758(.

4-150

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

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 has been performed on a 6WDWLF7H[W in the past 500 ms. The &$FWLRQ is executed every 500 ms. 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 6WDWLF7H[W was selected. Return of the picture width.

WinCC Configuration Manual C79000-G8276-C140-01

4-151

6DPSOH3URMHFWH[DPSOHB



 'LDORJ%R[HVIRU6HWWLQJ&RORUV H[BBFKDSWHUBF

The dialog boxes for setting colors described in this example are displayed by selecting the above button from the H[BBFKDSWHUBF3'/ with the .

7DVN'HILQLWLRQ

Using several dialog boxes, the color settings of the table described in the 7DJ/RJJLQJ chapter, example 8VHUGHILQHGWDEOHOD\RXW H[BBFKDSWHUBF3'/ , can be changed. The background color of the table as well as each columns font color are to be changeable.

,PSOHPHQWDWLRQ&RQFHSW

The setting colors dialog boxes are realized using three pictures. The first picture, which is displayed by pressing on the button above, shows a dialog box containing the current color settings. 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 '. From this dialog box in turn, an additional dialog box can be reached for selecting a color from a total of 50 colors.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Five tags of the 8QVLJQHG%LW9DOXH type are used. In the example, these are the &2B7,0(, &2B0$;, &2B0,1, &2B0($1 and &2B%$&. tags. These tags store the current color values. A tag of the 8QVLJQHG%LW9DOXH 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 with an 2.%XWWRQ. A tag of the 7H[W7DJ%LW&KDUDFWHU6HW type is used as an address tag. The name of the color tag to be processed is stored in this tag. In the example, this is the &2B$GGUHVV7DJ. The table configured in the H[BBFKDSWHUBF3'/ consists of several individual objects. All properties of these objects that are changeable have a 7DJ &RQQHFWLRQ to one of the color tags. A picture of the first dialog boxs layout is available. This is the H[BB)'B3'/. For each property that can be set, a 6WDQGDUG2EMHFW 6WDWLF7H[W and a 6WDQGDUG2EMHFW5HFWDQJOH is configured. The rectangle displays the currently set color of each property. This is realized via a 7DJ&RQQHFWLRQ to the corresponding color tag. Create a &$FWLRQ for the 5HFWDQJOHV and 6WDWLF7H[WV at (YHQWV0RXVH3UHVV/HIW, which writes the name of the corresponding color tag into the address tag. Double-clicking on one of these rectangles opens a dialog box for selecting a color from among the 16 basic colors. The double-click is queried at 3URSHUWLHV *HRPHWU\3RVLWLRQ; of the *UDSKLF2EMHFW.

4-152

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

The layout of the second dialog box has been configured in another picture. This is the H[BB)'B3'/. For each color that can be selected, a 6WDQGDUG2EMHFW 5HFWDQJOH is configured whose background color matches the color to be set. Also configure a 'LUHFW&RQQHFWLRQ for each color at (YHQWV0RXVH3UHVV /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 (YHQWV0RXVH0RXVH $FWLRQ, which turns the current window invisible. Via a separate :LQGRZV2EMHFW%XWWRQ, the next dialog box can be opened.

WinCC Configuration Manual C79000-G8276-C140-01

4-153

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

The layout of the third dialog box has been configured in another picture. This is the H[BB)'B3'/. Just as described in step 4, a 6WDQGDUG2EMHFW 5HFWDQJOH is configured for each color that can be selected. However, the 'LUHFW &RQQHFWLRQ at (YHQWV0RXVH3UHVV/HIW is not writing the color tag indicated 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 tag after activation of the OK button. In the picture, a 6PDUW2EMHFW*UDSKLF2EMHFW is configured, which displays the current color value contained in the &2B7(03 tag. In the example, this is the 6HOHFWLRQ object. The position of this object is changed, if a rectangle is selected, via a &$FWLRQ at (YHQWV0RXVH3UHVV/HIW.

In the H[BBFKDSWHUBF3'/, a 6PDUW2EMHFW3LFWXUH:LQGRZ is configured for each dialog box. The 3LFWXUH:LQGRZ containing the first dialog box is opened via a :LQGRZV2EMHFW%XWWRQ.

4-154

WinCC Configuration Manual C79000-G8276-C140-01



6DPSOH3URMHFWH[DPSOHB

 %DU*UDSK'LVSOD\ H[BBFKDSWHUBH

The bar graph display described in this example was used in the 7DJ/RJJLQJ chapter,  $UFKLYLQJDW6HW7LPHV H[BBFKDSWHUBH3'/ example.

7DVN'HILQLWLRQ

The current values of the tags archived in a corresponding picture are to be displayed using three bar graphs. It should be possible to deactivate each bar graph via a button.

,PSOHPHQWDWLRQ&RQFHSW

Each bar graph consists of a 6PDUW2EMHFW6WDWXV'LVSOD\, which displays the foreground of the bar graph, and a 6PDUW2EMHFW3LFWXUH:LQGRZ, in which the background of the bar graph is displayed. A '\QDPLF'LDORJ controls the height of the 3LFWXUH:LQGRZ depending on the value of the tag to be displayed.

,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Three pictures are available, each consisting of a 6PDUW2EMHFW*UDSKLF 2EMHFW. These are the H[BB%+B3'/, H[BB%+B3'/ and H[BB%+B3'/. Each *UDSKLF2EMHFW contains a bitmap, which displays the background of the bar graph. In the H[BBFKDSWHUBH3'/, three 6PDUW2EMHFWV6WDWXV'LVSOD\V are configured, which display the foreground of each bar graph. If the bar graph is deactivated, the background of the bar graph is displayed. A 6PDUW2EMHFW3LFWXUH:LQGRZ is placed over each 6WDWXV'LVSOD\. The pictures described in step 1 are set at 3URSHUWLHV0LVFHOODQHRXV3LFWXUH 1DPH. Configure a '\QDPLF'LDORJ at 3URSHUWLHV*HRPHWU\:LQGRZ+HLJKW, which controls the height of the picture window depending on the value of the tag to be displayed.

WinCC Configuration Manual C79000-G8276-C140-01

4-155

6DPSOH3URMHFWH[DPSOHB



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQWKH*UDSKLFV'HVLJQHU

Only positive values can be displayed. Therefore, the absolute value of the tag is formed using the DEV function. The maximum value that can be displayed is 100. Since the 3LFWXUH:LQGRZ displays the background of the bar graph, the tag value must be subtracted from the maximum value to maintain the background height. One unit of the bar graph consists of 3 pixels in the bitmap, therefore the calculated height of the bar graph height must be multiplied by 3. Above the bar graph background, there are 14 free pixels, which must be added to the picture height. 4 Via three 6PDUW2EMHFWV6WDWXVGLVSOD\V on the toolbar, the bar graphs can be deactivated. This is done via &$FWLRQ at (YHQWV0RXVH3UHVV/HIW. This &$FWLRQ toggles the visibility of the SLFWXUHZLQGRZ, toggles the visibility of the picture displayed in the status display (which displays the bar graph), and toggles the picture displayed by its own object.

4-156

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 8VHU $UFKLYH
This manual describes the way in which the new User Archive works and the procedure for configuring and using it.

WinCC Configuration Manual C79000-G8276-C140-01

5-1

8VHU$UFKLYH



 8VHU$UFKLYH

At runtime you can access the examples concerning this subject by choosing the button in the H[DPSOHB8$ project. The examples are configured in illustrated above using the pictures H[BBFKDSWHUBSGO to H[BBFKDSWHUBFSGO.

*HQHUDOLQIRUPDWLRQ

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 WinCC tags and WinCC raw data tags for communication with the PLC. User Archive can also be configured 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 them from a CSV file. Displayed data can be filtered according to different criteria and sorted according to your specific requirements. The OLE control has a freely configurable toolbar and status bar. Different display formats can be assigned to the various columns of the table. By configuring views, you can display fused data from different archives.

5-2

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 &UHDWLQJD8VHU$UFKLYH H[BBFKDSWHUB3'/

7DVNGHILQLWLRQ

You wish to create an archive having data records consisting of five integer boxes and a text box for storing a data record name. You want the data of the archive to be available record for record throughout the project.

,PSOHPHQWDWLRQFRQFHSW

An archive is created in the user archive editor for archiving the data. Archive communications will be configured with WinCC tags. Six data fields of the requisite field types will be created in the archive. An internal WinCC tag will be assigned to each data field 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 user archive. A connection is not established to the subordinate PLC and, instead, internal WinCC tags will be used to demonstrate the method of working. Examples containing a fully configured connection will be found further below.

&UHDWLQJDQDUFKLYH
6WHS 3URFHGXUH&UHDWLQJDQ$UFKLYH

Create one internal tag for each data record in the archive. Communications between the archive and the rest of the system will take place by means of these tags. In the example, use is made of tags 6LBH[B8$LB to 6LBH[B8$LB of the VLJQHGELWYDOXH type. Further, a type ELWIRQWWH[WWDJ is created for storing the data record name. In our example, this is tag 7LBH[B8$LB. Open the XVHUDUFKLYHHGLWRU. You do this by clicking 8VHU$UFKLYH in &RQWURO&HQWHU.

85

on the entry called

Create a new archive. Click 5 on the $UFKLYH entry to start a wizard. This wizard guides the user through the process of creating a new archive.

WinCC Configuration Manual C79000-G8276-C140-01

5-3

8VHU$UFKLYH



6WHS

3URFHGXUH&UHDWLQJDQ$UFKLYH

Fill out the wizards page called *HQHUDO,QIRUPDWLRQ. At this stage you give general details about the archive you want to create. You have to enter the DUFKLYHQDPH. The archive name length may be as many as 20 characters. You must not use any ANSI C (programming language) or SQL (database query language) keywords. In our example, we enter 8VHU$UFKLYHBL as the name in the $UFKLYH1DPH box. In the $OLDV box, we can enter a piece of text that describes the archive in greater detail. All alpha and numeric entries are accepted in this box. Completion of this box is optional, however. In our example, we will leave the $OLDV box blank. Further, we have to select the DUFKLYHW\SH. If this is set to /LPLWHG, we will have to specify the maximum number of GDWDUHFRUGV that the archive will be allowed to hold. In our example, we will set 8QOLPLWHG as the DUFKLYHW\SH. The wizards page is closed by clicking 1H[W.

Fill out the wizards &RPPXQLFDWLRQV page. At this stage we have to specify how our new archive will communicate with the rest of the project. If we select &RPPXQLFDWLRQVYLD:LQ&&5DZ'DWD7DJ, we have to set a WinCC raw data tag on this page. A complete data record is transferred via this set tag with this type of communication. Further, we have to enter a 3/&,', which may contain up to eight characters. This ID can be used to assign a block of raw data that has been sent by the programmable logic controller to a specific archive. If we select &RPPXQLFDWLRQVYLD:LQ&&7DJ V , we will have to assign a WinCC tag to every data field in the archive. However, we cannot do this until we create the 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 &RPPXQLFDWLRQVYLD:LQ&&7DJ V . The wizards page is closed by clicking 1H[W.

5-4

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&UHDWLQJDQ$UFKLYH

Fill out the wizards &RQWURO7DJV page. Here you can set four internal or external WinCC 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 :RUNLQJZLWK&RQWURO7DJV H[BBFKDSWHUB3'/ contains a detailed description of this subject. The wizards page is closed by clicking 1H[W.

Fill out the wizards 3ULYLOHJHVDQG)ODJV page. In the 3ULYLOHJHV box, we can set authorization levels for the UHDG and ZULWH types button opens a dialog box containing a list of access. Clicking the of all the authorization levels created using the 8VHU$GPLQLVWUDWRU editor. You can choose the authorization level you require from the list. Section 6KXWGRZQ :LQ&&DFFHVVSURWHFWLRQ contains an in-depth description of configuring users and authorization levels with the 8VHU$GPLQLVWUDWRU editor. Pre-defined columns can be inserted into the archive in the )ODJV box. A column is 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.

WinCC Configuration Manual C79000-G8276-C140-01

5-5

8VHU$UFKLYH



6WHS

3URFHGXUH&UHDWLQJDQ$UFKLYH

In our example, we will not perform any settings on this page of the wizard. The wizards page is closed by clicking )LQLVK.

The archive you have just configured now appears in the tree structure under the entry $UFKLYHV.

Click 5 on the entry of the new archive or the button while the entry is selected to open the Properties dialog box of the archive. The dialog box shows all the wizards pages and the details we made on them in the form of tabs. In addition, there is another tab for setting the archive order. However, there is only a single archive at this stage of configuration.

5-6

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

1RWH

By default, the user archive editor is set such that when you have completed one archive you are prompted as to whether you wish to create another one. This feature can be modified by choosing (GLW2SWLRQV from the menu and deselecting the corresponding check box. The same applies to boxes, views and columns.

&RQILJXULQJGDWDILHOGV
6WHS 3URFHGXUH&RQILJXULQJ'DWD)LHOGV

5 on the entry of the new Create the individual boxes of the archive. Click archive to start a wizard. This wizard guides the user through the process of creating a new box.

Fill out the wizards page called *HQHUDO,QIRUPDWLRQ. At this stage you provide general details about the box you want to create. You have to enter the ER[QDPH. The box name is subject to the same constraints as the archive name. In our example, we will use the name 5HFRUG1DPH as the ER[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. If you do not enter a name, the ER[QDPH is used as the column heading. There is also the possibility of entering the DOLDV directly or of using a reference to a text in the WH[WOLEUDU\. The second possibility is sensible only when you want to create multi-lingual projects. Clicking the button opens a dialog box for entering text in the WH[W OLEUDU\ or selecting text from the WH[WOLEUDU\. Text entered in the 7H[W box is entered in the WH[WOLEUDU\ by clicking 2.. The DOLDV used is then a reference to this text. You can search for existing text in the 6HOHFW box, too. When doing so, you enter a word or a piece of text that you require to be contained in the text you are looking for as a ILOWHU. In this case the character is used a wildcard character. If you just enter , the whole contents of the WH[WOLEUDU\ is displayed in the list on the list box updates its contents. box. Clicking In our example, we will enter ER[QDPH as WH[W. Close the 7H[W/LEUDU\ dialog box by clicking 2..

WinCC Configuration Manual C79000-G8276-C140-01

5-7

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJ'DWD)LHOGV

Further, we have to select the W\SH of box. At the present time the types available are QXPEHU LQWHJHU , QXPEHU GRXEOH , VWULQJ and GDWHWLPH. In our example, we will set the W\SH of box to VWULQJ. We also have to set the string OHQJWK for this type. In our example, we will set the value to . The wizards page is closed by clicking 1H[W.

Fill out the wizards page called 9DOXHV. Here we can set numeric box types to 0D[LPXP, 0LQLPXP and also 6WDUW9DOXH. In the case of text boxes, we can enter a default value for the VWDUWYDOXH that is dependent upon the defined length. If &RPPXQLFDWLRQYLD:LQ&&7DJ V has been configured, we have to set a corresponding tag for every box. In our example, we will select the text tag called 7LBH[B8$LB, which we configured earlier. The wizards page is closed by clicking 1H[W.

5-8

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJ'DWD)LHOGV

Fill out the wizards 3ULYLOHJHVDQG)ODJV page. In the 3ULYLOHJHV box we can set authorization levels for the UHDG and ZULWH types of access. The authorization levels set at this stage refer to a single box. It is therefore possible to protect individual boxes from unauthorized access. In the )ODJV box, we can assign various properties to the box. The following properties can be assigned: The PXVWKDYHDYDOXH, which was must not be zero. The PXVWKDYHDXQLTXHYDOXH, the values of this column must all differ from each other. The ER[VKRXOGEHVXSSRUWHGE\DQLQGH[. In our example, we will not perform any settings on this page of the wizard. The page is closed by clicking )LQLVK.

In our example, let us now create five more boxes. We want them to be QXPEHU LQWHJHU type boxes. The names of the boxes will range from 3UHVVXUHBD to 3UHVVXUHBH; the aliases of the boxes will range from 3UHVVXUH to 3UHVVXUH. A

WinCC Configuration Manual C79000-G8276-C140-01

5-9

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJ'DWD)LHOGV VLJQHGELWWDJ, which we created earlier, will be set as the tag. The remaining box settings will be similar to those of the first box. The new boxes are displayed in the list when 8VHU$UFKLYHBL archive is selected in the tree structure.

5 on the entry of a box or the button while the box is selected to Click open the Properties dialog box associated with the box. The dialog box shows all the wizards pages and the details we provided on them in the form of tabs. In addition, there is another tab for setting the archive box order.

Save the configurations you have performed. To do this, you can use the button on the toolbar or you can choose 3URMHFW6DYH from the menu. When doing so, make sure that the XVHUDUFKLYHHGLWRU is not in the mode for entering 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.

5-10

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 'DWD(QWU\ H[BBFKDSWHUB3'/

7DVNGHILQLWLRQ

The present example is based on the previous example &UHDWLQJD8VHU$UFKLYH H[BBFKDSWHUB3'/ . We want to supply the archive we created earlier with data. In doing so, we want to avail ourselves of the possibilities provided by direct data entry in the user archive editor and that of data import from an external file.

'DWDHQWU\LQWKHXVHUDUFKLYHHGLWRU
6WHS 3URFHGXUH'DWD(QWU\LQWKH8VHU$UFKLYH(GLWRU

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

Switch the archive to Runtime Data mode. You do this by clicking the button on the toolbar or by choosing (GLW5XQWLPH'DWD from the menu. The data of an archive can be modified in this mode only. A blank table, whose columns correspond to the data structure of the archive we configured, appears in the lower table window.

Enter the data. Before we can enter data in a box, we have to select the box by '. If the focus is in the table window, entry of a new data record can be initiated by clicking the button on the toolbar.

button on the toolbar, If the focus is in the table window and if you click the in the table window is in Change mode. It suffices to select a box with the order 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 than one data record at a time.

WinCC Configuration Manual C79000-G8276-C140-01

5-11

8VHU$UFKLYH



,PSRUWLQJGDWDIURP&69ILOHV
6WHS 3URFHGXUH,PSRUWLQJ'DWDIURP&69)LOHV

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 )LOH6HOHFWLRQ box, we specify the name of the file to which we wish to button to select an existing file. export our archive data records. Click the In our example, the file we will set in the )LOH6HOHFWLRQ box is the one called H[B8$LFVY. We leave &69 (comma separated values) set as the file format. We can modify button. In our the separator used for the file by clicking the example, we will keep to the default semicolon, however.

In the $UFKLYH6HOHFWLRQ box we set the 8VHU$UFKLYHBL archive. We will keep $OO as the ILOWHU so that all the data stored in the archive are exported. There is also the possibility of setting a filter to the values of a specific

5-12

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSRUWLQJ'DWDIURP&69)LOHV

box or making a selection by means of an SQL expression. Clicking the file we selected. 2 button starts the export operation of the data to the

The file we just selected can be opened only with a text editor of some description. In our example, the file was opened with the Microsoft editor. It will be retained for importing the necessary file structure.

When creating a file which you want to use as a basis for importing data, make sure the quotation marks enclosing text boxes are removed, since otherwise errors will occur during the import operation. Existing data records are not overwritten during the import operation. Data records are identified by the IDs displayed in the first column. Imported files should contain only data records having 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 Excels Open dialog box, change the file type setting from 0LFURVRIW([FHO )LOHV to WH[WILOHV.

The different boxes in the archive are then displayed in such a manner that they are distributed over various columns in a table. Various new data records can be created in a user-friendly manner as illustrated below.

In our example, we will now save the file by choosing )LOH6DYH$V from the menu as LPB8$LFVY. Excel automatically removes the quotation marks encompassing the text boxes during the operation. We can now exit Excel. The final query on the save operation can be answered by selecting 1R, since the data have already been saved in a new file. 4 Import the data into the user archive editor. We do this by clicking the button on the toolbar. The Import dialog box opens.

WinCC Configuration Manual C79000-G8276-C140-01

5-13

8VHU$UFKLYH



6WHS

3URFHGXUH,PSRUWLQJ'DWDIURP&69)LOHV

In the )LOH6HOHFWLRQ box, we set the file receiving the data by clicking the button. In our example, the file we set in the )LOH6HOHFWLRQ box will be the one we created earlier, in other words LPB8$LFVY. button to In the )LOH)RUPDW box, we left &69 as it was. Click the specify the separator to be used in the file. In our example, we can keep to the default semicolon, however. We set the destination archive in the $UFKLYH6HOHFWLRQ box; In our example, it will be 8VHU$UFKLYHBL. The data import operation is started by clicking the 5 button.

Imported data are written directly to the database. They therefore do not have to be saved separately.

1RWH

During the import operation, make sure the file is not still open in Excel. If it is, an error will occur. The same error message is issued when the file contains existing data records or the file structure of the file does not match that of the archive.

5-14

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 &RQILJXULQJD7DEOH9LHZ H[BBFKDSWHUB3'/

7DVNGHILQLWLRQ

The present example is based on the two preceding examples, &UHDWLQJD8VHU $UFKLYH H[BBFKDSWHUB3'/ and 'DWD(QWU\ H[BBFKDSWHUB3'/ . The data of the archive configured in these examples are required to be made available to the user at runtime. The archive data are to be displayed in tabular form.

,PSOHPHQWDWLRQFRQFHSW

The archive will be displayed at runtime by means of a special OLE control. The data will be displayed in tabular form. Using the control it will be possible to place various edit options for the archive at the disposal of the user.

,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

1 2

Open *UDSKLFV'HVLJQHU and create a new picture. In our example, this is the picture called H[BBFKDSWHUBSGO. Configure an OLE control at 6PDUW2EMHFW2/(&RQWURO. The ,QVHUW 2OH&RQWURO dialog box is opened.

In this dialog box, we select the entry :LQ&&8VHU$UFKLYH7DEOH&RQWURO from the list of available OLE controls and close the dialog box by clicking 2.. The deactivated :LQ&&8VHU$UFKLYH7DEOH&RQWURO appears. In our example, we use the object called 2/(&RQWURO. 3 Click box.

8'

on the object known as 2/(&RQWURO to open its Properties dialog

WinCC Configuration Manual C79000-G8276-C140-01

5-15

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

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 any views 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 be able to access. In our example, we will make the full range of edit options available to the user. We can display the OLE control with %RUGHU. In addition, we can also display the object in form view. In our example, we select the %RUGHU check box. But we do not select the )RUP check box.

We can select the data fields, which we want to have displayed in the table, on the &ROXPQV tab. In our example, we select all the boxes available. Further, there is the possibility of setting certain properties for every data field in the 3URSHUWLHV box. In our example, however, we will leave the default settings for all the data fields as they are.

5-16

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

On the 7RROEDU tab, we can configure the elements we require on the toolbar. In our example, we will leave all the functions selected. There is the possibility of assigning an authorization level to every button on the toolbar so that it can be operated only by authorized users. If the &OHDU check box is selected, the toolbar is not displayed. If, however, only individual buttons are deselected from the list by means of the check boxes, they will be displayed nevertheless, though it will not be possible to operate them.

On the 6WDWXV%DU tab, we can set the status bar to look as we wish it to. In our example, we will leave all the elements selected. If the &OHDU check box is selected, the status bar is not displayed.

WinCC Configuration Manual C79000-G8276-C140-01

5-17

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

On the )RQWV tab, we can customize the font used by the OLE control. In our example, we will reduce the VL]H of the font to  in order to be able simultaneously to display all the columns of the table at runtime. We will leave all the other settings as they are.

On the )LOWHU6RUW tab, we will not perform any settings for our example. You can set filters and sorts at runtime, too, if the corresponding buttons have been provided on the toolbar. On the &RORUV tab, we can modify the colors of individual elements in a table. A convenient place for settings colors, especially when more than 16 colors are required to be available, is the 2/(&RQWURO object Properties dialog box provided by WinCC.

10

5-18

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

11 12

Complete the settings in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box by clicking 2..


2/(&RQWURO

Set the table color scheme. Click object.

85

to open the Properties dialog box of the

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 settings will be applied for the remaining colors. There is a possibility of performing almost all the other settings performed in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box at this stage as well. This is not practical for some setting options, however.

WinCC Configuration Manual C79000-G8276-C140-01

5-19

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

We can check some of the configurations we have performed in *UDSKLFV


'HVLJQHU. Click to open the object.

8'

on the 2/(&RQWURO object while keeping CTRL pressed

Configure five pointer-type instruments to display the tags that have to be written by 8VHU$UFKLYH. These are :LQ&&JDXJHFRQWURO type OLE controls configured at 6PDUW2EMHFWV2/(&RQWUROV. In our example, these are objects 2/( &RQWURO to 2/(&RQWURO.

5-20

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

At each of the objects, we create a WDJFRQQHFWLRQ to one of the five integer tags that have to be written by the archive at 3URSHUWLHV2/(&RQWURO3URSHUWLHV 9DOXH. To be in a position to simulate a change of the values of these tags, five slider objects are configured at 6PDUW2EMHFWV6OLGHU2EMHFWV. In our example, these are objects6OLGHU2EMHFW to 6OLGHU2EMHFW. At each of these objects, we create one WDJFRQQHFWLRQ to one of the corresponding tags at 3URSHUWLHV0LVFHOODQHRXV3URFHVV'ULYHU &RQQHFWLRQ. Further, a GLUHFWFRQQHFWLRQ to the same tag is created at (YHQW 3URSHUW\7RSLFV0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ&KDQJH. For these GLUHFWFRQQHFWLRQV, the VRXUFH WKLVREMHFW3URFHVV'ULYHU&RQQHFWLRQis connected to the GHVWLQDWLRQ of the corresponding WDJ. This is performed so that a change of the tag value is achieved for every change in the position of the slider.

We configure a standard object at 6WDQGDUG2EMHFW6WDWLF7H[W to display the data record that is currently being loaded to the tags. In our example, we use the object called 6WDWLF7H[W. At this object, we create a WDJFRQQHFWLRQ to 7LBH[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 has not been loaded as yet, and we want this to be displayed likewise. This is performed by means of a &DFWLRQ at picture object H[BBFKDSWHUB by selecting (YHQW0LVFHOODQHRXV2SHQ3LFWXUH. This &DFWLRQ writes the words 1RGDWD UHFRUG to the tag if it is blank.

WinCC Configuration Manual C79000-G8276-C140-01

5-21

8VHU$UFKLYH



1RWHVRQJHQHUDOXVH

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 the Form button. You can modify archive data at runtime, too, using the edit buttons. You can delete and modify data records, or add new ones. The extent to which the user is authorized to modify data will depend on the OLE control settings in *UDSKLFV 'HVLJQHU. Using the navigation buttons, you can move in the table and select different data records. Selection of data records also works by directly selecting data records with the mouse. The data transfer buttons are used to read and write data. The :ULWH7DJV button is used to write the data record selected in the table to the tags set in 8VHU $UFKLYH. The 5HDG7DJV button is used to read in the current values of the tag set in 8VHU$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 the corresponding buttons in the user archive editor. The procedure for importing and exporting data is described in the example contained in 'DWD(QWU\ H[BBFKDSWHUB3'/ . We can use the )LOWHU and 6RUW buttons to define the data records we want to have displayed and the order in which we want to have them displayed. These settings for OLE control can also be performed in *UDSKLFV'HVLJQHU.

5-22

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 &RQILJXULQJD)RUP9LHZ H[BBFKDSWHUB3'/

7DVNGHILQLWLRQ

The present example is based on the two preceding examples, &UHDWLQJD8VHU $UFKLYH H[BBFKDSWHUB3'/ and 'DWD(QWU\ H[BBFKDSWHUB3'/ . The data of the archive configured in these examples are required to be made available to the user at runtime. We want the archive data to be displayed as a form, by means of which it will be possible to display one data record at a time.

,PSOHPHQWDWLRQFRQFHSW

The archive will be displayed at runtime by means of a special OLE control. The data will be displayed as a form. By means of several buttons, it will be possible to place various edit options for the archive at the disposal of the user.

,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

1 2

Open *UDSKLFV'HVLJQHU and create a new picture. In our example, this is the picture called H[BBFKDSWHUBSGO. Configure an OLE Control object at 6PDUW2EMHFWV2/(&RQWURO. The ,QVHUW 2OH&RQWURO dialog box is opened.

In this dialog box, we select the entry :LQ&&8VHU$UFKLYH7DEOH&RQWURO from the list of available OLE controls and close the dialog box by clicking 2.. The deactivated :LQ&&8VHU$UFKLYH7DEOH&RQWURO appears. In our example, we use the object called 2/(&RQWURO. 3 Click box.

8'

on the object known as 2/(&RQWURO to open its Properties dialog

WinCC Configuration Manual C79000-G8276-C140-01

5-23

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

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 any views 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 be able to access. In our example, we will not allow the user to modify archive data by selecting the 5HDG2QO\ check box. We can display the OLE control with %RUGHU. In addition, we can also display the object in form view. In our example, we select the %RUGHU and )RUP check boxes. On the 7RROEDU tab, we can configure a toolbar. In our example, however, we select the &OHDU check box. This means that the toolbar will not be displayed at runtime. On the 6WDWXV%DU tab, we can configure a status bar. In our example, we will leave all the elements selected. But, as on the previous tab, we select the &OHDU tab. This means that the status bar will not be displayed at runtime, either. In our example, the VL]H of the font was reduced to  on the )RQWVtab. It is true that this setting refers to table view, which is not being used, but it also indirectly affects form view too. If the size of the OLE control is too small to display the entire table view, scroll bars are shown. They are likewise shown when the OLE control happens to be in form view. To circumvent this annoying effect, the font size is reduced to allow the entire table view to be shown. On the other tabs, we will not perform any more settings for our example. Complete the settings in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box by clicking 2.. For us to be able to configure the form view, OLE control has to be activated in *UDSKLFV'HVLJQHU. This is done by clicking ' on the object while keeping CTRL pressed.

5 on the activated object opens a shortcut menu, which can be used Clicking to insert text boxes, editing boxes and buttons in the form. To insert a text box, choose 7H[W from the menu.

A text box is displayed on the form and, at the same time, its Properties dialog box is opened. There is also the possibility of entering a piece of text in the 7H[W input 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-

5-24

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

down list for the 7H[W box.

10

Configure the editing box that matches the text box. This is accomplished by clicking 5 on the activated OLE control. We choose (GLW from the shortcut menu that appears. An editing box is displayed on the form and, at the same time, its Properties dialog box is opened. From the drop-down list, we can now select the required box whose data we want to have displayed in the editing box. In our example, the 5HFRUG1DPH box has been selected from the drop-down list for the )LHOG box. As with the procedure described in the preceding four steps, a text box and an editing box will be configured for each archive box in our example.

11

12

13

It must then be possible to navigate through the boxes in the archive. This is accomplished by configuring buttons. On the form, all the functions available on the 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 box is opened. It is possible to enter a piece of text for labeling the button in the 7H[W input box. In our example, the WH[W we use is the string . Its purpose is to symbolize 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 all the functions available is shown as a drop-down list. In our example, we set the 6WDUW function.

WinCC Configuration Manual C79000-G8276-C140-01

5-25

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

15

We then configure three more buttons. We want them to trigger %DFN, )RUZDUG and (QG functions.

In our example, we configure a further two buttons which the user can use to write single data records to the tags assigned to the data fields. The functions we have to set for them are 5HDG7DJV and :ULWH7DJV.

16

Configure five pointer-type instruments to display the tags that have to be written by 8VHU$UFKLYH. These are :LQ&&JDXJHFRQWURO type OLE controls configured at 6PDUW2EMHFWV2/(&RQWUROV. In our example, these are objects 2/( &RQWURO to 2/(&RQWURO. At each of the objects, we create a WDJFRQQHFWLRQ to one of the five integer tags that have to be written by the archive at 3URSHUWLHV2/(&RQWURO3URSHUWLHV 9DOXH. To be in a position to simulate a change of the values of these tags, five slider objects are configured at 6PDUW2EMHFWV6OLGHU2EMHFWV. In our example, these are objects6OLGHU2EMHFW to 6OLGHU2EMHFW. At each of these objects, we create a WDJFRQQHFWLRQ to one of the corresponding tags at 3URSHUWLHV0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ. Further, a GLUHFWFRQQHFWLRQ to the same tag is created at (YHQW3URSHUW\7RSLFV 0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ&KDQJH. For these GLUHFW FRQQHFWLRQV, the VRXUFH WKLVREMHFW3URFHVV'ULYHU&RQQHFWLRQis connected to the GHVWLQDWLRQ of the corresponding WDJ. This is performed so that a change of the tag value is achieved for every change in the position of the slider.

17

We configure static text at 6WDQGDUG2EMHFW6WDWLF7H[W to display the data record that is currently being loaded to the tags. In our example, we use the object called 6WDWLF7H[W. At this object, we create a WDJFRQQHFWLRQ to the

5-26

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

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 has not been loaded as yet, and we want this to be displayed likewise. This is performed by means of a &DFWLRQ at picture object H[BBFKDSWHUB at (YHQW 0LVFHOODQHRXV2SHQ3LFWXUH. This &DFWLRQ writes the words 1RGDWDUHFRUG to the tag if it is blank.
7LBH[B8$LB

WinCC Configuration Manual C79000-G8276-C140-01

5-27

8VHU$UFKLYH



 :RUNLQJZLWK&RQWURO7DJV H[BBFKDSWHUB3'/

7DVNGHILQLWLRQ

We wish to create an archive having data records consisting of three double boxes and a text box for storing a data record name. We want to keep the number of data records to three. We want the archive data to be made available throughout the project by using the control tags on a record-by-record basis.

,PSOHPHQWDWLRQFRQFHSW

An archive is created in the user archive editor for archiving the data. Archive communication will be configured with WinCC tags. We will assign four control tags to the archive. Their purpose is to control writing of the data to the WinCC tags and reading of the data from the WinCC tags. Four data fields of the requisite field types will be created in the archive. An internal tag will be assigned to each data field and will be used by the archive to communicate with the rest of the project. We then configure several buttons and I/O fields in Graphics Designer, which will be used to write to the control tags. The contents of the control tags set the data record for processing and whether data should be read or written.

&UHDWLQJDQDUFKLYH
6WHS 3URFHGXUH&UHDWLQJDQ$UFKLYH

Create a single internal tag for each data record in the archive. Communication between the archive and the rest of the system will take place by means of these tags. In our example, we use tags *LB8$FWB to *LB8$FWB of the IORDWLQJ SRLQWELW,((( type. Further, a type ELWIRQWWH[W tag is created for storing the data record name. In our example, this is tag 7LB8$FWB. Open the user archive editor. We create a new archive in the user archive editor. Click 5 on the $UFKLYHV entry to open a wizard for this purpose.

We enter the DUFKLYHQDPH on the wizards first page. In our example, we enter 8VHU$UFKLYHBFW as the name in the $UFKLYHQDPH box. We will leave the $OLDV box blank. We choose /LPLWHG as the DUFKLYHW\SH. In keeping with the task set, the maximum number of GDWDUHFRUGV is set to . The wizards page is closed by clicking 1H[W. On the wizards second page, we select the type of communication. In the present example, we select 7\SH as &RPPXQLFDWLRQYLD:LQ&&7DJ V . The wizards page is closed by clicking 1H[W. On the third page of the wizard, we can set four control tags. The archive can be controlled at runtime by means of these tags. If the tags have not been created previously, you can have the wizard do it

5-28

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&UHDWLQJDQ$UFKLYH

automatically. Click the button to open a dialog box for setting a few 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 the wizard to create external tags, then we must also specify the FRQQHFWLRQ for which we want to have them created. The wizard generates the tags in a tag group. We have to set the name of the group and also the names of the individual tags. However, the wizard also proposes names without being prompted to do so. In our example, we select LQWHUQDO as the type of tag. We will keep to the names for the tag group and individual tags as proposed by the wizard. Click 2. to close the &UHDWH&RQWURO7DJV dialog box.

The tags you have just created are then automatically entered in the corresponding boxes for ,', -RE, )LHOG and 9DOXH. Since we will not perform any more settings on the next page of the wizard in our example, we can close the wizard at this stage already by clicking )LQLVK.

WinCC Configuration Manual C79000-G8276-C140-01

5-29

8VHU$UFKLYH



6WHS

3URFHGXUH&UHDWLQJDQ$UFKLYH

The boxes listed in the table that follows are created in our example for the archive you have just configured. The tags configured in step 1 are set as the assigned tags. For the double boxes, we set a PLQLPXPYDOXH of - and a PD[LPXPYDOXH of . We set the OHQJWK of the text box to .

A total of three data records can now be created for the archive in the bottom window of the table.

,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

1 2

Open *UDSKLFV'HVLJQHU and create a new picture. In our example, this is the picture called H[BBFKDSWHUBSGO. Configure an OLE Control object at 6PDUW2EMHFWV2/(&RQWURO. It will only be used in our example to display archive data and will not be given any control elements. The ,QVHUW2OH&RQWURO dialog box is opened.

5-30

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

In this dialog box, we select the entry :LQ&&8VHU$UFKLYH7DEOH&RQWURO from the list of available OLE controls and close the dialog box by clicking 2.. The deactivated :LQ&&8VHU$UFKLYH7DEOH&RQWURO appears. In our example, we use the object called 2/(&RQWURO. 3

' on the object known as 2/(&RQWURO to open its Properties dialog Click box. On the *HQHUDO,QIRUPDWLRQ tab, we set the 6RXUFH field to 8VHU$UFKLYHBFW, the DUFKLYH you configured earlier. Keep 5HDG2QO\ as the setting in the (GLW box. In our example, we deselect the %RUGHU check box. The )RUP check box likewise remains deselected.
On the 7RROEDU tab, we select the &OHDU check box. Similarly, we select the &OHDU check box on the 6WDWXV%DU tab. This results in the table being displayed without the toolbar or the status bar. Complete the settings in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box by clicking 2.. Configure three bar graphs to display the tags that have to be written by 8VHU $UFKLYH by selecting 6PDUW2EMHFWV%DU*UDSK. In our example, these objects are %DU to %DU. We create a WDJFRQQHFWLRQ to one of the three double tags that have to be written by the archive at each of the objects by selecting3URSHUWLHV0LVFHOODQHRXV 3URFHVV'ULYHU&RQQHFWLRQ. For us to be in a position to simulate any change of values for these tags, two buttons are configured at :LQGRZV2EMHFWV%XWWRQ for each bar graph. One of these buttons is used to increment the corresponding tag value in typing mode and the other to decrease it.

WinCC Configuration Manual C79000-G8276-C140-01

5-31

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

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 that function. Selection of the data record by means of control tags can be done in two different ways. It is possible to write to the tag set for the ID. The second version consists of writing a field name for the tag set for the field and, in addition, a search value to the tag set for the value. To select the data record by means of the ID, we configure three buttons at :LQGRZV2EMHFWV%XWWRQ in our example. They write a suitable value, via GLUHFWFRQQHFWLRQV, to the tag, #8$B8VHU$UFKLYHBFWB,', set for the ID. The current tag value is displayed by means of an I/O field created at 6PDUW2EMHFW ,2)LHOG.

To select the data record using the field name and a search value, we configure four buttons at :LQGRZV2EMHFWV%XWWRQ. They write a suitable field name, via GLUHFWFRQQHFWLRQV, to the tag, #8$B8VHU$UFKLYHBFWB)LHOG, set for the field name. The current tag value is displayed by means of an I/O field created at 6PDUW2EMHFWV,2)LHOG. We configure another I/O field at 6PDUW2EMHFW,2)LHOG for entering the search value. Make sure you enter dots rather than commas for double values. If you want to use text as a search value, it must be encompassed in quotation marks.

5-32

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

In our example, we can switch to and fro between two possible selections for data records by means of two buttons configured at :LQGRZV2EMHFWV%XWWRQ. A ELQDU\WDJ type is used to disable the input objects of the one version and then the other.

10

:LQGRZV2EMHFWV

To trigger jobs for the data record we selected, we configure two buttons at %XWWRQ. They write a suitable value, via GLUHFWFRQQHFWLRQV, to the tag, #8$B8VHU$UFKLYHBFWB-RE, set for the job. Permissible values in this instance 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 archive In 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 set for the job. If the job has been completed successfully, the tag is set to zero. If the job fails, the tag is set to -1. This is evaluated in our example using a G\QDPLFGLDORJER[ created at 6PDUW 2EMHFW,2)LHOG.

WinCC Configuration Manual C79000-G8276-C140-01

5-33

8VHU$UFKLYH



 &RQQHFWLQJYLD:LQ&&7DJV H[BBFKDSWHUBDSGO

7DVNGHILQLWLRQ

We want to establish a connection to a programmable logic controller. The programmable logic controller we are going to use is the S5. The following description refers to the use of an S5-115U (CPU 944B) with a CP1430 communication processor. Communication will take place via a SIMATIC Industrial Ethernet. Further, we wish to create an archive. The data records in this archive will consist of a text box, two integer fields, two double fields and a date field. We want the archive data to be displayed in tabular form at runtime. They are required to be made available to the programmable logic controller on a record-by-record basis.

1RWH

The option of communication between User Archive and the programmable logic controller via WinCC tags should be preferred when the majority of the activities are to be controlled by WinCC.

,PSOHPHQWDWLRQFRQFHSW

We establish a connection to an S5 over a SIMATIC Industrial Ethernet. Several external tags are created for the connection we configured. We want to use them for communication between the programmable logic controller and the User Archive that we are going to create. We create a User Archive which we want to communicate with the PLC by means of WinCC tags. Created beforehand, the tags are assigned to the individual data fields of the archive. The archive data are displayed at runtime by means of an OLE control. The current values of the tags we are using are displayed for information purposes and for checking by means of I/O fields and bar graphs.

6,0$7,&6(WKHUQHW/D\HUFRPPXQLFDWLRQGULYHU

This driver will be used for communication with the programmable logic controller in our example. It is suitable for connections to the SIMATIC S5-115U, -135U and -155U with the 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 programmable logic controllers.

&RQILJXULQJWKH&3FRPPXQLFDWLRQSURFHVVRU
6WHS 3URFHGXUH&RQILJXULQJWKH&3&RPPXQLFDWLRQ3URFHVVRU

Install the driver for the network connection between the PC and the PLC. For this we will require the SIMATIC Drivers CD (SIMATIC NET). After specifying a few general details in the installation wizard concerning the installation, we select the entry ,(6 in the list box displayed on the page labeled &RPSRQHQWV. Installation is completed by clicking 1H[W. Following this, the computer has to be rebooted.

5-34

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&3&RPPXQLFDWLRQ3URFHVVRU

Install the CP 1413 card on the PC. Install the CP 1413 card on the PC exactly in the manner stated in the installation instructions enclosed with the card. Following this, software installation of the card has to be performed, again by precisely following the instructions. Start the 6HW3URJUDPPLQJ'HYLFH3&,QWHUIDFH program on the Control Panel.

The access point for the Industrial Ethernet connection was entered by default when you installed the card. This is the access point labeled &3+B.

WinCC Configuration Manual C79000-G8276-C140-01

5-35

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&3&RPPXQLFDWLRQ3URFHVVRU

Assign a module to the access point. The module has to be installed first, however. This is accomplished by means of the button in the 0RGXOHV box. The ,QVWDOO8QLQVWDOO0RGXOH dialog box opens. In the left list box, we select the &3 entry and install the card using the button.

5-36

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&3&RPPXQLFDWLRQ3URFHVVRU

The &35HVRXUFHV 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 be influenced by jumpers on the card.

To avoid duplicate assignment of the memory area and interrupts, it is sensible to look in :LQGRZV17'LDJQRVWLFV. You do this by choosing the 6WDUWPHQX 3URJUDPV$GPLQLVWUDWLYH7RROV &RPPRQ :LQGRZV17'LDJQRVWLFV.

The :LQGRZV17'LDJQRVWLFV program appears. In this program, select the 5HVRXUFHV tab. You can determine the interrupts in use by clicking the you click the are in use. 6 7 button. If

button, you can determine which memory locations

The settings in the &35HVRXUFHV dialog box are now completed by clicking 2. and the ,QVWDOO8QLQVWDOO0RGXOHV dialog box is closed. Assign the card you have just installed to the access point. To do this, in the 6HW 3URJUDPPLQJ'HYLFH3&,QWHUIDFH program, select access point &3B+B in the top list box and select the entry for the &3 in the bottom list.

WinCC Configuration Manual C79000-G8276-C140-01

5-37

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&3&RPPXQLFDWLRQ3URFHVVRU

Set the properties of the &3 card. We do this by clicking the button. In the CP 1413 Properties dialog box that appears, we have to enter the Ethernet address of the card on the (WKHUQHW 0$& $GGUHVV tab.

&RQILJXULQJWKHFRQQHFWLRQRQWKHSURJUDPPDEOHORJLFFRQWUROOHU
6WHS 3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQRQWKH3URJUDPPDEOH/RJLF &RQWUROOHU

Configure the connection on the programmable logic controller. This is done with the 6,1(&1&0 COM package for the processor we are using. Open the 'HIDXOW6HWWLQJV dialog box by choosing )LOH6HOHFWfrom the menu. For the &37\SH, we enter &3. The GDWDEDVHILOH we create in our example is the file called $865$5&. The file name must start with an A character. Apply the settings you have performed with ). Choose (GLW&3,QLW from the menu to open the &3%DVLF,QLWLDOL]DWLRQ dialog box. We will leave the 0$&$GGUHVV in our example at . This is also the default Ethernet address set by WinCC for the programmable logic controller when a new connection is created. Apply the settings you have performed with ). Create two transport connections. This is accomplished by choosing (GLW &RQQHFWLRQV7UDQVSRUW&RQQHFWLRQV from the menu. The 7UDQVSRUW

5-38

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQRQWKH3URJUDPPDEOH/RJLF &RQWUROOHU

dialog box opens. A transport connection is now created for requesting data from the programmable logic 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$3in our example. In addition to the 76$3, &&')(7&+ in our example, we also have to enter the Ethernet address of the CP-1413 card as the 0$&DGGUHVV for the remote device parameter. A transport connection is now created for sending data to the programmable logic controller from WinCC. We can enter a new transport connection by pressing ). Specify 5(&(,9( as the job type. We set the programmable logic controller to 3DVVLYH. In the 7UDQVSRUW$GGUHVVHV box, we enter $*':5,7( for the local parameter of 76$3in our example. We enter &&':5,7( as the 76$3 for the remote device parameter. We also have to specify the Ethernet address of the card 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 or the other type of job is not required.
&RQQHFWLRQ

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 the programmable logic controller has been stopped.

&RQILJXULQJWKHFRQQHFWLRQLQ&RQWURO&HQWHU
6WHS 3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Install the required communication driver for the requisite programmable logic controller and the requisite driver connections. In &RQWURO&HQWHU, click 5 on 7DJ0DQDJHPHQW to open the $GG1HZ'ULYHU dialog box.

Select 6,0$7,&6(WKHUQHW/D\HU from the list shown in the dialog box. Exit the dialog box by clicking 2SHQ.

WinCC Configuration Manual C79000-G8276-C140-01

5-39

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Configure a connection for the communication driver you have just added. This is accomplished in &RQWURO&HQWHU by clicking 5 on the entry of one of the two channel units that are displayed. In our example, we will use the 67UDQVSRUW &3 channel unit.

The &RQQHFWLRQ3URSHUWLHV dialog box is displayed. Enter the name of the new connection on the *HQHUDO,QIRUPDWLRQ tab. In our example, we use the name 68: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$GGUHVVRI3/&. In the 5($')XQFWLRQ box, we select )HWFK$FWLYH. This means that WinCC is the active peer and it is possible for WinCC to read data from the programmable logic controller. In our example, our 2ZQ76$3 will be called &&')(7&+ and the 3HHU76$3 will be called $*')(7&+. In the :5,7()XQFWLRQ box, our 2ZQ76$3 will be called &&':5,7( and the 3HHU76$3 will be called $*':5,7( in our example. TSAPs always consist of eight characters. If less than eight characters are entered, the other positions are filled with 0x0. The hexadecimal code of the TSAP is displayed next to the name we entered. Be careful with upper-case and lower-case characters, and also with distinguishing an entered space and a nonentered character.

5-40

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Close the dialog box by clicking 2..

Set the system parameters for the channel unit being used. To do this, click on their entry.

85

The 6\VWHP3DUDPHWHUV dialog box opens. On the 'HYLFH1DPH tag, you can enter the name of the access point via which you wish communication to take place. However, this is not necessary in our example, since by default a name was assigned already when the driver for the CP-1413 card was installed. That name is used in this instance. On the 7UDQVSRUW3DUDPHWHUV tab, we can modify different settings relating to communication management. These settings should always agree with the CPs configuration on the programmable logic controller. A check always gives added security. Close the dialog box by clicking 2.. If modifications have been performed, exit

WinCC Configuration Manual C79000-G8276-C140-01

5-41

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

WinCC and reboot. A complete restart is the only way to enable application of the parameters to the CP.

We create a new tag group in the example for the new connection we have created. All the tags for communication between User Archive and the programmable logic controller will be combined in this group. In our example, we will call the new tag group 8VHU$UFKLYHBGP.

Create the tags to be used for communication in the new tag group. Each of the tags corresponds to a box in the User Archive we have yet to create. We create a type ELWIRQWWH[W tag. In our example, it is called 7ZBH[B8$GPB. Its OHQJWK is set to .

5-42

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Click the button to open the dialog box for setting the DGGUHVV of the tag on the programmable logic controller. In the $GGUHVV'HVFULSWLRQ box, we select '% for the GDWDDUHD in our example. We set the '%1R to . Select :RUG for the addressing, and set ':. Exit the dialog box by clicking 2..

WinCC Configuration Manual C79000-G8276-C140-01

5-43

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Further, we create two VLJQHGELWYDOXH type tags and two IORDWLQJSRLQWELW ,((( type tags. The assigned names and the parameters assigned to the addresses comply with the following table.

For VLJQHGELWYDOXH type tags, we set $GDSW6FDOH/RQJ7R6LJQHG':RUG in the 7DJ3URSHUWLHV dialog box. For VLJQHGELW,((( type tags, we set $GDSW6FDOH'RXEOH7R6)ORDW in the 7DJ3URSHUWLHV dialog box. This means that these tags only require 4 bytes on the programmable logic controller. 6 Check the connection to the programmable logic controller. To do this, switch the WinCC project to Runtime and start the programmable logic controller. A dialog box, which you can open by choosing 2SWLRQV6WDWXVRI'ULYHU&RQQHFWLRQV in &RQWURO&HQWHU, keeps you informed of the status of the connection.

5-44

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

&UHDWLQJDQGFRQILJXULQJWKH'%LQWKH6,0$7,&6FRQILJXUDWLRQ

DB

20 0:KH 1:KH 2:KH 3:KH 4:KH 5:KH 6:KH 7:KH 8:KH 9:KH 10:KC 15:KH 16:KH 17:KG 19:KH 20:KH 21:KG User Archive via DM Tags = 0000 = 0000 = 0000 = 0000 = 0000 = 0000 = 0000 = 0000 = 0000 = 0000 =Record_001 RecordName = 0000 Pressure_a High = 01C9 Pressure_a Low = +1025400+03 Temperature_a = 0000 Pressure_b High = 0381 Pressure_b Low = +4959800+03 Temperature_b

The tags for communication are addressed in '%. This DB therefore contains the data 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 program excerpt from the SIMATIC S5 configuration software shown above.

WinCC Configuration Manual C79000-G8276-C140-01

5-45

8VHU$UFKLYH



&RQILJXULQJWKH8VHU$UFKLYH
6WHS 3URFHGXUH&RQILJXULQJ8VHU$UFKLYH

Open the 8VHU$UFKLYH editor and create a new archive by clicking $UFKLYHV.

85

on

On the wizards first page, we enter 8VHU$UFKLYHBGP as the DUFKLYHQDPH and specify the DUFKLYHW\SH as 8QOLPLWHG. On the second page, we set &RPPXQLFDWLRQYLD:LQ&&7DJV. On the other pages we will not perform any more settings. 2 The boxes listed in the table that follows are created in our example for the archive you have just configured. The external tags we configured earlier are set as the assigned tags.

Several data records can now be created for the archive in the bottom window of the User Archive table editor.

1RWH

You cannot assign tags to a date/time type of data field. The data entered in this data field are used merely as additional details elating to a data record.

&RQILJXULQJLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

Create a new picture in *UDSKLFV'HVLJQHU. In our example, this is the picture called H[BBFKDSWHUBDSGO. We configure an OLE control in this picture at 6PDUW2EMHFW2/(&RQWURO. In the ,QVHUW2OH&RQWURO dialog box that appears, we select the entry :LQ&&8VHU $UFKLYH7DEOH&RQWURO from the list displayed. Close the dialog box by clicking 2.. The deactivated :LQ&&8VHU$UFKLYH7DEOH&RQWURO appears. In our example, we use the object called 2/(&RQWURO.

5-46

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

Click ' on the object known as 2/(&RQWURO to open its Properties dialog box. On the *HQHUDO,QIRUPDWLRQ tab, we select $UFKLYH8VHU$UFKLYHBGP as the 6RXUFH. 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 select the %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 the existing elements. On the )RQWV tab, we will reduce the VL]H of the font to  in order to be able simultaneously to display all columns of the table at runtime. On the )LOWHU6RUW tab, we will not perform any settings for our example. Complete the settings in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box by clicking 2.. The color scheme of the table has been adapted in our example to the color scheme used throughout the project by means of the Properties dialog box of the 2/(&RQWURO object. We configure an I/O field at 6PDUW2EMHFW,2)LHOG to display the data record name. In our example, we use the object called ,2)LHOG. At 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH, we create a WDJFRQQHFWLRQ to tag 7ZBH[B8$GPB. Select 3URSHUWLHV2XWSXW,QSXW to modify the GDWD IRUPDW to VWULQJ on the object. The other four tags are all displayed by means of an I/O field created at 6PDUW 2EMHFW,2)LHOG and a bar graph created at 6PDUW2EMHFW%DU*UDSK. At the ,2ILHOGV, create a WDJFRQQHFWLRQ to every one of the four tags at 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH. In the case of the bars, create corresponding WDJFRQQHFWLRQV in a similar manner at 3URSHUWLHV 0LVFHOODQHRXV3URFHVV'ULYHU&RQQHFWLRQ.

WinCC Configuration Manual C79000-G8276-C140-01

5-47

8VHU$UFKLYH



1RWHVRQJHQHUDOXVH

The following adaptations must be made with regard to general use: The configurations performed for the connection can be directly applied to private applications, provided that the hardware used is identical. If not, adjustments have to be made in this area. Adapt the structure and format of the archive to your own requirements.

5-48

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 &RQQHFWLRQYLD:LQ&&5DZ'DWD7DJVWRWKH6 H[BBFKDSWHUBESGO

7DVNGHILQLWLRQ

We want to establish a connection to a programmable logic controller. The programmable logic controller we are going to use is the S5. The description below refers to the use of an S5-115U (CPU 944B) with a CP1430 processor. Communication is required to take place over a SIMATIC Industrial Ethernet. Further, we wish to create an archive. The data records in this archive will consist of a text box, an integer field and a double field. We want the archive data to be displayed in tabular form at runtime. They are required to be made available to the programmable logic controller on a record-by-record and field-by-field basis.

1RWH

The option of communication between User Archive and the programmable logic controller via WinCC raw data tags should be preferred when the majority of the activities are to be controlled by the programmable logic controller. In the present example, however, the WinCC user takes the initiative. The programmable logic controller will be prompted to send job message frames to WinCC by setting a control tag. In this way the functionality otherwise present in the programmable logic controller is simulated.

,PSOHPHQWDWLRQFRQFHSW

We establish a connection to an S5 over a SIMATIC Industrial Ethernet. We will create a WinCC raw data tag for the configured connection. We want to use this tag for communication between the programmable logic controller and User Archive. We create a User Archive which we want to communicate with the PLC by means of WinCC 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 set on the programmable logic controller by means of various buttons. They trigger the transfer of raw data message frames for writing, reading and deleting different data records and data fields.

1RWH

The present example of connecting via WinCC raw data tags is based on the previous example of connecting via WinCC tags. The configurations performed with regard to the connection are regarded as completed. These are the sections on configuration of communication processor CP 1413, configuration of the connection on the programmable logic controller and configuration of the connection in Control Center. Completion of the other sections of the preceding example is not assumed.

WinCC Configuration Manual C79000-G8276-C140-01

5-49

8VHU$UFKLYH



&RQILJXULQJWKH&3&RPPXQLFDWLRQ3URFHVVRU

The configuration of the CP 1413 communication processor has already been described at length in the preceding section. The approach to configuring is identical in as far as the requirements of this example are concerned and can thus be adopted without any changes having to be made to it.

&RQILJXULQJWKHFRQQHFWLRQRQWKHSURJUDPPDEOHORJLFFRQWUROOHU
6WHS 3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQRQWKH3URJUDPPDEOH/RJLF &RQWUROOHU

In the 6,1(&1&0IRU&20V communication package, choose )LOH6HOHFW to open the 'HIDXOW6HWWLQJV dialog box. For the &37\SH, we enter &3. The GDWDEDVHILOH we open is the $8$5&+,9 file we used in the previous example. Apply the settings you have performed with ). Create two new transport connections. This is accomplished by choosing (GLW &RQQHFWLRQV7UDQVSRUW&RQQHFWLRQV from the menu. The 7UDQVSRUW &RQQHFWLRQ dialog box opens. A transport connection is now created for the active transmission of data from the programmable logic controller to WinCC. We can enter a new transport connection by pressing ). Specify 6(1' as the job type. We set the programmable logic controller to $FWLYH. In the 7UDQVSRUW$GGUHVVHV box, we enter $*5)(7&+ for the local parameter of 76$3in our example. In addition to the 76$3, &&5)(7&+ in our example, we also have to enter the Ethernet address of the &3 card as the 0$&DGGUHVV for the remote device parameter. A transport connection is now created for sending data to the programmable logic controller from WinCC. Specify 5(&(,9( as the job type. We set the programmable logic controller to 3DVVLYH. In the 7UDQVSRUW$GGUHVVHV box, we enter $*5:5,7( for the local parameter of 76$3in our example. We enter &&5:5,7( as the 76$3 for the remote device parameter. We also have to specify the Ethernet address of the card again. Apply the settings you have performed with ). 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 the programmable logic controller has been stopped.

&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU
6WHS 3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

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 5 on the entry of one of the two connection in &RQWURO&HQWHU by clicking channel units displayed. In our example, we will use the 67UDQVSRUW &3 channel unit.

5-50

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

The &RQQHFWLRQ3URSHUWLHV dialog box opens. Enter the name of the new connection on the *HQHUDO,QIRUPDWLRQ tab. In our example, we use the name 68: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$GGUHVVRI3/&. In the 5($')XQFWLRQ box, we select )HWFK3DVVLYH. This means that WinCC is the passive peer. Data are sent on the initiative of the programmable logic controller. Enter the TSAPs which we defined when we configured the connection on the programmable logic controller. In our example, our 2ZQ76$3 will be called &&5)(7&+ and the 3HHU76$3 will be called $*5)(7&+. In the :5,7()XQFWLRQ box, our 2ZQ76$3 will be called &&5:5,7( and the 3HHU76$3 will be called $*5:5,7( in our example. TSAPs always consist of eight characters. If less than eight characters are entered, the other positions are filled with 0x0. The hexadecimal code of the TSAP is displayed next to the name we entered. Be careful with upper-case and lower-case characters, and also with distinguishing an entered space and a nonentered character. Close the dialog box by clicking 2..

WinCC Configuration Manual C79000-G8276-C140-01

5-51

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Create the WinCC raw data tag for communication between User Archive and the programmable logic controller. You do this by clicking 5 on the entry of the new connection 68:LQ&&3DVVLYH. The 7DJ3URSHUWLHV dialog box opens.

Set the tag properties. The QDPH of the tag we use in our example is 5$:BH[B8$UGB. We select the UDZGDWDW\SH from the list of GDWDW\SHV.

5-52

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&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 GDWDDUHD 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, we select the 6HQG5HFHLYH%ORFN option. Exit the $GGUHVV3URSHUWLHV dialog box by clicking 2.. Similarly, click 2. to close the 7DJ3URSHUWLHV dialog box.

Create external tags for triggering actions on the programmable logic controller and 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 preceding example. In our example, the tag group in which we are going to create the tags will be called 8VHU$UFKLYHBUG.

WinCC Configuration Manual C79000-G8276-C140-01

5-53

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

The tags we need to create and their addressing on the programmable logic controller are shown at length in the list below. Tags 7ZBH[B8$UGB, *ZBH[B8$UGB and 6ZBH[B8$UGB are required to accommodate data sent to and from User Archive. Tags 8ZBH[B8$UGB and 8ZBH[B8$UGB are to be used to set the record number that has to be edited or the field number that needs editing. Tag 8ZBH[B8$UGB is used as a control tag. We wish to use it to set and trigger the type of job that has to be performed.

&RQILJXULQJ8VHU$UFKLYH
6WHS 3URFHGXUH&RQILJXULQJ8VHU$UFKLYH

Open the 8VHU$UFKLYH editor and create a new archive. Do this by clicking on $UFKLYHV. The wizard for creating a new archive appears.

85

2 3

On the *HQHUDO,QIRUPDWLRQ page, we enter the DUFKLYHQDPH as 8VHU$UFKLYHBUG and specify the DUFKLYHW\SH as 8QOLPLWHG. On the &RPPXQLFDWLRQ page, we set &RPPXQLFDWLRQYLD:LQ&&5DZ'DWD7DJV. Once this item has been selected, the 3/&,' input field can be used. In our example, we will use the name 865$5&5' as the 3/&,'. This ID must not be longer 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 for communication. In our example, we set the tag we created earlier, 5$:BH[B8$UGB, in the 7DJ box.

5-54

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJ8VHU$UFKLYH

4 3

In our example, we will not perform any more settings on the remaining pages of the wizard. The boxes listed in the table that follows are created in our example for the archive you have just configured. We now save the settings we have performed.

Several data records can now be created for the archive in the bottom window of the User Archive table editor.

3URJUDPJHQHUDWLRQRQWKHSURJUDPPDEOHORJLFFRQWUROOHU
6WHS 3URFHGXUH3URJUDP*HQHUDWLRQRQWKH3URJUDPPDEOH/RJLF&RQWUROOHU

We have to create a data block in which we store the data for controlling and monitoring communication. This is control tag 8ZBH[B8$UGB, which contains the job type. Further, there are the communication monitoring tags, 7ZBH[B8$UGB, *ZBH[B8$UGB and 6ZBH[B8$UGB, as well as the tags for setting the record number and field number for editing, 8ZBH[B8$UGB and 8ZBH[B8$UGB. In our example, this data block is '%. Create a further data block which we can use to handle communication with User Archive. In our example, this is '%. The address of the WinCC raw data tag set in the user archive editor refers to this memory area.

WinCC Configuration Manual C79000-G8276-C140-01

5-55

8VHU$UFKLYH



6WHS

3URFHGXUH3URJUDP*HQHUDWLRQRQWKH3URJUDPPDEOH/RJLF&RQWUROOHU

WinCC sends to it the acknowledgement of the raw data message frames received from the programmable logic controller. The structure of the acknowledgement message frames can be taken from the section that follows, 6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. 3 To illustrate the example more clearly, a separate raw data message frame is stored in a separate data data block for every job type. The structure of these job message frames is explained in the section that follows, 6WUXFWXUHRIUDZ GDWDPHVVDJHIUDPHV. Every job message frame has an area for accommodating the data record number and data field number. In WinCC, we enter the values for these specifications in tags 8ZBH[B8$UGB and 8ZBH[B8$UGB. The tag types have been chosen in accordance with the length specified in the message frame structure for the different values. The data record number requires 4 bytes, while the data field number requires 2 bytes. In the PLC program, these values are reloaded to the different job message frames by means of a separate program block. The data record number is required for all job types except the 'HOHWH$OO'DWD5HFRUGV type. The data field number is required only for job types :ULWH)LHOG and 5HDG)LHOG. The program block responsible for reloading the values is 3% in our example. All communication handling is performed by another program block. In our example, 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 different bit memories, job message frames are sent to WinCC. This is accomplished in each case by send block )%. The different transmit data for )% are stored in a separate data block. In our example, '% is used for this purpose.

Description of PB5 (communication with archive)


PB 5 Communication with archive Network 0000 0001 0002 0003 0005 0006 0007 0008 0009 000A NETWORK 000B 000C NAME 000D SSNR 000E A-NR 1 :A :L :T :L :T : :SPA : :A :*** DB DW MW KF DW 21 2 30 +0 2 Reload job tag to memory word 30

PB 7 DB 5

Load record number and field number in job message frames Open data block containing transmit data

2 Send All :JU FB 244 :SEND : KY 000,000 : KY 000,000 Job number zero for Send All

5-56

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

000F 0010 0011 0012 0013 0014 0015

SW QTYP DBNR QANF QLAE PAFE

: : : : : : :***

DW KC KY KF KF MB

0 DB 000,000 +0 +0 100

NETWORK 0016 0017 NAME 0018 SSNR 0019 A-NR 001A SW 001B ZTYP 001C DBNR 001D ZANF 001E ZLAE 001F PAFE 0020 NETWORK 0021 0022 0023 NAME 0024 SSNR 0025 A-NR 0026 SW: 0027 QTYP 0028 DBNR at DW 50 0029 QANF 002A QLAE 002B PAFE 002C NETWORK 002D 002E 002F NAME 0030 SSNR 0031 A-NR 0032 SW : 0033 QTYP 0034 DBNR at DW 60 0035 QANF 0036 QLAE 0037 PAFE 0038 NETWORK 0039 003A 003B NAME 003C SSNR 003D A-NR 003E SW : 003F QTYP 0040 DBNR at DW 70

3 Receive All :SPA FB 245 :RECEIVE : KY 000,000 : KY 000,000 Job number zero for Receive All : DW 2 : KC DB : KY 000,000 : KF +0 : KF +0 : MB 100 :*** 4 Delete all records :U M 30.1 If the bit memory set is Send :JC FB 244 the job :SEND : KY 000,000 : KY 000,003 DW 4 : KC RW : KY 000,005 Transmitted data from DB5 starting : KF +50 : KF +0 : MB 100 :*** 5 Read data record :U M 30.2 If the bit memory set is Send :SPB FB 244 the job :SEND : KY 000,000 : KY 000,003 DW 6 : KC RW : KY 000,005 Transmitted data from DB5 starting : KF +60 : KF +0 : MB 100 :*** 6 Write record :U M 30.3 If the bit memory set is Send :JC FB 244 the job :SEND : KY 000,000 : KY 000,003 DW 8 : KC RW : KY 000,005 Transmitted data from DB5 starting

WinCC Configuration Manual C79000-G8276-C140-01

5-57

8VHU$UFKLYH



0041 QANF : KF +70 0042 QLAE : KF +0 0043 PAFE : MB 100 0044 :*** NETWORK 0045 0046 0047 NAME 0048 SSNR 0049 A-NR 004A SW : 004B QTYP 004C DBNR at DW 80 004D QANF 004E QLAE 004F PAFE 0050 NETWORK 0051 0052 0053 NAME 0054 SSNR 0055 A-NR 0056 SW : 0057 QTYP 0058 DBNR at DW 90 0059 QANF 005A QLAE 005B PAFE 005C NETWORK 005D 005E 005F NAME 0060 SSNR 0061 A-NR 0062 SW : 0063 QTYP 0064 DBNR at DW 100 0065 QANF 0066 QLAE 0067 PAFE 0068 7 Delete data record :U M 30.4 If the bit memory set is Send :JC FB 244 the job :SEND : KY 000,000 : KY 000,003 DW 10 : KC RW : KY 000,005 Transmitted data from DB5 starting : KF +80 : KF +0 : MB 100 :*** 8 Read field :U M 30.5 If the bit memory set is Send :JC FB 244 the job :SEND : KY 000,000 : KY 000,003 DW 12 : KC RW : KY 000,005 Transmitted data from DB5 starting : KF +90 : KF +0 : MB 100 :*** 9 Write field :U M 30.6 If the bit memory set is Send :SPB FB 244 the job :SEND : KY 000,000 : KY 000,003 DW 14 : KC RW : KY 000,005 Transmitted data from DB5 starting : : : :BE KF +100 KF +0 MB 100

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, 8ZBH[B8$UGB, is transferred first to memory word 30. The contents of the control tag is then reset to zero. Further, the record number and field number entered in WinCC is entered in the different message frames by means of PB7. In this case we must remember that the byte order has to be changed. Finally, the data block containing the transmit data is opened for processing on the subsequent networks. On Network 2, a Send All job is executed. On Network 3, a Receive All job is executed.

5-58

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

On Network 4, a job message frame is sent to WinCC in the event of bit memory 30.1 being set. In this case the message frame is used to delete all the data records from an archive. The transmit data are taken by FB244 from DB5 starting at DW50. The transmit data contained in this block are shown in the program excerpt below. On the subsequent networks, other job message frames are sent to WinCC, depending on the state of memory byte 30. The only differences in the calls relate to the addressing if 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 49:KH 50:KC 51:KY 52:KF 53:KF 54:KC 55:KY 56:KF 57:KF 58:KH 59:KH = 0000 = 0000 =DB = 000,025 = +00000 = +00050 =DB = 000,023 = +00000 = +00050 = 0000 = 0000

### Transmit data Delete All Records Source type DB of DB 25 DW 0 with length of 50 words Destination type DB to DB 23 DW 0 with length of 50 words

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 is the 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.

&RQILJXULQJLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

Create a new picture in *UDSKLFV'HVLJQHU. In our example, this is the picture called H[BBFKDSWHUBESGO. We configure an OLE control in this picture at 6PDUW2EMHFW2/(&RQWURO. In the ,QVHUW2OH&RQWURO dialog box that appears, we select the entry :LQ&&8VHU $UFKLYH7DEOH&RQWURO from the list displayed. Close the dialog box by clicking 2.. The deactivated :LQ&&8VHU$UFKLYH7DEOH&RQWURO appears. In our example, we use the object called 2/(&RQWURO.

Click ' on the object known as 2/(&RQWURO to open its Properties dialog box. On the *HQHUDO,QIRUPDWLRQ tab, we select $UFKLYH8VHU$UFKLYHBUG as the 6RXUFH. In the (GLW field, we select check boxes 3DVWH, &KDQJH and 'HOHWH to

WinCC Configuration Manual C79000-G8276-C140-01

5-59

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJLQ*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 :ULWH7DJ and 5HDG7DJ. Control is performed by the programmable logic controller in the present example. 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 elements. On the )RQWV tab, we will reduce the VL]H of the font to  in order to be able simultaneously to display all columns of the table at runtime. On the )LOWHU6RUW tab, we will not perform any settings for our example. Complete the settings in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box by clicking 2.. The color scheme of the table has been adapted in our example to the color scheme used throughout the project by means of the Properties dialog box of the 2/(&RQWURO object. 3 To display the data transferred from User Archive to the programmable logic controller, we configure three I/O fields at 6PDUW2EMHFWV,2)LHOGV. In our example, these are the objects ,2)LHOG, ,2)LHOG and ,2)LHOG. At the ,2ILHOGV, we create - at 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH - a WDJFRQQHFWLRQ for each of the three tags 7ZBH[B8$UGB, 6ZBH[B8$UGB and *ZBH[B8$UGB.

To set the record number that has to edited and the field number, we create two more I/O fields at 6PDUW2EMHFWV,2)LHOGV. In our example, these are the objects ,2)LHOG and ,2)LHOG. At the object ,2)LHOG, we create at 3URSHUWLHV2XWSXW,QSXW2XWSXW 9DOXH a WDJFRQQHFWLRQ to tag 8ZBH[B8$UGB. This is used to accommodate the record number. At the object ,2)LHOG, we create at 3URSHUWLHV2XWSXW,QSXW2XWSXW 9DOXH a WDJFRQQHFWLRQ to tag 8ZBH[B8$UGB. This is used to accommodate the field number. To trigger actions on the programmable logic controller, we configure six buttons at :LQGRZV2EMHFWV%XWWRQ. In our example, these objects are %XWWRQ to %XWWRQ. When a button is clicked, a different value is written to tag 8ZBH[B8DUGB. Every value corresponds to a different type of job for the programmable logic controller. Refer to the list below for the assignment of individual values to the corresponding jobs. The values are specified as hexadecimal. 0x0200 = Delete All Records 0x0400 = Write Record to PLC

5-60

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

0x0800 = Read Record from PLC 0x1000 = Delete Record from Archive 0x2000 = Write Field to PLC 0x4000 = Read Field from PLC This tag is periodically queried in the PLC program. A corresponding job is triggered depending on the contents of the tag.

1RWH

In our example, we want to test the exchange of data between User Archive and the programmable logic controller. A complex program that sends and receives would go beyond the framework of a basic description of the connection. Tags 7ZBH[B8$UGB, *ZBH[B8$UGB and 6ZBH[B8$UGB have been created for checking communication. I/O field data are used to make entries in these tags at runtime. These data are then re-stored in the data area of a job message frame using project functions. The procedure for data arriving at the programmable logic controller is similar. They are restored from the data area of the acknowledgement message frame in the corresponding tags by means of a project function.

-REVIRUZULWLQJWRWKH3/&
6WHS 3URFHGXUH-REVIRU:ULWLQJWRWKH3/&

With write jobs (write to the programmable logic controller), the data arriving at the programmable logic controller in our example are re-stored in tags 7ZBH[B8$UGB, *ZBH[B8$UGB and 6ZBH[B8$UGB. This is done to check the function and is not necessary in normal practice. In the present example, the storage of data at the WinCC end is solved by means of project functions. Two raw data tags were created. One of the tags is tag 5$:BH[B8$UGB in our example. With regard to its address, it corresponds to the data area of the acknowledgement message frame sent to the requesting programmable logic controller by WinCC in response to a job. The second tag is tag 5$:BH[B8$UGB in our example. With regard to its addressing, it corresponds to the memory area on the programmable logic controller in which the three WinCC tags used for checking are addressed. When the data are re-stored, we have to make sure that the first byte of a number occurring in a raw data message frame is the least significant byte. In the case of WinCC tags, the byte order is exactly the reverse of this. If object %XWWRQ (write record to PLC) is operated by clicking , an internal tag of the ELQDU\WDJ type is set. In our example, this is tag %,1LBH[B8$UGB.

WinCC Configuration Manual C79000-G8276-C140-01

5-61

8VHU$UFKLYH



6WHS

3URFHGXUH-REVIRU:ULWLQJWRWKH3/&

Further, control tag 8ZBH[B8$UGB is set to a value of 0x0400. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC, which requests a specific data record. The requested data are then sent by means of the raw data tag set in User Archive to the programmable logic controller (acknowledgement message frame). We configure a &DFWLRQ at 3URSHUWLHV*HRPHWU\3RVLWLRQ; of the button that is triggered when tag 5$:BH[B8$UGB is modified. Any change to this tag signifies that new data have been sent. Tag %,1LBH[B8$UGB is checked in the &DFWLRQ. If it has been set, a new data record (as opposed to a new data field) has been sent. Project function $FWXDOLVH'DWD6HW is then triggered and performs the re-store operation of the sent data to the WinCC tags. Further, tag %,1LBH[B8$UGB is reset.

The procedure for writing fields to the PLC is similar to step 1. However, only a single field is processed. If object %XWWRQ (write field to PLC) is operated by clicking , an internal tag of the ELQDU\WDJ type is set. In our example, this is tag %,1LBH[B8$UGB. Further, control tag 8ZBH[B8$UGB is set to a value of 0x2000. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC. This message frame requests a specific data field of a data record. The requested data are then sent by means of the raw data tag set in User Archive to the programmable logic controller (acknowledgement message frame). We configure a &DFWLRQ at 3URSHUWLHV*HRPHWU\3RVLWLRQ; of the button that is triggered when tag 5$:BH[B8$UGB is modified. Any change to this tag signifies that new data have been sent. Tag %,1LBH[B8$UGB is checked in the &DFWLRQ. If it has been set, a new data field (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 the sent field to the corresponding WinCC tag. This is performed in function of the currently set field number. Further, tag %,1LBH[B8$UGB is reset.

5-62

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

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 tag 8ZBH[B8$UGB to a defined value. In this instance we use the value [. It causes 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 acknowledgement message 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 addressed to the data area of the acknowledgement message frame sent by WinCC. If its value changes, it means that new data have arrived on the programmable logic controller.

WinCC Configuration Manual C79000-G8276-C140-01

5-63

8VHU$UFKLYH



Project function ActualiseDataSet()


void ActualiseDataSet() { BYTE byData[22]; BYTE bySet[22]; int i; GetTagRaw("RAW_ex_UArd_02",&byData[0],22);
//load text data

for (i=0; i<10; i++) { bySet[i]=byData[i]; }


//load double data

for (i=0; i<8; i++) { bySet[17-i]=byData[10+i]; }


//load integer data

for (i=0; i<4; i++) { bySet[21-i]=byData[18+i]; } SetTagRaw("RAW_ex_UArd_08",&bySet[0],22);


//init telegram data

for (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 field 5HFRUG1DPH, which is present in the 8VHU$UFKLYHBUG archive. The 10-character field is the equivalent of ten bytes. Reload the double field to the E\6HW byte field. These data correspond to data field 7HPSHUDWXUH, which is present in the archive. A double field requires an area of eight bytes. The byte order has to be reversed. Reload the integer field to the E\6HW byte field. These data correspond to data field 3UHVVXUH, 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 three WinCC tags used for checking. The data sent by the archive are now deleted. For this purpose, a byte field consisting of zeroes is written to tag 5$:BH[B8$UGB.

5-64

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

Job message frame in DB26 (read data record)


DB 26 0:KY 1:KY 2:KY 3:KY 4:KC 8:KY 9:KY 10:KY 11:KY 12:KY 13:KY 14:KH 15:KH = 028,000 = 000,000 = 002,000 = 001,000 =USRARCRD = 012,000 = 006,000 = 000,000 = 002,000 = 000,000 = 000,000 = 0000 = 0000 Read data record Message frame length low Message frame length high Transfer type, reserve Number of jobs PLCID Job length Job type Field number Data record number low Data record number high Selection criterion

The program excerpt above shows the job message frame for reading a data record from the archive. The structure of the job message frames can be taken from Section  6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. Attention must be paid to the coding of the numerical 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 by means of 3%.

1RWH

stores the message frame for reading a data field. This differs from the message frame for 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 3%, in addition to the data record number.
'%

Acknowledgement message frame in DB23


DB 23 0:KY 1:KY 2:KY 3:KY 4:KY 5:KY 6:KY 7:KY 8:KC 12:C 17:KH 18:KH 19:KH 20:KH 21:KH 22:KH 23:KH 24:KH 25:KH Receive block = 046,000 Message frame length low = 000,000 Message frame length high = 002,000 Transfer type, Reserve = 001,000 Error code,job type = 000,000 Reserved = 001,000 Field number = 002,000 Data record number low = 000,000 Data record number high =USRARCRD PLCID =Record_001 RecordName 10 bytes -> = 0000 Temperature 8 bytes -> = 0000 = 0000 = 0000 = 0000 Pressure 4 bytes -> = 0000 = 0000 = 0000 = 0000

WinCC Configuration Manual C79000-G8276-C140-01

5-65

8VHU$UFKLYH



The program excerpt above shows the acknowledgement message frame for reading a data record from the archive. The structure of the acknowledgement message frames can be taken from the section that follows, 6WUXFWXUHRIUDZGDWDPHVVDJH IUDPHV. The data are re-stored from the data area of the message frame by means of project function $FWXDOLVH'DWD6HW to the WinCC tags. This means that successful sending of 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 message frame does not contain more than a single data field. The data field is re-stored in the corresponding WinCC tag by means of project function $FWXDOLVH'DWD)LHOG .

-REVIRUUHDGLQJIURPWKH3/&
6WHS 3URFHGXUH-REVIRU5HDGLQJIURPWKH3/&

In the case of read jobs (read from the programmable logic controller), the data stored in tags 7ZBH[B8$UGB, *ZBH[B8$UGB and 6ZBH[B8$UGB have to be re-stored in the data areas of the write message frames of the PLC program. In the present example, this is performed at the WinCC end by means of 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 frame for sending a data record in the PLC program. A second tag, in our example tag 5$:BH[B8$UGB, corresponds with regard to its addressing to the data area of the message frame for sending a data field in the PLC program.

If object %XWWRQ (read record from PLC) is operated by clicking , project function /RDG'DWD6HW is called. These re-stores the current data of the tags in the data area of the message frame for writing a data record. Further, control tag 8ZBH[B8DUGB is set to a hexadecimal value of [. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC to send a data record. In our example, the message frame we are referring to is located in '%.

The procedure for reading from fields on the PLC is similar to that for reading records. However, only a single field is processed. , project If object %XWWRQ (read record from PLC) is operated by clicking function /RDG'DWD)LHOG is called. This function re-stores the current data of the tag corresponding to the currently set field number in the data area of the message frame for writing a data field. Further, control tag 8ZBH[B8DUGB is set to a hexadecimal value of [. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC to send a data field. In our example, the message frame we are referring to is located in '%.

5-66

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

Job message frame in DB27 (write data record)


DB 28 0:KY 1:KY 2:KY 3:KY 4:KC 8:KY 9:KY 10:KY 11:KY 12:KY 13:KY 14:KC 19:KH 20:KH 21:KH 22:KH 23:KH 24:KH 25:KH 26:KH Write data record = 050,000 Message frame length low = 000,000 Message frame length high = 002,000 Transfer type, reserve = 001,000 Number of jobs =USRARCRD PLCID = 034,000 Job length = 007,000 Job type = 000,000 Field number = 003,000 Data record number low = 000,000 Data record number high = 000,000 Selection criterion =Record_001 RecordName 10 bytes -> = 0000 Temperature 8 bytes -> = 0000 = 0000 = 5940 = 2D00 Pressure 4 bytes-> = 0000 = 0000 = 0000

The program excerpt above shows the job message frame for sending a data record to the archive. The structure of the job message frames can be taken from Section  6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. Attention must be paid to the coding of the numerical values. The least significant byte is sent first. The number of the data record, to which the message frame data are required to be written, 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 of project function /RDG'DWD6HW .
1RWH

stores the message frame for writing a data field. This differs from the message frame 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 the data record number.
'%

WinCC Configuration Manual C79000-G8276-C140-01

5-67

8VHU$UFKLYH



-REVIRUGHOHWLQJIURPWKHDUFKLYH
6WHS 3URFHGXUH-REVIRU'HOHWLQJIURPWKHDUFKLYH

If object %XWWRQ (delete record) is operated by pressing , control tag 8ZBH[B8$UGB is set by means of a GLUHFWFRQQHFWLRQ to a hexadecimal value of [. However, decimal values have to be entered in the &RQVWDQW input 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 controller then sends a job message frame to WinCC to delete a data record. In our example, the message frame we are referring to is located in '%.

If object %XWWRQ (delete record) is operated by pressing , control tag 8ZBH[B8$UGB is similarly set by means of a GLUHFWFRQQHFWLRQ to a hexadecimal value of [. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to delete all data records. In our example, the message frame we are referring to is located in '%.

5-68

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

Job message frame in DB28 (Delete data record)


DB 28 0:KY 1:KY 2:KY 3:KY 4:KC 8:KY 9:KY 10:KY 11:KY 12:KY 13:KH 14:KH = 026,000 = 000,000 = 002,000 = 001,000 =USRARCRD = 010,000 = 008,000 = 000,000 = 001,000 = 000,000 = 0000 = 0000 Delete data record Message frame length low Message frame length high Transfer type, reserve Number of jobs PLCID Job length Job type Field number Data record number low Data record number high

The program excerpt above shows the job message frame for deleting a data record from the archive. The structure of the job message frames can be taken from Section 6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. Attention must be paid to the coding of the 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 by means of 3%.

Job message frame in DB25 (Delete all data records)


DB 25 0:KY 1:KY 2:KY 3:KY 4:KC 8:KY 9:KY 10:KH 11:KH = 020,000 = 000,000 = 002,000 = 001,000 =USRARCRD = 004,000 = 005,000 = 0000 = 0000 Delete all data records Message frame length low Message frame length high Transfer type, reserve Number of jobs PLCID Job length Job type

The program excerpt above shows the job message frame for deleting all data records from the archive.

1RWHVRQJHQHUDOXVH

The following adaptations must be made for general use: The configurations performed for the connection can be directly applied to private applications, provided that the hardware used is identical. If not, adjustments have to be made 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 the program.

WinCC Configuration Manual C79000-G8276-C140-01

5-69

8VHU$UFKLYH



 &RQQHFWLRQYLD:LQ&&5DZ'DWD7DJVWRWKH6 H[BBFKDSWHUBFSGO

7DVNGHILQLWLRQ

We want to establish a connection to a programmable logic controller. The programmable logic controller we are going to use is the S7. The following description refers to the use of an 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 text field, an integer field and a double field. We want the archive data to be displayed in tabular form at runtime. They are required to be made available to the programmable logic controller on a record-by-record and field by field basis.
1RWH

The option of communication between User Archive and the programmable logic controller via WinCC raw data tags should be preferred when the majority of the activities are to be controlled by the programmable logic controller. In the present example, however, the WinCC user takes the initiative. The programmable logic controller will be prompted to send job message frames to WinCC by way of setting a control tag. In this way the functionality otherwise present in the programmable logic controller is simulated.

,PSOHPHQWDWLRQFRQFHSW

We establish a connection to an S7 via the MPI. Two connections are created in Control Center. Create a WinCC raw data tag for this connection. We want to use this tag for communication between the programmable logic controller and the User Archive that we are 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 of WinCC 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 set on the programmable logic controller by means of various buttons. They trigger the transfer of raw data message frames for writing, reading and deleting different data records and data fields.

6,0$7,&6SURWRFROVXLWHFRPPXQLFDWLRQGULYHU

This driver will be used for communication with the programmable logic controller in our example. The driver contains five different channel units. In our example, we use the MPI channel unit. It is suitable for connections to a SIMATIC S7-300 and S7-400 through the MPI. 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.

5-70

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

&RQILJXULQJWKH03,FDUG
6WHS 3URFHGXUH&RQILJXULQJWKH03,&DUG

Install the WinCC component called 6'RV. If this was not done at the time when WinCC was installed, the 6'RV component can be installed later.

Install the MPI ISA card on the PC. Install the card on the PC exactly as stated in the installation instructions enclosed with the card. Following this, software installation of the card has to be performed, again by precisely following the instructions. Start the 6HW3URJUDPPLQJ'HYLFH3&,QWHUIDFH program on the Control Panel.

The access point for the MPI was entered by default at the time WinCC was installed. This is the access point labeled 03, :LQ&& .

WinCC Configuration Manual C79000-G8276-C140-01

5-71

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH03,&DUG

Assign a module to the access point. The module has to be installed first, however. This is accomplished by means of the button in the 0RGXOHV box. The ,QVWDOO8QLQVWDOO0RGXOH dialog box is opened. In the left list box, we select the 03,,6$&DUG entry and install the card using the button.

5-72

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH03,&DUG

The 03,,6$&DUG5HVRXUFHV dialog box opens. The set memory area can frequently not be used. We recommend the '')). area

To avoid duplicate assignment of the memory area and interrupts, it is sensible to look in :LQGRZV17'LDJQRVWLFV. You do this by choosing the 6WDUWPHQX 3URJUDPV$GPLQLVWUDWLYH7RROV &RPPRQ :LQGRZV17'LDJQRVWLFV.

The :LQGRZV17'LDJQRVWLFV program appears. In this program, select the 5HVRXUFHV card. You can determine the interrupts in use by clicking the you click the locations are in use. 6 7 button. If

button, you can determine which the memory

The settings in the 03,,6$&DUG5HVRXUFHV dialog box are now completed by clicking 2. and the ,QVWDOO8QLQVWDOO0RGXOHV dialog box is closed. Assign the card you have just installed to the access point. To do this, in the 6HW 3URJUDPPLQJ'HYLFH3&,QWHUIDFH program select access point 03, :LQ&& in the top list box and select the entry for the 03,,6$&DUG in the bottom list.

WinCC Configuration Manual C79000-G8276-C140-01

5-73

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH03,&DUG

Set the properties of the MPI ISA card. We do this by clicking the button. In the 03,,6$&DUG 03, Properties dialog box that appears, set a ORFDOQRGHDGGUHVV for the card on the 03,1HWZRUN tab. The WUDQVPLVVLRQUDWH we use on the S7-300 must be NELWVHF. On the S7-400, even 0ELWVHF would be possible.

5-74

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH03,&DUG

&RQILJXULQJWKHFRQQHFWLRQRQWKHSURJUDPPDEOHORJLFFRQWUROOHU
6WHS 3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQRQWKH3URJUDPPDEOH/RJLF &RQWUROOHU

In our example, we use the default programming device interface of the programmable logic controller for the MPI connection. In this instance no additional card is required at the programmable logic controller end. All we have to do is create the MPI node and define the MPI address of the programmable logic controller. To do this, open +DUGZDUH in 6,0$7,&0DQDJHU. The +:&RQILJ program is opened. In the present example, the CPU is in slot 3. Open the Properties dialog 5. box for the CPU module we are using by clicking

In the &38'33URSHUWLHV dialog box that appears, select the *HQHUDO


,QIRUPDWLRQ

tab. Click the

button to open the 03,8VHU3URSHUWLHV

dialog box.

WinCC Configuration Manual C79000-G8276-C140-01

5-75

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQRQWKH3URJUDPPDEOH/RJLF &RQWUROOHU

On the 3RZHU6XSSO\ 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 the connection. Finish the settings in the 03,8VHU3URSHUWLHV dialog box by clicking 2.. Close the &38'33URSHUWLHV dialog box similarly by clicking 2.. We can then exit the +:&RQILJ program.

&RQILJXULQJWKHFRQQHFWLRQLQ&RQWURO&HQWHU
6WHS 3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Install the required driver for the necessary programmable logic controller and necessary driver connections. In &RQWURO&HQWHU, click 5 on option 7DJ 0DQDJHPHQW to open the $GG1HZ'ULYHU dialog box.

Select the 6,0$7,&63URWRFRO6XLWH driver from the list shown in the dialog box. Exit the dialog box by clicking 2SHQ.

5-76

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Configure a connection for the driver you have just added. This is accomplished in &RQWURO&HQWHU by clicking 5 on the 03, channel unit entry.

The &RQQHFWLRQ3URSHUWLHV dialog box is displayed. Enter the name of the new connection on the *HQHUDO,QIRUPDWLRQ tab. In our example, we use the QDPH 6:LQ&&3DVVLYH. We set the properties of the connection on the &RQQHFWLRQ tab. In our example, we set the VWDWLRQDGGUHVV to the value of  that is set on the PLC. We have to set the values of the VHJPHQW,', UDFNQXPEHU and VORWQXPEHU in accordance with the conditions prevalent on the programmable logic controller. Select the 6HQG5HFHLYH5DZ'DWD%ORFN check box. We want this connection to be responsible for communication via WinCC raw data tags. The FRQQHFWLRQ UHVRXUFH we enter in our example is . Close the dialog box by clicking 2..

WinCC Configuration Manual C79000-G8276-C140-01

5-77

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Set the system parameters for the channel unit being used. To do this, click on their entry.

85

The 6\VWHP3DUDPHWHUV dialog box opens. Close the dialog box by clicking 2..

5-78

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

We create a new tag group in our example for the new connection we have created. In the 1HZ7DJ dialog box, we use the name 5$:BH[B8$6B in our example. We set the tag type to 5DZ'DWD7\SH. button to open the $GGUHVV3URSHUWLHV dialog box. We Click the select 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 $GGUHVV3URSHUWLHV dialog box by clicking 2.. Similarly, click 2. to close the 7DJ3URSHUWLHV dialog box. We want to use the tag we have just created for communication between the User Archive and the programmable logic controller.

WinCC Configuration Manual C79000-G8276-C140-01

5-79

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Configure a further connection for the 6,0$7,&63URWRFRO6XLWH driver. We want to use it for communication for the normal WinCC tags. In the &RQQHFWLRQ3URSHUWLHV dialog box, enter the name of the new connection on the *HQHUDO,QIRUPDWLRQ tab. In our example, we use the QDPH6 :LQ&&$FWLYH. We set the properties of the connection on the &RQQHFWLRQ tab. In our example, we set the VWDWLRQDGGUHVV to the value of  that is set on the PLC. We have to set the values of the VHJPHQW,', UDFNQXPEHU and VORWQXPEHU in accordance with the conditions prevalent on the programmable logic controller. Close the dialog box by clicking 2..

5-80

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Create external tags for triggering actions on the programmable logic controller and 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 be called 8VHU$UFKLYHB6.

The tags we need to create and their addressing on the programmable logic controller are shown at length in the list below. Tags 7ZBH[B8$6B, *ZBH[B8$6B and 6ZBH[B8$6B are required to accommodate data sent to and from User Archive. Tags 8ZBH[B8$6B and 8ZBH[B8$6B are to be used to set the record number that has to be edited or the field number that needs editing. Tag 8ZBH[B8$B is used as a control tag. We wish to use it to set the type of job that has to be performed and to trigger it.

WinCC Configuration Manual C79000-G8276-C140-01

5-81

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJWKH&RQQHFWLRQLQ&RQWURO&HQWHU

Check the connection to the programmable logic controller. To do this, switch the WinCC project to Runtime and start the programmable logic controller. A dialog box, which you can open by choosing 2SWLRQV6WDWXVRI'ULYHU&RQQHFWLRQV in &RQWURO&HQWHU, keeps you informed of the status of the connection. For the 6,0$7,&3URWRFRO6XLWH driver, however, a separate status dialog box is available for the different connections of the channel unit. It is opened by 5 on the button of the corresponding channel unit and the V\VWHP clicking SDUDPHWHUV entry in the shortcut menu that is displayed. The 6\VWHP3DUDPHWHUV dialog box opens. The &RQQHFWLRQV tab displays the current states of the different connections.

5-82

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

&RQILJXULQJWKH8VHU$UFKLYH
6WHS 3URFHGXUH&RQILJXULQJ8VHU$UFKLYH

Open the 8VHU$UFKLYH editor and create a new archive. Do this by clicking on $UFKLYHV. The wizard for creating a new archive appears.

85

2 3

On the *HQHUDO,QIRUPDWLRQ page, we enter 8VHU$UFKLYHB6 as the DUFKLYHQDPH and specify the DUFKLYHW\SH as 8QOLPLWHG. On the &RPPXQLFDWLRQ page, we set &RPPXQLFDWLRQYLD:LQ&&5DZ'DWD7DJV. Once this item has been selected, the 3/&,' input field can be used. In our example, we will use the name 865$5&6 as the 3/&,'. This ID must not be longer 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 for communication. In our example, we set the tag we created earlier, 5$:BH[B8$6B, in the 7DJ box.

4 3

In our example, we will not perform any more settings on the remaining pages of the wizard. The boxes listed in the table that follows are created in our example for the archive you have just configured. We now save the settings we have performed.

Several data records can now be created for the archive in the bottom window of the User Archive table editor.

WinCC Configuration Manual C79000-G8276-C140-01

5-83

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJ8VHU$UFKLYH

3URJUDPJHQHUDWLRQRQWKHSURJUDPPDEOHORJLFFRQWUROOHU
6WHS 3URFHGXUH3URJUDP*HQHUDWLRQRQWKH3URJUDPPDEOH/RJLF&RQWUROOHU

We have to create a data block in which we store the data for controlling and monitoring communication. This is control tag 8ZBH[B8$6B, which contains the job type. Further, there are the communication monitoring tags, 7ZBH[B8$6B, *ZBH[B8$6B and 6ZBH[B8$6B, as well as the tags for setting the record number and field number for editing, 8ZBH[B8$6B and 8ZBH[B8$6B. In our example, this data block is '%. Create a further data block which we can use to handle communication with User Archive. In our example, this is '%. The address of the raw data tag set in the user archive editor refers to this memory area.

WinCC sends to it the acknowledgement of the raw data message frames received from the programmable logic controller. The structure of the acknowledgement message frames can be taken from the section that follows, 6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. 3 To illustrate the example more clearly, a separate raw data message frame is stored in a separate data data block for every job type. The structure of these job message frames is explained in the section that follows, 6WUXFWXUHRIUDZ GDWDPHVVDJHIUDPHV. Every job message frame has an area for accommodating the data record number and data field number. In WinCC, we enter the values for these specifications in tags 8ZBH[B8$6B and 8ZBH[B8$6B. The tag types have been chosen in accordance with the length specified in the message frame structure for the different values. The data record number requires 4 bytes, while the data field number requires 2 bytes. In the PLC program, these values are reloaded to the different job message frames by means of a separate program block. The data record number is required for all job types except the 'HOHWH$OO'DWD5HFRUGV type. The data field number is required only for job types :ULWH)LHOG and 5HDG)LHOG. The program block responsible for reloading the values is )& in our example. All communication handling is performed by another program block. In our example, 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 different bit memories, job message frames are sent to WinCC. This is accomplished in

5-84

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH3URJUDP*HQHUDWLRQRQWKH3URJUDPPDEOH/RJLF&RQWUROOHU

each case by the send block known as %6(1'.

Description of FC5 (communication with archive)


FUNCTION FC 5 : VOID TITLE = Communication with User Archiver
//Communication with User Archive via raw data message frames

VERSION : 0.0 VAR_TEMP stat : WORD ; len : WORD ; END_VAR BEGIN NETWORK TITLE = 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 ; NETWORK TITLE = Transmit data length


//Set tag #len (length of transmit data) to a value of 50

L 50; T #len; NOP 0; NETWORK TITLE = 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 REQ ID R_ID STATUS SD_1 LEN NOP 0; NETWORK TITLE = Read data record U M 30.2; = L 4.0; BLD 103; CALL SFB 12 , DB REQ ID R_ID STATUS SD_1 LEN NOP 0; NETWORK

12 ( := := := := := := L 4.0, W#16#10, DW#16#5, #stat, P#DB25.DBX 0.0 BYTE 4, #len);

//If bit memory 30.2 set, send job "Read data record"

12 ( := := := := := := L 4.0, W#16#10, DW#16#5, #stat, P#DB26.DBX 0.0 BYTE 4, #len);

WinCC Configuration Manual C79000-G8276-C140-01

5-85

8VHU$UFKLYH



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 REQ ID R_ID STATUS SD_1 LEN NOP 0; NETWORK TITLE = Delete data record U M 30.4; = L 4.0; BLD 103; CALL SFB 12 , DB REQ ID R_ID STATUS SD_1 LEN NOP 0; NETWORK TITLE = Read data field U M 30.5; = L 4.0; BLD 103; CALL SFB 12 , DB REQ ID R_ID STATUS SD_1 LEN NOP 0; NETWORK TITLE = Write data field

12 ( := := := := := := L 4.0, W#16#10, DW#16#5, #stat, P#DB27.DBX 0.0 BYTE 4, #len);

//If bit memory 30.4 set, send job "Delete data record"

12 ( := := := := := := L 4.0, W#16#10, DW#16#5, #stat, P#DB28.DBX 0.0 BYTE 4, #len);

//If bit memory 30.5 set, send job "Read data field"

12 ( := := := := := := L 4.0, W#16#10, DW#16#5, #stat, P#DB29.DBX 0.0 BYTE 4, #len);

//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 ID R_ID STATUS SD_1 LEN NOP 0; NETWORK TITLE = Receive acknowledgement CALL SFB 13 , DB ID R_ID STATUS 13 (

:= := := := := :=

L 4.0, W#16#10, DW#16#5, #stat, P#DB30.DBX 0.0 BYTE 4, #len);

//Acknowledgement message frames received from WinCC are stored in DB23

:= W#16#10, := DW#16#5, := #stat,

5-86

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

RD_1 LEN NOP 0; END_FUNCTION

:= P#DB23.DBX 0.0 BYTE 100, := #len);

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, 8ZBH[B8$UGB, is transferred to memory word 30. The contents of the control tag is then reset to zero. Further, the record number and field number entered in WinCC are entered in the different message frames by means of FC7. In this case we must remember that the byte order has to be changed. On the second network, the tag called #len, which transfers the length of the message frames 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 memory 30.1 being set. In this case the message frame is used to delete all the data records from an archive. On subsequent networks, other job message frames are sent to WinCC depending on the state of memory byte 30. The only differences between the calls relate to the addressing of the start of the data that have to be transmitted. On the final network, acknowledgement message frames originating from WinCC are forwarded to DB23.

&RQILJXULQJLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

Create a new picture in *UDSKLFV'HVLJQHU. In our example, this is the picture called H[BBFKDSWHUBFSGO. We configure an OLE control in this picture at 6PDUW2EMHFW2/(&RQWURO. In the ,QVHUW2OH&RQWURO dialog box that appears, we select the entry :LQ&&8VHU $UFKLYH7DEOH&RQWURO from the list displayed. Close the dialog box by clicking 2.. The deactivated :LQ&&8VHU$UFKLYH7DEOH&RQWURO appears. In our example, we use the object called 2/(&RQWURO.

Click ' on the object known as 2/(&RQWURO to open its Properties dialog box. On the *HQHUDO,QIRUPDWLRQ tab, we select $UFKLYH8VHU$UFKLYHB6 as the 6RXUFH. In the (GLW field, we select check boxes 3DVWH, &KDQJH and 'HOHWH to 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 :ULWH7DJ and 5HDG7DJ. Control is performed by the programmable logic controller in the present example. 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

WinCC Configuration Manual C79000-G8276-C140-01

5-87

8VHU$UFKLYH



6WHS

3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

elements. On the )RQWV tab, we will reduce the VL]H of the font to  in order to be able simultaneously to display all columns of the table at runtime. On the )LOWHU6RUW tab, we will not perform any settings for our example. Complete the settings in the 3URSHUWLHVRI:LQ&&8VHU$UFKLYH7DEOH&RQWURO dialog box by clicking 2.. The color scheme of the table has been adapted in our example to the color scheme used throughout the project by means of the Properties dialog box of the 2/(&RQWURO object. 3 To display the data transferred from User Archive to the programmable logic controller, we configure three I/O fields at 6PDUW2EMHFWV,2)LHOGV. In our example, these are the objects ,2)LHOG, ,2)LHOG and ,2)LHOG. At the ,2ILHOGV, we create - at 3URSHUWLHV2XWSXW,QSXW2XWSXW9DOXH - a WDJFRQQHFWLRQ for each of the three tags 7ZBH[B8$6B, 6ZBH[B8$6B and *ZBH[B8$6B.

To set the record number that has to edited and the field number, we create two more I/O fields at 6PDUW2EMHFWV,2)LHOGV. In our example, these are the objects ,2)LHOG and ,2)LHOG. At the object ,2)LHOG, we create at 3URSHUWLHV2XWSXW,QSXW2XWSXW 9DOXH a WDJFRQQHFWLRQ to tag 8ZBH[B8$6B. This is used to accommodate the record number. At the object ,2)LHOG, we create at 3URSHUWLHV2XWSXW,QSXW2XWSXW 9DOXH a WDJFRQQHFWLRQ to tag 8ZBH[B8$6B. This is used to accommodate the field number. To trigger actions on the programmable logic controller, we configure six buttons at :LQGRZV2EMHFWV%XWWRQ. In our example, these objects are %XWWRQ to %XWWRQ. When a button is clicked, a different value is written to tag 8ZBH[B8DUGB. Every value corresponds to a different type of job for the programmable logic controller. Refer to the list below for the assignment of individual values to the corresponding 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 PLC This tag is periodically queried in the PLC program. A corresponding job is triggered depending on the contents of the tag.

5-88

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH&RQILJXULQJLQ*UDSKLFV'HVLJQHU

1RWH

In our example, we want to test the exchange of data between User Archive and the programmable logic controller. A complex program that sends and receives would go beyond the framework of a basic description of the connection. For checking communication, tags 7ZBH[B8$6B, *ZBH[B8$6B and 6ZBH[B8$6B have been created. I/O field data are used to make entries in these tags at runtime. These data are then re-stored in the data area of a job message frame using project functions. The procedure with 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 tags by means of a project function.

-REVIRUZULWLQJWRWKH3/&
6WHS 3URFHGXUH-REVIRU:ULWLQJWRWKH3/&

With write jobs (write to the programmable logic controller), the data arriving at the programmable logic controller in our example are re-stored in tags 7ZBH[B8$6B, *ZBH[B8$6B and 6ZBH[B8$6B. This is done to check the function and is not necessary in normal practice. In the present example, the storage of data at the WinCC end is solved by means of project functions. Two raw data tags were created. One of the tags is 5$:BH[B8$UGB in our example. With regard to its address, it corresponds to the data area of the acknowledgement message frame sent to the requesting programmable logic controller 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 area on the programmable logic controller in which the three WinCC tags used for checking are addressed. When the data are re-stored, we have to make sure that the first byte of a number occurring in a raw data message frame is the least significant byte. In the case of WinCC tags, the byte order is exactly the reverse of this. , an internal If object %XWWRQ (write record to PLC) is operated by clicking tag of the ELQDU\WDJ type is set. In our example, this is tag %,1LBH[B8$6B. Further, control tag 8ZBH[B8$6B is set to a value of 0x0400. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC, which requests a specific data record. The requested data are then sent by means of the raw data tag set in User Archive to the programmable logic controller (acknowledgement message frame). We configure a &DFWLRQ at 3URSHUWLHV*HRPHWU\3RVLWLRQ; of the button

WinCC Configuration Manual C79000-G8276-C140-01

5-89

8VHU$UFKLYH



6WHS

3URFHGXUH-REVIRU:ULWLQJWRWKH3/&

that is triggered when tag 5$:BH[B8$6B is modified. Any change to this tag signifies that new data have been sent. Tag %,1LBH[B8$6B is checked in the &DFWLRQ. If it has been set, a new data record (as opposed to a new data field) has been sent. Project function $FWXDOLVH6'DWD6HW is then triggered and performs the re-store operation of the sent data to the WinCC tags. Further, tag %,1LBH[B8$UGB is reset.

The procedure for writing fields to the PLC is similar to step 1. However, only a single field is processed. , an internal tag If object %XWWRQ (write field to PLC) is operated by clicking of the ELQDU\WDJ type is set. In our example, this is tag %,1LBH[B8$6B. Further, control tag 8ZBH[B8$6B is set to a value of 0x2000. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC, which requests a specific data field of a data record. The requested data are then sent by means of the raw data tag set in User Archive to the programmable logic controller (acknowledgement message frame). We configure a &DFWLRQ at 3URSHUWLHV*HRPHWU\3RVLWLRQ; of the button that is triggered when tag 5$:BH[B8$6B is modified. Any change to this tag signifies that new data have been sent. Tag %,1LBH[B8$6B is checked in the &DFWLRQ. If it has been set, a new data field (as opposed to a new data record) has been sent. Project function $FWXDOLVH6'DWD)LHOG is then triggered and performs the re-store operation of the sent field to the corresponding WinCC tag. This is performed as a function of the currently set field number. Further, tag %,1LBH[B8$6B 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 tag 8ZBH[B8$6B to a defined value. In this instance we use the value [. It causes the programmable logic controller to request a record. Set tag %,1LBH[B8$6B. This indicates that a data record has been requested.

5-90

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

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$6B. 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 acknowledgement message frame in the WinCC tags. Further, tag %,1LBH[B8$6B is reset. This action is triggered upon a change to tag 5$:BH[B8$6B. This tag is addressed to the data area of the acknowledgement message frame sent by WinCC. If its value changes, 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 data

for (i=0; i<10; i++) { bySet[i]=byData[i]; }


//load double data

for (i=0; i<8; i++) { bySet[17-i]=byData[10+i]; }


//load integer data

for (i=0; i<4; i++) { bySet[21-i]=byData[18+i]; } SetTagRaw("RAW_ex_UAS7_08",&bySet[0],22);


//init telegram data

for (i=0; i<22; i++) { byData[i] = 0; } SetTagRaw("RAW_ex_UAS7_02",&byData[0],22); }

WinCC Configuration Manual C79000-G8276-C140-01

5-91

8VHU$UFKLYH



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 field 5HFRUG1DPH, which is present in the 8VHU$UFKLYHBUG archive. The 10-character field is the equivalent of ten bytes. Reload the double field to the E\6HW byte field. These data correspond to data field 7HPSHUDWXUH, which is present in the archive. A double field requires an area of eight bytes. The byte order has to be reversed. Reload the integer field to the E\6HW byte field. These data correspond to data field 3UHVVXUH, 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 three WinCC tags used for checking. The data sent by the archive are now deleted. For this purpose, a byte field consisting of zeroes is written to tag 5$:BH[B8$6B.

Job message frame in DB26 (read data record)


DATA_BLOCK DB 26 Name : SRead Version : 0.0 struct TLngLow TLngHigh Transfer AAnz PLCID ALng ATyp FNr SNrLow SNrHigh SelKrit Date1 Date2

: : : : : : : : : : : : :

WORD := W#16#1C00; //Frame length low WORD := W#16#0; //Frame length high WORD := W#16#200; //Transfer type, Reserve WORD := W#16#100; //Number of jobs ARRAY [1 .. 8 ] OF //PLCID of archive CHAR := U,S,R,A,R,C,S,7; WORD := W#16#C00; //Job length WORD := W#16#600; //Job type, Reserve WORD := W#16#0; //Field number WORD := W#16#200; //Data record number low WORD := W#16#0; //Data record number high WORD := W#16#0: //Selection criterion WORD; WORD;

END_STRUCT ;

The program excerpt above shows the job message frame for reading a data record from the archive. The structure of the job message frames can be taken from Section  6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. Attention must be paid to the coding of the numerical 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 by means of )&.

1RWH

stores the message frame for reading a data field. This differs from the message frame 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 the data record number.
'%

5-92

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

Acknowledgement message frame in DB23


DATA_BLOCK DB 23 NAME : Quit Version : 0.1 struct TLngLow TLngHigh TTyp FCode Res FNr SNrLow SNrHigh PLCID Text Double0 Double1 Double2 Double4 IntLow IntHigh Data1 Data2

: : : : : : : : : : : : : : : : : :

WORD := W#16#2C00; //Frame length low WORD := W#16#0; //Frame length high WORD := W#16#100; //Transfer type, Reserve WORD := W#16#0; //Error code, job type WORD := W#16#0; //Reserve WORD := W#16#100; //Field number WORD := W#16#300; //Data record number low WORD := W#16#0; //Data record number high ARRAY [1 .. 8 ] OF //PLCID CHAR := U,S,R,A,R,C,S,7; ARRAY [1 .. 10 ] OF //Text box CHAR := R,E,C,O,R,D,_,0,0,1; WORD := W#16#0; //Double field low WORD := W#16#0; WORD := W#16#0; WORD := W#16#0; //Double field high WORD := W#16#0; //Integer field low WORD := W#16#0; //Integer field high WORD; WORD;

END_STRUCT ;

The program excerpt above shows the acknowledgement message frame for reading a data record from the archive. The structure of the acknowledgement message frames can be taken from the section that follows, 6WUXFWXUHRIUDZGDWDPHVVDJH IUDPHV. The data are re-stored from the data area of the message frame by means of project function $FWXDOLVH6'DWD6HW to the WinCC tags. This means that successful sending of 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 message frame does not contain more than a single data field. The data field is re-stored in the corresponding WinCC tag by means of project function $FWXDOLVH6'DWD)LHOG .

-REVIRUUHDGLQJIURPWKH3/&
6WHS 3URFHGXUH-REVIRU5HDGLQJIURPWKH3/&

In the case of read jobs (read from the programmable logic controller), the data stored in tags 7ZBH[B8$6B, *ZBH[B8$6B and 6ZBH[B8$6B have to be re-stored in the data areas of the write message frames of the PLC program. In the present example, this is performed at the WinCC end by means of project functions. Create two raw data tags. A tag, in our example tag 5$:BH[B8$6B, corresponds with regard to its addressing to the data area of the message frame for sending a data record in the PLC program. A second tag, in our example tag 5$:BH[B8$6B, corresponds with regard to its addressing to the data area of the message frame for sending a data field in the PLC program.

WinCC Configuration Manual C79000-G8276-C140-01

5-93

8VHU$UFKLYH



6WHS

3URFHGXUH-REVIRU5HDGLQJIURPWKH3/&

If object %XWWRQ (read record from PLC) is operated by clicking , project function /RDG6'DWD6HW is called. This re-stores the current data of the tags in the data area of the message frame for writing a data record. Further, control tag 8ZBH[B8D6B is set to a hexadecimal value of [. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC to send a data record. In our example, the message frame we are referring to is located in '%.

The procedure for reading from fields on the PLC is similar to that for reading records. However, only a single field is processed. , project If object %XWWRQ (read field from PLC) is operated by clicking function /RDG6'DWD)LHOG is called. This function re-stores the current data of the tag corresponding to the currently set field number inn the data area of the message frame for writing a data field. Further, control tag 8ZBH[B8D6B is set to a hexadecimal value of [. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to WinCC to send a data field. In our example, the message frame we are referring to is located in '%.

Job message frame in DB27 (write data record)


DATA_BLOCK DB 27 NAME : SWrite Version : 0.0 struct TLngLow TLngHigh TTyp AAnz PLCID ALng ATyp FNr SNrLow SNrHigh SelKrit Text Double0 Double1 Double2 Double4 IntLow IntHigh

: : : : : : : : : : : : : : : : : :

WORD := W#16#3200; //Frame length low WORD := W#16#0; //Frame length high WORD := W#16#200; //Transfer type, Reserve WORD := W#16#100; //Number of jobs ARRAY [1 .. 8 ] OF //PLCID CHAR := U,S,R,A,R,C,S,7; WORD := W#16#2200; //Job length WORD := W#16#700; //Job type, Reserve WORD := W#16#0; //Field number WORD := W#16#300; //Data record number low WORD := W#16#0; //Data record number high WORD := W#16#0; //Selection criterion ARRAY [1 .. 10 ] OF //Text box CHAR := R,E,C,O,R,D,_,0,0,1; WORD := W#16#0; //Double field low WORD := W#16#0; WORD := W#16#0; WORD := W#16#0; //Double field high WORD := W#16#0; //Integer field low WORD := W#16#0; //Integer field high

5-94

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

Data1 : WORD ; Data2 : WORD ; END_STRUCT;

The program excerpt above shows the job message frame for sending a data record to the archive. The structure of the job message frames can be taken from Section  6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. Attention must be paid to the coding of the numerical values. The least significant byte is sent first. The number of the data record, to which the message frame data are required to be written, 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 of project function /RDG6'DWD6HW .

1RWH

stores the message frame for writing a data field. This differs from the message frame for writing a data record only in in as much as a there is 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 )&, in addition to the data record number.
'%

-REVIRUGHOHWLQJIURPWKHDUFKLYH
6WHS 3URFHGXUH-REVIRU'HOHWLQJIURPWKHDUFKLYH

, control tag If object %XWWRQ (delete record) is operated by pressing 8ZBH[B8$6B is set by means of a GLUHFWFRQQHFWLRQ to a hexadecimal value of [. However, decimal values have to be entered in the &RQVWDQW input 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

WinCC Configuration Manual C79000-G8276-C140-01

5-95

8VHU$UFKLYH



6WHS

3URFHGXUH-REVIRU'HOHWLQJIURPWKHDUFKLYH

controller then sends a job message frame to WinCC to delete a data record. In our example, the message frame we are referring to is located in '%.

If object %XWWRQ (delete record) is operated by pressing , control tag 8ZBH[B8$6B is similarly set by means of a GLUHFWFRQQHFWLRQ to a hexadecimal value of [. By means of the write operation to the control tag, the programmable logic controller then sends a job message frame to delete all data records. In our example, the message frame we are referring to is located in '%.

Job message frame in DB28 (delete data record)


DATA_BLOCK DB 28 NAME : SDelete Version : 0.0 struct TLngLow TLngHigh TTyp AAnz PLCID ALng ATyp FNr SNrLow SNrHigh Date1 Date2

: : : : : : : : : : : :

WORD := W#16#1A00; //Frame length low WORD := W#16#0; //Frame length high WORD := W#16#200; //Transfer type, Reserve WORD := W#16#100; //Number of jobs ARRAY [1 .. 8 ] OF //PLCID CHAR := U,S,R,A,R,C,S,7; WORD := W#16#A00; //Job length WORD := W#16#800; //Job type, Reserve WORD := W#16#0; //Field number WORD := W#16#100; //Data record number low WORD := W#16#0; //Data record number high WORD; WORD;

END_STRUCT ;

The program excerpt above shows the job message frame for deleting a data record from the archive. The structure of the job message frames can be taken from Section 6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV. Attention must be paid to the coding of the 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 by means of )&.

5-96

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

Job message frame in DB25 (Delete all data records)


DATA_BLOCK DB 25 NAME : ASDelete Version : 0.0 struct TLngLow TLngHigh TTyp AAnz PLCID ALng ATyp Date1 Date2

: : : : : : : : :

WORD := W#16#1400; //Frame length low WORD := W#16#0; //Frame length high WORD := W#16#200; //Transfer type, Reserve WORD := W#16#100; //Number of jobs ARRAY [1 .. 8 ] OF //PLCID CHAR := U,S,R,A,R,C,S,7; WORD := W#16#400; //Job length WORD := W#16#500; //Job type, Reserve WORD; 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 a button. However, the configuration of this dialog box does not depend on the programmable logic controller being used and is therefore described in a separate section (Section 6WDWXV0RQLWRULQJRI([WHUQDO7DJV H[BBFKDSWHUBFSGO ).

1RWHVRQJHQHUDOXVH

The following adaptations must be made for general use: The configurations performed for the connection can be directly applied to private applications, provided that the hardware used is identical. If not, adjustments have to me made 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 the PLC program.

WinCC Configuration Manual C79000-G8276-C140-01

5-97

8VHU$UFKLYH



 6WDWXV0RQLWRULQJRI([WHUQDO7DJV H[BBFKDSWHUBFSGO

7DVNGHILQLWLRQ

The status of several external tags is required to be monitored at runtime. We want the status to be displayed in a separate dialog box, which we want to be accessible by means of a button.

,PSOHPHQWDWLRQFRQFHSW

The dynamic dialog box is used to monitor the status of individual tags. For every tag we want to have monitored, static text is used to display the static text and a status display presents a symbolic representation of the status. These objects are configured in a separate picture. This picture is displayed at runtime by means of a picture window that can be shown by means of a button.

,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU
6WHS 3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

1 2

Create a new picture in *UDSKLFV'HVLJQHU. In our example, this is the picture called H[BBZLQGRZBSGO. In the picture we have just created, we configure static text at 6WDQGDUG2EMHFW 6WDWLF7H[W. In our example, we use the object called 6WDWLF7H[W. Its purpose is to display the status of tag 7ZBH[B8$6B, which was created in the 
&RQQHFWLRQYLD:LQ&&5DZ'DWD7DJVWRWKH6 H[BBFKDSWHUBFSGO

example. The procedure is the same for any other external tag, however. At 3URSHUWLHV)RQW7H[W, we create a G\QDPLFGLDORJER[. In the
([SUHVVLRQ)RUPXOD box, we click the button to set the tag we want to monitor, namely 7ZBH[B8$6B. Select the (YDOXDWH7DJ6WDWXV check box. The dialog box is then expanded. There is then the possibility of defining text for every tag status possible. If the tag assumes the corresponding status, this text is displayed in the 6WDWLF7H[W object. If no status on the list is in fact current - in other words, the connection is in order - the text entered on the 2WKHU line is displayed. In our example, this is &RQQHFWLRQ2..

5-98

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

Configure a status display at 6PDUW2EMHFW6WDWXV'LVSOD\. In our example, we use the object called 6WDWLF'LVSOD\. The purpose of the object is to symbolically display the status of tag 7ZBH[B8$6B. Following placement, the FRQILJXUDWLRQGLDORJER[ of the object is displayed. A further status is added by button. We then set a suitable picture for every status. clicking the In our example, the pictures are 9HUELQGXQJ2.EPS for status  and 9HUELQGXQJ6723EPS for status . Complete the settings in the FRQILJXUDWLRQGLDORJER[ by clicking 2..

WinCC Configuration Manual C79000-G8276-C140-01

5-99

8VHU$UFKLYH



6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

We want the 6WDWXV'LVSOD\ object to be supplied at runtime with information about the status of the tag. This is accomplished by means of the 6WDWLF7H[W object, which monitors the status. At this object, we create a C action at (YHQW3URSHUW\7RSLFV)RQW7H[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 it is identical with the string &RQQHFWLRQ2., the status of object 6WDWXV'LVSOD\ is set 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 in order to display the status display with the current status. This is accomplished by the text entered in object 6WDWLF7H[W being deleted. In this way, the text is modified at all events following opening of the picture and the action is executed. In our example, tags *ZBH[B8$6B and 6ZBH[B8$6B are likewise monitored. To configure them for monitoring, proceed in a similar manner to the steps just described. When configuring several similar tag monitors, pay attention to the note that follows this table. We want to display the picture we have just created in a picture window. For this purpose, we configure in our example a picture window at 6PDUW2EMHFW 3LFWXUH:LQGRZ in another picture, H[BBFKDSWHUBFSGO in our example. This picture window is object 3LFWXUH:LQGRZ. At 3URSHUWLHV0LVFHOODQHRXV3LFWXUH1DPH, set H[BBZLQGRZBSGO, the picture you created earlier. At 3URSHUWLHV0LVFHOODQHRXV, the GLVSOD\ of the object is set to 1R.

5-100

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

6WHS

3URFHGXUH,PSOHPHQWDWLRQLQ*UDSKLFV'HVLJQHU

In order to be able to display it at runtime all the same, we configure a button at :LQGRZV2EMHFW%XWWRQ. In our example, we use the object called %XWWRQ. At this button, we create a GLUHFWFRQQHFWLRQ at (YHQW0RXVH0RXVH$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 different tags, it is advantageous to fully configure these objects and then copy them. In the present case, however, this is not possible - at least not directly possible. If, namely, the tag name is modified in the dynamic dialog box, the values entered for each status of the tag will similarly be lost. There is a possibility, however, of transforming the dynamic dialog box into a C action. For this purpose, only the created dynamic dialog box is opened as a C action in the Properties dialog box of the object.

The C action received can now be copied. Only the tag name in the code of the copy has to be modified and the C action triggered on this tag.

WinCC Configuration Manual C79000-G8276-C140-01

5-101

8VHU$UFKLYH



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 &RQQHFWLRQ2.. If they are identical, object 6WDWXV'LVSOD\ is set to status . This means that the green check mark is displayed. If they are not identical, object 6WDWXV'LVSOD\ is set to status . This means that the STOP symbol is displayed.

1RWHVRQJHQHUDOXVH

The following adaptations must be made for general use: The procedure described above can be applied directly to your own project.

5-102

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

 6WUXFWXUHRIUDZGDWDPHVVDJHIUDPHV

*HQHUDO

The raw data message frames can be sent by the programmable logic controller by means of an active sender to WinCC. The message frames contain one or more requests on the WinCC 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 consist in their turn of a job header and possibly subsequent data - where write jobs are concerned. Processing acknowledgements consist of an acknowledgement header and possibly subsequent data - where read jobs are concerned.
6WUXFWXUHRIWKHPHVVDJHIUDPHKHDGHU
%\WH 'HVFULSWLRQ

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Message frame length in byte LSB (frame length requires a total of 4 bytes) Message frame length in byte Message frame length in byte Message frame length in byte MSB Transfer type: 2 corresponds to Send Data from the programmable logic controller Reserved Number of jobs LSB (number of jobs requires a total of 2 bytes) Number of jobs MSB 1st character of archive PLCID (PLCID is eight characters long) 2nd character of archive PLCID 3rd character of archive PLCID 4th character of archive PLCID 5th character of archive PLCID 6th character of archive PLCID 7th character of archive PLCID 8th character of archive PLCID

WinCC Configuration Manual C79000-G8276-C140-01

5-103

8VHU$UFKLYH



6WUXFWXUHRIWKHMREKHDGHU
%\WH 'HVFULSWLRQ

0 1 2 3 4 5 6 7 8 9 10 11

Job length LSB (job length requires a total of 2 bytes) Job length in byte MSB Job type: refer to description of job types below Reserved Field number LSB (field number requires a total of 2 bytes) Field number MSB Data record number LSB (data record number requires a total of 4 byte) Data record number Data record number Data record number MSB Selection criterion LSB (selection criterion requires a total of 2 bytes) Selection criterion MSB

1RWH

The field number that has to be specified in the job header is applicable only to jobs involving 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 in the ID column of User Archive. Data record numbering starts at 1. If 0 is entered, a new data record is added in the case of a job writing a data record to User Archive.

-REW\SHV

A byte is set for the job type in the job header. The following job types are available.

7\SH

'HVFULSWLRQ

4 5 6 7 8 9 10

Test archive for presence Delete all data records from the archive Read data record (archive to programmable logic controller) Write data record (programmable logic controller to archive) Delete data record Read data field (archive to programmable logic controller) Write data field (programmable logic controller to archive)

5-104

WinCC Configuration Manual C79000-G8276-C140-01



8VHU$UFKLYH

-REGDWD

In the case of write jobs, the archive data come next. They correspond to the contents of a data record with a ZULWHGDWDUHFRUG job or the contents of a data field with a ZULWHGDWD ILHOG job. No other data follow for the remaining jobs. Numbers are transmitted in Intel format. This means that the LSB is transferred first and the MSB last. Integer fields are 4 bytes long, double fields are 8 bytes long. Text fields are not terminated with \0.

$FNQRZOHGJHPHQWKHDGHU
%\WH 'HVFULSWLRQ

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Message frame length in byte LSB (frame length requires a total of 4 bytes) Message frame length in byte Message frame length in byte Message frame length in byte MSB Transfer type: 1 corresponds to the data sent by WinCC Reserved Error code: refer to the description of error types below Job type: refer to description of job types above Reserved Reserved Field number LSB (field number requires a total of 2 bytes) Field number MSB Data record number LSB (data record number requires a total of 4 byte) Data record number Data record number Data record number MSB 1st character of archive PLCID (PLCID is eight characters long) 2nd character of archive PLCID 3rd character of archive PLCID 4th character of archive PLCID 5th character of archive PLCID 6th character of archive PLCID 7th character of archive PLCID 8th character of archive PLCID

WinCC Configuration Manual C79000-G8276-C140-01

5-105

8VHU$UFKLYH



$FNQRZOHGJHPHQWGDWD

In the case of read jobs, the requested data then follow. They correspond to the contents of a data record with a UHDGGDWDUHFRUG job or the contents of a data field with a UHDGGDWD ILHOG job. No other data follow for the remaining jobs.

(UURUFRGHV

If an error occurs during communication, WinCC returns an error code to the programmable logic controller in the acknowledgement message frame. The following error codes are defined.

&RGH

'HVFULSWLRQ

0 1 2 101 102 201 202 254 255

Function triggered Invalid data (archive) Non-existent data (archive) Invalid data (data record) Non-existent data (data record) Invalid data (field) Non-existent data (field) Function not available Undefined error

5-106

WinCC Configuration Manual C79000-G8276-C140-01



,QGH[

Index
A
Acknowledgement, 3-57 Horn, 4-76 Messages, 4-76 Addressing indirect, 2-47, 2-50 Alarm Analog Alarms, 4-72 Archiving of, 4-91 Bit Message Procedure, 4-52 Create with Wizard, 4-63 Enter Alarm Logging in the Startup tab, 469 line, 3-5 Loop in, 4-89 Loop in, 3-109 Setup, 4-52 Use OCX, 4-97 Alias archive, 5-4 data fields, 5-7 Analog Values Monitor, 4-72 API For Message Filter, 4-95 Use, 4-28 Application window, 3-107 Archive Every full Minute, 4-42 Export, 4-46 archiving Cyclic-Continuous, 4-3 Archiving Acyclic, 4-21 Alarms, 4-91 Authorization level, 3-27 Use, 4-30 Changeover switch, 2-17 Color change, 3-70, 3-79 scheme, 3-109 Communication driver, 5-39 processor, 5-34 Communications user archives, 5-4 Communikation OLE with Excel, 4-139 Configuration Color Scheme of the Messages, 4-67 Loop in Alarm, 4-89 Trend Display, 4-24, 4-46 Connection in Control Center, 5-39 on PLC, 5-38 raw data tags, 5-49 To Excel, 4-139 to S5, 2-66 WinCC tags, 5-34 Content Print Short-Term Archive, 4-95 Control tags, 5-28 Controllable access protection, 3-24, 3-27 Create data fields, 5-7 user archives, 5-3 Creating tags, 2-2 Creation Group Messages, 4-102 Process Value Archive, 4-3 CSV Export Archive Automatically, 4-46 user archives, 5-12 CurrentUser, 4-25

B
Bit editing, 2-39 Bit Message Procedure, 4-52, 4-64 Bit pattern, 2-40 Buttons For Message Filter, 4-91

D
Data Archive, 4-29 Archiving, 4-16 data fields, 5-7 data type, 5-2 transfer to PLC, 5-2 Data import user archives, 5-12 Decrementing, 2-7, 2-19

C
Callback Function

WinCC Configuration Manual C79000-G8276-C140-01

Index-1

,QGH[



Direct connection, 2-13, 2-29, 2-40, 3-7 Direct link, 1-1 Display Contents Of Example_01, 4-149 DLL Integration, 4-86 Documentation Pictures, 4-110 Project Function, 4-115 Tags, 4-118 Trend Window, 4-123 Dynamic Part of the Report, 4-132 Dynamic Dialog Use, 4-40 Dynamic dialog box status monitoring, 5-98 Dynamic Wizard, 3-12, 3-15

picture window, 3-33, 3-35, 3-36 HMI, 3-1 Hot key configuring, 3-86

I
Import tags, 2-61 Incrementing, 2-7, 2-19 Info (instruction) box configuring, 3-39 Information hiding, 3-74, 3-102 showing, 3-74, 3-102 Initialisation Of the Callback Function with Call, 4-33 Initialization in the project, 3-50 picture, 1-2 simulation, 2-56 Input by means of a check box, 2-36 by means of a slider, 2-29 by means of an option group, 2-34 check, 3-59, 3-61 Integration DLL, 4-28

E
Editor user archive editor, 5-3 Embedding OCX, 5-15 Entry data entry, 5-11 Error error code, 5-106 Excel user archives, 5-13 Export Process Valie Archive, 4-46 tags, 2-61

J
Jogging, 2-7

K F
Form view, 5-23 Key combination Logon, Logoff, 3-28 switching between windows, 3-93 Key Combination For Login, 4-12

G
Gauge control, 5-20 Group Tag Management, 2-2 user group, 3-28 Group Messages, 4-101

L
Language in runtime, 3-83 Library, 3-7 project, 3-11 Login, 3-27, 3-30 Name in the project example_01, 4-12 Loop in Alarm, 4-89

H
Hiding information, 3-74, 3-102

Index-2

WinCC Configuration Manual C79000-G8276-C140-01



,QGH[

M
Message Wizard, 4-63 Message box, 2-56 Message Window, 4-52, 4-58, 4-72, 4-88, 4-97 Messages Archiving, 4-91 Bit Message Procedure, 4-52 Configure, 4-64 configuring, 3-107 Define Colors, 4-67 Print, 4-95, 4-137 MPI, 5-71 Multiplex display, 2-50

Picture Register Creation, 4-145 project, 3-1 windows, 3-5 Picture window time-controlled hiding, 3-36 Pragma, 3-29, 4-28, 4-86 Print Job Time Selection, 4-126 Process connection, 2-1 Process Value Archive Create, 4-3 Project start, 2-23 Project library, 3-11

O
OCX Use Alarm OCX, 4-97 using, 3-105 OLE Connection to Excel, 4-139 insert, 5-15 OLE control, 5-2 Operator Authorization For Trend Display, 4-9 Operator panels, 3-52 Operator-controllable archives, 5-5 Output Message Sequence Report, 4-135 Overview picture, 3-3, 3-107

R
Raw data tags raw data message frames, 5-103 user archives, 5-49, 5-70 Resolution screen, 1-1, 3-1 Runtime language change, 3-83 Print out table, 4-129 Print out trend window, 4-123 shutting down (exiting), 3-25 Start, stop archiving, 4-15

S
Screen layout, 3-3, 3-4 Section screen, 3-4 Selection data types, 2-3 Set value changing, 2-8, 2-29 Setup Message Class, 4-75 Message Line Format, 4-57 Message Window Template, 4-58 Single Messages, 4-64 Short-term archive, 3-108 Short-Term Archive Create, 4-92 Print Messages, 4-137 Showing picture window, 3-32 Shutdown WinCC, 3-24

P
password In the project example_01, 4-3 Password, 3-2 In the project example_01, 4-21 Performance, 1-1 Picture adjust size, 3-46 buildup, 3-1 change, 3-6 change size, 3-49 changing, 3-3 displaying the picture name, 3-7 Documentation, 4-110 geometry, 3-46 initialization, 1-2 opening, 3-1, 3-7

WinCC Configuration Manual C79000-G8276-C140-01

Index-3

,QGH[



Simulation, 2-55, 4-2 Slider, 2-29 SmartTools, 2-59 Sound, 4-86 Startup Tab, 4-14, 4-69 Status display, 3-80 Status monitoring, 5-98 Structure tags, 2-5, 2-63 Switching operation binary, 3-53 Sysmalloc, 3-106 System Time Determination, 4-48

Trends Displaying Process Values, 4-2

U
Update Stopped, 4-26 Trend Window, 4-18 User As the project example, 4-3 authorization, 3-27 groups, 3-29 User archive creating, 5-3 editor, 5-3 User Archives database, 5-2 User level, 3-30

T
Table configuring, 5-15 Display process values, 4-21 User Defined, 4-30 Table Layout, 4-29 Tags Archive, 4-38 Document, 4-118 simulation, 2-55 Text text library, 5-7 Text input, 3-43 Time display, 3-105 Time Selection, 4-126 Tool tip, 2-3 Toolbar user archives, 5-22 User Archives, 5-2

V
View, 5-2

W
WinCC Shutdown, 3-24 Without a mouse working, 3-85 Wizard For Process Value Archive, 4-3 Message Wizard, 4-63 Working without a mouse, 3-85

Index-4

WinCC Configuration Manual C79000-G8276-C140-01

You might also like