Files
lmxopcua/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.IntegrationTests/TwinCatProject/PLC/POUs/FB_AxisSim.TcPOU
Joseph Doherty a25593a9c6 chore: organize solution into module folders (Core/Server/Drivers/Client/Tooling)
Group all 69 projects into category subfolders under src/ and tests/ so the
Rider Solution Explorer mirrors the module structure. Folders: Core, Server,
Drivers (with a nested Driver CLIs subfolder), Client, Tooling.

- Move every project folder on disk with git mv (history preserved as renames).
- Recompute relative paths in 57 .csproj files: cross-category ProjectReferences,
  the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external
  mxaccessgw refs in Driver.Galaxy and its test project.
- Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders.
- Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL,
  integration, install).

Build green (0 errors); unit tests pass. Docs left for a separate pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 01:55:28 -04:00

55 lines
1.8 KiB
XML

<?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>