This tutorial uses the use case Payload integration, a configuration repository downloadable from get.stellar-systems.eu: the HSC-100, a hyperspectral camera for 6U CubeSats described by its supplier's ICD, and the procedures written against its catalogue before the hardware arrives. It runs the procedure « First light » twice: on your machine, on an ephemeral simulated camera, then on a demonstration environment of the online trial, where you also send telecommands and watch values. It takes about twenty minutes and needs no hardware.
It assumes the CLI of Installation is on your PATH, and, for the first
part, the nats-server 2.12 binary of the message bus too (see Installation).
1. Get the repository#
curl -fsSLO https://get.stellar-systems.eu/use-cases/payload-integration.zip
unzip payload-integration.zip
cd payload-integrationIt is a complete configuration repository:
topology.yaml environments SIM and BENCH; targets cam-sim-1 and cam-em-1
packages/hsc-100/catalogue.yaml the camera, from its ICD: modes, measures, telecommands, alarms
packages/hsc-100-ops/ the library: camera.proc, package.yaml, stellar.lock
simulations/hsc-100-sim.yaml the simulated camera: powers, cooling, acquisitions, faults
runs/first-light.yaml the run request of the demonstration
drivers/hsc_100/ the Python driver of the real camera, over CSP
icd/hsc-100.md the ICD of the supplier (fictitious)The topology declares two targets of the platform hsc-100: cam-sim-1, the simulated camera,
in the environment SIM, and cam-em-1, the engineering model on the CAN bus of the
integration bench, in BENCH. The same procedures run on both. See
Payload Integration for how the catalogue, the simulation
and the driver were made from the ICD.
2. Check it#
stellar check . --lockedChecked 1 catalogue, 1 library, the topology, 1 simulation (1 step, 3 procedures): 0 errors, 0 warnings.stellar check compiles everything with the same compiler as the services: types, units,
limits, calibrations, references, environment policies. --locked also fails when a step or a
procedure changed without being validated again in its stellar.lock, as the CI of a merge
request does. See Compilation, Snapshots and Locks.
3. The procedure#
packages/hsc-100-ops/camera.proc holds a shared step and three procedures, « First light »,
« Release cover » and « Download quicklook ». « First light » is the first acquisition of the
camera:
step "Camera answers" retry 3 times every 2 s
uses cam: hsc-100
send housekeeping to cam.camera
expect cam.camera.responding is true within 5 s
procedure "First light"
description "First acquisition of the camera: health, detector to its setpoint, a short acquisition, back to standby."
uses cam: hsc-100
allowed in SIM, BENCH
do "Camera answers" with cam
step "Health"
check cam.camera.mode is STANDBY
check cam.camera.faulty is false
log "Supply {cam.camera.input_voltage}, {cam.camera.power}; detector {cam.camera.detector_temperature}; cover {cam.camera.cover}"
step "Cool the detector"
configure cam for Nominal
send set_mode to cam.camera with mode = READY
wait until cam.camera.can_acquire within 3 min
log "Ready: detector {cam.camera.detector_temperature} for a setpoint of {cam.camera.detector_setpoint}, {cam.camera.power}"
step "Acquire"
send configure_acquisition to cam.camera with lines = 1024, integration_time = 4000 us, band_set = FULL
send start_acquisition to cam.camera
wait until cam.camera.acquisition_progress >= 50 % within 60 s
log "Acquisition {cam.camera.last_acquisition} halfway: {cam.camera.power}"
wait until cam.camera.mode is READY within 60 s
log "Acquisition done: {cam.camera.storage_free} free, electronics at {cam.camera.electronics_temperature}"
step "Back to standby"
send set_mode to cam.camera with mode = STANDBY
log "Standby: {cam.camera.power}"
if failed
step "Report the state"
log "First light failed: mode {cam.camera.mode}, last status {cam.camera.last_status}, faulty {cam.camera.faulty}"It declares one role, cam, typed by the platform hsc-100. configure cam for Nominal
applies the mode Nominal of the target: the detector setpoint the topology gives for it
(18 °C), set by its telecommand and checked on its readback. can_acquire is a derived measure
of the catalogue: mode READY, detector at its setpoint and no duty cycle pending.
A run request binds the role to a target, in an environment (runs/first-light.yaml):
run: First light
environment: SIM
targets: {cam: cam-sim-1}4. Dry run on your machine#
stellar run --dry runs/first-light.yaml --report report.htmlThe command starts a local message bus (nats-server), the services of the core in its own process, and a
simulated camera, dry-cam, played by simulations/hsc-100-sim.yaml. It then follows the log
of the run, one timestamped line per event (timestamps removed here):
[dry] simulated targets ready: cam=dry-cam (hsc-100-sim)
started « First light » in SIM (cam=dry-cam) by dry run
step First light / Camera answers
send camera.housekeeping to dry-cam
→ VERIFIED
expect cam.camera.responding is true: PASSED
…
step First light / Cool the detector
send camera.set_detector_setpoint to dry-cam
→ VERIFIED
mode of dry-cam: Nominal
send camera.set_mode to dry-cam
→ VERIFIED
wait_until cam.camera.can_acquire: PASSED
log Ready: detector 18.05 degC for a setpoint of 18 degC, 4.45274 W
…
finished: PASSED
[dry] report written to report.htmlIt takes about 40 seconds: the simulated detector cools from 22 °C to its setpoint, then a
20-second acquisition runs. The command exits with 0 when the procedure succeeds, 1 when it
fails: this is what the CI of a procedure repository runs. The roles get targets named
dry-<role>; the environment and targets of the request are ignored. Nothing is left
running.
| Option | Meaning |
|---|---|
--repository <dir> | Configuration repository (default .) |
--nats-server <path> | nats-server binary (STELLAR_NATS_SERVER, default nats-server) |
--report <file> | Write the report of the run |
--fault <ROLE:FAULT[@[STEP+]DELAY][~OFF]> | A fault to switch on during the run |
--on-decision <choice> | How the dry run answers a decision: fail (default), skip, replay, abort, ask |
--speed <x> | Speed of the simulated time |
See Dry runs.
5. Read the report#
Open report.html in a browser. Every run keeps its evidence, and the report renders it: the
procedure, its library and version, the environment, the target bound to each role, the hash of
the configuration it ran; then each step and attempt, each telecommand with its acknowledgement
chain (PENDING, ENCODED, SENT, VERIFIED) and its timestamps, and each check, expect
and log with the samples that decided it. See Evidence and Reports
and Telecommand Lifecycle.
6. Rehearse a failure#
The simulation declares the faults of the ICD (tec_fault, under_voltage, electronics_hot,
over_current). Switch the TEC fault on 5 seconds into the step « Cool the detector »:
stellar run --dry runs/first-light.yaml --fault 'cam:tec_fault@Cool the detector+5s' step First light / Cool the detector
…
send camera.set_mode to dry-cam
log fault `tec_fault` switched on for `dry-cam` (scheduled by the request)
alarm dry-cam.camera.safe_mode ACTIVE_UNACK (critical)
→ VERIFY_TIMEOUT: verification on `mode` not met within 130s
FAILED: `camera.set_mode` ended VERIFY_TIMEOUT: verification on `mode` not met within 130s
decision required on First light / Cool the detector: …
[dry] decision on First light / Cool the detector: fail (--on-decision)
answered fail by the dry run
step First light / Report the state
log First light failed: mode SAFE, last status OK, faulty true
finished: FAILED: a step failedThe camera goes to SAFE: the alarm safe_mode of the catalogue is raised, and set_mode
never sees READY within the 130 s of its verification. The step fails; since it changes the
on-board state, it is not retried automatically but waits for a decision, which the dry run
answers fail: the if failed block runs and logs the state of the camera, and the command
exits with 1. This takes a little over two minutes, the time of the verification. See
Faults scheduled by a run and
Questions, Decisions and Control.
7. A demonstration environment#
Open the online trial on this use case,
control.stellar-systems.eu/#/new?usecase=payload-integration,
and sign up. You get a demonstration environment at https://<name>.control.stellar-systems.eu:
the configuration of this repository, the simulated camera cam-sim-1 running, and the web
console.
Sign the CLI in to it, then make it the API of every command:
stellar login --api https://<name>.control.stellar-systems.eu
# Open https://…/device?user_code=…
# and check that it shows the code …
export STELLAR_API=https://<name>.control.stellar-systems.euApprove the code in a browser; the session is kept and renewed by itself. See Signing in the CLI.
8. Send a telecommand#
The catalogue of hsc-100 declares a housekeeping telecommand, verified by the responding
measure within 5 s:
housekeeping:
description: Asks for the housekeeping record (port 10).
changes_state: false
verify: [{responding: true, within: 5s}]Send it:
stellar send cam-sim-1 camera.housekeepingThe command follows the acknowledgement chain of the telecommand until its final state:
PENDING, ENCODED (ACK 1, the driver), SENT (ACK 2, the gateway), then VERIFIED (ACK 3,
the verification on telemetry). It succeeds on VERIFIED or COMPLETE.
A telecommand with arguments takes them as name=value, quantities with their unit:
stellar send cam-sim-1 camera.set_detector_setpoint 'temperature=15 degC'It is verified when the detector_setpoint measure reads 15 °C back, within 5 s. A value
outside the range of the argument (temperature=30 degC, the range is 10 to 25 °C) is refused
before anything is sent, with the error tc::out-of-range.
9. Watch values#
stellar watch cam-sim-1 camera.detector_temperatureThe command prints the current value, then each new sample: the simulated detector follows its
new setpoint at 0.5 °C/s, with noise. Stop it with Ctrl-C. A measure is selected as
camera.detector_temperature or detector_temperature; without a measure, every value of the
target is shown.
--until and --timeout turn it into a wait, handy in scripts:
stellar watch cam-sim-1 camera.mode --until STANDBY --timeout 10More in Direct Telecommands and Values.
10. Run the procedure#
Launch « First light » on cam-sim-1, from the same request as the dry run:
stellar run runs/first-light.yamlstellar run prints run <id> launched, then follows the log of the run as in the dry run. Its
configure cam for Nominal brings the setpoint back to 18 °C. It exits with success when the
procedure succeeds.
With --detach, it only prints the run identifier (a ULID). You can then follow, inspect it and
get its report:
RUN=$(stellar run runs/first-light.yaml --detach)
stellar watch "$RUN" # follow it; an identifier of run is told apart from a target
stellar status "$RUN" # running, suspended, waiting for an answer, finished
stellar report "$RUN" -o report.htmlThe camera allows one acquisition every 10 minutes (the duty cycle of its ICD): a run started sooner after the previous acquisition waits for it in « Cool the detector », 3 minutes at most, then fails.
In the environment SIM, human orchestration is off: no identity is required by the
environment, and confirmations are acknowledged automatically. In BENCH, the environment of
the engineering model, an operator must confirm each hazardous telecommand, such as
release_cover in « Release cover ». See Hazardous Confirmations
and Questions, Decisions and Control.
Faults can be injected online too, through the run request: its faults: key switches faults of
the simulation on and off during the run, on simulated targets only. The
Test Bench Automation use case does it with
runs/tvac-leak.yaml: a vacuum leak opens 10 s into a plateau of « TVAC cycle », the alarm
vacuum_leak rises, and its reaction « Safe chamber » closes the gate valve and warms the plate.
# runs/tvac-leak.yaml of the use case test-bench-automation
run: TVAC cycle
environment: SIM
targets: {chamber: chamber-sim, psu: psu-sim, dut: cam-sim}
inputs: {hot: 50 degC, cold: -30 degC}
faults:
- {target: chamber, fault: vacuum_leak, at: {step: Plateau, after: 10 s}, off: {after: 60 s}}From a clone of that repository, stellar run runs/tvac-leak.yaml launches it on a
demonstration environment of the use case.
See Faults scheduled by a run.
11. The web console#
Open https://<name>.control.stellar-systems.eu/ in a browser. The Targets view
(#/target/cam-sim-1) shows the current values of the camera, the curve of a measure against its
limits, its mode and parameters, and a form to send its telecommands. The Runs view
(#/runs) lists your runs with their steps, log and evidence, launches a procedure, and opens
the report of a finished run. See Web Console.
Where to go next#
- The other use cases: a 6U CubeSat from simulation to flight model, a TVAC chamber run unattended. See Use Cases.
- Describe your own platform: Catalogue Packages.
- Simulate it from its catalogue:
stellar generate simulation <catalogue>, see A simulation written from the catalogue. - Describe your targets and links: Targets.
- Write procedures: Steps and Procedures.
- The whole command line: CLI Reference.