Operators and Functions

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.

OperationSymbolFriendly NamePrecedenceExampleResult
Add / Subtract+ / -1110 + 515
Multiply / Divide* / /1210 * 330
Remainder%MOD1210 MOD 31
Negative-13-10 + 2010

2. Comparison Operators (Decisions)

The following Comparative Operators allow you to compare two values and return True (1) or False (0).

SymbolFriendly NameMeaningPrecedenceExample
== (or =)EQEqual to7Temp EQ 25
!=NENot equal to7Status NE OFF
>GTGreater than8Power GT 1000
<LTLess than8Volts LT 220
>=GEGreater than or equal8SOC GE 80
<=LELess than or equal8Temp LE 15

3. Logical Operators (Combinations)

Logical Operators are used to join multiple comparisons together.

SymbolFriendly NameMeaningPrecedenceExample
&&ANDBoth must be true3Temp GT 20 AND SOC LT 10
||OREither can be true2Manual_On OR Auto_Trigger
!NOTFlips the result13NOT ON (Result is OFF)

4. Mathematical Functions

Special tools for more complex logic.

Function/sTypeDescriptionExample
ABS(x)Expects a single valueRemoves negative signsABS(-5) is 5
MIN(a, b, …)Accepts multiple valuesPicks the smallest valueMIN(10, 20, 5) is 5
MAX(a, b, …)Accepts multiple valuesPicks the largest valueMAX(10, 20, 5) is 20
SIN / COS / LOGExpects a single valueStandard math functionsSIN(45)

5. String (Text) Functions

Used for manipulating text data and labels.

FunctionDescriptionExampleResult
LEFT(text, length)Take letters from startLEFT("Alpha", 2)"Al"
RIGHT(text, length)Take letters from endRIGHT("Alpha", 2)"ha"
MID(text, start, length)Take x letters from middleMID("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) * 3 equals 9, whereas 1 + 2 * 3 equals 7.
  • Case Sensitivity: AlphaMon is case-insensitive. For example, “BATTSOC", “battsoc", and “BattSoc" are all the same.
  • Assignments: Use the “=" assignment operator to 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.

Built better by Solargy Innovation (Australia)

[email protected]

Powered by WordPress.