functionaddIndex

add to an index in a cyclic way

Extends from Modelica.Icons.Function (Icon for functions).

Information

  result:= k + a;

and bring the result to the range [1, m] in a cyclic way, i.e. m + 1 -> 1 and 0 -> m. The addend can also be negative.

Inputs

TypeNameDefaultDescription
IntegerkIndex
IntegeraAddend
IntegermMax. index

Outputs

TypeNameDefaultDescription
Integerresult1 + mod(k + a - 1, m)Resulting index