All docsStellar ControlMission control · by Stellar Systems v1.1.0

Procedure Language

Syntax and Names

Files, lines and indentation, comments, strings, reserved words, naming rules and how names resolve in steps and procedures.

This page describes the layout of .proc files and how the names written in them resolve: roles, components, instances, measures, inputs and answers. The statements themselves are in the Statement Reference, the expressions in Expressions, Types and Units.

Files#

  • Steps and procedures live in .proc files of a library package, next to its package.yaml (see Libraries and Validation). A library may have any number of files; names are shared by all of them, so a step defined in one file is called from another.
  • A file contains top-level step and procedure blocks, in any order: calls resolve whatever the order of the definitions.
  • Anything else at the top level is an error (procedure::unexpected-line).

Lines and blocks#

  • One statement per line. A statement never spans several lines.
  • Blocks by indentation. The lines of a block are indented under the line that opens it, all by the same amount. Only step, procedure and if failed open a block.
  • Spaces only. A tab in the indentation is an error (procedure::indentation, "tab in indentation").
  • A line indented deeper than its block, or an indented block under a line that opens none, is an error (procedure::indentation).
  • Comments start with # and run to the end of the line, outside strings. Blank lines and comments are ignored.
Procedure
# Operations on the camera outside the procedures of the use case.

procedure "Ready camera"
  uses cam: hsc-100

  step "Command ready"          # an inline step, inside the procedure
    send set_mode to cam.camera with mode = READY
    wait until cam.camera.at_setpoint within 3 min

Strings#

Step names, procedure names, questions of ask, texts of log and descriptions are strings in double quotes: "Camera answers". A string cannot contain a double quote and does not span lines; an unterminated string is reported (procedure::syntax). Strings are never values in expressions (expr::string-value). Only the text of a log holds expressions, between braces ("Detector at {cam.camera.detector_temperature}", see log).

Descriptions#

A description "…" line in the header of a step (inline steps included) or of a procedure describes it for operators. The hover of the editor and the launch form of the web console show it.

Procedure
procedure "Power-up test"
  description "Powers the camera from the bench supply, then checks that it answers in standby."
  uses cam: hsc-100
  • At most one per step or procedure (procedure::duplicate-description).
  • It is not part of the compiled procedure: writing or rewording a description changes neither the hash of the procedure nor its validation in stellar.lock.

Keywords and reserved words#

Every line starts with a keyword:

WhereKeywords
Top levelstep, procedure
Header of a step or proceduredescription, uses, input
Header of a procedureallowed in
Body of a stepsend, expect, check, ask, wait, download, upload, configure
Body of a proceduredo, run, step, if failed

An unknown keyword is reported with the closest one (procedure::unknown-keyword); a keyword in the wrong place too (procedure::misplaced), for instance a send directly in a procedure or a do in a step.

Inside a line, to, with, via, within, retry, every, for, as and into split the line into clauses, outside strings and brackets. They cannot be used as names on the lines that accept them. A clause keyword written twice on one line is an error. In a type, of follows file_id (file_id of quicklook).

In expressions, and, or, not, is, true and false are keywords, and param followed by a path reads a parameter, with in <mode> after the path for a given mode.

Names#

  • Roles, inputs, typed answers, argument names and environments are identifiers: ASCII letters, digits and _, starting with a letter (procedure::invalid-name otherwise).
  • Platforms in uses are catalogue package names, such as hsc-100 or lab-psu.
  • Step and procedure names are free strings. Step names are unique in a library, and so are procedure names (procedure::duplicate-step, procedure::duplicate-procedure); a step and a procedure may share a name, since do calls steps and run calls procedures.
  • A library step must have a name (procedure::anonymous-step); anonymous steps exist only inline in a procedure.
  • Roles, inputs and the answers of ask … into share one namespace per step or procedure (procedure::duplicate-name). An answer is visible in the statements that follow its ask.

Addressing#

A path names what a statement reads or commands. It starts with a role; each segment may be indexed with […].

WrittenMeans
sat.channel[PAYLOAD]Component channel of the target of role sat (a cubesat-6u), instance PAYLOAD
sat.channel[channel]The same, the instance given by the input channel (of the instance enum)
sat.channel[channel].currentMeasure (or derived measure) current of that instance
psuThe only component of a single-component platform (lab-psu)
psu.output_enabledA measure of that only component
cam.files[quicklook]On-board file given by an input file_id of quicklook
sat.stream[camera]Continuous stream camera of the stream component
sat.link[nominal].lockoutMeasure of the standard link component, for the link nominal

Rules:

  • Instances. A multi-instance component is always indexed, by a value of its instance enum (PAYLOAD) or by an input of that enum type (channel); a single-instance one never is (procedure::missing-instance, procedure::unexpected-instance, procedure::unknown-instance). Measures and roles are never indexed.
  • Single component. For a platform with one component, the component is omitted: send output_on to psu, check psu.voltage > 11 V. On a platform with several components, a component must be named (procedure::several-components).
  • files. The on-board directory is indexed by an input declared file_id of <file type>, resolved at run time; a literal identifier is refused. Its telecommands receive their file_id argument from the instance: do not write it in with (procedure::file-id-argument). See Files and Streams.
  • link. The standard link component exists for every target, one instance per link. sat.link[nominal] is accepted by the compiler whatever the link: link names belong to the target, not to the platform, and are checked when the run request is resolved (run::unknown-link). See COP-1 and the Link Component.

Roles and inputs#

Procedure
uses <role>: <platform>
input <name>: <type>
input <name>: <duration type> range [<low>, <high>]
  • uses cam: hsc-100 declares a role typed by a platform. The platform must be a catalogue the library depends on (procedure::unknown-platform); its version is fixed by the library, see Libraries and Validation.
  • input declares a typed input; see Input types. A duration input of a step may have a range of times (input dwell: f32 s range [1 s, 8 h]), which bounds a wait or a within given by the run (see wait). Only the inputs of a step take a range, and only a duration input (procedure::invalid-range).
  • An inline step declares neither (procedure::inline-declaration): it uses those of its procedure.

Name resolution in expressions#

In a condition, an argument value or a call argument, a name resolves in this order:

  1. a path starting with a role: a measure (cam.camera.mode, psu.voltage);
  2. an input or a typed answer of the step or procedure (bus_voltage, measured);
  3. on one side of is, or as the value of an enum argument, a value of the enum on the other side (STANDBY, READY).

An unknown name is reported with the closest known one (expr::unknown-name, expr::unknown-enum-value).

↑↓ to moveEnter to open