feat(focas): real FANUC 30i/31i-B PDU-v3 support (live-validated on a 31i-B)

First real FOCAS hardware contact (Makino Pro 5 / 31i-B @ 10.201.31.5). A full
v3 data-PDU capture corrected the initial diagnosis: the v3 block envelope is
identical to v1, so only specific payload structs / request math / one client
robustness gap were wrong — not "framing rewrites".

Fixes (all re-validated live through the fixed driver):
- version gate: accept inbound PDU {1,3}, keep emitting v1 (FocasWireProtocol).
- cnc_rdtimer: 8-byte {minute,msec} payload is little-endian (ParseTimer) — the
  only decode with an in-range msec field.
- pmc_rdpmcrng: request range widened to the data-type byte width
  (end = start + width - 1) so a Word/Long isn't truncated to 0 values
  (was spurious BadOutOfRange); decode extracted to ParsePmcRange.
- cnc_rdsvmeter: per-axis LOADELM is 8 bytes (not 12) and names come from the
  0x0089 block — ParseServoMeters fixes the misaligned 655360 garbage. Also the
  "hang" was NetworkStream.ReadAsync not aborting a stalled socket: ReadExactlyAsync
  now disposes the stream on cancellation so a stalled peer can't wedge a poll loop.
- cnc_rddynamic2: contract guard rejecting axis < 1 (driver poll already 1-based).
- FocasDriverProbe: run a real wire session (initiate + cnc_statinfo) instead of
  degrading to Ok=true "TCP reachability only" when FWLIB is absent — a bare TCP
  listener no longer reports HEALTHY.

cnc_rdparam (0x000e) is unsupported on this control — EW_FUNC across 14
request-framing variants x 4 known-present params; needs a reference FWLIB trace
or is restricted. Deferred (deployed config uses macros, not parameters).

Tests: FOCAS suite 234 green (+16), full solution builds 0 errors. Raw v3
captures checked in under tests/.../Fixtures/v3/. Capture tools under scripts/focas/.

Docs: docs/plans/2026-06-25-focas-pdu-v3-{30i-b-support,implementation-plan}.md,
docs/drivers/FOCAS.md, docs/v2/focas-version-matrix.md,
docs/deployments/wonder-app-vd03-makino-z-34184.md.
This commit is contained in:
Joseph Doherty
2026-06-25 16:41:42 -04:00
parent fd01448ac4
commit 5f0a52864c
36 changed files with 1567 additions and 177 deletions
@@ -0,0 +1,69 @@
# Deployment record — wonder-app-vd03 · Makino Pro 5 (Z-34184) FOCAS
**Date configured:** 2026-06-25
**Host:** `wonder-app-vd03.zmr.zimmer.com` (OtOpcUaHost Windows service, single fused admin+driver node)
**Status:** Configured + deployed + served. **Live values blocked** by the FOCAS PDU-v3 driver gap —
see [`docs/plans/2026-06-25-focas-pdu-v3-30i-b-support.md`](../plans/2026-06-25-focas-pdu-v3-30i-b-support.md).
## Equipment
| Field | Value |
|---|---|
| Machine | **Makino Pro 5** (FANUC **30i-B** control) |
| **IP / FOCAS endpoint** | **`10.201.31.5:8193`** (FOCAS Ethernet, TCP) — reachable from the host (and from VPN clients) |
| **ZTag** | **`Z-34184`** |
| Manufacturer / Model | `Makino` / `Pro 5` |
| CNC series (driver) | `Thirty_i` (30i) |
## OtOpcUa host endpoints
- AdminUI: `http://wonder-app-vd03.zmr.zimmer.com:9000` (login disabled — `Security__Auth__DisableLogin=true`)
- OPC UA: `opc.tcp://wonder-app-vd03.zmr.zimmer.com:4840/OtOpcUa`
- Akka cluster: `:4053` · ConfigDb: SQL `OtOpcUaConfig` on `:1433`
## Deployed configuration (cluster `DEV`, Enterprise `zb` / Site `wonder-app-vd03`)
First config ever deployed on this node. All authored via the AdminUI.
| Object | Value |
|---|---|
| Namespace | `dev-equipment` (Equipment), URI `urn:zb:wonder-app-vd03:equipment` |
| UNS path | `zb / wonder-app-vd03 / machining / makino` |
| FOCAS driver instance | `focas-z-34184` ("Makino Pro 5 Z-34184 (FOCAS)"), backend `wire`, FixedTree enabled |
| Device | `10.201.31.5:8193`, series `Thirty_i` |
| Equipment | `z-34184``EquipmentId = EQ-3686c0272279`, MachineCode `Z-34184`, ZTag `Z-34184` |
| Tags | `parts-count``MACRO:3901` (Float64/Double, Read); `parts-required``MACRO:3902` (Float64/Double, Read) |
| Deployment | `0c2db588` (rev `924b59097eba…`) — **Sealed / "In sync"** |
OPC UA node IDs (verified served via the OtOpcUa CLI client):
- Equipment: `ns=2;s=EQ-3686c0272279`
- `ns=2;s=EQ-3686c0272279/parts-count`
- `ns=2;s=EQ-3686c0272279/parts-required`
## Host change required to deploy at all (Akka cluster roles)
This node was joining the Akka cluster **role-less**, so no deployment could ever complete
("a task was canceled"; Fleet status: "no driver-role nodes are Up"). Root cause: `OTOPCUA_ROLES`
(set to `admin,driver`) drives Program.cs actor wiring but does **not** populate the Akka member roles —
those come from config `Cluster:Roles`, which was unset (no `Cluster__Roles` env var; no `Cluster`
section in any appsettings). No code bridges `OTOPCUA_ROLES``AkkaClusterOptions.Roles`.
**Fix applied to the host service** (`HKLM\SYSTEM\CurrentControlSet\Services\OtOpcUaHost``Environment`):
added `Cluster__Roles__0=admin` and `Cluster__Roles__1=driver`, then restarted the service. The member
now joins **UP with roles ADMIN+DRIVER** and deployments seal. Prior env backed up on the host at
`E:\ApiInstall\OtOpcUa\_envbak-20260625T145303.txt`.
> Product follow-up: either wire `OTOPCUA_ROLES` → `AkkaClusterOptions.Roles`, or bake `Cluster:Roles`
> into the deploy template, so a node redeploy doesn't regress to role-less.
## Live verification (OtOpcUa CLI client → server)
`connect` + `browse` confirm the equipment + both tags are served at the node IDs above.
**Driver fix shipped (2026-06-25):** the wire client now accepts PDU v3 (see the linked plan). Validated
directly against `10.201.31.5``MACRO:3901`/`3902` read **Good** from the live 30i-B. **However, the
OtOpcUaHost on this box is still running the pre-v3 driver binary**, so the live OPC UA tags will keep
returning `Bad_WaitingForInitialData` until the rebuilt `ZB.MOM.WW.OtOpcUa.Driver.FOCAS.dll` (or a fresh
self-contained host publish) is deployed to `E:\ApiInstall\OtOpcUa\` and `OtOpcUaHost` is restarted. Once
redeployed, `parts-count`/`parts-required` should go Good (FixedTree + PMC/Parameter still pending the
follow-on v3 command work).