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

Uhiyrs8r

!((

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

!((

Uhiyrs8r

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

Uhiyrs8r

!((

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

!((

Uhiyrs8r

3UHIDFH
Qrsurhhy

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 hvhf
description of example project vpf description of example project rhyrf

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

Srvrrsvtuvhhy

Knowledge of WinCC BrvtThrq) or practical configuration experience using WinCC.

6qqvvhyT

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

Uhiyrs8r

!((

DshvhiTDH6UD8Qqp

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

!((

ThyrQwrp

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

Ir)

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 Ayy TprrandTyvqr under 8y8rr8rQrvrQrvr BhuvpSvr.

The partitioning of the screen and the associated presettings and scripts associated with this are described in more detail in Chapter "  Ghvturprr nher beschrieben.
Ir)

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

Thyrwrp

!((

Dvvhyvhv

If required, initialization procedures are performed for the individual pictures. These initialization procedures are configured under @r Hvpryyhr PrQvpr.

1-2

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

 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. Drhyht without process driver connection, @rhyht with process driver connection, and in the scripts, 8ht. In our examples, we will mainly be using vrhyht and 8ht. The examples used for these topics are configured in the WinCC project entitled hvhf.

WinCC Configuration Manual C79000-G8276-C140-01

2-1

ThyrQwrphvhf

!((

!

8rhvttvthqvtht

In WinCC, tags can be created in the 8y8rr under the items UhtHhhtrr and 9hhUr.

Uhthhtrr

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.
Tr Qprqr)prhvthtvurUhtHhhtrr

To create a tag group for vrhyht, ' the item. Then 5 the subitem Drhyht that appears in order to open the pop-up menu. Select the Ir B 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 Drhyht item, this group symbol the 8y8rr. 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 IrUht 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

!((

ThyrQwrphvhf

Tr

Qprqr)prhvthtvurUhtHhhtrr

On the BrrhyDshv tab in the window that appears, enter a tag name. Then select the qhhr you want from the list box immediately below. An 6qqr does not have to be set for internal tags.

Ir)

The current status of the tag in the process image can be queried in the 8y8rr by means of a tool tip while runtime is active.

9hhr

A new tag can also be created by means of the 9hhUr item. You can choose from the following data types:

Tr

Qprqr)prhvthtirhsur9hhUrrvr

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 9hhUr item, a list of the data types available appears.

WinCC Configuration Manual C79000-G8276-C140-01

2-3

ThyrQwrphvhf

!((

Tr

Qprqr)prhvthtirhsur9hhUrrvr

When you click the PF button, you are returned to the BrrhyDshv tab in the Uhtrvr window under the Tag Management item.

Hvtht

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


Tr

1 2

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

85

Qprqr)vtht

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

Ir)

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.

@rhyht

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

1 2

85

Qprqr)

9vr

the Tag Management item to open the pop-up menu and select the 6qqIr item.

Select the driver you want from the list displayed and click the Pr button. A new subitem with the name of the driver appears in the left window of the 8y8rr.

' this new subitem, a further subitem appears. 5 this new subitem If you to open the pop-up menu and select the Ir9vr8rpv item.

2-4

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)

On the BrrhyDshv 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 PF 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 rrhyht, you must also define the addressing and format adjustment in addition to the settings for vrhyht. The addressing refers to the address of the tag in the programmable controller.

Tprht

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.
Tr Qprqr)

5 the Tprht item to open the pop-up menu To create a new structure, and select the IrTprUr item.

2 3

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

WinCC Configuration Manual C79000-G8276-C140-01

2-5

ThyrQwrphvhf

!((

Tr

Qprqr)

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 PF button.

Ir)

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

!((

ThyrQwrphvhf

!! Dprrvtqrprrvthqwttvt

In runtime, you access the examples that relate to these topics in the button depicted above. The examples are configured in the our hvhf project by pictures hvhf"fpuhrf qy and hvhf"fpuhrf hqy.

9rsvvv

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. Ettvt refers to the execution of an action when a i 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.
Dprrvt 9rprrvt

WinCC Configuration Manual C79000-G8276-C140-01

2-7

ThyrQwrphvhf

!((

!!

Ettvtpuhtvthrhyrrhyr

Uhxqrsvvv

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.

Dyrrhvppr

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

; changing is event-driven. When the i is , the value of an vrhyht 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 8 hpv. The change in the set value is displayed by means of a ThPiwrpDPAvryq. The output value of theDPsvryq is linked to the vrhyht.
DyrrvtvurXv88wrp
Tr Qprqr)puhtvthrhyrvsvrqr

1 2

Create a tag of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tag called T"!vfhvhfif In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq . When configuring the DPsvryq in the psvthvqvhyt, select the tag named T"!vfhvhfif, change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P.

3 4

In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7! To change the set value, create a 8hpv by the object and selecting Qrvr@rHrQryrs. This 8hpv changes the value of the tag each time the button is clicked with the and checked in the 8hpv.

. The limit value is specified

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

2-8

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

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 vrhyspv BrUht9Xq to read out the current value from tag T"!vfhvhfif.

In the vs 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 ryr branch is executed and the value is raised in this way by 100. The vrhyspv TrUht9Xq then returns the changed value to the T"!vfhvhfif tag.

Irtrrhyr

The 8hpv linked to the two i 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

ThyrQwrphvhf

!((

!!! EttvtpuhtvthrhyrvtByihyTpvrhyr!

Uhxqrsvvv

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

Dyrrhvppr

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

; changing is event-driven. When the i is , the value of an vrhyht 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 wrp spv. The change in the set value is displayed by means of a ThPiwrpDPAvryq. The output value of theDPsvryq is linked to the vrhyht.

DyrrvtvurXv88wrp
Tr Qprqr)prhvturwrpspv

1 2 3 4

Open the ByihyTpv editor from the 8y8rr. Create a new function by selecting AvyrIrQwrpApv. Assign this new function the name Dp9rpWhyr and save the function by selecting AvyrThr6Dp9rpWhyrsp. 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

!((

ThyrQwrphvhf

The function header with the name of the project function Dp9rpWhyr and the transfer parameters. We use the same wrpspv 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 8ht . Using the vpu statement, evaluate the information of the direction tag h. In the relevant phr 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


Tr Qprqr)puhtvthrhyrvsvrqr

1 2

Create a tag of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tag called T"!vfhvhfif# In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called I/O Field2. When configuring theDP svryq in the psvthvqvhyt, select the tag named T"!vfhvhfif#. change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P.

3 4

In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7& To change the set value, create a 8hpv by the object and selecting Qrvr@rHrQryrs. This 8hpv calls the wrp spv Dp9rpWhyr and transfers the required parameters to it. The changes the . The limits are value of the tag each time the i is clicked with the specified as the transfer parameters when the wrpspv is called. They are checked in the wrpspv.

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

WinCC Configuration Manual C79000-G8276-C140-01

2-11

ThyrQwrphvhf

!((

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 vrhyspv BrUht9Xq to read out the current value of the vrhy ht. Call the wrpspv Dp9rpWhyrand transfer the parameters (Qvrht, GryvvVryvvDprr9vrpv. Use the vrhyspv TrUht9Xq to transfer the changed value to the vrhy ht.

Irtrrhyr

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

2-12

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!!" Ettvtirhyr$

You access the solutions to these subjects in our project called hvhfby choosing the two iwith the . They are configured in the picture with the name vpf"fpuhrf hqy.

Uhxqrsvvv

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.

Dyrrhvppr

We implement the button along event-driven lines by means of a button, which we create under XvqPiwrp7. We visualize this implementation by means of a qvrpprpv and a 8hpv.
Ir)

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

DyrrvtvurXv88wrpqvrpprpv
Tr Qprqr)uhixqvrpprpv

1 2 3

Create a tag of type 7vhht in Tag Management. In our example, we use the tag called 7DIvfhvhfif ! In a picture, we configure XvqPiwrp7. In our example, we use the object called 7! Configure a qvrpprpv for 7! under @rHrQryrs. Connect the pr 8h to the htr Whvhiyr7DIvfhvhfif !. Accept the settings by clicking the PF button. Configure another qvrp prpv under @rHrSryrhryrs, but this time for the pr 8h.

WinCC Configuration Manual C79000-G8276-C140-01

2-13

ThyrQwrphvhf

!((

Tr

Qprqr)uhixqvrpprpv

We control our animation by means of the 7DIvfhvhfif

tag.

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

DyrrvtvurXv88wrp8hpv
Tr Qprqr)uhix8hpv

1 2 3

Create a tag of type 7vhht in Tag Management. In our example, we use the tag called 7DIvfhvhfif ! In a picture, we configure XvqPiwrp7. In our example, we use the object called 7  Under @rHrQryrs, generate a 8hpv which sets the value of the 7DIvfhvhfif ! tag to . Under @rHrSryrhryrs, generate a further 8hpv which sets the value of the 7DIvfhvhfif ! 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 vrhyspv TrUht9Xq to set the tag to .

2-14

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

6vhvsrhyr

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

The color wheel consists of several ThqhqPiwrpQvrTrtr. The QrvrBrrTh6tyr and QrvrBrr@q6tyr of all the objects are dynamized using the 9hvp9vhyt. 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 8hpv for QvrTrtr# under Qrvr8yGvr8y. We set the trigger for the action to !$. In this case, we do dynamize the Gvr8y. The reason a 8hpv 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 vrhyht called T"!vfhhfif .

WinCC Configuration Manual C79000-G8276-C140-01

2-15

ThyrQwrphvhf

!((

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 8ht v as a hvp9XPS9, since its value must remain constant while the picture is open. By clicking the i (button on), rotate the wheel further in steps of 10 degrees, i.e. increment the value of the tag by 10. The tag v is initialized once the wheel has been fully rotated through 360. Transfer the new value for the angle of rotation of the vrhyht. Return the input configured for the background color with r. It isn't supposed to be changed.

Irtrrhyr

The i with the qvrpprpv can be used after changes have been made to the tag.

2-16

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!!# Ettvtpuhtrrvpurhyr%

You access the example that relates to this topic in our hvhf project by i depicted above. They are configured in the picture with the name vpf"fpuhrf hqy.

the two

Uhxqrsvvv

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.

Dyrrhvppr

We implement the changeover switch along event-driven lines by means of a button, which we create under XvqPiwrp7.
Ir)

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

DyrrvtvurXv88wrpqvrpprpv
Tr Qprqr)uhpuhtrrvpuxqvrpprpv

1 2

Create a tag of type 7vhht in Tag Management. In our example, we use the tag called 7DIvfhvhfif % In a picture, configure two buttons under XvqPiwrp7. In our example, we use the object 7# for switching on and the object 7$ for switching off. Configure a qvrpprpv for 7# under @rHrQryrs. Connect the pr 8h to the htr Whvhiyr7DIvfhvhfif %. Accept the settings by clicking the PF button. Configure a qvrpprpv linked to 7$ in the same way, but this time with the pr 8h. The qvrpprpv under Events Mouse Mouse Action only synchronizes the labeling on 7" and isnt essential for the changeover switch to be able to function.

WinCC Configuration Manual C79000-G8276-C140-01

2-17

ThyrQwrphvhf

!((

DyrrvtvurXv88wrp8hpv
Tr Qprqr)uhpuhtrrvpux8hpv

1 2 3

Create a tag of type 7vhht in Tag Management. In our example, we use the tag called 7DIvfhvhfif % In a picture, configure a XvqPiwrp7. In our example, we use the object called 7". Under @rHrQryrs, generate a 8hpv which negates the status of the 7DIvfhvhfif % 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 hr tag. The vrhyspv BrUht7v reads out the value of the vrhyht, inverts it and returns it with TrUht7v.

Irtrrhyr

The button with the 8hpv can be used after changes have been made to the tag. Inversion of the vrhyht can also be carried out without the 8ht.
SetTagDWord("BINi_varia_but_16",(SHORT)!GetTagBit("BINi_varia_but_16 "));

2-18

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!!$ Dprrvthqqrprrvtrhyr 

Uhxqrsvvv

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.

Dyrrhvppr

We create a button along event-driven lines using XvqPiwrp7. When the button is pressed with the , the value of an vrhyht 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 ThPiwrpDPAvryq. The output value of theDPsvryq is linked to the vrhyht.

Changing the value


To change the value, we need an action which changes the value of an vrhyht with a fixed time base. We effect this changing of the value by means of a 8hpv on the DP svryq under QrvrBrrQvvY. We set the trigger for the action to !$. We are dynamizing the position of the DPsvryq. The reason a 8hpv 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 tyihyhpv.

WinCC Configuration Manual C79000-G8276-C140-01

2-19

ThyrQwrphvhf

!((

DyrrvtvurXv88wrp
Tr Qprqr)vprrvtqrprrvt

1 2

Creating the tag in the Tag Management. In our example, we use the tags called
T"!vfhvhfifhqT'vfhvhfif 

In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq  When creating the DPsvryq in the psvthvqvhyt, set the tag called T"!vfhvhfif. change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. In the same picture, configure a XvqPiwrp7. In our example, we use the object called 7" To modify a setpoint at the click of a mouse, we create several qvrpprpv at thisi. These qvrpprpvmodify the value of tag T'vfhvhfif every time the i is chosen with the or R. Set @rHrQryrs to incrementation ON (set tag to ). Set @r HrSryrhryrs to incrementation OFF (set tag to ). Set @r HrQrvtu to decrementation ON (set tag to !) and @rHr Sryrhrvtu to decrementation OFF (set tag to ).

3 4

8 8

5 6

The value of the T"!vfhvhfif tag is changed by a 8hpv for the object DPAvryq under QrvrBrrQvvY. We then change the trigger for calling the 8hpv to !$.

2-20

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

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 8ht hyr and p. Evaluation of whether the i is pressed. If the i is not being pressed, the 8 hpv is ended (to avoid unnecessary loading of the system). If the i 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 r. It isnt supposed to be changed.

Irtrrhyr

The button with the qvrpprpv can be used after changes have been made to the tag and in conjunction with the 8hpv for the DPsvryq. The limits and tags must be adapted in the 8hpv.

WinCC Configuration Manual C79000-G8276-C140-01

2-21

ThyrQwrphvhf

!((

!!% DprrvthqqrprrvtvtByihyTpvrhyr!

Uhxqrsvvv

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.

Dyrrhvppr

We create a button along event-driven lines using XvqPiwrp7. It is to be implemented with the aid of a tyihyhpv. , the value of an vrhyht 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 ThPiwrpDPAvryq. The output value of theDPsvryq is linked to the vrhyht.

2-22

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Changing the value


To change the value, we need an action which changes the value of an vrhyht with a fixed time base. We implement the change in the value by means of a tyihyhpv. 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 8ht. External 8ht 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 wrpspv, a separate wrpspv is created for declaring these tags. This project function must be executed once when the project is started and is then no longer required.

DyrrvtvurXv88wrp

Configuration is divided into the following three steps.

Tr )

8rhvturwrpspv
Tr Qprqr)prhvturwrpspvsvvvhyvhv

1 2 3 4

Open the ByihyTpv editor from the 8y8rr. Create a new function by selecting AvyrIrQwrpApv. Assign this new function the name Dv6pv and save the function by selecting AvyrThr6Dv6pvsp. 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 8ht. 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 @rHvpryyhrPrQvpr.

WinCC Configuration Manual C79000-G8276-C140-01

2-23

ThyrQwrphvhf

!((

Tr!)

8rhvturtyihyhpv
Tr Qprqr)prhvturtyihyhpv

1 2 3 4 5

Open the ByihyTpv editor from the 8y8rr. Create a new action by selecting AvyrIr6pv. Save the file by selecting AvyrThr6prh. Program and compile the action. Set the trigger. You do this by clicking the tab. Add Uvr8pyvp!$ on this tab.
i

and selecting the Uvttr

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 8ht. Evaluation of whether the i is pressed. If the i is not being pressed, the 8 hpv is ended (to avoid unnecessary loading of the system). If the i is being pressed, the script inquires whether the value is to be incremented or decremented. The value of the 8hthyr is changed depending on the result of this evaluation. After the value has been changed, the limit value check is performed. Use the vrhyspv TrUht9Xq to assign the new value to the tag to be processed.

2-24

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr")

8svtvturi
Tr Qprqr)vprrvthqqrprrvtvtByihyTpv

1 2

Creating the tag in the Tag Management. In our example, we use the tag called
T"!vfhvhfif#

In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq! When creating the DPsvryq in the psvthvqvhyt, set the tag called T"!vfhvhfif#. change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7' To modify a setpoint at the click of a mouse, we create several 8hpv at this iThese 8hpv provide the tyihyhpv, prhwith the relevant parameters. This happens each time the button is clicked with the or R. Set @rHrQryrs to incrementation ON, @rHr Sryrhryrs to incrementation OFF, @rHrQrvtu to decrementation ON and @rHrSryrhrvtu to decrementation OFF.

3 4

8 8

The value of the T"!vfhvhfif# tag is changed in the tyihyhpv prh.

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

ThyrQwrphvhf

!((

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 8ht in the 8hpv. These tags are generated in the project function Dv6pv. Provide the tags with the relevant values. This is comparable with transferring parameters to a wrpspv. The content of the p tag is responsible for processing the program in the tyihyhpv. When switching off the incrementation process, there is no need to set all the tags.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: In the 8hpv, change the tag and adapt the limit values and the increment. If this button is to be used in another project, the wrpspv Dv6pv and the tyihyhpv prh must both be transferred over together with the button.

2-26

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!!& Uururrhyrryhrquvvp

rhyr"

The functionality of this example is similar to that of example rhyr . 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.

rhyr#

The functionality of this example results from combining rhyr and rhyr!. The value is changed with the help of the tyihyhpv prh.

rhyr&

The functionality of this example is similar to that of example rhyr$. The difference here is in the mode of animation.

WinCC Configuration Manual C79000-G8276-C140-01

2-27

ThyrQwrphvhf

!((

!" 8uhtvththyrvtXvqPiwrp

In runtime, you access the solutions that relate to these topics in the i depicted above. The examples are configured in the our hvhf project by picture named hvhf"fpuhrf!qy.

2-28

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!"

Dvtirhshyvqrvuqvrpprpvrhyr 

Uhxqrsvvv

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.

Dyrrhvppr

We use a slider object created under XvqPiwrpTyvqrPiwrp to implement changing of the set values. By means of a qvrpprpv, the value of an vrhyht is changed when the position of the slider is changed. The change in the set value is displayed by means of a ThPiwrpDPAvryq.

DyrrvtvurXv88wrp
Tr Qprqr)puhtvtrhyrirhshyvqrqvrpprpv

1 2

Create a tag in Tag Management. In our example, we use the tag called
T"!vfhvhfvf 

In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq . When configuring the DPsvryq in the psvthvqvhyt, select the tag named T"!vfhvhfvf . change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P.

WinCC Configuration Manual C79000-G8276-C140-01

2-29

ThyrQwrphvhf

!((

Tr

Qprqr)puhtvtrhyrirhshyvqrqvrpprpv

In the same picture, configure an object under XvqPiwrpTyvqrPiwrp. In our example, we use the object called TyvqrPiwrp . Create aqvrp prpv under @rHvpryyhrQpr9vr8rpv.

In the 9vrp8rpv dialog box, connect the pr uviwrpQpr 9vr8rpv to the htr WhvhiyrT"!fhvhfvf . Accept the settings by clicking the PF button.

2-30

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)puhtvtrhyrirhshyvqrqvrpprpv

Irtrrhyr

The following adaptations must be made before this button can be put to general use: Change the tag in the qvrpprpv. The value range of the TyvqrPiwrp can be changed under QrvrHvpryyhr HhvWhyr andHvvWhyr. This can also be done under 8svthv
9vhyt

WinCC Configuration Manual C79000-G8276-C140-01

2-31

ThyrQwrphvhf

!((

!"! Dvtirhsyvqrhqhtprpvrhyr"

Uhxqrsvvv

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.

Dyrrhvppr

We use a slider object created under XvqPiwrpTyvqrPiwrp to implement changing of the set values. By means of a htprpv, the value of an vrhyht 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 ThPiwrpDPAvryq.

DyrrvtvurXv88wrp
Tr Qprqr)puhtvtrhyrirhshyvqrhtprpv

1 2

Create a tag in Tag Management. In our example, we use the tag called
T"!vfhvhfvf

In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq". When configuring theDPsvryq in the psvthvqvhyt, select the tag named T"!vfhvhfvf. Change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. In the same picture, configure an object under XvqPiwrpTyvqrPiwrp. In our example, we use the object called TyvqrPiwrp!. When configuring the yvqriwrp in the psvthvqvhyt, select the tag named T"!vfhvhfvf. Change the entry in the Vqhr list box from the default value of 2s to Vpuhtr.

2-32

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Irtrrhyr

The following adaptations must be made before this button can be put to general use: Change the tag in thehtprpv. The value range of the TyvqrPiwrp can be changed under QrvrHvpryyhr HhvWhyr andHvvWhyr. This can also be done under 8svthv 9vhyt.

WinCC Configuration Manual C79000-G8276-C140-01

2-33

ThyrQwrphvhf

!((

!"" DvtirhshPvBrhyr!

Uhxqrsvvv

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

Dyrrhvppr

We implement this changing of the set value by means of an option group, which we create under XvqPiwrpPvB. When one of the specified set values is selecting using the , the value in an vrhyht 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 ThPiwrpDPAvryq. The output value of theDPsvryq is linked to the vrhyht. The change in the set value is implemented by means of a 8hpv.

DyrrvtvurXv88wrp
Tr Qprqr)puhtvtrhyrvthvt

1 2

Create a tag in Tag Management. In our example, we use the tag called
T"!vfhvhfvf!

In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq!. When configuring the DPsvryq in the psvthvqvhyt, select the tag named T"!vfhvhfvf!. Change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. In the same picture, configure a XvqPiwrpPvB. In our example, this is PvB . Under QrvrBrrIirs 7r, change the default value 3 to #. Select the index value 1 under QrvrADqr . Enter the appropriate text for the selected index under QrvrAUr. In the same way, configure the values for the remaining index inputs. Under @rQrUvpPDTryrprq7r, create a 8 hpv, which set tag T"!vfhvhfvf! to a specific value depending on the field selected.

2-34

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)puhtvtrhyrvthvt

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 T"!vfhvhfvf! in accordance with the input state. The input state is stored in the predefined tag hyr.

Irtrrhyr

The following adaptation must be made before the PvB can be put to general use: Adapt the tag in the 8hpv under @rQrUvpPD Tryrprq7r.

WinCC Configuration Manual C79000-G8276-C140-01

2-35

ThyrQwrphvhf

!((

!"# Dvtirhspurpxirhyr#

Uhxqrsvvv

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

Dyrrhvppr

We implement this by means of a check box, which we create under Xvq Piwrp 8urpx7, and we use this check box to set individual bits in a tag. A number of objects created under Thqhq Piwrp Qyt are shown or hidden depending on these bits. We display the binary output value of the purpx i by means of a Th Piwrp DP Avryq.

DyrrvtvurXv88wrp
Tr Qprqr)vvtirhshpurpxi

1 2

Create a tag of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tag called T"!vfhvhfvf" Configure a number of objects under ThqhqPiwrpQyt; in our example, we use Qyt through Qyt&. These objects are to be shown or hidden depending on the selection state of the purpxi.

In the same picture, configure a XvqPiwrp8urpx7. In our example, 8urpx7 . Under QrvrBrrIirs7r, change the default value 3 to &. Select the index value 1 under QrvrADqr . Enter the appropriate text for the selected index under QrvrAUr, 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 @rQrUvpPDTryrprq7r create a 8 hpv which assigns the binary state of 8urpx7 to tag S32i_varia_win_03 and controls the "visibility" of the individual ytiwrp.

2-36

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)vvtirhshpurpxi

Configure an I/O field under ThPiwrpDPAvryq; in our example, we use DPAvryq#. Under 8svthv9vhyt, select tag T"!vfhvhfvf". Change the entry in the Vqhr list box from the default value of 2s to Vpuhtr. Under QrvrPD, change the 9hhAh to 7vh and change . the Output Format to 

WinCC Configuration Manual C79000-G8276-C140-01

2-37

ThyrQwrphvhf

!((

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 T"!vfhvhfvf" to the new input state of the purpxi. Control the visibility of the objects in accordance with the input state. The input state is stored in the predefined tag hyr. To read out the respective bit, you have to perform bit masking to the relevant bit.
Ir)

A simple example is shown in the vpf project in the chapter entitled 9hvp in rhyr#. In this case, however, visibility is queried for each individual object by means of the 9hvp9vhyt.

Irtrrhyr

The following adaptation must be made before the 8urpx7 can be put to general use: Adapt the tag and the object names in the 8hpv under @rQrUvp PDTryrprq7r.

2-38

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!# 7vrqvvtvq

You access the solutions that relate to these topics in our hvhf project by the i depicted above. The examples are configured in the pictures hvhf"fpuhrf"qy and hvhf"fpuhrf"hqy.

9rsvvv

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

WinCC Configuration Manual C79000-G8276-C140-01

2-39

ThyrQwrphvhf

!((

!#

9vrpyrvthivvuurhvqshpurpxihqqvrp prpvrhyr%

Uhxqrsvvv

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.

Dyrrhvppr

We implement changing of the bit states by means of a check box, which we create under XvqPiwrp8urpx7. When we one of the fields of the 8urpx7, the bit assigned to it in the vrhyht is changed with the aid of a qvrpprpv. The bit pattern is displayed by means of an I/O field created under ThPiwrpDP Avryq. The output value of the DPsvryq is linked to an vrhyht.

DyrrvtvurXv88wrp
Tr Qprqr)qvrpyrvthivvuurhvqshpurpxihqqvrp prpv

1 2

Create a tag of type Vvtrq %ivhyr in Tag Management. In our example, we use the tag called V %vfhvhfrf$ In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq!. When configuring the DPsvryq in the psvthvqvhyt, select the tag named V %vfhvhfrf$. Change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. Under QrvrPD, change the 9hhAh to 7vh and change the PAh to  .

In the same picture, configure a XvqPiwrp8urpx7In our example, we use the object called 8urpx7 . Under QrvrBrrIir

2-40

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)qvrpyrvthivvuurhvqshpurpxihqqvrp prpv s7r

, change the default value 3 to

Select the index value 1 under QrvrADqr . Enter the appropriate text for the selected index under QrvrAUriv. In the same way, configure the values for the remaining index inputs.
qvrpprpv

Under @rQrUvpTryrprq7r, dynamize this event using a .

In the 9vrp8rpv dialog box, connect the pr Qruviwrp Tryrprq7r to the target WhvhiyrV %vfhvhfrf$. Accept the settings by clicking the PF button.

WinCC Configuration Manual C79000-G8276-C140-01

2-41

ThyrQwrphvhf

!((

Tr

Qprqr)qvrpyrvthivvuurhvqshpurpxihqqvrp prpv

7 8

Configure two XvqPiwrp7. In our example, we use the objects called 7! and 7". These will be used to set and reset all bits. Create a qvrpprpv for under @rHrHr6pv. Connect the pr 8h%$$"$ to the htr PiwrpvQvpr8urpx7 Tryrprq7r. Accept the settings by clicking the PF button. The constant selected corresponds to the binary number 1111111111111111. Create a qvrpprpv linked to the object 7" in the same way, but this time with the pr 8h.

Irtrrhyr

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

2-42

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!#! Tryrpvthivhqpuhtvtvhrrhyr 

Uhxqrsvvv

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

Dyrrhvppr

We implement changing of the bit states by means of a button, which we create under XvqPiwrp7. To enter the bit number and display the bit pattern, we use a ThPiwrpDPAvryq. When we enter the bit number and the i, the selected bit in an vrhyht is changed. The change is implemented by means of a 8hpv.

DyrrvtvurXv88wrp
Tr Qprqr)puhtvthivvhq

1 2

Create two tags of type Vvtrq example, we use the tags called V

%ivhyr

%vfhvhfrf'

in Tag Management. In our and V %vfhvhfrf(

In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq!. When configuring the DPsvryq, connect it to tag V %vfhvhfrf(. Change the entry in the Vqhr list box from the default value of 2s to Vpuhtr. The bit number is entered in this input field.

WinCC Configuration Manual C79000-G8276-C140-01

2-43

ThyrQwrphvhf

!((

Tr

Qprqr)puhtvthivvhq

Configure a second DPsvryq for displaying the bit states. In our example, we use the object called DPAvryq . When configuring the DPsvryq, connect it to tag V %vfhvhfrf'. Change the entry in the Vqhr list box from the default value of 2s to Vpuhtr. Change the field type to P. Under Qrvr PD, change the 9hhAh to 7vh and change the P . Ah to  In the same picture, configure three buttons under XvqPiwrp7. In our example, we use the objects called 7 , 7! and 7". Create a 8hpv for 7 under @rHrQryrs. This 8hpv is to be used to set the bit selected in the DPsvryq in an vrhyht. In the same way, create 8hpv under the other i 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 8ht. Use the vrhyspv BrUhtXq 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 vrhyht.

2-44

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

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 8ht. Use the vrhyspv BrUhtXq 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 vrhyht.

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 8ht. Use the vrhyspv BrUhtXq 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 vrhyht.

WinCC Configuration Manual C79000-G8276-C140-01

2-45

ThyrQwrphvhf

!((

!#" Uururrhyrryhrquvvp

rhyr!

The functionality of this example is similar to that of example rhyr . 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.

rhyr#

The functionality of this example is similar to that of example rhyr!. 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.

rhyr&

The functionality of this example is similar to that of example rhyr%. 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

!((

ThyrQwrphvhf

!$ Dqvrphqqrvtsht

You access the solutions that relate to these topics in our hvhf project by the i depicted above. The examples are configured in the picture named hvhf"fpuhrf"qy.

WinCC Configuration Manual C79000-G8276-C140-01

2-47

ThyrQwrphvhf

!((

!$

Dqvrphqqrvtirhshqvrpprpvrhyr 

Uhxqrsvvv

Various process values are to be displayed in an DPsvryq. The corresponding values are to be selected by means of i.

Dyrrhvppr

We implement selection of the corresponding process values by means of a button, which we create under XvqPiwrp7. We use an I/O field created under ThPiwrpDPAvryq and indirect addressing in WinCC to display the process values. Three more I/O fields created under ThPiwrp DPsvryqalso enable you to enter the process value directly.

DyrrvtvurXv88wrp
Tr Qprqr)vqvrphqqrvtirhshqvrpprpv

Create three tags of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tags called T"!vfhvhfhqf !T"!vfhvhfhqf " and T"!vfhvhfhqf #. These contain the process values to be displayed. Create a tag of type Urht %ivpuhhprr with a length of 20 characters in Tag Management. In our example, we use the tag called U %fhvhfhqf#. This will be used as an address tag. In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq#. When configuring the DPsvryq in the psvthvqvhyt, select the tag named U %fhvhfhqf#. Change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. Under QrvrPDP Whyr, select the box in the DDqvrp column. Select the box.

Configure an object of type ThqhqPiwrpThvpUr. In our example, we

2-48

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)vqvrphqqrvtirhshqvrpprpv

use the object called ThvpUr . This object indicates which process value is currently being displayed. The text in the object is automatically supplied by the i. 5 6 In the same picture, configure three buttons under XvqPiwrp7In our example, we use the objects called 7 , 7! and 7". Configure a qvrpprpv for 7 under @rHrQryrs. Connect the pr 8hT"!vfhvhfhqf ! to the htr Whvhiyr U %fhvhfhqf#. Accept the settings by clicking the PF button.

Create a further qvrpprpv under @rHrHr6pv. Connect the pr QruviwrpUr to the htr PiwrpvQvpr ThvpUr Ur. Accept the settings by clicking the PF button. Configure 7! and 7"in the same way as 7 . In the first qvrp prpv, the tag name in the pr must be changed. The second qvrp prpv can be applied without any change.

Irtrrhyr

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

ThyrQwrphvhf

!((

!$! Hyvyrqvyhvtvqvrphqqrvthqh8hpv rhyr!

Uhxqrsvvv

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.

Dyrrhvppr

We implement selection of the corresponding container by means of an option group, which we create under XvqPiwrpPvB. We use three I/O fields created under ThPiwrpDPAvryq and indirect addressing in WinCC to display the process values. The containers with the corresponding values are displayed in rhyr#.

DyrrvtvurXv88wrp
Tr Qprqr)yvyrqvyhvuvqvrphqqrvt

Create nine tags of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tags called T"!vfhvhfhqf" through T"!vfhvhfhqf . These tags contain the corresponding process values of the container. Create three tags of type Urht %ivpuhhprr in Tag Management. In our example, we use the tags called U %fhvhfhqf , U %fhvhfhqf! and U %fhvhfhqf". They will be used as address tags for theDPsvryq. Configure three I/O fields under ThPiwrpDPAvryq. In our example, we use DPAvryq$, DPAvryq% and DPAvryq&. For object DPAvryq$, change the AvryqUr to P under Qrvr PD. Under the property PWhyr, configure a htprpv to tag U %fhvhfhqf and select the box in the DDqvrp column. Select the box. In the same way, configure the other DPsvryq, but connect each field to a different address tag. Configure an option group under XvqPiwrpPvB. In our example, we use the object called PvB . Select the index 1 under QrvrADqr. Enter the appropriate text for the selected index under QrvrAUr8hvr . In the same way, configure the texts for the remaining index values. Create a 8hpv under @rQrUvpPDTryrprq 7r. 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

!((

ThyrQwrphvhf

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 8ht 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 hyr. Assign the corresponding tag names to the address tags.

Irtrrhyr

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

ThyrQwrphvhf

!((

!$" Dqvrphqqrvtirhs8hpvrhyr"

Uhxqrsvvv

Various process values are to be displayed in an DPsvryq. The corresponding values are to be selected by means of an PvB.

Dyrrhvppr

We implement selection of the corresponding process value by means of an option group, which we create under XvqPiwrpPvB. We use an I/O field created under ThPiwrpDPAvryq and indirect addressing in WinCC to display the process value.

DyrrvtvurXv88wrp
Tr Qprqr)vqvrphqqrvtirhsh8hpv

Create three tags of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tags called T"!vfhvhfhqfT"!vfhvhfhqf and T"!vfhvhfhqf!. These contain the process values to be displayed. Create a tag of type Urht %ivpuhhprr with a length of 20 characters in Tag Management. In our example, we use the tag called U %fhvhfhqf. This will be used as an address tag. In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq'. When configuring the DPsvryq in the psvthvqvhyt, select the tag namedU %fhvhfhqf. Change the entry in the list box from the default value of 2s to Vpuhtr and change the field type entry (Ur) to P. Under QrvrPDP Whyr, select the box in the DDqvrp column. Select the box. In the same picture, configure a XvqPiwrpPvB. In our example, we use the object called PvB!. Select the index 1 under QrvrADqr. Enter the appropriate text for the selected index under QrvrAUrAvyyGrry. In the same way, configure the texts for the remaining index values. Create a 8hpv under @rQrUvpPDTryrprq 7r. This action describes the address tag depending on the field selected.

4 5

2-52

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

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 U %fhvhfhqf in accordance with the input state. The input state is stored in the predefined tag hyr.

Irtrrhyr

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

ThyrQwrphvhf

!((

!$# Uururrhyrryhrquvvp

rhyr#

The functionality of this example is to display the process values used in rhyr!.

2-54

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!% Tvyhvsht

You access the solutions that relate to these topics in our hvhf project by the i depicted above. The examples are configured in the picture named hvhf"fpuhrf$qy.

9rsvvv

The term vyhv 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

ThyrQwrphvhf

!((

!%

Tvyhvthvhtyhpvyyhvirhsh8hpv rhyr 

Uhxqrsvvv

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 i. Another i is to be used to reset the tag value to zero.

Dyrrhvppr

We implement starting of the simulation and initialization by means of two buttons, which we create under XvqPiwrp7. To display the tag value and to input the maximum and minimum values, we will create three I/O fields under ThPiwrpDP Avryq. If simulation is started while the maximum and minimum values set are identical, a message box pops up.

DyrrvtvurXv88wrp
Tr Qprqr)vyhvthvhtyhpvyyhvirhsh8hpv

Create three tags of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tags called T"!vfhvhfvfT"!vfhvhfvf! and
T"!vfhvhfvf"

2 3 4

Create two tags of type 7vhht in Tag Management. In our example, we use the tags called 7DIvfhvhfvf and 7DIvfhvhfvf#. Configure three I/O fields under ThPiwrpDPAvryq. In our example, we use DPAvryq , DPAvryq! and DPAvryq". For object DPAvryq , create a htprpv to tag T"!vfhvhfvf" under QrvrPDPWhyr and set the trigger to Vpuhtr. Change the PAh to (((. In the same way, configure DPAvryq!, but set tag T"!vfhvhfvf! , create a htprpv to tag under QrvrGvvCvtuGvvWhyr. In the same way, configure the tag T"!vfhvhfvf" as the GGvvWhyr for DPAvryq!.
UpurpxuryhvivyvsDPAvryq T"!vfhvhfvf!

For object DPAvryq", create a htprpv to tag T"!vfhvhfvf under QrvrPDPWhyr and set the trigger to Vpuhtr. Change the PAh to ((( and the AvryqUr to P. Configure a picture window at ThPiwrpQvprXvq; in our example we use qvhyti Select QrvrHvpryyhrand modify the properties Hrhiyr and 7qr to `r and the QvprIhr to hvhf$fvqf. 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 XvqPiwrp7; in our example, we use 7!. Create a further qvrpprpv under @rHrQryrs. Connect the pr 8h to the htrWhvhiyr7DIvfhvhfvf#. This i is used for initialization. Configure another XvqPiwrp7. In our example, we use the object

2-56

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)vyhvthvhtyhpvyyhvirhsh8hpv

called 7 . Under @rfHrQryrs, generate a 8hpv which negates the status of the 7DIvfhvhfvf tag. Under QrvrBrr QvvY, create a 8hpv, which executes tag simulation. 10 Create a status display under ThPiwrpTh9vyh to display the status of simulation. In our example, we use the object called Th9vyh . Under 8svthv9vhyt, set tag 7DIvfhvhfvf and set the trigger to Vpuhtr. Add another status. For status , set the picture tyuivrf!f!#7vi, and for status , set the picture tyuivrf f!#7vi.

8hpvshtvyhv

#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

ThyrQwrphvhf

!((

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 7! (init)has been pressed (clicked), set the tag value memory to the minimum value stored, the counter direction to ascending, the value of the vrhyht T"!vfhvhfvf 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 7 .

2-58

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!%! Tvyhvirhshrrhythrhyr!

WinCC provides its own simulation program, which can simulate tags using a number of different methods. This simulation program must be installed using the Trrr program in the folder called ThUy88fTvyh on the WinCC CD.

Uhxqrsvvv

Tags are to be simulated using the WinCC tag simulator.

Dyrrhvppr

We will use a number of tags, which will be displayed in I/O fields created under Th PiwrpDPAvryq and whose contents will be controlled by means of the tag simulator.

WinCC Configuration Manual C79000-G8276-C140-01

2-59

ThyrQwrphvhf

!((

DyrrvtvurXv88wrp
Tr Qprqr)vyhvtirhshrrhyth

1 2 3

Create two vrhyht of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tags called T"!vfhvhfvf$ and T"!vfhvhfvf% Configure two I/O fields under ThPiwrpDPAvryq. In our example, we use DPAvryq# and DPAvryq$. For object DPAvryq#, create a htprpv to tag T"!vfhvhfvf$ under QrvrPDPWhyr and set the trigger to Vpuhtr. Change the PAh to (((((( and the AvryqUr to PAvryq. In the same way, configure DPAvryq$, but set tag T"!vfhvhfvf%. Start the tag simulator by means of the Tvyh button. If the tag simulator has not been installed under the default path, set the correct path by means of the Qhu 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 T"!vfhvhfvf$ under the menu item @qvIr Uht from the Tag Management screen which appears. Select the Dp tab and enter the ThWhyr and @qWhyr. In our example, the values  and ! have been used. Simulation is started by selecting the item hpvr. 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 T"!vfhvhfvf%. In our example, the Tv tab has been selected and 6yvqr set to $, Pssr to $ and Ppvyyhvvr to !$.

Ir)

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

Irtrrhyr

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

!((

ThyrQwrphvhf

!& Dvtrvtht

You access the solutions that relate to these topics in our hvhf project by the i depicted above. The examples are configured in the picture named hvhf"fpuhrf%qy.

Uhxqrsvvv

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.

Dyrrhvppr

To implement this in the project, we use two buttons which we create under Xvq Piwrp7; these buttons are used to start the import/export program hfvrrr and rpryrr. The path to each of these programs can be set by means of two I/O fields created under ThPiwrpDPAvryq.

WinCC Configuration Manual C79000-G8276-C140-01

2-61

ThyrQwrphvhf

!((

DyrrvtvurXv88wrp
Tr Qprqr)vvtrvtht

1 2

Set the correct paths to the programs rpryrr and hfvrrr. Call the hfrvrr program by clicking the D@ i during runtime. The program can also be started directly in Explorer, without runtime being active. Use the
hvhfp i

3 4

to set the path to project hvhf and select the file

there.

Select the selection field @. Then click @rprPF. Exporting of the tags is now performed. The program generates a file with the extension r, which contains the information relating to the tags. It also creates a second file with the extension pr, which contains the information relating to the connections to the programmable controller, and a third file with the extension qr, which contains the information relating to tags of type 9hhTpr. Start @pry and open the hvhfhp file just generated by selecting Avyr Pr. To configure 100 tags of type Vvtrq %ivhyr, proceed as described below. The names to be assigned to these tags are to range from V %vfhvhfvrf through V %vfhvhfvrf((. In the first column of the first empty line, enter the name V %vfhvhfvrf. 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, vrhyht; in the fourth, vr as the group name; in the fifth column, !; and in the sixth column, $ as the code for an Vvtrq %ivhyr. In the remaining Columns, enter the value . Fill in the remaining 99 lines automatically. Open hfvrrr again via the task bar and select the selection field D. Then click @rprPF. After completing import of the tags, exit the program. 100 new tags have now been created in Tag Management.

9 10
Ir)

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

2-62

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!' Vvtprht

You access the solutions that relate to these topics in our hvhf project by the i depicted above. The examples are configured in the picture named hvhf"fpuhrf&qy.

9rsvvv

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

ThyrQwrphvhf

!((

!'

Whyrpyirhshprhtrhyr 

Uhxqrsvvv

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

Dyrrhvppr

To implement this, we use two buttons created under XvqPiwrp7, with which we will turn the valve on and off and simulate a fault condition. We will also use polygons created under ThqhqPiwrpQyt

DyrrvtvurXv88wrp
Tr Qprqr)hyrpyirhshprht

Define a new structure tag in the 8y8rr. Select IrTpr at 9hh 5. UrTprUr using

In the window that appears, 5 IrTpr and select Srhr in the pop-up menu that appears. The name hyr has been selected in our example. Add a new structure element by clicking the Irryrr button. Then 5 this new structure element and select the data type 7DU.

2-64

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

Tr

Qprqr)hyrpyirhshprht

Using Srhr, change the name to hpvhrq and select the selection field vrhyht. Define further structure elements as follows:

In Tag Management, create a tag of type hyr. In our example, we use the tag called TUVvfhvhff. The following ivhht are created in this way.

Configure two buttons under XvqPiwrp7; in our example, we use 7 and 7!. Create a 8hpv for 7 , which turns the valve on and off. Create a 8hpvs 7!, which turns the error bit on and off. Under 7 , configure a 8hpv under QrvrBrrQvv Y, 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 ThqhqPiwrpQyt. These are positioned one on top of the other and shown or hidden depending on the state of the valve.

6 7

Irtrrhyr

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.
8hpv

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

WinCC Configuration Manual C79000-G8276-C140-01

2-65

ThyrQwrphvhf

!((

!( TrvhyprpvT$

You access the solutions that relate to these topics in our hvhf project by the i depicted above. The examples are configured in the picture named hvhf"fpuhrf'qy.

Uhxqrsvvv

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

DyrrvtvurXv88wrp
Tr Qprqr)rvhyprpvT$

In the 8y8rr under UhtHhhtrr, add a new driver. In our example, we use the driver TDH6UD8T$T@SD6G"(%#S.

Click the name of the driver with the 5, select Ir9vr8rpv and give the connection a name on the BrrhyDshv tab; in our example, we use QG88rpv. On the B tab, create a new group; in our example, we use prp. On the Trvhy"(%#S tab, make the settings you want; in our example, the standard values are set. In the tag group, create three new tags of type Vvtrq %ivhyr. The tags must be assigned an address in the PLC, this being set by means of the Tryrp button. The type of format adaptation selected in our example is XqUVvtrqXq. Tags V %fhvhfpf, V %fhvhfpf! and V %fhvhfpf" are used. These tags are also used in the following examples.

3 4

2-66

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrphvhf

!(

Uururrhyrryhrquvvp

rhyr

The functionality of this example corresponds to the example named !#!Tryrpvthiv hqpuhtvtvhrrhyr  in the section called 7vrqvvtvq. The tag in which the bit is set is, however, the external data word V %fhvhfpf.

rhyr!

The functionality of this example corresponds to the example named !# 9vrpyrvt hivvuurhvqshpurpxihqqvrpprpvrhyr% in the section called 7vrqvvtvq. The tag in which the bit is set is, however, the external data word V %fhvhfpf!.

rhyr"

The functionality corresponds to the example named !!& Uururrhyrryhrq uvvp in the section called Dprrvtqrprrvthqwttvt. The tag which is incremented or decremented is, however, the external data word V %fhvhfpf".

WinCC Configuration Manual C79000-G8276-C140-01

2-67

ThyrQwrphvhf

!((

2-68

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

 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

ThyrQwrpvpf

!((

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

Ir)

The password for logging in is the project name, vpfA simpler way to log in is to click Gtv in the title bar, click the input field Qhq and then to confirm the input.

3-2

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"

Tprryhhqpuhtvtvpr

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

ThyrQwrpvpf

!((

"

Ghvturprr

Uhxqrsvvv

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.

Dyrrhvppr

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

!((

ThyrQwrpvpf

Layout 2
Logo Overview Area

Button Area

Plant Representations

Ghvpvyr

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

ThyrQwrpvpf

!((

"! Qvprpuhtr

In runtime, you access the examples that relate to these topics in our vpf project by the button depicted above. The examples are configured in the pictures vpf"fpuhrf qy and vpf"fpuhrf hqy.

3-6

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"!

Prvthvprirhshqvrpprpvhqqvyhvt urvprhrrhyr 

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp , which we click with the to change the picture displayed in the ThPiwrp QvprXvq. We display the picture name in the picture by means of Thqhq PiwrpThvpUr.
7

DyrrvtvurXv88wrp
Tr Qprqr)rvthvprirhshqvrpprpvhqqvyhvt urvprhr

Create a new picture by selectingAvyrIr and then select AvyrThrh to save it under the name vpf$fvqfqy. Change the picture geometry by setting QrvrBrrQvprXvqu to !& and Qrvr BrrQvprCrvtu to !'. In picture vpf$fvqfqy, configure the ThqhqPiwrpThvpUr. In our example, we use the object called ThvpUr . Change QrvrA 7yq to `r. Under QrvrAUr, delete the default text in the Thvp column. This prevents an incorrect text from being output at the moment of picture buildup. Dynamize the object using a 8hpvUuv8hpv returns the current picture name as the return value. The trigger we use for the 8hpv is the Thqhq ppyr u (low system load, no change).

In picture vpf$fvqfqy, configure the information to be displayed. In our example, we use Uhx" from the Global Library. The library is opened by choosing WvrGvih 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.

WinCC Configuration Manual C79000-G8276-C140-01

3-7

ThyrQwrpvpf

!((

Tr

Qprqr)rvthvprirhshqvrpprpvhqqvyhvt urvprhr

Configure two more pictures by saving the picture you have just configured once again, but this time under the name vpf$fvqf qy, and then saving this picture under the name vpf$fvqf!qy (AvyrThr6). This gives us two copies of vpf$fvqfqyNow insert the content you want into the new pictures created. Theres no need to change the ThvpUr object for displaying the picture name. Configure a new picture by selecting AvyrIr. In this picture, configure a picture window under ThPiwrpQvprXvq. In our example, we use QvprXvq . Adjust the size of the vprvq to the size of the pictures just created by means of QrvrBrrXvqXvqu and QrvrBrrXvqCrvtu. In order to display the window with a border during runtime, change QrvrHvpryyhr7qr to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqfqy. This sets the picture to be displayed by the QvprXvq object when the picture is opened.

3-8

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)rvthvprirhshqvrpprpvhqqvyhvt urvprhr

In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7 . Create a further qvrp prpv under @rHrQryrs. button to display a Under Tpr, select 8h and click the now active selection list of all the pictures available. Select the vpf$fvqfqy picture and under Uhtr, select PiwrpvQvpr, QvprXvq as the object and QvprIhr as the property. Accept the settings by clicking the PF button.

WinCC Configuration Manual C79000-G8276-C140-01

3-9

ThyrQwrpvpf

!((

Tr

Qprqr)rvthvprirhshqvrpprpvhqqvyhvt urvprhr

Select the now configured 7 by clicking it with the and duplicate the object by means of @qv9yvphr. Repeat this procedure once more. We now have two more buttons, 7! and 7". Under @rHrQr yrs, modify the qvrpprpv configured. Change the Tpr for 7! to vpf$fvqf qy and the Tpr for 7" to vpf$fvqf!qy.

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 8ht. Check whether yQvprIhr contains only the picture name. You do this using the function pu. This function searches through yQvprIhr. If the picture is displayed in a vprvq, yQvprIhr contains the picture name with the complete path of the picture. In the first case, return yQvprIhr directly as the return value.

3-10

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

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

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The object ThvpUr can be transferred directly to any other vprvq. 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 vprvq must be adapted in the qvrpprpv for 7 . Pictures, picture contents and vprvq that are to be displayed must be laid out as you need them. The height and width of the picture and the vprvq should agree.

WinCC Configuration Manual C79000-G8276-C140-01

3-11

ThyrQwrpvpf

!((

"!! Prvthvprirhsur9hvpXvhqrhyr!

Uhxqrsvvv

The picture in the vprvq is to be changed by clicking a i with the mouse; configuration of the button is to be performed by means of the 9hvpXvhq.

Dyrrhvppr

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


7

, which we click with the 5 to change the picture displayed in the ThPiwrp QvprXvq. We will use the pictures already configured in the previous example.

DyrrvtvurXv88wrp
Tr Qprqr)rvthvprirhsur9hvpXvhq

In a picture, configure a picture window under ThPiwrpQvprXvq. In our example, we use QvprXvq!. Adjust the size of the vprvq to the size of the screen and change QrvrHvpryyhr7qr to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqf qy. If the 9hvpXvhq isnt visible, activate it by selecting WvrUyih In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7#. With the object selected, select ' the Qvpr the QvprApv tab from the 9hvpXvhq and 8uhtrvurXvq option. In the 9hvpXvhq on the page entitled Tryrp vttr, select Svturi and choose Ir to close the page. Fill in the Trv page as follows:

2 3

3-12

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)rvthvprirhsur9hvpXvhq

Click the i to display a list of the pictures available in the project. Close the Avvurq page by clicking Avvu. 4 Configure two more buttons under XvqPiwrp7; in our example, we use 7$ and 7%. Apply the 9hvpXvhq to these buttons, too. In the Trv window, set vpf$fvqf qy as the qrvhvvpr hr for 7$ and vpf$fvqf!qy for 7%.

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

Irtrrhyr

The following adaptations must be made before this button can be put to general use: Adapt the settings in the 9hvpXvhq to suit your own needs.

WinCC Configuration Manual C79000-G8276-C140-01

3-13

ThyrQwrpvpf

!((

"!" Prvthvprirhsvrhyspvrhyr!

Uhxqrsvvv

The picture in the vprvq is to be changed by clicking a i with the mouse; configuration of the i is to be performed by means of a C action.

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp , which we click with the to change the picture displayed in the ThPiwrp QvprXvq. We will use the pictures from the previous example.
7

DyrrvtvurXv88wrp
Tr Qprqr)rvthvprirhsvrhyspv

In a picture, configure a picture window under ThPiwrpQvprXvq. In our example, we use QvprXvq!. Adjust the size of the vprvq to the size of the screen and change QrvrHvpryyhr7qr to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqf qy. In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7#. Under @rHr Qryrs, configure the 8hpv for changing picture. Configure two more i; in our example, we use 7$and 7%, which are equipped with an appropriately modified 8hpv.

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 vrhyspv TrQvprIhr, switch the picture vp$fvqfqy to the object QvprXvq!. vpf"fpuhrf qy is the name of the picture in which the vprvq is located.

Irtrrhyr

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

3-14

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"!# Tvtyrvprpuhtrirhsur9hvpXvhq rhyr"

Uhxqrsvvv

The picture displayed during runtime is to be changed by clicking a i. Configuration is to be implemented using the 9hvpXvhq.

Dyrrhvppr

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


7

, which we click with the

to change the picture displayed during runtime.

DyrrvtvurXv88wrp
Tr Qprqr)vtyrvprpuhtrirhsur9hvpXvhq

In our example, the picture change is from vpffhvprfqy to vpf"fpuhrf hqy. In the sample project, picture vpffhvprfqy is always selected and only picture changes between windows are performed there. By using the 8hpv generated by the 9hvp Xvhq, the entire picture system displayed during runtime is replaced by the one called. Changing back to vpffhvprfqy is like completely restarting the picture project. In the picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7&.

With the object selected, select the QvprApv tab from the 9hvp ' the Tvtyrvprpuhtr option. In the 9hvpXvhq on Xvhq and the page entitled Tryrpvttr, select the Grsri list entry and choose Ir to close the page. Fill in the Trv page as follows:

Click the i to display a list of the pictures available in the project. Close the Avvurq page by clicking Avvu. 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

ThyrQwrpvpf

!((

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 9hvpXvhq generates a 8hpv. This 8hpv uses a hqhqspv called PrQvpr, thus switching the picture vpf"fpuhrf hqy to runtime. The 8hpv generated can itself also be programmed.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: Adapt the settings in the 9hvpXvhq to suit your own needs.

3-16

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"!$ Tvtyrvprpuhtrirhshqvrpprpvrhyr#

You access this example in our project vpf by clicking the twoi.

Uhxqrsvvv

In contrast to the previous examples, clicking a i 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.

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, which we click with the to change the picture. The button is configure using a qvrpprpv.

DyrrvtvurXv88wrp
Tr Qprqr)vtyrvprpuhtrirhshqvrpprpv

1 2

In our example, the picture change is from vpf"fpuhrf vpffhvprfqy.

hqy

to

In the picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7&.

In the 8uhtrQvprHr8yvpx section of the 78svthv dialog, select the picture vpffhvprf by means of the selection window. This automatically leads to the generation of a qvrpprpv under @rHrHr6pv. This connection can also be generated by means of the PiwrpQrvr dialog box.

WinCC Configuration Manual C79000-G8276-C140-01

3-17

ThyrQwrpvpf

!((

Tr

Qprqr)vtyrvprpuhtrirhshqvrpprpv

Irtrrhyr

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 qvrpprpv for 7&.

3-18

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"!% Prvthvprirhsuriwrphrhqhvrhy spvrhyr$

You access this example in our project vpf by clicking the twoi.

Uhxqrsvvv

The picture in a vprvq is to be changed by clicking a button. The i 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.

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp , which we click with the to change the picture displayed in the ThPiwrp . 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.
7 QvprXvq

DyrrvtvurXv88wrp
Tr Qprqr)rvthvprirhsuriwrphrhqhvrhy spv

In a picture, configure a picture window under ThPiwrpQvprXvq. In our example, we use QvprXvq . Adjust the size of the vprvq to match the size of the pictures previously created. In order to display the window with a border during runtime, change QrvrHvpryyhr 7qr to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqfqy. In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7. Under @rHr Qryrs, configure a 8hpv which reads out the name and number of the i and displays the picture you want in accordance with the agreed name conventions. Duplicate 7 twice and change the object names to 7 and 7!.

WinCC Configuration Manual C79000-G8276-C140-01

3-19

ThyrQwrpvpf

!((

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 8ht. 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 pu searches backward through the name for the character and the character string that follows the is picked up and converted into an integer value by the function hv. The vs 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 i. The vrhyspv TrQvprIhris then used to switch the picture to be called to the object QvprXvq .

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The 8hpv for the i 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

!((

ThyrQwrpvpf

"!& Prvthvprirhsuriwrphrhqhht prpvvuqvyhsurvprhrrhyr%

You access this example in our project vpf by clicking the twoi.

Uhxqrsvvv

The picture in a vprvq is to be changed by clicking a i. The i 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.

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp , which we click with the to change the picture displayed in the ThPiwrp QvprXvq. 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 ThqhqPiwrpThvpUr to display the picture name.
7

WinCC Configuration Manual C79000-G8276-C140-01

3-21

ThyrQwrpvpf

!((

DyrrvtvurXv88wrp
Tr Qprqr)rvthvprirhsuriwrphrhqhht prpvvuqvyhsurvprhr

Create a tag of type Urht %ivpuhhprr with a length of 30 characters in Tag Management. In our example, we use the tag called U %fryrpf. This tag contains the name of the picture displayed in the vprvq. Call the properties dialog box of the picture object with the name vpfpuhrf hqy. Under @rHvpryyhrPrQvpr, configure a 8hpv which assigns the picture name vpf$fvqf qy to tag U %fryrpf. 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 ThPiwrpQvprXvq. In our example, we use QvprXvq!. Adjust the size of the vprvq to match the size of the pictures previously created. In order to display the window with a border during runtime, change QrvrHvpryyhr 7qr to `r. Under QrvrHvpryyhrQvprIhr, select vpf$fvqf qy and create a htprpv to tag U %fryrpf. In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7f. Under @rHr Qryrs, configure a 8hpv which reads out the name and number of the i and assigns this name to the vrhyht U %fryrpf. Duplicate 7f twice and change the object names to 7f and 7f!. In the picture, configure a static text (ThPiwrpThvpUrabove Qvpr Xvq!; in our example, we use the object ThvpUr#. Change Qrvr A7yq to `r. Under QrvrAUr, delete the default text in the Thvp column and create a htprpv to tag U %fryrpf. Set updating to take place Vpuhtr. 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

!((

ThyrQwrpvpf

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 vrhyspv TrUht8uh.

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 vrhyht. 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 pu searches backward through the name for the character f and the character string that follows the f is picked up and converted into an integer value by the function hv. The vs 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 i. The vrhyspv TrUht8uhis then used to transfer the picture name to be called to tag U %fryrpf.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The8hpv for the i 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

ThyrQwrpvpf

!((

"" TuqXv88hpprrpv

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf!qy.

3-24

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

""

Tuvtqrvvtvrhqurrrhyr 

Uhxqrsvvv

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

Dyrrhvppr

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

DyrrvtvurXv88wrp
Tr Qprqr)uvtqrvvtvrhqurr

1 2

Configure a picture that is to be used to shut down (exit) runtime; in our example, we use picture vpf$fvqf#qy. In this picture, configure a button under XvqPiwrp7; in our example, we use 7 .With the object selected, select the TrApv tab from the 9hvpXvhq and ' the @vXv88Xvq option. In the 9hvpXvhq on the page entitled Tryrpvttr, select Grsri and Ir. On the Trv page, select @vXvq. Close the Avvurq page by clicking Avvu.

Configure another XvqPiwrp7. In our example, we use the object called 7!. This is used to cancel the procedure. Under @rHr Qryrs, configure a qvrpprpv which hides the picture. Configure another picture that is to be used to shut down the system; in our example, we use picture vpf$fvqf"qy. In this picture, configure a XvqPiwrp7. In our example, we use the object called 7 . With the object selected, select the TrApv tab from the 9hvpXvhq and ' the @vXv88Svr option. In the 9hvpXvhq on the page entitled Tryrpvttr, select Grsri and Ir. Close the Avvurq page by clicking Avvu. Configure another XvqPiwrp7. In our example, we use the object called 7!. This is used to cancel the procedure. Under @rHr Qryrs, configure a qvrpprpv which hides the picture. In another picture, configure two picture windows under ThPiwrp QvprXvq; in our example, we use the objects QvprXvq and QvprXvq!, which, however are tiled. Adjust the size of the vpr vq to match the size of the pictures just configured. If the vprvq are to be displayed with borders, XvqCrvtu and the XvqXvqu of the vprvq 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 QrvrHvpryyhrQvprIhr. Change Qrvr

4 5

WinCC Configuration Manual C79000-G8276-C140-01

3-25

ThyrQwrpvpf

!((

Tr

Qprqr)uvtqrvvtvrhqurr Hvpryyhr

9vyh to I.

In the same picture, configure two button objects under XvqPiwrp 7. In our example, these are 7 and 7!. Configure a qvrp prpv for 7 under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq 9vyh. Accept the settings by clicking the PF button. In the same way, create a qvrp prpv for 7!, but set the htr to PiwrpvQvprQvpr Xvq!9vyh.

Irtrrhyr

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 qvrpprpv of the vprvq which make up the i for calling the picture windows must be changed.

3-26

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

""! 6pprrpvytvirhshhqhqirhyr!

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use two buttons created under XvqPiwrp 7, each of which displays a picture in the ThPiwrpQvprXvq when we click it with the . The necessary settings for assigning user authorization are to be made in the Vr6qvvh editor.

WinCC Configuration Manual C79000-G8276-C140-01

3-27

ThyrQwrpvpf

!((

DyrrvtvurXv88wrp
Tr Qprqr)hpprrpvytvirhshhqhqi

Open the Vr6qvvheditor in the 8y8rr using

85

2 3

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

Under the menu item Uhiyr6qqrhuvhvyrry, define the authorization level 8uhtrvpr under line 9. This authorization level is assigned to the rvpr group. For this, select the group with . In the table

containing the authorization levels, ' the vprpuhtr line in the @hiyr column. An authorization level assigned to a group or a user is identified by a red dot in the @hiyr column.

i and create a new user. With the rvpr user group selected, click the User vyyv having the password vpf was used in the example project. The 8trvthy check box is selected in order to transfer the authorization levels applicable to the group to the user.

6qvvh

editor by choosing Avyr@v from the menu.

Close the Vr

In the 8y8rr, call the Qwrprvr 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.
CFr

In a picture, configure two buttons under XvqPiwrp7. In our example, we use the objects called 7" and 7#. Configure a picture window under ThPiwrpQvprXvq, into which

3-28

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)hpprrpvytvirhshhqhqi

various pictures are inserted by means of qvrpprpv linked to the two i. 7 Under QrvrHvpryyhrVryrry, select the authorization level 8uhtrvpr for the objects 7"and 7# and change Qrvr HvpryyhrPrh8y@hiyr to I. Selectthe tab labeled Hvpryyhr on 7" for an object selected in the 9hvpXvhqand ' Prhiyrvshuvrq. Close the 9hvpXvhq by choosing Avvu. Apply the same procedure to 7#. In tag management, create the system tag 58rVrof type rht %iv puhhprr with a length of 20 characters. This tag is automatically assigned the user name currently logged in. Trigger the 8hpv generated by the 9hvpXvhq at 7"and 7# on change of this tag. This means that the 8hpv 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)); }

Irtrrhyr

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

ThyrQwrpvpf

!((

""" Prh8y@hiyrytvvhrhhrqvhyti rhyr"

Uhxqrsvvv

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

Dyrrhvppr

For implementation we use two buttons created under XvqPiwrp7; with the first button a picture window, created under ThPiwrpQvprXvq, is opened for logging on upon clicking

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

DyrrvtvurXv88wrp
Tr Qprqr)hpprrpvPrh8y@hiyrytvirhs hrhhrqvhyti

In the Vr6qvvh editor, create a new user group and give it a name; in our example, we use the name r. Under line 10, define a new authorization level with the name Svrrq (= Exit runtime). This authorization level is assigned to the r group. Create a user for the group. User yvpu having the password vpf was used in the example project. In a picture, configure two buttons under XvqPiwrp7. In our example, we use the objects called 7$ and 7%. Under object 7$, configure the call for a picture window created under ThPiwrpQvprXvq to be used to exit runtime; in our example, we use QvprXvq$ Under QrvrHvpryyhrVryrry, select the authorization level Svrrq for the object 7$ and change QrvrHvpryyhr Prh8y@hiyr to I. At 7$, apply the 9hvpXvhq labeled Prhiyrvshuvrq. Set the 8 hpv generated to be triggered by the system tag, 58rVr, to be created in Tag Management. Configure a picture window under ThPiwrpQvprXvq. In our example, we use the object called QvprXvq#. Change Qrvr BrrXvqXvqu to "% and QrvrBrrXvq Crvtu to '. In the QrvrHvpryyhrXvqpuhtrHhiyr, 7qr, Uvyr and Artq to `r. Under QrvrHvpryyhr QvprIhr, select the picture with the name vpf$fvqf 'qy. This picture can be taken directly from project vpf.

2 3

3-30

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)hpprrpvPrh8y@hiyrytvirhs hrhhrqvhyti

7 8

Under 7%, configure a qvrpprpv for displaying the vprvq just configured. Under 7%, configure a 8hpv which assigns a text to the button label, which depends on whether the user is logged in or not. This 8hpv is also triggered by the 58rVr 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 58rVr tag contains a name, that is, the comparison of the two texts results in USV@, the text Gtss is returned, otherwise Gt.

Irtrrhyr

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

ThyrQwrpvpf

!((

"# Tuvthvprvq

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf"qy.

3-32

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"#

Tuvthquvqvtsvqrhvprvqrhyr 

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use two buttons created under XvqPiwrp 7, to show and hide the picture displayed in the ThPiwrpQvprXvq when we click one of them with the

DyrrvtvurXv88wrp
Tr Qprqr)uvthquvqvtsvqrhvprvq

Configure a picture that is to be shown and hidden, e.g. a help text or an info box. In our example, we use vpf$fvqf&, a pure info box without any additional control elements. In another picture, configure a ThPiwrpQvprXvq with the same geometric dimensions as the picture created before. In our example, we use QvprXvq  Change QrvrBrrXvqXvqu to !#% and QrvrBrrXvqCrvtu to !(. In order to display the window with a border during runtime, change QrvrHvpryyhr 7qr to `r. To allow the window to be moved round, change Qrvr HvpryyhrHhiyr to `r. Under QrvrHvpryyhrQvpr Ihr, select the picture with the name vpf$fvqf&qy. In the same picture, configure two button objects under XvqPiwrp 7. In our example, these are 7 and 7!. Configure a qvrp prpv for 7 under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq 9vyh. Accept the settings by clicking the PF button.

WinCC Configuration Manual C79000-G8276-C140-01

3-33

ThyrQwrpvpf

!((

Tr

Qprqr)uvthquvqvtsvqrhvprvq

In the same way as for 7 , configure a direct connection for 7! under @rHrQryrs. Enter the value  as the 8h.

Irtrrhyr

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 vprvq must be adapted in the qvrpprpv for 7 and 7!. The picture vpf$fvqf& can be integrated directly into another project, where its title and information text are changed.

3-34

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"#! Tuvtsvqrhquvqvtsvvqrhvprvq rhyr!

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use two buttons created under XvqPiwrp 7, to show and hide the picture displayed in the ThPiwrpQvprXvq when we click one of them with the

DyrrvtvurXv88wrp
Tr Qprqr)uvtsvqrhquvqvtsvvqrurvprvq

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 vpf$fvqf', an info box with an additional button which will be used to hide the picture. In our example, this is 7 . Configure a qvrpprpv for 7 under @rHrQryrs. Connect the source 8h to the target 8rXvq9vyh. Accept the settings by clicking the PF button. In another picture, configure a ThPiwrpQvprXvq with the same geometric dimensions as the picture created before. In our example, we use QvprXvq!. Change QrvrBrrXvqXvqu to !#% and QrvrBrrXvqCrvtu to !(. In order to display the window with a border during runtime, change QrvrHvpryyhr 7qr to `r. To allow the window to be moved round, change Qrvr HvpryyhrHhiyr to `r. Under QrvrHvpryyhrQvpr Ihr, select the picture with the name vpf$fvqf'qy. In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7". Configure a qvrpprpv for 7" under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq!9vyh. Accept the settings by clicking the PF button.

Irtrrhyr

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 vprvq must be adapted in the qvrpprpv for 7". The picture vpf$fvqf' 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 qvrp prpv under 7 .

WinCC Configuration Manual C79000-G8276-C140-01

3-35

ThyrQwrpvpf

!((

"#" Uvrpyyrquvqvtshvprvqrhyr"

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, to show and hide the picture displayed in the ThPiwrpQvprXvq when we click it with the

DyrrvtvurXv88wrp
Tr Qprqr)vrpyyrquvqvtshvprvq

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 vpf$fvqf(, a pure info box without any additional control elements. To implement time-controlled hiding of the object called BhuvpPiwrp at QrvrBrrQvvY, configure a 8hpv. This 8hpv can be positioned anywhere, since only a vttr is required. Set rpq as the trigger.

In another picture, configure a ThPiwrpQvprXvq with the same geometric dimensions as the picture created before. In our example, we use QvprXvq" Change QrvrBrrXvqXvqu to !#% and QrvrBrrXvqCrvtu to !(. In order to display the window with a border during runtime, change QrvrHvpryyhr 7qr to `r. To allow the window to be moved round, change Qrvr HvpryyhrHhiyr to `r. Under QrvrHvpryyhrQvpr Ihr, select the picture with the name vpf$fvqf(qy. In our example, this is 7#. Under @rHrQryrs, configure a 8hpv for 7#, which shows and hides the vprvq.

3-36

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

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 8ht. This tag retains its value during the time the picture is open. Incrementing of the static 8ht 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 vprvq is hidden. The return value is the X position of BhuvpPiwrp , since the 8hpv 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 vrhyspv TrWvviyr assigns the inverse of the current state of visibility to the state of visibility of QvprXvq". The current state is queried by the vrhy spv BrWvviyr.

Irtrrhyr

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 vprvq must be adapted in the 8hpv for 7#. The picture vpf$fvqf( 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 8hpv under BhuvpPiwrp either by changing the trigger or by changing the condition in the vs statement itself.

WinCC Configuration Manual C79000-G8276-C140-01

3-37

ThyrQwrpvpf

!((

"## Tuvthvprvquvyruyqvtqurvtur irhyr#

Uhxqrsvvv

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

85

is released.

85

is pressed and held down on a i, and

Dyrrhvppr

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


7, to show the picture in the ThPiwrpQvprXvq while the pressed and held down on this button.

R is being

DyrrvtvurXv88wrp
Tr Qprqr)uvthvprvquvyruyqvtqurvtur i

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 vpf$fvqf&, a pure info box without any additional control elements. In another picture, configure a ThPiwrpQvprXvq with the same geometric dimensions as the picture created before. In our example, we use QvprXvq  Change QrvrBrrXvqXvqu to !#% and QrvrBrrXvqCrvtu to !(. In order to display the window with a border during runtime, change QrvrHvpryyhr 7qr to `r. To allow the window to be moved round, change Qrvr HvpryyhrHhiyr to `r. Under QrvrHvpryyhrQvpr Ihr, select the picture with the name vpf$fvqf&qy. In the same picture, configure a button under XvqPiwrp7; in our example, this is 7$. Configure a qvrpprpvs 7$ under @r HrQrvtu. Connect the pr 8h to the htr Piwrp vQvprQvprXvq#9vyh. Accept the settings by clicking the PF button. In the same way, configure a qvrpprpv under @rHr Sryrhrvtu. Enter the value  as the 8h.

Irtrrhyr

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 vprvq must be adapted in the qvrpprpv for 7$. The picture vpf$fvqf& can be integrated directly into another project, where its title and information text are changed.

3-38

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"#$ 8svtvtvsvpvirvuurvhqrhyr$

You access this example by the i depicted above. The example is configured in the picture named vpf"fpuhrf"hqy.

Uhxqrsvvv

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.

Dyrrhvppr

To implement this control action, we use a slider object created under XvqPiwrp TyvqrPiwrp to input the tag value and an I/O field created under ThPiwrpDP Avryq to display the tag value.

DyrrvtvurXv88wrp
Tr Qprqr)psvtvtvsvpvirvuurvhq

1 2

If the 9hvpXvhq isnt visible, activate it by selecting WvrUyih In a picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq . With the object selected, select the QvprApv tab from the 9hvpXvhq and ' the 9vyh Dpv7 option. In the 9hvpXvhq on the page entitled Tryrp Ir. Fill in the Trv page as vttr, select Grsri and follows:

WinCC Configuration Manual C79000-G8276-C140-01

3-39

ThyrQwrpvpf

!((

Tr

Qprqr)psvtvtvsvpvirvuurvhq

Close the Avvurq page by clicking Avvu. 3 Use the 9hvpXvhq on DPAvryq once again. On the page entitled Tryrp vttr, select Svturi. On the page entitled Trv, select the @rtrp7 option and enter the text to be displayed. Create a tag of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tag called T"!vfvpfirf. In the same picture, configure an object under XvqPiwrpTyvqrPiwrp. in our example, this is TyvqrPiwrp . Create a qvrpprpv for Tyvqr Piwrp under @rQrUvpHvpryyhrQpr9vr 8rpv. Connect the pr QrTyvqrPiwrp Qpr9vr 8rpv to the htr WhvhiyrT"!vfvpfirf. Accept the settings by clicking the PF button. For object DPAvryq , create a tag connection to tag T"!vfvpfirf under QrvrPDPWhyr and set the trigger to Vpuhtr.

4 5

3-40

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)psvtvtvsvpvirvuurvhq

For object DPAvryq , create a 8hpv under @rQrUvp PDPWhyr, which displays an info box if tag T"!vfvpfirf exceeds a value of 100 and an emergency box if the tag exceeds a value of 150. The 8hpv generated by the 9hvpXvhq can be copied at @rHrQryrsand Qrvtu and inserted into this 8 hpv. Delete the 8hpv under @rHrQryrsand Qrvtu.

WinCC Configuration Manual C79000-G8276-C140-01

3-41

ThyrQwrpvpf

!((

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 vrhyspv BrUht9Xq. If 100 is exceeded, show the info (instruction) box with the 8hpv generated by the 9hvpXvhq. If 100 is exceeded, the info box is initially shown again; if 100 is fallen below, the static 8ht i has been reset to zero. If 150 is exceeded, show the emergency box with the8hpv generated by the 9hvp Xvhq. If 150 is exceeded, the emergency box is initially shown again; if 150 is fallen below, the static 8ht j has been reset to zero.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The tag name in the 8hpv under DPAvryq 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

!((

ThyrQwrpvpf

"#% Tuvthqvhytisrrvtrrhyr%

You access this example by the i depicted above. The example is configured in the picture named vpf"fpuhrf"hqy.

Uhxqrsvvv

When ai 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.

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7 to display the dialog box and a static text created under ThqhqPiwrpThvp Ur to display the text. An I/O field created under ThPiwrpDPAvryq is used to enter the text in the dialog box, and two buttons created under XvqPiwrp7 are used apply or cancel the input.

DyrrvtvurXv88wrp
Tr Qprqr)uvthqvhytisrrvtr

1 2 3

Create two tags of type Urht %ivpuhhprr in Tag Management. In our example, we use U %vfvpfvf and U %vfvpfvf . Configure a picture in which text input is to be carried out. in our example, we use picture vpf$fvqf &qy. In this picture, configure an object by selecting ThPiwrpDPAvryq. Under QrvrPDPWhyr, configure a htprpv to tag U %vfvpfvf and set the trigger to Vpuhtr. Change Qrvr PD9hhAh to Tvt and QrvrPD6y @v to `r. 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 XvqPiwrp7. In our example, we use the object called 7 . This is used to accept (apply) the text entered. Under @rHrQryrs, configure a 8hpv which transfer the contents of tag U %vfvpfvf to the tag which contains the text to be displayed, i.e. tagU %vfvpfvf. Under @rHr Hr6pv, configure a qvrpprpv which hides the picture. Configure another button under XvqPiwrp7; in our example, we use 7!. This is used to cancel the input; the text previously entered is retained. Configure a 8hpv under @rHrQryrs. This transfers the contents of tag U %vfvpfvf (which contains the previous text) to tagU %vfvpfvf . Under @rHrHr6pv, configure a qvrpprpv which hides the picture. In a second picture, configure a picture window under ThPiwrpQvpr Xvq. In our example, we use QvprXvq . Adjust the size of the vpr vq to match the size of the picture just configured. If the picture window is

WinCC Configuration Manual C79000-G8276-C140-01

3-43

ThyrQwrpvpf

!((

Tr

Qprqr)uvthqvhytisrrvtr

to be displayed with borders, the XvqCrvtu and the XvqXvqu of the vprvq must be set 10 pixels greater than those of the picture. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqf &qy. 7 In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7 . Create a further qvrp prpv under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq 9vyh. Accept the settings by clicking the PF button. In the same picture, configure an object of type ThqhqPiwrpThvpUr. In our example, this is ThvpUr . Under QrvrAUr, configure a htprpv to tag U %vfvpfvf and set the trigger to Vpuhtr.

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 U

%vfvpfvf

to tag U

%vfvpfvf

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 U

%vfvpfvf

to tag U

%vfvpfvf

Irtrrhyr

The following adaptations must be made before this button can be put to general use: Picture vpf$fvqf &qy can be used directly for entering text. The 8hpv under the i, however, must be adapted to your own tag names.

3-44

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"$ a

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf#qy.

WinCC Configuration Manual C79000-G8276-C140-01

3-45

ThyrQwrpvpf

!((

"$

8uhtvtvprtrrirrrvrrhyr 

Uhxqrsvvv

A vprvqis to be shown and hidden again by means of two i for clicking. When opened, the picture is to be shown small. The size of the picture is to be adjustable by means of another i.

Dyrrhvppr

To implement this control action, we use two buttons created under XvqPiwrp 7, to show and hide the picture displayed in the ThPiwrpQvpr . Two further buttons created under Xvq when we click one of them with the XvqPiwrp7 are used to enlarge and reduce the size of the picture.

DyrrvtvurXv88wrp
Tr Qprqr)puhtvtvprtrrirrrvr

Configure a picture that is to be shown and hidden. In our example, we use the picture with the name vpf"fpuhrf (the start picture of picture project vpf. In another picture, configure a picture window under ThPiwrpQvpr Xvq; in our example, we use QvprXvq . Change Qrvr BrrXvqXvqu to &! and QrvrBrrXvq Crvtu to #. Change QrvrHvpryyhr7qr to `r and QrvrHvpryyhr6qhQvpr to `r. In this way, the picture, which has a geometry of 859*698, is adapted to the size of the picture window. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf"fpuhrf. Change QrvrHvpryyhr9vyh to I. In the same picture, configure two more button objects under XvqPiwrp 7. In our example, these are 7 and 7!. Configure a qvrp prpv for 7 under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq 9vyh. Accept the settings by clicking the PF button. Configure two more buttons under XvqPiwrp7. In our example, these are 7" and 7#. Under 7", select @rHrQr yrs and configure a 8hpv which enlarges the vprvq, then hides 7" and shows 7#. Under 7#, likewise select @rHr Qryrs and configure a 8hpv which reduces the vprvq, then hides 7# and shows 7". The QrvrHvpryyhr9vyh settings of both i are set to I. Create a qvrpprpv for 7 under @rHrHr6pv. Connect the pr 8h to the htr PiwrpvQvpr7" 9vyh. Accept the settings by clicking the PF button. Under 7!, select @r HrQryrs and configure a 8hpv which hides 7" and 7#, reduces the size of QvprXvq and then hides the vprvq.

3-46

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)puhtvtvprtrrirrrvr

Position 7" and 7# 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 QvprXvq using thevrhyspv TrCrvtu and TrXvqu. Hide the ryhtr button (7"). Show the rqpr button (7#).

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 QvprXvq using thevrhyspv TrCrvtu and TrXvqu. Show the ryhtr button (7"). Hide the rqpr button (7#).

WinCC Configuration Manual C79000-G8276-C140-01

3-47

ThyrQwrpvpf

!((

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 ryhtr button (7") and the rqpr button (7#). Change height and width of QvprXvq using thevrhyspv TrCrvtu and TrXvqu. Hide QvprXvq .

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The object names in the qvrpprpv under 7 must be adapted. The object names and the picture dimensions to be set must be adapted in the 8hpv for 7!, 7" and 7#.

3-48

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"$! 8uhtvturvprtrrryryu rhyr!

Uhxqrsvvv

A vprvq is to be shown and hidden again by means of two i for clicking. In addition, the size of the picture is to be made steplessly adjustable by means of a yvqr iwrp.

Dyrrhvppr

To implement this control action, we use two buttons created under XvqPiwrp 7, to show and hide the picture displayed in the ThPiwrpQvpr
Xvq Piwrp

when we click one of them with the , and a slider object created under Xvq TyvqrPiwrp, with which we change the size of the picture.

DyrrvtvurXv88wrp
Tr Qprqr)puhtvturvprtrrryryu

1 2

Configure a picture that is to be shown and hidden. In our example, we use the picture named vpf$fvqf qy, whose width:height ratio is 2:1. In another picture, configure a picture window under ThPiwrpQvpr Xvq; in our example, we use QvprXvq!. Change Qrvr BrrXvqXvqu to % and QrvrBrrXvq Crvtu to ' (width:height ratio likewise 2:1). In order to display the window with a border during runtime, change QrvrHvpryyhr7qr to `r and QrvrHvpryyhr6qhQvpr to `r. In this way, the picture is adapted to the size of the vprvq. Under Qrvr HvpryyhrQvprIhr, select the picture with the name vpf$fvqf qy. Change QrvrHvpryyhr9vyh to I. In the same picture, configure two more button objects under XvqPiwrp 7. In our example, these are 7$ and 7%. Configure a qvrp prpv for 7$ under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq!9vyh. Accept the settings by clicking the PF button. In the same way, configure a qvrpprpv for 7% under @r HrQryrs. Enter the value  as the 8h. Create a tag of type Vvtrq %ivhyr in Tag Management. In our example, we use the tag called V %vfvpff. Configure a slider object under XvqPiwrpTyvqrPiwrp; in our example, this is TyvqrPiwrp . Change QrvrHvpryyhr HhvWhyr to ". Change QrvrHvpryyhrQpr 9vr8rpv to '. Create a qvrpprpv under @rQr UvpHvpryyhrQpr9vr8rpv. Connect the pr QruviwrpQpr9vr8rpv to the htrWhvhiyr V %vfvpff. Accept the settings by clicking the PF button.

4 5 6

WinCC Configuration Manual C79000-G8276-C140-01

3-49

ThyrQwrpvpf

!((

Tr

Qprqr)puhtvturvprtrrryryu

Create a qhvpqvhyt for QvprXvq! under QrvrBrr


XvqCrvtu

. Click

Uht

and select V

%vfvpff

. Click the

button and confirm tag V %vfvpff as the trigger name in the dialog box. Select Vpuhtr as the standard cycle and confirm by clicking PF. In the 9hhUr field, select 9vrp and close the 9hvp9vhyt by clicking 6y.
8uhtrvttr

Create a dynamic dialog for QvprXvq! under QrvrBrr XvqXvqu. The settings can be made as described above, but the @rvAyh 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 vpf"fpuhrf#, configure a 8hpvunder @r HvpryyhrPrQvpr, which sets tag V %vfvpff to ' when the picture is opened. Without this initialization, the value of the tag would remain 0 until the object TyvqrPiwrp is operated for the first time. If the 7$ object were operated, QvprXvq! 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 V

%vfvpff

to '.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The tag name in the qvrpprpv under TyvqrPiwrp must be adapted. The tag names in the qhvpqvhyt under QvprXvq! must be adapted. The multiplier must be adapted to the width:height ratio used.

3-50

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"$" 8svtvthqwhiyrvprtrrirhsurrvr qvhytrhyr"

Uhxqrsvvv

A vprvq 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 i.

Dyrrhvppr

To implement this control action, we use two buttons created under XvqPiwrp 7, to show and hide the picture displayed in the ThPiwrpQvprXvq when we click one of them with the the properties dialog box.

. The necessary picture properties are configured in

DyrrvtvurXv88wrp
Tr Qprqr)psvtvthqwhiyrvprtrrirhsur rvrqvhyt

Configure a picture that is to be shown and hidden. In our example, we use the picture with the name vpf"fpuhrf (the start picture of picture project vpf. In another picture, configure a picture window under ThPiwrpQvpr Xvq; in our example, we use QvprXvq". Change Qrvr BrrXvqXvqu to #& and QrvrBrrXvq Crvtu to #. Under QrvrHvpryyhr, change the attributes Tvrhiyr, Hhiyr, 7qr, Uvyr, 8h7rHhvvrq, 6qhQvpr and 8h7r 8yrq to `r. Under QrvrHvpryyhrQvprIhr, select vpf"fpuhrf. Change QrvrHvpryyhr9vyh to I. In the same picture, configure two buttons under XvqPiwrp7. In our example, these are 7& and 7'. Configure a qvrpprpv for 7& under @rHrQryrs. Connect the pr 8h to the htr PiwrpvQvprQvprXvq"9vyh. Accept the settings by clicking the PF button. In the same way, configure a qvrpprpv for 7' under @r HrQryrs. However, enter the value  as the 8h.

Irtrrhyr

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 vprvq must be adapted in the qvrpprpv for 7& and 7'. The picture shown in QvprXvq" must be adapted.

WinCC Configuration Manual C79000-G8276-C140-01

3-51

ThyrQwrpvpf

!((

"% Prhhry

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf$qy.

3-52

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"%

7vhvpuvtrhvrpyrhyr 

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, to show the picture displayed in the ThPiwrpQvprXvq when we click the button with the , and two more i which are used in the operator panel for performing the switching operation and for closing the panel.

DyrrvtvurXv88wrp
Tr Qprqr)ivhvpuvtrhvrpy

1 2

Create a tag of type 7vhht in Tag Management. in our example, we use 7DIvfvpfvf. This tag is to contain the current state of the value. Configure a picture with two buttons created under XvqPiwrp7. In our example, we use picture vpf$fvqf with 7 and 7!. Configure a qvrpprpv for 7 under @rHrQryrs. Connect the pr 8h to the htr 8rXvq9vyh Accept the settings by clicking the PF button.

3 4

Under the second i, in our example 7!, configure a 8hpv which reverses the status of the binary tag 7DIvfvpfvf. In another picture, configure a picture window under ThPiwrpQvpr Xvq; in our example, we use QvprXvq . Change Qrvr BrrXvqXvqu to !#% and QrvrBrrXvq

WinCC Configuration Manual C79000-G8276-C140-01

3-53

ThyrQwrpvpf

!((

Tr

Qprqr)ivhvpuvtrhvrpy Crvtu to !(. In order to display the window with a border and make it movable during runtime, change QrvrHvpryyhr7qr to `r and QrvrHvpryyhrHhiyr to `r. Under Qrvr HvpryyhrQvprIhr, select the picture with the name vpf"fvqf . Change QrvrHvpryyhrHvpryyhr to I.

In the picture, configure a button under XvqPiwrp7. In our example, this is 7 in picture vpf"fpuhrf$. Configure a qvrp prpv for 7 under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq 9vyh. Accept the settings by clicking the PF 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 7DIvfvpfvf usingvrhyspv BrUht7v, negate it and reset it using vrhyspv TrUht7v.

Irtrrhyr

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 qvrp prpv for 7 . The tag name in the 8hpv under 7! in the operator panel must be adapted.

3-54

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"%! 7vhTSvpuvtrhvrpyrhyr!

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, to show the picture displayed in the ThPiwrpQvprXvq when we click the button with the , and three more i which are used in the operator panel for performing the switching operation and for closing the panel.

DyrrvtvurXv88wrp
Tr Qprqr)ivhTSvpuvtrhvrpy

1 2

Create a tag of type 7vhht in Tag Management. in our example, we use 7DIvfvpfvf . This tag is to contain the current state of the value. Configure a picture with three buttons created under XvqPiwrp7. In our example, we use picture vpf$fvqf ! with 7 , 7! and 7". Configure a qvrpprpv for 7 under @rHr Qryrs. Connect the pr 8h to the htr 8rXvq
9vyh

Accept the settings by clicking the PF button. 3 Configure a qvrpprpv for 7! under @rHrQryrs. Connect the pr 8h to the htr Whvhiyr7DIvfvpfvf . Accept the settings by clicking the PF button. In the same way, configure a qvrpprpv for 7" under @r HrQryrs. Enter the value  as the 8h. In another picture, configure a picture window under ThPiwrpQvpr Xvq; in our example, we use QvprXvq!. Change Qrvr BrrXvqXvqu to !#% and QrvrBrrXvq Crvtu to !(. In order to display the window with a border and make it movable during runtime, change QrvrHvpryyhr7qr to `r and QrvrHvpryyhrHhiyr to `r. Under Qrvr HvpryyhrQvprIhr, select the picture with the name vpf"fvqf !. In a picture, configure a XvqPiwrp7. In our example, this is 7! in picture vpf"fpuhrf$. Configure a qvrpprpv for 7! under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq!9vyh. Accept the settings by clicking the PF button.

4 5

WinCC Configuration Manual C79000-G8276-C140-01

3-55

ThyrQwrpvpf

!((

Irtrrhyr

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 qvrp prpv for 7!. The tag names in the qvrpprpv under 7 and 7! in the operator panel must be adapted.

3-56

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"%" 7vhvpuvtrhvvuhpxyrqtrrrhyr"

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, to show the picture displayed in the ThPiwrpQvprXvq when we click the button with the , and two more iwhich are used in the operator panel for performing the switching operation and for closing the panel.

DyrrvtvurXv88wrp
Tr Qprqr)ivhvpuvtrhvvuhpxyrqtrr

Create two tags of type 7vhht in Tag Management. In our example, we use 7DIvfvpfvf! and 7DIvfvpfvf". 7DIvfvpfvf! is to contain the current state of the valve, 7DIvfvpfvf"is to act as a buffer memory for the switching operation before acknowledgement. Configure a picture with two buttons created under XvqPiwrp7. In our example, we use picture vpf$fvqf " with 7 and 7!. Create a qvrpprpvs7 under @rHr6pv. Connect the pr 8h to the htr 8rXvq9vyh. Accept the settings by clicking the PF button. Under @rHrQryrs, configure another qvrpprpv. Connect the pr7DIvfvpfvf! to the htr 7DIvfvpfvf". Accept the settings by clicking the PF button. Under the second button, in our example 7!, configure a 8hpv which reverses the status of the binary tag 7DIvfvpfvf!. In another picture, configure a picture window under ThPiwrpQvpr Xvq; in our example, we use QvprXvq". Change Qrvr BrrXvqXvqu to !#% and QrvrBrrXvq Crvtu to !(. In order to display the window with a border and make it movable during runtime, change QrvrHvpryyhr7qr to `r and QrvrHvpryyhrHhiyr to `r. Under Qrvr HvpryyhrQvprIhr, select the picture with the name vpf"fvqf ". In a picture, configure a button object under XvqPiwrp7. In our example, this is 7" in picture vpf"fpuhrf$. Configure a qvrpprpv for 7" under @rHrQryrs. Connect the pr 8h to the htr PiwrpvQvprQvpr Xvq"9vyh. Accept the settings by clicking the PF button.

3 4

WinCC Configuration Manual C79000-G8276-C140-01

3-57

ThyrQwrpvpf

!((

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 7DIvfvpfvf! using vrhyspv BrUht7v, negate it and reset it using vrhyspv TrUht7v.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The object name of the vprvq to be opened must be adapted in the qvrp prpv for 7". The tag names in the qvrpprpv under 7 in the operator panel must be adapted. The tag name in the 8hpv under 7! in the operator panel must be adapted.

3-58

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"%# 6hvpvpurpxrhyr#

You access this example in our vpf project by the button depicted above. The example is configured in the picture named vpf"fpuhrf$hqy.
Uhxqrsvvv

An operator panel is to be shown (displayed) by clicking a i. 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.
Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, to show the picture displayed in the ThPiwrpQvprXvq when we click it with the . Furthermore, we use three buttons created under XvqPiwrp , to turn the valve on and off and to closed the operator panel. An I/O field created under ThPiwrpDPAvryq is used to enter the fill level.
7

DyrrvtvurXv88wrp
Tr Qprqr)hhvpvpurpx

1 2

In Tag Management, create a tag of type 7vhht, which contains the current state of the valve. in our example, we use 7DIvfvpfvf%. Create two tags of type Vvtrq %ivhyr. In our example, these are V %vfvpfvf# and V %vfvpfvf$. 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 XvqPiwrp7 and one I/O field created under ThPiwrpDPAvryq. In our example, we use 7 , 7! and 7" and the object DPAvryq  The picture we use is vpf$fvqf #qy. For object DPAvryq , create a htprpv to tag V %vfvpfvf# under QrvrPDPWhyr and set the trigger to Vpuhtr. We assume the container has a maximum fill level of 40 liters. TheDPsvryq must therefore only accept inputs between 0 and 40. To set these limits, set Qrvr GvvGGvvWhyr and QrvrGvvCvtuGvvWhyr #. For object 7 , configure a qvrpprpv under @rHr Qryrs, which hides the picture. For object 7!, configure a qvrpprpv under @rHr Qryrs, which assigns the value to tag 7DIvfvpfvf%. Under 7", configure a qvrpprpv which assigns the value  to the tag. In a second picture, configure a picture window under ThPiwrpQvpr Xvq. In our example, we use QvprXvq . Adjust the size of the vpr vq to match the size of the picture just configured. If the vprvq is to be displayed with borders, the XvqCrvtu and the XvqXvqu of the vprvq 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

ThyrQwrpvpf

!((

Tr

Qprqr)hhvpvpurpx

10

11

HvpryyhrQvprIhr, select the picture with the name . In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7 . Create a further qvrp prpv under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq 9vyh. Accept the settings by clicking the PF button. Select the Uhx! object from the library and use it display the fill level. Create a 8hpv under QrvrBrrXvqu to simulate the filling process. Under QrvrUht6vtrAvyyGrry, configure a htprpv to tag V %vfvpfvf$. As a second method of displaying the fill level, configure an I/O field under ThPiwrpDPAvryq; in our example, this is DPAvryq 
Qrvr vpf$fvqf #qy

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

The following adaptations must be made before this button can be put to general use: The tag names and the limits of the DPsvryq in picture vpf$fvqf # must be adapted to suit your own needs.

3-60

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"%$ @uhprqhhvpvpurpxrhyr$

You access this example in our vpf project by the i depicted above. The example is configured in the picture named vpf"fpuhrf$hqy.

Uhxqrsvvv

An operator panel is to be shown (displayed) by clicking a i. 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.

Dyrrhvppr

To implement this control action, we use a button created under XvqPiwrp 7, to show the picture displayed in the ThPiwrpQvprXvq 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 ThPiwrpDPAvryq. In addition, we use two buttons created under XvqPiwrp7, one to apply the settings in theDP svryq, the other to cancel the inputs and close the operator panel.

DyrrvtvurXv88wrp
Tr Qprqr)ruhprqhhvpvpurpx

In Tag Management, create two tags of type 7vhht, which contain the current states of the valves via which the container is filled. In our example, we use 7DIvfvpfvf( and 7DIvfvpfvf  Create four tags of type Vvtrq %ivhyr; in our example, these are V %vfvpfvf&, V %vfvpfvf', V %vfvpfvf ", and V %vfvpfvf #. The first two contain the set values for the container fill levels, the last two the actual values. Create two tags of type Vvtrq %ivhyr. In our example, these are V %vfvpfvf and V %vfvpfvf !. These contain the values entered in the DPsvryq. Configure a picture with two buttons created under XvqPiwrp7 and three I/O fields created under ThPiwrpDPAvryq. In our example, we use 7 and 7! and DPAvryq , DPAvryq!, and DPAvryq". The picture we use is vpf$fvqf $qy. For DPAvryq , create a htprpv to tag V %vfvpfvf under QrvrPDPWhyr and set the trigger to Vpuhtr. For DPAvryq!, create a htprpv to tag V %vfvpfvf !. For DPAvryq", configure a dynamic dialog under QrvrPD PWhyr. Enter the settings shown in the figure below. Set the trigger to Upon change.

WinCC Configuration Manual C79000-G8276-C140-01

3-61

ThyrQwrpvpf

!((

Tr

Qprqr)ruhprqhhvpvpurpx

7 8

For 7!, configure a qvrpprpv under @rHrQryrs, which hides the picture. For 7 , configure a 8hpv under @rHrQryrs, which assigns the contents of input tags V %vfvpfvf and V %vfvpfvf to set value tags V %vfvpfvf& and V %vfvpfvf'. Under @r HrHr6pv, configure a qvrpprpv which closes the picture. In the same picture, configure two objects of type ThqhqPiwrpThvp Ur. In our example, we use ThvpUr$ and ThvpUr%. These are used to display whether the maximum fill level is exceeded or not. Under ThvpUr$, which contains the error message, change QrvrHvpryyhr 9vyh to I.
PD !

10

For DPAvryq", create a 8hpv under @rQrUvp PWhyr, which makes 7 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 ThPiwrpQvpr Xvq. In our example, we use QvprXvq!. Adjust the size of the vpr vq to match the size of the picture just configured. Under Qrvr HvpryyhrQvprIhr, select the picture with the name vpf$fvqf $qy. In the same picture, configure a button object under XvqPiwrp7. In our example, we use the object called 7". Create a further qvrp prpv under @rHrQryrs. Connect the pr 8h to thehtr PiwrpvQvprQvprXvq!9vyh. Accept the settings by clicking the PF button.
8hpv

12

13

Select the Uhx! object from the library and use it display the fill level. Create a under QrvrBrrXvqu and under Qrvr

3-62

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)ruhprqhhvpvpurpx

14

Crvtu to simulate the filling process. Under QrvrUht AvyyGrry, create a qhvpqvhyt which returns the sum of the two actual value tags V %vfvpfvf " and V %vfvpfvf # as the return value. As a second method of displaying the fill level, configure an I/O field under ThPiwrpDPAvryq; in our example, this is DPAvryq!
Brr 6vtr

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

ThyrQwrpvpf

!((

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 theDPsvryq. If the sum of the value entered exceeds the maximum fill level of the container, 7 is made inoperable and ThvpUr$, which contains the error message, is displayed.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The tag names and the limits of theDPsvryq in picture vpf$fvqf $ must be adapted to suit your own needs.

3-64

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"%% Hyvyrrhvrhyr%

You access this example in our vpf project by the i depicted above. The example is configured in the picture named vpf"fpuhrf$iqy.

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use buttons created under XvqPiwrp7, to show the picture displayed in the ThPiwrpQvprXvq when we click them with the . The valve is controlled by means of two buttons created under Xvq 7; another i 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 ThqhqPiwrp ThvpUr. The picture is anchored by means of a status display created under Th PiwrpTh9vyh.
Piwrp

DyrrvtvurXv88wrp
Tr Qprqr)yvyrrhv

In Tag Management, create tags of type 7vhht, 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 7DIvfvpfyvf , 7DIvfvpfyvf!, 7DIvfvpfyvf", and 7DIvfvpfvf#. Create a tag of type Urht %ivpuhhprr with a length of 20 characters. In our example, this is U %fvpfvf $. This will be used as an address tag. Create a tag of type 7vhht. In our example, this is 7DIvfvpfyvf. The contents of this tag inform us whether the window has been anchored. Configure a picture with three buttons created under XvqPiwrp7. In our example, we use the objects 7 , 7!, and 7" The picture we use is vpf$fvqf %qy. For 7 , configure a 8hpv under @rHrQryrs, which sets the position of the picture outside the visible area, closes the picture and cancels the anchoring of the picture. Configure a qvrpprpv for 7! under @rHrQryrs. Connect the pr 8h to the htrWhvhiyrU %fvpfvf $. Select the vqvrp option. Accept the settings by clicking the PF button. In this way, you have carried out indirect addressing. In the same way, create a qvrp prpv under 7! with the pr 8h. Create a status display under ThPiwrpTh9vyh. In our example, we use Th9vyh . Under 8svthv9vhyt, select tag

2 3 4

WinCC Configuration Manual C79000-G8276-C140-01

3-65

ThyrQwrpvpf

!((

Tr

Qprqr)yvyrrhv

and set the trigger in the Vqhr list box to Vpuhtr. Click the 6qq button to add another state. For state , select picture fi, and for state , picture fqi.
7DIvfvpfyvf

8 9

For Th9vyh prhrh8hpv under @rHrQryrs, which negates the state of tag 7DIvfvpfyvf. Configure an object of type ThqhqPiwrpThvpUr as the title. In our example, we use the object called ThvpUr . Create a 8hpv under QrvrAUr, which reads the current valve number out of the address tag U %fvpfvf $ and returns an appropriate text as the return value. Configure another object under ThqhqPiwrpThvpUr to display the valve state. In our example, we use the object called ThvpUr!. Create a8 hpv under QrvrAUr, which reads the state of the valve in question and returns an appropriate text as the return value. Under Qrvr 8yA8y, create a 8hpv which controls the font color in accordance with the state of the valve. In a second picture, configure a picture window under ThPiwrpQvpr Xvq. In our example, we use QvprXvq . Adjust the size of the vpr vq to match the size of the picture just configured. In the Qrvr Hvpryyhr window, change the attributes Hhiyr and 7qr to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqf %qy. In the same picture, configure a button under XvqPiwrp7 for each valve in the picture; in our example, we use 7 , 7!, 7", and 7#. For each button, create a 8hpv which reads out the number of the i 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

!((

ThyrQwrpvpf

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

ThyrQwrpvpf

!((

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

Irtrrhyr

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

!((

ThyrQwrpvpf

"& 9hvp

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf%qy.

WinCC Configuration Manual C79000-G8276-C140-01

3-69

ThyrQwrpvpf

!((

"&

8ypuhtrrhyr 

Uhxqrsvvv

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

Dyrrhvppr

We implement this by means of a slider object created under XvqPiwrpTyvqr Piwrp, which we use to change the value in a tag. The text is displayed by means of ThqhqPiwrpThvpUr.

DyrrvtvurXv88wrp
Tr Qprqr)pypuhtr

1 2

Create a tag of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tag called T"!vfvpfqf. Configure a slider object under XvqPiwrpTyvqrPiwrp; In our example, we use the object called TyvqrPiwrp . Under Qrvr Hvpryyhr, set the HhvWhyr to  and the HvvWhyr to . Under @rQrUvpHvpryyhrQpr9vr 8rpv, create a qvrpprpv to tag T"!vfvpfqf. Configure an object of type ThqhqPiwrpThvpUr. In our example, we use the object called ThvpUr$. Under QrvrAUr, create a 8 hpv which outputs a text with the corresponding tag value. and set the trigger to Vpuhtr. Create a qhvpqvhyt under Qrvr8yA8y. In the @rvAyh field, set tag T"!vfvpfqf and set the trigger to V puhtr. In the 9hhUr field, select 6hyt and add 4 value ranges by means of the 6qq button. Set the value ranges as follows.

Create a qhvpqvhyt under QrvrAyhuvtAyhuvt7hpxtq 6pvr. In the @rvAyh field, set tag T"!vfvpfqf and set the trigger to Vpuhtr. In the 9hhUr field, select 6hyt and add a value range by means of the 6qq button. Set the value ranges as follows.

3-70

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)pypuhtr

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 vs function. It is performed independently of the current runtime language. The return value is the generated text.

Irtrrhyr

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

WinCC Configuration Manual C79000-G8276-C140-01

3-71

ThyrQwrpvpf

!((

"&! Urrpuhtrrhyr!

Uhxqrsvvv

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.

Dyrrhvppr

button created under XvqPiwrp7, to turn a valve on and off. A static text created under ThqhqPiwrpThvpUr displays whether the valve is on or off.

DyrrvtvurXv88wrp
Tr Qprqr)rrpuhtr

1 2

Create a tag of type 7vhht in Tag Management. In our example, we use the tag called 7DIvfvpfqf . Configure a button under XvqPiwrp7. In our example, we use the object called 7 . Under @rHrQryrs, generate a 8hpv which negates the status of the 7DIvfvpfqf tag. Create a qhvpqvhyt under QrvrHvpryyhrUyvUr. In the @rvAyh field, set tag 7DIvfvpfqf and set the trigger to Vpuhtr. In the 9hhUr field, select the 7y option. In the UyvUr column, enter the text pyr next to the valid range `rUSV@ and the text r next to IA6GT@. Configure an object of type ThqhqPiwrpThvpUr. In our example, we use the object called ThvpUr&. Create a qhvpqvhyt under Qrvr AUr. In the @rvAyh field, set tag 7DIvfvpfqf and set the trigger to Vpuhtr. In the 9hhUr field, select the 7y option. In the UyvUr column, enter the text r next to the valid range `rUSV@ and the text pyr next to IA6GT@.

Irtrrhyr

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

3-72

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"&" 6vhvsrrrhyr"

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a picture window created under ThPiwrp QvprXvq, whose position we control by means of a tag. We change the value in the tag by means of a slider object created under XvqPiwrpTyvqrPiwrp.

DyrrvtvurXv88wrp
Tr Qprqr)hvhvsrr

1 2

Create a tag of type Tvtrq"!ivhyr in Tag Management. In our example, we use the tag called T"!vfvpfqf". Configure a slider object under XvqPiwrpTyvqrPiwrp; in our example, we use TyvqrPiwrp!. Under QrvrHvpryyhr, set the HhvWhyr to " and the HvvWhyr to . Under @rQr UvpHvpryyhrQpr9vr8rpv, create a qvrp prpv to tag T"!vfvpfqf". Configure a picture window under ThPiwrpQvprXvq. In our example, we use the object called QvprXvq . Under Qrvr Hvpryyhr, change the attributes 7qr and 6qhQvpr to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf"fpuhrf. Create a qhvpqvhyt under QrvrBrrQvvY. In the @rvAyh field, set the expression T"!vfvpfqf"!(. Set the trigger to Vpuhtr of tag T"!vfvpfqf". In the 9hhUr field, select the 9vrp option. Create a qhvpqvhyt under QrvrBrrQvv`. In the @rvAyh field, set the expression #T"!vfvpfqf". Set the trigger to Vpuhtr of tag T"!vfvpfqf". In the 9hhUr field, select the 9vrp option.

Irtrrhyr

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

WinCC Configuration Manual C79000-G8276-C140-01

3-73

ThyrQwrpvpf

!((

"&# Tuvthquvqvtiwrpirhsivrhyhv rhyr#

Uhxqrsvvv

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

Dyrrhvppr

We implement this by means of a check box, which we create under Xvq Piwrp 8urpx 7, and we use this check box to set individual bits in a tag. Several polygons created under Thqhq Piwrp Qyt are displayed or hidden depending on these bits.
DyrrvtvurXv88wrp
Tr Qprqr)uvthquvqvtiwrpirhsivrhyhv

1 2

Create a tag of type Vvtrq'ivhyr in Tag Management. In our example, we use the tag called V'fvpfqf!. Configure a check box under XvqPiwrp8urpx7; in our example we use 8urpx7 . Under QrvrBrrIirs7r, enter the number of objects to be switched; in our example, &. Under QrvrA Ur, 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 ThqhqPiwrpQyt. In our example, we use the objects called Qyt through Qyt&. Create a qhvpqvhyt for Qyt under QrvrHvpryyhr 9vyh. In the @rvAyh field, set tag V'vfvpfqf! and set the trigger to Vpuhtr. In the 9hhUr field, select the 7v option. Click the button to call bit selection and select the first bit.

3 4

Follow the same procedure for the other ytiwrp and change the bit number for each one.

Irtrrhyr

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

3-74

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"&$ 6vhvsrrirhsh8hpvrhyr$

You access the following examples that relate to the Dynamics chapter in our vpf project by the button depicted above. The examples are configured in the picture named vpf"fpuhrf%hqy.

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a status display created under ThPiwrp Th9vyh to display two pictures. Two buttons created under XvqPiwrp 7 are used to move this status display in two different directions.

DyrrvtvurXv88wrp
Tr Qprqr)hvhvsrrirhsh8hpv

1 2

In Tag Management, create three tags of type 7vhht; in our example, we use tags 7DIvfvpfqf$, 7DIvfvpfqf% and 7DIvfvpfqf&. Create a status display under ThPiwrpTh9vyh. In our example, we use the object called Th9vyh . Under 8svthv9vhyt, select tag 7DIvfvpfqf$ and set the trigger to Vpuhtr. Add another status. Set picture Arhv i under state  and picture Arhv!i under state by means of drag&drop.

Under QrvrThr7hvpQvprUhhr8y, set the color Xuvr for both states ( and ) and set QvprUhhr8yP to `r. This means that the picture is not shown with a white background. Configure a button under XvqPiwrp7. In our example, we use the object called 7 . Under @rHrQryrs, create a qvrp prpv which sets tag 7DIvfvpfqf& to , and under @rHr Qrvtu, create another qvrpprpv which resets the same tag to . Create a second button under XvqPiwrphqvurhrhh
qrpvirqvurrvrprhrqvrpprpvht 7DIvfvpfqf%

. In our example, we use the object called 7!.

Under QrvrBrrQvvY, create a 8hpv for Th 9vyh which executes animation of the movement depending on which i is clicked. Set the trigger for this action to !$.

WinCC Configuration Manual C79000-G8276-C140-01

3-75

ThyrQwrpvpf

!((

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 hvpv and initialize it with the current X position of the object. Check whether 7 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 Th9vyh . Check whether 7! 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 Th 9vyh . The return value is the new X position.

Irtrrhyr

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

!((

ThyrQwrpvpf

"&% 8rhrhvhvsrrirhshvhqrhyr%

Uhxqrsvvv

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 9hvpXvhq.

Dyrrhvppr

To implement this control action, we use a circle created under ThqhqPiwrp8vpyr, which is to be moved on the screen. We use two slider objects created under Xvq PiwrpTyvqrPiwrp to enter the tag.
DyrrvtvurXv88wrp
Tr Qprqr)prhrhvhvsrrirhshvhq

1 2

Create two tags of type Vvtrq"!ivhyr in Tag Management. In our example, we use the tags called T"!vfvpfqf  and T"!vfvpfqf . Configure two slider objects under XvqPiwrpTyvqrPiwrp; in our example, we use TyvqrPiwrp and TyvqrPiwrp!. Create a qvrpprpv under TyvqrPiwrp . Connect the pr QrTyvqrPiwrp Qpr 9vr8rpv to the target Variable T"!vfvpfqf . In the same way, create a qvrpprpv to tag T"!vfvpfqf under TyvqrPiwrp!. Under QrvrHvpryyhrHhvWhyr, change the setting to !$$ for both slider objects. Configure an object of type ThqhqPiwrp8vpyr. In our example, we use 8vpyr . With the object selected, select the Thqhq9hvp tab from the 9hvpXvhq and ' the HrPiwrp option. Select Uht as the trigger. On the Trv page, select tag T"!vfvpfqf  for the X direction and tag T"!vfvpfqf 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 Avvu.

3 4

Under QrvrBrrQvvY and QrvrBrr Qvv`, set the trigger to Vpuhtr of the respective tag in the 8hpv generated by the 9hvpXvhq.

WinCC Configuration Manual C79000-G8276-C140-01

3-77

ThyrQwrpvpf

!((

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

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The settings made in the 9hvpXvhq for animation of the movement must be adapted to suit your own needs.

3-78

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"&& 8ypuhtrirhsh8hpvrhyr%

Uhxqrsvvv

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

Dyrrhvppr

We implement this by means of a circle, which we create under ThqhqPiwrp 8vpyr, whose color changes as a tag value changes. We use a slider object created under XvqPiwrpTyvqrPiwrp to enter the tag.

DyrrvtvurXv88wrp
Tr Qprqr)

1 2

Create a tag of type Vvtrq"!ivhyr in Tag Management. In our example, we use tag T"!vfvpfqf . Configure a slider object under XvqPiwrpTyvqrPiwrp; In our example, we use the object called TyvqrPiwrp . Create a qvrpprpv for TyvqrPiwrp under @rQrUvpHvpryyhrQpr 9vr8rpv. Connect the pr QrTyvqrPiwrp Qpr 9vr8rpv to the target Variable T"!vfvpfqf . Under QrvrHvpryyhrHhvWhyr, change the setting for TyvqrPiwrp to !$$. Configure a circle under ThqhqPiwrp8vpyr; in our example, we use 8vpyr . Under Qrvr8y7hpxtq8y, create a 8hpv which provides a color value depending on tag T"!vfvpfqf . This action is triggered Vpuhtr 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, T"!vfvpfqf , shifted 8 bit positions to the left.

Irtrrhyr

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

ThyrQwrpvpf

!((

"&' 6vhvsrrirhshhqvyhrhyr&

Uhxqrsvvv

Movement is to be simulated by turning on different pictures in a ThPiwrpTh qvyh.

Dyrrhvppr

To implement this control action, we use a status display created under ThPiwrp Th9vyh, in which we display different pictures one after the other after turning on the display by means of another status display created under ThPiwrpTh qvyh.

DyrrvtvurXv88wrp
Tr Qprqr)hvhvsrrirhshhqvyh

1 2

Create a tag of type 7vhht in Tag Management. In our example, we use the tag called 7DIvfvpfqf(. Create a status display under ThPiwrpTh9vyh. in our example, we use the object called Th9vyh". Under 8svthv9vhyt, select tag 7DIvfvpfqf( and set the trigger to Vpuhtr. Add another status. Set picture Tvyvi under state  and picture 8yi under state . For Th9vyh", create a 8hpvqr @rHrQryrs, which negates the state of tag 7DIvfvpfqf(. Configure another status display under ThPiwrpTh9vyh; in our example, we use Th9vyh#. Under QrvrThr8rTh, configure seven more statuses with the respective pictures. For each status, change the 7hvpQvprUhhr8y attribute to Xuvr and the 7hvp QvprUhhr8yP to `r. Statuses  through & are each assigned one of the pictures from T"f% i through T"f%'i.

3 4

For Th9vyh#, create a 8hpv under QrvrThr8r Th, which causes current statuses 0 through 7 to be run through. Set the trigger for this action to !$.

3-80

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

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

Irtrrhyr

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

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

ThyrQwrpvpf

!((

"' Ghthtrvpu

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf&qy.

3-82

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"'

8uhtrvryhthtrrhyr

Uhxqrsvvv

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

Dyrrhvppr

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

DyrrvtvurXv88wrp
Tr Qprqr)puhtrvryhthtr

In the Bhuvp9rvtr, 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 pfile with the aid of the yhthtrrr program on the WinCC CD. They can then be translated and imported back into the project. Call the library by selecting menu item WvrGvih. Select the Byihy Gvih7Ghthtr subfolder and drag the i you require to the workspace using the If you require a language that is not contained in the library, create a button under XvqPiwrp7 and configure a 8hpv under @rHr Qryrs, which executes the language change to the language in question. The Bhuvp9rvtr even provides a 9hvpXvhq, which generates the 8 hpv required. To do this, select the i to be used for the additional language and then ' the GhthtrTvpu option in the TrApv tab of the 9hvpXvhq. You can then select the language you want in the 9hvpXvhq.

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 TrGhthtr function to change the language setting, entering the respective language code to do so.

Irtrrhyr

The following adaptations must be made before this button can be put to general use: Carry out the desired language settings in the 9hvpXvhq.

WinCC Configuration Manual C79000-G8276-C140-01

3-83

ThyrQwrpvpf

!((

"'! 9vhytispuhtvturvrhq8y8rryhthtr rhyr!

Uhxqrsvvv

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

Dyrrhvppr

To implement this control on, we use a button created under XvqPiwrp7, which shows or hides a picture window created under ThPiwrpQvprXvq. This dialog box can be taken directly from the project with the name vpf.

DyrrvtvurXv88wrp
Tr Qprqr)qvhytispuhtvturvrhq8y8rr yhthtr

In the Bhuvp9rvtr, a picture (any picture) is configured in a certain language. By selecting the menu item WvrGhthtr, the next language to be configured is selected and all the texts translated into the language in question. Configure a picture window under ThPiwrpQvprXvq. In our example, we use QvprXvq . Under QrvrBrr, change the XvqXvqu to !" and the XvqCrvtu to ! #. Under Qrvr Hvpryyhr, change the attributes Hhiyr, 7qr, Uvyr and 8h7r8yrq to `r. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf$fvqf (qy. This picture can be taken directly from project vpf. Change QrvrHvpryyhrHvpryyhr to I. Configure a button under XvqPiwrp7. In our example, we use the object called 7#. Configure a qvrpprpv under @rHr Qryrs, which shows QvprXvq .

Irtrrhyr

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

3-84

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"( Xxvtvuhr

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the pictures vpf"fpuhrf'qy, vpf"fpuhrf'hqyand vpf"fpuhrf'iqy.

WinCC Configuration Manual C79000-G8276-C140-01

3-85

ThyrQwrpvpf

!((

"(

PrhvvuurU67xruxrrhyr 

Uhxqrsvvv

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.

Dyrrhvppr

To implement these control actions, we use four buttons created under XvqPiwrp 7. They are used to display the dialog boxes. They can be operated on the keyboard when the runtime cursor is activated. Select the i you want to operate with the TAB key. Further, a hot key is assigned to every button. Three picture windows created under ThPiwrpQvprXvq are used to display the dialog boxes.

8svtvtppy
Tr Qprqr)psvtvtppy

5 Make the relevant settings in the 8y8rr to enable cursor control. 8r to call the shortcut menu and choose Qrvr. In the 8ryv the Qrvr button. rvr dialog box that appears,

Then select the BhuvpSvr tab. 2 Make the hot key settings as follows. A hot key is not configured to puhtr vq since setting of the control focus is performed with 8hpv in the examples. To switch between UhiPqr6yuh8, set TCDAU6, and set TCDAUS for turning the runtime cursor on and off.

Do not set any keys in the segment 8py)xr. If they are required in

3-86

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)psvtvtppy

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.

DyrrvtvurXv88wrp
Tr Qprqr)psvtvtpyirhsuxr

In tag management, create three tags of the Vvtrq %ivhyr type, which contain the set font attributes. In our example, we use V %vfvpfpf through V %vfvpfpf!. In the picture vpf"fpuhrf'qy, create four objects of the XvqPiwrp 7 type. In our example, we use the objects called 7 , 7!, 7" and 7#. They are used to open the dialog boxes and to reset the settings performed. Further, configure static text under ThqhqPiwrpThvpUr, the font attributes of which have been set in the dialog boxes. In our example, we use the object called ThvpUr . Configure another picture, which will be used as a dialog box for setting colors. In our example, we use the picture named vpf$fvqf!"qy. In this picture, configure a XvqPiwrpPvB. In our example, we use the object called PvB . QrvrBrrIirs Avryq is set to #. This means it is possible to select four different colors. Under QrvrPDTryrprq7r, create a htprpv to tag V %vfvpfpf. At QrvrBrrQvvY, create a 8hpv which switches the focus to its own object. This 8hpv is triggered at u. If the PvB 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 XvqPiwrp 7. In our example, we use the objects called 7 and 7!. 7 is used as the PFi. At the @rHrHrpyvpx, create a 8hpv which changes the color of the lettering as a function of the value of the V %vfvpfpftag. Further, its own window is switched to be made invisible. 7!is used as the @T8i. At @rHrHr8yvpx, create a qvrpprpv to hide the separate window. Performing settings for keyboard control. Set the tabulator order. It can be set by choosing @qvU67PqrTvpu 8Trrpr from the menu.

WinCC Configuration Manual C79000-G8276-C140-01

3-87

ThyrQwrpvpf

!((

Tr

Qprqr)psvtvtpyirhsuxr

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 PvB is performed with the hxr. A color is selected with hprih. You can switch to and fro between the control elements with the hiyhxr. The buttons are operated with the hprih. The two i are further provided with a hot key. The dialog box for configuring a hot key is opened by choosing QrvrHvpryyhrC Fr. @IU@S and @T8 are set for PF 8hpry, respectively.

3-88

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)psvtvtpyirhsuxr

In the picture called vpf"fpuhrf'qy, configure a picture window by choosing ThPiwrpQvprXvq in which you want to display the picture you have just configured. In our example, we use the object called Qvpr Xvq . Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf"fvqf!"qy. Set QrvrHvpryyhr 9vyh to I. At the 7 object, create a 8hpv which queries the currently set color of the lettering and, depending on that, describes the V %vfvpfpf tag. This is used to set the selection of the PvB in the dialog box to the currently set value. Further, the QvprXvq object is displayed. At 7 create at QrvrBrrQvvY a 8hpv that switches the control focus to that object. This 8hpv is triggered at u, but setting of the focus is performed only the first time.

The i is further provided with a hot key. In our example, this is the function key A(. 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 vpf$fvqf!#qy. In this picture, configure a XvqPiwrp8urpx7. In our example, we use the object called 8urpx7 . QrvrBrrIirsAvryq is set to #. It should be possible to choose the attributes iyq, vhyvp, qrpr and iqr. Under QrvrPDTryrprq7r, create a htprpv to tag V %vfvpfpf . At QrvrBrrQvvY, create a 8hpv which switches the control focus to its own object. The selection frame can be hidden in a manner similar to the PvB configured beforehand. As with the picture called vpf$fvqf!"qy, two buttons are created by choosing XvqPiwrp7. Choosing PF reads in the V %vfvpfpf tag and depending on that, the appropriate settings are

WinCC Configuration Manual C79000-G8276-C140-01

3-89

ThyrQwrpvpf

!((

Tr

Qprqr)psvtvtpyirhsuxr

applied to the lettering. The settings for keyboard control are performed in the same way as for the picture called vpf$fvqf!"qy. 9 In the picture called vpf"fpuhrf'qy, configure a further picture window by choosing ThPiwrpQvprXvq in which you want to display the picture you have just configured. In our example, we use the object called Qvpr Xvq!. Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf"fvqf!#qy. Set QrvrHvpryyhr 9vyh to I. At the 7! object, create a 8hpv which queries the currently set font attributes you want to modify and, depending on that, describes the V %vfvpfpf tag. This is used to set the selection of the purpxi in the dialog box to the currently set values. Further, the QvprXvq! object is displayed. The i is further provided with a hot key. In our example, this is the function key A .

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 vpf$fvqf!$qy. In this picture, configure an object by selecting ThPiwrpDPAvryq. In our example, we use the object called DPAvryq . Under QrvrPDPWhyr, create a htprpv to tag V %vfvpfpf!. At QrvrBrrQvvY, create a 8hpv which switches the control focus to its own object. Hiding the selection list-box is accomplished in the current example by a thuvpiwrp being placed across the DPsvryq. In our example, we use the object called BhuvpPiwrp . The bitmap displayed by the thuvpiwrp has a specific color in the area in which the DPsvryq has to be displayed. This color is set in the thuvpiwrp as the picture transparent color at QrQvprQvprUhhr8y. Further, the r QvprQvprUhhr8yP has to be set to`r. The bitmap used is displayed below.

12

As with the picture called vpf$fvqf!"qy, two buttons are created by choosing XvqPiwrp7. Click PF or 8hpry to close the dialog box. Both i are removed from the TAB order, however. This is accomplished by choosing @qvU67PqrTvpu8Trrpr. 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

!((

ThyrQwrpvpf

Tr

Qprqr)psvtvtpyirhsuxr 8USGTCDAU

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

rectangle.

The i are operated solely by means of the @IU@S and @T8 hot keys. If, however, @IU@Sis pressed, the value entered in the DPsvryq is applied to tag V %vfvpfpf! simultaneously. At object ThvpUr in the picture called vpf"fpuhrf'qy, create a ht prpv at QrvrAATvr at tag V %vfvpfpf!. 13 In the picture called vpf"fpuhrf'qy, configure a further picture window by choosing ThPiwrpQvprXvq in which you want to display the picture you have just configured. In our example, we use the object called Qvpr Xvq". Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf"fvqf!$qy. Set QrvrHvpryyhr 9vyh to I. At object 7", create a 8hpv that displays the object called Qvpr Xvq". The i is further provided with a hot key. In our example, this is the function key A .

14

15

At object 7#, create a 8hpv that resets the settable properties of the object called ThvpUr to the presettings. The i is provided with hot key A !.

16

Choose @qvU67PqrTvpu8Trrpr from the menu to set objects 7 to 7# in the corresponding order. All other objects are removed from the TAB order. Press the hprih or operate the appropriate hot keys to choose the i.

WinCC Configuration Manual C79000-G8276-C140-01

3-91

ThyrQwrpvpf

!((

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 8hpv is called once per hour. The focus is set only once, however. This 8hpv is located at the QrBrrQvvY of object Pv B in the picture called vpf$fvqf!$qy 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 spy property of object ThvpUr is set as a function of the value of tag V %vfvpfpf. This 8hpv is executed by choosing PF in the picture called vpf$fvqf!"qy.

3-92

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

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 vpf"fpuhrf'qy applies a cursor setting by means of API-function Q9GSUTr8Fr. 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.

Irtrrhyr

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

ThyrQwrpvpf

!((

"(! 8xrihqrhyr!

The present example is obtained in the picture called vpf"fpuhrf'qy using the key . It is configured in the combination 8USGX or by choosing the top button with picture with the name vpf"fpuhrf'hqy.

Uhxqrsvvv

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.

Dyrrhvppr

A ready-made keyboard from the library is used for the implementation. It is personalized. A picture window created at ThPiwrpQvprXvq is used to display the dialog box. A button created at XvqPiwrp7 provided with a hot key is used to display the dialog box. Thei itself is not displayed at runtime, however.

3-94

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

DyrrhvvBhuvp9rvtr
Tr Qprqr)vyrrhvvBhuvp9rvtr

In tag management, create two tags of the Vvtrq %ivhyr type for storing cursor behavior. In the example we use the tags V %vfvpfpf# and V %vfvpfpf$. Further, create a tag of the rht %ivpuhhprr type for transferring the entered text. In our example, we use the tag called U %vfvpfpf. button on the toolbar. Open the library with the In the Frihq folder, select the Frihq8uh object and drag and drop it into a picture. In our example, this is the picture named vpf"fpuhrf'hqy. The explanatory objects can be deleted; only the elements displayed below are required.

At @IU@S, a 8hpv is created at @rHrHr6pv to write entered text to a text tag. This tag is called 8rprqWh8uh. It has to be modified in the picture called U %vfvpfpf. The contents of the U %vfvpfpf tag are displayed in the example in the ThvpUr, which forma the picture heading. This is performed by means of a ht prpv 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 8hpv at @r HvpryyhrPrQvpr. It should be possible to set the cursor behavior in a dialog box. This will normally already have been performed in the 8y8rr. Use 5 to open the shortcut menu at the item 8r and select Qrvr. In the 8ryvrvr dialog box that appears, the Qrvr button. Then select the BhuvpSvr tab. You can choose between three different settings in the 8py)iruhv box.

WinCC Configuration Manual C79000-G8276-C140-01

3-95

ThyrQwrpvpf

!((

Tr

Qprqr)vyrrhvvBhuvp9rvtr

Create a new picture to be used as a dialog box. In our example, we use the picture named vpf$fvqf!%qy. Configure three status displays at ThPiwrpTh9vyh in this picture. In our example these are the objects called Th9vyh , Th 9vyh! and Th9vyh". The 8svthvqvhyti is used to set for every hqvyh one bitmap which displays the pressed state of a button, and one bitmap which displays the non-pressed state of a button. Thr is intended to display the pressed button, while hr  is intended to display the non-pressed state. At QrvrThr8rTh, create in each case a qhvpqvhyt i that control the current status of tag V %vfvpfpf$. This tag contains the temporary setting for the cursor behavior. At @rFrihqQr, create a 8hpv that describes tag V %vfvpfpf$ 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 XvqPiwrp 7. In our example, we use the objects called 7 and 7!. 7 is used as the PFi. At @rHrHr6pv, create a 8hpv that writes the value of tag V %vfvpfpf$to tag V %vfvpfpf#. This is intended to represent the currently set cursor behavior. Following that, the cursor behavior is changed using the API function Q9GSUTr8Fr. The value stored in the V %vfvpfpf#tag corresponds to the numerical value demanded by the function for specific cursor behavior. Further, the focus is set to the 6i and the separate window is switched to become invisible. 7!is used as the @T8i. At @rHrHr6pv, create a 8hpv that sets the focus to the 6i and hides its own window.. In the picture called vpf"fpuhrf'hqy, configure a picture window by choosing ThPiwrpQvprXvq in which you want to display the picture you have just configured. In our example, we use the object called Qvpr Xvq . Under QrvrHvpryyhrQvprIhr, select the picture with the name vpf"fvqf!%qy. Set QrvrHvpryyhr 9vyh to I. In the picture called vpf"fpuhrf'hqy, create a button at Xvq Piwrp7. In our example, we use the object called 7$.

3-96

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)vyrrhvvBhuvp9rvtr

At object 7$, create a 8hpv which writes the value for the currently set cursor behavior to the V %vfvpfpf$ tag and makes the QvprXvq object visible. The i is further provided with a hot key. In our example this is the key combination 8USG@. The QrvrHvpryyhr9vyh settings are set to I. 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 8hpv 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 8hpv has to be configured at the QrFr event, as it not a question of a i with this object but of a hqvyh. If it were not, the Hr8yvpx event might be used. To design the object for mouse operation too, a further 8hpv has to be created at the Mouse Click event - without key code query, however.

WinCC Configuration Manual C79000-G8276-C140-01

3-97

ThyrQwrpvpf

!((

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 Q9GSUTr8Fr function. The selected cursor behavior is stored in the V
%vfvpfpf#

tag.

Perform the cursor setting with the AP function Q9GSUTr8Fr. 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 V %vfvpfpf# tag. The focus is again set to the 6i of the keyboard and the dialog box is closed. Upon the event Open Picture, the function called Q9GSUTr8Fr 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.

Irtrrhyr

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

!((

ThyrQwrpvpf

"(" Whyrvpyhpvrhyr"

The present example is obtained in the picture called vpf"fpuhrf'hqy using the . It is configured in the key combination 8USGX or by choosing the top button with picture with the name vpf"fpuhrf'iqy.

Uhxqrsvvv

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.

Dyrrhvppr

To implement these control actions, a number of buttons created under XvqPiwrp 7 is used, under which hot keys are configured. Values are to be able to be entered in I/O fields created under ThPiwrpDPAvryq, and valves are to be able to be turned on and off.

DyrrhvvBhuvp9rvtr
Tr Qprqr)vyrrhvvBhuvp9rvtr

In tag management, create six tags of the vtrq %ivhyr type for performing and storing inputs. In our example we use the tags T %vfvpfpf to T %vfvpfpf$. In a picture, configure three I/O fields at ThPiwrpDPAvryq in which the fill-level setpoints have to be entered. In our example these are the objects DP Avryq , DPAvryq! and DPAvryq". At object DPAvryq , create a tag connection to tag T %vfvpfpf at QrvrPDPWhyr. Choose QrvrGvv and set the Vryvv to #((( and the Gryvv to . Proceed in a similar manner at the other DPsvryq, but set tags T %vfvpfpf and T %vfvpfpf!. At the DPAvryq" object, however, set the Vryvv to ((((.

Configure three buttons at XvqPiwrp7which are to be used for applying the values entered in the DPsvryq. In our example, we use the objects called 7A%, 7A& and 7A'. At object 7A%, create a 8hpv at @rHrHr6pv that writes the value entered in tag T %vfvpfpf to tag T %vfvpfpf". Choose QrvrHvpryyhrCFr set hot key A% for the i. Proceed in a similar manner with the other i. At 7A%, create a 8hpv at QrvrBrrXvqu that switches the focus to its own object.

WinCC Configuration Manual C79000-G8276-C140-01

3-99

ThyrQwrpvpf

!((

Tr

Qprqr)vyrrhvvBhuvp9rvtr

Configure three rectangle at ThqhqPiwrpSrphtyr to represent entered values. In our example, we use the objects Srphtyr(, Srphtyr , and Srphtyr . Set the QrvrAvyyvt9hvpAvyyvt to `r. At QrvrAvyyvt AvyyGrry, create in each instance a qhvpqvhyti for converting the tag value into a fill level. The graphical display of the containers is performed with several hqhq iwrp, which are combined to form a group in each instance.

Configure four more buttons under XvqPiwrp7. They are to be used to turn valves on and off. In our example, we use the objects called 7A(, 7A , 7A and 7A !. At the @rHrHr8yvpx, create a 8hpv to invert a binary tag representing a valve state. Every i 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 9vyhvthquvqvtvshv in example Tuvthq uvqvtiwrprhyr . With the exception of the i provided with hot keys, all the other objects are removed from the TAB order. Set the order of selection of the DPsvryq with the TAB key by choosing @qv U67Pqr6yuh8Pqr from the menu.

In the 8y8rr, set a key combination for fore toggling between the Tab 5 8r to call the shortcut menu and choose Orders and the alpha cursor.

3-100

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)vyrrhvvBhuvp9rvtr Qrvr Qrvr

. In the 8ryvrvr dialog box that appears, the button. Then select the BhuvpSvr tab. To toggle between UhiPqrhqhyuhp, set the key combination TCDAU6. Further, to turn the runtime cursor on and off, set the key combination TCDAUS.

Ir)

You can exit the example just described by choosing the following button or by pressing @T8.

Irtrrhyr

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 Tvhvp PQ#&.

WinCC Configuration Manual C79000-G8276-C140-01

3-101

ThyrQwrpvpf

!((

"

 Tuvthquvqvtvshv

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf(qy.

3-102

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"



Tuvthquvqvtiwrprhyr

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.

Uhxqrsvvv

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

Dyrrhvppr

To implement this control action, we use a picture in which several valves are displayed. Each valve is assigned a button created under XvqPiwrp7 which is used to control the valve, a static text created under ThqhqPiwrpThvpUr 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 ThPiwrpDPAvryq. 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 XvqPiwrp7.

DyrrvtvurXv88wrp
Tr Qprqr)uvthquvqvtiwrp

In Tag Management, create three tags of type 7vhht, which control the visibility of the various object groups. In our example, we use 7DIvfvpfvsf !, 7DIvfvpfvsf ", and 7DIvfvpfvsf #. In Tag Management, create further tags of type 7vhht, which contain the current states of the valves. The number of tags required depends on the number of valves. In our example, we use 7DIvfvpfvsf through 7DIvfvpfyvf ; we have, then, configured a total of 11 valves. To display the valves in their open state, configure an object under Thqhq PiwrpQyt, which has the shape of a valve. Under Qrvr8y

7hpxtq8y, select the color qhxtrr.


4 To display the valves in their closed state, configure an object under Thqhq PiwrpQyyvr, which has the shape of a valve.

Configure two identical objects under ThqhqPiwrpSrphtyr and set them to display the background color of the picture under Qrvr8y 7hpxtq8y. 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 @qv BiwrpB and group the two objects. For the group object this generates, configure a tag connection to tag 7DIvfvpfvsf under Qrvr HvpryyhrWvr.

WinCC Configuration Manual C79000-G8276-C140-01

3-103

ThyrQwrpvpf

!((

Tr

Qprqr)uvthquvqvtiwrp

Position the closed valve over the second rphtyr and position it in the foreground. Then position the tiwrp generated under Step 6 over this and position it in the foreground. Now group these three objects. This new t iwrp can then be copied to enable you to configure the remaining valves quickly. The only adaptation you have to make is to the htprpv. For each valve, configure a button under XvqPiwrp7 and under @rHrQryrs, create a 8hpv which negates the corresponding tag value. Configure a static text for each valve under ThqhqPiwrpThvpUr, 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 ThPiwrpDPAvryq. Configure three objects under XvqPiwrp7. In our example, we use the objects called 7 !, 7 ", and 7 #. For 7 !, create a 8 hpv under @rHrQryrs, which negates the value of tag 7DIvfvpfvsf !. Then create identical 8hpv for tags 7DIvfvpfvsf " and 7DIvfvpfvsf # under the remaining i. Configure a htprpv to tag 7DIvfvpfvsf ! under all of the objects which are to be shown and hidden by means of 7 !. Do exactly the same for the other objects. In our example, 7 ! is used to show the DPsvryq, 7 " to show the hvpr, and 7 # to show the i.

9 10 11

12

Irtrrhyr

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

!((

ThyrQwrpvpf

"

! 9vyhvturqhrhqvrrhyr!

Uhxqrsvvv

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

Dyrrhvppr

We implement this by means of an OLE Control object which we create under Th PiwrpPG@8y and which is used to display an OCX object. We also use two static texts created under ThqhqPiwrpThvpUr to display the date and the time.

DyrrvtvurXv88wrp
Tr Qprqr)qvyhvturqhrhqvr

Configure an OLE Control object under ThPiwrpPG@8y. In our example, we use the object called PG@8y . Select the Xv88 9vtvhy6hyt8ypx8y 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 ThqhqPiwrpThvpUr. In our example, we use the object called ThvpUr!!. Create a 8hpv under QrvrA Ur, 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 ThqhqPiwrpThvpUr. In our example, we use the object called ThvpUr!". Create a 8hpv under QrvrAUr, which reads out the current date and returns this as the return value.

WinCC Configuration Manual C79000-G8276-C140-01

3-105

ThyrQwrpvpf

!((

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

vrvr

returns the current system time in seconds. returns a pointer to the system time structure.

yphyvrvr THhyyp vs

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

Irtrrhyr

The following adaptations must be made before this button can be put to general use: The ThPiwrpPG@8y can be directly applied. The 8hpv at ThqhqPiwrpThvpUr can be directly applied.

3-106

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

"

8svtvtrhtr

You access the examples that relate to this topic in our vpf project by the i depicted above. The examples are configured in the picture named vpf"fpuhrf qy.

Uhxqrsvvv

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.

Dyrrhvppr

To implement this control action, we use two application windows created under Th Piwrp6yvphvXvq, in which we display the message pictures. In addition, we also use three slider objects created under XvqPiwrpTyvqrPiwrp and a check box created under XvqPiwrp8urpx7, with which we enter values and simulate error messages.

DyrrvtvurXv88wrp
Tr Qprqr)psvtvtrhtr

1 2

Create four tags of type Vvtrq %ivhyr in Tag Management. In our example, we use V %vfvpfrhtrf through V %vfvpfrhtrf". Configure a check box under XvqPiwrp8urpx7; in our example, we use 8urpx7 . Under QrvrPDTryrprq7r, create a htprpv to tag T"!vfvpfrhtrf. Configure three objects of type XvqPiwrpTyvqrPiwrp. in our example, we use TyvqrPiwrp , TyvqrPiwrp!, and TyvqrPiwrp". Under 8svthv9vhyt, select tag T"!vfvpfrhtrf and set the trigger to Vpuhtr. Change the HhvWhyr to $. In the same way, configure the remaining tags for the other yvqriwrp. Open the 6yhGttvt editor in the 8y8rr by clicking it with the 5.

Select menu item AvyrThHrhtrXvhq and close the first page of the

WinCC Configuration Manual C79000-G8276-C140-01

3-107

ThyrQwrpvpf

!((

Tr

Qprqr)psvtvtrhtr

wizard by clicking Ir.

On the page entitled TryrpvtHrhtr7ypx in the section called Tr iypx, select the 9hrUvrIir option. Leave the remaining settings as they are and close the page by clicking Ir. On the page entitled 8rhvth Gvr, leave the settings as they are and close the page by clicking Ir. On the page entitled HrhtrXvq, leave the settings as they are and close the page by clicking Ir. On the page entitled Qrrvt8yhr, leave the settings as they are and close the page by clicking Ir. On the page entitled 8uvt 6puvr, select the TuUr6puvrA!$Hrhtr and close the page by clicking Ir. Close the Avhyr page by clicking 6y. Select Hrhtryvrsh, 5 the Hrhtryvrrhyr option in the righthand window and open the properties dialog.

Add the message blocks Hrhtrr and Qvsr by clicking the button and close the window by clicking PF. 8 Select Hrhtriypx and window. 5 the Hrhtrr option and call the properties dialog. Change the length to 40 characters. In the same way, change the length of the Qvsr block to 20 characters.

8'

the Vrriypx option in the right-hand

5 the Hrhtrvqrhyr option in Select Hrhtrvqryhr, the right-hand window and open the properties dialog. In the Brrhy Dshv tab, enter the window name and the window title and select Tu Ur6puvrXvq in the XvqUr section. In our example, we have chosen Avyyvtrvvt as the window name and Avyyvtr as the window title. On the HrhtrGvr tab, set the message line format you require WinCC Configuration Manual C79000-G8276-C140-01

3-108

!((

ThyrQwrpvpf

Tr

Qprqr)psvtvtrhtr

in the example, the previously created rhyrrhtryvr format. On the Qhhrr tab, select the items GvrUvyr and 8yUvyr. In the Th7h tab, select 9vyhTh7h, set 7 in the 6yvtr section, and under @yrrPsUurTh7h, select 9hr and Uvr. In the Uyih tab, select 9vyhUyih, set U in the 6yvtr section, select hyyxrihqspv, but deselect the 8v8hyyspv check box. Close the window by clicking PF. 10 Define messages in the table window. To do this, 5 the Iir column and click 6rqIrGvr. Enter @ in the 8yh column and 6yh in the Ur column. In the @rht column, select tag V %vfvpfrhtrf and under @riv, set the bit number . Enter irhxq as the rhtrr and as the yphv. Configure further messages in the same way, using @ and Xhvt also as message types. These are all generated by individual bits of the tag written to by the purpxi. hasnt already been done. Now 5 the new Gvvhyrvvt option that has appeared and click the Ir option. Select V %vfvpfrhtrf as the tag to be monitored. 5 the new option generated for the tag, select Ir and define a limit value and the message number that belongs to it. In our example, we use a CvtuGvvWhyr of #$ and the Hrhtrir #. A new line has now been added in the table window, in which all you have to enter now is the Hrhtrr and the Qvsr. In the same way, configure other messages for the low limit value and the other tags. Select menu item Pv6qqD and click Gvvhyrvvt if this

11

12

option in the right-hand window. 5 the 6yh option, open the properties dialog and enter the color settings you want. Do the same for the Ahvyr and Xhvt options. In our example, we use the following color scheme for the message type 6yh:
Ahvyr

To configure the message colors, select the Hrhtrpyhr item and

8'

the

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

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

13 14

Save the settings in the 6yhGttvt editor.


6yvphvXvq

In the picture, configure an application window under ThPiwrp , select 6yhGttvt as the Xvq8r and Avyyvt vvt as the Uryhr. In our example, we use the object called 6yvphv Xvq .

WinCC Configuration Manual C79000-G8276-C140-01

3-109

ThyrQwrpvpf

!((

Configuring Loop in Alarm


Tr Qprqr)psvtvtGv6yh

The pictures we use in our example to display a Gv6yh are vpf$fvqf through vpf$fvqf!For each of the container objects in the three pictures, a htprpv is configured to one of the three tags supplied by the yvqriwrp; this is done under QrvrUht 6vtrAvyyGrry. In the picture in which the yvqriwrp and the purpxir are also configured, configure a picture window (ThPiwrpQvprXvq). In our example, we use QvprXvq and set vpf$fvqf qy as the picture name. To implement a Gv6yh, create a wrpspv in the ByihyTpv 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 6yhQvpr8uhtr. The 6yhGttvt editor uses the PrQvpr 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 Gv6yh column and set the picture name. The picture set is the one in which the corresponding tag, whose limit value is monitored, is displayedThe function6yhQvpr8uhtr is selected as the function name at Qwrpspv. 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


Tr Qprqr)psvtvthrhtrvqvurrvrrpv

In the 6yhGttvt editor, create a new message window template; in our example, we use the template Prvrrhtr. Select Hrhtrvq

5 it, and then click Ir. In the BrrhyDshv tab, enter ryhr, the window name and the window title. In our example, we have chosen Prvrrhtr as the window name and hyh as the window title. Select the HrhtrXvq option in the XvqUr section. Choose the Tryrpv button to open the TrTryrpv window and deselect message types @ and Xhvtvia the folder called Hrhtr8yh@ in the window on the right. This means that only messages of type 6yh are displayed in the overview window.

3-110

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrpvpf

Tr

Qprqr)psvtvthrhtrvqvurrvrrpv

In the HrhtrGvr tab, set the format entitled Hrhtryvrrhyr. The Qhhrr, Th7h and Uyih tabs can be applied unchanged. 2 In an overview window which is displayed in every plant status, configure an application window under ThPiwrp6yvphvXvq and set 6yh Gttvt as the Xvq8r and Prvrrhtr as the Uryhr. In our example, we use the object called 6yvphvXvq! in picture vpf frvrfqy. Set the size of the window large enough that a message can be displayed. In the overview picture, configure a button object under XvqPiwrp 7. In our example, we use the object called 7". For this button, create a 8hpv under @rHrHr6pv, which opens the message picture vpf"fpuhrf . This i 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 vpf!fxrihqfqy, a further i 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

ThyrQwrpvpf

!((

Project function AlarmPictureChange


void AlarmPictureChange(char* lpszPicture) { SetPictureName("pictu_3_chapter_10","Picture Window1", lpszPicture); }

Calling the TrQvprIhr 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 Qvpr Xvq is the transfer parameter.

Irtrrhyr

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

!((

ThyrQwrprhyrf

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


This project presents examples to the UhtGttvt, 6yhGttvt and Sr9rvtr editors. The examples to this subject are configured in the rhyrf WinCC project.

WinCC Configuration Manual C79000-G8276-C140-01

4-1

ThyrQwrprhyrf

!((

#

UhtGttvt

In runtime, the examples can be selected by clicking on the button displayed above with the . The examples are configured in the pictures rf"fpuhrf Q9G to rf"fpuhrf sQ9G.

BrrhyDshv
UhtGttvt

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.

TvyhvsQprWhyr

For the simulation of process values that are archived by UhtGttvt 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 B%#frfytf ,B%#frfytf! and B%#frfytf" are supplied with values. The tag B%#vfrfytf# 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

!((

ThyrQwrprhyrf

#

8pyvp8v6puvvtrf"fpuhrf Q9G

Uhx9rsvvv

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 pyyr as user name and htyttvt as password.

Dyrrhv8pr

To archive the displayed data, create a cyclic-continuous process value archive in the Uht Gttvt editor. To realize a graphical display, an hyvphvvq for displaying a trend window is used. The rqvqryhr is created in the UhtGttvt editor.

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

Creation of the tags to be archived in "Tag Management". In the example, the tags B%#frfytf ,B%#frfytf! and B%#frfytf" are archived. These tags are supplied with values by the simulator. In the 8y8rr, open the UhtGttvt editor via a

85

Creating a new archive. Start the ArchiveWizard via 6puvr

85

Conclude the first page of the Wizard by clicking on Ir. On the second page, select the QprWhyr6puvr as the hpuvrr and name it. In the example, the archive was named aFfQprWhyr6puvrf. Proceed to the next page by clicking on Ir. On the third page, set the tags to be archived via the button. In the example, the tags B%#frfytf ,B%#frfytf! and B%#frfytf" were

WinCC Configuration Manual C79000-G8276-C140-01

4-3

ThyrQwrprhyrf

!((

Tr

Qprqr)8rhvshQprWhyr6puvr

selected. Close the page by clicking on Avvu. 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 BrrhyDshv tab, basic archive parameters can be changed. The hpuvrhr and the hpuvrr have already been set by the Wizard. The hpuvrrcan not be changed again. The 6puvvthTrTh box is rhiyrq. In the 6uvhvGrry box, I 6pprQrpv 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

!((

ThyrQwrprhyrf

Tr

Qprqr)8rhvshQprWhyr6puvr

Additional properties are set in the 6puvrQhhrr tab. Set  as the number of data records. As the HrGphv, select Pur uhqqvx. A function can be set as the 6pvsrvturur hpuvr that is, executed automatically whenever the short-term archive is full. In the example, however, no action is planned. Select Turhpuvr as the 6puvrUr. 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 PF. 7

85

on the table window to open the properties dialog box of the selected archive tag.

In the 6puvrUht 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 Ihrs ur6puvrUht, in the example, the name of the corresponding process tag is

WinCC Configuration Manual C79000-G8276-C140-01

4-5

ThyrQwrprhyrf

!((

Tr

Qprqr)8rhvshQprWhyr6puvr

used. In the TyvtUht box, Tr has been selected and the 6puvvthTr Th has been rhiyrq. 8pyvp8v has been set as the 6puvvtUr. 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 Qhhrr tab, additional settings are made. In the 8pyr box, set $ as the 6pvvv cycle and $ as the 6puvvt cycle. Set the 6phyhyr in the Qprvt box. Vv will not be selected. "Last Value" is to be saved on error. 6puvr puhtr is not selected.

4-6

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)8rhvshQprWhyr6puvr

10 11 12

In the 9vyh tab, the transfer range of the tag into the archive is set. In the example, I9vyhGvvhv is set. In the @r tab, the example uses no action in the 9hvp 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.

Ir)

The presettings made by the Archive Wizard for the process value archive and the archive tags can be changed via 6puvrQrrvtQpr6puvr and 6puvr Qrrvt6hytUht.

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

WinCC Configuration Manual C79000-G8276-C140-01

4-7

ThyrQwrprhyrf

!((

Urq9vyh8svthv
Tr Qprqr)Urq9vyh8svthv

Create a new trend window template by 5 on the corresponding entry in the navigation window of the UhtGttvt editor.

The QrvrUrqXvqUryhr dialog box will be displayed. The button opens the QrvrsurUryhr dialog box. General settings for the entire template are made in this dialog. As the IhrsurUryhr, the example uses aFfQ6fUrqryhrf. In the 9vyh box, select the Th7h, a Uvyr7h is not needed. In the Uyih box, the toolbar can be adapted to your needs via the button. In the example, the 6yyxrihqApv checkbox has been selected. Data is to be read from the archive immediately when the vprvrrq. As the 8y, the background color of the picture is set (RGB Value 231/207/199). Apply the settings made by clicking on the PF button.

In the Prh6uvhv box, you can determine, if a change in the configuration data is possible in runtime.

4-8

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)Urq9vyh8svthv

The QrvrvSU check-box allows you to determine, if setting changes made in runtime are to be maintained after a picture change. The QrvrvSUhq 8T 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 QrvrvSUhq8T function has been associated with the @qvUrqUryhr authorization level. This authorization level must first be created in the Vr6qvvh 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 8urPiwrp box.

Select the first trend from the 8urPiwrp box. In the BrrhyDshv tab, the general trend properties are set. In the example, Urq is used as the IhrsurUrq1. In the 9vyh box, select the check-boxes 9vyhUrq, TuhrqY6v and Tuhrq`6v. Set Srq as the trend color.

WinCC Configuration Manual C79000-G8276-C140-01

4-9

ThyrQwrprhyrf

!((

Tr

Qprqr)Urq9vyh8svthv

In the Uht tab, the archive tag displayed by the trend is selected. In the example, the B%#frfytf tag from the aFfQprWhyr6puvrf archive is used.

In the Y6v tab, the properties of the time axis are set. Enter Uvr as the Ghiry of the axis. Select the Vqhr check-box from the Tphyvt box. This determines that the trend

4-10

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)Urq9vyh8svthv

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 UvrShtr check-box and the Hvr entry from the list-box. No changes are needed for the date of the A 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 UvrShtr check-box is not selected, the displayed time range is determined by the time difference resulting from the s and dates. However, this is only the case if the Vqhr check-box has been selected.

In the `6v tab, the properties of the Y-Axis are set. Enter UhtWhyr as the Ghiry of the axis. In the 9vyh field, no grid lines are shown is set. In the Tryrpv field, $ is entered as the Th value and $ as the @q value. Both input fields only become visible, if the 6htr check-box is not selected. Select 8rp9yvrhyas the Urq9vyh.

WinCC Configuration Manual C79000-G8276-C140-01

4-11

ThyrQwrprhyrf

!((

Tr

Qprqr)Urq9vyh8svthv

For this example, filling out the 8yGvvWhyr tab is not necessary. The setting options of this tab are described in the example # "6puvvtvsWhyrv @prrqrqrf"fpuhrf iQ9G in the table Urq9vyh8svthv. 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 Urq9vyh 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 PF and save the changes made in the Uht Gttvt editor via AvyrThr.

10

Ir)

In the example project, the password protected online configuration, configured in step 3, can be accessed via the login name pyyr and the password UhtGttvt. A new user logging in is only recognized by UhtGttvt 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 ""TuqXv88hpprrpv. The "Login" dialog box is opened via the [Ctrl+O] key combination. This key combination can be set in the CFr tab of the projects properties dialog box.

4-12

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Creation of a new picture, in the example, this is the rf"fpuhrf Q9G. In this picture, a ThPiwrp6yvphvXvq is configured. In the example, the 6yvphvXvq object is used. After placing the object in the picture, the Xvq8r dialog box is displayed. Select the UhtGttvt entry. Close the dialog box by clicking on PF.

In the following Uryhr dialog box, select aFfQ6fUrqryhrf trend window template. Close the dialog box by clicking on PF.

In the Graphics Designer, the configured 6yvphvXvq 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 ThPiwrpTh9vyh is placed below the 6yvphv Xvq. It is the Th9vyh 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 Th9vyh 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 Th9vyh are

WinCC Configuration Manual C79000-G8276-C140-01

4-13

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

supplied with values. 3 To be able to use UhtGttvt during runtime, UhtGttvtSvr must be enabled first. To do so, check "Tag Logging Runtime" in the "Startup" tab of the 8rQrvr dialog box. If this is not the case, select the "Computer" entry in the 8y8rr via a and open the 8rQrvrThUhi by clicking on the
8rQrvr

button

button to open the from the dialogs toolbar. Click on the dialog box. In the Th tab, select the UhtGttvt Svr check-box.

Ir)

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

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#

! 8pyvpTryrpvr6puvvtrf"fpuhrf

hQ9G

Uhx9rsvvv

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 Bhuvp9rvtr using your own objects. One diagram is to be displayed for each process value.

WinCC Configuration Manual C79000-G8276-C140-01

4-15

ThyrQwrprhyrf

!((

Dyrrhv8pr

To archive the data to be displayed, a cyclic-selective process value archive is created in the UhtGttvt editor. To realize a graphical display, an hyvphvvq for displaying a trend window is used. This is created in the UhtGttvt editor. The required toolbar is made up of multiple XvqPiwrp7, ThPiwrpTh9vyh and ThPiwrp BhuvpPiwrp, the status bar is realized with two XvqPiwrp7. To control the archive, a project function is needed that starts and stops the archiving process.

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

Open the UhtGttvt editor from the 8y8rr. Create a new QprWhyr6puvr with the archive wizard. In the example, the archive was named aTfQprWhyr6puvrf. For the archiving, the tags B%#frfytf ,B%#frfytf! and B%#frfytf" 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 ppyvpryrpvr as 6puvvt Ur for each of the three tags. This gives you the option of setting a Th@r, as well as a T@r, in the @r tab. In the example, the project function aTfQ6fTh is set as the Th@r. In the 8pyr field, enter $ as the 6pvvv cycle and $ as the 6puvvt 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 7DIvfrfytf. This function is called by UhtGttvt 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

!((

ThyrQwrprhyrf

Urq9vyh8svthv
Tr Qprqr)Urq9vyh8svthv

1 2

Creating a new trend window template. The QrvrUrqXvqUryhr dialog box will be displayed. button opens the QrvrsurUryhr dialog box. The As the template name, the example uses aTfQ6fUrqryhrf. No vyrih, hih or yih is required. As the 8y, 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 Prh6uvhv field. button allows you to add two additional trends. The trends will then be The displayed in the 8urPiwrp window. Select the first trend. In the BrrhyDshv tab, Urq is displayed as the IhrsurUrq. In the 9vyh field, select the 9vyhUrq and 9vyhUrqThttrrq checkboxes. This determines that a separate graph is drawn for each trend. The presettings can be accepted for the remaining settings. In the Uht tab, the B%#frfytf archive tag from the aTfQprWhyr6puvrf archive is selected. The presettings can be accepted in the Y6v tab. In the `6v tab, use the trend name as the Ghiry. In the Tryrpv field, select the 6htr check-box. Enter $ as the Th and $ as the @q value. As the Urq9vyh, select Tuyq. This type of display facilitates the recognition of time periods where no archiving took place. Accept the presettings of the 8yGvvWhyr 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 PF to apply all the settings made. Save the changes made in the Uht Gttvt editor via AvyrThr.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

1 2

In Tag Management, two internal tags of the 7vhUht type are created. In the example, the 7DIvfrfytf and 7DIvfrfytf% tags are used. Creation of a new picture, in the example, this is the rf"fpuhrf hQ9G. In this picture, a ThPiwrp6yvphvXvq is configured. Select Uht Gttvt as the window content and the aTfQ6fUrqryhrf trend window template as the Uryhr. To control the update, a ThPiwrpTh9vyh is configured. In the example, this is the Th9vyh$ object. Via the Th9vyh8svthv dialog box, this object is connected to the 7DIvfrfytf% tag and triggered upon change. The states  and are created and assigned to the corresponding pictures. In the example, the bitmaps yti

WinCC Configuration Manual C79000-G8276-C140-01

4-17

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

and tyti are used.

A 86pv is created at @rHrQrGrs, 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 9vrp8rpv at @rHvpryyhrPr Qvpr of the rf"fpuhrf hQ9G picture object, which sets the status of the tag to . pressing of the
7DIvfrfytf%

Configure a second ThPiwrpTh9vyh following the procedure described in step 3. In the example, this is the Th9vyh% object. It will control the archiving process. The object is connected to the 7DIvfrfytf tag and uses the 6puvri / 6puvrvi bitmaps. A 86pv is created at @rHrQrGrs, which toggles the 7DIvfrfytf tag queried by the aTfQ6fTh 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 XvqPiwrp7 are configured. In the example, these are the 7#, 7&, 7' and 7 objects. 86pv are created at @rHrHr6pv, which simulate the activation of the standard buttons. Additionally, a ThPiwrpBhuvpPiwrp is required that disables the buttons in case of an active update. In the example, this is the BhuvpPiwrp! object. The bitmap displayed by the object shows the four buttons in an inoperational state (Qsrvyrqvi). Create a 9hvp9vhyt at Qrvr

4-18

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr Hvpryyhr

9vyh, which controls the visibility of the buttons depending on the status of the 7DIvfrfytf% tag (this tag contains information about the update).

To display the status bar, two XvqPiwrp7 are configured. In the example, these are the 7$ and 7% objects. 7 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 9hvp9vhyt at the 7$ object at QrvrAUr, which returns to the property, depending on the 7DIvfrfytf tag, either the text 6puvvtThrq or 6puvvtTrq.

Perform the same steps for 7% using the 7DIvfrfytf% tag.


Ir)

The implementation of the buttons for time selection and print preview are explained in greater detail in the Sr9rvtr chapter, example #"$QvPurUrqXvq vSvrrf"fpuhrf hQ9G.

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 UytUrqXvqQrThT7 has the same effect as clicking on the TB7 of the standard toolbar. The transfer parameter indicates the name of the template to which the function call is referring to. Toggles the 7DIvfrfytf% tag to save the current status of the template.

WinCC Configuration Manual C79000-G8276-C140-01

4-19

ThyrQwrprhyrf

!((

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 Av9hhSrpq button of the standard toolbar. The functions used at the other buttons are:
UytUrqXvqQrQr7 UytUrqXvqQrIr7 UytUrqXvqQrGh7

Ir)

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 ByihyTpv editor.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#

" 6puvvtvsWhyrv@prrqrqrf"fpuhrf iQ9G

Uhx9rsvvv

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 pyyr and r as the user names, and htyttvt as the password. The toolbar and status must first be created in the Bhuvp9rvtr. The status bar should contain the name of the currently logged in user.

Dyrrhv8pr

To archive the displayed data, create an acyclic process value archive in the UhtGttvt editor. To implement the graphical display, two hyvphvvq are used. One displays the trend and the other the table window. The rqvqryhr and the hiyrvq ryhr to be displayed are created in the UhtGttvt editor. The required toolbar is made up of multiple XvqPiwrp7, ThPiwrp Th9vyh and ThPiwrpBhuvpPiwrp, the status bar is realized using two XvqPiwrp7. To control the archive, a project function is created. This function triggers the archiving if the process value exceeds a set limit value.

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

Create a new QprWhyr6puvr with the archive wizard. In the example, the archive was named 6afQprWhyr6puvrf. The tag to be archived was B%#vfrfytf#. 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 huvhvyrry for read and write access, set two levels which must first be created in the Vr6qvvh editor.

Accept the presettings for the remaining settings. 3 In the properties dialog box of the process tag, select hppyvp as the 6puvvt Ur. This gives you the option of setting a Th@r in the @r tab. In the example, the project function 6puvr8y is set as the Th@r. Accept the presettings for the remaining settings.

WinCC Configuration Manual C79000-G8276-C140-01

4-21

ThyrQwrprhyrf

!((

"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 vs structure, the value overflow flag rsy 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 rsy be set. This function is automatically invoked by UhtGttvt. Archiving is performed if ur rhyrhsurspvqvssrsurrvphyy (on the other hand, in a cyclic-selective archive, the archiving is started if the return value is TRUE).

Uhiyr9vyh8svthv
Tr Qprqr)Uhiyr9vyh8svthv

Create a new table window template by 5 on the corresponding entry in the navigation window of the UhtGttvt editor.

The QrvrUhiyrXvqUryhr dialog box will be displayed. The button opens the QrvrsurUryhr dialog box. As the template name, the example uses 6afQ6fUhiyrryhr. No vyrih, hih or yih is required. As the 8y, 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

!((

ThyrQwrprhyrf

Tr

Qprqr)Uhiyr9vyh8svthv

3 4

No inputs need to be made in the Prh6uvhv field. In the BrrhyDshv tab, 8y is displayed as the 8yCrhqvt. In the 9vyh field, select the 8yphirrqvrq and Tuhrpy checkboxes. The presettings can be accepted for the remaining settings.

In the Uht tab, the B%#vfrfytf# archive tag from the 6afQprWhyr6puvrf archive is selected.

Click on PF to apply all the settings made.

WinCC Configuration Manual C79000-G8276-C140-01

4-23

ThyrQwrprhyrf

!((

Urq9vyh8svthv
Tr Qprqr)Urq9vyh8svthv

For the B%#vfrfytf# 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 aTfQprWhyr6puvrf archive. Creating a new trend window template. The QrvrUrqXvqUryhr dialog box will be displayed. button opens the QrvrsurUryhr dialog box. The As the template name, the example uses aFfQ6fUrqryhrf . No vyrih, hih or yih is required. As the 8y, 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 Prh6uvhv field. In the BrrhyDshv tab, Urq is displayed as the IhrsurUrq. In the 9vyh field, select the 9vyhrq check-box. Choose blue as the color of the trend. In the Uht tab, the B%#vfrfytf# archive tag from the aFfQprWhyr6puvrf archive is selected. The presettings can be accepted in the Y6v tab. In the Tryrpv field of the `6v tab, deselect the 6htr check-box. Enter   as the Th and  as the @q value. As the Urq9vyh, select Avyyhrh vryhrqrq. This display type allows you to better emphasize areas, where value overflows have occurred. Accept the presettings for the remaining settings. In the 8yGvvWhyr 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

!((

ThyrQwrprhyrf

Tr

Qprqr)Urq9vyh8svthv

Click on PF to apply all the settings made. Save the changes made in the Uht Gttvt editor via AvyrThr.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

In Tag Management, two internal tags of the 7vhUht type are created. In the example, the 7DIvfrfytf% and 7DIvfrfytf& tags are used. Additionally, the 58rVr tag of the type UrUht %7v8uhhprTr, 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 rf"fpuhrf iQ9G. In this picture, a ThPiwrp6yvphvXvq is configured. In the example, this is the 6yvphvXvq object. Select UhtGttvt as the window content and the 6afQ6fUhiyrryhr as the Uryhr. To control the update, a ThPiwrpTh9vyh is configured. In the example, this is the Th9vyh" object. Via the 8svthv9vhyt7, this object is connected to the 7DIvfrfytf% tag and triggered upon change. The states  and are created and assigned to the corresponding pictures. In the example, the bitmaps yti and t yti are used. A 86pv is created at @rHrQrGrs, which simulates the pressing of the
7DIvfrfytf%

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

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

the update of the table window is always initiated at the selection of the picture. This is realized by a 86pv at @rHvpryyhrPrQvpr of the rf"fpuhrf iQ9G picture object, which sets the status of the tag to . 4 Configure a second ThPiwrpTh9vyh following the procedure described in step 3. In the example, this is the Th9vyh! object. This object controls the editability of the table. The object is connected to the 7DIvfrfytf& tag and uses the @qvi / @qv vi bitmaps. A 86pv is created at @rHrQrGrs, which simulates the edit button from the standard toolbar and toggles the status of pressing of the the 7DIvfrfytf& tag. Via QrvrHvpryyhrQhq, set the same authorization level for the 7 as for the archives write access. In the example, this is the @qv Uhiyr authorization level. The status of the 7DIvfrfytf& 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 86pv at @r HvpryyhrPrQvpr of the rf"fpuhrf iQ9G 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 XvqPiwrp7 are configured. In the example, these are the 7#, 7&, 7' and 7 objects. 86pv are created at @rHrHr6pv, which simulate the activation of the standard buttons. Additionally, a ThPiwrpBhuvpPiwrp is required that disables the buttons in case of an active update and active editability. In the example, this is the BhuvpPiwrp! object. The bitmap displayed by the object shows the four buttons in an inoperational state (Qsrvyrqvi). Create a 9hvp9vhyt at QrvrHvpryyhr9vyh, which controls the visibility of the buttons depending on the states of the 7DIvfrfytf% and 7DIvfrfytf& tags. 6 An additional ThPiwrpBhuvpPiwrp is needed that disables the button for controlling the update while editability is active. In the example, this is the BhuvpPiwrp object. Create a 9hvp9vhyt at Qrvr Hvpryyhr9vyh, which makes the object visible if the 7DIvfrfytf& tag receives the status USV@. In the example, the picture to be displayed is the qvyti. The object must be positioned exactly on top of the Th9vyh" object.

Configure two additional XvqPiwrp7 that take on the function and the TryrpUvrShtr of the buttons for opening the parameter dialog boxes. In the example, these are the 7 ! and 7 " objects.

Configure an additional XvqPiwrp7. In the example, this is the

4-26

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

object. This button accesses the TrGtv dialog box. To do so, create a 86pv at @rHrQrGrs, which calls the required API function.
7$

To display the status bar, two XvqPiwrp7 are configured. In the example, these are the 7( and 7  objects. Create a 9hvp9vhyt at the 7  object at QrvrAUr, which returns to the property, depending on the 7DIvfrfytf% tag, either the text VqhrThrq or VqhrTrq. At 7( at QrvrAUr, configure a htprpv to the 58rVr tag and set the trigger to "upon change". Clicking on this button displays the name of the current user. Configure an additional ThPiwrp6yvphvXvq . In the example, this is the 6yvphvXvq! object. Select UhtGttvt as the window content and the aFfQ6fUrqryhrf as the Uryhr.

10

Ir)

The usage and changing of data is password protected. In the example project, access to the archive data is gained via the login name r and the password htyttvt. Via the login name pyyr and the password htyttvt, 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 UytUrqXvqQr@qv7 has the same effect as clicking on the @qv7 of the standard toolbar. The transfer parameter indicates the name of the template to which the function call is referring to. Toggles the 7DIvfrfytf& tag to save the current status of the edit function.

WinCC Configuration Manual C79000-G8276-C140-01

4-27

ThyrQwrprhyrf

!((

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 Av9hhSrpq button of the standard toolbar. The functions used at the other buttons are:
UytUrqXvqQrQr7 UytUrqXvqQrIr7 UytUrqXvqQrGh7 UytUhiyrXvqQrPr9yt7 UytUhiyrXvqQrPrUvrTryrp9yt7 UytUhiyrXvqQrThT7

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 QXSUGtv. Call of the API function for opening the TrGtv dialog box.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#

# Vrqrsvrqhiyryhrf"fpuhrf

pQ9G

Uhx9rsvvv

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 Bhuvp 9rvtr editor. A table has to be created in the Graphics Designer if the standard tools of UhtGttvt are insufficient to realize a table layout.

Dyrrhv8pr

To archive the data, create a cyclic-continuous process value archive in the UhtGttvt editor. To implement the graphical display, each line of the table uses, depending on the type of data to be displayed, either a ThqhqPiwrpThvpUr or a ThPiwrpDPAvryq . The data is read from the database table of the appropriate archive via API functions.

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

In Tag Management, create three tags of the type AyhvtQvIir%#7v D@@@&$#. In the example, these are the B%#vfrfytf$, B%#vfrfytf% and B%#vfrfytf& tags. The archived values are to be written into these tags (in addition). Create a new QprWhyr6puvr with the archive wizard. In the example, the archive was named aFfQprWhyr6puvrf!. As the archiving tag, the B%#vfrfytf# 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 BrrhyDshv tab of the first process tags properties dialog box, enter HhvWhyr as the Ihrsur6puvrUht. In the 6yhpuvrq hyrvht field, select the B%#vfrfytf& tag. This tag allows you to react to the archiving of a value with a 86pv. This is accomplished, if the 86pv is triggered upon the change of this tag. In the 8pyr field of the Qhhrr tab, set the 6pvvv to $ and the 6puvvt to !$. In the Qprvt field, select the HhvWhyr 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

ThyrQwrprhyrf

!((

Tr

Qprqr)8rhvshQprWhyr6puvr

The presettings can be accepted for the remaining settings. Carry out step 3 to 4 for the two other archive tags. However, for Qprvt select HvvWhyr and HrhWhyr. The Ihrs ur6puvrUht should reflect this selection.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

1 2

In Tag Management, two internal tags of the 7vhUht type are created. In the example, these are the 7DIvfrfytf% and AG6BfUhiyrBrPWhyr tags. Create a project function which instructs UhtGttvt 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 @rhrTr6puvr9hh and Br6puvr9hh8hyyihpx 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 86pv at @r HvpryyhrPrQvpr of the rffhvprfQ9G start picture. In the example, this function is named 8rhr@rhy.

Creation of a new picture, in the example, this is the rf"fpuhrf iQ9G. The user defined table should be able to display 10 lines. To display data in the first column, 10 (one for each line) ThqhqPiwrpThvpUr are used, which display the time and date. For the additional columns, ThPiwrp DPAvryq are used. As object names in the first column, use ThvpUr to ThvpUr , where the number defines the line. The numbering is from bottom to top, since the last line contains the most current data. The DPAvryq 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

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

Create a 86pv for each ThvpUr at QrvrAUr. 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 AG6BfUhiyrBrPWhyr 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 86pv for each DPAvryq at Qrvr PDPWhyr. This function also has the task to read the data record, assigned to their object, from the callback function. To control the update, a ThPiwrpTh9vyh is configured. In the example, this is the Th9vyh" object. Via the 8svthv dialog box, this object is connected to the 7DIvfrfytf% tag and triggered upon change. The states  and are created and assigned to the corresponding pictures. In the example, the bitmaps yti and t yti are used. Create a 86pv at @rHrQrGrs, which toggles the status of the 7DIvfrfytf%. The status USV@ means that the update has been started. The status of this tag should be USV@ 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 86pv at @rHvpryyhrPrQvpr of the rf"fpuhrf pQ9G picture object. This 86pv sets the status of the tag to USV@ and reads the archive one time.

Create a 86pv for Thqvyh" at QrvrBrrXvqu. This action will, depending on the status of the 7DIvfrfytf% tag, read the archive and toggle the AG6BfUhiyrBrPWhyr tag to initiate the update of the table. The 86pv is triggered upon the change of the B%#vfrfytf& 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 B%#vfrfytf& tag is set to a value, which can not be attained

WinCC Configuration Manual C79000-G8276-C140-01

4-31

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

by the process value to be archived, after each pass of the 86pv. 7 To be able to navigate in the archive while the update is stopped, four navigation buttons are required. To implement this, four XvqPiwrp7 are configured. In the example, these are the 7(, 7 , 7 and 7 ! objects. Create 86pv at @rHrHr6pv. These actions write a new value to the external C tag qPssr. Additionally, the trigger tag AG6BfUhiyrBrPWhyr is toggled to achieve an update of the display. Also, a ThPiwrpBhuvpPiwrp is required that disables the buttons in case of an active update. In the example, this is realized via the BhuvpPiwrp! object. The bitmap displayed by the object shows the four buttons in an inoperational state (Qsrvyrqvi). At QrvrHvpryyhr9vyh, create a htprpv to the 7DIvfrfytf% 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

!((

ThyrQwrprhyrf

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 8hyy. This function calls the Br6puvr9hh8hyyihpx function, which sets a value of 0 for the yVr parameter. Establishes the connection to UhtGttvt. If this fails, the function is aborted. Reading of the archived values of the of the HhWhyr, HvWhyr and HrhWhyr archive tags via the UGBBr6puvr9hh function. Determines the number of values read. This is done via the help function 8hyy, which calls the Br6puvr9hh8hyyihpx function and sets a value of 4 for the yVr parameter. Abortion of the connection to UhtGttvt.

WinCC Configuration Manual C79000-G8276-C140-01

4-33

ThyrQwrprhyrf

!((

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

!((

ThyrQwrprhyrf

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 yVr contains the value 1, 2 or 3, the function has been called by Tag Logging. In this case, the transferred structure yB69 will be stored in the corresponding archive. If the transfer parameter yVr 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 yVr contains the value 4, the number of stored values is requested. This number is then stored in the transferred structure as the structure member qAyht. If the transfer parameter yVr contains the value 7, the stored tag value of an DPAvryq or ThvpUr object is requested. From which position of the table the tag is requested, is determined by the transferred structure via the UvrHu and Uvr9h structure members.

WinCC Configuration Manual C79000-G8276-C140-01

4-35

ThyrQwrprhyrf

!((

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 UvrHu and Uvr9h structure members of the B69 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 Br6puvr9hh8hyyihpx function is called with a yVr transfer parameter value of 7, i.e. a value is requested. The date value of the transferred structure B69 is stored in the Uvr structure member. From this, the text to be displayed is formed. The text is returned to the property via r.

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

!((

ThyrQwrprhyrf

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 UvrHu and Uvr9h structure members of the B69 structure to be transferred are supplied with the column number or calculated data record number. The Br6puvr9hh8hyyihpx function is called with a yVr transfer parameter value of 7, i.e. a value is requested. The tag value of the transferred structure B69 is stored in the qWhyr structure member and is used as a return value.
Ir)

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 #$"9vhyt7rsTrvt8y rf"fpuhrf p.

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#

$ 6puvvtsivhhtrf"fpuhrf

qQ9G

Uhx9rsvvv

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.

Dyrrhv8pr

To archive the data to be displayed, create a cyclic-continuous process value archive for three binary tags in the UhtGttvt editor. Create a separate table window template for each tag. To realize the graphical display, a ThPiwrpQvprXvq is used, which displays a different picture depending on the selected motor. Each of the pictures contains a Th Piwrp6yvphvXvq, which will display the table window template.

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

Creation of four tags in "Tag Management". In the example, these are the 7DIvfrfytf ,7DIvfrfytf! and 7DIvfrfytf" tags of the 7vhUht type, and the V'vfrfytf tag of the Vvtrq'7vWhyr type. Create a new QprWhyr6puvr with the archive wizard. In the example, the archive was named aFfQprWhyr6puvrf". For the archiving, the 7DIvfrfytf ,7DIvfrfytf! and 7DIvfrfytf" 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 Qhhrr tab, select rrvthypuhtr from the 6puvvt field. In the IhrsThr field, enter HPss for Thr and HP for Thr . In the 8pyr field, set the 6puvvt to $. 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

!((

ThyrQwrprhyrf

Tr

Qprqr)8rhvshQprWhyr6puvr

Uhiyr9vyh8svthv
Tr Qprqr)Uhiyr9vyh8svthv

Creating a new table window template. The QrvrUhiyrXvqUryhr dialog box will be displayed. The button opens the Qrvrsur Uryhr dialog box. As the template name, the example uses aFfQ6fUhiyrryhrf"h. A vyrih and yih is required. Select the following elements for the yih 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 Prh6uvhv field. In the BrrhyDshv tab, enter Thr as the 8yCrhqvt. In the 9vyh field, select the Tuhr8y check-box. Also select the Uvrhtr check-box and set 9h. The presettings can be accepted for the remaining settings.

2 3

WinCC Configuration Manual C79000-G8276-C140-01

4-39

ThyrQwrprhyrf

!((

Tr

Qprqr)Uhiyr9vyh8svthv

In the Uht tab, the B%#vfrfytf archive tag from the aFfQprWhyr6puvrf" archive is selected. Click on PF 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 aFfQ6fUhiyrryhrf"i and aFfQ6fUhiyrryhrf"p for the other templates.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

A separate picture must be created for each table template. In the example, these are the rf%fhyvphvf, rf%fhyvphvf and rf%fhyvphvf! pictures. Each of these pictures contains a ThPiwrp6yvphvXvq. For each of these objects, UhtGttvt is set as the Xvq8r and one of the previously created table templates as the Uryhr. The geometry of the pictures is tuned to the geometry of the 6yvphvXvq. Creation of a new picture, in the example, this is the rf"fpuhrf picture.
qQ9G

2 3

The motors to be displayed each consist of a ThqhqPiwrp8vpyr, a ThqhqPiwrpQyt and a ThqhqPiwrpThvpUr. The background color of the circle is changed via a 9hvp9vhyt depending on the status of the motor. These three objects are grouped. In the example, these are the B , B! and B" objects. Each of these objects has a 9vrp8rpv at @r HrHr6pv, which writes the number of the motor to the V'vfrfytf tag. Two XvqPiwrp7 are assigned to each motor. These buttons control the tags assigned to the motors via 9vrp8rpv. To be able highlight the currently selected motor, assign each motor a Thqhq PiwrpSrphtyr.
Qrvr

4 5

Select the dotted line via QrvrTyrGvrTyr and Uhhr via TyrAvyyQhr.

Use a 9hvp9vhyt (for each rectangle) at QrvrHvpryyhr to make the Srphtyr only visible if the content of the V'vfrfytf tag agrees with its own object number.
9vyh

Configure a ThPiwrpQvprXvq , in the example, the Qvpr Xvq object is used. Via QrvrHvpryyhr, set the Hhiyr, 7qr, Uvyr and 8h7r 8yrq properties to r. Create a 9hvp9vhyt at QrvrHvpryyhr9vyh, which makes the QvprXvq visible if the V'vfrfytf tag has a value greater than 0, i.e. a motor has been selected. Create a 9hvp9vhyt at QrvrHvpryyhrQvprIhr, which, depending on the content of the V'vfrfytf tag, displays the

4-40

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

corresponding picture in the QvprXvq.

Create a 86pv at @rQrUvpHvpryyhr9vyh, which sets the V'vfrfytf tag to 0 if the QvprXvq is invisible. This ensures that the selection frame around the current motor is also invisible.

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#

% 6puvvthTrUvrrf"fpuhrf rQ9G

Uhx9rsvvv

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.

Dyrrhv8pr

To archive the displayed data, create a cyclic-continuous process value archive in the Uht Gttvt editor. To archive at every full minute, a new 8pyrUvr 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 Bhuvp 9rvtr via a ThPiwrp6yvphvXvq.

8rhvthr8pyrUvr
Tr Qprqr)8rhvthr8pyrUvrUvr

Open the UhtGttvt editor from the 8y8rr. Create a new Uvr by on this point in the navigation window.

85

The properties dialog box of the new Uvr will be displayed. The example uses vTh) as the hr of the Uvr. As the 7hr select Hvr and as the Ahp choose . The Ahp also allows you to configure, for example, cycles of 4 or 6 minutes. In the ThvtQvsur8pyr field, select the @rurThvtQvsur8pyr 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

!((

ThyrQwrprhyrf

Tr

Qprqr)8rhvthr8pyrUvrUvr

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

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

Create a new QprWhyr6puvr with the archive wizard. In the example, the archive was named aFfQprWhyr6puvrf&. For the archiving, the tags B%#frfytf , B%#frfytf! and B%#frfytf" are selected. In the example project, these tags are supplied with values by the simulator.

WinCC Configuration Manual C79000-G8276-C140-01

4-43

ThyrQwrprhyrf

!((

Tr

Qprqr)8rhvshQprWhyr6puvr

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 Qhhrr tab, select * v Trpq as the 6pvvv cycle in the 8pyr field. As 6puvvt, set Th). Select T in the Qprvt 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.

Uhiyr9vyh8svthv
Tr Qprqr)Uhiyr9vyh8svthv

Creating a new table window template. The QrvrUhiyrXvqUryhr dialog box will be displayed. The button opens the Qrvrsur Uryhr dialog box. As the template name, the example uses aFfQ6fUhiyrryhrf&. A hih and yih is required. Select the desired elements for the yih via the button. No inputs need to be made in the Prh6uvhv field. The button allows you to add two additional columns. The columns will

2 3

4-44

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)Uhiyr9vyh8svthv

then be displayed in the 8urPiwrp window. Select the first column. In the BrrhyDshv tab, enter B%#frfytf as the 8yCrhqvt. In the 9vyh field, select the Tuhr8y check-box. Also select the Uvrhtr check-box and set C. The presettings can be accepted for the remaining settings. 4 In the Uht tab, the B%#frfytf archive tag from the aFfQprWhyr6puvrf& archive is selected. Click on PF to apply all the settings made. Carry out step 3 to 4 for the second and third column. However, the 8y Crhqvt and 6puvrUht 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.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Creation of a new picture, in the example, this is the rf"fpuhrf rQ9G picture. In this picture, a ThPiwrp6yvphvXvq is configured. In the example, this is the 6yvphvXvq object. Select UhtGttvt as the window content and the aFfQ6fUhiyrryhrf&as the Uryhr.

Ir)

A brief explanation about the other configuration settings made for the rf"fpuhrf rQ9G picture in the Bhuvp9rvtr can be found in example #$# 7hBhu9vyhrf"fpuhrf r.

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#

& @vth6puvrrf"fpuhrf

sQ9G

Uhx9rsvvv

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.

Dyrrhv8pr

To archive the displayed data, create a cyclic-continuous process value archive in the Uht Gttvt 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 XvqPiwrp7 and ThPiwrpTh9vyh.

8rhvshQprWhyr6puvr
Tr Qprqr)8rhvshQprWhyr6puvr

Create a new QprWhyr6puvr with the archive wizard. In the example, the archive was named aFfQprWhyr6puvrf#. The tag to be archived was B%#vfrfytf#. 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 6pvs@vturTuUr6puvr, the project function 6pvA@vt6puvr is set.

Accept the presettings for the remaining settings. 3 Accept the presettings for the properties dialog box of the process tag.

Urq9vyh8svthv
Tr Qprqr)Urq9vyh8svthv

Creation of a new table window template. The QrvrUhiyrXvq dialog box will be displayed. The button opens the dialog box. As the template name, the example uses aFfQ6fUrqryhrf#. No vyrih, hih or yih is required. Accept the presettings for the remaining settings.
Uryhr QrvrsurUryhr

2 3

No inputs need to be made in the Prh6uvhv field. In the BrrhyDshv tab, Urq is displayed as the IhrsurUrq. In

4-46

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)Urq9vyh8svthv

the 9vyh field, select the 9vyhUrq and 9vyhUrqWrvphyy checkboxes, and then the sur radio-button. In the Uht tab, the B%#vfrfytf# archive tag from the aFfQprWhyr6puvrf# archive is selected. In the Y6v tab, select the Vqhr check-box in the Tphyvt field and deselect the remaining check-boxes. In the Tryrpv field of the `6v tab, deselect the 6htr check-box. Enter   as the Th and  as the @q value. As the Urq9vyh, select Trrq Urq. Accept the presettings for the remaining settings. Accept the presettings of the 8yGvvWhyr tab. 4 Apply the settings made by clicking on PF and save the changes made in the Uht Gttvt editor via AvyrThr.

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

ThyrQwrprhyrf

!((

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 UhtGttvt via the UGB8rp function. Determination of the size of the data to be exported via the UGB7hpxTvr function. This value is stored in an internal tag. Exporting of the archive via the UGB7hpx function and setting of the 7DIvfrfytf( binary tag, which makes the export visible.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

In Tag Management, three tags of the 7vhUht type are created. In the example, the 7DIvfrfytf%,7DIvfrfytf' and 7DIvfrfytf( tags are used. In addition, the V %vfrfytf tag of the Vvtrq %7vWhyr type is required. Creation of a new picture, in the example, this is the rf"fpuhrf sQ9G. In this picture, a ThPiwrp6yvphvXvq is configured. In the example, this is the 6yvphvXvq object. Select UhtGttvt as the window content and the aFfQ6fUrqryhrf#as the Uryhr. The implementation of a toolbar has already been explained in detail in the # " 6puvvtvsWhyrv@prrqrqrf"fpuhrf iQ9G example. This chapter will only describe the newly added control elements. To control the archiving, a XvqPiwrp7 is configured. In the example, this is the 7 % object. A 86pv is created at @rHrQrGrs, which toggles the 7DIvfrfytf' tag and calls the GpxVypx6puvr project function. The binary

4-48

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

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 rf$fvqf"Q9G. This picture contains a ThqhqPiwrpThvpUr, which displays a text via a 86pv. This text consists of a fixed part and the number value of the V %vfrfytf tag. The number value contains the size of the exported data. Additionally, the picture contains a XvqPiwrp7 and ThPiwrp BhuvpPiwrp, which both turn the 7DIvfrfytf( tag to the constant  via a 9vrp8rpv at @rHrHr6pv.

Configure a ThPiwrpQvprXvq in the initial picture, in the example, the QvprXvq object is used. At QrvrHvpryyhr QvprIhr, set the rf$fvqf"Q9G. At QrvrHvpryyhr 9vyh, create a htprpv to the 7DIvfrfytf( tag. To display the status bar, two XvqPiwrp7 are configured. In the example, these are the 7 # and 7 & objects. Create a 9hvp9vhyt at the 7 & object at QrvrAUr, which returns to the property, depending on the 7DIvfrfytf% tag, either the text VqhrThrq or VqhrTrq. Create a 9hvp9vhyt at the 7 # object at QrvrAUr, which returns to the property, depending on the 7DIvfrfytf' tag, either the text 6puvr@hiyrq or 6puvrGpxrq.

WinCC Configuration Manual C79000-G8276-C140-01

4-49

ThyrQwrprhyrf

!((

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 UhtGttvt. Call of the UGBGpx6puvr function. The iGpx transfer parameter decides whether the archive is to be locked or enabled.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#! 6yhGttvt

In runtime, the examples to this topic can be selected by clicking on the button displayed . The examples are configured in the pictures rf"fpuhrf!Q9G to above with the rf"fpuhrf!qQ9G.

BrrhyDshv

The 6yhGttvt 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 6yhGttvt supports the search for causes of errors.

WinCC Configuration Manual C79000-G8276-C140-01

4-51

ThyrQwrprhyrf

!((

#!

7vHrhtrQprqrrf"fpuhrf!Q9G

Uhx9rsvvv

Four motors are to be monitored by 6yhGttvt. 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.

Dyrrhv8pr

A message window template is created in 6yhGttvt. Additionally, several single messages must be created that refer to the monitored motors. The message window is created in the Graphics Designer via a ThPiwrp6yvphv Xvq. The individual motors consist of multiple ThqhqPiwrp. 86pv change the displays of the motors for the various message states.

TrsurSrvrqUht
Tr Qprqr)TrsurSrvrqUht

In Tag Management, set up a total of twelve tags of the Vvtrq %7vWhyr type. Four of these tags serve as event tags. In the example, these are the V %vfrfhytf,V %vfrfhytf",V %vfrfhytf% and V %vfrfhytf( tags. Four tags serve as status tags. In the example, these are the V %vfrfhytf!, V %vfrfhytf$,V %vfrfhytf' and V %vfrfhytf tags. The remaining tags serve as acknowledgment tags. In the example, these are the V %vfrfhytf !, V %vfrfhytf ",V %vfrfhytf # and V %vfrfhytf $ tags.

4-52

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

BrrhyDshv

A message consists of several message blocks. These message blocks can be divided into three groups: Tr7ypx: These blocks contain system data assigned by 6yhGttvt. This includes date, time, report ID, etc. : These blocks contain the values transmitted from the process, e.g. critical fill levels, temperatures, etc.
QprWhyr7ypx VrUr7ypx: These blocks contain texts which provide general information and aid the understandability, e.g. error explanations, message sources, point of error, etc.

Hrhtr7ypx8svthv
Tr Qprqr)Hrhtr7ypx8svthv

In the 8y8rr, open the 6yhGttvt editor via a

85

Selection of the required message blocks. Open the 8svtrHrhtr7ypx dialog box via Hrhtr7ypx 5.

By

Hrhtr

8'

on one of the three entries in the 6hvyhiyrHrhtr7ypxvur window, the already selected message blocks become visible.

WinCC Configuration Manual C79000-G8276-C140-01

4-53

ThyrQwrprhyrf

!((

Tr

Qprqr)Hrhtr7ypx8svthv

Once a Tr7ypx, VrUr7ypx or QprWhyr7ypx 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

!((

ThyrQwrprhyrf

Tr

Qprqr)Hrhtr7ypx8svthv

The button moves a message block highlighted in the left window to the right window, and thus selects it. Clicking on PF applies the settings made. In the 8svtrHrhtr7ypx 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 PF applies the settings made in the Hrhtr7ypx dialog boxes. The 8svtrHrhtr7ypx dialog box is also exited by clicking on PF. 3 The settings made can also be displayed by

8'

on the Hrhtr7ypx entry.

WinCC Configuration Manual C79000-G8276-C140-01

4-55

ThyrQwrprhyrf

!((

Tr

Qprqr)Hrhtr7ypx8svthv

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

If one of the three sub-entries, Tr7ypx, Vrr7ypx or QprWhyr , the right window will display the selected 7ypx, 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 Hrhtr7ypx 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

!((

ThyrQwrprhyrf

TrshrHrhtrGvrAh
Tr Qprqr)TrshrHrhtrGvrAh

The 6yhGttvt editor must still be open. Create a new message line format by on the HrhtrGvrAh entry.

85

The HrhtrGvr dialog box will be displayed. As the IhrsurHrhtr GvrAh, the example uses Gvrf. As the @yrrsurHrhtr, select the Iir, 9hr, Uvr, Qvs@ and HrhtrUr message blocks via the button.

The move and move q buttons allow you to change the order of the selected message blocks. Clicking on PF applies the settings made and exits the dialog box. 2 If the HrhtrGvrAh entry is selected with the display all available message line formats.

, the right window will

WinCC Configuration Manual C79000-G8276-C140-01

4-57

ThyrQwrprhyrf

!((

Tr

Qprqr)TrshrHrhtrGvrAh

8' 85
or

on the appropriate icon opens the HrhtrGvr dialog box.

BrrhyDshv

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.

TrsHrhtrXvqUryhr
Tr Qprqr)TrsHrhtrXvqUryhr

The 6yhGttvt editor must still be open. Create a new message window template by Uryhr entry.

85

on the HrhtrXvq

The 8svtrHrhtrXvq dialog box will be displayed. 2 In the BrrhyDshv tab, enter HrhtrXvqf in the Xvq entry field and HHrhtrXvq in the XvqUvyr entry field. In runtime, the XvqUvyr will be displayed if the 6yvphvXvq displaying this template is configured with Uvyr. If no text is entered in the window title entry field, the content of the Xvq entry field is used as the XvqUvyr. As the XvqUr, select HrhtrXvq. The Tryrpv is performed after the single messages have been configured.

4-58

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)TrsHrhtrXvqUryhr

In the HrhtrGvr tab, a message line format is selected. In the example, the Gvrf message line format has been selected. A new message line format can be created by clicking on the Ir button.

In the Qhhrr tab, the appearance of the message window is defined. In the TrhhvGvr field, select the Cvhy and Wrvphy check-boxes. This means that the table will be displayed with horizontal and vertical separation

WinCC Configuration Manual C79000-G8276-C140-01

4-59

ThyrQwrprhyrf

!((

Tr

Qprqr)TrsHrhtrXvqUryhr

lines. In the Tryrpv field, select ITryrpv. This defines that - in runtime - single messages can only be selected by using buttons on the toolbar, not with the mouse. Select the GvrUvyr and 8yUvyr check-boxes. Select the 6Tpyyvt check-box.

In the Th7h tab, select the 9vyhTh7h check-box. In the 6yvtr field, select 7. As @yrrsurTh7h, select the 9hr, Uvr and IirsHrhtrvurXvq check-boxes.

4-60

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)TrsHrhtrXvqUryhr

In the Uyih tab, select the 9vyhUyih check-box. In the 6yvtr field, select U. The following FrihqApv 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

ThyrQwrprhyrf

!((

Tr

Qprqr)TrsHrhtrXvqUryhr

, the right If the HrhtrXvqUryhr entry is selected with the window will display all available message window templates.

8' 85
or dialog box.

on the appropriate icon opens the 8svtrHrhtrXvq

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

!((

ThyrQwrprhyrf

Tr

Qprqr)TrsHrhtrXvqUryhr

Ir)

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 6yhGttvt can also be performed, in a very simplified and abbreviated form, by the Message Wizard. This wizard is activated via the menu points Avyr ThHrhtrXvhq. 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 " 8svtvtrhtr.

WinCC Configuration Manual C79000-G8276-C140-01

4-63

ThyrQwrprhyrf

!((

#!! 7vHrhtrQprqr8vrq

TrsTvtyrHrhtr
Tr Qprqr)TrsTvtyrHrhtr

In the 6yhGttvt 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 TvtyrHrhtr dialog box. This dialog 5 on the corresponding message line. box is accessed via a

Access the TvtyrHrhtr dialog box as described in the previous step. In the Qhhrr tab, select @ as the message class and Ahvyr as the message type. In the UuvHrhtr field, select the vyyirhpuvrq and vyyirrrq checkboxes. In the 8rpv field, select the V %vfrfhytf tag as the @rUht and enter  as the @r7v. This means that the message will be generated if the first bit of the set tag assumes the status of 1. Select the V %vfrfhytf ! tag as the 6pxyrqtrUht and enter  as the 6pxyrqtr7v. This means that the first bit of the set tag will be set to 1 if the message is acknowledged in runtime. Select the V %vfrfhytf! tag as the ThUht and enter  as the Th7v. This setting effects that the first bit of the set tag is representing the 8hr DXrPTh 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 6pxyrqtrTh 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 8hrDXrPThr, the high-byte the 6pxyrqtr
Thr

4-64

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)TrsTvtyrHrhtr

In the Ur tab, enter Drypx@ as the HrhtrUr and H as the Qvs@. No Dsr is used.

No entries need to made in the Uht6pv tab. Apply the settings made by clicking on the PF 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 @r7v, 6pxyrqtr7v and Th7v have to be adjusted. Additionally, Arrqihpx @ and 7vrhy@ are used as the HrhtrUr. The other three motors also require three message lines each.

WinCC Configuration Manual C79000-G8276-C140-01

4-65

ThyrQwrprhyrf

!((

Tr

Qprqr)TrsTvtyrHrhtr

The @rUht, 6pxyrqtrUht and ThUht, as well as the texts for the Qvs@, 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, BrrhyDshv tab, of the created message window template. To do so, open the appropriate properties dialog box. In the BrrhyDshv tab, clicking on the accesses the TrurTryrpv 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 Iir system block. A selecting a block with the , all possible selections are displayed in the right side of the window. For the Iir system block, a ThWhyr and a TWhyr can be entered - the message numbers lie in this range. In the example, is entered as the ThWhyr and ! as the TWhyr.

8'

on the Tr7ypx folder displays all available system blocks. By

Close the properties dialog box by clicking on PF. If a selection has been made, a check-mark
8svtrHrhtrXvq

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

4-66

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

8svthvsursurHrhtr8yTpurr
Tr Qprqr)8svthvsursurHrhtr8yTpurr

The configured single messages are of the @ message class and the Ahvyr message type.

on the Hrhtr8yhr entry to display all available message classes in the on the message class icon @ to display all available or on the message type icon Ahvyr opens the Ur

right window.

message types. dialog box.

8' 8' 85

In the Ur 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

ThyrQwrprhyrf

!((

Tr

Qprqr)8svthvsursurHrhtr8yTpurr

The configurations made in 6yhGttvt are saved via the AvyrThr menu points.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Each motor to be displayed consist of a ThqhqPiwrp8vpyr, a Thqhq PiwrpQyt and a ThqhqPiwrpThvpUr.

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 86pv for the ThvpUr at Qrvr8yA 8y, which changes the font color depending on the current state of the motors status tag. In the same manner, create a 86pv for the 8vpyr at Qrvr8y 7hpxtq8y. 2 The occurrence of an error at a motor is simulated using a XvqPiwrp 8urpx7. At QrvrBrrIirs7r enter ".

4-68

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

At QrvrPDTryrprq7r, create a Uht8rpv to the corresponding event tag of the motor. 3 To display the created message window template, a ThPiwrp6yvphv Xvq is configured. In the example, the 6yvphvXvq object is used. After placing the object in the picture, the Xvq8r dialog box is displayed. Select the 6yhGttvt entry. Close the dialog box by clicking on PF.

In the following Uryhr dialog box, select HrhtrXvqf trend window template. Close the dialog box by clicking on PF.

In the Graphics Designer, the configured 6yvphvXvq will be displayed as a gray rectangle. The rectangle will be labeled with the name of the selected trend window template. At QrvrHvpryyhr, set the 7qr and Uvyr properties of the 6yvphvXvq object to `r.

To be able to use 6yhGttvt during runtime, 6yhGttvtSvr must be enabled first. To do so, check "Alarm Logging Runtime" in the "Startup" tab of the 8rQrvr dialog box. If this is not the case, select the "Computer" entry in the 8y8rr via a and open the 8rQrvrThUhi by clicking on the button

WinCC Configuration Manual C79000-G8276-C140-01

4-69

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

from the dialogs toolbar. Click on the button to open the 8rQrvr dialog box. In the Th tab, select the 6yhGttvt Svr 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 86pv adds dynamics to the background color property of the 8vpyr assigned to the first motor. The V %vfrfhytf! 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 86pv is triggered upon the change of the V
%vfrfhytf!

status tag.

4-70

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

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 86pv adds dynamics to the font color property of the ThvpUr assigned to the first motor. The V %vfrfhytf! 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 86pv is triggered upon the change of the V
%vfrfhytf!

status tag.

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#!" 6hyt6yhrf"fpuhrf!hQ9G

Uhx9rsvvv

The pressure and temperature values of three containers are to be monitored by 6yh Gttvt. 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 Bhuvp9rvtr. 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.

Dyrrhv8pr

A message window template is created in 6yhGttvt. Additionally, several single messages must be created that refer to the three monitored containers. In the Bhuvp9rvtr, the message window is displayed using a ThPiwrp 6yvphvXvq. The height of this window, controlled by a 86pv, depends on the on the number of messages. The background of this table is formed by a ThPiwrp BhuvpPiwrp. The toolbar consists of multiple XvqPiwrp7 and Th PiwrpTh9vyh.

TrsurSrvrqUht
Tr Qprqr)TrsurSrvrqUht

In Tag Management, set up a total of six tags of the Vvtrq %7vWhyr type. Three of these tags contain the temperature values of the individual containers. In the example, these are the V %vfrfhytf ,V %vfrfhytf! and V %vfrfhytf" tags. The remaining three tags contain the pressure values. In the example, these are the V %vfrfhytf ,V %vfrfhytf! and V %vfrfhytf" tags. Three additional tags of the Vvtrq %7vWhyr tags are required that serve as status tags. In the example, these are the V %vfrfhytf ,V %vfrfhytf# and V %vfrfhytf& tags. One additional tag of the Vvtrq %7vWhyr type is needed to control a central signaling device. In the example, this is the V %vfrfhytf  tag. Two 7vhUht are required. In the example, these are the 7DIvfrfhytf and 7DIvfrfhytf" tags.

Ir)

The configurations carried out in the 8svtrHrhtr7ypx table example are considered complete and will not be described again.

4-72

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

TrshrHrhtrXvqUryhr
Tr Qprqr)TrshrHrhtrXvqUryhr

Open the 6yhGttvt 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 Hrhtr7ypx Access the 8svtrHrhtr7ypx dialog box by entry. Select the QprWhyr7ypx entry from the list and access the 6qq
button. QprWhyr7ypx dialog box by clicking on the This will add a new process value block. Close the dialog box by clicking on PF.

8'

on the QprWhyr7ypx entry will display the new block. If you select

this block, its properties can be displayed by clicking on the button. In the example, Whyr has been entered as the Ihr of the block and $ has been set as its Grtu.

Clicking on PF accepts the settings made in the Hrhtr7ypx and 8svtr Hrhtr7ypx dialog boxes. 2 Since a new message block has been configured, a new message line format is needed. The Gvrf format, created in the first example, can not be used anymore. Create a new message line format by

85

on the HrhtrGvrAh entry.

The HrhtrGvr dialog box will be displayed. As the IhrsurHrhtr GvrAh, the example uses Gvrf . As the @yrrsurHrhtr, select the Iir, 9hr, Uvr, Qvs@, HrhtrUr and Whyr message blocks

WinCC Configuration Manual C79000-G8276-C140-01

4-73

ThyrQwrprhyrf

!((

Tr

Qprqr)TrshrHrhtrXvqUryhr

via the button. Clicking on PF applies the settings made and exits the dialog box. 3 Create a new message window template by Uryhr entry.

85

on the HrhtrXvq

The 8svtrHrhtrXvq dialog box will be displayed. 4 In the BrrhyDshv tab, enter HrhtrXvqf in the Xvq entry field. A separate XvqUvyr is not needed. As the XvqUr, select HrhtrXvq. The Tryrpv is performed after the single messages have been configured. In the HrhtrGvr tab, select the Gvrf message line format. In the Qhhrr tab, the appearance of the message window is defined. In the TrhhvGvr field, select the Cvhy and Wrvphy check-boxes. In the Tryrpv field, select Gvr. This determines that in runtime individual message lines can be selected using the mouse if 6Tpyyvt is turned off. Deselect the GvrUvyr and 8yUvyr check-boxes. Select the 6Tpyyvt check-box. In the Th7h and Uyih tabs, deselect the check-boxes for displaying the status bar and toolbar. Close the dialog box by clicking on PF.

BrrhyDshv

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

!((

ThyrQwrprhyrf

TrshrHrhtr8yh
Tr

85

Qprqr)TrshrHrhtr8yh

on the Hrhtr8yhr entry to access the 6qqHrhtr8yh dialog box.

Clicking on the button adds a new message class. The dialog box is closed by clicking on PF. 2 including newly created ones, in the right window. 5 on one of the message class icons to open the 8svtrHrhtr8yhr dialog box.

on the Hrhtr8yhr entry to display all available message classes,

In the BrrhyDshv tab, enter 8hvr@ as the Ihrsur8yh. Access the 6qqHrhtrUr 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 PF. Select one of the two new message types from the HrhtrUr field and button. display its properties by clicking on the Enter 8hvr6yh 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 8hvrXhvt 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

ThyrQwrprhyrf

!((

Tr

Qprqr)TrshrHrhtr8yh

In the 6pxyrqtrr tab, select the 6pxyrqtrr8hrD check-box from the 6pxyrqtrrQuvyu field. In the 8rhyTvthyvt9rvpr field, select Trhhr6pxyrqtrrFr. As the Uht, set the V %vfrfhytf  tag. This tag triggers a central signaling device. To acknowledge this signaling device, a button must be provided on the toolbar. This is the C6pxyrqtrr button, if a standard toolbar is configured.

4-76

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)TrshrHrhtr8yh

In the ThUr tab, no changes need to be made. The dialog box is closed by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-77

ThyrQwrprhyrf

!((

#!# 6hyt6yhpvrq

TrsTvtyrHrhtr
Tr

85

Qprqr)TrsTvtyrHrhtr

in the table window and add 12 new lines.

Select the first of the newly added lines via a TvtyrHrhtr dialog box.

8 85
.

on this line opens the

In the Qhhrr tab, select 8hvr@ as the message class and 8hvr 6yh as the message type. In the UuvHrhtr field, select the DTvtyr 6pxyrqtrrPy, UvttrC, vyyirhpuvrq and vyyirrrq check-boxes. In the 8rpv field, select the V %vfrfhytf tag as the ThUht and enter  as the Th7v. No @rUht is set, since the message is generated by an analog alarm. Also, no 6pxyrqtrUht is set. In the Ur tab, enter 8vvphyPrrr as the HrhtrUr and 8hvr as the Qvs@. As the Dsr enter Uurrrvphvr uh rprrqrqurpvvphyhyr. In the Uht6pv tab, a tag can be set for the Whyr 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 PF 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 8hvr @ message type. Enter 8vvphyUrrhr as the HrhtrUr and change the Dsr correspondingly. Create two messages of the 8hvrXhvt message type and enter QrrXhvt and UrrhrXhvt as the HrhtrUr. For these warnings select all check-boxes from the UuvHrhtr field of the Qhhrr tab (of the TvtyrHrhtr 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

!((

ThyrQwrprhyrf

Tr

Qprqr)TrsTvtyrHrhtr

The ThUht, as well as the Qvs@ 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, BrrhyDshv tab, of the created message window template. To do so, open the appropriate properties dialog box. In the BrrhyDshv tab, clicking on the accesses the TrurTryrpv dialog box. For the Iir system block, enter " as the ThWhyr and !# as the T Whyr. Close the properties dialog box by clicking on PF. If a selection has been made, a check-mark
8svtrHrhtrXvq

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

WinCC Configuration Manual C79000-G8276-C140-01

4-79

ThyrQwrprhyrf

!((

8svthvs6hyt6yh
Tr Qprqr)8svthvs6hyt6yh

If the 6hyt6yh entry is not present in the navigation window, it must be loaded first. This is done from the Pv6qqD menu of the 6yh Gttvt editor. In the following dialog, select the analog alarm entry.

85

on the 6hyt6yh entry and select "New" to open the Qrvr dialog box of the tag. In this dialog box, a new tag for the analog alarm can be selected.

Set the V %vfrfhytf tag, which contains the temperature value of the first container, as the Uhtirvrq. The 6HrhtrshyyGvvWhyr checkbox is not selected. Keep  as the 9ryhUvr. Close the dialog box by clicking on PF.

4-80

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)8svthvs6hyt6yh

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 Qrvr dialog box of the limit values. In this dialog box, a new limit value can be assigned to the tag.

Select VrGvv in the GvvWhyr field. Enter ' in the GvvWhyrUht entry box. Keep  as the Crrv. Enter # as the Iir in the Hrhtr field. This is the alarm message for the first container if the temperature has been exceeded. Close the dialog box by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-81

ThyrQwrprhyrf

!((

Tr

Qprqr)8svthvs6hyt6yh

For the same tag, set a second limit value. In the GvvWhyr field, select Vr Gvv again. Enter $ in the GvvWhyrUht entry box. Enter ! as the Iir in the Hrhtr 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 6hyt6yh entry to display all created tags.

4-82

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

The simulation of the process values to be monitored is realized using Xvq PiwrpTyvqrPiwrp. In the example, these are the TyvqrPiwrp to Tyvqr Piwrp% objects. Create a 9vrp8rpv for the TyvqrPiwrxp at @rQrUvp HvpryyhrQpr9vr8rpv, which directs the current process value of the Tyvqr to the V %vfrfhytf tag. This Tyvqr has the task of simulating the temperature value of the first container. In the same manner, configure a Tyvqr for each tag. To synchronize the slider positions with the current tag values at the opening of the picture, create a 86pv at @rHvpryyhrPrQvpr. Assign each Tyvqr a ThPiwrpDPAvryq , which displays its current tag value. In the example, these are the DPAvryq to DPAvryq% objects. Create a Uht8rpv for the DPAvryq at QrvrHvpryyhr QvprIhr to the V %vfrfhytf tag and trigger it upon change. This is the DPAvryq assigned to the first Tyvqr. In the same manner, assign an DPAvryq to each Tyvqr. The display of the individual containers is accomplished via the Uhx# smart object from the global library. In the example, these are the Uhx# , Uhx#! and Uhx#" objects. In the example, these objects contain no dynamics. They only serve display purposes.

A ThPiwrpTh9vyh is assigned to each container to represent a warning light. In the example, these are the Th9vyh to Th9vyh" objects. In the example, via QrvrThr of the Th9vyh for the 8r
Th 

, set the bitmap Dqvphvsyhuvti

as the 7hvpQvpr

and the bitmap Dqvphvsyhuvti as the AyhuQvpr. The QrvrThrAyhuvtAyhuQvprhpvr is set to I. At the same property, create a 86pv, which turns on the flashing if an alarm message concerning a container is pending. Configure the two other Th9vyh in the same manner. 5 Configure an additional ThPiwrpTh9vyh to represent a horn. In the example, this is the Th9vyh# object. At this object, via Qrvr for the 8rTh , set the bitmap Cvqvti as the 7hvpQvpr and the bitmap Cvqvti as the AyhuQvpr.
Thr

WinCC Configuration Manual C79000-G8276-C140-01

4-83

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

The QrvrThrAyhuvtAyhuQvprhpvr is set to I. At the same property, create a 86pv, which turns on the flashing if an alarm message arrives for one of the three containers, i.e. if the tag set in 6yh Gttvt for the 8hvr@ message class (which triggers a central signaling device) receives the status of . In the example, this is the V %vfrfhytf  tag. Create a 86pv at QrvrBrrXvqu, 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 ThPiwrpBhuvpPiwrp.

To display the configured message window template, a ThPiwrp 6yvphvXvq is used. In the example, this is the 6yvphvXvq object. Select 6yhGttvt as the Xvq8r and HrhtrXvqf as the Uryhr. Create a 86pv at QrvrBrrXvqCrvtu, which controls the height of the message window depending on the number of messages to be displayed. For the toolbar, configure several XvqPiwrp7, which simulate the pressing of individual buttons of the standard toolbar via special standard functions.

The 7$ object replaces the button for the horn acknowledgement. Create a 86pv at @rHrHr6pv, which calls the P7C6pxHtXv standard function. As HtXv transfer parameter, enter the name of the message window template. This button acknowledges the central signaling device. Using a ThPiwrpBhuvp Piwrp, 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 7 for single acknowledgement, a 7 for group acknowledgement and a 7 for calling the infotext dialog box. The corresponding standard functions are:
P7Tvty6pxHtXv P7Wvviyr6pxHtXv P7DsHtXv

10

As replacement for the button turning the auto-scroll function on/off, a Th PiwrpTh9vyh is used. In the example, this is the Th9vyh%

4-84

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

object. At QrvrThr8rTh, create a Uht8rpv to the 7DIvfrfhytf tag. This tag contains information whether auto-scrolling is turned on or off. A 86pv is created at @rHrQrGrs, which toggles the 7DIvfrfytf tag and calls the P7TpyyHtXv standard function. At the opening of the picture, the 7DIvfrfhytf 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, USV@ is returned to the property, that is, the warning light is flashing. This 86pv 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, USV@ is returned to the property, that is, the horn is also displayed optically. This 86pv is triggered upon the change of the tag triggering the central audible indicator.

WinCC Configuration Manual C79000-G8276-C140-01

4-85

ThyrQwrprhyrf

!((

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 vqyy. This DLL contains the function for playing sound files. If the Th9vyh# object is flashing, the Crh file, located in the project folder, is played. To do so, the project folder and file path must be determined via the 9HBrSvrQwrp function. Calling of the QyhTq function. The present 86pv 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

!((

ThyrQwrprhyrf

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

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#!$ HrhtrXvqrf"fpuhrf!iQ9G

Uhx9rsvvv

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 6yhGttvt editor, that is, the standard toolbar and status bar are used.

Dyrrhv8pr

A message window template is created in 6yhGttvt. 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 GD6yh button on the toolbar is pressed. In the Bhuvp9rvtr, the message window is displayed using a ThPiwrp 6yvphvXvq. No additional objects are needed.
Ir)

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.

Dyrrhvsur@hyr
Tr Qprqr)Dyrrhvsur@hyr

Open the 6yhGttvt editor from the 8y8rr. Create a new message window template by Uryhr entry.

85

on the HrhtrXvq

The 8svtrHrhtrXvq dialog box will be displayed. 2 In the BrrhyDshv tab, enter HrhtrXvqf# in the Xvq entry field and HrhtrXvq in the XvqUvyr entry field. As the XvqUr, select HrhtrXvq. Tryrpv must not be performed, since all single messages that occur are to be displayed. In the HrhtrGvr tab, select the Gvrf message line format. In the Qhhrr tab, select the Cvhy and Wrvphy check-boxes from the TrhhvGvr field. In the Tryrpv field, select ITryrpv. Select the Gvr Uvyr and 8yUvyr check-boxes. Select the 6Tpyyvt check-box. In the Th7h tab, select the 9vyhTh7h check-box and 7 from the 6yvtr field. As the @yrrsurTh7h, select 9hr, Uvr, IirsHrhtrvurXvq, Gpx and Tryrpv. In the Uyih tab, select the 9vyhUyih check-box and U from the

4-88

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)Dyrrhvsur@hyr 6yvtr

9vyhQprHrhtrXvq

field. As elements of the toolbar, select everything but the keys for , 9vyhTuUr6puvr, 9vyh Trrpr6puvr and 8v8hyyApv. Close the dialog box by clicking on PF.

For each single message, Gv6yh must be set. This function enables a direct picture change to the corresponding picture of the message. By default, the function PrQvpr 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 6yh Gttvt. In this example, the 6GBGD6yh function is created in the Byihy
Tpv editor. In the message windows toolbar, the must have been selected.

button for Gv6yh

In the table window of 6yhGttvt, ' on the Gv6yh column to display the Gv6yh dialog box of the selected single message.

As ApvIhr, the 6GBGD6yh function is used. For the messages that refer to the motors of the first example, the rf"fpuhrf!Q9G picture is used as the QvprIhrQhhrr, for messages of the second example, the rf"fpuhrf!hQ9G picture is used.

The configuration of the Gv6yh function can also be made from the single messages properties dialog box in the Uht6pv tab, Gv6yh field. Save the configurations made in 6yhGttvt. 4 Open the Bhuvp9rvtr and create a new picture. In the example, this is the

WinCC Configuration Manual C79000-G8276-C140-01

4-89

ThyrQwrprhyrf

!((

Tr

Qprqr)Dyrrhvsur@hyr

. To display the configured message window template, a ThPiwrp 6yvphvXvq is used. In the example, this is the 6yvphvXvq object. Select 6yhGttvt as the Xvq8r and HrhtrXvqf# as the Uryhr. Via QrvrHvpryyhr, the attributes Uvyr and 7qr are set to `r.
rf"fpuhrf!iQ9G

ALGLoopInAlarm Project Function


void ALGLoopInAlarm(char* PictureName) { SetPictureName("ex_0_startpicture_00.PDL","workspace", PictureName); }

Call of the TrQvprIhr function to execute the picture change. This function can not be used directly in 6yhGttvt, since the number and type of the call parameters do not agree with the previous ones.
Ir)

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 #"&HrhtrTrrprSrrf"fpuhrf!iQ9G, in the Sr9rvtr chapter.
Brrhy6yvphvIr

For the general application, the following adaptations must be performed: The functions, configured for the individual messages, pertaining to the Gv6yh, 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

!((

ThyrQwrprhyrf

#!% Hrhtr6puvvtrf"fpuhrf!pQ9G

Uhx9rsvvv

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.

Dyrrhv8pr

A message window template is created in 6yhGttvt. This example will use the messages created in the previous examples. In addition, a message archive is configured. In the Bhuvp9rvtr, the message window is displayed using a ThPiwrp 6yvphvXvq. The toolbar is implemented using multiple XvqPiwrp 7, ThPiwrpTh9vyh and ThPiwrpBhuvpPiwrp. A project function is needed that performs a defined selection in the message window if the selection buttons are activated.

TrsurSrvrqUht
Tr Qprqr)TrsurSrvrqUht

Create a total of three tags of the 7vhUht type. In the example, these are the 7DIvfrfhytf, 7DIvfrfhytf and 7DIvfrfhytf! tags.

Ir)

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.

Dyrrhvv6yhGttvt
Tr Qprqr)Dyrrhvv6yhGttvt

Open the 6yhGttvt editor from the 8y8rr. Create a new message window template by 5 on the HrhtrXvq Uryhr entry. The 8svtrHrhtrXvq dialog box will be displayed. In the BrrhyDshv tab, enter HrhtrXvqf! in the Xvq entry field, a separate XvqUvyr is not needed. As the XvqUr, select Tu Ur6puvrXvq. Tryrpv must not be performed, since all archive messages are to be displayed. In the HrhtrGvr tab, select the Gvrf message line format. In the Qhhrr tab, select the Cvhy and Wrvphy check-boxes from the TrhhvGvr field. In the Tryrpv field, select 8ryy. Select the GvrUvyr and 8yUvyr check-boxes. Select the 6Tpyyvt check-box. In the Th7h and Uyih tabs, deselect the check-boxes for displaying the status bar and toolbar. Close the dialog box by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-91

ThyrQwrprhyrf

!((

Tr

85

Qprqr)Dyrrhvv6yhGttvt

Qhhrr6vtr

on the 6puvr entry and select "Add/Remove" to open the 6puvr 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 IirsHrhtr entry box, enter !. Tryrpv is not performed.

4-92

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)Dyrrhvv6yhGttvt

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

To display the configured message window template, a ThPiwrp 6yvphvXvq is used. In the example, this is the 6yvphvXvq object. Select 6yhGttvt as the Xvq8r and HrhtrXvqf! as the Uryhr. For the toolbar, configure several XvqPiwrp7, which simulate the pressing of individual buttons of the standard toolbar via special standard functions.

The 7$ object replaces the button for the horn acknowledgement. Create a 86pv at @rHrHr6pv, which calls the P7C6pxHtXv standard function. As HtXv 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 ThPiwrpBhuvpPiwrp, 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 7 for single acknowledgement, a 7 for group acknowledgement, a 7 for calling the selection dialog box and a 7 for calling the infotext dialog box. The corresponding standard functions are:
P7Tvty6pxHtXv P7Wvviyr6pxHtXv P7DsHtXv

WinCC Configuration Manual C79000-G8276-C140-01

4-93

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr P7TryrpHtXv

As replacement for the button turning the auto-scroll function on/off, a Th PiwrpTh9vyh is used. In the example, this is the Th9vyh" object. At QrvrThr8rTh, create a Uht8rpv to the 7DIvfrfhytf tag. This tag contains information whether auto-scrolling is turned on or off. A 86pv is created at @rHrQrGrs, which toggles the 7DIvfrfytf tag and calls the P7TpyyHtXv standard function. At the opening of the picture, the 7DIvfrfhytf 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:
P7HtAvHtXv P7HtGhHtXv P7HtIrHtXv P7HtQrHtXv

These buttons can be made inoperational via a ThPiwrpBhuvpPiwrp, which positions itself over the buttons if auto-scrolling is turned on. This is accomplished via a Uht8rpv to the 7DIvfrfhytf tag at Qrvr Hvpryyhr9vyh. 6 Use of two ThPiwrpTh9vyh to switch between the Hrhtr Xvq and TuUr6puvrXvq display types. The current status of the message window is stored in the 7DIvfrfhytf tag, which must be set to zero at the opening of the picture, since the message window is displayed as Tu Ur6puvrXvq first if called. Create a Uht8rpv for the Th9vyh object at QrvrThr 8rTh to the 7DIvfrfhytf tag. Create a 9hvp9vhyt at Qrvr HvpryyhrPrh8y@hiyr, which enables the operation of the object only, if the message window displays the short-term archive, i.e. the 7DIvfrfhytf tag has the status of 0. Create a 86pv at @rHr QrGrs, which simulates the pressing of the corresponding button on the standard toolbar and toggles the 7DIvfrfhytf tag. Do the same to configure the Th9vyh! object. The following standard functions are used:
P7HtXvHtXv P76pTuHtXv

Use two additional XvqPiwrp7 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 ByihyTpv editor, which receives the message numbers between which the displayed messages are lying. In the

4-94

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

example, this function is named TrHtITryrpv.

An additional XvqPiwrp7 is used to call the P7QvHtXv 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 Sr6yhGttvtSUSryvt6puvr is called. By default, the QhtrGh hythy is used. This page layout must be adapted or exchanged. The steps to do this are described in the example #"(Hrhtr 6puvrSrrf"fpuhrf!pQ9G, in the Sr9rvtr 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 Avyr filter structure. Assignment of values to the, for this application relevant, structure member of the file structure. As the AvyrIhr, the name of the message window template, to which the filter is referring to, must be used. In the qHtI 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 qAvyr switch is set to identify the file structure as a number filter. Call of the HTSUTrHtXvAvyr API function, which applies the created filter to the selected message window template.

WinCC Configuration Manual C79000-G8276-C140-01

4-95

ThyrQwrprhyrf

!((

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#!& Xv886yh8yrf"fpuhrf!qQ9G

Uhx9rsvvv

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 Xv886yh8y OCX. By using this object, the toolbar and status bar must be created in the Bhuvp9rvtr.

Dyrrhv8pr

By using an OCX, no message line format or message window template must be created in 6yhGttvt. 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 Bhuvp9rvtr, the message window is configured as a ThPiwrpPG@ 8y. The toolbar is implemented using multiple XvqPiwrp7, Th PiwrpTh9vyh and ThPiwrpBhuvpPiwrp.
Ir)

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 #!%Hrhtr6puvvt rf"fpuhrf!pQ9G.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

1 2

In Tag Management, create two tags of the 7vhUht type. In the example, these are the 7DIvfrfhytf and 7DIvfrfhytf tags. To display the message window, a ThPiwrpPG@8y is used. In the example, this is the 886ytXv8y object. After placing the object, the DrPG@8yP8Y dialog box is automatically displayed. Select the Xv886yh8y entry from the list and exit the dialog box by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-97

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

The PG@Piwrp will be displayed as follows:

' on this object to open the Xv886yh8yQrvr dialog box. Settings are made in this dialog box that are normally made in 6yhGttvt while creating a message window template and message line format. In the Tyr tab, select TuUr6puvrXvq from the XvqUr field.

In the Qhhrr tab, select the Cvhy and Wrvphy check-boxes from the TrhhvGvr field. Select line and column title, as well as auto-scrolling. In the Tryrpv field, set ITryrpv.

4-98

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

In the HrhtrGvr tab, the message blocks displayed in the message line are selected. The message blocks configured in 6yhGttvt are marked by a  at the beginning. For this example, all message blocks created in 6yhGttvt are selected for the message line.

Apply the settings made in this dialog box by clicking on PF. 4

8'

on the just created object while holding down the CRTL key, activates the OCX in the Bhuvp9rvtr and gives you a preview of its appearance.

If runtime is activated, the OCX will receive relevant data of the 6yhGttvt.

WinCC Configuration Manual C79000-G8276-C140-01

4-99

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

To control the Xv886yh8y, a user-defined toolbar must used. The configuration of the individual elements of the toolbar has been described in detail in the example #!%Hrhtr6puvvtrf"fpuhrf!pQ9G, in the table DyrrhvvurBhuvp9rvtr. The standard functions used there are to be replaced by functions that control the Xv886yh8y. These functions have the same names as their counterparts used to control message window templates in application windows, however, the character string 6Y8f 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:

6Y8fP7C6pxyQvprIhryPiwrpIhr 6Y8fP7Tvty6pxyQvprIhryPiwrpIhr 6Y8fP7Wvviyr6pxyQvprIhryPiwrpIhr 6Y8fP7TpyyyQvprIhryPiwrpIhr 6Y8fP7HtAvyQvprIhryPiwrpIhr 6Y8fP7HtGhyQvprIhryPiwrpIhr 6Y8fP7HtIryQvprIhryPiwrpIhr 6Y8fP7HtQryQvprIhryPiwrpIhr 6Y8fP7HtXvyQvprIhryPiwrpIhr 6Y8fP76pTuyQvprIhryPiwrpIhr

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#!' BHrhtrrf'ftrrhfQ9G

In runtime, this example is accessed by clicking on the 7 displayed above using the . The message generator can be turned on by selecting the 6pvr check-box contained in this picture. Messages will then be generated in 10 second cycles.

Uhx9rsvvv

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 #!!7vHrhtrQprqr 8vrq and #!#6hyt6yhpvrq 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.

Dyrrhv8pr

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 ThPiwrpTh9vyh, the current status of this tag is analyzed and a corresponding symbol displayed.
Ir)

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.

TrsurSrvrqUht
Tr Qprqr)TrsurSrvrqUht

In Tag Management, set up a total of three tags of the Vvtrq %7vWhyr type. In the example, these are the V %vfrfhytf!, V %vfrfhytf! and V %vfrfhytf!! tags. They serve as status, lock and acknowledge tags.

BrrhyDshv

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

ThyrQwrprhyrf

!((

8rhvsrBHrhtr
Tr Qprqr)8rhvsrBHrhtr

Open the 6yhGttvt editor. entries. 5 on the Vr9rsvrq entry and select "Add Group Message" to display the IrBHrhtr dialog box.
Vr9rsvrq

8'

on the BHrhtr entry. This will display the Hrhtr8yh and

Enter 8hvr6yh in the Ihr entry field. As the Th, Gpx and 6pxyrqtr tags, set the tags created previously. Enter  as the bit numbers.

Close the dialog box by clicking on PF. Create two additional group messages that use the same Th, Gpx and 6pxyrqtr 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

!((

ThyrQwrprhyrf

Tr

Qprqr)8rhvsrBHrhtr

on one of the icons and select "Add Single Message" to open the Ir dialog box. For each group message, enter the message numbers of the corresponding single messages and close the dialog boxes by clicking on PF.
TvtyrHrhtr

85

In the navigation window, ' on the Vr9rsvrq 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 8hvr6yh group message.

WinCC Configuration Manual C79000-G8276-C140-01

4-103

ThyrQwrprhyrf

!((

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Create a new picture in the Bhuvp9rvtr. In the example, this is the rf'ftrrhfQ9G. In this picture, configure a ThPiwrpTh9vyh, which displays the current status of the group messages. In the example, this is the Th9vyh object. The status of the group messages is stored in the V %vfrfhytf! tag, as configured in 6yhGttvt. 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 86pv at QrvrThr8r Th, which controls the status depending on the V %vfrfhytf! tag and the requested priority.

Additionally, configure a XvqPiwrp7, 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 7 object. Using a 86pv at @rHrHr6pv, the current status of the group messages is retrieved and the picture change performed accordingly. If no message is pending, a XvqPiwrp7 is placed on top of the just described 7. This new button has the purpose of making the other button inoperational and of optically displaying that inoperability. Set the Qrvr HvpryyhrPrh8y@hiyr to I. Configure an additional XvqPiwrp7, which allows the currently displayed group message to be acknowledged. In the example, this is the 7" object. Configure 86pv at @rHrHr6pv, 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 V %vfrfhytf!! acknowledge tag is set and then reset. If no unacknowledged message is pending, an additional XvqPiwrp7 is positioned on top of the just described 7 to make it inoperational and optically display that inoperability. Set the QrvrHvpryyhrPrh8y@hiyr to I.

Configure an additional picture. In the example, this is the rf'ftrrhf Q9G. In this picture, three XvqPiwrp8urpx7r are configured. In the example, these are the 8urpx7 , 8urpx7! and 8urpx7" objects. Create a 86pv each at @rQrUvpPDTryrprq 7r, which locks are enables the corresponding group message. Each lock is displayed in the V %vfrfhytf! tag as configured in 6yhGttvt. Since a lock can also be set from the other side, a 86pv must be created at Qrvr PDTryrprq7r. This action is triggered upon the change of the V %vfrfhytf! tag and checks, if the status of the lock controlled by the

4-104

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr 8urpx7

has changed.

In the picture created first (rf'ftrrhfQ9G), create a ThPiwrp QvprXvq and set the rf'ftrrhf Q9G at Qrvr HvpryyhrQvprIhr. Set I at QrvrHvpryyhr 9vyh. An additional XvqPiwrp7 is needed that makes the previously configured QvprXvq visible via a 9vrp8rpv at @rHr Hr6pv.

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 6yhGttvt. 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

ThyrQwrprhyrf

!((

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

!((

ThyrQwrprhyrf

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. B 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 Uvr structure member of the SYSTEMTIME type. The sD9Vrq 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.
Ihr

contains the name of the desired group message.

q9hr indicates, if it should be set or enabled. The current status is transferred to the check-box.

Starting of the message service via the HTSUThHtTrvpr function. Calling of the function for locking or enabling the HTSUGpxB group message. Termination of the message service via the HTSUTHtTrvpr function.

WinCC Configuration Manual C79000-G8276-C140-01

4-107

ThyrQwrprhyrf

!((

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#" Sr9rvtr

In runtime, the examples pertaining to this topic can be selected by clicking on the button . The examples are configured in the rf"fpuhrf"Q9G. displayed above with the Additional examples are spread out throughout the example project.

BrrhyDshv

The Sr9rvtr 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 Sr9rvtr, output comprises the printing of these reports.
Ir)

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 5 symbol.

WinCC Configuration Manual C79000-G8276-C140-01

4-109

ThyrQwrprhyrf

!((

#"

Qvpr9prhvrf"fpuhrf"Q9G

Uhx9rsvvv

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.

Dyrrhv8pr

A system layout is available that satisfies all of these requirements. It is the 5Q9GQvpy layout. This layout is copied and adapted to meet your needs.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

Open the Sr9rvtr editor from the 8y8rr.

Open the 5Q9GQvpy system layout via AvyrPr and save it under a new name via AvyrThr6. In the example, the name Q9Gvpry is used. 2

85

on a blank area within the layout to open its properties dialog box.

In the Qrvr tab, general geometric properties can be set at the Brr entry.

4-110

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurSr9rvtr

The Hvpryyhr 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 9hvpPiwrp@irqqrqGh. In the example, this is the @irqGh dynamic object, which is not to be changed. The embedded layout is the 5Q9Gvprphpy 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 @irqGh object via QrvrHvpryyhrGhAvyr. 4 The static part of the report contains a header and a footer. The footer contains the TrPiwrp 9hrUvr, QhtrIir, QwrpIhr and GhIhr. The header contains two ThvpPiwrpThvpUr and one TrPiwrp QwrpIhr. Additionally, a logo is displayed via a ThvpPiwrpPG@ @yrr. Change the text of the ThUr to Qvpr9prhv. To display your own logo, delete the current PyrPiwrp . Configure a new ThvpPiwrp PG@@yrr. In the DrPiwrp dialog box, which is displayed after placing the object in the report, select 8rhrsAvyr and set the bitmap file containing your logo. Close the dialog box by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-111

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurSr9rvtr

Save the configurations made in the Sr9rvtr. 5 button on the toolbar switches among the cover Clicking on the sheet, report contents and final page. The examples cover sheet contains two ThvpPiwrpThvpUr and a Thvp PiwrpPG@@yrr.

4-112

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

TrsQvEi
Tr Qprqr)TrsQvEi

In the 8y8rr,

85

on "Print Job" and select "New Print Job".

The right window will display the new print job using the default name Qv
Ei , in addition to the already existing print jobs. print job to display its properties dialog box.

8' 85
or

on the new

In the QvEi tab, replace the default name in the Ihr entry field by QvwifQ9G. As the Gh, set the previously created layout Q9Gvpry. In the Tryrpv tab, the area to be printed is set. In the QhtrShtr field, select 6yy. In the example, a set UvrShtr has no influence on the print job. In the QvrTr tab, the printer is selected. You can also choose to print the data to a file. In the 8y8rr, 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 Xvq Piwrp7. This is the 7 " object in the rf"fpuhrf"Q9G. Create a 86pv at @rHrHr6pv, which activates the preview of the corresponding print job.

WinCC Configuration Manual C79000-G8276-C140-01

4-113

ThyrQwrprhyrf

!((

C-Action for Starting a Print Job


#include "apdefap.h" void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName) { RPTJobPreview("PrintJob_PDL"); }

Calls the SQUEiQrvr standard function. As transfer parameter, the name of the print job is used.
Ir)

If the layout, inserted into the report layout of the Sr9rvtr editor, is open, the preview and the print job can not be started.

Brrhy6yvphvIr

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 DyrrhvvurSr 9rvtr.

4-114

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

#"! SrvturQwrpApvrf"fpuhrf"Q9G

Uhx9rsvvv

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.

Dyrrhv8pr

A system layout is available that satisfies all of these requirements. It is the 5BT8fSQA8y layout. This layout is copied and adapted to meet your needs. This layout contains an inserted layout that must also be adapted.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, open the 5BT8fSQA8y system layout by

85

on it.

Save this system layout under a new name via AvyrThr6. In the example, the name tpfwrpspvy 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 8rTurr entry from Hvpryyhr. Accept the remaining settings. The static part of the report contains a header and a footer. The footer contains the TrPiwrp 9hrUvr, QhtrIir, QwrpIhr and GhIhr. The header and footer both contain a ThvpPiwrpSrphtyr as the background. Via Qrvr8y7hpxtq8y, set the background color of these rectangles to GvtuBh. The header contains two additional ThvpPiwrpThvpUr and one Tr PiwrpQwrpIhr. The existing PyrPiwrp , which displays the logo, is deleted. It is replaced by a ThvpPiwrpThvpHrhsvyr. In the example, this is the ThHrhsvyr . Via QrvrHvpryyhrHrhsvyrIhr, an existing metafile is set. In the example, this is the ytrs file containing the WinCC logo. If ThvpHrhsvyr 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 ThvpPiwrpThvpUr and a Thvp PiwrpPG@@yrr.

WinCC Configuration Manual C79000-G8276-C140-01

4-115

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurSr9rvtr

The dynamic part of the report consists of a 9hvpPiwrp@irqqrq Gh. In the example, this is the @irqGh object. As the embedded layout, the system layout 5tpspy is used. Open the system layout 5tpspy and save it under a new name. In the example, the name tpfwvry is used. The static part of this layout contains no objects. The dynamic part of this report contains two 9hvpPiwrp9hvpUr. In the example, these are the 9Ur and 9Ur! objects. The connection of the 9Ur object to the ByihyTpv data was established as follows: Open the properties dialog box of the 9Ur object. Select the 8rp tab. Click on the button to open the 8rp dialog box.

In the ByihyTpv folder, select Ds from the QwrpApv and close

the dialog box by clicking on PF.


The selected connection will then be displayed in the left window of the 8rp tab. If the QwrpApv entry is selected, the Tryrpvt@yrr entry will be displayed. This means that a selection can be made. Click on this entry using the
Tryrpvt@yrr

to activate the dialog box.

button. This button opens the

In this dialog box, select 6yy6hvyhiyr@yrr. For the 9Ur! object, a connection was established as described above. The exception being that Tpr8qr, instead of Ds, was selected. Configuration of appropriate fonts. In the example, the 9Ur object uses the font 6vhy with a font size of !. The font is also displayed Vqryvrq. The 9Ur! object uses the 8vrIr font with a font size of . This font is displayed in 7yq. The entire 9Ur! object was framed by a border using a GvrXrvtu of . Save the changes made to the embedded layout. Close the layout. In the still open layout tpfwrpspvy, set the just created layout at the @irqGh object via QrvrHvpryyhrGhAvyr. This layout replaces the previously set system layout. Via 8rpQwrpApv (in the PiwrpQrvr dialog box of the @irqGh object), a selection can now be made. Select the Tryrpvt entry. This makes the button operational, by which the dialog box is accessed. In the example, 6yy6hvyhiyr @yrr has been selected. It is also possible to directly select the project functions to be reported.
@yrr Tryrpvt@yrr

4-116

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurSr9rvtr

Save the configurations made in the Sr9rvtr.


Ir)

The procedure of creating a new print job and executing that print job from the 8y 8rr or runtime, is described in the previous example under TrsQvEi. The settings can be made correspondingly.

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#"" Srvtsur8y8rrrf"fpuhrf"Q9G

Uhx9rsvvv

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.

Dyrrhv8pr

Configure a new layout in the Sr9rvtr editor. This layout is not based on any existing layout.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, create a new layout by

85

on Gh.

The right window will display the new layout, using the default name IrSQGSQG, 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 8y8rry is used.

Open the new layout in the Sr9rvtr. 5 on a blank In the properties dialog box of the layout, which is accessed by area within the report, select the 8rTurr entry from Hvpryyhr. Accept the remaining settings. In the static part of the report, various ThvpPiwrp and TrPiwrp 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 9hvpPiwrp9hvpUhiyr is configured. In the example, this is the 9Uhiyr object. After the object is placed in the report, the 8rp dialog box is displayed. Select the Uht entry from the 8y8rr8T folder. Close the dialog box by clicking on PF.

4-118

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurSr9rvtr

In the 8rp 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 9hhUr, B, Qhhrr and @rhyUht9hh check-boxes. Also, select the 8hp 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: 6yhGttvt and 6yhGttvt!. However, this selection is only possible, if the 6yyUhtB check-box has not been selected. To make the selection of the tag groups effective, the 6yyUht check-box must be deselected in the tag selections dialog box.

WinCC Configuration Manual C79000-G8276-C140-01

4-119

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurSr9rvtr

Save the settings made in the Sr9rvtr.


Ir)

The procedure of creating a new print job and executing that print job from the 8y 8rr or runtime, is described in the first example of the Sr9rvtr chapter under TrsQvEi. The settings can be made correspondingly.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#"# SrvtsUhtGttvt8Trf"fpuhrf"Q9G

Uhx9rsvvv

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.

Dyrrhv8pr

Configure a new layout in the Sr9rvtr editor. This layout is not based on any existing layout.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, create a new layout by

on Gh. The right window will display the new layout, using the default name IrSQGSQG, in addition to the already existing ones. 5 on this name and rename the layout to ytfpy.

85

Open the new layout in the Sr9rvtr. 5 on a blank In the properties dialog box of the layout, which is accessed by area within the report, select the 8rTurr entry from Hvpryyhr. Accept the remaining settings. In the static part of the report, various ThvpPiwrp and TrPiwrp 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 9hvpPiwrp9hvpUhiyr is configured. In the example, this is the 9Uhiyr object. After the object is placed in the report, the 8rp dialog box is displayed. Select the QprWhyr6puvr entry from the UhtGttvt8T folder. Close the dialog box by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-121

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurSr9rvtr

In the 8rp 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 6yy 6puvr 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 Sr9rvtr.
Ir)

8'

The procedure of creating a new print job and executing that print job from the 8y 8rr or runtime, is described in the first example of the Sr9rvtr chapter under TrsQvEi. The settings can be made correspondingly.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#"$ QvPurUrqXvqvSvrrf"fpuhrf hQ9G

Uhx9rsvvv

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 # !8pyvpTryrpvr6puvvtrf"fpuhrf hQ9G example in the UhtGttvt chapter. Its concepts will be utilized to print out the table displayed in this example.

Dyrrhv8pr

Configure a new layout in the Sr9rvtr 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.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, create a new layout by

5 on Gh. The right window will display the new layout in addition to the already existing 5 on it. ones. Rename the layout to ytfaTfQ6fy by

Open the new layout in the Sr9rvtr. In the static part of the report, various ThvpPiwrp and TrPiwrp are configured for the header and footer. In the dynamic part of the report, three 9hvpPiwrp9hvpHrhsvyr are configured. In the example, these are the 9Hrhsvyr , 9Hrhsvyr! and 9Hrhsvyr" objects. After placing the objects in the report, the 8rp dialog box is displayed. For all three objects, select the UhtUrq entry from the UhtGttvtSvr folder. Close the dialog boxes by clicking on PF.

WinCC Configuration Manual C79000-G8276-C140-01

4-123

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurSr9rvtr

In the 8rp tab of the 9hvpHrhsvyr 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 UvrTryrpv will not be performed. In the 6puvr9hhTryrpv dialog box, the aTfQprWhyr6puvrf archive is selected. For the 9Hrhsvyr object, select the B%#frfytf 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

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurSr9rvtr

Save the settings made in the Sr9rvtr.

TrsQvEi
Tr Qprqr)TrsQvEi

In the 8y8rr,

85

on the QvEi entry and select "New Print Job".

The right window will display the new print job using the default name Qv ' or 5 on the new Ei , in addition to the already existing print jobs. print job to display its properties dialog box. In the QvEi tab, enter QvwifaTfQ6f in the Ihr entry field. As the Gh, set the previously created layout ytfaTfQ6fy. In the Tryrpv tab, the print range is set. In the QhtrShtr field, select 6yy. In the UvrShtr field, select 6iyr. An exact time range is not set until runtime is activated. In the QvrTr tab, the printer to be used is set. 2 In the example project, a print job preview can be displayed via a Xvq Piwrp7. This is the 7 " object in the rf"fpuhrf hQ9G. Create a 86pv at @rHrHr6pv, which activates the

8 8

WinCC Configuration Manual C79000-G8276-C140-01

4-125

ThyrQwrprhyrf

!((

Tr

Qprqr)TrsQvEi

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 rf$fvqf!Q9G. In this picture, configure six ThPiwrpDPAvryq each for entering the start and end times. These are the DPAvryq to DPAvryq% objects for setting the start time, and the DPAvryq& to DPAvryq ! objects for setting the end time. To buffer the made settings, a tag of the Vvtrq %7vWhyr type must be created for each DPAvryq in UhtHhhtrr. In the example, these are the V %vfrfrfs to V %vfrfrfs% tags for the start time, and the V %vfrfrf to V %vfrfrf% tags for the end time. For each DPAvryq, a Uht8rpv to the corresponding tag must be created via QrvrPDPWhyr. At QrvrPDPAh, the format (( is set for each . One exception are the DPAvryq for setting the year. They use the output format ((((.
DPAvryq

In the rf$fvqf!Q9G, create a 86pv at @rHvpryyhr PrQvpr, 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 XvqPiwrp7 in the rf$fvqf!Q9G. In the example, these are the 7 and 7! objects. 7! serves as the cancel button. Create a 9vrp8rpv at @r HrHr6pv, which switches the 8h of  to the 9vyh of the 8rXvq. 7 serves as the OK button. It also contains a 9vrp8rpv at @r HrHr6pv for closing the window. Configure a 86pv at @rHrQrGrs. 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 UrUht %7v8uhhprTr type that must be created in UhtHhhtrr. In the example, this is the U %vfrfrf tag. To display the just created picture in the rf"fpuhrf hQ9G, a ThPiwrp QvprXvq must be created. In the example, this is the QvprXvq object. At QrvrHvpryyhrQvprIhr, set the rf$fvqf!Q9G. Set the 9vyh to I. To display the QvprXvq, an additional XvqPiwrp7 is needed. In the example, this is the 7 ! object. Create a 86pv for this button at @rHrHr6pv, which writes the print job name to

4-126

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)TrsQvEi

be processed to the U visible.

%vfrfrf

tag and makes the QvprXvq object

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 HqvsQvEi 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 UvrA and UvrU stored in the internal tags. In addition, the name of the print job to be processed is required. This name is stored in the U %vfrfrf 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

ThyrQwrprhyrf

!((

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 and !, 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 9HBrSvrQwrp function. Setting and storing of the start time. This is the 67TPGV@T@G@8UDPIASPH property. Setting and storing of the end time. This is the 67TPGV@T@G@8UDPIUP property.

Brrhy6yvphvIr

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 HqvsQvEi, UvrA and UvrU project functions are required to ensure functionality. The tags for buffering the time values are to be configured using the same names. Otherwise, the UvrA and UvrU 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

!((

ThyrQwrprhyrf

#"% QvvtPurUhiyrvSvrrf"fpuhrf

pQ9G

Uhx9rsvvv

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 # #Vrqrsvrqhiyryhrf"fpuhrf pQ9G example in the UhtGttvt chapter. Its concepts will be utilized to print out the table displayed in this example.

Dyrrhv8pr

Configure a new layout in the Sr9rvtr 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 Trs QvEi table.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, create a new layout by

on Gh. The right window will display the new layout in addition to the already existing on it. ones. Rename the layout to ytfaFfQ6f!y by

Open the new layout in the Sr9rvtr. In the static part of the report, various ThvpPiwrp and TrPiwrp are configured for the header and footer. In the dynamic part of the report, a 9hvpPiwrp9hvpUhiyr is configured. In the example, this is the 9Uhiyr object. After placing the objects in the report, the 8rp dialog box is displayed. Select the UhtUhiyr entry from the UhtGttvtSvr folder. Close the dialog box by clicking on PF.

85 85

WinCC Configuration Manual C79000-G8276-C140-01

4-129

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurSr9rvtr

In the 8rp tab of the 9hvpHrhsvyr 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 Uvr Tryrpv is not performed. In the 6puvr9hhTryrpv dialog box, the aFfQprWhyr6puvrf archive is selected. Select all available columns of the table.

8'

4-130

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurSr9rvtr

Save the settings made in the Sr9rvtr.

TrsQvEi
Tr Qprqr)TrsQvEi

In the 8y8rr,

85

on "Print Job" and select "New Print Job".

' or 5 on the new Ei , in addition to the already existing print jobs. print job to display its properties dialog box. In the QvEi tab, enter QvwifaFfQ6f! in the Ihr entry field. As the Gh, set the previously created layout ytfaFfQ6f!y. In the Tryrpv tab, the print range is set. In the QhtrShtr field, select 6yy. In the UvrShtr field, select 6iyr. An exact time range is not set until runtime is activated. In the QvrTr 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 TrsQvEi table. button for the time selection in the Adaptations must be made to the at @rHrHr6pv. The U %vfrfrf 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 86pv at @rHrHr 6pv.

The right window will display the new print job using the default name Qv

8 8

86pv

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#"& HrhtrTrrprSrrf"fpuhrf!iQ9G

Uhx9rsvvv

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 #!$HrhtrXvqrf"fpuhrf!iQ9G example in the 6yhGttvt 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.

Dyrrhv8pr

A system layout and system print job are available, which meet the set requirements. These are the 5hyrsy layout and 5Sr6yhGttvtSUHrhtrTrrpr 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.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, open the 5hyrsy system layout by

85

on it.

Save this system layout under a new name via AvyrThr6. In the example, the name hytfrsy 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 9hvpPiwrp9hvpUhiyr ("Alarm Logging Runtime" -> "Message Sequence Report"). In the example, this is the 9Uhiyr object. Open the 9Uhiyr objects properties dialog box and select the 8rp tab. The table is already connected to the HrhtrTrrprSr of 6yh GttvtSvr. A selection has also been already performed.

4-132

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurSr9rvtr

The button or ' on the Tryrpv entry opens the dialog box for selecting message blocks. The 9hr, Uvr and Iir system blocks are already button adds all remaining selected. In the example, clicking on the message blocks. Close the dialog box by clicking on PF. Save the layout.

6qhvturQvEi
Tr Qprqr)6qhvturQvEi

Open the system print job 5Sr6yhGttvtSUHrhtrTrrpr by ' or 5 on its name (and then selecting "Properties") in the 8y8rr.

8 8

In the QvEi tab, set the just created Gh hyrsy. In the QvrTr tab, set the printer to be used. No further changes need to be made. Close the dialog box by clicking on PF. The message sequence report must be activated in the 6yhGttvt editor. Open the Alarm Logging editor. 5 on the Sr entry and select "Add/Remove" to open the 6vtvtSrQhhrr dialog box.

In this dialog box, select the HrhtrTrrprSr 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

ThyrQwrprhyrf

!((

Tr

Qprqr)6qhvturQvEi

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 SrApv button. In the example project, this button has already been configured in the HrhtrXvqf# template used in the rf"fpuhrf!iQ9G. Save the settings made in 6yhGttvt.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#"' HrhtrTrrprSrhGvrQvr

Uhx9rsvvv

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.

Dyrrhv8pr

Create a line printer layout. This layout will be set in the 5Sr6yhGttvtSU HrhtrTrrpr system print job.

8rhvshGvrQvrGh
Tr Qprqr)8rhvshGvrQvrGh

Create a new line printer layout by 8y8rr.

85

on the corresponding entry in the

A new line printer layout with the default name IrSQ

example, this name is kept. ' on the name of the new line printer layout (in the right window), opens the GvrGh@qv. In this editor, general settings pertaining to page margins, headers, footers, etc. can be made.

SQ

is created. In the

In the Uhiyr 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

ThyrQwrprhyrf

!((

6qhvturQvEi
Tr Qprqr)6qhvturQvEi

1 2

Open the system print job 5Sr6yhGttvtSUHrhtrTrrpr by ' or 5 on its name (and then selecting "Properties") in the 8y8rr. In the QvEi tab, select the GvrGhsGvrQvr check-box and set the just created Gh IrSQ SQ . In the QvrTr tab, set the line printer to be used. No further changes need to be made. The dialog box is closed by clicking on PF.

8 8

The message sequence report must be activated in the 6yhGttvt editor. Open the Alarm Logging editor. 5 on the Sr entry and select "Add/Remove" to open the 6vtvtSrQhhrr dialog box. In this dialog box, select the HrhtrTrrprSr check-box.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

#"( Hrhtr6puvrSrrf"fpuhrf!pQ9G

Uhx9rsvvv

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 #!%Hrhtr6puvvtrf"fpuhrf!pQ9G example in the 6yhGttvt 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.

Dyrrhv8pr

A system layout and system print job are available, which meet the set requirements. These are the 5hyhy layout and 5Sr6yhGttvtSUSryvt6puvr 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.

DyrrhvvurSr9rvtr
Tr Qprqr)DyrrhvvurSr9rvtr

In the 8y8rr, open the 5hyhy system layout by

Save this system layout under a new name via AvyrThr6. In the example, the name hytfh 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 9hvpPiwrp9hvpUhiyr ("Alarm Logging Runtime" -> "Short-Term Archive Report"). In the example, this is the 9Uhiyr object. Open the 9Uhiyr objects properties dialog box and select the 8rp tab. The table is already connected to the TuUr6puvrSr of 6yh GttvtSvr. A selection has also been already performed. 4 The button or ' on the Tryrpv entry opens the dialog box for selecting message blocks. The 9hr, Uvr and Iir system blocks are already button adds all remaining selected. In the example, clicking on the message blocks. Close the dialog box by clicking on PF. Save the layout.

85

on it.

WinCC Configuration Manual C79000-G8276-C140-01

4-137

ThyrQwrprhyrf

!((

6qhvturQvEi
Tr Qprqr)6qhvturQvEi

1 2

Open the system print job 5Sr6yhGttvtSUSryvt6puvr by ' or 5 on its name (and then selecting "Properties") in the 8y8rr. In the QvEi tab, set the just created Gh hyhy. In the QvrTr tab, set the printer to be used. No further changes need to be made. The dialog box is closed by clicking on PF. The archive report must be activated in the 6yhGttvt editor. Open the 5 on the Sr entry and select "Add/Remove" to Alarm Logging editor. open the 6vtvtSrQhhrr dialog box.

8 8

In this dialog box, select the 6puvrSr6pvr check-box. Save the settings made in 6yhGttvt. 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 P7QvHtXv. In the example project, this button has already been configured in the rf"fpuhrf!iQ9G.

Brrhy6yvphvIr

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

!((

ThyrQwrprhyrf

## PG@8vphv@Y8@G

In runtime, the examples to this topic can be selected by clicking on the button displayed . These examples are configured in the rf"fpuhrf#Q9G and the above with the PG@f8vphvy Excel spreadsheet.

WinCC Configuration Manual C79000-G8276-C140-01

4-139

ThyrQwrprhyrf

!((

##

SrhqvthqXvvtUhtWhyrrf"fpuhrf#Q9G

Uhx9rsvvv

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.

Dyrrhv8pr

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.

DyrrhvvXv88
Tr Qprqr)DyrrhvvXv88

In Tag Management, create tags of several types. In the example, the following tags are used:

In a picture, a ThPiwrpDPAvryq is configured for each tag created. At QrvrPDPWhyr, create a Uht8rpv to the corresponding tag.

4-140

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Dyrrhvv@pryWrv'
Tr Qprqr)Dyrrhvv@pry

Create a new Excel spreadsheet. In the example, this spreadsheet is named PG@f8vphvy. 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 8yUyi toolbar from the WvrUyih 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 BrWhyr as the name of the object and BrWhyr 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

ThyrQwrprhyrf

!((

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

!((

ThyrQwrprhyrf

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 p 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 TrWhyr function. The loop is continued until an empty cell (of the columns containing the tag names) is reached.

Brrhy6yvphvIr

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

ThyrQwrprhyrf

!((

#$ 6qqvvhy8svthvvur@hyr

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

!((

ThyrQwrprhyrf

#$

QvprSrtvr

Uhx9rsvvv

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.

Dyrrhv8pr

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.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Two tags of the 7vhUht type are required. In the example, these are the 7DIvfrftf and 7DIvfrftf tags. These tags control the operation of the "Forward" and "Back" buttons. A tag of the Vvtrq %7vWhyr type is required. In the example, this is the V %vfrftf tag. This tag stores the current position in the picture register. A tag of the UrUht %7v8uhhprTr type is required. In the example, this is the U %frftf tag. This tag stores the current picture name. A project function for controlling the picture register is available. This is the 8rhrQvprTrrpr function, which is called at every picture change. This is accomplished by a 86pv at @rQrUvpHvpryyhr QvprIhr of the Xxhpr object in the rffhvprfQ9G. 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 rf!fxrihqfQ9G, two control elements for scrolling backward and forward are configured.

If one of these elements is operated, the 8rhrQvprTrrpr project function will be called. This function performs the picture change. The two control elements can be disabled via two ThPiwrpBhuvpPiwrp. 4 The following button displays a picture containing the current picture register. In the example, this is the rf(frtvrfQ9G.

In this picture, 10 ThqhqPiwrpThvpUr are configured. The set text is deleted at all objects. For the picture object, create a 86pv at Qrvr BrrQvprXvqu, which calls the 8rhrQvprTrrpr project

WinCC Configuration Manual C79000-G8276-C140-01

4-145

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

function. This function transfers the stored picture names to the ThvpUr. The 86pv is triggered upon the change of the U %frftf tag. This updates the display at a picture change. For each ThvpUr, create 86pv at @rHrQrGrs, 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 9hvp9vhyt at Qrvr8yA8y 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 6Q9@A6QC file. This file is located in the Gvih 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

!((

ThyrQwrprhyrf

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 Ayht has the value of S@BfDIT@SUQD8UVS@, the function was called by the 86pv at @rQrUvpHvpryyhrQvpr Ihr of the Xxhpr object in the rffhvprfQ9G. The Xxhpr 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 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

ThyrQwrprhyrf

!((

If the transfer parameter Ayht has the value of S@Bf768F, 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 Ayht has the value of S@BfAPSX6S9, 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 Ayht has the value of S@BfTCPXS@BDTU@S, the Thvp Ur in the rf(frtvrfQ9G 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 Ayht has the value of S@Bf9DS@8U, a direct picture selection via the ThvpUr has been performed. The picture change is performed by the 86pv at the ThvpUr and is not entered into the register.

Brrhy6yvphvIr

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 S@Bf9DS@8U and S@BfTCPXS@BDTU@S from the project function can be omitted. If the number of stored pictures is to be modified, the definition H6YfS@B (for the maximum number of pictures) in the project function must be changed.

4-148

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

#$! Uhiyrs8r

The example projects table of contents can be displayed by clicking on the above button . with the

Uhx9rsvvv

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.

Dyrrhv8pr

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.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Two tags of the Vvtrq %7vWhyr type are required. In the example, these are the V %vfrfpf and V %vfrfpf tags. These tags store the currently selected chapter number and example number. A picture of the dialog boxs layout is available. This is the rf(frtvrf Q9G. For each chapter, a ThqhqPiwrpThvpUr and a ThPiwrpBhuvpPiwrp is configured. At the opening of the picture, no chapter is selected. The V %vfrfpf tag , the corresponding has the value of zero. If a ThvpUr is selected with the chapter number is written into the tag. Using multiple 9hvp9vhyt, the coloring of the selected ThvpUr is changed.

WinCC Configuration Manual C79000-G8276-C140-01

4-149

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

A separate picture is configured for each chapter, which, depending on the selected chapter number, is displayed in a ThPiwrpQvprXvq. If no chapter is selected, the picture window will not be displayed. Each example also contains a ThqhqPiwrpThvpUr. If a chapter is selected, no example is selected at first. If a ThvpUr is selected with the the corresponding example number is written into the V %vfrfpf tag. Using multiple 9hvp9vhyt, the coloring of the selected ThvpUr is changed.

To realize the picture selection via double-click, three external C-tags have been created. They are generated using the 8rhr@rhy project function. This function is executed once at the start of the project: extern BOOL bPress1,bPress2
extern int nButtonID A 86pv at the pictures QrvrBrrQvprXvqu queries, in 500 ms cycles, if a double-click has been performed. If this is the case, an action is performed depending on the 7D9 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 ThvpUr. This will determine the action to be performed. At each mouse click, iQr and iQr! are alternately set to USV@.

4-150

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

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 USV@, a double-click has been performed on a ThvpUr in the past 500 ms. The 86pv is executed every 500 ms. After every call, both external C-tags are reset to A6GT@. If a double-click is detected, an action is performed depending on the 7D9 tag. This tag contains information about which ThvpUr was selected. Return of the picture width.

WinCC Configuration Manual C79000-G8276-C140-01

4-151

ThyrQwrprhyrf

!((

#$" 9vhyt7rsTrvt8yrf"fpuhrf

p

The dialog boxes for setting colors described in this example are displayed by selecting the above button from the rf"fpuhrf pQ9G with the .

Uhx9rsvvv

Using several dialog boxes, the color settings of the table described in the UhtGttvt chapter, example # #Vrqrsvrqhiyryhrf"fpuhrf pQ9G, can be changed. The background color of the table as well as each columns font color are to be changeable.

Dyrrhv8pr

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.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Five tags of the Vvtrq"!7vWhyr type are used. In the example, these are the 8PfUDH@, 8PfH6Y, 8PfHDI, 8PfH@6I and 8Pf768F tags. These tags store the current color values. A tag of the Vvtrq"!7vWhyr type is required. In the example, this is the 8PfU@HQ tag. This tag serves as a buffer for the color value to be accepted with an PF7. A tag of the UrUht %7v8uhhprTr 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 8Pf6qqrUht. The table configured in the rf"fpuhrf pQ9G consists of several individual objects. All properties of these objects that are changeable have a Uht 8rpv to one of the color tags. A picture of the first dialog boxs layout is available. This is the rf fA9fQ9G. For each property that can be set, a ThqhqPiwrp ThvpUr and a ThqhqPiwrpSrphtyr is configured. The rectangle displays the currently set color of each property. This is realized via a Uht8rpv to the corresponding color tag. Create a 86pv for the Srphtyr and ThvpUr at @rHrQrGrs, 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 Qrvr BrrQvvY of the BhuvpPiwrp .

4-152

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

The layout of the second dialog box has been configured in another picture. This is the rf fA9f Q9G. For each color that can be selected, a ThqhqPiwrp Srphtyr is configured whose background color matches the color to be set. Also configure a 9vrp8rpv for each color at @rHrQr Grs. This direct connection switches the value of the 7hpxtq8y Qr of the selected object to the color tag contained in the address tag.

Configure a 9vrp8rpv for each Srphtyr at @rHrHr 6pv, which turns the current window invisible. Via a separate XvqPiwrp7, the next dialog box can be opened.

WinCC Configuration Manual C79000-G8276-C140-01

4-153

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

The layout of the third dialog box has been configured in another picture. This is the rf fA9f"Q9G. Just as described in step 4, a ThqhqPiwrp Srphtyr is configured for each color that can be selected. However, the 9vrp 8rpv at @rHrQrGrs is not writing the color tag indicated by the address tag, but the temporary color tag 8PfU@HQ. 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 ThPiwrpBhuvpPiwrp is configured, which displays the current color value contained in the 8PfU@HQ tag. In the example, this is the Tryrpv object. The position of this object is changed, if a rectangle is selected, via a 86pv at @rHrQrGrs.

In the rf"fpuhrf pQ9G, a ThPiwrpQvprXvq is configured for each dialog box. The QvprXvq containing the first dialog box is opened via a XvqPiwrp7.

4-154

WinCC Configuration Manual C79000-G8276-C140-01

!((

ThyrQwrprhyrf

#$# 7hBhu9vyhrf"fpuhrf

r
%

The bar graph display described in this example was used in the UhtGttvt chapter, # 6puvvthTrUvrrf"fpuhrf rQ9G example.

Uhx9rsvvv

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.

Dyrrhv8pr

Each bar graph consists of a ThPiwrpTh9vyh, which displays the foreground of the bar graph, and a ThPiwrpQvprXvq, in which the background of the bar graph is displayed. A 9hvp9vhyt controls the height of the QvprXvq depending on the value of the tag to be displayed.

DyrrhvvurBhuvp9rvtr
Tr Qprqr)DyrrhvvurBhuvp9rvtr

Three pictures are available, each consisting of a ThPiwrpBhuvp Piwrp. These are the rf f7CfQ9G, rf f7Cf Q9G and rf f7Cf!Q9G. Each BhuvpPiwrp contains a bitmap, which displays the background of the bar graph. In the rf"fpuhrf rQ9G, three ThPiwrpTh9vyh 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 ThPiwrpQvprXvq is placed over each Th9vyh. The pictures described in step 1 are set at QrvrHvpryyhrQvpr Ihr. Configure a 9hvp9vhyt at QrvrBrrXvqCrvtu, 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

ThyrQwrprhyrf

!((

Tr

Qprqr)DyrrhvvurBhuvp9rvtr

Only positive values can be displayed. Therefore, the absolute value of the tag is formed using the hi function. The maximum value that can be displayed is 100. Since the QvprXvq 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 ThPiwrpThqvyh on the toolbar, the bar graphs can be deactivated. This is done via 86pv at @rHrQrGrs. This 86pv toggles the visibility of the vprvq, 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

!((

Vr6puvr

 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

Vr6puvr

!((

$

Vr6puvr

At runtime you can access the examples concerning this subject by choosing the button in the rhyrfV6 project. The examples are configured in illustrated above using the pictures rf"fpuhrf qy to rf"fpuhrf pqy.

Brrhyvshv

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

!((

Vr6puvr

$

8rhvthVr6puvrrf"fpuhrf

Q9G

Uhxqrsvvv

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.

Dyrrhvppr

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.

Ir)

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.

8rhvthhpuvr
Tr Qprqr)8rhvth6puvr

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 T"!vfrfV6vf to T"!vfrfV6vf$ of the vtrq"!ivhyr type. Further, a type 'ivsrht is created for storing the data record name. In our example, this is tag U'vfrfV6vf . Open the rhpuvrrqv. You do this by clicking Vr6puvr in 8y8rr.

85

on the entry called

Create a new archive. Click 5 on the 6puvr 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

Vr6puvr

!((

Tr

Qprqr)8rhvth6puvr

Fill out the wizards page called BrrhyDshv. At this stage you give general details about the archive you want to create. You have to enter the hpuvrhr. 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 Vr6puvrfv as the name in the 6puvrIhr box. In the 6yvh 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 6yvh box blank. Further, we have to select the hpuvrr. If this is set to Gvvrq, we will have to specify the maximum number of qhhrpq that the archive will be allowed to hold. In our example, we will set Vyvvrq as the hpuvrr. The wizards page is closed by clicking Ir.

Fill out the wizards 8vphv page. At this stage we have to specify how our new archive will communicate with the rest of the project. If we select 8vphvvhXv88Sh9hhUht, 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 QG8D9, 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 8vphvvhXv88Uht, 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 I 8vphv. In the present example, we select Ur as 8vphvvhXv88Uht . The wizards page is closed by clicking Ir.

5-4

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8rhvth6puvr

Fill out the wizards 8yUht 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 $ $Xxvtvu8yUhtrf"fpuhrf !Q9G contains a detailed description of this subject. The wizards page is closed by clicking Ir.

Fill out the wizards QvvyrtrhqAyht page. In the Qvvyrtr box, we can set authorization levels for the rhq and vr types button opens a dialog box containing a list of access. Clicking the of all the authorization levels created using the Vr6qvvh editor. You can choose the authorization level you require from the list. Section ""Tuq Xv88hpprrpv contains an in-depth description of configuring users and authorization levels with the Vr6qvvh editor. Pre-defined columns can be inserted into the archive in the Ayht 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

Vr6puvr

!((

Tr

Qprqr)8rhvth6puvr

In our example, we will not perform any settings on this page of the wizard. The wizards page is closed by clicking Avvu.

The archive you have just configured now appears in the tree structure under the entry 6puvr.

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

!((

Vr6puvr

Ir)

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 @qvPv from the menu and deselecting the corresponding check box. The same applies to boxes, views and columns.

8svtvtqhhsvryq
Tr Qprqr)8svtvt9hhAvryq

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 BrrhyDshv. At this stage you provide general details about the box you want to create. You have to enter the ihr. The box name is subject to the same constraints as the archive name. In our example, we will use the name SrpqIhr as the ihr. In the 6yvh box, you can enter a long name that is not subject to any constraints. If a name is entered in the 6yvh box, it is used at runtime as a column heading. If you do not enter a name, the ihr is used as the column heading. There is also the possibility of entering the hyvh directly or of using a reference to a text in the ryvih. 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 r yvih or selecting text from the ryvih. Text entered in the Ur box is entered in the ryvih by clicking PF. The hyvh used is then a reference to this text. You can search for existing text in the Tryrp 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 svyr. In this case the character is used a wildcard character. If you just enter , the whole contents of the ryvih is displayed in the list on the list box updates its contents. box. Clicking In our example, we will enter ihr as r. Close the UrGvih dialog box by clicking PF.

WinCC Configuration Manual C79000-G8276-C140-01

5-7

Vr6puvr

!((

Tr

Qprqr)8svtvt9hhAvryq

Further, we have to select the r of box. At the present time the types available are irvrtr, irqiyr, vt and qhrvr. In our example, we will set the r of box to vt. We also have to set the string yrtu for this type. In our example, we will set the value to !. The wizards page is closed by clicking Ir.

Fill out the wizards page called Whyr. Here we can set numeric box types to Hhv, Hvv and also ThWhyr. In the case of text boxes, we can enter a default value for the hhyr that is dependent upon the defined length. If 8vphvvhXv88Uht has been configured, we have to set a corresponding tag for every box. In our example, we will select the text tag called U'vfrfV6vf , which we configured earlier. The wizards page is closed by clicking Ir.

5-8

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvt9hhAvryq

Fill out the wizards QvvyrtrhqAyht page. In the Qvvyrtr box we can set authorization levels for the rhq and vr 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 Ayht box, we can assign various properties to the box. The following properties can be assigned: The uhrhhyr, which was must not be zero. The uhrhvrhyr, the values of this column must all differ from each other. The iuyqirrqihvqr. In our example, we will not perform any settings on this page of the wizard. The page is closed by clicking Avvu.

In our example, let us now create five more boxes. We want them to be irvrtr type boxes. The names of the boxes will range from Qrrfh to Qrrfr; the aliases of the boxes will range from Qrr to Qrr$. A

WinCC Configuration Manual C79000-G8276-C140-01

5-9

Vr6puvr

!((

Tr

Qprqr)8svtvt9hhAvryq vtrq"!ivht, 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 Vr6puvrfv 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 QwrpThr from the menu. When doing so, make sure that the rhpuvrrqv 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

!((

Vr6puvr

$

! 9hh@rf"fpuhrf Q9G

Uhxqrsvvv

The present example is based on the previous example $  8rhvthVr6puvr rf"fpuhrf Q9G. 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.

9hhrvurrhpuvrrqv
Tr Qprqr)9hh@vurVr6puvr@qv

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

Vr6puvr

!((

Dvtqhhs8TWsvyr
Tr Qprqr)Dvt9hhs8TWAvyr

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 @ dialog box is displayed.

In the AvyrTryrpv 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 AvyrTryrpv box is the one called rfV6vp. We leave 8TW (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 6puvrTryrpv box we set the Vr6puvrfv archive. We will keep 6yy as the svyr 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

!((

Vr6puvr

Tr

Qprqr)Dvt9hhs8TWAvyr

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 Hvps@pry Avyr to rsvyr.

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 AvyrThr6 from the menu as vfV6vp. 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 I, 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

Vr6puvr

!((

Tr

Qprqr)Dvt9hhs8TWAvyr

In the AvyrTryrpv box, we set the file receiving the data by clicking the button. In our example, the file we set in the AvyrTryrpv box will be the one we created earlier, in other words vfV6vp. button to In the AvyrAh box, we left 8TW 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 6puvrTryrpv box; In our example, it will be Vr6puvrfv. 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.

Ir)

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

!((

Vr6puvr

$

" 8svtvthUhiyrWvrrf"fpuhrf

Q9G

Uhxqrsvvv

The present example is based on the two preceding examples, $  8rhvthVr 6puvrrf"fpuhrf Q9G and $ !9hh@rf"fpuhrf Q9G. 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.

Dyrrhvppr

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.

DyrrhvvBhuvp9rvtr
Tr Qprqr)DyrrhvvBhuvp9rvtr

1 2

Open Bhuvp9rvtr and create a new picture. In our example, this is the picture called rf"fpuhrf qy. Configure an OLE control at ThPiwrpPG@8y. The Dr Pyr8y dialog box is opened.

In this dialog box, we select the entry Xv88Vr6puvrUhiyr8y from the list of available OLE controls and close the dialog box by clicking PF. The deactivated Xv88Vr6puvrUhiyr8y appears. In our example, we use the object called PG@8y . 3 Click box.

8'

on the object known as PG@8y to open its Properties dialog

WinCC Configuration Manual C79000-G8276-C140-01

5-15

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

On the BrrhyDshv tab, we select the 6puvr option in the Tpr box. In the present example, we cannot select Wvr since we have not configured any views as yet. The archive we select is Vr6puvrfv. In the @qv 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 7qr. In addition, we can also display the object in form view. In our example, we select the 7qr check box. But we do not select the A check box.

We can select the data fields, which we want to have displayed in the table, on the 8y 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 Qrvr 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

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

On the Uyih 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 8yrh 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 Th7h 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 8yrh check box is selected, the status bar is not displayed.

WinCC Configuration Manual C79000-G8276-C140-01

5-17

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

On the A tab, we can customize the font used by the OLE control. In our example, we will reduce the vr 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 AvyrT 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 8y 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 PG@8y object Properties dialog box provided by WinCC.

10

5-18

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

11 12

Complete the settings in the QrvrsXv88Vr6puvrUhiyr8y dialog box by clicking PF.


PG@8y

Set the table color scheme. Click object.

85

to open the Properties dialog box of the

In our example, we will adapt the colors Bvq7hpx8y, 7hpx8y and Crhqr7hpx8y 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 QrvrsXv88Vr6puvrUhiyr8y 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

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

We can check some of the configurations we have performed in Bhuvp


9rvtr. Click to open the object.

8'

on the PG@8y object while keeping CTRL pressed

Configure five pointer-type instruments to display the tags that have to be written by Vr6puvr. These are Xv88thtrpy type OLE controls configured at ThPiwrpPG@8y. In our example, these are objects PG@ 8y! to PG@8y%.

5-20

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

At each of the objects, we create a htprpv to one of the five integer tags that have to be written by the archive at QrvrPG@8yQrvr Whyr. To be in a position to simulate a change of the values of these tags, five slider objects are configured at ThPiwrpTyvqrPiwrp. In our example, these are objectsTyvqrPiwrp to TyvqrPiwrp$. At each of these objects, we create one htprpv to one of the corresponding tags at QrvrHvpryyhrQpr9vr 8rpv. Further, a qvrpprpv to the same tag is created at @r QrUvpHvpryyhrQpr9vr8rpv8uhtr. For these qvrpprpv, the pr uviwrpQpr9vr8rpvis connected to the qrvhv of the corresponding ht. 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 ThqhqPiwrpThvpUr to display the data record that is currently being loaded to the tags. In our example, we use the object called ThvpUr!. At this object, we create a htprpv to U'vfrfV6vf tag containing the name of the data record at QrvrA Ur. 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 8hpv at picture object rf"fpuhrf by selecting @rHvpryyhrPrQvpr. This 8hpv writes the words Iqhh rpq to the tag if it is blank.

WinCC Configuration Manual C79000-G8276-C140-01

5-21

Vr6puvr

!((

Irtrrhyr

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 Bhuvp 9rvtr. 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 XvrUht button is used to write the data record selected in the table to the tags set in Vr 6puvr. The SrhqUht button is used to read in the current values of the tag set in Vr6puvr 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 $ !9hh@ rf"fpuhrf Q9G. We can use the Avyr and T 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 Bhuvp9rvtr.

5-22

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

$

# 8svtvthAWvrrf"fpuhrf

Q9G

Uhxqrsvvv

The present example is based on the two preceding examples, $  8rhvthVr 6puvrrf"fpuhrf Q9G and $ !9hh@rf"fpuhrf Q9G. 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.

Dyrrhvppr

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.

DyrrhvvBhuvp9rvtr
Tr Qprqr)DyrrhvvBhuvp9rvtr

1 2

Open Bhuvp9rvtr and create a new picture. In our example, this is the picture called rf"fpuhrf qy. Configure an OLE Control object at ThPiwrpPG@8y. The Dr Pyr8y dialog box is opened.

In this dialog box, we select the entry Xv88Vr6puvrUhiyr8y from the list of available OLE controls and close the dialog box by clicking PF. The deactivated Xv88Vr6puvrUhiyr8y appears. In our example, we use the object called PG@8y . 3 Click box.

8'

on the object known as PG@8y to open its Properties dialog

WinCC Configuration Manual C79000-G8276-C140-01

5-23

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

On the BrrhyDshv tab, we select the 6puvr option in the Tpr box. In the present example we cannot select Wvr since we have not configured any views as yet. The archive we select is Vr6puvrfv. In the @qv 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 SrhqPy check box. We can display the OLE control with 7qr. In addition, we can also display the object in form view. In our example, we select the 7qr and A check boxes. On the Uyih tab, we can configure a toolbar. In our example, however, we select the 8yrh check box. This means that the toolbar will not be displayed at runtime. On the Th7h 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 8yrh tab. This means that the status bar will not be displayed at runtime, either. In our example, the vr of the font was reduced to (&$ on the Atab. 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 QrvrsXv88Vr6puvrUhiyr8y dialog box by clicking PF. For us to be able to configure the form view, OLE control has to be activated in Bhuvp9rvtr. 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 Ur 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 Ur input box, or selecting the name of a data field from the drop-down list. In our example, the box name SrpqIhr has been selected from the drop-

5-24

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

down list for the Ur box.

10

Configure the editing box that matches the text box. This is accomplished by clicking 5 on the activated OLE control. We choose @qv 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 SrpqIhr box has been selected from the drop-down list for the Avryq 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 i 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 Ur input box. In our example, the r we use is the string 11. Its purpose is to symbolize the function of the button for going to the first data record. In the 6pv 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 Th function.

WinCC Configuration Manual C79000-G8276-C140-01

5-25

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

15

We then configure three more buttons. We want them to trigger 7hpx, Ahq and @q 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 SrhqUht and XvrUht.

16

Configure five pointer-type instruments to display the tags that have to be written by Vr6puvr. These are Xv88thtrpy type OLE controls configured at ThPiwrpPG@8y. In our example, these are objects PG@ 8y! to PG@8y%. At each of the objects, we create a htprpv to one of the five integer tags that have to be written by the archive at QrvrPG@8yQrvr Whyr. To be in a position to simulate a change of the values of these tags, five slider objects are configured at ThPiwrpTyvqrPiwrp. In our example, these are objectsTyvqrPiwrp to TyvqrPiwrp$. At each of these objects, we create a htprpv to one of the corresponding tags at QrvrHvpryyhrQpr9vr8rpv. Further, a qvrpprpv to the same tag is created at @rQrUvp HvpryyhrQpr9vr8rpv8uhtr. For these qvrp prpv, the pr uviwrpQpr9vr8rpvis connected to the qrvhv of the corresponding ht. 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 ThqhqPiwrpThvpUr to display the data record that is currently being loaded to the tags. In our example, we use the object called ThvpUr!. At this object, we create a htprpv to the

5-26

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

tag containing the name of the data record at QrvrA Ur. 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 8hpv at picture object rf"fpuhrf at @r HvpryyhrPrQvpr. This 8hpv writes the words Iqhhrpq to the tag if it is blank.
U'vfrfV6vf

WinCC Configuration Manual C79000-G8276-C140-01

5-27

Vr6puvr

!((

$

$ Xxvtvu8yUhtrf"fpuhrf !Q9G

Uhxqrsvvv

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.

Dyrrhvppr

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.

8rhvthhpuvr
Tr Qprqr)8rhvth6puvr

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 B%#vfV6pf to B%#vfV6pf" of the syhvt v%#ivD@@@&$# type. Further, a type 'ivsr tag is created for storing the data record name. In our example, this is tag U'vfV6pf . Open the user archive editor. We create a new archive in the user archive editor. Click 5 on the 6puvr entry to open a wizard for this purpose.

We enter the hpuvrhr on the wizards first page. In our example, we enter Vr6puvrfp as the name in the 6puvrhr box. We will leave the 6yvh box blank. We choose Gvvrq as the hpuvrr. In keeping with the task set, the maximum number of qhhrpq is set to ". The wizards page is closed by clicking Ir. On the wizards second page, we select the type of communication. In the present example, we select Ur as 8vphvvhXv88Uht . The wizards page is closed by clicking Ir. 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

!((

Vr6puvr

Tr

Qprqr)8rhvth6puvr

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 prpv 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 vrhy as the type of tag. We will keep to the names for the tag group and individual tags as proposed by the wizard. Click PF to close the 8rhr8yUht dialog box.

The tags you have just created are then automatically entered in the corresponding boxes for D9, Ei, Avryq and Whyr. 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 Avvu.

WinCC Configuration Manual C79000-G8276-C140-01

5-29

Vr6puvr

!((

Tr

Qprqr)8rhvth6puvr

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 vvhyr of -" and a hvhyr of $. We set the yrtu 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.

DyrrhvvBhuvp9rvtr
Tr Qprqr)DyrrhvvBhuvp9rvtr

1 2

Open Bhuvp9rvtr and create a new picture. In our example, this is the picture called rf"fpuhrf !qy. Configure an OLE Control object at ThPiwrpPG@8y. It will only be used in our example to display archive data and will not be given any control elements. The DrPyr8y dialog box is opened.

5-30

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

In this dialog box, we select the entry Xv88Vr6puvrUhiyr8y from the list of available OLE controls and close the dialog box by clicking PF. The deactivated Xv88Vr6puvrUhiyr8y appears. In our example, we use the object called PG@8y . 3

' on the object known as PG@8y to open its Properties dialog Click box. On the BrrhyDshv tab, we set the Tpr field to Vr6puvrfp, the hpuvr you configured earlier. Keep SrhqPy as the setting in the @qv box. In our example, we deselect the 7qr check box. The A check box likewise remains deselected.
On the Uyih tab, we select the 8yrh check box. Similarly, we select the 8yrh check box on the Th7h tab. This results in the table being displayed without the toolbar or the status bar. Complete the settings in the QrvrsXv88Vr6puvrUhiyr8y dialog box by clicking PF. Configure three bar graphs to display the tags that have to be written by Vr 6puvr by selecting ThPiwrp7hBhu. In our example, these objects are 7h to 7h". We create a htprpv to one of the three double tags that have to be written by the archive at each of the objects by selectingQrvrHvpryyhr Qpr9vr8rpv. For us to be in a position to simulate any change of values for these tags, two buttons are configured at XvqPiwrp7 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

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

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 XvqPiwrp7 in our example. They write a suitable value, via qvrpprpv, to the tag, 5V6fVr6puvrfpfD9, set for the ID. The current tag value is displayed by means of an I/O field created at ThPiwrp DPAvryq.

To select the data record using the field name and a search value, we configure four buttons at XvqPiwrp7. They write a suitable field name, via qvrpprpv, to the tag, 5V6fVr6puvrfpfAvryq, set for the field name. The current tag value is displayed by means of an I/O field created at ThPiwrpDPAvryq. We configure another I/O field at ThPiwrpDPAvryq 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

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

In our example, we can switch to and fro between two possible selections for data records by means of two buttons configured at XvqPiwrp7. A ivhht type is used to disable the input objects of the one version and then the other.

10

XvqPiwrp

To trigger jobs for the data record we selected, we configure two buttons at 7. They write a suitable value, via qvrpprpv, to the tag, 5V6fVr6puvrfpfEi, 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 qhvpqvhyti created at Th PiwrpDPAvryq.

WinCC Configuration Manual C79000-G8276-C140-01

5-33

Vr6puvr

!((

$

% 8rpvtvhXv88Uhtrf"fpuhrf

hqy

Uhxqrsvvv

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.

Ir)

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.

Dyrrhvppr

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.

TDH6UD8T$@urrGhr#pvphvqvr

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.

8svtvtur8Q # "pvphvpr
Tr Qprqr)8svtvtur8Q # "8vphvQpr

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 D@T& # " in the list box displayed on the page labeled 8r. Installation is completed by clicking Ir. Following this, the computer has to be rebooted.

5-34

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8Q # "8vphvQpr

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 TrQthvt9rvprQ8Drshpr 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 8QC f ).

WinCC Configuration Manual C79000-G8276-C140-01

5-35

Vr6puvr

!((

Tr

Qprqr)8svtvtur8Q # "8vphvQpr

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 Hqyr box. The DhyyVvhyyHqyr dialog box opens. In the left list box, we select the 8Q button.
# "

entry and install the card using the

5-36

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8Q # "8vphvQpr

The 8Q

dialog box opens. The set memory area @ can frequently not be used. We recommend the 9 9AAAA area. By default, the I/O area is set to "@"@& and can be influenced by jumpers on the card.
# "Srpr @AAAA

To avoid duplicate assignment of the memory area and interrupts, it is sensible to look in XvqIU9vhtvp. You do this by choosing the Thr Qth6qvvhvrUy8XvqIU9vhtvp.

The XvqIU9vhtvp program appears. In this program, select the Srpr 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 8Q # "Srpr dialog box are now completed by clicking PF and the DhyyVvhyyHqyr dialog box is closed. Assign the card you have just installed to the access point. To do this, in the Tr Qthvt9rvprQ8Drshpr program, select access point 8QfC f ) in the top list box and select the entry for the 8Q # " in the bottom list.

WinCC Configuration Manual C79000-G8276-C140-01

5-37

Vr6puvr

!((

Tr

Qprqr)8svtvtur8Q # "8vphvQpr

Set the properties of the 8Q

# "

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 @urrH686qqr tab.

8svtvturprpvurthhiyrytvppyyr
Tr Qprqr)8svtvtur8rpvurQthhiyrGtvp 8yyr

Configure the connection on the programmable logic controller. This is done with the TDI@8I8H COM package for the processor we are using. Open the 9rshyTrvt dialog box by choosing AvyrTryrpfrom the menu. For the 8QUr, we enter 8Q #". The qhhihrsvyr we create in our example is the file called 6VTS6S8. The file name must start with an A character. Apply the settings you have performed with A&. Choose @qv8QDv from the menu to open the 8Q7hvpDvvhyvhv dialog box. We will leave the H686qqr 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 A&. Create two transport connections. This is accomplished by choosing @qv 8rpvUh8rpv from the menu. The Uh

5-38

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvurQthhiyrGtvp 8yyr

dialog box opens. A transport connection is now created for requesting data from the programmable logic controller to be transferred to WinCC. Specify A@U8C as the job type. Further, we set the programmable logic controller to Qhvr. In the Uh 6qqrr box, we enter 6B9A@U8C for the local parameter of UT6Qin our example. In addition to the UT6Q, 889A@U8C in our example, we also have to enter the Ethernet address of the CP-1413 card as the H68hqqr 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 A". Specify S@8@DW@ as the job type. We set the programmable logic controller to Qhvr. In the Uh6qqrr box, we enter 6B9XSDU@ for the local parameter of UT6Qin our example. We enter 889XSDU@ as the UT6Q 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 A&. It is always necessary to create read and write jobs. This also applies when one or the other type of job is not required.
8rpv

The data must now be transferred to the CP. This is accomplished by choosing 9yhqA938Q from the menu. However, this can be done only when the programmable logic controller has been stopped.

8svtvturprpvv8y8rr
Tr Qprqr)8svtvtur8rpvv8y8rr

Install the required communication driver for the requisite programmable logic controller and the requisite driver connections. In 8y8rr, click 5 on UhtHhhtrr to open the 6qqIr9vr dialog box.

Select TDH6UD8T$@urrGhr# from the list shown in the dialog box. Exit the dialog box by clicking Pr.

WinCC Configuration Manual C79000-G8276-C140-01

5-39

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

Configure a connection for the communication driver you have just added. This is accomplished in 8y8rr by clicking 5 on the entry of one of the two channel units that are displayed. In our example, we will use the T$Uh8Q # "  channel unit.

The 8rpvQrvr dialog box is displayed. Enter the name of the new connection on the BrrhyDshv tab. In our example, we use the name T$ $VXv886pvr. We set the properties of the connection on the 8rpv tab. In our example, we will keep to the default setting for the @urr6qqrsQG8. In the S@69Apv box, we select Arpu6pvr. 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 PUT6Q will be called 889A@U8C and the QrrUT6Q will be called 6B9A@U8C. In the XSDU@Apv box, our PUT6Q will be called 889XSDU@ and the QrrUT6Q will be called 6B9XSDU@ 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

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

Close the dialog box by clicking PF.

Set the system parameters for the channel unit being used. To do this, click on their entry.

85

The TrQhhrr dialog box opens. On the 9rvprIhr 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 UhQhhrr 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 PF. If modifications have been performed, exit

WinCC Configuration Manual C79000-G8276-C140-01

5-41

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

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

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 'ivsr tag. In our example, it is called U'frfV6qf . Its yrtu is set to .

5-42

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

Click the button to open the dialog box for setting the hqqr of the tag on the programmable logic controller. In the 6qqr9rpvv box, we select 97 for the qhhhrh in our example. We set the 97I to !. Select Xq for the addressing, and set 9X . Exit the dialog box by clicking PF.

WinCC Configuration Manual C79000-G8276-C140-01

5-43

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

Further, we create two vtrq"!ivhyr type tags and two syhvtv%#iv D@@@&$# type tags. The assigned names and the parameters assigned to the addresses comply with the following table.

For vtrq"!ivhyr type tags, we set 6qhTphyrGtUTvtrq9Xq in the UhtQrvr dialog box. For vtrq%#ivD@@@&$# type tags, we set 6qhTphyr9iyrUT$Ayh in the UhtQrvr 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 PvThs9vr8rpv in 8y8rr, keeps you informed of the status of the connection.

5-44

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

8rhvthqpsvtvtur97!vurTDH6UD8T$psvthv

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 97!. 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 9X  to 9X #. 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

Vr6puvr

!((

8svtvturVr6puvr
Tr Qprqr)8svtvtVr6puvr

Open the Vr6puvr editor and create a new archive by clicking 6puvr.

85

on

On the wizards first page, we enter Vr6puvrfq as the hpuvrhr and specify the hpuvrr as Vyvvrq. On the second page, we set 8vphvvhXv88Uht. 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.

Ir)

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.

8svtvtvBhuvp9rvtr
Tr Qprqr)8svtvtvBhuvp9rvtr

Create a new picture in Bhuvp9rvtr. In our example, this is the picture called rf"fpuhrf hqy. We configure an OLE control in this picture at ThPiwrpPG@8y. In the DrPyr8y dialog box that appears, we select the entry Xv88Vr 6puvrUhiyr8y from the list displayed. Close the dialog box by clicking PF. The deactivated Xv88Vr6puvrUhiyr8y appears. In our example, we use the object called PG@8y .

5-46

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtvBhuvp9rvtr

Click ' on the object known as PG@8y to open its Properties dialog box. On the BrrhyDshv tab, we select 6puvrVr6puvrfq as the Tpr. In the @qv field, we select the check boxes labeled Qhr, 8uhtr and 9ryrr to make all the editing options available to the user. In addition, we select the 7qr check box. On the 8y tab, we select all the existing data fields of the archive. On the Uyih and Th7h tabs, we apply the presettings and thus use all the existing elements. On the A tab, we will reduce the vr of the font to (&$ in order to be able simultaneously to display all columns of the table at runtime. On the AvyrT tab, we will not perform any settings for our example. Complete the settings in the QrvrsXv88Vr6puvrUhiyr8y dialog box by clicking PF. 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 PG@8y object. We configure an I/O field at ThPiwrpDPAvryq to display the data record name. In our example, we use the object called DPAvryq$. At QrvrPDPWhyr, we create a htprpv to tag U'frfV6qf . Select QrvrPD to modify the qhh sh to vt on the object. The other four tags are all displayed by means of an I/O field created at Th PiwrpDPAvryq and a bar graph created at ThPiwrp7hBhu. At the DPsvryq, create a htprpv to every one of the four tags at QrvrPDPWhyr. In the case of the bars, create corresponding htprpv in a similar manner at Qrvr HvpryyhrQpr9vr8rpv.

WinCC Configuration Manual C79000-G8276-C140-01

5-47

Vr6puvr

!((

Irtrrhyr

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

!((

Vr6puvr

$

& 8rpvvhXv88Sh9hhUhturT$ rf"fpuhrf iqy

Uhxqrsvvv

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.

Ir)

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.

Dyrrhvppr

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.

Ir)

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

Vr6puvr

!((

8svtvtur8Q # "8vphvQpr

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.

8svtvturprpvurthhiyrytvppyyr
Tr Qprqr)8svtvtur8rpvurQthhiyrGtvp 8yyr

In the TDI@8I8Hs8PH communication package, choose AvyrTryrp to open the 9rshyTrvt dialog box. For the 8QUr, we enter 8Q #". The qhhihrsvyr we open is the 6V6S8CDW file we used in the previous example. Apply the settings you have performed with A&. Create two new transport connections. This is accomplished by choosing @qv 8rpvUh8rpv from the menu. The Uh 8rpv 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 A". Specify T@I9 as the job type. We set the programmable logic controller to 6pvr. In the Uh6qqrr box, we enter 6BSA@U8C for the local parameter of UT6Qin our example. In addition to the UT6Q, 88SA@U8C in our example, we also have to enter the Ethernet address of the 8Q # " card as the H68hqqr for the remote device parameter. A transport connection is now created for sending data to the programmable logic controller from WinCC. Specify S@8@DW@ as the job type. We set the programmable logic controller to Qhvr. In the Uh6qqrr box, we enter 6BSXSDU@ for the local parameter of UT6Qin our example. We enter 88SXSDU@ as the UT6Q for the remote device parameter. We also have to specify the Ethernet address of the card again. Apply the settings you have performed with A&. The data must now be transferred to the CP. This is accomplished by choosing 9yhqA938Q from the menu. However, this can be done only when the programmable logic controller has been stopped.

8svtvtur8rpvv8y8rr
Tr Qprqr)8svtvtur8rpvv8y8rr

Configure a new connection for the TDH6UD8T$@UC@SI@UG6`@S# driver. The driver was installed in the preceding example already. Create the new 5 on the entry of one of the two connection in 8y8rr by clicking channel units displayed. In our example, we will use the T$Uh8Q # "  channel unit.

5-50

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

The 8rpvQrvr dialog box opens. Enter the name of the new connection on the BrrhyDshv tab. In our example, we use the name T$ $VXv88Qhvr. We set the properties of the connection on the 8rpv tab. In our example, we will keep to the default setting for the @urr6qqrsQG8. In the S@69Apv box, we select ArpuQhvr. 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 PUT6Q will be called 88SA@U8C and the QrrUT6Q will be called 6BSA@U8C. In the XSDU@Apv box, our PUT6Q will be called 88SXSDU@ and the QrrUT6Q will be called 6BSXSDU@ 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 PF.

WinCC Configuration Manual C79000-G8276-C140-01

5-51

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

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 T$ $VXv88Qhvr. The UhtQrvr dialog box opens.

Set the tag properties. The hr of the tag we use in our example is S6XfrfV6qf . We select the hqhhr from the list of qhhr.

5-52

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

Open the dialog box for assigning parameters to addresses by clicking the button. In the 6qqr9rpvv box, we select in our example the qhhhrh as 97 and 97I!". Further, we enter Xq6qqrvt and 9X. We select the Sh 9hh check box and set a yrtu of  for the tag. In the Sh9hh box, we select the TrqSrprvr7ypx option. Exit the 6qqrQrvr dialog box by clicking PF. Similarly, click PF to close the UhtQrvr 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 T$ $VXv886pvr 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 Vr6puvrfq.

WinCC Configuration Manual C79000-G8276-C140-01

5-53

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

The tags we need to create and their addressing on the programmable logic controller are shown at length in the list below. Tags U'frfV6qf , B%#frfV6qf and T"!frfV6qf are required to accommodate data sent to and from User Archive. Tags V"!frfV6qf! and V %frfV6qf" are to be used to set the record number that has to be edited or the field number that needs editing. Tag V %frfV6qf is used as a control tag. We wish to use it to set and trigger the type of job that has to be performed.

8svtvtVr6puvr
Tr Qprqr)8svtvtVr6puvr

Open the Vr6puvr editor and create a new archive. Do this by clicking on 6puvr. The wizard for creating a new archive appears.

85

2 3

On the BrrhyDshv page, we enter the hpuvrhr as Vr6puvrfq and specify the hpuvrr as Vyvvrq. On the 8vphv page, we set 8vphvvhXv88Sh9hhUht. Once this item has been selected, the QG8D9 input field can be used. In our example, we will use the name VTS6S8S9 as the QG8D9. 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, S6XfrfV6qf , in the Uht box.

5-54

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtVr6puvr

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.

Qthtrrhvurthhiyrytvppyyr
Tr Qprqr)QthBrrhvurQthhiyrGtvp8yyr

We have to create a data block in which we store the data for controlling and monitoring communication. This is control tag V %frfV6qf , which contains the job type. Further, there are the communication monitoring tags, U'frfV6qf , B%#frfV6qf and T"!frfV6qf , as well as the tags for setting the record number and field number for editing, V"!frfV6qf! and V %frfV6qf". In our example, this data block is 97! . Create a further data block which we can use to handle communication with User Archive. In our example, this is 97!". 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

Vr6puvr

!((

Tr

Qprqr)QthBrrhvurQthhiyrGtvp8yyr

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, $  Tprshqhhrhtrshr. 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, $  Tprsh qhhrhtrshr. 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 V"!frfV6qf! and V %frfV6qf". 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 9ryrr6yy9hhSrpq type. The data field number is required only for job types XvrAvryq and SrhqAvryq. The program block responsible for reloading the values is Q7& in our example. All communication handling is performed by another program block. In our example, this is Q7$. It is processed on a cyclic basis by means of P7 . The contents of the control tag are transferred to a specific memory byte in Q7$. 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 A7!##. The different transmit data for A7!## are stored in a separate data block. In our example, 97$ 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

!((

Vr6puvr

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

Vr6puvr

!((

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, V %frfV6qf , 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

!((

Vr6puvr

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.

8svtvtvBhuvp9rvtr
Tr Qprqr)8svtvtvBhuvp9rvtr

Create a new picture in Bhuvp9rvtr. In our example, this is the picture called rf"fpuhrf iqy. We configure an OLE control in this picture at ThPiwrpPG@8y. In the DrPyr8y dialog box that appears, we select the entry Xv88Vr 6puvrUhiyr8y from the list displayed. Close the dialog box by clicking PF. The deactivated Xv88Vr6puvrUhiyr8y appears. In our example, we use the object called PG@8y .

Click ' on the object known as PG@8y to open its Properties dialog box. On the BrrhyDshv tab, we select 6puvrVr6puvrfq as the Tpr. In the @qv field, we select check boxes Qhr, 8uhtr and 9ryrr to

WinCC Configuration Manual C79000-G8276-C140-01

5-59

Vr6puvr

!((

Tr

Qprqr)8svtvtvBhuvp9rvtr

make all the editing options available to the user. In addition, we select the 7qr check box. On the 8y tab, we select all the existing data fields of the archive. On the Uyih tab, we deselect the two buttons XvrUht and SrhqUht. Control is performed by the programmable logic controller in the present example. All the other buttons on the toolbar will be used. On the Th7h tabs, we apply the presettings and thus use all the existing elements. On the A tab, we will reduce the vr of the font to (&$ in order to be able simultaneously to display all columns of the table at runtime. On the AvyrT tab, we will not perform any settings for our example. Complete the settings in the QrvrsXv88Vr6puvrUhiyr8y dialog box by clicking PF. 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 PG@8y object. 3 To display the data transferred from User Archive to the programmable logic controller, we configure three I/O fields at ThPiwrpDPAvryq. In our example, these are the objects DPAvryq , DPAvryq! and DPAvryq". At the DPsvryq, we create - at QrvrPDPWhyr - a htprpv for each of the three tags U'frfV6qf , T"!frfV6qf and B%#frfV6qf .

To set the record number that has to edited and the field number, we create two more I/O fields at ThPiwrpDPAvryq. In our example, these are the objects DPAvryq# and DPAvryq$. At the object DPAvryq#, we create at QrvrPDP Whyr a htprpv to tag V"!frfV6qf!. This is used to accommodate the record number. At the object DPAvryq$, we create at QrvrPDP Whyr a htprpv to tag V %frfV6qf". This is used to accommodate the field number. To trigger actions on the programmable logic controller, we configure six buttons at XvqPiwrp7. In our example, these objects are 7 to 7 #. When a button is clicked, a different value is written to tag V %frfVhqf . 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

!((

Vr6puvr

Tr

Qprqr)8svtvtvBhuvp9rvtr

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.

Ir)

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 U'frfV6qf , B%#frfV6qf and T"!frfV6qf 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.

EisvvturQG8
Tr Qprqr)EisXvvturQG8

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 U'frfV6qf , B%#frfV6qf and T"!frfV6qf . 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 S6XfrfV6qf! 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 S6XfrfV6qf' 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 7( (write record to PLC) is operated by clicking , an internal tag of the ivhht type is set. In our example, this is tag 7DIvfrfV6qf .

WinCC Configuration Manual C79000-G8276-C140-01

5-61

Vr6puvr

!((

Tr

Qprqr)EisXvvturQG8

Further, control tag V %frfV6qf" 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 8hpv at QrvrBrrQvvY of the button that is triggered when tag S6XfrfV6qf! is modified. Any change to this tag signifies that new data have been sent. Tag 7DIvfrfV6qf is checked in the 8hpv. If it has been set, a new data record (as opposed to a new data field) has been sent. Project function 6phyvr9hhTr is then triggered and performs the re-store operation of the sent data to the WinCC tags. Further, tag 7DIvfrfV6qf is reset.

The procedure for writing fields to the PLC is similar to step 1. However, only a single field is processed. If object 7 " (write field to PLC) is operated by clicking , an internal tag of the ivhht type is set. In our example, this is tag 7DIvfrfV6qf!. Further, control tag V %frfV6qf" 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 8hpv at QrvrBrrQvvY of the button that is triggered when tag S6XfrfV6qf! is modified. Any change to this tag signifies that new data have been sent. Tag 7DIvfrfV6qf is checked in the 8hpv. If it has been set, a new data field (as opposed to a new data record) has been sent. Project function 6phyvr9hhAvryq 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 7DIvfrfV6qf! is reset.

5-62

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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 V %frfV6qf to a defined value. In this instance we use the value #. It causes the programmable logic controller to request a record. Set tag 7DIvfrfV6qf . 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 tag7DIvfrfV6qf . If it has been set, a data record has been sent. In this instance project function 6phyvr9hhTr is called. It re-stores the data area of the sent acknowledgement message frame in the WinCC tags. Further, tag 7DIvfrfV6qf is reset. This action is triggered upon a change to tag S6XfrfV6qf!. 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

Vr6puvr

!((

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 i9hh byte field. Reload the text box to the iTr byte field. These data correspond to data field SrpqIhr, which is present in the Vr6puvrfq archive. The 10-character field is the equivalent of ten bytes. Reload the double field to the iTr byte field. These data correspond to data field Urrhr, 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 iTr byte field. These data correspond to data field Qrr, which is present in the archive. An integer field requires an area of four bytes. The byte order has to be reversed. The iTr 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 S6XfrfV6qf!.

5-64

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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 $   Tprshqhhrhtrshr. 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 Q7&.

Ir)

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 Q7&, in addition to the data record number.
97!(

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

Vr6puvr

!((

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, $  Tprshqhhrhtr shr. The data are re-stored from the data area of the message frame by means of project function 6phyvr9hhTr 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 6phyvr9hhAvryq.

EisrhqvtsurQG8
Tr Qprqr)EisSrhqvtsurQG8

In the case of read jobs (read from the programmable logic controller), the data stored in tags U'frfV6qf , B%#frfV6qf and T"!frfV6qf 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 S6XfrfV6qf%, 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 S6XfrfV6qf&, 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 7  (read record from PLC) is operated by clicking , project function Ghq9hhTr 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 V %frfVhqf" 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 97!&.

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 7 # (read record from PLC) is operated by clicking function Ghq9hhAvryq 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 V %frfVhqf" 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 97".

5-66

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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 $   Tprshqhhrhtrshr. 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 Q7&. The data from the tags are entered in the data area of the message frame by means of project function Ghq9hhTr.
Ir)

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 Q7&, in addition to the data record number.
97"

WinCC Configuration Manual C79000-G8276-C140-01

5-67

Vr6puvr

!((

Eisqryrvtsurhpuvr
Tr Qprqr)Eis9ryrvtsurhpuvr

If object 7

(delete record) is operated by pressing , control tag is set by means of a qvrpprpv to a hexadecimal value of  . However, decimal values have to be entered in the 8h input field of the 9vrp8rpv dialog box. In the present case, the value is #(%.
V %frfV6qf

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 97!'.

If object 7

(delete record) is operated by pressing , control tag is similarly set by means of a qvrpprpv 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 97!$.
! V %frfV6qf

5-68

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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 $  Tprshqhhrhtrshr. 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 Q7&.

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.

Irtrrhyr

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

Vr6puvr

!((

$

' 8rpvvhXv88Sh9hhUhturT& rf"fpuhrf pqy

Uhxqrsvvv

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.
Ir)

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.

Dyrrhvppr

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.

TDH6UD8T&pyvrpvphvqvr

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

!((

Vr6puvr

8svtvturHQDphq
Tr Qprqr)8svtvturHQD8hq

Install the WinCC component called T&9. If this was not done at the time when WinCC was installed, the T&9 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 TrQthvt9rvprQ8Drshpr 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 HQDXv88.

WinCC Configuration Manual C79000-G8276-C140-01

5-71

Vr6puvr

!((

Tr

Qprqr)8svtvturHQD8hq

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 Hqyr box. The DhyyVvhyyHqyr dialog box is opened. In the left list box, we select the HQDDT68hq entry and install the card using the button.

5-72

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvturHQD8hq

The HQDDT68hqSrpr dialog box opens. The set memory area can frequently not be used. We recommend the 99&AA. area

To avoid duplicate assignment of the memory area and interrupts, it is sensible to look in XvqIU9vhtvp. You do this by choosing the Thr Qth6qvvhvrUy8XvqIU9vhtvp.

The XvqIU9vhtvp program appears. In this program, select the Srpr 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 HQDDT68hqSrpr dialog box are now completed by clicking PF and the DhyyVvhyyHqyr dialog box is closed. Assign the card you have just installed to the access point. To do this, in the Tr Qthvt9rvprQ8Drshpr program select access point HQDXv88 in the top list box and select the entry for the HQDDT68hq in the bottom list.

WinCC Configuration Manual C79000-G8276-C140-01

5-73

Vr6puvr

!((

Tr

Qprqr)8svtvturHQD8hq

Set the properties of the MPI ISA card. We do this by clicking the button. In the HQDDT68hqHQD Properties dialog box that appears, set a yphyqrhqqr for the card on the HQDIrx tab. The hvvhr we use on the S7-300 must be '&$xivrp. On the S7-400, even $Hivrp would be possible.

5-74

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvturHQD8hq

8svtvturprpvurthhiyrytvppyyr
Tr Qprqr)8svtvtur8rpvurQthhiyrGtvp 8yyr

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 Chqhr in TDH6UD8Hhhtr. The CX8svt 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 8QV#
Dshv

#!9QQrvr

dialog box that appears, select the Brrhy button to open the HQDVrQrvr

tab. Click the

dialog box.

WinCC Configuration Manual C79000-G8276-C140-01

5-75

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvurQthhiyrGtvp 8yyr

On the QrTy tab, enter a ! as the value for the hqqr in the Vr box. This value also has to be specified later in WinCC when we configure the connection. Finish the settings in the HQDVrQrvr dialog box by clicking PF. Close the 8QV# #!9QQrvr dialog box similarly by clicking PF. We can then exit the CX8svt program.

8svtvturprpvv8y8rr
Tr Qprqr)8svtvtur8rpvv8y8rr

Install the required driver for the necessary programmable logic controller and necessary driver connections. In 8y8rr, click 5 on option Uht Hhhtrr to open the 6qqIr9vr dialog box.

Select the TDH6UD8T&QpyTvr driver from the list shown in the dialog box. Exit the dialog box by clicking Pr.

5-76

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

Configure a connection for the driver you have just added. This is accomplished in 8y8rr by clicking 5 on the HQD channel unit entry.

The 8rpvQrvr dialog box is displayed. Enter the name of the new connection on the BrrhyDshv tab. In our example, we use the hr T&#Xv88Qhvr. We set the properties of the connection on the 8rpv tab. In our example, we set the hvhqqr to the value of ! that is set on the PLC. We have to set the values of the rtrD9, hpxir and yir in accordance with the conditions prevalent on the programmable logic controller. Select the TrqSrprvrSh9hh7ypx check box. We want this connection to be responsible for communication via WinCC raw data tags. The prpv rpr we enter in our example is . Close the dialog box by clicking PF.

WinCC Configuration Manual C79000-G8276-C140-01

5-77

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

Set the system parameters for the channel unit being used. To do this, click on their entry.

85

The TrQhhrr dialog box opens. Close the dialog box by clicking PF.

5-78

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

We create a new tag group in our example for the new connection we have created. In the IrUht dialog box, we use the name S6XfrfV6T&f in our example. We set the tag type to Sh9hhUr. button to open the 6qqrQrvr dialog box. We Click the select the Sh9hh check box. The value of the SfD9 we use in our example is $. 7T@I97S8W is used in the Raw Data Type box. Complete the settings in the 6qqrQrvr dialog box by clicking PF. Similarly, click PF to close the UhtQrvr 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

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

Configure a further connection for the TDH6UD8T&QpyTvr driver. We want to use it for communication for the normal WinCC tags. In the 8rpvQrvr dialog box, enter the name of the new connection on the BrrhyDshv tab. In our example, we use the hrT&# Xv886pvr. We set the properties of the connection on the 8rpv tab. In our example, we set the hvhqqr to the value of ! that is set on the PLC. We have to set the values of the rtrD9, hpxir and yir in accordance with the conditions prevalent on the programmable logic controller. Close the dialog box by clicking PF.

5-80

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)8svtvtur8rpvv8y8rr

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 T$ $VXv886pvr connection. In our example, the tag group in which we are going to create the tags will be called Vr6puvrfT&.

The tags we need to create and their addressing on the programmable logic controller are shown at length in the list below. Tags U'frfV6T&f , B%#frfV6T&f and T"!frfV6T&f are required to accommodate data sent to and from User Archive. Tags V"!frfV6T&f! and V %frfV6T&f" are to be used to set the record number that has to be edited or the field number that needs editing. Tag V %frfV6&f 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

Vr6puvr

!((

Tr

Qprqr)8svtvtur8rpvv8y8rr

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 PvThs9vr8rpv in 8y8rr, keeps you informed of the status of the connection. For the TDH6UD8QpyTvr 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 r clicking hhrr entry in the shortcut menu that is displayed. The TrQhhrr dialog box opens. The 8rpv tab displays the current states of the different connections.

5-82

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

8svtvturVr6puvr
Tr Qprqr)8svtvtVr6puvr

Open the Vr6puvr editor and create a new archive. Do this by clicking on 6puvr. The wizard for creating a new archive appears.

85

2 3

On the BrrhyDshv page, we enter Vr6puvrfT& as the hpuvrhr and specify the hpuvrr as Vyvvrq. On the 8vphv page, we set 8vphvvhXv88Sh9hhUht. Once this item has been selected, the QG8D9 input field can be used. In our example, we will use the name VTS6S8T& as the QG8D9. 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, S6XfrfV6T&f , in the Uht 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

Vr6puvr

!((

Tr

Qprqr)8svtvtVr6puvr

Qthtrrhvurthhiyrytvppyyr
Tr Qprqr)QthBrrhvurQthhiyrGtvp8yyr

We have to create a data block in which we store the data for controlling and monitoring communication. This is control tag V %frfV6T&f , which contains the job type. Further, there are the communication monitoring tags, U'frfV6T&f , B%#frfV6T&f and T"!frfV6T&f , as well as the tags for setting the record number and field number for editing, V"!frfV6T&f! and V %frfV6T&f". In our example, this data block is 97! . Create a further data block which we can use to handle communication with User Archive. In our example, this is 97!". 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, $  Tprshqhhrhtrshr. 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, $  Tprsh qhhrhtrshr. 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 V"!frfV6T&f! and V %frfV6T&f". 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 9ryrr6yy9hhSrpq type. The data field number is required only for job types XvrAvryq and SrhqAvryq. The program block responsible for reloading the values is A8& in our example. All communication handling is performed by another program block. In our example, this is A8$. It is processed on a cyclic basis by means of P7 . The contents of the control tag are transferred to a specific memory byte in A8$. 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

!((

Vr6puvr

Tr

Qprqr)QthBrrhvurQthhiyrGtvp8yyr

each case by the send block known as 7T@I9.

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

Vr6puvr

!((

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

!((

Vr6puvr

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, V %frfV6qf , 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.

8svtvtvBhuvp9rvtr
Tr Qprqr)8svtvtvBhuvp9rvtr

Create a new picture in Bhuvp9rvtr. In our example, this is the picture called rf"fpuhrf pqy. We configure an OLE control in this picture at ThPiwrpPG@8y. In the DrPyr8y dialog box that appears, we select the entry Xv88Vr 6puvrUhiyr8y from the list displayed. Close the dialog box by clicking PF. The deactivated Xv88Vr6puvrUhiyr8y appears. In our example, we use the object called PG@8y .

Click ' on the object known as PG@8y to open its Properties dialog box. On the BrrhyDshv tab, we select 6puvrVr6puvrfT& as the Tpr. In the @qv field, we select check boxes Qhr, 8uhtr and 9ryrr to make all the editing options available to the user. In addition, we select the 7qr check box. On the 8y tab, we select all the existing data fields of the archive. On the Uyih tab, we deselect the two buttons XvrUht and SrhqUht. Control is performed by the programmable logic controller in the present example. All the other buttons on the toolbar will be used. On the Th7h tabs, we apply the presettings and thus use all the existing

WinCC Configuration Manual C79000-G8276-C140-01

5-87

Vr6puvr

!((

Tr

Qprqr)8svtvtvBhuvp9rvtr

elements. On the A tab, we will reduce the vr of the font to (&$ in order to be able simultaneously to display all columns of the table at runtime. On the AvyrT tab, we will not perform any settings for our example. Complete the settings in the QrvrsXv88Vr6puvrUhiyr8y dialog box by clicking PF. 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 PG@8y object. 3 To display the data transferred from User Archive to the programmable logic controller, we configure three I/O fields at ThPiwrpDPAvryq. In our example, these are the objects DPAvryq , DPAvryq! and DPAvryq". At the DPsvryq, we create - at QrvrPDPWhyr - a htprpv for each of the three tags U'frfV6T&f , T"!frfV6T&f and B%#frfV6T&f .

To set the record number that has to edited and the field number, we create two more I/O fields at ThPiwrpDPAvryq. In our example, these are the objects DPAvryq# and DPAvryq$. At the object DPAvryq#, we create at QrvrPDP Whyr a htprpv to tag V"!frfV6T&f!. This is used to accommodate the record number. At the object DPAvryq$, we create at QrvrPDP Whyr a htprpv to tag V %frfV6T&f". This is used to accommodate the field number. To trigger actions on the programmable logic controller, we configure six buttons at XvqPiwrp7. In our example, these objects are 7 to 7 #. When a button is clicked, a different value is written to tag V %frfVhqf . 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

!((

Vr6puvr

Tr

Qprqr)8svtvtvBhuvp9rvtr

Ir)

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 U'frfV6T&f , B%#frfV6T&f and T"!frfV6T&f 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.

EisvvturQG8
Tr Qprqr)EisXvvturQG8

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 U'frfV6T&f , B%#frfV6T&f and T"!frfV6T&f . 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 S6XfrfV6qf! 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 S6XfrfV6qf' 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 7( (write record to PLC) is operated by clicking tag of the ivhht type is set. In our example, this is tag 7DIvfrfV6T&f . Further, control tag V %frfV6T&f" 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 8hpv at QrvrBrrQvvY of the button

WinCC Configuration Manual C79000-G8276-C140-01

5-89

Vr6puvr

!((

Tr

Qprqr)EisXvvturQG8

that is triggered when tag S6XfrfV6T&f! is modified. Any change to this tag signifies that new data have been sent. Tag 7DIvfrfV6T&f is checked in the 8hpv. If it has been set, a new data record (as opposed to a new data field) has been sent. Project function 6phyvrT&9hhTr is then triggered and performs the re-store operation of the sent data to the WinCC tags. Further, tag 7DIvfrfV6qf 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 7 " (write field to PLC) is operated by clicking of the ivhht type is set. In our example, this is tag 7DIvfrfV6T&f!. Further, control tag V %frfV6T&f" 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 8hpv at QrvrBrrQvvY of the button that is triggered when tag S6XfrfV6T&f! is modified. Any change to this tag signifies that new data have been sent. Tag 7DIvfrfV6T&f is checked in the 8hpv. If it has been set, a new data field (as opposed to a new data record) has been sent. Project function 6phyvrT&9hhAvryq 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 7DIvfrfV6T&f! 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 V %frfV6T&f to a defined value. In this instance we use the value #. It causes the programmable logic controller to request a record. Set tag 7DIvfrfV6T&f . This indicates that a data record has been requested.

5-90

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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 7DIvfrfV6T&f . If it has been set, a data record has been sent. In this instance project function 6phyvrT&9hhTr is called. It re-stores the data area of the sent acknowledgement message frame in the WinCC tags. Further, tag 7DIvfrfV6T&f is reset. This action is triggered upon a change to tag S6XfrfV6T&f!. 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

Vr6puvr

!((

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 i9hh byte field. Reload the text box to the iTr byte field. These data correspond to data field SrpqIhr, which is present in the Vr6puvrfq archive. The 10-character field is the equivalent of ten bytes. Reload the double field to the iTr byte field. These data correspond to data field Urrhr, 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 iTr byte field. These data correspond to data field Qrr, which is present in the archive. An integer field requires an area of four bytes. The byte order has to be reversed. The iTr 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 S6XfrfV6T&f!.

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 $   Tprshqhhrhtrshr. 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 A8&.

Ir)

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 A8&, in addition to the data record number.
97!(

5-92

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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, $  Tprshqhhrhtr shr. The data are re-stored from the data area of the message frame by means of project function 6phyvrT&9hhTr 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 6phyvrT&9hhAvryq.

EisrhqvtsurQG8
Tr Qprqr)EisSrhqvtsurQG8

In the case of read jobs (read from the programmable logic controller), the data stored in tags U'frfV6T&f , B%#frfV6T&f and T"!frfV6T&f 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 S6XfrfV6T&f%, 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 S6XfrfV6T&f&, 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

Vr6puvr

!((

Tr

Qprqr)EisSrhqvtsurQG8

If object 7  (read record from PLC) is operated by clicking , project function GhqT&9hhTr 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 V %frfVhT&f" 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 97!&.

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 7 # (read field from PLC) is operated by clicking function GhqT&9hhAvryq 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 V %frfVhT&f" 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 97".

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

!((

Vr6puvr

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 $   Tprshqhhrhtrshr. 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 A8&. The data from the tags are entered in the data area of the message frame by means of project function GhqT&9hhTr.

Ir)

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 A8&, in addition to the data record number.
97"

Eisqryrvtsurhpuvr
Tr Qprqr)Eis9ryrvtsurhpuvr

If object 7

(delete record) is operated by pressing , control tag is set by means of a qvrpprpv to a hexadecimal value of  . However, decimal values have to be entered in the 8h input field of the 9vrp8rpv dialog box. In the present case, the value is #(%.
V %frfV6T&f

By means of the write operation to the control tag, the programmable logic

WinCC Configuration Manual C79000-G8276-C140-01

5-95

Vr6puvr

!((

Tr

Qprqr)Eis9ryrvtsurhpuvr

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 97!'.

If object 7

(delete record) is operated by pressing , control tag is similarly set by means of a qvrpprpv 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 97!$.
! V %frfV6T&f

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 $  Tprshqhhrhtrshr. 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 A8&.

5-96

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

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.

Ir)

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 $ (ThHvvts@rhyUhtrf"fpuhrf pqy).

Irtrrhyr

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

Vr6puvr

!((

$

( ThHvvts@rhyUhtrf"fpuhrf

pqy

Uhxqrsvvv

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.

Dyrrhvppr

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.

DyrrhvvBhuvp9rvtr
Tr Qprqr)DyrrhvvBhuvp9rvtr

1 2

Create a new picture in Bhuvp9rvtr. In our example, this is the picture called rf$fvqf"qy. In the picture we have just created, we configure static text at ThqhqPiwrp ThvpUr. In our example, we use the object called ThvpUr . Its purpose is to display the status of tag U'frfV6T&f , which was created in the $ '
8rpvvhXv88Sh9hhUhturT&rf"fpuhrf pqy

example. The procedure is the same for any other external tag, however. At QrvrAUr, we create a qhvpqvhyti. In the
@rvAyh box, we click the button to set the tag we want to monitor, namely U'frfV6T&f . Select the @hyhrUhtTh 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 ThvpUr object. If no status on the list is in fact current - in other words, the connection is in order - the text entered on the Pur line is displayed. In our example, this is 8rpvPF.

5-98

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

Configure a status display at ThPiwrpTh9vyh. In our example, we use the object called Thvp9vyh . The purpose of the object is to symbolically display the status of tag U'frfV6T&f . Following placement, the psvthvqvhyti 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 WrivqtPFi for status  and WrivqtTUPQi for status . Complete the settings in the psvthvqvhyti by clicking PF.

WinCC Configuration Manual C79000-G8276-C140-01

5-99

Vr6puvr

!((

Tr

Qprqr)DyrrhvvBhuvp9rvtr

We want the Th9vyh object to be supplied at runtime with information about the status of the tag. This is accomplished by means of the ThvpUr object, which monitors the status. At this object, we create a C action at @rQrUvpAUr 8uhtr. This is executed upon a change of the displayed text - in other words, when the status of tag changes. The 8hpv checks the text being displayed. If it is identical with the string 8rpvPF, the status of object Th9vyh is set to . In other words, the green check mark is displayed. If this is not the case, the STOP symbol is displayed. The 8hpv 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 ThvpUr 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 B%#frfV6T&f and T"!frfV6T&f 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 ThPiwrp QvprXvq in another picture, rf"fpuhrf pqy in our example. This picture window is object QvprXvq . At QrvrHvpryyhrQvprIhr, set rf$fvqf"qy, the picture you created earlier. At QrvrHvpryyhr, the qvyh of the object is set to I.

5-100

WinCC Configuration Manual C79000-G8276-C140-01

!((

Vr6puvr

Tr

Qprqr)DyrrhvvBhuvp9rvtr

In order to be able to display it at runtime all the same, we configure a button at XvqPiwrp7. In our example, we use the object called 7 $. At this button, we create a qvrpprpv at @rHrHr6pv. This switches 8h to the qvyh property of object QvprXvq .

Ir)

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

Vr6puvr

!((

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 8rpvPF. If they are identical, object Th9vyh is set to status . This means that the green check mark is displayed. If they are not identical, object Th9vyh is set to status . This means that the STOP symbol is displayed.

Irtrrhyr

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

!((

Vr6puvr

$

 Tprshqhhrhtrshr

Brrhy

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.
Tprsurrhtrshrurhqr
7r 9rpvv)

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

Vr6puvr

!((

Tprsurwiurhqr
7r 9rpvv)

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

Ir)

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.

Eir

A byte is set for the job type in the job header. The following job types are available.

Ur

9rpvv

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

!((

Vr6puvr

Eiqhh

In the case of write jobs, the archive data come next. They correspond to the contents of a data record with a vrqhhrpq job or the contents of a data field with a vrqhh svryq 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.

6pxyrqtrrurhqr
7r 9rpvv)

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

Vr6puvr

!((

6pxyrqtrrqhh

In the case of read jobs, the requested data then follow. They correspond to the contents of a data record with a rhqqhhrpq job or the contents of a data field with a rhqqhh svryq job. No other data follow for the remaining jobs.

@pqr

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.

8qr

9rpvv

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

!((

Dqr

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

Dqr

!((

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

!((

Dqr

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

Dqr

!((

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