task-galaxy-e2e branch — non-FOCAS work-in-progress snapshot
Catch-all commit for pending work on the task-galaxy-e2e branch that
wasn't part of the FOCAS migration. Grouping by topic so future per-topic
commits can be cherry-picked if needed.
TwinCAT
- src/.../Driver.TwinCAT/AdsTwinCATClient.cs + TwinCATDriverFactoryExtensions.cs:
factory-registration extensions + ADS client refinements.
- src/.../Driver.TwinCAT.Cli/Commands/BrowseCommand.cs: new browse command
for the TwinCAT test-client CLI.
- tests/.../Driver.TwinCAT.IntegrationTests/TwinCAT3SmokeTests.cs + TwinCatProject/:
fixture scaffold with a minimal POU + README pointing at the TCBSD/ESXi
VM for e2e.
- docs/Driver.TwinCAT.Cli.md + docs/drivers/TwinCAT-Test-Fixture.md:
documentation for the above.
- docs/v3/twincat-backlog.md: forward-looking backlog seed.
Admin UI + fleet status
- src/.../Admin/Components/Pages/Clusters/DriversTab.razor + Hosts.razor:
UI refresh for fleet-status rendering.
- src/.../Admin/Hubs/FleetStatusHub.cs + FleetStatusPoller.cs +
Admin/Program.cs: SignalR hub + poller plumbing for live fleet data.
- tests/.../Admin.Tests/FleetStatusPollerTests.cs: poller coverage.
Server + redundancy runtime (Phase 6.3 follow-ups)
- src/.../Server/Hosting/RedundancyPublisherHostedService.cs: HostedService
that owns the RedundancyStatePublisher lifecycle + wires peer reachability.
- src/.../Server/Redundancy/ServerRedundancyNodeWriter.cs: OPC UA
variable-node writer binding ServiceLevel + ServerUriArray to the
publisher's events.
- src/.../Server/Program.cs + Server.csproj: hosted-service registration.
- tests/.../Server.Tests/ServerRedundancyNodeWriterTests.cs +
Server.Tests.csproj: coverage for the above.
Configuration
- src/.../Configuration/Validation/DraftValidator.cs +
tests/.../Configuration.Tests/DraftValidatorTests.cs: draft-validation
refinements.
E2E scripts (shared infrastructure)
- scripts/e2e/README.md + _common.ps1 + test-all.ps1: shared helpers + the
all-drivers test-all runner.
- scripts/e2e/test-opcuaclient.ps1: OPC UA Client e2e runner.
Docs
- docs/v2/implementation/phase-6-{1,2,3,4}*.md + exit-gate-phase-{3,7}.md:
phase-gate + implementation doc updates.
- docs/v2/plan.md: top-level plan refresh.
- docs/v2/redundancy-interop-playbook.md: client interop playbook for the
Phase 6.3 redundancy-runtime work.
Two orphan FOCAS docs remain on disk but deliberately unstaged —
docs/v2/focas-deployment.md and docs/v2/implementation/focas-simulator-plan.md
describe the now-retired Tier-C topology and should either be rewritten
or deleted in a follow-up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
# TwinCAT XAR fixture project
|
||||
|
||||
This folder holds the TwinCAT 3 XAE project that the XAR VM runs for the
|
||||
integration-tests suite (`tests/.../TwinCAT.IntegrationTests/*.cs`).
|
||||
This folder holds the TwinCAT 3 XAE project that the XAR VM (or TCBSD
|
||||
target) runs for the integration-tests suite and the broader browse /
|
||||
UDT / array / enum coverage exercised by the OPC UA driver.
|
||||
|
||||
**Status today**: stub. The `.tsproj` isn't committed yet; once the XAR
|
||||
VM is up + a project with the required state exists, export via
|
||||
File → Export + drop it here as `OtOpcUaTwinCatFixture.tsproj` + its
|
||||
PLC `.library` / `.plcproj` companions.
|
||||
**Status today**: the `.sln` / `.tsproj` / `.plcproj` wrappers still get
|
||||
generated per-workstation in XAE (GUIDs are install-specific), but every
|
||||
PLC object is committed as a standalone `.TcGVL` / `.TcDUT` / `.TcPOU`
|
||||
under `PLC/{GVLs,DUTs,POUs}/`. Reconstruction is "Add Existing Item" of
|
||||
each file into a fresh XAE project — see **Importing the committed PLC
|
||||
objects** below.
|
||||
|
||||
## Why `.tsproj`, not the binary bootproject
|
||||
|
||||
@@ -30,41 +33,89 @@ Reconstruction workflow on the VM:
|
||||
|
||||
## Required project state
|
||||
|
||||
The smoke tests in `TwinCAT3SmokeTests.cs` depend on this exact GVL +
|
||||
PLC setup. Missing or renamed symbols surface as ADS `DeviceSymbolNotFound`
|
||||
or wrong-type read failures, not silent skips.
|
||||
`TwinCAT3SmokeTests.cs` ships 14 `[TwinCATFact]` methods plus a 16-case
|
||||
`[TwinCATTheory]` — the tests depend on the exact shapes below. Missing
|
||||
or renamed symbols surface as ADS `DeviceSymbolNotFound` or wrong-type
|
||||
read failures, not silent skips. Changed seed values will flip specific
|
||||
assertions — the load-bearing ones are called out inline.
|
||||
|
||||
### Global Variable List: `GVL_Fixture`
|
||||
### Integration-test contract
|
||||
|
||||
```st
|
||||
VAR_GLOBAL
|
||||
// Monotonically-increasing counter; MAIN increments each cycle.
|
||||
// Seed value 1234 picked so the smoke test can assert ">= 1234" without
|
||||
// synchronising with the initial cycle.
|
||||
nCounter : DINT := 1234;
|
||||
The dependency surface spans `GVL_Fixture`, `GVL_Primitives`, `GVL_Arrays`,
|
||||
`GVL_Enums`, `GVL_Plant`, and `MAIN`.
|
||||
|
||||
// Scratch REAL for write-then-read round-trip test. Smoke test writes
|
||||
// 42.5 + reads back.
|
||||
rSetpoint : REAL := 0.0;
|
||||
**`GVL_Fixture`** (source: [`PLC/GVLs/GVL_Fixture.TcGVL`](PLC/GVLs/GVL_Fixture.TcGVL))
|
||||
holds exactly three variables — `nCounter : DINT := 1234`,
|
||||
`rSetpoint : REAL := 0.0`, `bFlag : BOOL := TRUE`. `MAIN`
|
||||
(source: [`PLC/POUs/MAIN.TcPOU`](PLC/POUs/MAIN.TcPOU)) increments
|
||||
`nCounter` every cycle so the native-notification test sees monotonic
|
||||
change without writing. Seeded values aren't reliable — PlcTask
|
||||
watchdog restarts reset them — so the read test only asserts a
|
||||
non-negative DINT.
|
||||
|
||||
// Readable boolean with seed value TRUE. Reserved for future
|
||||
// expansion (e.g. discovery / symbol-browse tests).
|
||||
bFlag : BOOL := TRUE;
|
||||
END_VAR
|
||||
**`GVL_Primitives.vWord := 16#BEEF`** — the bit-indexed BOOL test pins
|
||||
to bit 3 (set in `0xBEEF`) and bit 4 (clear). Changing the seed flips
|
||||
that test.
|
||||
|
||||
**`GVL_Primitives` numeric seeds** — the primitive-type theory reads
|
||||
each of `vSInt, vUSInt, vInt, vUInt, vDInt, vUDInt, vLInt, vULInt,
|
||||
vReal, vLReal, vString` and asserts the exact seed value. Matches
|
||||
the declarations in [`PLC/GVLs/GVL_Primitives.TcGVL`](PLC/GVLs/GVL_Primitives.TcGVL).
|
||||
|
||||
**`GVL_Arrays.aReal1D[5]`** — the array round-trip test writes + reads
|
||||
element index 5. The array must be writable; don't apply read-only
|
||||
attributes.
|
||||
|
||||
**`GVL_Plant.Line1.Stations[1].Axes[1].Motor.{Temperature, Running}`** —
|
||||
the nested-UDT test reads both (LREAL + BOOL). `FB_LineSim` must be
|
||||
driving the hierarchy (see `MAIN`) so values are alive.
|
||||
|
||||
**`GVL_Enums.currentAxisState`** — the browse test asserts this symbol
|
||||
surfaces by name.
|
||||
|
||||
### Complex hierarchy (for browse / UDT / array / enum coverage)
|
||||
|
||||
All sources in [`PLC/`](PLC/). Commits are split
|
||||
one-object-per-file so XAE can "Add Existing Item" each into a fresh
|
||||
project (the `.plcproj` wrapper is environment-specific and not
|
||||
committed).
|
||||
|
||||
**Type coverage** — `GVL_Primitives` has one of every ADS primitive:
|
||||
`BOOL, BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT,
|
||||
LINT, ULINT, REAL, LREAL, STRING(80), WSTRING(80), TIME, TOD, DATE, DT`.
|
||||
|
||||
**Array coverage** — `GVL_Arrays` has 1-D primitives, `ARRAY[1..4,1..4]
|
||||
OF REAL`, `ARRAY[0..2,0..2,0..2] OF DINT`, plus `ARRAY[1..4] OF ST_Axis`
|
||||
for per-element nested-struct browse.
|
||||
|
||||
**Enum + alias coverage** — `E_AxisState : DINT`, `E_Severity : INT`,
|
||||
`T_Temperature : LREAL`, `T_MeterPerSec : LREAL`. `GVL_Enums` exposes
|
||||
each at the root so tests can assert `EnumStrings` /
|
||||
`DataTypeDefinition` rendering without walking the plant hierarchy.
|
||||
|
||||
**5-level plant hierarchy** — rooted at `GVL_Plant.Line1 : ST_Line`:
|
||||
|
||||
```
|
||||
GVL_Plant.Line1 (ST_Line)
|
||||
.Stations[1..3] (ARRAY OF ST_Station)
|
||||
.Axes[1..4] (ARRAY OF ST_Axis)
|
||||
.Motor (ST_Motor)
|
||||
.Encoder (ST_Encoder)
|
||||
.Commands (ST_AxisCommands)
|
||||
.TravelLog[1..8] (ARRAY OF LREAL)
|
||||
.IO (ST_StationIO — 32x DI/DO, 8x AI/AO)
|
||||
.Alarms[1..16] (ARRAY OF ST_Alarm)
|
||||
.Recipe (ST_Recipe)
|
||||
.Steps[1..10] (ARRAY OF ST_RecipeStep)
|
||||
.SupportedSkus[1..4] (ARRAY OF STRING)
|
||||
.Stats (ST_Stats)
|
||||
```
|
||||
|
||||
### PLC program: `MAIN`
|
||||
|
||||
```st
|
||||
PROGRAM MAIN
|
||||
VAR
|
||||
END_VAR
|
||||
|
||||
// One-line program: increment the fixture counter every cycle.
|
||||
// The native-notification smoke test subscribes to GVL_Fixture.nCounter
|
||||
// + observes the monotonic changes without a write path.
|
||||
GVL_Fixture.nCounter := GVL_Fixture.nCounter + 1;
|
||||
```
|
||||
**Live value churn** — `FB_LineSim` + `FB_AxisSim` are called from
|
||||
`MAIN` every cycle: axes ramp position + derive velocity/accel, motor
|
||||
current/temperature track a sine, IO masks rotate, one alarm per station
|
||||
toggles each 32 cycles, stats counters increment. Subscription tests
|
||||
see real data-change notifications without an external writer.
|
||||
|
||||
### Task
|
||||
|
||||
@@ -77,6 +128,30 @@ GVL_Fixture.nCounter := GVL_Fixture.nCounter + 1;
|
||||
to this. Use runtime 2 / port `852` only if the single runtime is
|
||||
already taken by another project on the same VM.
|
||||
|
||||
## Importing the committed PLC objects
|
||||
|
||||
On a machine with a working TcXaeShell (or Visual Studio with the TC3
|
||||
XAE integration):
|
||||
|
||||
1. File → New → Project → **TwinCAT XAE Project** → name
|
||||
`OtOpcUaTwinCatFixture`. This lays down the `.sln` + `.tsproj`
|
||||
scaffolding.
|
||||
2. In the Solution Explorer, right-click the `PLC` node →
|
||||
**Add New Item → Standard PLC Project** → name `PLC`. Delete the
|
||||
auto-generated stub `MAIN` — the committed one will replace it.
|
||||
3. Right-click the PLC project's `DUTs` folder → **Add → Existing Item
|
||||
…** → multi-select every file under [`PLC/DUTs/`](PLC/DUTs/) and
|
||||
**Add As Link** (so the repo stays the source of truth). Repeat for
|
||||
`GVLs/` → [`PLC/GVLs/`](PLC/GVLs/) and `POUs/` →
|
||||
[`PLC/POUs/`](PLC/POUs/).
|
||||
4. Assign `MAIN` to `PlcTask` (cyclic, 10 ms, priority 20).
|
||||
5. Set the target system to the TCBSD / XAR VM via the AMS route, then
|
||||
**Build → Build Solution** + **Activate Configuration → Run Mode**.
|
||||
|
||||
If XAE complains about missing references while importing, add the DUTs
|
||||
before the GVLs (the structs are referenced by the plant GVL) and the
|
||||
enums/aliases first within DUTs.
|
||||
|
||||
## XAR VM setup (one-time)
|
||||
|
||||
Full bootstrap lives in `docs/v2/dev-environment.md`. The TwinCAT-specific
|
||||
@@ -126,14 +201,17 @@ Options to eliminate the manual step:
|
||||
On the dev box:
|
||||
|
||||
```powershell
|
||||
$env:TWINCAT_TARGET_HOST = '10.0.0.42' # replace with the VM IP
|
||||
$env:TWINCAT_TARGET_NETID = '5.23.91.23.1.1' # replace with the VM AmsNetId
|
||||
# $env:TWINCAT_TARGET_PORT = '852' # only if not using PLC runtime 1
|
||||
$env:TWINCAT_TARGET_NETID = '5.23.91.23.1.1' # replace with the VM AmsNetId — REQUIRED
|
||||
$env:TWINCAT_TARGET_HOST = '10.0.0.42' # replace with the VM IP (defaults to localhost)
|
||||
# $env:TWINCAT_TARGET_PORT = '852' # only if not using PLC runtime 1 (default 851)
|
||||
dotnet test tests\ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.IntegrationTests
|
||||
```
|
||||
|
||||
With any of those env vars unset, all three smoke tests skip cleanly via
|
||||
`[TwinCATFact]`; unit suite (`TwinCAT.Tests`) runs unchanged.
|
||||
Only `TWINCAT_TARGET_NETID` is required — fixture gates on it specifically.
|
||||
`TWINCAT_TARGET_HOST` defaults to `localhost` when unset; `TWINCAT_TARGET_PORT`
|
||||
defaults to `851`. With the NetID unset, the whole integration suite
|
||||
(~28 cases, both `[TwinCATFact]` and `[TwinCATTheory]`) skips cleanly;
|
||||
unit suite (`TwinCAT.Tests`) runs unchanged.
|
||||
|
||||
## See also
|
||||
|
||||
|
||||
Reference in New Issue
Block a user