smolpy 1.10.3.dev2__tar.gz → 1.10.3.dev4__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.
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/PKG-INFO +1 -1
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/model-semantics.md +33 -6
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/backends.py +1 -1
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/network.py +4 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/observation.py +5 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/model/validate.py +6 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/sim/engine.py +99 -5
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/viz/dashboard.py +5 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/viz/text_dashboard.py +5 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/equivalence/scenarios.py +91 -0
- smolpy-1.10.3.dev4/tests/test_buffers.py +547 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_ns3.py +4 -1
- smolpy-1.10.3.dev2/tests/test_buffers.py +0 -196
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/ci.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/dev-build.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/docker-image.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/docs.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/github-release.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/ns3-base.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/publish.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/release.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.github/workflows/rust-wheels.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/.gitignore +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/LICENSE +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/README.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/__main__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/load.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-13-0921-simpy-jaws-zbook-baseline.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-13-1527-simpy-jaws-zbook-optimised.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-13-2116-simpy-jaws-zbook-research-batch.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-13-2119-simpy-jaws-zbook-research-b4.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-15-1255-rust-jaws-zbook-stop-criterion.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-15-1333-rust-jaws-zbook-research-b4.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-15-1346-rust-jaws-zbook-research-batch.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/results/2026-11-16-1839-simpy-ns3-jaws-zbook-tcp-under-load.json +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/runner.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/scenarios.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/benchmarks/worker.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/Dockerfile +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/Dockerfile.dockerignore +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/Dockerfile.ns3 +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/Dockerfile.ns3.dockerignore +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/ns3-base/Dockerfile +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/ns3-base/smoke.cc +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docker/smoke.smol +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0001-protocol-package-structure.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0002-modbus-tcp-implementation.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0003-smol-external-dsl.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0004-execution-backends.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0005-profinet-rt.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0006-profiling-and-baseline-benchmark.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0007-execution-independent-scenario-model.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0008-rust-des-engine-mvp.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0009-batch-execution-and-cross-backend-validation.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0010-ethernet-frames-on-the-wire.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/adr/0011-bounded-switch-buffers.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/backends.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/benchmarks.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/dashboard.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/dsl-reference.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/examples.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/index.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/language-reference.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/modbus.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/mqtt.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/profinet.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/roadmap.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/scenario-model.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/docs/simulation-engine.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/README.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example.smol +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_10_clients.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_12_clients.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_20_clients.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_file_transfer.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_modbus.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_mqtt.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_profinet.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_profinet.smol +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_staggered_transfer.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/examples/example_two_tier.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/mkdocs.yml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/pyproject.toml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/Cargo.lock +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/Cargo.toml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/Cargo.toml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/src/frames.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/src/lib.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/src/rng.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/src/scenario.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/src/sim.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smol-engine/src/timebase.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smolpy-engine-rs/Cargo.toml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smolpy-engine-rs/README.md +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smolpy-engine-rs/pyproject.toml +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smolpy-engine-rs/smoke_test.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/rust/smolpy-engine-rs/src/lib.rs +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/_worker.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/batch.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/cli.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/adapter.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/batch.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/link.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/core/node.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/ethernet/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/ethernet/switch.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/lang/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/lang/ast.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/lang/errors.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/lang/grammar.lark +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/lang/interpreter.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/lang/transformer.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/modbus/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/modbus/slave.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/model/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/model/frames.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/model/scenario.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/model/streams.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/model/timebase.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/mqtt/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/mqtt/broker.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/ns3/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/ns3/cpp/smol-ns3.cc +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/profinet/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/profinet/device.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/sim/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/stats.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/src/smolpy/viz/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/equivalence/__init__.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/equivalence/harness.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/equivalence/test_equivalence.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/equivalence/test_rust_timebase.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_backends.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_batch.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_benchmarks.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_cli.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_dsl.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_engine_ir.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_lang.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_model.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_profinet.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_semantics.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_simulation.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_stats.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_sweep.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_timebase.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/tests/test_validate.py +0 -0
- {smolpy-1.10.3.dev2 → smolpy-1.10.3.dev4}/uv.lock +0 -0
|
@@ -71,7 +71,7 @@ On the wire it is preceded by a preamble and SFD and followed by an inter-frame
|
|
|
71
71
|
|
|
72
72
|
- **A link is full duplex.** Each direction is an independent channel with its own egress queue and transmitter at the sending node. Half-duplex links are valid in the model but not supported by the SimPy backend, which rejects them.
|
|
73
73
|
- **Transmitter:**
|
|
74
|
-
- it takes the next frame from its queue;
|
|
74
|
+
- it takes the next frame from its queue: at once when it has sent the previous frame's FCS, or, when it is idle, at the instant a frame is queued, after the events already scheduled for that instant ([§9](#9-simultaneous-events));
|
|
75
75
|
- it sends the preamble and SFD (8 B) and the frame: `tx = tx(8 + size)`;
|
|
76
76
|
- it then keeps the wire idle for the inter-frame gap (12 B): `gap = tx(12)`. The next frame starts no earlier than the end of the gap.
|
|
77
77
|
- Both are rounded as in [§1](#1-time-and-units). A link therefore carries at most `speed / ((size + 20) × 8)` frames per second, as real Ethernet does: 148 809 frames of 64 B per second at 100 Mb/s.
|
|
@@ -82,9 +82,18 @@ On the wire it is preceded by a preamble and SFD and followed by an inter-frame
|
|
|
82
82
|
- frames within a class are served first in, first out;
|
|
83
83
|
- service is non-preemptive: a frame in transmission is never interrupted.
|
|
84
84
|
- **`qos="fifo"`** on a switch puts every frame into one class on that switch's egress queues. All other nodes, including end stations, use the 8 classes.
|
|
85
|
-
- **Queues are unbounded
|
|
85
|
+
- **Queues are unbounded unless a switch sets `buffer`** ([ADR-0011](adr/0011-bounded-switch-buffers.md)). Without it no frame is ever dropped for lack of buffer.
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
**Bounded egress queues.** A switch with `buffer` (bytes) bounds each of its egress queues:
|
|
88
|
+
- **What occupies the buffer:** the frame bytes ([§2](#2-frames)) of the frames queued on the port and not yet taken by its transmitter, which are the frames `queue_depth` counts. The frame in transmission does not occupy the buffer.
|
|
89
|
+
- **Tail drop.** A frame of `s` bytes that arrives with `q` bytes queued is queued if `q + s ≤ buffer`, and dropped otherwise. A dropped frame is never queued, displaces nothing and schedules nothing.
|
|
90
|
+
- **One limit per port,** shared by the 8 priority classes. A frame is dropped whatever its priority, under `qos="fifo"` as under `"strict"`.
|
|
91
|
+
- **Flooded copies** are admitted or dropped each on its own port.
|
|
92
|
+
- **The delay is bounded.** A frame admitted with `n` frames of `q` bytes ahead of it starts its preamble at most `tx(q + 20·n) + tx(8 + m) + tx(12)` after it is queued, where `m` is the largest frame of the scenario.
|
|
93
|
+
- **End stations are unbounded.** Adapters, brokers, Modbus slaves and PROFINET devices never drop a frame.
|
|
94
|
+
- **Validation.** `buffer` is a whole number of bytes, at least 1 522 B (one maximum frame with a tag) and at least the largest frame of the scenario.
|
|
95
|
+
|
|
96
|
+
*Tests: `test_single_hop_latency_is_tx_plus_prop_per_link`, `test_propagation_does_not_hold_the_link`, `test_priority_frames_carry_a_tag`, `test_saturated_link_reaches_nominal_capacity` in `test_simulation.py`, existing priority tests in `test_profinet.py`; bounded queues in `test_buffers.py`: `test_a_frame_is_dropped_exactly_when_it_would_exceed_the_buffer`, `test_the_queue_never_holds_more_than_its_buffer`, `test_queueing_delay_is_bounded_by_the_buffer`, `test_a_buffer_that_is_never_full_changes_nothing`, `test_one_port_is_an_md1k_queue`.*
|
|
88
97
|
|
|
89
98
|
## 4. Switches
|
|
90
99
|
|
|
@@ -122,7 +131,16 @@ On the wire it is preceded by a preamble and SFD and followed by an inter-frame
|
|
|
122
131
|
| Modbus slave | for a request with its `unit_id`: one response to the requester |
|
|
123
132
|
| PROFINET device | passes cyclic frames of its ARs to its PROFINET consumer |
|
|
124
133
|
|
|
125
|
-
An end station sends everything over its single link, in the egress queue order of [§3](#3-links-and-egress-queues).
|
|
134
|
+
An end station sends everything over its single link, in the egress queue order of [§3](#3-links-and-egress-queues). Its egress queue is unbounded.
|
|
135
|
+
|
|
136
|
+
**When a frame is lost** at a bounded switch, nothing is retransmitted: the model has no transport layer ([ADR-0011](adr/0011-bounded-switch-buffers.md)).
|
|
137
|
+
- **Modbus:** a lost request or response leaves its poll without a response. The master does not retry, and its next polls go out on schedule.
|
|
138
|
+
- **MQTT:** a lost PUBLISH is neither forwarded nor acknowledged. A lost copy is lost to its subscriber. A lost PUBACK changes nothing.
|
|
139
|
+
- **PROFINET RT:** a lost cyclic frame leaves a gap, and the watchdog expires if it exceeds `hold × cycle` ([§7](#7-profinet-consumer)).
|
|
140
|
+
|
|
141
|
+
The ns-3 backend runs Modbus and MQTT over ns-3's TCP, which retransmits lost segments ([Execution backends](backends.md)).
|
|
142
|
+
|
|
143
|
+
*Tests: `test_a_lost_poll_stays_unanswered`, `test_a_lost_profinet_frame_expires_the_watchdog` in `test_buffers.py`.*
|
|
126
144
|
|
|
127
145
|
## 6. Traffic sources
|
|
128
146
|
|
|
@@ -177,6 +195,11 @@ An end station sends everything over its single link, in the egress queue order
|
|
|
177
195
|
| `pn_latency` | mean PROFINET latency over cyclic frames received in the window. *Window metric.* | µs |
|
|
178
196
|
| `pn_jitter` | maximum jitter over the window. *Window metric.* | µs |
|
|
179
197
|
| `pn_watchdog_expiries` | total expiries so far, over all ARs of the node | count |
|
|
198
|
+
| `drops` | frames the switch's egress buffers dropped in the window. Sampled every time, 0 included. | frames |
|
|
199
|
+
| `drops_total` | frames the switch's egress buffers dropped so far | frames |
|
|
200
|
+
| `frames_sent` | frames whose transmission on the adapter's link has completed so far | frames |
|
|
201
|
+
| `frames_received` | frames the adapter accepted so far | frames |
|
|
202
|
+
| `modbus_unanswered` | Modbus requests the adapter's polls have generated so far, less the responses it has accepted so far: lost polls plus polls in flight | polls |
|
|
180
203
|
|
|
181
204
|
A metric's result key is `"<metric>:<node>"`. Its samples are `(time_ms, value)` pairs in time order.
|
|
182
205
|
|
|
@@ -189,9 +212,10 @@ A metric's result key is `"<metric>:<node>"`. Its samples are `(time_ms, value)`
|
|
|
189
212
|
- **`utilization`:** `wire_bits × 10⁵ / (Σ speed × W)` %, where `speed` is in Mb/s.
|
|
190
213
|
|
|
191
214
|
**Frame bytes, not wire bytes.** The byte metrics count frames, header to FCS, without the preamble, SFD and gap, as switch and NIC counters do. So a saturated 100 Mb/s link carrying 64 B frames shows 76.2 Mb/s of `throughput` and 100 % `utilization`.
|
|
192
|
-
- **Counts** (`queue_depth`, `broker_queue`, `pn_watchdog_expiries`) as they are.
|
|
215
|
+
- **Counts** (`queue_depth`, `broker_queue`, `pn_watchdog_expiries`, `drops`, `drops_total`, `frames_sent`, `frames_received`, `modbus_unanswered`) as they are.
|
|
216
|
+
- **Loss of a flow** `a → b`, when `a` sends nothing else: `frames_sent:a − frames_received:b` is the frames dropped plus the frames in flight, which are at most the buffers on the path and a frame per link.
|
|
193
217
|
|
|
194
|
-
*Tests: `test_metric_definitions`, `test_window_metrics_skip_empty_windows`, `test_modbus_latency_is_round_trip`, `test_mqtt_latency_is_end_to_end`, `test_watchdog_expiries_are_cumulative`.*
|
|
218
|
+
*Tests: `test_metric_definitions`, `test_window_metrics_skip_empty_windows`, `test_modbus_latency_is_round_trip`, `test_mqtt_latency_is_end_to_end`, `test_watchdog_expiries_are_cumulative`; `test_loss_is_frames_sent_less_frames_received` in `test_buffers.py`.*
|
|
195
219
|
|
|
196
220
|
## 9. Simultaneous events
|
|
197
221
|
|
|
@@ -201,6 +225,8 @@ A metric's result key is `"<metric>:<node>"`. Its samples are `(time_ms, value)`
|
|
|
201
225
|
- **Frames queued at the same instant on one egress queue** are served by priority, then in the order they were queued:
|
|
202
226
|
- a batch group in draw order;
|
|
203
227
|
- broker copies in subscriber order, then the PUBACK.
|
|
228
|
+
- This holds on an idle port too: its transmitter takes a frame after the events already scheduled for the instant, so it takes the highest-priority frame queued by then.
|
|
229
|
+
- **Admissions to a bounded queue** at the same instant are decided in the order the frames are queued, each against the bytes queued at that moment ([§3](#3-links-and-egress-queues)). A frame the transmitter has taken no longer counts.
|
|
204
230
|
|
|
205
231
|
**Start-up order** decides the scheduling order of the first events:
|
|
206
232
|
- link transmitters are started first, in link order, a then b direction;
|
|
@@ -222,3 +248,4 @@ Every disagreement between this page and the intended model is listed here, with
|
|
|
222
248
|
| 4 | Wire overhead was not counted | Preamble, SFD and inter-frame gap were not on the wire, protocol sizes left the FCS out, frames could be shorter than 64 B, and flows with a priority had no tag. A link carried 31 % more 64 B frames than real Ethernet. | resolved in ADR-0010: frames on the wire as real Ethernet |
|
|
223
249
|
| 5 | One random stream for all sources | Adding or reordering one source changed the draws of all others. | resolved in ADR-0007 step 5: one stream per traffic statement |
|
|
224
250
|
| 6 | SimPy did not use integer nanoseconds | Time was float µs. Periodic sources added the interval to the clock, and metrics were float sums. | resolved in ADR-0007 step 7: SimPy runs on integer nanoseconds |
|
|
251
|
+
| 7 | Queues were unbounded | No frame was ever dropped, so at and above saturation delay grew without limit, where a real switch caps it and drops frames. A testbed measured a capped RTT and 0.09 % loss at ρ = 0.996, where the model predicted a p99 of 79 ms. | resolved in ADR-0011: a switch's `buffer` bounds its egress queues, with tail drop |
|
|
@@ -88,6 +88,12 @@ METRIC_TARGETS: dict[str, tuple[type, ...] | None] = {
|
|
|
88
88
|
"pn_jitter": (AdapterNode, ProfinetDeviceNode),
|
|
89
89
|
"pn_watchdog_expiries": (AdapterNode, ProfinetDeviceNode),
|
|
90
90
|
"utilization": None,
|
|
91
|
+
# ADR-0011: loss
|
|
92
|
+
"drops": (SwitchNode,),
|
|
93
|
+
"drops_total": (SwitchNode,),
|
|
94
|
+
"frames_sent": (AdapterNode,),
|
|
95
|
+
"frames_received": (AdapterNode,),
|
|
96
|
+
"modbus_unanswered": (AdapterNode,),
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
SWITCH_MODES = ("store-and-forward", "cut-through")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
|
+
import heapq
|
|
4
5
|
import itertools
|
|
5
6
|
import random
|
|
6
7
|
import time
|
|
@@ -106,6 +107,8 @@ class _AdapterCounters:
|
|
|
106
107
|
def __init__(self) -> None:
|
|
107
108
|
self.bytes_received: int = 0
|
|
108
109
|
self.frames_received: int = 0
|
|
110
|
+
self.modbus_requests: int = 0 # generated by this adapter's polls
|
|
111
|
+
self.modbus_responses: int = 0 # accepted
|
|
109
112
|
self.latency_sinks: Sinks = []
|
|
110
113
|
self.modbus_rtt_sinks: Sinks = []
|
|
111
114
|
|
|
@@ -114,8 +117,10 @@ class _AdapterCounters:
|
|
|
114
117
|
self.frames_received += 1
|
|
115
118
|
if self.latency_sinks:
|
|
116
119
|
_emit(self.latency_sinks, now - frame.created_at_ns)
|
|
117
|
-
if frame.modbus_is_response
|
|
118
|
-
|
|
120
|
+
if frame.modbus_is_response:
|
|
121
|
+
self.modbus_responses += 1
|
|
122
|
+
if self.modbus_rtt_sinks:
|
|
123
|
+
_emit(self.modbus_rtt_sinks, now - frame.created_at_ns)
|
|
119
124
|
|
|
120
125
|
|
|
121
126
|
# ---------------------------------------------------------------------------
|
|
@@ -123,12 +128,35 @@ class _AdapterCounters:
|
|
|
123
128
|
# ---------------------------------------------------------------------------
|
|
124
129
|
|
|
125
130
|
|
|
131
|
+
class _BoundedQueue(simpy.PriorityStore):
|
|
132
|
+
"""An egress queue that counts the frame bytes it holds (ADR-0011).
|
|
133
|
+
|
|
134
|
+
A frame leaves the buffer when the transmitter takes it, which is when
|
|
135
|
+
SimPy pops it from the store: at once when the transmitter asks for the
|
|
136
|
+
next frame, or, if it was idle, when the Put of a queued frame is
|
|
137
|
+
processed. The frame in transmission is therefore not counted."""
|
|
138
|
+
|
|
139
|
+
def __init__(self, env: _Environment) -> None:
|
|
140
|
+
super().__init__(env)
|
|
141
|
+
self.queued_bytes = 0
|
|
142
|
+
|
|
143
|
+
def _do_get(self, event: simpy.resources.store.StoreGet) -> None:
|
|
144
|
+
if self.items:
|
|
145
|
+
item = heapq.heappop(self.items)
|
|
146
|
+
self.queued_bytes -= item.item.size_bytes
|
|
147
|
+
event.succeed(item)
|
|
148
|
+
|
|
149
|
+
|
|
126
150
|
class _LinkChannel:
|
|
127
151
|
"""Simulates one direction of a cable: enqueue → tx delay → prop delay → deliver.
|
|
128
152
|
|
|
129
153
|
The egress queue serves 802.1Q priority classes strictly (higher first,
|
|
130
154
|
FIFO within a class, non-preemptive). With strict_priority=False every
|
|
131
155
|
frame is treated as priority 0, i.e. plain FIFO.
|
|
156
|
+
|
|
157
|
+
With *buffer_bytes* the queue is bounded: a frame that would take the
|
|
158
|
+
frame bytes waiting beyond it is dropped on arrival, whatever its
|
|
159
|
+
priority (tail drop, ADR-0011).
|
|
132
160
|
"""
|
|
133
161
|
|
|
134
162
|
def __init__(
|
|
@@ -139,6 +167,7 @@ class _LinkChannel:
|
|
|
139
167
|
in_port: int,
|
|
140
168
|
dst_store: simpy.Store,
|
|
141
169
|
strict_priority: bool = True,
|
|
170
|
+
buffer_bytes: int | None = None,
|
|
142
171
|
) -> None:
|
|
143
172
|
self.env = env
|
|
144
173
|
self.speed_mbps = speed_mbps
|
|
@@ -149,7 +178,13 @@ class _LinkChannel:
|
|
|
149
178
|
self.in_port = in_port
|
|
150
179
|
self.dst_store = dst_store
|
|
151
180
|
self.strict_priority = strict_priority
|
|
152
|
-
self.
|
|
181
|
+
self.buffer_bytes = buffer_bytes
|
|
182
|
+
self.frames_dropped: int = 0
|
|
183
|
+
# Only a bounded queue counts its bytes: unbounded ones, every end
|
|
184
|
+
# station's among them, run exactly as before.
|
|
185
|
+
self.queue: simpy.PriorityStore = (
|
|
186
|
+
simpy.PriorityStore(env) if buffer_bytes is None else _BoundedQueue(env)
|
|
187
|
+
)
|
|
153
188
|
# PriorityItem compares on the key only, so the sequence number is what
|
|
154
189
|
# keeps equal-priority frames in FIFO order.
|
|
155
190
|
self._seq = itertools.count()
|
|
@@ -158,6 +193,12 @@ class _LinkChannel:
|
|
|
158
193
|
env.process(self._run())
|
|
159
194
|
|
|
160
195
|
def enqueue(self, frame: _Frame) -> None:
|
|
196
|
+
if self.buffer_bytes is not None:
|
|
197
|
+
queue: _BoundedQueue = self.queue # type: ignore[assignment]
|
|
198
|
+
if queue.queued_bytes + frame.size_bytes > self.buffer_bytes:
|
|
199
|
+
self.frames_dropped += 1 # tail drop: nothing is queued or scheduled
|
|
200
|
+
return
|
|
201
|
+
queue.queued_bytes += frame.size_bytes
|
|
161
202
|
cls = -frame.priority if self.strict_priority else 0
|
|
162
203
|
self.queue.put(simpy.PriorityItem((cls, next(self._seq)), frame))
|
|
163
204
|
|
|
@@ -334,6 +375,7 @@ def _modbus_poll_gen(
|
|
|
334
375
|
frame_size: int,
|
|
335
376
|
rate_hz: float,
|
|
336
377
|
channel: _LinkChannel,
|
|
378
|
+
counters: _AdapterCounters,
|
|
337
379
|
delay_ns: int = 0,
|
|
338
380
|
) -> Generator:
|
|
339
381
|
"""Periodic Modbus TCP poll request (Read Holding Registers, FC 03)."""
|
|
@@ -341,6 +383,7 @@ def _modbus_poll_gen(
|
|
|
341
383
|
yield env.timeout(delay_ns)
|
|
342
384
|
for t in tb.instants(delay_ns, tb.interval_ns(rate_hz)):
|
|
343
385
|
yield env.timeout(t - env.now)
|
|
386
|
+
counters.modbus_requests += 1
|
|
344
387
|
channel.enqueue(
|
|
345
388
|
_Frame(
|
|
346
389
|
src_mac=src_mac,
|
|
@@ -666,6 +709,37 @@ def _throughput_sampler(
|
|
|
666
709
|
samples.append((tb.ns_to_ms(env.now), mbps))
|
|
667
710
|
|
|
668
711
|
|
|
712
|
+
def _count_sampler(
|
|
713
|
+
env: _Environment,
|
|
714
|
+
count: Callable[[], int],
|
|
715
|
+
period: tb.Exact,
|
|
716
|
+
samples: Samples,
|
|
717
|
+
window: bool = False,
|
|
718
|
+
) -> Generator[simpy.Event]:
|
|
719
|
+
"""A count at each sample: so far, or with *window* in the window."""
|
|
720
|
+
last = 0
|
|
721
|
+
for tick in _ticks(env, period):
|
|
722
|
+
yield tick
|
|
723
|
+
total = count()
|
|
724
|
+
samples.append((tb.ns_to_ms(env.now), float(total - last if window else total)))
|
|
725
|
+
if window:
|
|
726
|
+
last = total
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
def _dropped(ports: list[_LinkChannel]) -> Callable[[], int]:
|
|
730
|
+
return lambda: sum(ch.frames_dropped for ch in ports)
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
def _sent(channel: _LinkChannel) -> Callable[[], int]:
|
|
734
|
+
return lambda: channel.frames_sent
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
def _received(counters: _AdapterCounters, metric: str) -> Callable[[], int]:
|
|
738
|
+
if metric == "frames_received":
|
|
739
|
+
return lambda: counters.frames_received
|
|
740
|
+
return lambda: counters.modbus_requests - counters.modbus_responses # modbus_unanswered
|
|
741
|
+
|
|
742
|
+
|
|
669
743
|
def _queue_depth_sampler(
|
|
670
744
|
env: _Environment,
|
|
671
745
|
out_channels: dict[int, _LinkChannel],
|
|
@@ -774,6 +848,10 @@ def run_simulation(
|
|
|
774
848
|
def _strict(node: model.NodeSpec) -> bool:
|
|
775
849
|
return not (isinstance(node, model.SwitchNode) and node.qos == "fifo")
|
|
776
850
|
|
|
851
|
+
def _buffer(node: model.NodeSpec) -> int | None:
|
|
852
|
+
# only switches bound their egress queues; end stations never drop
|
|
853
|
+
return node.buffer_bytes if isinstance(node, model.SwitchNode) else None
|
|
854
|
+
|
|
777
855
|
# Build directed link channels from topology
|
|
778
856
|
next_port: dict[str, int] = defaultdict(int)
|
|
779
857
|
out_channels: dict[str, dict[int, _LinkChannel]] = defaultdict(dict)
|
|
@@ -792,8 +870,12 @@ def run_simulation(
|
|
|
792
870
|
|
|
793
871
|
prop_ns = tb.propagation_ns(link.length_m)
|
|
794
872
|
# ch_ab is a's egress queue, ch_ba is b's — each follows its owner's QoS.
|
|
795
|
-
ch_ab = _LinkChannel(
|
|
796
|
-
|
|
873
|
+
ch_ab = _LinkChannel(
|
|
874
|
+
env, link.speed_mbps, prop_ns, port_b, inbound[b.name], _strict(a), _buffer(a)
|
|
875
|
+
)
|
|
876
|
+
ch_ba = _LinkChannel(
|
|
877
|
+
env, link.speed_mbps, prop_ns, port_a, inbound[a.name], _strict(b), _buffer(b)
|
|
878
|
+
)
|
|
797
879
|
|
|
798
880
|
out_channels[a.name][port_a] = ch_ab
|
|
799
881
|
out_channels[b.name][port_b] = ch_ba
|
|
@@ -915,6 +997,7 @@ def run_simulation(
|
|
|
915
997
|
MODBUS_REQUEST_BYTES,
|
|
916
998
|
spec.rate,
|
|
917
999
|
ch,
|
|
1000
|
+
adapter_counters[name],
|
|
918
1001
|
delay_ns=tb.ms_to_ns(spec.delay_ms),
|
|
919
1002
|
)
|
|
920
1003
|
)
|
|
@@ -983,6 +1066,17 @@ def run_simulation(
|
|
|
983
1066
|
env.process(_window_sampler(env, sinks, _max_us, period, samples))
|
|
984
1067
|
elif obs.metric == "pn_watchdog_expiries" and target.name in pn_consumers:
|
|
985
1068
|
env.process(_pn_expiries_sampler(env, pn_consumers[target.name], period, samples))
|
|
1069
|
+
elif obs.metric in ("drops", "drops_total") and isinstance(target, model.SwitchNode):
|
|
1070
|
+
dropped = _dropped(list(out_channels[target.name].values()))
|
|
1071
|
+
window = obs.metric == "drops"
|
|
1072
|
+
env.process(_count_sampler(env, dropped, period, samples, window))
|
|
1073
|
+
elif obs.metric == "frames_sent" and adapter:
|
|
1074
|
+
ch = adapter_out.get(target.name)
|
|
1075
|
+
if ch:
|
|
1076
|
+
env.process(_count_sampler(env, _sent(ch), period, samples))
|
|
1077
|
+
elif obs.metric in ("frames_received", "modbus_unanswered") and adapter:
|
|
1078
|
+
count = _received(adapter_counters[target.name], obs.metric)
|
|
1079
|
+
env.process(_count_sampler(env, count, period, samples))
|
|
986
1080
|
|
|
987
1081
|
if _n_chunks > 1:
|
|
988
1082
|
sleep_s = 8.0 / _n_chunks # target ~8 s total wall time
|
|
@@ -269,6 +269,94 @@ def protocols() -> Scenario:
|
|
|
269
269
|
return net.to_scenario(duration=60)
|
|
270
270
|
|
|
271
271
|
|
|
272
|
+
def tail_drop() -> Scenario:
|
|
273
|
+
"""Ethernet and PROFINET through bounded switch buffers (ADR-0011): a
|
|
274
|
+
learning core that floods to a bounded port, a FIFO edge switch, two
|
|
275
|
+
sources whose frames reach a full queue at the same instants, priority
|
|
276
|
+
frames dropped by tail drop, and a watchdog that expires on loss."""
|
|
277
|
+
net = Network("tail-drop")
|
|
278
|
+
core = net.switch("core", ports=4, buffer=8 * 1_500)
|
|
279
|
+
# 5 frames of 1 500 B leave 50 B: too little for a 92 B PROFINET frame
|
|
280
|
+
edge = net.switch("edge", ports=5, qos="fifo", buffer=5 * 1_500 + 50)
|
|
281
|
+
plc = net.adapter("plc", ip="10.0.0.1")
|
|
282
|
+
io = net.profinet_device("io", ip="10.0.0.2")
|
|
283
|
+
left = net.adapter("left", ip="10.0.0.3")
|
|
284
|
+
right = net.adapter("right", ip="10.0.0.4")
|
|
285
|
+
srv = net.adapter("srv", ip="10.0.0.5")
|
|
286
|
+
quiet = net.adapter("quiet", ip="10.0.0.6")
|
|
287
|
+
cam = net.adapter("cam", ip="10.0.0.7")
|
|
288
|
+
net.link(left, core, speed=1_000, length=5)
|
|
289
|
+
net.link(right, core, speed=1_000, length=5)
|
|
290
|
+
net.link(srv, core, speed=100, length=10)
|
|
291
|
+
net.link(core, edge, speed=100, length=50)
|
|
292
|
+
net.link(plc, edge, speed=100, length=10)
|
|
293
|
+
net.link(io, edge, speed=100, length=10)
|
|
294
|
+
net.link(quiet, edge, speed=100, length=10)
|
|
295
|
+
net.link(cam, edge, speed=1_000, length=10)
|
|
296
|
+
plc.controls(io, cycle=1, inputs=64, outputs=64, hold=2)
|
|
297
|
+
# the same rate and start: their frames reach core's port to srv together
|
|
298
|
+
left.sends(srv, rate=5_000, size=1_500)
|
|
299
|
+
right.sends(srv, rate=5_000, size=1_500)
|
|
300
|
+
right.sends(srv, rate=2_000, size=200, priority=5, delay_ms=0.05)
|
|
301
|
+
# to quiet, which never sends: core floods these, to srv's port as well
|
|
302
|
+
left.sends(quiet, rate=3_000, size=1_200, delay_ms=0.3)
|
|
303
|
+
left.sends(plc, rate=2_000, size=1_500, delay_ms=0.1)
|
|
304
|
+
# with left's, 129 % of plc's port: PROFINET inputs are dropped there
|
|
305
|
+
cam.sends(plc, rate=8_500, size=1_500, delay_ms=0.02)
|
|
306
|
+
net.observe("drops", on=core, every=2)
|
|
307
|
+
net.observe("drops_total", on=core, every=2)
|
|
308
|
+
net.observe("drops_total", on=edge, every=2)
|
|
309
|
+
net.observe("queue_depth", on=core, every=1)
|
|
310
|
+
net.observe("frames_sent", on=left, every=2)
|
|
311
|
+
net.observe("frames_received", on=srv, every=2)
|
|
312
|
+
net.observe("frames_received", on=quiet, every=2)
|
|
313
|
+
net.observe("latency", on=srv, every=2)
|
|
314
|
+
net.observe("pn_watchdog_expiries", on=plc, every=2)
|
|
315
|
+
net.observe("pn_latency", on=plc, every=2)
|
|
316
|
+
return net.to_scenario(duration=40)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def lossy_protocols() -> Scenario:
|
|
320
|
+
"""Modbus polls and MQTT messages through a bounded port overloaded by
|
|
321
|
+
a constant flow: lost requests, responses and PUBLISH copies."""
|
|
322
|
+
net = Network("lossy-protocols")
|
|
323
|
+
sw = net.switch("sw", ports=5, buffer=6 * 1_500 + 40)
|
|
324
|
+
scada = net.adapter("scada", ip="10.0.0.1")
|
|
325
|
+
meter = net.modbus_slave("meter", ip="10.0.0.2", unit_id=3)
|
|
326
|
+
broker = net.mqtt_broker("broker", ip="10.0.0.3")
|
|
327
|
+
sensor = net.adapter("sensor", ip="10.0.0.4")
|
|
328
|
+
cam = net.adapter("cam", ip="10.0.0.5")
|
|
329
|
+
net.link(scada, sw, speed=100, length=20)
|
|
330
|
+
for node in (meter, broker, sensor, cam):
|
|
331
|
+
net.link(node, sw, speed=1_000, length=20)
|
|
332
|
+
cam.sends(scada, rate=9_000, size=1_500) # 110 % of scada's port
|
|
333
|
+
scada.polls(meter, register=0, count=20, rate=500)
|
|
334
|
+
sensor.publishes(broker, topic="cell/temp", rate=400, payload=40, qos=1)
|
|
335
|
+
broker.routes("cell/temp", to=[scada])
|
|
336
|
+
net.observe("modbus_unanswered", on=scada, every=2)
|
|
337
|
+
net.observe("modbus_latency", on=scada, every=2)
|
|
338
|
+
net.observe("latency", on=scada, every=2)
|
|
339
|
+
net.observe("frames_received", on=scada, every=2)
|
|
340
|
+
net.observe("drops_total", on=sw, every=2)
|
|
341
|
+
return net.to_scenario(duration=40)
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def random_drops() -> Scenario:
|
|
345
|
+
"""Poisson traffic into a bounded port at 150 % of its link: the buffer
|
|
346
|
+
is nearly always full, so delay is capped and its mean is precise."""
|
|
347
|
+
net = Network("random-drops")
|
|
348
|
+
sw = net.switch("sw", ports=3, buffer=12 * 1_518)
|
|
349
|
+
srv = net.adapter("srv", ip="10.0.0.1")
|
|
350
|
+
net.link(srv, sw, speed=100, length=5)
|
|
351
|
+
for i in (2, 3):
|
|
352
|
+
host = net.adapter(f"h{i}", ip=f"10.0.0.{i}")
|
|
353
|
+
net.link(host, sw, speed=1_000, length=10)
|
|
354
|
+
host.sends(srv, rate=0.75 * 100e6 / (1_538 * 8), size=1_518, pattern="poisson")
|
|
355
|
+
for metric in ("throughput", "latency", "frames_received"):
|
|
356
|
+
net.observe(metric, on=srv, every=20)
|
|
357
|
+
return net.to_scenario(duration=1_000, seed=23)
|
|
358
|
+
|
|
359
|
+
|
|
272
360
|
def random_load() -> Scenario:
|
|
273
361
|
"""Poisson and bursty traffic with IMIX sizes into one server port, at
|
|
274
362
|
about 40 % of its link."""
|
|
@@ -338,9 +426,12 @@ DETERMINISTIC: dict[str, Callable[[], Scenario]] = {
|
|
|
338
426
|
"messaging": messaging,
|
|
339
427
|
"cyclic": cyclic,
|
|
340
428
|
"protocols": protocols,
|
|
429
|
+
"tail-drop": tail_drop,
|
|
430
|
+
"lossy-protocols": lossy_protocols,
|
|
341
431
|
}
|
|
342
432
|
STOCHASTIC: dict[str, Callable[[], Scenario]] = {
|
|
343
433
|
"random-load": random_load,
|
|
344
434
|
"batches": batches,
|
|
345
435
|
"groups": groups,
|
|
436
|
+
"random-drops": random_drops,
|
|
346
437
|
}
|