• No results found

Definition and Use

Triggers are implemented in order to execute actions in runtime. To allow this, a trigger is connected to an action thus forming the triggering event which calls the action. Actions without a trigger are not executed.

The triggers defined for an action are displayed in the Global Script navigation window .

Trigger Types

The following triggers are available:

Acyclic triggers

They consist of the specification of date and time. The action linked to such a trigger is executed on the date and at the time specified.

Cyclic triggers

They consist of the specification of a time interval and start time. The following cyclic triggers are available:

• Standard cycle. The beginning of the first interval coincides with the start of Runtime. The length of the interval is determined by the cycle.

• Hourly. The start of the time interval is defined in minutes and seconds. The length of the interval is one hour.

• Daily. The start of the time interval is defined by the time (hour, minute and second). The length of the interval is one day.

• Weekly. The start of the time interval is defined by the weekday (Monday, Tuesday, ...) and time. The length of the interval is one week.

• Monthly. The start of the time interval is defined by the day and time. The length of the interval is one month.

• Yearly. The start of the time interval is defined by the day, month and time. The length of the interval is one year.

Time-controlled triggers are used for Global Script actions and for actions to make graphic objects dynamic.

Tag Triggers

• They consist of one or more specified tags. The action which is connected to such a trigger is always executed when a change in the value of one of these tags has been detected.

• The way in which the tag value is queried can be individually defined for each tag. Select from the following modes:

• Cyclic query of the tag value: Specify a standard cycle. The tag value is queried at the defined intervals (e.g. every 2 seconds). The action is triggered when the system detects a change of the tag value. Depending on the size of the cycle, it is possible that the tag value is changed but it is not detected by the system.

If, for example, a cycle of 5 minutes has been set, the tag value may change several times within the 5 minute period but only the value set when the next query is made is detected. The value changes between the two queries are not registered.

• Changes in the tag value: Each change in the tag value is detected by the system. The action is executed each time the tag value changes.

Tag triggers are used for Global Script actions and for actions to make graphic objects dynamic.

Event-driven

When an action is configured related to an event on a graphic object, the action is triggered when a specific event has occurred, e.g. following a mouse click or the change of the background color due to another action.

Effects of Triggers on Actions

If the action is only linked to one trigger, the action is executed as soon as the triggering event occurs.

However, an action can be linked to several triggers, e.g. to a cyclic trigger and a tag trigger. The action is then executed when one of the defined, triggering events occurs. If two events occur simultaneously, the action is executed twice in

succession. If two tags contained in the trigger change simultaneously, the action is only executed once.

Processing Actions in Graphics Designer

The following rules apply to processing actions in Graphics Designer:

• No event-driven actions can be executed as long as another event-driven action is running.

• No cyclic/tag triggered actions can be executed as long as another cyclic/tag triggered action is running.

• The two action types do not affect each other: An event-driven action can also be executed when a cyclic action is already in progress.

• If the execution of actions is blocked by other actions (e.g. a cyclic action by a tag-triggered action), each action which is blocked is executed once at the next possible moment. Cyclic actions then run in their normal intervals after the one- off execution.

Processing Actions in Global Script

Picture-independent actions from Global Script are executed in runtime in

succession after being triggered. If an action is triggered while another action is in progress, the second action is retained in a queue until it can be executed. Actions in Global Script and Graphics Designer do not affect each other.

Note:

If the action should not be executed at each event, it is possible to define a condition in the action, the result of which controls whether the action is executed or not.

Notes on Configuring Triggers

For system-related reasons, it may not be possible to guarantee that an action with a cyclic trigger is executed at precisely the specified times. If this is guaranteed, the task (e.g. checks) can be realized in the PLC.

The tag triggers should have priority over cyclic triggers: With cyclic actions, the action is always executed, e.g. every 20 seconds. The tag trigger only executes the action if a change in the value of the tag has been detected (e.g. case of cyclic queries). This reduces the load on the system and increases performance.

If a tag trigger is used, configure the "Upon Change" cycle to start as seldom as possible. This query cycle causes the tag to trigger the action following every change. This causes high system loads.

Linking Tag Triggers

The CrossReference from WinCC can be used to quickly find all the application points of tags, even in VBS actions. Tag triggers in actions in Graphics Designer can be "linked" using CrossReference, i.e. replaced by other tags at all or selected points.

Note:

Tags can also be directly linked in Graphics Designer by marking the graphic object and selecting the "Linking ..." command from the context menu.

Note:

When addressing pictures and tags in the code, use the standard formulations HMIRuntime.BaseScreenName = "Screenname" and HMIRuntime.Tags ("Tagname"), in order to ensure that pictures and tags are acquired by the CrossReference.

Further information on CrossReference is available in the WinCC documentation.

9.6.1 Adding a "Timer" Type Trigger

Introduction

"Timer" type triggers execute an action at a certain time. "Timer" type triggers can be cyclic or acyclic triggers.

• Acyclic triggers trigger an action once at the configured time.

• Cyclic triggers trigger an action at regular intervals. The time interval and start time for the time must be triggered. If a standard cycle is selected as the cyclic trigger, the start time is always the start of runtime. User-specific cycles can also be selected as standard cycles.

Note:

Cyclic triggers guarantee a high updating rate of the system but require high system loads. Only select cyclic triggers for actions in which updating is very important.

In the case of a high system load, it is possible that actions can no longer be executed.

"Timer" type triggers are used to make the properties in Graphics Designer dynamic and execute global actions.

Procedure

Procedure 1 Open the action.

2 Select the "Info/Trigger" button in the toolbar or select "Info/Trigger"

in the context menu. The "Properties..." dialog appears.

3 Select the "Triggers" tab control.

4 Select the "Timer" trigger and then select the trigger type to be created:

cyclic or acyclic.

5 Click the "Add" button. The "Add Trigger" dialog appears.

6 If the "acyclic" trigger type has been selected: Enter a relevant trigger name and define the time at which the action should be executed.

Procedure

7 If the "cyclic" trigger type has been selected: Enter a relevant trigger name and define the start time at which the action should be executed for the first time. Enter a cycle at which the action should be repeated.

Click on OK to confirm your input.

Note:

An action can be assigned several triggers. The action is always executed when one of the triggering events occurs.

9.6.2 Adding Tag Type Trigger

Introduction

"Tag" type triggers execute an action following the change of a tag value. Any internal or external tag stored in WinCC can be used as a trigger tag.

Actions with tag triggers can be executed at the following times:

• On change of tag: The action is executed each time the tag value changes.

Since this setting causes a very high system utilization, the updating rate should be set as low as possible.

• Query the tag status according to standard cycle (including user cycles):

Define a cycle in whose intervals the tag value should be queried. The action is only executed when the tag value has changed when queried. When the query status is a large value, it is possible that the tag value changes but it is not detected by the system. The action is not executed in such cases.

If an action is linked with several tags, the action is executed when one of the tag values changes.

Procedure

Procedure 1 Open the action.

2 Select the "Info/Trigger" button in the toolbar or select "Info/Trigger"

in the context menu. The "Properties..." dialog appears.

3 Select the "Triggers" tab control.

4 Select "Trigger" as the tag.

5 Click the "Add" button. The "Add Trigger" dialog appears.

6 Enter the name of the tag to be used as the trigger or click the button beside the "Tag Name" field in order to select a tag from the tag selection dialog.

Procedure

7 Double click on the "Standard cycle" field to open the selection dialog for the tag update cycle:

Procedure

Select a cycle and click on OK to confirm the selection.

9.6.3 Modifying a Trigger

Introduction

A defined trigger can be modified at any time, even during runtime.

Procedure

Procedure

1 Open the action whose triggers should be modified.

2

Select the "Info/Trigger" button in the toolbar or select "Info/Trigger" in the context menu. The "Properties..." dialog appears.

Alternatively, call in the dialog without executing the action by double clicking on the trigger in the navigation window.

3 Select the "Triggers" tab control.

4 Select the trigger to be modified and click the "Change" button.

5 After modifying the trigger, confirm the entries with OK.

9.6.4 Deleting a Trigger

Introduction

Defined triggers can be deleted at any time. Triggers can also be deleted during runtime.

If a trigger is deleted during runtime, it takes effect after saving the action.

Note:

Actions without a trigger are not executed in Runtime. None of the actions which used the deleted trigger are executed any longer.

Procedure

Procedure

1 Open the Global Script Editor or the Graphics Designer action editor.

2 Open the action.

3 Select the "Info/Trigger" button in the toolbar or select "Info/Trigger"

in the context menu. The "Properties..." dialog appears.

4 Select the "Triggers" tab control.

5 Select the trigger to be deleted and click the "Delete" button.

Procedure

The trigger is deleted immediately.

Note:

Triggers can also be deleted directly in the Global Script navigation window using the "Delete" command in the context menu.

In document Using Visual Basic Script in WinCC (Page 54-62)

Related documents