feat(cosim): generic co-simulation plugin surface + cosim-step CLI#471
Draft
w1ne wants to merge 1 commit into
Draft
feat(cosim): generic co-simulation plugin surface + cosim-step CLI#471w1ne wants to merge 1 commit into
w1ne wants to merge 1 commit into
Conversation
Adds a domain-neutral co-simulation boundary so external physical-plant models can be declared in the system manifest and stepped through an adapter, independent of any specific device or vendor. - Manifest: `cosim_models` with external_process | fmi | mock adapters, typed inputs/outputs signal routing, manifest-relative model paths, and validation (non-empty id, positive step_ns, model required for external_process/fmi). - Core: `CosimAdapter` trait, `StaticCosimAdapter`, typed `CosimStep`/`CosimStepResult`, an external-process JSONL adapter, and a `CosimRunner` that steps models at their configured boundaries and routes signals into/out of a signal store. - CLI: `labwired cosim-step <system.yaml> --set <path>=<value>` builds the runner from a manifest and prints routed outputs (table or --json). - Example: `examples/cosim-plant-demo` — a minimal reduced-order discrete plant exercising the full contract. - Docs: docs/cosimulation_plugins.md. - Contract tests cover the static/external-process adapters, registry, runner boundaries, signal routing, and manifest-relative loading. Existing SystemManifest constructors gain the new `cosim_models` field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a generic, domain-neutral co-simulation plugin surface to LabWired: external physical-plant models can be declared in the system manifest and stepped through an adapter, with typed signal routing — independent of any specific device or vendor.
LabWired keeps owning deterministic firmware execution, topology, traces, and fault orchestration; a co-sim model owns the plant approximation behind a clean boundary.
How it fits together
labwired-config): acosim_modelslist withexternal_process | fmi | mockadapters,inputs/outputssignal-path maps,step_ns, and manifest-relativemodelpaths.validate_cosim_models()enforces a non-empty id, a positivestep_ns, and amodelforexternal_process/fmi.labwired-core::cosim): aCosimAdaptertrait,StaticCosimAdapter, typedCosimStep/CosimStepResult, an external-process JSONL adapter, and aCosimRunnerthat steps each model only at its configured boundary and routes model I/O into and out of a signal store.labwired cosim-step <system.yaml> --set <path>=<value>…builds the runner from a manifest, seeds the signal store, steps the models, and prints routed outputs (table, or--json).examples/cosim-plant-demo— a minimal reduced-order discrete plant that exercises the whole contract (manifest parse → validation → manifest-relative load → adapter → signal routing).docs/cosimulation_plugins.md.adapter: fmiintentionally returns a clear "not wired yet" error, marking the next integration seam.Example
Tests
crates/core/tests/cosim_contract.rscovers the static adapter, the external-process JSONL round-trip, the mock registry, runner step boundaries, signal-path routing, and manifest-relative loading (8 tests).labwired-configgains manifest parse + validation tests.Verified locally: full workspace
cargo testgreen,cargo fmt --checkclean, andclippy -D warningsclean on the touched crates (labwired-core,labwired-config,labwired-cli).Note
Existing
SystemManifestconstructors across the workspace gained the newcosim_modelsfield (defaulted to empty) — that accounts for most of the one-line diffs.🤖 Generated with Claude Code