ReferenceConsoleCalculated Channels

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

FieldDescription
NameA name for the channel.
ExpressionThe Arc expression that calculates the value to be written to the calculated channel. This expression must end with a return statement. Channel dependencies are automatically detected from the expression.
Operation (Optional)Post-processing operation applied to the expression result. Options include min, max, avg for running aggregations, and derivative for rate of change.
Window (Optional)Time duration for operation resets. When the duration expires, the operation state is reset. Set to 0 for no duration-based reset. Only applies when an operation is selected.
Reset Channel (Optional)A boolean channel that triggers operation reset when its value is true. Only applies when an operation is selected.

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 Channel

The operation keeps state across executions and outputs a single aggregated value.

Supported Operations

OperationDescription
minRunning minimum. Tracks the smallest value seen since the last reset.
maxRunning maximum. Tracks the largest value seen since the last reset.
avgRunning average. Computes the mean of all values since the last reset.
derivative

Rate of change. Computes the derivative (dx/dt) per second of the expression result. Always outputs float64.

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

Use case Operation Window Reset Channel
Rolling 10-second average avg 10s none
Maximum until manual reset max 0s manual_reset_btn
Minimum, time or signal min 60s cycle_complete
Rate of change derivative n/a n/a

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 boolean channel from a schematic button or control panel.
  • Periodic: use a timer or sequence to generate reset pulses.
  • Conditional: use a calculated channel that outputs true when 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  → 110

At 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 * current

Every expression must end with a return statement.

Variables

Use := to declare intermediate variables:

scaled := pressure * 2.5
offset := scaled + 10
return offset

Operators

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

Use case Expression
Scale a sensor return pressure * 1.5
Convert Celsius to Kelvin return temperature + 273.15
Power return voltage * current
Sum sensors return sensor_1 + sensor_2 + sensor_3
Average return (temp_1 + temp_2 + temp_3) / 3
Differential pressure return inlet_pressure - outlet_pressure

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 fahrenheit

Pressure compensation:

raw_pressure := sensor_reading
temp_correction := temperature * 0.01
compensated := raw_pressure - temp_correction
return compensated

How 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_status

Data 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 + pressure

If 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:

  1. pressure’s last value (34) repeats for positions 6-10
  2. 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.