Examples of AlphaMon Expressions

The AlphaMon Platform allows you to control both your renewable energy generation and electrical loads using a process called Demand Management.

The rules The AlphaMon Platform uses to perform Demand Management tasks are called “expressions”. You can create multiple rules or expressions for each AlphaMon device by editing your Config File. Each expression is similar to a simple mathematical equation.

The best way to learn AlphaMon expressions is to see them in action. Here are a few practical examples categorized by what they’re designed to achieve.

Note: Not all of the Alias values shown below may be available on your specific system, so check which Aliases are available to you by referring to this tutorial.

1. Automation & Control (Logic)

These examples show how to turn devices on or off based on sensor data. Note that the RHS of the Expression should be designed to return a 1 or 0, equating to ON or OFF, or alternately True or False or Yes or No.

  • The “Battery Guard” (Low Battery Alert):
    BUZZ = (BATTSOC < 20 AND LOCAL:HH >= 8)
    • What it does: Sounds the buzzer if the Battery State of Charge drops below 20%, but only after 8:00 AM (to avoid waking you up at night).
    • Highlights: Comparison (<), Logical (AND), and Time (LOCAL:HH).
  • Smart Heater Control:
    HEATER = (TEMP_ROOM < 18 AND GRID_POWER_PRICE < 0.15)
    • What it does: Turns on a heater only if the room is cold AND the electricity price is low.

2. Monitoring & Math (Arithmetic)

Sometimes you need to modify raw data to make it more useful.

  • Calculating Power in Kilowatts:
    KW_TOTAL = (METER1:WATTS + METER2:WATTS) / 1000
    • What it does: Adds the wattage from two meters together and divides by 1,000 to show the value in Kilowatts.
    • Highlights: Arithmetic (+, /) and Parentheses to ensure addition happens first.
  • Temperature Calibration:
    CORRECTED_TEMP = SENSOR_TEMP – 2.5
    • What it does: Adjusts a sensor reading that you know runs a bit hot.

3. Visual Feedback (Blinks & Dimmers)

Using math and time to create status indicators.

  • The “Heartbeat” (Blinking LED):
    LED = MOD(LOCAL:SS, 2) * 50
    • What it does: Every even second, the LED turns on at 50% brightness. Every odd second, it turns off.
    • Highlights: Remainder (MOD), Multiplier (*), and the Numeric LED scale.
  • Night-Time Dimmer:
    LED = (LOCAL:HH >= 20 OR LOCAL:HH < 6) ? 10 : 80
    • (Note: Using logic to set levels): LED = (LOCAL:HH >= 18) * 10 + (LOCAL:HH < 18) * 80
    • What it does: Sets the LED to 10% brightness at night (after 6 PM) and 80% during the day.

4. Advanced “Smart” Functions

Using the built-in functions to pick the best data.

  • Peak Power Monitor:
    MAX_LOAD = MAX(PHASE_A, PHASE_B, PHASE_C)
    • What it does: Identifies which of your three power phases is currently drawing the most current.
    • Highlights: The MAX() function.
  • Relative Temperature (Absolute Difference):
    TEMP_DIFF = ABS(TEMP_INSIDE – TEMP_OUTSIDE)
    • What it does: Tells you how many degrees difference there is between inside and outside, ignoring whether it is hotter or colder.
    • Highlights: The ABS() and MAX() functions.

Tips for Success:

  1. Order Matters: Use the BODMAS acronym (Brackets, Orders, Division/Multiplication, Addition/Subtraction) to help remember Precedence. If your result looks weird, add more parentheses!
  2. Check Your Aliases: Make sure the names (like TEMP_ROOM) match exactly what you see in your Boot Log.

Built better by Solargy Innovation (Australia)

[email protected]

Powered by WordPress.