Abdylreshit opened a new pull request, #2536: URL: https://github.com/apache/plc4x/pull/2536
## Summary Adds a new \`simulated\` driver to \`plc4py\`, matching the existing Java (\`plc4j/drivers/simulated\`) and Go (\`plc4go/internal/simulated\`) implementations. The mspec-generated protocol code under \`plc4py/protocols/simulated/readwrite/\` was already in the tree, but no Python driver consumed it; this PR fills that gap. The driver runs entirely in-process — it does not open a network socket and does not need an external PLC or simulator — so it is useful both as a reference implementation of the \`plc4py\` driver SPI and in tests that need a working driver without infrastructure. ## Tag semantics Tag format: \`TYPE/name:DATA_TYPE[count]\` (same as the Java and Go drivers). | Tag type | Read | Write | |----------|-------------------------------------------------------------------|----------------------------| | STATE | Returns the last written value, or \`NOT_FOUND\` if never written | Stores the value in memory | | RANDOM | Returns a freshly generated random value for the data type | \`ACCESS_DENIED\` | | STDOUT | \`ACCESS_DENIED\` | Logs the value | All 19 data types from \`simulated.mspec\` are supported (\`BOOL\`, \`BYTE\`, \`WORD\`, \`DWORD\`, \`LWORD\`, \`SINT\`, \`INT\`, \`DINT\`, \`LINT\`, \`USINT\`, \`UINT\`, \`UDINT\`, \`ULINT\`, \`REAL\`, \`LREAL\`, \`CHAR\`, \`WCHAR\`, \`STRING\`, \`WSTRING\`), both scalar and arrays. ## Files added - \`plc4py/drivers/simulated/SimulatedTag.py\` — tag parser (regex, enum, builder) - \`plc4py/drivers/simulated/SimulatedConfiguration.py\` — URL config - \`plc4py/drivers/simulated/SimulatedDevice.py\` — in-memory state store + random-value generator - \`plc4py/drivers/simulated/SimulatedConnection.py\` — connection, driver and pluggy loader - \`plc4py/tests/unit/plc4py/drivers/simulated/\` — 20 unit tests (tag-parser unit tests + end-to-end via \`PlcDriverManager\`) Also registers the new driver via \`pyproject.toml\` entry points: \`\`\`toml simulated = \"plc4py.drivers.simulated.SimulatedConnection:SimulatedDriverLoader\" \`\`\` ## Test plan - [x] \`pytest tests/unit/plc4py/drivers/simulated/ -v\` — **20 passed** - [x] \`pytest\` full suite — **97 passed, 36 xfailed** (was 77 passed, 36 xfailed before; no regressions) - [x] Tag parser handles STATE / RANDOM / STDOUT prefixes, arrays, dotted names, unknown types - [x] \`STATE\` write → read round-trips preserve the value (scalar and array) - [x] \`RANDOM\` reads return correctly-typed \`PlcValue\` instances; writes return \`ACCESS_DENIED\` - [x] \`STDOUT\` writes succeed and are logged; reads return \`ACCESS_DENIED\` - [x] Multi-tag read request dispatches each tag independently -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
