miravo 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -236
- package/console-dist/assets/index-C1oOHU1J.js +119 -0
- package/console-dist/assets/index-C3XMYq26.css +2 -0
- package/console-dist/favicon.svg +31 -14
- package/console-dist/index.html +2 -2
- package/console-dist/miravo-logo.png +0 -0
- package/package.json +8 -7
- package/src/__tests__/integration/executable-methods-runner.ts +1 -0
- package/src/__tests__/integration/executable-methods.integration.ts +45 -39
- package/src/commands/inject.test.ts +0 -24
- package/src/commands/models.test.ts +1 -1
- package/src/commands/models.ts +6 -0
- package/src/commands/start.test.ts +122 -0
- package/src/commands/start.ts +310 -12
- package/src/commands/status.test.ts +0 -26
- package/src/commands/templates.test.ts +0 -13
- package/src/lib/shutdown.ts +13 -3
- package/src/logger.ts +21 -4
- package/console-dist/assets/index-BXtW73cF.css +0 -2
- package/console-dist/assets/index-ChSocZFW.js +0 -119
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Industrial environment platform. Canonical asset models, multi-protocol output, structured plant topology.
|
|
4
4
|
|
|
5
|
-
Miravo simulates industrial assets with realistic physics
|
|
5
|
+
Miravo simulates industrial assets with realistic physics -- correlated signals, lifecycle degradation, cascading faults -- and projects them over MQTT and OPC UA from a single canonical asset model.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
MiravoWorks/smart-factory
|
|
@@ -42,9 +42,6 @@ miravo start
|
|
|
42
42
|
# Start with a specific template
|
|
43
43
|
miravo start --template smart-factory
|
|
44
44
|
|
|
45
|
-
# Validate without running
|
|
46
|
-
miravo start --template smart-factory --dry-run
|
|
47
|
-
|
|
48
45
|
# Deterministic replay
|
|
49
46
|
miravo start --seed 42
|
|
50
47
|
|
|
@@ -54,244 +51,25 @@ miravo start --speed 10 --tick 500
|
|
|
54
51
|
|
|
55
52
|
Connect any MQTT client to `localhost:1883` and subscribe to `#` to see the data.
|
|
56
53
|
|
|
57
|
-
##
|
|
58
|
-
|
|
59
|
-
Miravo ships with 8 canonical asset models, each with typed members, lifecycle stages, and fault modes:
|
|
60
|
-
|
|
61
|
-
| Model | Key Signals | Fault Examples |
|
|
62
|
-
| ------------------ | ----------------------------------------- | ---------------------------------- |
|
|
63
|
-
| Centrifugal Pump | pressure, flow, vibration, temperature | cavitation, bearing wear |
|
|
64
|
-
| AC Induction Motor | speed, current, vibration, winding temp | rotor imbalance, inner race defect |
|
|
65
|
-
| Air Compressor | header pressure, current, oil temp | valve leak, oil degradation |
|
|
66
|
-
| Belt Conveyor | speed, tension, current, pulley temp | belt slip, misalignment |
|
|
67
|
-
| Hot Water Boiler | firing rate, supply/return temp, pressure | scale buildup, flame instability |
|
|
68
|
-
| HVAC RTU | supply/return air temp, compressor stages | refrigerant leak, dirty filter |
|
|
69
|
-
| Storage Tank | inflow, outflow, level, valve position | sensor drift, outlet leak |
|
|
70
|
-
| Diesel Generator | load, frequency, voltage, coolant temp | fuel filter clog, governor fault |
|
|
71
|
-
|
|
72
|
-
## Built-In Templates
|
|
73
|
-
|
|
74
|
-
Templates combine models into full plant topologies. Use `miravo templates list` to see all available templates, or `miravo templates inspect <name>` for details.
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Copy a template and its models locally for customization
|
|
78
|
-
miravo templates inspect smart-factory --copy --content-dir ./my-content
|
|
79
|
-
|
|
80
|
-
# Run with your customized content
|
|
81
|
-
miravo start --content-dir ./my-content
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Commands
|
|
85
|
-
|
|
86
|
-
### `miravo start`
|
|
87
|
-
|
|
88
|
-
Start a simulation from a template.
|
|
89
|
-
|
|
90
|
-
| Option | Description |
|
|
91
|
-
| --------------------------------- | ----------------------------------------------------------------------------- |
|
|
92
|
-
| `-t, --template <id\|name\|path>` | Template to run (env: `MIRAVO_TEMPLATE`, flag takes precedence) |
|
|
93
|
-
| `-n, --name <name>` | Simulation name (env: `MIRAVO_NAME`, flag takes precedence) |
|
|
94
|
-
| `--content-dir <path>` | User content root with `/templates` and `/models` (env: `MIRAVO_CONTENT_DIR`) |
|
|
95
|
-
| `--models-dir <path>` | Additional `.twin.yaml` model directory |
|
|
96
|
-
| `-s, --speed <multiplier>` | Time multiplier (default: `1`) |
|
|
97
|
-
| `--seed <number>` | Deterministic RNG seed |
|
|
98
|
-
| `--tick <ms>` | Tick interval in ms (default: `1000`) |
|
|
99
|
-
| `-p, --mqtt-port <number>` | MQTT port (default: `1883`, env: `MIRAVO_MQTT_PORT`) |
|
|
100
|
-
| `--mqtt-host <host>` | MQTT bind host (default: `127.0.0.1`, env: `MIRAVO_MQTT_HOST`) |
|
|
101
|
-
| `--mqtt-mode <mode>` | `embedded` or `external` (env: `MIRAVO_MQTT_MODE`) |
|
|
102
|
-
| `--mqtt-url <url>` | External broker URL (env: `MIRAVO_MQTT_URL`) |
|
|
103
|
-
| `--mqtt-username <user>` | External broker username (env: `MIRAVO_MQTT_USERNAME`) |
|
|
104
|
-
| `--mqtt-password <pass>` | External broker password (env: `MIRAVO_MQTT_PASSWORD`) |
|
|
105
|
-
| `--no-mqtt` | Disable MQTT broker |
|
|
106
|
-
| `--opcua` | Enable OPC UA server |
|
|
107
|
-
| `--opcua-port <number>` | OPC UA port (default: `4840`, env: `MIRAVO_OPCUA_PORT`) |
|
|
108
|
-
| `--opcua-host <host>` | OPC UA bind host (default: `0.0.0.0`, env: `MIRAVO_OPCUA_HOST`) |
|
|
109
|
-
| `--admin-host <host>` | Admin server host (default: `127.0.0.1`, env: `MIRAVO_ADMIN_HOST`) |
|
|
110
|
-
| `--admin-port <number>` | Admin server port (default: `8080`, env: `MIRAVO_ADMIN_PORT`) |
|
|
111
|
-
| `-d, --detach` | Start simulation in background (daemon mode) |
|
|
112
|
-
| `--dry-run` | Validate and print summary without starting |
|
|
113
|
-
| `--summary-interval <s>` | Seconds between periodic summaries (default: `5`) |
|
|
114
|
-
|
|
115
|
-
### Daemon Mode
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
# Start in background
|
|
119
|
-
miravo start -d --name my-sim
|
|
120
|
-
|
|
121
|
-
# List running simulations
|
|
122
|
-
miravo ps
|
|
123
|
-
|
|
124
|
-
# Stream live events
|
|
125
|
-
miravo logs my-sim
|
|
126
|
-
|
|
127
|
-
# Stop gracefully
|
|
128
|
-
miravo stop my-sim
|
|
129
|
-
|
|
130
|
-
# Remove stale registry entry
|
|
131
|
-
miravo rm my-sim --force
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Runtime Control
|
|
135
|
-
|
|
136
|
-
All runtime commands communicate with the running simulation via the admin HTTP server.
|
|
137
|
-
Timeouts are specified in seconds (default: 5).
|
|
54
|
+
## 3-Command Demo
|
|
138
55
|
|
|
139
56
|
```bash
|
|
140
|
-
#
|
|
141
|
-
miravo
|
|
142
|
-
|
|
143
|
-
# Remove an instance
|
|
144
|
-
miravo remove pump-001
|
|
145
|
-
|
|
146
|
-
# Pause / resume
|
|
147
|
-
miravo pause
|
|
148
|
-
miravo resume
|
|
149
|
-
|
|
150
|
-
# Change simulation speed
|
|
151
|
-
miravo speed 10
|
|
152
|
-
|
|
153
|
-
# Load additional template
|
|
154
|
-
miravo load ./extra.miravo.yaml
|
|
155
|
-
|
|
156
|
-
# Reset simulation
|
|
157
|
-
miravo reset --clear-persistence
|
|
158
|
-
|
|
159
|
-
# Inject / clear faults
|
|
160
|
-
miravo inject pump-001 cavitation
|
|
161
|
-
miravo inject pump-001 cavitation --clear
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Adapter Management
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
# Enable OPC UA at runtime
|
|
168
|
-
miravo adapter enable opcua -p 4841
|
|
169
|
-
|
|
170
|
-
# Disable MQTT
|
|
171
|
-
miravo adapter disable mqtt
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### `miravo status`
|
|
175
|
-
|
|
176
|
-
Show live status, metrics, and instances of a running simulation.
|
|
177
|
-
|
|
178
|
-
| Option | Description |
|
|
179
|
-
| ------------------- | ----------------------------------------------------------- |
|
|
180
|
-
| `--admin-url <url>` | Admin server URL (env: `MIRAVO_ADMIN_URL`) |
|
|
181
|
-
| `-w, --watch` | Poll and re-render on updates |
|
|
182
|
-
| `--instance <id>` | Show one instance instead of fleet overview |
|
|
183
|
-
| `--json` | Machine-readable JSON output |
|
|
184
|
-
| `--discover` | Discover running simulations via MQTT |
|
|
185
|
-
| `--template <path>` | Template for MQTT discovery only (env: `MIRAVO_TEMPLATE`) |
|
|
186
|
-
| `--timeout <s>` | Request timeout in seconds (default: `5`) |
|
|
187
|
-
|
|
188
|
-
### `miravo inject [instanceId] [fault]`
|
|
189
|
-
|
|
190
|
-
Trigger or clear faults on running instances.
|
|
191
|
-
|
|
192
|
-
| Option | Description |
|
|
193
|
-
| ------------------- | ----------------------------------------------------------- |
|
|
194
|
-
| `--clear` | Clear fault instead of triggering |
|
|
195
|
-
| `--json` | Machine-readable JSON output |
|
|
196
|
-
| `--admin-url <url>` | Admin server URL (env: `MIRAVO_ADMIN_URL`) |
|
|
197
|
-
| `--timeout <s>` | Request timeout in seconds (default: `5`) |
|
|
198
|
-
|
|
199
|
-
If `instanceId` and `fault` are omitted in a TTY, an interactive picker is shown.
|
|
200
|
-
|
|
201
|
-
### `miravo templates list`
|
|
202
|
-
|
|
203
|
-
List all discovered templates (built-in and local).
|
|
204
|
-
|
|
205
|
-
| Option | Description |
|
|
206
|
-
| -------------- | ---------------------------- |
|
|
207
|
-
| `--dir <path>` | Additional directory to scan |
|
|
208
|
-
|
|
209
|
-
### `miravo templates inspect <id|name|path>`
|
|
210
|
-
|
|
211
|
-
Show template details or copy it locally.
|
|
212
|
-
|
|
213
|
-
| Option | Description |
|
|
214
|
-
| ---------------------- | ---------------------------------------------------- |
|
|
215
|
-
| `--raw` | Print raw YAML |
|
|
216
|
-
| `--copy` | Copy template and referenced models to content dir |
|
|
217
|
-
| `--content-dir <path>` | Target content directory (env: `MIRAVO_CONTENT_DIR`) |
|
|
218
|
-
|
|
219
|
-
### `miravo models list`
|
|
220
|
-
|
|
221
|
-
List all discovered canonical asset models.
|
|
222
|
-
|
|
223
|
-
| Option | Description |
|
|
224
|
-
| -------------- | ---------------------------- |
|
|
225
|
-
| `--dir <path>` | Additional directory to scan |
|
|
226
|
-
|
|
227
|
-
### `miravo models inspect <name>`
|
|
228
|
-
|
|
229
|
-
Show model details — typed members, lifecycle stages, fault definitions.
|
|
230
|
-
|
|
231
|
-
| Option | Description |
|
|
232
|
-
| ------- | -------------- |
|
|
233
|
-
| `--raw` | Print raw YAML |
|
|
234
|
-
|
|
235
|
-
## Global Options
|
|
236
|
-
|
|
237
|
-
| Option | Description |
|
|
238
|
-
| ----------------------------- | ------------------------------ |
|
|
239
|
-
| `-V, --version` | Print version |
|
|
240
|
-
| `-h, --help` | Show help |
|
|
241
|
-
| `-v, --verbose` | Enable debug logging |
|
|
242
|
-
| `-q, --quiet` | Suppress output (errors only) |
|
|
243
|
-
| `--plain` | Disable ANSI styling |
|
|
244
|
-
| `--log-format <pretty\|json>` | Log format (default: `pretty`) |
|
|
245
|
-
|
|
246
|
-
## Output Control
|
|
247
|
-
|
|
248
|
-
- `NO_COLOR=1` — disables colors (same as `--plain`)
|
|
249
|
-
- `--json` — machine-readable JSON on write commands (`spawn`, `remove`, `pause`, `resume`, `speed`, `reset`, `load`, `inject`, `stop`, `rm`)
|
|
250
|
-
- All `--timeout` flags accept seconds (converted to ms internally)
|
|
251
|
-
|
|
252
|
-
## Environment Variables
|
|
253
|
-
|
|
254
|
-
| Variable | Description | Used by |
|
|
255
|
-
| --------------------- | --------------------------------- | ------------------ |
|
|
256
|
-
| `MIRAVO_NAME` | Simulation name | `start` |
|
|
257
|
-
| `MIRAVO_TEMPLATE` | Template id, name, or path | `start`, `status` |
|
|
258
|
-
| `MIRAVO_ADMIN_URL` | Admin server URL | Runtime commands |
|
|
259
|
-
| `MIRAVO_ADMIN_HOST` | Admin bind host | `start` |
|
|
260
|
-
| `MIRAVO_ADMIN_PORT` | Admin bind port | `start` |
|
|
261
|
-
| `MIRAVO_MQTT_PORT` | MQTT broker port | `start` |
|
|
262
|
-
| `MIRAVO_MQTT_HOST` | MQTT bind host | `start` |
|
|
263
|
-
| `MIRAVO_MQTT_MODE` | `embedded` or `external` | `start` |
|
|
264
|
-
| `MIRAVO_MQTT_URL` | External broker URL | `start` |
|
|
265
|
-
| `MIRAVO_OPCUA_PORT` | OPC UA server port | `start` |
|
|
266
|
-
| `MIRAVO_OPCUA_HOST` | OPC UA bind host | `start` |
|
|
267
|
-
| `MIRAVO_ADMIN_TOKEN` | Bearer token for admin auth | All admin commands |
|
|
268
|
-
| `NO_COLOR` | Disable ANSI colors when non-empty | All commands |
|
|
269
|
-
|
|
270
|
-
## Docker
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# Start with defaults
|
|
274
|
-
docker run --rm -p 1883:1883 -p 8080:8080 amineamaach/miravo:latest
|
|
275
|
-
|
|
276
|
-
# Pass options to the start command
|
|
277
|
-
docker run --rm -p 1883:1883 -p 8080:8080 amineamaach/miravo:latest start --template smart-factory --seed 42
|
|
278
|
-
|
|
279
|
-
# Use JSON logs for container environments
|
|
280
|
-
docker run --rm -p 1883:1883 -p 8080:8080 amineamaach/miravo:latest --log-format json start
|
|
281
|
-
|
|
282
|
-
# Mount custom content
|
|
283
|
-
docker run --rm -p 1883:1883 -p 8080:8080 \
|
|
284
|
-
-v ./my-content:/data/miravo \
|
|
285
|
-
amineamaach/miravo:latest start --template my-template
|
|
57
|
+
miravo start -d --name my-sim # Start in daemon mode
|
|
58
|
+
miravo inject pump-001 cavitation # Inject a fault at runtime
|
|
59
|
+
miravo ps # List running simulations
|
|
286
60
|
```
|
|
287
61
|
|
|
288
|
-
|
|
62
|
+
## Documentation
|
|
289
63
|
|
|
290
|
-
|
|
64
|
+
For the full command reference, all options, environment variables, and advanced usage, visit **[miravo.dev/docs/cli-reference](https://miravo.dev/docs/cli-reference/)**.
|
|
291
65
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
66
|
+
| Topic | Link |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| CLI Reference | [miravo.dev/docs/cli-reference](https://miravo.dev/docs/cli-reference/) |
|
|
69
|
+
| Environment Variables | [miravo.dev/docs/environment-variables](https://miravo.dev/docs/environment-variables/) |
|
|
70
|
+
| Docker | [miravo.dev/docs/docker](https://miravo.dev/docs/docker/) |
|
|
71
|
+
| Twin Models | [miravo.dev/docs/twin-models](https://miravo.dev/docs/twin-models/) |
|
|
72
|
+
| Built-in Content | [miravo.dev/docs/built-in-content](https://miravo.dev/docs/built-in-content/) |
|
|
295
73
|
|
|
296
74
|
## License
|
|
297
75
|
|