All docsStellar ControlMission control · by Stellar Systems v1.1.0

Procedure Language

Expressions, Types and Units

Input types, literals, operators, conditions, units and durations of the procedure language.

Conditions, argument values and call arguments are expressions, parsed and type-checked by the compiler: there is no textual substitution. The same expression language serves the derived measures and alarms of the catalogues; procedures use a subset of it, without temporal functions.

Input types#

TypeWrittenValue given at launch
Booleanbooltrue, false
Integeri8, i16, i32, i64, u8, u16, u32, u64, optionally with a unita whole number in range: 3, 12 s
Floatf32, f64, optionally with a unit (f32 V)12 V, 12000 mV, 11.5 without unit
Bytesbyteshexadecimal: 0a1b, 0x0a1b
Enumthe name of an enum of a platform of the roles (camera_mode)a value of the enum: READY
File identifierfile_id of <file type> (file_id of quicklook)the on-board identifier: 12
File contentfilethe SHA-256 of a content stored with stellar put
InstantinstantRFC 3339, to the nanosecond: 2026-10-05T12:00:00Z; read by send … at only
Procedure
input expected_mode: camera_mode
input bus_voltage: f32 V
input quicklook: file_id of quicklook
input patch: file

Rules checked by the compiler:

  • Only numeric types carry a unit (procedure::invalid-type); the unit must be known (procedure::invalid-unit).
  • An enum is looked up in the catalogues of the roles of the step or procedure. A name defined differently by two of these platforms is ambiguous and refused (procedure::ambiguous-enum); an unknown type is reported with the closest candidates (procedure::unknown-type).
  • A file_id needs its file type, declared by the files component of a platform of the roles (procedure::unknown-file-type).
  • The answer of ask … as <type> into <name> uses the same types.

At launch, a quantity is converted into the unit of its input, or refused when the units are incompatible (run::invalid-input): bus_voltage: 12000 mV is 12 V, bus_voltage: 12 A is refused, and so is bus_voltage: 12 for an input with a unit.

Literals#

LiteralExamples
Number3, 27.5, 2.5e-3
Quantity: a number followed by a unit28 V, 800 degC, 10 V/s, 2.5e-3 kV, 500 ms
Booleantrue, false
Enum valueSTANDBY, PAYLOAD, VERIFIED, bare

A unit follows its number, separated by a space or not (5s, 5 s). Units compose with /, * and ^: V/s. Units of the same dimension convert into each other (mV, V, kV; ms, s, min, h, d).

References#

A reference is a path:

  • a measure or derived measure of a role: cam.camera.mode, psu.voltage, cam.files[quicklook].transfer, sat.channel[channel].current, sat.link[nominal].lockout;
  • an input or a typed answer: bus_voltage, measured;
  • a bare enum value, on one side of is or as an enum argument: STANDBY.

A role alone is not a value (expr::type-mismatch), and neither are file_id and file inputs: those index files or are the source of an upload.

Parameters: param#

Procedure
param <role>.<component>[<instance>].<parameter> [in <mode>]
Procedure
send set_detector_setpoint to cam.camera with temperature = param cam.camera.detector_setpoint in Nominal
check cam.camera.detector_setpoint is param cam.camera.detector_setpoint +/- 0.1 degC

param reads a parameter of the target of a role, as the topology gives it for that target, in the environment of the run:

  • without in, in the current mode of the target, read from stellar_modes when the statement is evaluated (the default mode of the topology when it was never set);
  • with in <mode>, in that mode.

The value has the type and unit of the parameter; it serves as an argument of a telecommand or in a condition, like a measure. The path is written like that of a measure; the component is left out on a platform of one component, and the instance is a value of the enum or an input of that type. Parameters have their own namespace: param cam.camera.detector_setpoint is the parameter, cam.camera.detector_setpoint the measure.

  • The mode must be declared in the topology (procedure::unknown-mode), and the path must name a parameter (procedure::unknown-parameter; procedure::unexpected-instance for an index on the parameter itself).
  • param … in <mode> on a known instance is checked when the run request is resolved: the target must have a value in that mode (run::parameter-undefined). Otherwise, a parameter without a value for the target fails the statement at run time.
  • param exists in procedures only; in a catalogue expression it is refused (expr::parameter-not-here).

Operators#

From the lowest precedence to the highest:

OperatorsMeaningOperands
orEitherBooleans
andBothBooleans
notNegationBoolean
is, is not, is … +/- …, <, <=, >, >=ComparisonSee below
+, -Sum, differenceNumbers of compatible units
*, /Product, quotientNumbers; units multiply and divide
- (unary)OppositeNumber

Parentheses group: (a or b) and c. A comparison takes one comparison operator: write a > 1 V and a < 5 V, not 1 V < a < 5 V.

Equality: is and is not#

is compares numbers, booleans and enum values; is not negates it.

Procedure
check cam.camera.mode is mode
expect cam.camera.responding is true within 5 s
check cam.camera.mode is not SAFE
  • The two sides must have the same type: two numbers of compatible units, two booleans, or two values of the same enum (expr::type-mismatch).
  • An enum value is written bare; it is checked against the enum of the other side (expr::unknown-enum-value).

Tolerance: +/-#

Procedure
check psu.voltage is 12 V +/- 0.5 V
check psu.voltage is measured +/- 0.5 V

a is b +/- t holds when a is within t of b. It applies to numbers only, and the tolerance has a compatible unit.

Ordering: <, <=, >, >=#

Procedure
check psu.current < 2 A
wait until cam.camera.detector_temperature <= 18.5 degC within 3 min

Both sides are numbers of compatible units.

Units#

The compiler checks units everywhere:

  • adding, subtracting or comparing values of incompatible units is an error (expr::unit-mismatch): degrees Celsius and volts never mix;
  • a number without unit compared with a value that has one is an error (expr::missing-unit): write 5 V, not 5;
  • values of compatible units are converted: psu.voltage > 11000 mV is valid.

Functions#

Conditions may use the pure mathematical functions abs, floor, ceil, round, sqrt, exp, ln, log10, sin, cos, tan, asin, acos, atan, atan2, hypot and clamp.

Procedure
check abs(psu.current) < 2 A

The temporal functions (age, stable, rate, avg…) are refused in procedures (expr::temporal-not-allowed): declare them as derived measures in the catalogue, and read the derived measure in the procedure.

Conditions#

The conditions of expect, check and wait until are boolean (expr::type-mismatch otherwise). When a condition reads a value that is missing or stale, it does not hold.

Durations#

The durations of within, wait, every and for are literals with a time unit: 500 ms, 10 s, 3 min, 1 h, or, for wait and within, a duration input of the step bounded by a range (wait dwell, see wait). Another expression is refused (procedure::non-constant-duration), an input without range too (procedure::unbounded-duration), and so is a value that is not a time (procedure::not-a-duration): the maximum duration of a procedure is computed before it runs. See Safety Rules and Maximum Duration.

Diagnostics of expressions#

CodeMeaning
expr::syntaxThe expression does not parse
expr::unknown-nameUnknown name or path
expr::unknown-enum-valueNot a value of the enum on the other side
expr::type-mismatchOperands of the wrong type, or a condition that is not boolean
expr::unit-mismatchIncompatible units
expr::missing-unitA number without unit next to a value with one
expr::string-valueA string used as a value
expr::unknown-function, expr::wrong-argumentsUnknown function, wrong arguments
expr::temporal-not-allowedA temporal function in a procedure
expr::parameter-not-hereparam in a catalogue expression
procedure::unknown-mode, procedure::unknown-parameterparam … in names an undeclared mode, or param no parameter

↑↓ to moveEnter to open