Condition

The Condition trigger runs the operation, according to the specified conditions.

This trigger occurs once when the condition is met. Whether the condition is satisfied or not is determined when the value set for the condition changes.

Block

Text

onCondition(SOURCE < CONSTANT1 && SOURCE > CONSTANT2,
              1        4             1       5   
{enableDelay:false,enableDeadband:false,delayValue:0,deadBandValue:0},
         3                   2                3             2
 ()=>{

});

1: Condition Source

2: Deadband

3: Hold Delay

When [Hold Delay] is enabled, the operation runs after the set time.

4: Condition 1

5: Condition 2

 

(Example 1)

If the boolean variable BOOL2 value is set to ON, the trigger occurs.

Variable block Condition
Select BOOL2 from the Variable block.

Set the condition as [==].

Select [Bool] from the Constant block and select the check box.

Block
Text

onCondition(BOOL2 == true,{enableDelay:false,enableDeadband:false,delayValue:0,deadBandValue:0}, ()=>{

});

(Example 2)

If the integer variable INT2 value exceeds 20, the trigger occurs.

Variable block Condition

Select the variable INT2 from the Variable block.

Set the condition as [>].

Select [Int] from the Constant block and set 20.

Block
Text

onCondition(INT2 > 20,{enableDelay:false,enableDeadband:false,delayValue:0,deadBandValue:0}, ()=>{

});

(Example 3)

If the string variable STRING2 value becomes ABC, the trigger occurs.

Variable block Condition
Select the variable STRING2 from the Variable block.

Set the condition as [==].

Select [STRING] from the Constant block and type ABC.

Block
Text

onCondition(STRING2 == "ABC",{enableDelay:false,enableDeadband:false,delayValue:0,deadBandValue:0}, ()=>{

});

(Example 4)

If the graphical object Rectangle2 height is from 15 to 20, the trigger occurs.

The graphical object is drawn on Screen1.

Screen Object block Condition
Select the object Rectangle2.Height from the Screen Object block.

Select [Int] from the Constant block and set 15. Set the condition as [<=].

Set the other condition as [<=]. Select [Int] from the Constant block and set 20.

Block
Text

onCondition(15 <= $GraphicObject.Rectangle2.Height && $GraphicObject.Rectangle2.Height <= 20,{enableDelay:false,enableDeadband:false,delayValue:0,deadBandValue:0}, ()=>{

});

Supporting sign in Condition

[==] Equal to sign
[!=] Not equal to sign
[<=] Equal to or less than sign
[>=] Equal to or greater than sign
[<] Less than sign
[>] Greater than sign

Deadband

The value range between the value to trigger the alarm and the value to restore the alarm is called the Deadband.

(Example)

Consider Condition X>20 and Deadband 5.

Refer to the following chart: At point A, the input value reaches more than 20 for the first time, so the trigger occurs. At point B, the input value does not drop below 15, so the trigger does not occur. At point C, the input value drops below 15 and rises to more than 20, so the trigger occurs.

Block

Text

onCondition(Var1 > 20,{enableDelay:false,enableDeadband:true,delayValue:0,deadBandValue:5}, ()=>{

});

The table below illustrates Deadband under various conditions:

Example Description
X<5, Deadband = 1

The trigger occurs whenever the input value is less than 5.

When the input value is less than 5 for the first time, the trigger occurs. The next trigger occurs when the input value rises to 6 or greater and drops below 5.

X<=5, Deadband = 1

The trigger occurs whenever the input value is less than or equal to 5.

When the input value is less than or equal to 5 for the first time, the trigger occurs. The next trigger occurs when the input value rises to 6 or greater and drops to 5.
X==5, Deadband = 1

The trigger occurs whenever the input value equals 5.

The trigger occurs when the input value is equal to 5 the first time. The next trigger occurs when the input value rises to 6 or greater, or drops to 4 or less and then reaches 5 again.

X!=5, Deadband = 1

Note: Deadband does not support the [!=] condition even if deadband is set.

    

The trigger occurs whenever the input value is not equal to 5.

When the input value is not equal to 5 for the first time, the trigger occurs. The next trigger occurs when the input value reaches 5 and then changes to a different value.

4<=X<=6, Deadband = 1

The trigger occurs whenever the input value is from 4 to 6.

When the input value is from 4 to 6 for the first time, the trigger occurs. The next trigger occurs when the input value rises to 7 or greater and then reaches a value from 4 to 6. The trigger also occurs when the input value drops to 3 or less and then reaches a value from 4 to 6.