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 are virtual: their
data is computed on demand and never stored to disk. Because nothing is stored, an edit
applies to all historical data. A
channel changed from chan * 3 to chan * 10 shows chan * 10 for its whole history.
Calculated Channel Parameters
Operation Parameters
Create and Edit a Calculated Channel
Console
Python
TypeScript
Create a calculated channel with the “Create Calculated Channel” command in the Command Palette. To edit a calculated channel, right-click it in the Channels Toolbar and select “Edit Calculation” from the context menu.
# Create a calculated channel
avg_pressure = client.channels.create(
name="avg_pressure",
data_type=sy.DataType.FLOAT32,
expression="return (pressure_1 + pressure_2) / 2",
operations=[sy.channel.Operation(type="avg", duration=10 * sy.TimeSpan.SECOND)],
)
# Upsert to edit a calculated channel
avg_pressure.expression = "return pressure_1 * 2"
avg_pressure.operations = [
sy.channel.Operation(type="max", duration=10 * sy.TimeSpan.SECOND)
]
client.channels.create(avg_pressure)// Create a calculated channel
const avgPressure = await client.channels.create({
name: "avg_pressure",
dataType: DataType.FLOAT32,
expression: "return (pressure_1 + pressure_2) / 2",
operations: [{ type: "avg", duration: TimeSpan.seconds(10) }],
});
// Upsert to edit a calculated channel
await client.channels.create({
...avgPressure.payload,
expression: "return pressure_1 * 2",
operations: [{ type: "max", duration: TimeSpan.seconds(10) }],
});Operations
Operations are optional steps that apply a running aggregation, such as a minimum, maximum, or average.
The 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
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
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
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. Reference
channels by name, and end the expression with a return statement. The output data type
is inferred from the return value. Channel references are series, not scalars, so
return temperature + pressure is an elementwise operation on arrays.
scaled := pressure * 2.5
return scaled + 10See the Arc reference for operators, variables, and if statements.