[ablegacy] AbLegacy — Diagnostic counters as tags #386

Merged
dohertj2 merged 1 commits from auto/ablegacy/10 into auto/driver-gaps 2026-04-26 03:53:30 -04:00
Owner

Summary

Multi-variable PDU packing for S7 — replaces per-tag Plc.ReadAsync loop with Plc.ReadMultipleVarsAsync batching.

  • S7ReadPacker.cs (new) static helper:
    • Classifies tags as packable / fallback / unknown.
    • Builds S7.Net.Types.DataItem with VarType, Count, DB, StartByteAdr, BitAdr.
    • Computes PDU item budget: (pduSize - 18) / 12, capped at 19 items per call.
    • Bin-packs preserving caller order.
  • S7Driver.ReadAsync — classifies inputs into unknown / packable / fallback. Packable batches dispatch via Plc.ReadMultipleVarsAsync; decodes each DataItem.Value back to per-tag snapshots. Falls back to per-tag ReadOneAsync on batch-level failure so one bad tag doesn't poison the rest of the batch.
  • Arrays, strings, dates, 64-bit ints, UDT-shaped types remain on the existing per-tag path (variable-width or special encoding).

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.S7 — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.S7.Tests163 / 163 passed (14 new in S7ReadPackerTests: item-budget math, bin-packing 100 items into ≤6 batches, packability classification across all S7DataType values, DataItem field mapping (DB / area / VarType / BitAdr), value reinterpret (signed Int16/Int32 from unsigned wire))
  • Integration tests — Snap7-server fixture supports it; not exercised in this PR

🤖 Auto-generated by the Mode-B execution loop. Closes #292.

Closes #253

## Summary Multi-variable PDU packing for S7 — replaces per-tag `Plc.ReadAsync` loop with `Plc.ReadMultipleVarsAsync` batching. - **`S7ReadPacker.cs`** (new) static helper: - Classifies tags as packable / fallback / unknown. - Builds `S7.Net.Types.DataItem` with `VarType`, `Count`, `DB`, `StartByteAdr`, `BitAdr`. - Computes PDU item budget: `(pduSize - 18) / 12`, capped at **19 items** per call. - Bin-packs preserving caller order. - **`S7Driver.ReadAsync`** — classifies inputs into unknown / packable / fallback. Packable batches dispatch via `Plc.ReadMultipleVarsAsync`; decodes each `DataItem.Value` back to per-tag snapshots. Falls back to per-tag `ReadOneAsync` on **batch-level** failure so one bad tag doesn't poison the rest of the batch. - Arrays, strings, dates, 64-bit ints, UDT-shaped types remain on the existing per-tag path (variable-width or special encoding). ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.S7` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.S7.Tests` — **163 / 163 passed** (14 new in `S7ReadPackerTests`: item-budget math, bin-packing 100 items into ≤6 batches, packability classification across all `S7DataType` values, `DataItem` field mapping (DB / area / VarType / BitAdr), value reinterpret (signed Int16/Int32 from unsigned wire)) - [ ] Integration tests — Snap7-server fixture supports it; not exercised in this PR 🤖 Auto-generated by the Mode-B execution loop. Closes #292. Closes #253
dohertj2 added 1 commit 2026-04-26 03:53:25 -04:00
dohertj2 merged commit 4fdeef7a6c into auto/driver-gaps 2026-04-26 03:53:30 -04:00
dohertj2 deleted branch auto/ablegacy/10 2026-04-26 03:53:30 -04:00
Sign in to join this conversation.