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:
Joseph Doherty
2026-04-24 14:12:19 -04:00
parent 4b0664bd55
commit 69e0d02c72
58 changed files with 3070 additions and 247 deletions

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<POU Name="FB_AxisSim" Id="{5b3e4e46-5ace-4e6c-a0dc-d55113a89212}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_AxisSim
VAR_INPUT
Enable : BOOL;
END_VAR
VAR_IN_OUT
Axis : ST_Axis;
END_VAR
VAR
tick : UDINT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF NOT Enable THEN
Axis.State := E_AxisState.Idle;
RETURN;
END_IF
tick := tick + 1;
// Ramp position + derive velocity so a subscription sees LREAL churn.
Axis.PositionMm := Axis.PositionMm + 0.5;
Axis.VelocityMps := 0.5 * SIN(UDINT_TO_LREAL(tick) * 0.05);
Axis.Accel := LREAL_TO_REAL(0.1 * COS(UDINT_TO_LREAL(tick) * 0.05));
Axis.State := E_AxisState.Moving;
// Motor block — keep values sane but moving.
Axis.Motor.Current := 2.5 + LREAL_TO_REAL(0.5 * SIN(UDINT_TO_LREAL(tick) * 0.1));
Axis.Motor.Voltage := 24.0;
Axis.Motor.Temperature:= 35.0 + 5.0 * SIN(UDINT_TO_LREAL(tick) * 0.01);
Axis.Motor.Rpm := 1500 + LREAL_TO_DINT(200.0 * SIN(UDINT_TO_LREAL(tick) * 0.05));
Axis.Motor.Running := TRUE;
// Encoder
Axis.Encoder.RawCounts := Axis.Encoder.RawCounts + 12;
Axis.Encoder.PositionMm := Axis.PositionMm;
Axis.Encoder.VelocityMmPerS := Axis.VelocityMps;
Axis.Encoder.Homed := TRUE;
// Travel log — rolling window of last 8 positions.
Axis.TravelLog[1] := Axis.TravelLog[2];
Axis.TravelLog[2] := Axis.TravelLog[3];
Axis.TravelLog[3] := Axis.TravelLog[4];
Axis.TravelLog[4] := Axis.TravelLog[5];
Axis.TravelLog[5] := Axis.TravelLog[6];
Axis.TravelLog[6] := Axis.TravelLog[7];
Axis.TravelLog[7] := Axis.TravelLog[8];
Axis.TravelLog[8] := Axis.PositionMm;
]]></ST>
</Implementation>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<POU Name="FB_LineSim" Id="{83bd0d62-650e-4191-9410-a31c2eb07c02}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_LineSim
VAR_IN_OUT
Line : ST_Line;
END_VAR
VAR
tick : UDINT;
axisSim : ARRAY[1..3, 1..4] OF FB_AxisSim;
iStation : INT;
iAxis : INT;
iAlarm : INT;
rotatorBits : DWORD;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[tick := tick + 1;
FOR iStation := 1 TO 3 DO
Line.Stations[iStation].Online := TRUE;
Line.Stations[iStation].Heartbeat := tick;
// Axes — delegate to FB_AxisSim for per-cycle motion.
FOR iAxis := 1 TO 4 DO
axisSim[iStation, iAxis](
Enable := Line.Running,
Axis := Line.Stations[iStation].Axes[iAxis]
);
END_FOR
// Rolling I/O patterns to give subscribers something to watch.
rotatorBits := SHL(DWORD#1, (tick MOD 32));
Line.Stations[iStation].IO.LastInputMask := rotatorBits;
Line.Stations[iStation].IO.LastOutputMask := NOT rotatorBits;
Line.Stations[iStation].IO.CycleCounter := tick;
// Flip a couple of DI/DOs so BOOL arrays see changes.
Line.Stations[iStation].IO.DigitalInputs[(tick MOD 32)] := NOT Line.Stations[iStation].IO.DigitalInputs[(tick MOD 32)];
Line.Stations[iStation].IO.DigitalOutputs[(tick MOD 32)] := Line.Stations[iStation].IO.DigitalInputs[(tick MOD 32)];
// Walk an analog channel through a sine.
Line.Stations[iStation].IO.AnalogInputs[0] := LREAL_TO_REAL(10.0 + 5.0 * SIN(UDINT_TO_LREAL(tick + UDINT#100 * UINT_TO_UDINT(INT_TO_UINT(iStation))) * 0.05));
Line.Stations[iStation].IO.AnalogOutputs[0] := Line.Stations[iStation].IO.AnalogInputs[0] * 2.0;
// Rotate one alarm per station so IAlarmSource has state transitions.
iAlarm := INT_TO_USINT(1 + (DINT_TO_INT(UDINT_TO_DINT(tick)) MOD 16));
Line.Stations[iStation].Alarms[iAlarm].Active := (tick MOD 32) >= 16;
Line.Stations[iStation].Alarms[iAlarm].Severity := E_Severity.Warning;
Line.Stations[iStation].Alarms[iAlarm].Code := 1000 + DINT(iAlarm);
Line.Stations[iStation].Alarms[iAlarm].Message := CONCAT('alarm-', TO_STRING(iAlarm));
Line.Stations[iStation].Alarms[iAlarm].Source := CONCAT('Station-', TO_STRING(iStation));
END_FOR
// Stats — monotonic production counters.
Line.Stats.UnitsProduced := Line.Stats.UnitsProduced + 1;
IF (tick MOD 100) = 0 THEN
Line.Stats.UnitsRejected := Line.Stats.UnitsRejected + 1;
Line.Stats.RejectReasons[1 + ((DINT_TO_INT(UDINT_TO_DINT(tick / 100))) MOD 5)] :=
Line.Stats.RejectReasons[1 + ((DINT_TO_INT(UDINT_TO_DINT(tick / 100))) MOD 5)] + 1;
END_IF
Line.Stats.UpTimeSeconds := tick / 100; // 10 ms task tick -> approx seconds
]]></ST>
</Implementation>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<POU Name="MAIN" Id="{eaceb1e4-5544-4368-a12f-3e05dd0be17a}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM MAIN
VAR
lineSim : FB_LineSim;
i : INT;
j : INT;
k : INT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Smoke-test contract: monotonic counter on GVL_Fixture.nCounter.
// See TwinCAT3SmokeTests.cs (Driver_reads_seeded_DINT_through_real_ADS +
// Driver_subscribe_receives_native_ADS_notifications_on_counter_changes).
GVL_Fixture.nCounter := GVL_Fixture.nCounter + 1;
// Drive the complex fixture.
lineSim(Line := GVL_Plant.Line1);
// Keep the standalone enum / alias globals churning so browse + subscribe
// tests against GVL_Enums see changes without reaching into GVL_Plant.
IF (GVL_Fixture.nCounter MOD 10) = 0 THEN
GVL_Enums.currentAxisState := GVL_Plant.Line1.Stations[1].Axes[1].State;
GVL_Enums.currentSeverity := E_Severity.Info;
GVL_Enums.cabinetTemperature := GVL_Plant.Line1.Stations[1].Axes[1].Motor.Temperature;
GVL_Enums.conveyorSpeed := GVL_Plant.Line1.Stations[1].Axes[1].VelocityMps;
END_IF
// Stir a 2-D / 3-D array entry so multi-rank subscribes see value churn.
i := 1 + (GVL_Fixture.nCounter MOD 4);
j := 1 + ((GVL_Fixture.nCounter / 4) MOD 4);
GVL_Arrays.aReal2D[i, j] := LREAL_TO_REAL(SIN(DINT_TO_LREAL(GVL_Fixture.nCounter) * 0.01));
k := GVL_Fixture.nCounter MOD 3;
GVL_Arrays.aDInt3D[k, k, k] := GVL_Fixture.nCounter;
GVL_Arrays.aInt1D[GVL_Fixture.nCounter MOD 10] := DINT_TO_INT(GVL_Fixture.nCounter MOD 10000);
]]></ST>
</Implementation>
</POU>
</TcPlcObject>