From ea089b4f517e0545c3ced7993e1a48e074aa2869 Mon Sep 17 00:00:00 2001 From: Markus Kristensson Date: Wed, 5 Nov 2025 10:15:22 +0100 Subject: [PATCH 1/5] Create external setpoint structure Creates an external setpoint structure to facilitate operating an external setpoint generator. --- DUTs/Axis_Structures/ST_ExternalSetpoint.TcDUT | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 DUTs/Axis_Structures/ST_ExternalSetpoint.TcDUT diff --git a/DUTs/Axis_Structures/ST_ExternalSetpoint.TcDUT b/DUTs/Axis_Structures/ST_ExternalSetpoint.TcDUT new file mode 100644 index 00000000..d5a5ed16 --- /dev/null +++ b/DUTs/Axis_Structures/ST_ExternalSetpoint.TcDUT @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file From 564facc5342a7e11fe10671079ea104b5bbd3db5 Mon Sep 17 00:00:00 2001 From: Markus Kristensson Date: Wed, 5 Nov 2025 10:16:05 +0100 Subject: [PATCH 2/5] Add external setpoint parameters to ST_AxisControl Includes the external setpoint structure to the ST_AxisControl structure. Creates a new variable to control the start/stop of the external setpoint generator. --- DUTs/Axis_Structures/ST_AxisControl.TcDUT | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DUTs/Axis_Structures/ST_AxisControl.TcDUT b/DUTs/Axis_Structures/ST_AxisControl.TcDUT index ebb7a9ec..f3c7076e 100644 --- a/DUTs/Axis_Structures/ST_AxisControl.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisControl.TcDUT @@ -25,6 +25,8 @@ STRUCT bAirpadManualControl: BOOL := FALSE; //Allow manual control airpad bAirpadManualPressureOn: BOOL := FALSE; //Pressurize airpad manually bReleaseBrake AT %Q*: BOOL; //Output from method controlling brake + stExternalSetpoint: ST_ExternalSetpoint; //Input structure mapped to external setpoint feed + bEnableSetPointGen: BOOL := FALSE; //Enable external setpoint generator END_STRUCT END_TYPE ]]> From 77ad806dd48804496588987b0c2cafd9fe5e6605 Mon Sep 17 00:00:00 2001 From: Markus Kristensson Date: Wed, 5 Nov 2025 10:18:55 +0100 Subject: [PATCH 3/5] Add external setpoint generator status variable Adds a status variable to indicate if the external setpoint generator is ready to be feed. --- DUTs/Axis_Structures/ST_AxisStatus.TcDUT | 1 + 1 file changed, 1 insertion(+) diff --git a/DUTs/Axis_Structures/ST_AxisStatus.TcDUT b/DUTs/Axis_Structures/ST_AxisStatus.TcDUT index 1292791c..4c3c91d5 100644 --- a/DUTs/Axis_Structures/ST_AxisStatus.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisStatus.TcDUT @@ -47,6 +47,7 @@ STRUCT bCommandHandlerBufferingCommand: BOOL; //True if CommandHandler is waiting on a permit before releasing the command bCommandHandlerTimeoutError: BOOL; //True if CommandHandler did not receive a permit in time eInternalMotionCommand: E_MotionFunctions; + bExternalSetpointGeneratorEnabled: BOOL; //True if external setpoint generator enabled. END_STRUCT END_TYPE ]]> From e4e5a88d185ab2cd0ccf813e3d00e91fced7e3a3 Mon Sep 17 00:00:00 2001 From: Markus Kristensson Date: Wed, 5 Nov 2025 10:24:14 +0100 Subject: [PATCH 4/5] Declare function blocks Declares the Beckhoff function blocks related to the external setpoint generator. --- POUs/Motion/FB_Axis.TcPOU | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/POUs/Motion/FB_Axis.TcPOU b/POUs/Motion/FB_Axis.TcPOU index 4689df3d..faee3ef8 100644 --- a/POUs/Motion/FB_Axis.TcPOU +++ b/POUs/Motion/FB_Axis.TcPOU @@ -55,6 +55,10 @@ VAR fbGearOut: MC_GearOut; stMcStatusGearOut: ST_McStatus; + fbExtSetPointGenEnable: MC_ExtSetPointGenEnable; + fbExtSetPointGenDisable: MC_ExtSetPointGenDisable; + eExtSetPointGen: (STANDBY, ENABLE_GEN, ENABLED, DISABLE_GEN); + stMasterAxis: ST_GearAxis := (nIndex := 1, fRatio := 0); nSlaveAxesIndex: UINT; nAxisIndex: UINT; From 1ba9835d62d490d46b25f5b3858f0315d7998800 Mon Sep 17 00:00:00 2001 From: Markus Kristensson Date: Wed, 5 Nov 2025 10:39:27 +0100 Subject: [PATCH 5/5] Implement external setpoint generator control Implements the external setpoint generator method to facilitate motion control using an external setpoint generator. Adds a call to the method in FB_Axis.Run(). --- POUs/Motion/FB_Axis.TcPOU | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/POUs/Motion/FB_Axis.TcPOU b/POUs/Motion/FB_Axis.TcPOU index faee3ef8..16c386bb 100644 --- a/POUs/Motion/FB_Axis.TcPOU +++ b/POUs/Motion/FB_Axis.TcPOU @@ -615,6 +615,76 @@ bReady := AND _stAxis.stInputs.bBrakeReleased) OR NOT _stAxis.stConfig.stAirpadBrake.bExternalBrakeFeedbackConnected); mControl_ExternalBrake := bEnableAmp; +]]> + + + + + + = 0 THEN + nDirection := 1; +ELSE + nDirection := -1; +END_IF + +fbExtSetPointGenEnable(Axis := _stAxis.Axis); +fbExtSetPointGenDisable(Axis := _stAxis.Axis); + +MC_ExtSetPointGenFeed( + Axis := _stAxis.Axis, + Position := _stAxis.stControl.stExternalSetpoint.fPosition, + Velocity := _stAxis.stControl.stExternalSetpoint.fVelocity, + Acceleration := _stAxis.stControl.stExternalSetpoint.fAcceleration, + Direction := nDirection); + +stAxis.stStatus.bExternalSetpointGeneratorEnabled := eExtSetPointGen = ENABLED; ]]> @@ -1812,6 +1882,7 @@ stMcStatusHalt := mMove_Halt(); stMcStatusStop := mMove_Stop(); stMcStatusReset := mControl_Reset(); +mControl_ExtSetPointGen(); stMcStatusMoveAbsolute := mMove_MoveAbsolute(); stMcStatusMoveRelative := mMove_MoveRelative(); stMcStatusMoveModulo := mMove_MoveModulo();