Switching events according to conditions

<< Click to Display Table of Contents >>

Manual > Server Creation Guide > Events > Application of Events >

Switching events according to conditions

overview

Here we will explain how to set up the event itself to be switched depending on conditions.

 

As an example, prepare two Periodic event (one with a 1 second cycle and one with a 10 second cycle), and enable/disable each event by setting "U01.F01.T01" to ON/OFF.

 

While "U01.F01.T01" is ON, event "E02" is enabled, and while OFF, event "E03" is enabled.

 

c_event_0065

 

 

Download the sample

The creation examples shown on this page are provided with samples.

 

The sample can be downloaded from below.

 

Configuration file: event_sample03.txt

 

 

Setting contents

 

Tag configuration

 

Set the bit tag that will trigger the event to be enabled or disabled.

Here, set it to "U01.F01.T01".

 

c_event_0066

 

 


 

Action Settings

 

Add a script action "A01" and set the script as follows:
c_event_0058

 

//Event/E02!Enable = U01.F01.T01

//Event/E03!Enable = Not U01.F01.T01

 

In other words, when "U01.F01.T01" is TRUE, E02 is enabled, and when it is FALSE, E03 is enabled.

 

 


 

Event Settings

 

Add Tag event "E01" and Periodic event "E02" and "E03".

c_event_0067

E01:

Tag "U01.F01.T01"

Comparison condition "Tag value changed"

Execution action "A01"

 

E02:

Set the period to 1 second

Check "Disable" to disable the initial state

 

E03:

Set the period to 10 seconds

Check "Disable" to disable the initial state.

 

 

Commentary

 

c_event_0068

 

 

When bit is ON

1.When U01.F01.T01 becomes TRUE, Tag event "E01" occurs and script Ver1 action "A01" is executed.

2.In "A01", the formula "//Event/E02!Enable = U01.F01.T01" is executed, and the event "E02" is enabled.

3.At the same time, the formula "//Event/E03!Enable = Not U01.F01.T01" is executed, and the event "E03" is disabled.

 

When bit is OFF

1.When U01.F01.T01 becomes FALSE, Tag event "E01" occurs and script Ver1 action "A01" is executed.

2.In "A01", the formula "//Event/E02!Enable = U01.F01.T01" is executed, and the event "E02" is disabled.

3.At the same time, the formula "//Event/E03!Enable = Not U01.F01.T01" is executed, and the event "E03" is enabled.

 

*In the script, "Not" reverses TRUE/FALSE.