Auto: twincat-2.1 — ADS Sum-read / Sum-write

Closes #310
This commit is contained in:
Joseph Doherty
2026-04-25 21:43:32 -04:00
parent fa2fbb404d
commit 931049b5a7
11 changed files with 875 additions and 26 deletions

View File

@@ -71,6 +71,70 @@ GVL_Fixture.nCounter := GVL_Fixture.nCounter + 1;
- `PlcTask` — cyclic, 10 ms interval, priority 20
- Assigned to `MAIN`
## Performance scenarios
PR 2.1 (ADS Sum-read / Sum-write) ships an opt-in perf-tier integration test
(`TwinCATSumCommandPerfTests.Driver_sum_read_1000_tags_beats_loop_baseline_by_5x`)
that reads 1000 DINTs in one shot and asserts the bulk path beats the per-tag
loop by ≥ 5×. The fixture state required by that test is:
### Global Variable List: `GVL_Perf`
```st
VAR_GLOBAL
// 1000-DINT array exercised by the bulk Sum-read benchmark.
aTags : ARRAY[1..1000] OF DINT;
fbPerfChurn : FB_PerfChurn;
END_VAR
```
The XAE-form GVL ships at `PLC/GVLs/GVL_Perf.TcGVL`; import it into the PLC
project alongside `GVL_Fixture`.
### POU: `FB_PerfChurn`
```st
FUNCTION_BLOCK FB_PerfChurn
VAR
nIndex : INT := 1;
END_VAR
GVL_Perf.aTags[nIndex] := GVL_Perf.aTags[nIndex] + 1;
nIndex := nIndex + 1;
IF nIndex > 1000 THEN
nIndex := 1;
END_IF
```
The XAE-form POU ships at `PLC/POUs/FB_PerfChurn.TcPOU`. Wire it into `MAIN`
so a value rotates each cycle:
```st
PROGRAM MAIN
VAR
END_VAR
// existing GVL_Fixture line:
GVL_Fixture.nCounter := GVL_Fixture.nCounter + 1;
// PR 2.1 keep aTags moving so caches don't short-circuit the read.
GVL_Perf.fbPerfChurn();
```
### Running the perf tier
```powershell
$env:TWINCAT_TARGET_HOST = '10.0.0.42'
$env:TWINCAT_TARGET_NETID = '5.23.91.23.1.1'
$env:TWINCAT_PERF = '1'
dotnet test tests\ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.IntegrationTests `
--filter "Category=Performance"
```
Without `TWINCAT_PERF=1` the perf test skips via `[TwinCATPerfFact]` even when
the runtime is reachable — perf runs are opt-in to keep the default integration
pass fast.
### Runtime ID
- TC3 PLC runtime 1 (AMS port `851`) — the smoke-test fixture defaults