Controls API documentation
rackio.controls.Control
(name, condition, action)Control class.
This class defines a mechanism to apply controls on tags values, a control is defined by a condition and an action, once the condition is met, the action is triggered
Parameters:
- name (str): Condition name
- condition (Condition): Condition to inspect in this control
- action (Action): Action to be triggered once the condition is met
Usage:
>>> from rackio.controls import Action, Condition, Control
>>> act1 = Action("T3", 40)
>>> cond1 = Condition("T1",">=", "T2")
>>> control1 = Control("C1", cond1, act1)
rackio.controls.Rule
(name, condition, actions=None)Rule class.
This class defines a mechanism to apply rules on tags values, a rule is defined by a condition and a list of actions, once the condition is met, the actions are triggered in sequential order
Parameters:
- name (str): Condition name
- condition (Condition): Condition to inspect in this control
- action (Action): Action to be triggered once the condition is met
Usage:
>>> from rackio.controls import Action, Condition, Rule
>>> act1 = Action("T3", 40)
>>> act2 = Action("T4", 60)
>>> cond1 = Condition("T1",">=", "T2")
>>> rule1 = Rule("C1", cond1, [act1, act2])
Actions
rackio.controls.ValueAction
(tag_name, value)ValueAction class.
This class defines a mechanism to apply defined values as actions on tags values
Parameters:
- tag_name (str): tag name in which action will occur
- value (int, float, bool): Value to be assigned once the action is executed
Usage:
>>> from rackio.controls import ValueAction
>>> act1 = ValueAction("T3", 40)
rackio.controls.MathAction
(tag_name, expression)MathAction class.
This class defines a mechanism to apply mathematical expressions as actions on tag values
Parameters:
- tag_name (str): tag name in which action will occur
- expression (str): Mathematical expression to be parsed once the action is executed
Usage:
>>> from rackio.controls import MathAction
>>> act1 = MathAction("T3", "T1 + 2 * T2")
Conditions
rackio.controls.Condition
(tag1, _oper, tag2)Condition class.
This class defines a mechanism to apply conditions on tag values
Parameters:
- tag1 (str): First tag name to be compared
- _oper (str): Comparison operators ("=", "!=", "<", ">", "<=", ">=")
- tag2 (str): Second tag name to be compared
Usage:
>>> from rackio.controls import Condition
>>> cond1 = Condition("T1",">=", "T2")
rackio.controls.BoolCondition
(tag)BooleanCondition class.
This class defines a mechanism to apply conditions on boolean tag values
Parameters:
- tag (str): tag name
Usage:
>>> from rackio.controls import BoolCondition
>>> cond1 = BoolCondition("HIGH_ALARM")
rackio.controls.OrCondition
(conditions)Condition class.
This class defines a mechanism to apply conditions on tags values
Parameters:
- conditions (list): List of other condition objects
Usage:
>>> from rackio.controls import Condition, OrCondition
>>> cond1 = Condition("T1",">=", "T2")
>>> cond2 = Condition("T4","<=", "T5")
>>> cond3 = OrCondition([cond1, cond2])
rackio.controls.AndCondition
(conditions)Condition class.
This class defines a mechanism to apply conditions on tags values
Parameters:
- conditions (list): List of other condition objects
Usage:
>>> from rackio.controls import Condition, AndCondition
>>> cond1 = Condition("T1",">=", "T2")
>>> cond2 = Condition("T4","<=", "T5")
>>> cond3 = AndCondition([cond1, cond2])