AlphaMon Operator & Function Library
This section describes the Operators and Functions supported by AlphaMon’s firmware. These Operators and Functions can be used in the AlphaMon’s Expressions that draft to read data from your connected devices and control external generators, relays and switches.
Notes:
1/ In the following tables, operators with a higher Precedence Number will be evaluated before other operators with a lower Precedence Number, when used in the same expression.
2/ You can use either the Symbol or the “Friendly Name” in your expressions, interchangeably.
1. Arithmetic Operators (Calculations)
Arithmetic Operators are used for basic math.
| Operation | Symbol | Friendly Name | Precedence | Example | Result |
|---|---|---|---|---|---|
| Add / Subtract | + / - | — | 11 | 10 + 5 | 15 |
| Multiply / Divide | * / / | — | 12 | 10 * 3 | 30 |
| Remainder | % | MOD | 12 | 10 MOD 3 | 1 |
| Negative | - | — | 13 | -10 + 20 | 10 |
2. Comparison Operators (Decisions)
The following Comparative Operators allow you to compare two values and return True (1) or False (0).
| Symbol | Friendly Name | Meaning | Precedence | Example |
|---|---|---|---|---|
== (or =) | EQ | Equal to | 7 | Temp EQ 25 |
!= | NE | Not equal to | 7 | Status NE OFF |
> | GT | Greater than | 8 | Power GT 1000 |
< | LT | Less than | 8 | Volts LT 220 |
>= | GE | Greater than or equal | 8 | SOC GE 80 |
<= | LE | Less than or equal | 8 | Temp LE 15 |
3. Logical Operators (Combinations)
Logical Operators are used to join multiple comparisons together.
| Symbol | Friendly Name | Meaning | Precedence | Example |
|---|---|---|---|---|
&& | AND | Both must be true | 3 | Temp GT 20 AND SOC LT 10 |
|| | OR | Either can be true | 2 | Manual_On OR Auto_Trigger |
! | NOT | Flips the result | 13 | NOT ON (Result is OFF) |
4. Mathematical Functions
Special tools for more complex logic.
| Function/s | Type | Description | Example |
|---|---|---|---|
| ABS(x) | Expects a single value | Removes negative signs | ABS(-5) is 5 |
| MIN(a, b, …) | Accepts multiple values | Picks the smallest value | MIN(10, 20, 5) is 5 |
| MAX(a, b, …) | Accepts multiple values | Picks the largest value | MAX(10, 20, 5) is 20 |
| SIN / COS / LOG | Expects a single value | Standard math functions | SIN(45) |
5. String (Text) Functions
Used for manipulating text data and labels.
| Function | Description | Example | Result |
|---|---|---|---|
| LEFT(text, length) | Take letters from start | LEFT("Alpha", 2) | "Al" |
| RIGHT(text, length) | Take letters from end | RIGHT("Alpha", 2) | "ha" |
| MID(text, start, length) | Take x letters from middle | MID("Alpha", 2, 2) | "lp" |
Pro-Tips for AlphaMon Expressions
- The Order of Operations: AlphaMon follows standard math rules (Precedence). For example, Multiplications (
*) are evaluated before Additions (+). - When in doubt, use Parentheses: You can use
( )to force a specific order, e.g.,(1 + 2) * 3equals9, whereas1 + 2 * 3equals7. - Case Sensitivity: AlphaMon is case-insensitive. For example, “
BATTSOC", “battsoc", and “BattSoc"are all the same. - Assignments: Use the “
=" assignment operatorto set a value, e.g.,Relay1 = ON, where “Relay1” is referred to as the left-hand-side or “LHS” operand and “ON” is the RHS operand.