7466a46aa7
The standalone design.md, kpi.md, operations.md, and the docs/plan/ phase tree were point-in-time planning artefacts now superseded by the topic-organized docs/ tree (Architecture/, Features/, Operations/, Reference/, Testing/). The DL260/ folder mixed a device-reference doc, a test fixture, a sample test, and a screenshot; its contents now live in their natural homes (dl205.md + mbtcp_settings.JPG under docs/Reference/, dl205.json next to its launcher in tests/sim/, sample test dropped). All cross-references in the surviving docs, README, CLAUDE.md, the config template, and source comments are repointed to the new locations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
Markdown
50 lines
1.7 KiB
Markdown
# DL205 Modbus Simulator
|
|
|
|
Wraps the `dl205.json` pymodbus profile as a standalone launcher and as an xUnit managed lifecycle.
|
|
|
|
## Manual launch
|
|
|
|
```powershell
|
|
pwsh tests/sim/run-dl205-sim.ps1 -Port 5020
|
|
```
|
|
|
|
On first run the script creates a Python venv at `tests/sim/.venv` and installs:
|
|
|
|
```
|
|
pymodbus==3.13.0
|
|
aiohttp
|
|
```
|
|
|
|
(`pymodbus 3.13.0` does not provide a `[server]` extra; the simulator is included in
|
|
the base package. `aiohttp` is required by the simulator's HTTP console.)
|
|
|
|
Re-runs detect the existing venv and skip provisioning (fast path, < 2 s to first packet).
|
|
|
|
Ctrl-C exits cleanly. The venv directory is gitignored.
|
|
|
|
## Requirements
|
|
|
|
- Python 3.10+ on `PATH` (tested with 3.13). The script also tries the Windows `py` launcher.
|
|
- Network access for first-run venv provisioning. Subsequent runs are fully offline.
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Default | Description |
|
|
|------------|--------------------------------|------------------------------------|
|
|
| `-Profile` | `dl205.json` | pymodbus JSON device profile |
|
|
| `-Port` | `5020` | TCP port the Modbus server binds |
|
|
|
|
## xUnit integration
|
|
|
|
Test classes that need a live simulator declare:
|
|
|
|
```csharp
|
|
[Collection(nameof(DL205SimulatorCollection))]
|
|
```
|
|
|
|
The `DL205SimulatorFixture` (in `tests/Mbproxy.Tests/Sim/`) spawns `run-dl205-sim.ps1` via `pwsh -NoProfile -File`, polls for a TCP connection within 10 s, and exposes `Host`, `Port`, and `LogTail`. If Python is unavailable, `SkipReason` is populated and every test in the collection skips cleanly rather than failing.
|
|
|
|
## Version pin
|
|
|
|
`pymodbus[server]==3.13.0` — update this README and `run-dl205-sim.ps1` together when re-pinning.
|