Workflow: Generate → Validate → Iterate
This workflow assumes you are contributing to spx-examples (or mirroring its conventions in your own model repo).
Prereqs (one-time)
git clone https://github.com/HammerHeads-Engineers/spx-examples.git
cd spx-examplesSet your product key (pick one):
Edit
.envand setSPX_PRODUCT_KEY=...Or export it in your shell:
export SPX_PRODUCT_KEY=...
Install Python tooling:
poetry install --with devStart SPX Server:
docker compose up -dGenerate
Pick the closest template under
library/domains/....Copy it into the correct domain/vendor folder.
Keep
name:aligned with the file stem and keep YAML structure consistent withdocs/MODEL_LANGUAGE.md.
Validate
Run repo validation (model files + catalog references):
Expected success output:
Iterate (tests + UI)
Run the test suite (or target a subset first):
For interactive debugging, inspect the running Instance in the UI:
UI concepts:
ui-reference/README.mdMiL tests (deterministic stepping):
getting-started/use-in-unit-tests-mil.md
End-to-end example (real template → edit → test)
Goal: create a SCPI multimeter variant with a new fault scenario and a regression test.
Start from the template:
library/domains/measurement_instruments/generic/multimeter__scpi.yaml
Copy it:
Edit the new model:
File:
library/domains/measurement_instruments/generic/multimeter_overrange__scpi.yamlUpdate:
name: multimeter_overrange__scpiAdd a scenario under
scenarios:(follow patterns in the source template)
Example scenario shape:
Register it in the catalog:
File:
library/catalog/models.yamlAdd a new entry with:
path: library/domains/measurement_instruments/generic/multimeter_overrange__scpi.yamldomain: measurement_instrumentsprotocols: [scpi]services: [{id: scpi_tcp_stack}](match existing SCPI models)
Add a MiL test:
Copy an existing pattern:
tests/shared/integration/scpi_multimeter_sut_example.py
Create a new test under a
test_*.pyfile (sopytestcollects it), e.g.:tests/core/integration/test_scpi_multimeter_overrange.py
Minimal assertions to include:
loads the model from disk,
creates an Instance,
starts the new Scenario,
reads the SCPI response and asserts the expected range/behavior.
Run:
Inspect in UI (optional):
Start the UI container (see
spx-examples/docker-compose.ymlfor thespx-uiservice).Open the UI and inspect the instance attributes/scenarios.
Last updated

