[focas] FOCAS — Figure scaling + diagnostics #330

Merged
dohertj2 merged 1 commits from auto/focas/F1-f into auto/driver-gaps 2026-04-25 15:04:07 -04:00
Owner

Summary

Two related features per the f1-f plan:

Decimal scaling — adds IFocasClient.GetFigureScalingAsync (default-null) and FwlibFocasClient impl using cnc_getfigure(kind=0). New IODBAXIS struct + MAX_AXIS=8 constant. Internal DecodeFigureScaling(byte[], short) is testable in isolation. Cache populated once per session in the probe loop. Internal ApplyFigureScaling(host, axisName, raw) helper exposed for future PRs that wire Axes/{name}/AbsolutePosition etc.

Diagnostics subtree per device:

  • Diagnostics/ReadCount (Int64) — increments on every successful probe tick
  • Diagnostics/ReadFailureCount (Int64) — increments on probe failure
  • Diagnostics/ReconnectCount (Int64) — bumped by EnsureConnectedAsync
  • Diagnostics/LastErrorMessage (String)
  • Diagnostics/LastSuccessfulRead (DateTime)

Configuration:

  • FocasFixedTreeOptions.ApplyFigureScaling flag (default true) — operators on existing deployments can flip to false if they were already compensating client-side. Migration guidance is documentation-only.

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.FOCAS — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests236 / 236 passed (7 new in FocasFigureScalingDiagnosticsTests: discovery shape, counters increment on success/failure, scaling math, ApplyFigureScaling=false bypass, unconnected client returns null, DecodeFigureScaling buffer parsing/clamping)
  • Integration tests — skipped (live CNC required)

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

Closes #262

## Summary Two related features per the f1-f plan: **Decimal scaling** — adds `IFocasClient.GetFigureScalingAsync` (default-null) and `FwlibFocasClient` impl using `cnc_getfigure(kind=0)`. New `IODBAXIS` struct + `MAX_AXIS=8` constant. Internal `DecodeFigureScaling(byte[], short)` is testable in isolation. Cache populated once per session in the probe loop. Internal `ApplyFigureScaling(host, axisName, raw)` helper exposed for future PRs that wire `Axes/{name}/AbsolutePosition` etc. **Diagnostics subtree** per device: - `Diagnostics/ReadCount` (Int64) — increments on every successful probe tick - `Diagnostics/ReadFailureCount` (Int64) — increments on probe failure - `Diagnostics/ReconnectCount` (Int64) — bumped by `EnsureConnectedAsync` - `Diagnostics/LastErrorMessage` (String) - `Diagnostics/LastSuccessfulRead` (DateTime) Configuration: - `FocasFixedTreeOptions.ApplyFigureScaling` flag (default `true`) — operators on existing deployments can flip to `false` if they were already compensating client-side. Migration guidance is documentation-only. ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.FOCAS` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests` — **236 / 236 passed** (7 new in `FocasFigureScalingDiagnosticsTests`: discovery shape, counters increment on success/failure, scaling math, ApplyFigureScaling=false bypass, unconnected client returns null, DecodeFigureScaling buffer parsing/clamping) - [ ] Integration tests — skipped (live CNC required) 🤖 Auto-generated by the Mode-B execution loop. Closes #262. Closes #262
dohertj2 added 1 commit 2026-04-25 15:04:03 -04:00
dohertj2 merged commit 8314c273e7 into auto/driver-gaps 2026-04-25 15:04:07 -04:00
dohertj2 deleted branch auto/focas/F1-f 2026-04-25 15:04:08 -04:00
Sign in to join this conversation.