Files
lmxopcua/docs/plans/evidence/grpc-data-ext/A1-L4.md
T

93 lines
7.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# A1 exit gate L4: native initial-alarm-state signal latency
Plan `docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md` (rev. 7), §9.3 row L4. Measured 2026-11-24 on branch
`worktree-agent-ad44f71fa7ab46039`, from the macOS dev host against the shared Docker host `10.100.0.35`. One AbCip leg ran
against a private local container (see that row).
## What is measured
For each native alarm source, the latency from **quality Good** to the driver's first
`IAlarmInitialStateSignal.InitialAlarmStateDelivered`.
- **Quality Good** is the moment the driver's `InitializeAsync` returns. That is when `DriverInstanceActor` enters
`Connected` and the host starts its F5 window (`OnConditionSignalConnectivity`).
- The driver is then subscribed to its alarm refs (as the actor does) and the stopwatch stops in the signal handler.
- **"with connect"** also counts `InitializeAsync` itself. It is an upper bound for a cold start.
- **N = 20 per leg.** Each sample is a fresh driver instance: connect, alarm subscribe, first read/refresh, signal, then shutdown.
- **p50 / p99** use the nearest-rank method. With N = 20, p99 is the maximum.
- All fixture use was **read-only**: no fixture was restarted or reconfigured, and no alarm was scheduled on any mock.
The harness is a set of `Category=LiveIntegration`, `Phase=L4` tests:
- `tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests/OpcUaClientAlarmSignalLatencyTests.cs`
- `tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.IntegrationTests/FocasAlarmSignalLatencyTests.cs`
- `tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.MTConnect.IntegrationTests/MTConnectAlarmSignalLatencyTests.cs`
- `tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests/AbCipAlarmSignalLatencyTests.cs`
To re-run a leg:
```bash
OTOPCUA_L4_RESULTS=/path/l4.jsonl timeout 1200 dotnet test tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.<X>.IntegrationTests \
--filter "Phase=L4" --blame-hang-timeout 300s
# AbCip additionally needs OTOPCUA_L4_ALMD_ENDPOINT=<host:port> of an ab_server with the AlmA.* tags (below).
```
## Results
| Source | Fixture | Signal path measured | N | p50 (ms) | p99 (ms) | with connect p50 / p99 (ms) | `ConditionKnownSignalTimeout` |
|---|---|---|---|---|---|---|---|
| OpcUaClient | `otopcua-opc-plc` `opc.tcp://10.100.0.35:50000` (`--pn=50000 --ut --aa --alm`, verified) | `RefreshEnd` of the alarm subscription's ConditionRefresh, `Unsignalable=false` asserted | 20 | 567.8 | 642.3 | 989.2 / 1372.6 | **120 s** (default; 3× p99 = 4.1 s) |
| FOCAS | `otopcua-focas-fixture` focas-mock `focas://10.100.0.35:8193` (serves `cnc_rdalmmsg2`) | first successful alarm-read tick, `ALARM:*` condition | 20 | 95.7 | 256.2 | 95.7 / 266.5 | **120 s** (default; 3× p99 = 0.8 s) |
| MTConnect | `otopcua-mtconnect-agent` `http://10.100.0.35:5000` (2 CONDITION items: `fixture_x_travel`, `fixture_logic`) | resync emission in `SubscribeAlarmsAsync` over the init-time `/current` baseline | 20 | 0.0 | 1.5 | 24.2 / 120.7 | **120 s** (default; 3× p99 with connect = 0.4 s) |
| AbCip ALMD | **private** ab_server (image `otopcua-ab-server:libplctag-release`, copied from the Docker host), `127.0.0.1:44918`, tags `AlmA.InAlarm:BOOL`, `AlmA.Severity:DINT`, `AlmA.Acked:BOOL`, run under amd64 emulation on the Mac | first poll tick whose `InAlarm` read Good (default 1 s cadence, native transport) | 20 | 999.0 | 1005.1 | 999.3 / 1005.2 | **120 s** (default; 3× p99 = 3.0 s) |
| Galaxy | — | — | — | — | — | — | **120 s** (default) — **blocked** |
| Heidenhain | — | — | — | — | — | — | **120 s** (default) — **blocked** |
Raw samples (ms, signal latency from quality Good):
- OpcUaClient: 622.8, 555.6, 583.7, 605, 560.8, 512.4, 615.1, 514.6, 536.4, 642.3, 574.8, 527.2, 602.7, 560.2, 567.8, 512.6, 557.3, 622.3, 632.3, 573.1
- FOCAS: 256.2, 142.7, 73.8, 60.3, 155, 86.9, 79, 74.9, 85.2, 178.7, 95.7, 87.3, 110.6, 176.6, 109.3, 115.9, 92.4, 222.2, 110.8, 84.2
- MTConnect: 1.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.1, 0, 0, 0, 0, 0
- AbCip: 37.6, 976.6, 1004.4, 998.9, 1000.2, 997.8, 1003.1, 996, 999.2, 1004.1, 997.9, 1003.6, 995.5, 998.1, 1005.1, 998.7, 1002.7, 1000.8, 999, 1002.1
### Observations
- **OpcUaClient.** About 0.55 s is the ConditionRefresh round trip plus the alarm subscription's 500 ms publishing interval: the
`RefreshEnd` rides the next publish. The signal never came from `ConditionRefreshAsync` returning; the F1 path was taken on
every sample.
- **MTConnect.** The `/current` baseline is read inside `InitializeAsync`, so the resync in `SubscribeAlarmsAsync` signals
synchronously, about 0 ms after Good. The cost is the connect itself, up to 121 ms.
- **AbCip.** 19 of 20 samples took one full poll interval. Inferred, not traced: the first tick's `InAlarm` read on a fresh
native session does not come back Good, so that tick establishes nothing, and the second tick, 1 s later, signals. That is consistent with G1: no signal until
`InAlarm` actually reads Good. The one fast sample (37.6 ms) was the run's first driver.
- ab_server has no ALMD instruction. The shared `otopcua-ab-server-controllogix` fixture also serves no `InAlarm` member, so
it cannot produce ALMD alarms.
- That is why the leg used a separate local container with the ALMD member layout as flat dotted tags (Docker patch 0003
serves `X.Y` member paths). This measures the driver's poll-tick signal path, not Logix ALMD semantics, and ALMA was not
measured.
- The shared fixture was **not** touched. The private container was started with `--rm` and stopped after the run.
- **FOCAS.** One successful `cnc_rdalmmsg2` per sample. The mock's alarm list was read, never modified.
## Chosen timeouts
`DataConnections:ConditionKnownSignalTimeout:<DriverType>` stays at the **120 s default for every type**. No configuration
key is added, for three reasons:
- Every measured p99 is at most 1.4 s even with connect, so 120 s is at least 29× the observed p99. That satisfies the gate,
which requires at least 3×.
- These are LAN fixtures. Production CNCs, PLCs and upstream servers on plant networks can be much slower, and a lower
timeout would only raise the F5 "initial alarm state not signalled" diagnostic earlier. It would never make a condition
known sooner, because the signal does that.
- On expiry the conditions stay unknown either way, so a generous bound costs nothing but diagnostic latency.
`DataConnections:ConditionKnownSettle:OpcUaClient` (the backstop, default 60 s) needs no calibration. It applies only to an
upstream without ConditionRefresh (documented residual).
## Blocked legs
| Leg | Why it could not run | Timeout kept |
|---|---|---|
| **Galaxy** | Needs the mxaccessgw gateway with a deployed ArchestrA Platform behind the corporate VPN, which is down. No remote commands on the wonder boxes. The driver path is covered by unit tests against the real `GatewayGalaxyAlarmFeed` (`GalaxyInitialAlarmStateSignalTests`). | 120 s default |
| **Heidenhain** | No LSV2 fixture exists. The in-process simulator in `Heidenhain.Tests` is not a latency rig, and the iTNC 530 hardware was not available for this run. Covered by `HeidenhainInitialAlarmStateSignalTests`. | 120 s default |
| AbCip on the **shared** fixture | `otopcua-ab-server-controllogix` serves no ALMD/ALMA member, so it cannot produce alarms. Measured instead on a private same-image container (above). Real-Logix ALMD latency (e.g. Z35162, which has no ALMD/ALMA) remains unmeasured. | 120 s default |