Amtiri Script

Logic

Download PDF

Logic

And

and · and(value: boolean{2..})

True only when every condition given is true. It stops at the first false one without evaluating the rest, exactly as the && operator does.

Parameters

Name Type Description
value boolean (2 or more) A condition to test. At least two are required, and any number may follow.

Returns boolean: True when every condition is true.

Examples

and(PUMP_ON, LEVEL > 40, COUNT == 3) → true
and(false, NEVER_WRITTEN > 0) → false

Bit test

bit · bit(base: int, bit: int)

Tests one bit of a whole number - how a packed status word from a PLC or Modbus device is split into individual alarms.

Parameters

Name Type Description
base int The packed word to read.
bit int Which bit to test, counting from 0 at the least significant end.

Returns boolean: True when that bit is set.

Examples

bit(5, 0) → true
bit(5, 1) → false
bit(REGISTERS[3], 0) → true

Exclusive or

xor · xor(value: boolean{2..})

True when an odd number of the conditions given are true.

Parameters

Name Type Description
value boolean (2 or more) A condition to test. At least two are required, and any number may follow.

Returns boolean: True when the conditions disagree.

Examples

xor(true, false) → true
xor(true, true, true) → true
xor(true, true) → false

Not

not · not(value: boolean)

Inverts a condition.

Parameters

Name Type Description
value boolean The condition to invert.

Returns boolean: True when the value is false.

Examples

not(PUMP_ON) → false
not(LEVEL > 90) → true

Or

or · or(value: boolean{2..})

True when at least one condition given is true. It stops at the first true one without evaluating the rest, exactly as the || operator does.

Parameters

Name Type Description
value boolean (2 or more) A condition to test. At least two are required, and any number may follow.

Returns boolean: True when any condition is true.

Examples

or(LEVEL > 90, PUMP_ON) → true
or(false, false) → false

This page describes Amtiri Script 5.4.1 as shipped with Data Orchester engine 6.12.1 and Site 1.22.7.