Calculated Channels
Process live telemetry with calculated channels.
Calculated channels compute values from other channels in real time:
- Scale, convert, or filter raw data
- Implement sensor voting algorithms
- Trigger alarms or warnings from a condition
Calculated Channels
Create
Create a calculated channel with the “Create Calculated Channel” command in the Command Palette.
Edit
To edit a calculated channel, right-click it in the Channels Toolbar and select “Edit Calculation” from the context menu:
Parameters
Post-Processing Operations
Operations are optional post-processing steps that apply a running aggregation, such as a minimum, maximum, or average.
Expression Result → Operation → Output Channel
↑
Reset ChannelThe operation keeps state across executions and outputs a single aggregated value.
Supported Operations
The derivative operation does not support window or reset channel configuration. It maintains only the previous value and timestamp, so there is no accumulated state to reset.
Example Configurations
A reset fires when the window expires or the reset channel receives true, whichever
comes first. Set the window to 0 and omit the reset channel for an operation that
never resets.
Reset Channels
A reset channel provides signal-based control over operation state and must have the
data type boolean. When it receives true, the operation clears its state and
restarts.
- Manual: write to a virtual
booleanchannel from a schematic button or control panel. - Periodic: use a timer or sequence to generate reset pulses.
- Conditional: use a calculated channel that outputs
truewhen a condition is met.
Reset Example
Time: 0s → 5s → 10s → 10.1s (reset=true) → 15s → 20s
Pressure: 50 → 100 → 75 → 75 → 90 → 110
Max Operation: 50 → 100 → 100 → (reset to 75) → 90 → 110At 10.1s, the reset channel triggers, clearing the max value. The operation restarts from the current input (75) and continues tracking the new maximum.
Writing Expressions
Expressions are written in Arc, a language for real-time telemetry processing. The output data type is inferred from the return value.
Channel References
Reference channels directly by name without any prefix or special syntax:
return temperature
return sensor_a + sensor_b
return voltage * currentEvery expression must end with a return statement.
Variables
Use := to declare intermediate variables:
scaled := pressure * 2.5
offset := scaled + 10
return offsetOperators
Arithmetic: +, -, *, /, %
Comparison: ==, !=, <, >, <=, >=
Logical: and, or, not
A comparison returns true or false.
Conditionals
Use if statements with curly braces for conditional logic:
if (temperature > 100) {
return 1
} else {
return 0
}Multi-condition example:
if (temp > 100 and pressure > 50) {
return 2
} else if (temp > 50) {
return 1
} else {
return 0
}Examples
Common Expressions
Conditional Logic
Safe division (avoid divide-by-zero):
if (denominator == 0) {
return 0
} else {
return numerator / denominator
}Multi-Step Calculations
Unit conversion with intermediate variables:
celsius := sensor_temp
fahrenheit := celsius * 9 / 5 + 32
return fahrenheitPressure compensation:
raw_pressure := sensor_reading
temp_correction := temperature * 0.01
compensated := raw_pressure - temp_correction
return compensatedHow Calculated Channels Work
Calculated channels are virtual: their data is computed on demand and never stored to disk.
On-Demand Computation
A calculated channel runs only while something reads or streams it. Opening a line plot or requesting its data through the API activates the calculation, and stopping the stream pauses it. Nothing runs in the background, so a calculation uses CPU and memory only while its results are needed.
Historical Evaluation
A calculated channel can be queried historically, as if it had been running at that time. Two conditions apply:
- Every input channel must have data in the queried time range.
- Operations with time-based windows may not behave as they do live.
Nested calculations work historically too, as long as the channels at the bottom of the chain are persisted.
Nested Calculations
Calculated channels can depend on other calculated channels, creating calculation chains:
sensor_raw → temp_celsius → temp_fahrenheit → temp_statusData arriving at sensor_raw propagates through the chain, each channel calculating
from the output of the one before it. Nesting has no depth limit, but each level adds
computation time.
Handling Different Arrival Rates
Calculated channels operate on series (arrays of samples), not individual scalar
values. When you write return temperature + pressure, you’re performing an elementwise
operation on arrays.
When inputs have different numbers of samples, Arc uses last-value-hold semantics:
- The output length equals the maximum of the input lengths
- Shorter series repeat their last value for remaining positions
- This happens per frame, not across time
Example: Consider a frame where:
return temperature + pressureIf the frame contains:
temperature: 10 samples[20, 21, 22, 23, 24, 25, 26, 27, 28, 29]pressure: 5 samples[30, 31, 32, 33, 34]
The calculation produces 10 output samples:
pressure’s last value (34) repeats for positions 6-10- Elementwise addition:
[50, 52, 54, 56, 58, 59, 60, 61, 62, 63]
If temperature updates at 100 Hz and pressure at 10 Hz, a frame with 100
temperature samples and 10 pressure samples produces 100 output samples, where
pressure’s 10th value fills samples 11 to 100. This is a hold, not interpolation. No
new pressure values are created.