AutomationView Documentation

SUB (Subtraction)

Subtracts a value from the target variable each time the action executes.


Description

The SUB instruction performs a subtraction operation on the target variable. When the action activates, it subtracts the specified value (defaulting to 1) from the current value of the variable.

This is commonly used for decrementing counters, counting down remaining items, or adjusting numeric setpoints.

When using SUB with the N (non-stored) qualifier, the subtraction runs every scan cycle while the step is active. If you only want to subtract once when the step activates, use ActionQualifier.P (pulse) instead.


Syntax

Sequence Visual Editor

Sequence step with SUB instruction configured

Python

from automation_machine import ActionQualifier, ActionInstruction

step.add_action("variable_name", "Description", qualifier=ActionQualifier.P, instruction=ActionInstruction.SUB)

See Also