AutomationView Documentation

MOD (Modulo)

Computes the remainder of IN1 divided by IN2 (IN1 MOD IN2) and writes the result to the target variable.


Description

The MOD instruction calculates the modulo remainder of two numeric operands (src1 and src2) and stores the result in the target variable.

Common uses include:

When using MOD with the N (non-stored) qualifier, the calculation runs every scan cycle while the step is active. Use ActionQualifier.P (pulse) to compute once when the step activates.


Syntax

Sequence Visual Editor

  1. Select an action on a step or transition and hold Alt (or right-click -> Edit Qualifier & Instruction).
  2. Choose Math -> MOD and select the P (Pulse) or N qualifier.
  3. Fill in the target variable, dividend (IN1), and divisor (IN2) operand chips.

Python

from automation_machine import ActionQualifier, ActionInstruction

step.add_action("slot_col", "Compute column index", qualifier=ActionQualifier.P, instruction=ActionInstruction.MOD, src1="part_index", src2="4")

See Also