Auto: s7-d3 — instance-DB / FB parameter resolution

Closes #301
This commit is contained in:
Joseph Doherty
2026-04-26 07:04:40 -04:00
parent c9e28b881e
commit baf1d65875
9 changed files with 797 additions and 14 deletions

View File

@@ -1044,6 +1044,30 @@ The fan-out rejects, with clear errors:
- Tag with `UdtName` AND `ElementCount > 1` (array-of-UDT belongs in the UDT
layout, not at the parent-tag level)
### Re-import on UDT / FB-interface edit — caveat
The static-offset model assumes the declared layout matches the runtime
layout exactly. When the underlying UDT or FB interface changes in TIA Portal
— a member added, removed, or reordered — the byte offsets shift on the PLC
side and the cached `S7UdtDefinition` / instance-DB addresses point at the
wrong member.
**The driver does not auto-detect interface drift.** After any UDT edit or
multi-instance-FB interface edit on the PLC side, the operator must:
1. Recompile + download the updated program in TIA Portal.
2. Re-export "Show all tags" CSV from the updated project.
3. Re-import via `AddTiaCsvImport` (or `import-symbols` CLI) and update the
matching `S7UdtDefinition` declarations to mirror the new offsets.
4. Restart the driver instance (Admin UI → Drivers → Reload).
A stale UDT layout will silently read / write the wrong byte offsets — the
values will look like valid PLC data but reference whichever member used to
live at that offset before the edit. The same caveat applies to multi-instance
FB-instance DBs imported via PR-S7-D3 / [#301](https://github.com/dohertj2/lmxopcua/issues/301);
see [`docs/drivers/S7-TIA-Import.md` "Re-import on FB-interface edit"](../drivers/S7-TIA-Import.md#re-import-on-fb-interface-edit--caveat)
for the FB-instance-specific workflow.
## References
1. Siemens Industry Online Support, *Modbus/TCP Communication between SIMATIC S7-1500 / S7-1200 and Modbus/TCP Controllers with Instructions `MB_CLIENT` and `MB_SERVER`*, Entry ID 102020340, V6 (Feb 2021). https://cache.industry.siemens.com/dl/files/340/102020340/att_118119/v6/net_modbus_tcp_s7-1500_s7-1200_en.pdf