Open topic with navigation
Calculation example: time limit on successive state changes
In this example of using the Calculation feature, we want to prevent
state changes occurring in a pump (a digital object) from taking place
with too short a time interval. In other words, we want to place a minimum
time limit on how quickly the pump will be allowed to change states.
The pump we wish to control in this manner is shown in the illustration
below and is called Pump_2. It’s
a simple two-state pump, either ON (1)
or OFF (0).
- Double click
on the Pump_2 graphic to bring
up the properties tabs for this digital object.
- Click
on the Calculation tab.
- Since we
want to control the state of the pump without being “overruled” by the
PLC communicating with the State and continually putting new state values in here, we choose the Command atom on which to attach our
Calculation parameters as shown above.
- On the Execution trigger, we choose to make
the expression execute when a change occurs in the object, i.e. when the
pump changes states. Therefore On object
changes is selected.
- Our expression
is constructed with the If (condition) function called
IIF and the IGSS object function called MSecsSinceLastExec().
- If Pump_2
pump attempts to change state before the elapsed time of 240 milliseconds,
then it receives the OFF (0) command. If the time elapsed has been greater
than 240 milliseconds, then it receives the ON (1) command.
- If
it's necessary to record the workings of the Calculation function, then
make sure All changes and Log outgoing commands is selected on
the object's Data Management Definitions
tab.
For a complete list of the object functions available for Calculation,
please click
here.
For a complete list of the arithmetical functions and operators available
for Calculation, please click
here.
Open topic with navigation