Introduction:
In this post, we demonstrate how to use the “Condition” object. This object may be used as a substitute for if-else statements in macros. Additionally, we will demonstrate how to use the condition object to automate other tasks via Action Trigger" objects.
Software Version:
EasyBuilder Pro 6.06.02.190+
Instructions:
-
To begin navigate to the object tab and select the “Condition” object:
-
When creating a new condition, start by modifying the “Operator.” The “AND” operator will execute the program if all conditions are met, while the “OR” operator will execute the program if at least one condition is met. The “Output” is an optional feature that sets a boolean tag ON when the conditions are met and OFF when they are not.
-
To create a condition or “Conditional”, select the “New” button and you will see the page below. By default, the “Type” drop-down list is set to “Value Address”, which will allow you to read a value from a device tag. The data “Type” options allows you to choose either a “Bit” or “Word” address. In this demonstration, I will select a “Word” address of LW-0. Then, we will set the “Condition” associated with this “Conditional.” In the example below, the value within the read address must equal ten:
Note: The condition can be modified to be greater than, less than, etc.
-
Next, we will use an “Action Trigger (Global)” object to execute various functions when the condition is met:
Note: The “Action Trigger (Per-page)” object will only execute the defined functions when the page on which it is displayed is open.
-
When creating a new action trigger, select “Condition object” as the “Mode” and set the desired “Condition” object and Trigger. Below, I’ve selected a “Condition” named “Test 1”.
-
Next, select the actions to occur after the condition is met. Several actions placed within the same group will execute simultaneously. Whereas actions placed in seperate groups will execute sequentially. In this example, a “Set Bit” action has been defined to set bit LB-0 ON and a “Set Word” action has been defined to write the string “Hello” within LW-10 ~ LW-19:
-
[Optional] Create input and output UI objects to view the defined actions and trigger the condition:
-
When the value of both “conditional” registers meets the defined condition, the “Action Trigger” will execute the set functions:
Keywords
Keywords: Action trigger, macro substation, if, else, statements, memory registers, data transfers, condition