Automation — Control Loops

Control Loops let you build automation rules visually instead of writing code — sensors and conditions go in a spreadsheet-style editor, and the Abilis turns the formulas into a Lua program for you. Similar in spirit to how a PLC is programmed, but with no dedicated programming-cable hardware needed.

A control loop is an automated routine that reads input from sensors, applies rules, and drives outputs. For example: "read the temperature sensor → if it's above 25°C → turn on the air conditioning." Traditionally this requires code; the Control Loops editor lets you express the rules visually.

The Control Loop Editor

Control Loops — the main list showing configured control loops with their status.
Control Loops — the main list showing configured control loops with their status.

When you create a new control loop (New +), the editor shows two main tables:

Input Devices Table

The top table lists sensors — devices the loop reads from.

ColumnMeaning
DeviceThe physical device name (e.g. RIO-1, Sonoff-3).
PortWhich specific port/channel on the device.
DescriptionA human-readable label (e.g. "Office temperature sensor").
XThe variable name used in formulas. The first input is X1, the second X2, etc. (Despite the letter, this isn't a spatial coordinate — it's just a short name to reference the sensor in your formula.)
ValueThe current value being read from this sensor.

Output Devices Table

The bottom table lists actuators — devices the loop controls.

ColumnMeaning
DeviceThe physical device name.
PortWhich port/channel.
DescriptionHuman-readable label.
YThe variable name for this output: Y1 for the first output, Y2 for the second, etc. (Same convention as the X inputs — not a spatial coordinate.)
ValueThis is where you write the formula. The formula references input coordinates (X1, X2...) and produces the output. For example: IF(X1>25, 1, 0) turns the output ON when the temperature (X1) exceeds 25°C.

Click Add virtual output to add more output rows. A virtual output isn't wired to a physical actuator — use it for intermediate calculations whose result feeds another formula, or for state values you want to log without driving anything.

Table Syntax Guide

New Control Loop — the editor with input fields for loop parameters and conditions.
New Control Loop — the editor with input fields for loop parameters and conditions.
Control Loop syntax reference — formula operators and expression examples.
Control Loop syntax reference — formula operators and expression examples.

On the right side of the editor, an expandable Table Syntax Guide provides reference for writing formulas. Sections include:

Toolbar Buttons

ButtonWhat It Does
TimingSet how often the loop executes (e.g. every 1 second, every 5 seconds, every minute).
Open Guide / Close GuideToggle the Syntax Guide panel on the right. The button label changes depending on the current state.
DevicesAdd input sensors and output actuators to the tables.
ExportExport the loop's configuration to a file (so it can be imported on another Abilis or kept as a backup).
DeleteDelete this control loop entirely.
SaveSave the control loop. It is automatically converted to a Lua script that appears in the Programs tab.
CloseExit the editor.
After saving a control loop, go to the Programs tab — your loop appears as a Lua script that you can start, stop, and even further customise if needed.

Complete Formula Reference

The following functions and operators are available in Control Loop formulas (sourced from the official Abilis tutorial):

Mathematical Operators

Standard arithmetic: + (addition), - (subtraction), * (multiplication), / (division), ( ) (brackets for grouping).

Mathematical Functions

FunctionWhat It Does
ABS(value)Returns the number with a positive sign (absolute value).
EVEN(value)Returns 1 if the number is even, 0 if odd.
ODD(value)Returns 1 if the number is odd, 0 if even.
INT(value)Returns the integer part, removing decimals.
ROUND(value, decimals)Rounds the number to the specified decimal places.
LOG10(value)Returns the base-10 logarithm.
MOD(value)Returns the decimal part, removing the integer (e.g. MOD(3.14) = 0.14). Note: this is single-argument and Abilis-specific — it is not the modulo / remainder operation, which is what MOD(x, y) means in most spreadsheets. For modulo on Abilis, use the % operator (e.g. 7%3 = 1).
RAND()Returns a random decimal between 0 and 1.
RANDBETWEEN(from, to)Returns a random integer between the two values.
POW(value, exponent)Raises the number to the exponent. Use decimals for roots (e.g. POW(X1, 0.5) = square root).
SQRT(value)Returns the square root.

Logical Functions

FunctionWhat It Does
NOT(value)Returns true if input is false, and vice versa.
AND(v1, v2 [, v3...])Returns true only if all inputs are true. Up to 10 values.
OR(v1, v2 [, v3...])Returns true if any input is true. Up to 10 values.
XOR(v1, v2)Returns true if exactly one input is true and the other is false.

Conditional

IF(condition, value_if_true, value_if_false)

Example: IF(X1>25, 1, 0) → output 1 when temperature exceeds 25°, otherwise 0.

Using Past Values

You can reference a device's previous value by adding a time offset in brackets: X1(time_to_past). The time unit is determined by the interval set in the Timing section of the loop. For example, if timing is set to 5 seconds, X1(3) means "the value of X1 from 15 seconds ago" (3 × 5s).

Even though X1(3) looks like a function call, it's actually array-indexing for historical values. The Abilis stores the last few readings of each input, and X1(3) retrieves the value from 3 timing-cycles ago.

Memory variables (M)

In addition to inputs (X) and outputs (Y), Control Loops can also use memory variables (M1, M2, …) to keep state between cycles — useful for counters, running totals, or anything where the next cycle needs to know what happened in the previous one. See Equipment run-time tracking for a worked example.

Nesting Functions

Functions can be chained by nesting one inside another. For example, to get the average of the square root of two sensor inputs:

AVERAGE(POW(X1, 0.5), POW(X2, 0.5))

Anteklab Technical Support Email: tem@antek.it
Tel: +39 0376 16262,27