smolpy 1.8.2.dev6__tar.gz → 1.8.2.dev10__tar.gz

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.
Files changed (135) hide show
  1. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/PKG-INFO +4 -4
  2. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/README.md +3 -3
  3. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0008-rust-des-engine-mvp.md +1 -1
  4. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/dsl-reference.md +10 -3
  5. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/roadmap.md +11 -4
  6. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/src/frames.rs +26 -0
  7. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/src/scenario.rs +165 -17
  8. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/src/sim.rs +523 -52
  9. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smolpy-engine-rs/README.md +4 -2
  10. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smolpy-engine-rs/smoke_test.py +15 -4
  11. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/equivalence/scenarios.py +80 -4
  12. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/ci.yml +0 -0
  13. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/dev-build.yml +0 -0
  14. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/docs.yml +0 -0
  15. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/github-release.yml +0 -0
  16. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/publish.yml +0 -0
  17. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/release.yml +0 -0
  18. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.github/workflows/rust-wheels.yml +0 -0
  19. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/.gitignore +0 -0
  20. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/LICENSE +0 -0
  21. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/__init__.py +0 -0
  22. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/__main__.py +0 -0
  23. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-13-0921-simpy-jaws-zbook-baseline.json +0 -0
  24. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-13-1527-simpy-jaws-zbook-optimised.json +0 -0
  25. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-13-2116-simpy-jaws-zbook-research-batch.json +0 -0
  26. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-13-2119-simpy-jaws-zbook-research-b4.json +0 -0
  27. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-15-1255-rust-jaws-zbook-stop-criterion.json +0 -0
  28. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-15-1333-rust-jaws-zbook-research-b4.json +0 -0
  29. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/results/2026-11-15-1346-rust-jaws-zbook-research-batch.json +0 -0
  30. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/runner.py +0 -0
  31. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/scenarios.py +0 -0
  32. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/benchmarks/worker.py +0 -0
  33. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0001-protocol-package-structure.md +0 -0
  34. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0002-modbus-tcp-implementation.md +0 -0
  35. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0003-smol-external-dsl.md +0 -0
  36. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0004-execution-backends.md +0 -0
  37. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0005-profinet-rt.md +0 -0
  38. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0006-profiling-and-baseline-benchmark.md +0 -0
  39. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0007-execution-independent-scenario-model.md +0 -0
  40. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0009-batch-execution-and-cross-backend-validation.md +0 -0
  41. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/adr/0010-ethernet-frames-on-the-wire.md +0 -0
  42. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/benchmarks.md +0 -0
  43. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/dashboard.md +0 -0
  44. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/examples.md +0 -0
  45. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/index.md +0 -0
  46. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/language-reference.md +0 -0
  47. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/modbus.md +0 -0
  48. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/model-semantics.md +0 -0
  49. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/mqtt.md +0 -0
  50. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/profinet.md +0 -0
  51. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/scenario-model.md +0 -0
  52. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/docs/simulation-engine.md +0 -0
  53. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/README.md +0 -0
  54. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example.py +0 -0
  55. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example.smol +0 -0
  56. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_10_clients.py +0 -0
  57. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_12_clients.py +0 -0
  58. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_20_clients.py +0 -0
  59. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_file_transfer.py +0 -0
  60. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_modbus.py +0 -0
  61. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_mqtt.py +0 -0
  62. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_profinet.py +0 -0
  63. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_profinet.smol +0 -0
  64. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_staggered_transfer.py +0 -0
  65. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/examples/example_two_tier.py +0 -0
  66. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/mkdocs.yml +0 -0
  67. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/pyproject.toml +0 -0
  68. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/Cargo.lock +0 -0
  69. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/Cargo.toml +0 -0
  70. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/Cargo.toml +0 -0
  71. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/src/lib.rs +0 -0
  72. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/src/rng.rs +0 -0
  73. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smol-engine/src/timebase.rs +0 -0
  74. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smolpy-engine-rs/Cargo.toml +0 -0
  75. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smolpy-engine-rs/pyproject.toml +0 -0
  76. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/rust/smolpy-engine-rs/src/lib.rs +0 -0
  77. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/__init__.py +0 -0
  78. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/_worker.py +0 -0
  79. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/backends.py +0 -0
  80. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/batch.py +0 -0
  81. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/cli.py +0 -0
  82. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/__init__.py +0 -0
  83. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/adapter.py +0 -0
  84. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/batch.py +0 -0
  85. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/link.py +0 -0
  86. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/network.py +0 -0
  87. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/node.py +0 -0
  88. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/core/observation.py +0 -0
  89. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/ethernet/__init__.py +0 -0
  90. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/ethernet/switch.py +0 -0
  91. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/lang/__init__.py +0 -0
  92. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/lang/ast.py +0 -0
  93. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/lang/errors.py +0 -0
  94. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/lang/grammar.lark +0 -0
  95. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/lang/interpreter.py +0 -0
  96. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/lang/transformer.py +0 -0
  97. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/modbus/__init__.py +0 -0
  98. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/modbus/slave.py +0 -0
  99. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/model/__init__.py +0 -0
  100. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/model/frames.py +0 -0
  101. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/model/scenario.py +0 -0
  102. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/model/streams.py +0 -0
  103. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/model/timebase.py +0 -0
  104. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/model/validate.py +0 -0
  105. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/mqtt/__init__.py +0 -0
  106. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/mqtt/broker.py +0 -0
  107. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/profinet/__init__.py +0 -0
  108. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/profinet/device.py +0 -0
  109. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/sim/__init__.py +0 -0
  110. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/sim/engine.py +0 -0
  111. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/stats.py +0 -0
  112. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/viz/__init__.py +0 -0
  113. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/viz/dashboard.py +0 -0
  114. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/src/smolpy/viz/text_dashboard.py +0 -0
  115. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/__init__.py +0 -0
  116. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/equivalence/__init__.py +0 -0
  117. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/equivalence/harness.py +0 -0
  118. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/equivalence/test_equivalence.py +0 -0
  119. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/equivalence/test_rust_timebase.py +0 -0
  120. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_backends.py +0 -0
  121. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_batch.py +0 -0
  122. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_benchmarks.py +0 -0
  123. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_cli.py +0 -0
  124. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_dsl.py +0 -0
  125. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_engine_ir.py +0 -0
  126. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_lang.py +0 -0
  127. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_model.py +0 -0
  128. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_profinet.py +0 -0
  129. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_semantics.py +0 -0
  130. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_simulation.py +0 -0
  131. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_stats.py +0 -0
  132. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_sweep.py +0 -0
  133. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_timebase.py +0 -0
  134. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/tests/test_validate.py +0 -0
  135. {smolpy-1.8.2.dev6 → smolpy-1.8.2.dev10}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: smolpy
3
- Version: 1.8.2.dev6
3
+ Version: 1.8.2.dev10
4
4
  Summary: Network simulation DSL and discrete-event simulator
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -48,7 +48,7 @@ SMOLPy lets you describe a network topology in pure Python, define traffic flows
48
48
  > result = net.simulate(duration=60_000, backend="rust")
49
49
  > ```
50
50
  >
51
- > The Rust engine covers Ethernet and Modbus TCP for now: adapters, switches, links, flows and Modbus polling. MQTT and PROFINET follow. See [Simulation engine](#simulation-engine) and [ADR-0008](https://jwszolek.github.io/SMOLPy/adr/0008-rust-des-engine-mvp/).
51
+ > The Rust engine runs the whole model: Ethernet, Modbus TCP, MQTT and PROFINET RT. Only the live and text dashboards need SimPy. See [Simulation engine](#simulation-engine) and [ADR-0008](https://jwszolek.github.io/SMOLPy/adr/0008-rust-des-engine-mvp/).
52
52
 
53
53
  📖 **Full documentation:** [jwszolek.github.io/SMOLPy](https://jwszolek.github.io/SMOLPy/)
54
54
 
@@ -471,7 +471,7 @@ Every simulation goes through the same path. The Python API and `.smol` files bu
471
471
  | Backend | Language | What it runs | Speed | Install |
472
472
  |---|---|---|---|---|
473
473
  | `simpy` (default) | Python, SimPy | the whole model, the live and text dashboards | reference | included |
474
- | `rust` | Rust, through PyO3 | Ethernet: adapters, switches, links, flows (constant, Poisson, bursty, batch, IMIX); Modbus TCP polling; seven metrics | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
474
+ | `rust` | Rust, through PyO3 | the whole model, headless: Ethernet, Modbus TCP, MQTT and PROFINET RT, every metric | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
475
475
 
476
476
  ```python
477
477
  result = net.simulate(duration=60_000, backend="rust") # one run
@@ -483,7 +483,7 @@ smolpy run plant.smol --backend rust
483
483
  ```
484
484
 
485
485
  - **The same numbers.** On deterministic scenarios the Rust engine reproduces SimPy's results bit for bit, down to the event count. Random traffic uses each engine's own generator, so there the results agree statistically. CI checks both on every pull request ([ADR-0009](https://jwszolek.github.io/SMOLPy/adr/0009-batch-execution-and-cross-backend-validation/)).
486
- - **Nothing is skipped silently.** A scenario that uses something a backend does not support, such as PROFINET on Rust for now, is rejected before the run with a message naming the element.
486
+ - **Nothing is skipped silently.** A scenario that uses something a backend does not support is rejected before the run with a message naming the element. Asking the Rust engine for a dashboard is an error too.
487
487
 
488
488
  The model both engines implement:
489
489
 
@@ -20,7 +20,7 @@ SMOLPy lets you describe a network topology in pure Python, define traffic flows
20
20
  > result = net.simulate(duration=60_000, backend="rust")
21
21
  > ```
22
22
  >
23
- > The Rust engine covers Ethernet and Modbus TCP for now: adapters, switches, links, flows and Modbus polling. MQTT and PROFINET follow. See [Simulation engine](#simulation-engine) and [ADR-0008](https://jwszolek.github.io/SMOLPy/adr/0008-rust-des-engine-mvp/).
23
+ > The Rust engine runs the whole model: Ethernet, Modbus TCP, MQTT and PROFINET RT. Only the live and text dashboards need SimPy. See [Simulation engine](#simulation-engine) and [ADR-0008](https://jwszolek.github.io/SMOLPy/adr/0008-rust-des-engine-mvp/).
24
24
 
25
25
  📖 **Full documentation:** [jwszolek.github.io/SMOLPy](https://jwszolek.github.io/SMOLPy/)
26
26
 
@@ -443,7 +443,7 @@ Every simulation goes through the same path. The Python API and `.smol` files bu
443
443
  | Backend | Language | What it runs | Speed | Install |
444
444
  |---|---|---|---|---|
445
445
  | `simpy` (default) | Python, SimPy | the whole model, the live and text dashboards | reference | included |
446
- | `rust` | Rust, through PyO3 | Ethernet: adapters, switches, links, flows (constant, Poisson, bursty, batch, IMIX); Modbus TCP polling; seven metrics | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
446
+ | `rust` | Rust, through PyO3 | the whole model, headless: Ethernet, Modbus TCP, MQTT and PROFINET RT, every metric | about **40× faster**: B1 at 10 M frames in 4.9 s, not 200.8 s | `pip install smolpy[rust]` (since v1.8.0) |
447
447
 
448
448
  ```python
449
449
  result = net.simulate(duration=60_000, backend="rust") # one run
@@ -455,7 +455,7 @@ smolpy run plant.smol --backend rust
455
455
  ```
456
456
 
457
457
  - **The same numbers.** On deterministic scenarios the Rust engine reproduces SimPy's results bit for bit, down to the event count. Random traffic uses each engine's own generator, so there the results agree statistically. CI checks both on every pull request ([ADR-0009](https://jwszolek.github.io/SMOLPy/adr/0009-batch-execution-and-cross-backend-validation/)).
458
- - **Nothing is skipped silently.** A scenario that uses something a backend does not support, such as PROFINET on Rust for now, is rejected before the run with a message naming the element.
458
+ - **Nothing is skipped silently.** A scenario that uses something a backend does not support is rejected before the run with a message naming the element. Asking the Rust engine for a dashboard is an error too.
459
459
 
460
460
  The model both engines implement:
461
461
 
@@ -122,7 +122,7 @@ Anything outside this scope is rejected by the capability check with a message s
122
122
  - **Cross-engine equivalence** against SimPy uses the harness from ADR-0009:
123
123
  - **Deterministic scenarios** (constant patterns, fixed sizes) must agree with SimPy ~~within a tight tolerance on every metric window. Differences come only from float µs (SimPy) versus integer ns (Rust).~~ *Amended by the ADR-0007 revision of 2026-11-14:* exactly, on every metric window. Both engines use integer nanoseconds and the same rounding rules ([ADR-0007](0007-execution-independent-scenario-model.md#simulated-time-integer-nanoseconds)).
124
124
  - **Stochastic scenarios** must agree statistically across replications.
125
- - **Benchmark acceptance:** B1, B3 and B4 of the ADR-0006 suite, run with `--backend rust`, must meet the research targets defined there on the reference machine. B2 follows with protocol parity (Phase 5). *Met on 2026-11-15; see step 6.*
125
+ - **Benchmark acceptance:** B1, B3 and B4 of the ADR-0006 suite, run with `--backend rust`, must meet the research targets defined there on the reference machine. B2 follows with protocol parity (Phase 5). *Met on 2026-11-15; see step 6. B2 runs on Rust since Phase 5 (2026-11-16), bit-exact with SimPy.*
126
126
 
127
127
  ### Stop criterion
128
128
 
@@ -166,13 +166,20 @@ result.export("out.csv", format="csv") # explicit format override
166
166
  | `"simpy"` | The reference implementation. It is the default, always installed, and runs the whole model, including the live and text dashboards. |
167
167
  | `"rust"` | The native engine of [ADR-0008](adr/0008-rust-des-engine-mvp.md), from the optional package `smolpy-engine-rs` (`pip install smolpy[rust]`). It runs headless. |
168
168
 
169
- - **What a backend can run is checked before the run.** Every backend declares what it supports: node kinds, traffic kinds, patterns and metrics. A scenario that uses anything else is rejected with a `ScenarioError` naming the element, for example `poll a -> meter: the rust backend does not support poll (Modbus TCP)`.
169
+ - **What a backend can run is checked before the run.** Every backend declares what it supports: node kinds, traffic kinds, patterns and metrics. A scenario that uses anything else is rejected with a `ScenarioError` naming the element. A dashboard (`live=True` or `text=True`) on a headless backend is a `ValueError`.
170
170
  - **A missing backend is an error.** When a backend is not installed, selecting it raises `BackendUnavailable` with the install command.
171
171
  - **`smolpy.backends.installed()`** lists the backends that can run here.
172
172
 
173
- **The Rust backend so far** runs adapters, switches (`strict` and `fifo` QoS, `learning` and `topology` MAC tables), links and flows with every pattern (`constant`, `poisson`, `bursty`, `batch`) and with fixed or IMIX sizes. It also runs Modbus TCP: slaves, `polls()` and `modbus_latency`. It covers the metrics `throughput`, `latency`, `bytes_sent`, `bytes_received`, `queue_depth`, `utilization` and `modbus_latency`.
173
+ **The Rust backend** runs the whole model:
174
+ - adapters, switches (`strict` and `fifo` QoS, `learning` and `topology` MAC tables), links and flows with every pattern (`constant`, `poisson`, `bursty`, `batch`) and with fixed or IMIX sizes;
175
+ - Modbus TCP: slaves, `polls()` and `modbus_latency`;
176
+ - MQTT: brokers, `publishes()` with QoS 0 and 1, `routes()` and `broker_queue`;
177
+ - PROFINET RT: devices, `controls()` and its watchdog, `pn_latency`, `pn_jitter` and `pn_watchdog_expiries`;
178
+ - every metric.
179
+
180
+ It runs headless: the live and text dashboards need SimPy.
181
+
174
182
  - **Same results as SimPy.** Deterministic scenarios give SimPy's results bit for bit. Random traffic uses the same streams and distributions with the engine's own generator, so there the results agree statistically.
175
- - **Not in it yet.** MQTT and PROFINET come in Phase 5 of the [roadmap](roadmap.md).
176
183
  - **Install** it with `pip install smolpy[rust]`, or `pip install smolpy-engine-rs` next to an installed `smolpy`. It is released together with `smolpy`, with the same version, since v1.8.0. Wheels exist for Linux x86_64 and aarch64, macOS arm64 and x86_64, and Windows x86_64. To build it from the repository instead, with a Rust toolchain:
177
184
 
178
185
  ```bash
@@ -145,7 +145,7 @@ Decided before the Rust engine, so that it implements the final model once:
145
145
 
146
146
  - Step 7: `rust-wheels.yml` builds abi3 wheels for Linux, macOS and Windows and smoke-tests them against SimPy. `publish.yml` publishes them with each release, and a manual run publishes to TestPyPI first.
147
147
 
148
- **Phase 4 is done.** v1.8.0 published `smolpy-engine-rs`, so `pip install smolpy[rust]` installs it. Next is Phase 5, protocol parity in Rust.
148
+ **Phase 4 is done.** v1.8.0 published `smolpy-engine-rs`, so `pip install smolpy[rust]` installs it. Phase 5 then brought protocol parity.
149
149
 
150
150
  ## Phase 5: Rust protocol parity
151
151
 
@@ -153,11 +153,18 @@ Modbus TCP, MQTT and PROFINET RT in the Rust engine. These need no new architect
153
153
 
154
154
  **Exit criteria:** the Rust backend's capabilities equal SimPy's, apart from the live dashboard.
155
155
 
156
- **Status:** one of three protocols done.
157
- - **Modbus TCP: done.**
156
+ **Status: done.** The exit criterion is met: the Rust backend's capabilities equal SimPy's, apart from the live dashboard.
157
+ - **Modbus TCP.**
158
158
  - The Rust engine runs slaves, `polls()` and `modbus_latency`. It reproduces SimPy's poll generator and slave process, including requests flooded to other slaves and dropped there.
159
159
  - The new `polling` scenario is bit-exact with SimPy, down to the event count.
160
- - **MQTT and PROFINET RT** are next. PROFINET's watchdog waits on "a frame or a timeout", a SimPy condition whose event ordering the engine has to reproduce.
160
+ - **MQTT.**
161
+ - The Rust engine runs brokers, `publishes()` with QoS 0 and 1, `routes()` and `broker_queue`. It reproduces SimPy's publish generator and broker: copies keep the publisher's origin time, QoS 1 is acknowledged with a PUBACK, and a topic nobody subscribes to is only acknowledged.
162
+ - The new `messaging` scenario (two brokers, non-ASCII topics) and the existing `protocols` scenario (Modbus and MQTT) are bit-exact with SimPy, down to the event count.
163
+ - **PROFINET RT.**
164
+ - The Rust engine runs devices, `controls()`, `pn_latency`, `pn_jitter` and `pn_watchdog_expiries`.
165
+ - The watchdog waits on "a frame or a timeout", a SimPy `AnyOf` condition. The engine reproduces it event by event: the condition is an event of its own, and only an arrival processed before it counts. So the watchdog expires exactly when SimPy's does, also when a frame arrives in the same nanosecond as the timeout.
166
+ - The new `cyclic` scenario (two controllers, three ARs, a watchdog that expires in some cycles) and the existing `priorities` scenario are bit-exact with SimPy, down to the event count.
167
+ - **Benchmarks.** B2, the plant with PROFINET, Modbus and MQTT, now runs on Rust as well: all four benchmarks give SimPy's output and metric hashes and event counts at 200 k frames. B2 runs about 34× faster there.
161
168
 
162
169
  ## Phase 6: ns-3 high-fidelity backend ([ADR-0004](adr/0004-execution-backends.md), revised)
163
170
 
@@ -21,11 +21,30 @@ pub fn padded(bytes: u64) -> u64 {
21
21
  bytes.max(MIN_FRAME_BYTES)
22
22
  }
23
23
 
24
+ /// MQTT PUBACK: fixed header (2) and packet id (2).
25
+ pub const MQTT_PUBACK_BYTES: u64 = 64; // 62 B, padded to the minimum
26
+
27
+ /// MQTT PUBLISH: fixed header (2), topic length (2), the topic, a packet id
28
+ /// with a QoS above 0 (2) and the payload. `topic_len` counts characters, as
29
+ /// the reference engine's `len(topic)`.
30
+ pub fn mqtt_publish_frame_size(topic_len: u64, payload: u64, qos: u8) -> u64 {
31
+ padded(ETHERNET_IP_TCP_BYTES + 2 + 2 + topic_len + if qos > 0 { 2 } else { 0 } + payload)
32
+ }
33
+
24
34
  /// Read Holding Registers response: MBAP (6), FC (1), byte count (1), 2 B per register.
25
35
  pub fn modbus_response_frame_size(count: u16) -> u64 {
26
36
  padded(ETHERNET_IP_TCP_BYTES + 6 + 1 + 1 + 2 * count as u64)
27
37
  }
28
38
 
39
+ /// The 802.1Q priority (PCP) of PROFINET RT cyclic frames.
40
+ pub const PN_RT_PRIORITY: u8 = 6;
41
+
42
+ /// PROFINET RT: Ethernet (14), 802.1Q (4), FrameID (2), IO data, APDU
43
+ /// status (4) and FCS (4), padded to the minimum.
44
+ pub fn pn_frame_size(io_bytes: u64) -> u64 {
45
+ padded(14 + VLAN_TAG_BYTES + 2 + io_bytes + 4 + 4)
46
+ }
47
+
29
48
  /// A flow frame of `size` bytes (untagged, FCS included), with the tag a
30
49
  /// priority above 0 needs.
31
50
  pub fn flow_frame_size(size: u64, priority: u8) -> u64 {
@@ -45,5 +64,12 @@ mod tests {
45
64
  assert_eq!(MODBUS_REQUEST_BYTES, 69);
46
65
  assert_eq!(modbus_response_frame_size(10), 86);
47
66
  assert_eq!(modbus_response_frame_size(1), 68);
67
+ assert_eq!(pn_frame_size(20), 64);
68
+ assert_eq!(pn_frame_size(40), 68);
69
+ assert_eq!(pn_frame_size(1400), 1428);
70
+ assert_eq!(MQTT_PUBACK_BYTES, padded(ETHERNET_IP_TCP_BYTES + 4));
71
+ assert_eq!(mqtt_publish_frame_size(7, 20, 0), 58 + 2 + 2 + 7 + 20);
72
+ assert_eq!(mqtt_publish_frame_size(7, 20, 1), 58 + 2 + 2 + 7 + 2 + 20);
73
+ assert_eq!(mqtt_publish_frame_size(1, 0, 0), 64);
48
74
  }
49
75
  }
@@ -16,6 +16,8 @@ pub const VERSION: u64 = 2;
16
16
  pub enum NodeKind {
17
17
  Adapter { mac: String },
18
18
  ModbusSlave { mac: String, unit: u8 },
19
+ MqttBroker { mac: String },
20
+ ProfinetDevice { mac: String },
19
21
  Switch { fifo: bool, topology: bool },
20
22
  }
21
23
 
@@ -69,6 +71,40 @@ pub struct Poll {
69
71
  pub delay_ms: Q,
70
72
  }
71
73
 
74
+ /// MQTT PUBLISH messages to a broker at `rate` messages per second.
75
+ #[derive(Debug, Clone)]
76
+ pub struct Publish {
77
+ pub source: String,
78
+ pub broker: String,
79
+ pub topic: String,
80
+ pub rate: Q,
81
+ pub payload: u64,
82
+ pub qos: u8,
83
+ pub delay_ms: Q,
84
+ }
85
+
86
+ /// A broker's fan-out of one topic to its subscribers.
87
+ #[derive(Debug, Clone)]
88
+ pub struct Route {
89
+ pub broker: String,
90
+ pub topic: String,
91
+ pub subscribers: Vec<String>,
92
+ }
93
+
94
+ /// A PROFINET RT application relationship: cyclic frames both ways, with
95
+ /// `inputs` bytes from the device and `outputs` bytes to it; the watchdog is
96
+ /// `hold` cycles.
97
+ #[derive(Debug, Clone)]
98
+ pub struct ProfinetAr {
99
+ pub controller: String,
100
+ pub device: String,
101
+ pub cycle_ms: Q,
102
+ pub inputs: u64,
103
+ pub outputs: u64,
104
+ pub hold: u64,
105
+ pub delay_ms: Q,
106
+ }
107
+
72
108
  #[derive(Debug, Clone, Copy, PartialEq, Eq)]
73
109
  pub enum Metric {
74
110
  Throughput,
@@ -78,10 +114,14 @@ pub enum Metric {
78
114
  QueueDepth,
79
115
  Utilization,
80
116
  ModbusLatency,
117
+ BrokerQueue,
118
+ PnLatency,
119
+ PnJitter,
120
+ PnWatchdogExpiries,
81
121
  }
82
122
 
83
123
  impl Metric {
84
- pub const ALL: [(&'static str, Metric); 7] = [
124
+ pub const ALL: [(&'static str, Metric); 11] = [
85
125
  ("throughput", Metric::Throughput),
86
126
  ("latency", Metric::Latency),
87
127
  ("bytes_sent", Metric::BytesSent),
@@ -89,6 +129,10 @@ impl Metric {
89
129
  ("queue_depth", Metric::QueueDepth),
90
130
  ("utilization", Metric::Utilization),
91
131
  ("modbus_latency", Metric::ModbusLatency),
132
+ ("broker_queue", Metric::BrokerQueue),
133
+ ("pn_latency", Metric::PnLatency),
134
+ ("pn_jitter", Metric::PnJitter),
135
+ ("pn_watchdog_expiries", Metric::PnWatchdogExpiries),
92
136
  ];
93
137
 
94
138
  pub fn name(self) -> &'static str {
@@ -110,6 +154,9 @@ pub struct Scenario {
110
154
  pub links: Vec<Link>,
111
155
  pub flows: Vec<Flow>,
112
156
  pub polls: Vec<Poll>,
157
+ pub publishes: Vec<Publish>,
158
+ pub routes: Vec<Route>,
159
+ pub ars: Vec<ProfinetAr>,
113
160
  pub observations: Vec<Observation>,
114
161
  pub duration_ms: Q,
115
162
  pub seed: u64,
@@ -126,8 +173,14 @@ pub struct Capabilities {
126
173
  }
127
174
 
128
175
  pub const CAPABILITIES: Capabilities = Capabilities {
129
- nodes: &["adapter", "switch", "modbus_slave"],
130
- traffic: &["flow", "poll"],
176
+ nodes: &[
177
+ "adapter",
178
+ "switch",
179
+ "modbus_slave",
180
+ "mqtt_broker",
181
+ "profinet_device",
182
+ ],
183
+ traffic: &["flow", "poll", "publish", "route", "profinet_ar"],
131
184
  patterns: &["constant", "poisson", "bursty", "batch"],
132
185
  metrics: &[
133
186
  "throughput",
@@ -137,15 +190,13 @@ pub const CAPABILITIES: Capabilities = Capabilities {
137
190
  "queue_depth",
138
191
  "utilization",
139
192
  "modbus_latency",
193
+ "broker_queue",
194
+ "pn_latency",
195
+ "pn_jitter",
196
+ "pn_watchdog_expiries",
140
197
  ],
141
198
  features: &["imix"],
142
- notes: &[
143
- ("mqtt_broker", "planned for Phase 5"),
144
- ("profinet_device", "planned for Phase 5"),
145
- ("publish", "planned for Phase 5"),
146
- ("route", "planned for Phase 5"),
147
- ("profinet_ar", "planned for Phase 5"),
148
- ],
199
+ notes: &[],
149
200
  };
150
201
 
151
202
  type Res<T> = Result<T, String>;
@@ -269,7 +320,8 @@ pub fn parse(text: &str) -> Res<Scenario> {
269
320
  f.done()?;
270
321
  links.push(link);
271
322
  }
272
- let (mut flows, mut polls) = (Vec::new(), Vec::new());
323
+ let (mut flows, mut polls, mut publishes, mut routes, mut ars) =
324
+ (Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new());
273
325
  for (i, v) in array(top.take_or("traffic"), "traffic")?
274
326
  .into_iter()
275
327
  .enumerate()
@@ -277,6 +329,9 @@ pub fn parse(text: &str) -> Res<Scenario> {
277
329
  match parse_traffic(v, i)? {
278
330
  Traffic::Flow(flow) => flows.push(flow),
279
331
  Traffic::Poll(poll) => polls.push(poll),
332
+ Traffic::Publish(publish) => publishes.push(publish),
333
+ Traffic::Route(route) => routes.push(route),
334
+ Traffic::ProfinetAr(ar) => ars.push(ar),
280
335
  }
281
336
  }
282
337
  let mut observations = Vec::new();
@@ -322,6 +377,9 @@ pub fn parse(text: &str) -> Res<Scenario> {
322
377
  links,
323
378
  flows,
324
379
  polls,
380
+ publishes,
381
+ routes,
382
+ ars,
325
383
  observations,
326
384
  duration_ms,
327
385
  seed,
@@ -383,8 +441,17 @@ fn parse_node(value: Value, i: usize) -> Res<Node> {
383
441
  u8::try_from(unit).map_err(|_| format!("modbus_slave {name}: unit_id {unit}"))?;
384
442
  NodeKind::ModbusSlave { mac, unit }
385
443
  }
386
- "mqtt_broker" | "profinet_device" => {
387
- return Err(unsupported(&format!("{kind} nodes (Phase 5)")))
444
+ "mqtt_broker" => {
445
+ f.string("ip")?;
446
+ NodeKind::MqttBroker {
447
+ mac: f.string("mac")?,
448
+ }
449
+ }
450
+ "profinet_device" => {
451
+ f.string("ip")?;
452
+ NodeKind::ProfinetDevice {
453
+ mac: f.string("mac")?,
454
+ }
388
455
  }
389
456
  other => return Err(format!("unknown node kind {other:?}")),
390
457
  };
@@ -395,6 +462,9 @@ fn parse_node(value: Value, i: usize) -> Res<Node> {
395
462
  enum Traffic {
396
463
  Flow(Flow),
397
464
  Poll(Poll),
465
+ Publish(Publish),
466
+ Route(Route),
467
+ ProfinetAr(ProfinetAr),
398
468
  }
399
469
 
400
470
  fn parse_traffic(value: Value, i: usize) -> Res<Traffic> {
@@ -423,8 +493,78 @@ fn parse_traffic(value: Value, i: usize) -> Res<Traffic> {
423
493
  delay_ms,
424
494
  }))
425
495
  }
426
- "publish" | "route" | "profinet_ar" => {
427
- Err(unsupported(&format!("{kind} traffic (Phase 5)")))
496
+ "publish" => {
497
+ let source = f.string("source")?;
498
+ let broker = f.string("broker")?;
499
+ f.what = format!("publish {source} -> {broker}");
500
+ let topic = f.string("topic")?;
501
+ let rate = f.number("rate")?;
502
+ let payload = f.integer("payload")?;
503
+ let qos = f.integer("qos")?;
504
+ let qos = u8::try_from(qos)
505
+ .ok()
506
+ .filter(|q| *q <= 1)
507
+ .ok_or(format!("publish: qos {qos}"))?;
508
+ let delay_ms = match f.take_or("delay_ms") {
509
+ None => Q::int(0),
510
+ Some(v) => number(&v, "publish: delay_ms")?,
511
+ };
512
+ f.done()?;
513
+ Ok(Traffic::Publish(Publish {
514
+ source,
515
+ broker,
516
+ topic,
517
+ rate,
518
+ payload,
519
+ qos,
520
+ delay_ms,
521
+ }))
522
+ }
523
+ "route" => {
524
+ let broker = f.string("broker")?;
525
+ let topic = f.string("topic")?;
526
+ f.what = format!("route {broker} topic {topic:?}");
527
+ let subscribers = match f.take("subscribers")? {
528
+ Value::Array(items) => items
529
+ .into_iter()
530
+ .map(|v| match v {
531
+ Value::String(s) => Ok(s),
532
+ other => Err(format!("route: subscriber must be a name, got {other}")),
533
+ })
534
+ .collect::<Res<Vec<String>>>()?,
535
+ other => return Err(format!("route: subscribers must be a list, got {other}")),
536
+ };
537
+ f.done()?;
538
+ Ok(Traffic::Route(Route {
539
+ broker,
540
+ topic,
541
+ subscribers,
542
+ }))
543
+ }
544
+ "profinet_ar" => {
545
+ let controller = f.string("controller")?;
546
+ let device = f.string("device")?;
547
+ f.what = format!("PROFINET AR {controller} -> {device}");
548
+ let ar = ProfinetAr {
549
+ controller,
550
+ device,
551
+ cycle_ms: f.number("cycle_ms")?,
552
+ inputs: f.integer("inputs")?,
553
+ outputs: f.integer("outputs")?,
554
+ hold: match f.take_or("hold") {
555
+ None => 3,
556
+ Some(v) => v
557
+ .as_u64()
558
+ .filter(|h| *h >= 1)
559
+ .ok_or(format!("PROFINET AR: invalid hold {v}"))?,
560
+ },
561
+ delay_ms: match f.take_or("delay_ms") {
562
+ None => Q::int(0),
563
+ Some(v) => number(&v, "PROFINET AR: delay_ms")?,
564
+ },
565
+ };
566
+ f.done()?;
567
+ Ok(Traffic::ProfinetAr(ar))
428
568
  }
429
569
  other => Err(format!("unknown traffic kind {other:?}")),
430
570
  }
@@ -530,8 +670,16 @@ mod tests {
530
670
  assert!(parse(&B1.replace("\"constant\"", "\"batch\""))
531
671
  .unwrap_err()
532
672
  .contains("needs a batch size"));
533
- assert!(parse(&B1.replace("\"throughput\"", "\"pn_jitter\""))
673
+ let mqtt = parse(&B1.replace(
674
+ "\"traffic\": [",
675
+ "\"traffic\": [{\"kind\": \"publish\", \"source\": \"tx\", \"broker\": \"rx\", \"topic\": \"hala/temp\\u00b0C\", \"rate\": 10, \"payload\": 20, \"qos\": 1, \"delay_ms\": 0.0}, {\"kind\": \"route\", \"broker\": \"rx\", \"topic\": \"t\", \"subscribers\": [\"tx\"]}, ",
676
+ ))
677
+ .unwrap();
678
+ assert_eq!(mqtt.publishes[0].topic, "hala/temp°C");
679
+ assert_eq!(mqtt.publishes[0].qos, 1);
680
+ assert_eq!(mqtt.routes[0].subscribers, ["tx"]);
681
+ assert!(parse(&B1.replace("\"throughput\"", "\"frame_loss\""))
534
682
  .unwrap_err()
535
- .contains("metric \"pn_jitter\""));
683
+ .contains("metric \"frame_loss\""));
536
684
  }
537
685
  }