From ad1f60a92db15480651b568a05f881dab9774f51 Mon Sep 17 00:00:00 2001 From: Markus Kristensson Date: Tue, 11 Nov 2025 08:46:47 +0100 Subject: [PATCH 01/16] MBP-247: Extend E_RestorePosition Adds an additional restore position state to E_RestorePosition. --- DUTs/E_RestorePosition.TcDUT | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT index 9f96adfd..088f598f 100644 --- a/DUTs/E_RestorePosition.TcDUT +++ b/DUTs/E_RestorePosition.TcDUT @@ -6,7 +6,8 @@ TYPE E_RestorePosition : ( eDontRestore :=0, - eRestoreWithoutHome := 1 //Redefined the position of the axis to that when the power was lost + eRestoreWithoutHome := 1, //Redefine the position of the axis to that when the power was lost + eRestoreWithHome := 2 //Redefine the position of the axis to that when the power was lost and home ); END_TYPE ]]> From a28bb3cd0aadafbd763702b8f1acb41cace51498 Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Fri, 6 Mar 2026 12:23:39 +0100 Subject: [PATCH 02/16] MBP-247: Add persistent time variable in the GVL Add persistent variable in the GVL to store the current date and time at shutdown. --- DUTs/Axis_Structures/ST_SwitchInfo.TcDUT | 4 ++-- GVLs/GVL.TcGVL | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DUTs/Axis_Structures/ST_SwitchInfo.TcDUT b/DUTs/Axis_Structures/ST_SwitchInfo.TcDUT index 3c1b831d..ba547a77 100644 --- a/DUTs/Axis_Structures/ST_SwitchInfo.TcDUT +++ b/DUTs/Axis_Structures/ST_SwitchInfo.TcDUT @@ -1,6 +1,6 @@  - + - + \ No newline at end of file diff --git a/GVLs/GVL.TcGVL b/GVLs/GVL.TcGVL index ba332f53..40d5f1e4 100644 --- a/GVLs/GVL.TcGVL +++ b/GVLs/GVL.TcGVL @@ -25,6 +25,7 @@ END_VAR VAR_GLOBAL PERSISTENT astAxesPersistent: ARRAY [1..GVL_APP.nAXIS_NUM] OF ST_AxisPersistent; + timeAtShutdownPersistent : DT; //Date and time when the CPU was powered off END_VAR ]]> From 5824a599afbc086663d06f1e572f3b707b8b255d Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Fri, 6 Mar 2026 12:41:49 +0100 Subject: [PATCH 03/16] MPB-247: Fix whitespace --- GVLs/GVL.TcGVL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GVLs/GVL.TcGVL b/GVLs/GVL.TcGVL index 40d5f1e4..b532928f 100644 --- a/GVLs/GVL.TcGVL +++ b/GVLs/GVL.TcGVL @@ -25,7 +25,7 @@ END_VAR VAR_GLOBAL PERSISTENT astAxesPersistent: ARRAY [1..GVL_APP.nAXIS_NUM] OF ST_AxisPersistent; - timeAtShutdownPersistent : DT; //Date and time when the CPU was powered off + timeAtShutdownPersistent: DT; //Date and time when the CPU was powered off END_VAR ]]> From 7334d3b5bb2ebd9c460609032a5c2f365e43f70d Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Thu, 26 Mar 2026 08:28:40 +0100 Subject: [PATCH 04/16] MBP-247: Add persistent variable Add homing status of axis before shutdown. --- DUTs/Axis_Structures/ST_AxisPersistent.TcDUT | 1 + DUTs/E_RestorePosition.TcDUT | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT b/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT index 85b947e7..740bce4e 100644 --- a/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT @@ -7,6 +7,7 @@ STRUCT fPositionAtShutdown: LREAL; //Position of the axis when the CPU was powered off fEncoderBiasAtShutdown: LREAL; //Encoder bias value when the CPU was powered off bMovingAtShutdown: BOOL; //Indicates if the axis was moving during the shutdown (True if moving, false otherwise) + bHomedAtShutdown: BOOL; //Homing status of the axis when the CPU was powered off END_STRUCT END_TYPE ]]> diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT index 088f598f..459e6da7 100644 --- a/DUTs/E_RestorePosition.TcDUT +++ b/DUTs/E_RestorePosition.TcDUT @@ -6,8 +6,8 @@ TYPE E_RestorePosition : ( eDontRestore :=0, - eRestoreWithoutHome := 1, //Redefine the position of the axis to that when the power was lost - eRestoreWithHome := 2 //Redefine the position of the axis to that when the power was lost and home + eRestoreWithoutHome := 1, //Restores the position of the axis to that when the power was lost + eRestoreWithHome := 2 // Restores the position of the axis to that when the power was lost and sets the home position to the restored position ); END_TYPE ]]> From 08a6735d9bebe4e4a33405f2f193f20e7833f806 Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 7 Apr 2026 08:47:34 +0200 Subject: [PATCH 05/16] MBP-247: Extend restore position --- DUTs/E_RestorePosition.TcDUT | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT index 459e6da7..4d6cb5de 100644 --- a/DUTs/E_RestorePosition.TcDUT +++ b/DUTs/E_RestorePosition.TcDUT @@ -5,9 +5,10 @@ {attribute 'strict'} TYPE E_RestorePosition : ( - eDontRestore :=0, - eRestoreWithoutHome := 1, //Restores the position of the axis to that when the power was lost - eRestoreWithHome := 2 // Restores the position of the axis to that when the power was lost and sets the home position to the restored position + eDontRestore := 0, + eRestoreWithoutHome := 1, //Restores the position of the axis to that when the power was lost (incremental) + eRestoreWithHome := 2, // Restores the position of the axis to that when the power was lost and sets the home calibration flag (incremental) + eRestorePositionBias := 3 //Restores position bias (absolute) ); END_TYPE ]]> From 79ccffa71c3a1c2b03542156b697e3bb075e4cfb Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 7 Apr 2026 08:48:13 +0200 Subject: [PATCH 06/16] MBP-247: Extend ST_AxisPersistent ST_AxisPersistent is extended to include axis status variables to be saved before power failure. --- DUTs/Axis_Structures/ST_AxisPersistent.TcDUT | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT b/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT index 740bce4e..0bcb3519 100644 --- a/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT @@ -8,6 +8,20 @@ STRUCT fEncoderBiasAtShutdown: LREAL; //Encoder bias value when the CPU was powered off bMovingAtShutdown: BOOL; //Indicates if the axis was moving during the shutdown (True if moving, false otherwise) bHomedAtShutdown: BOOL; //Homing status of the axis when the CPU was powered off + bInitialized: BOOL; //Initialized status of the axis when the CPU was powered off + + //Axis status variables + stMotionState: MC_AXISSTATES; + bError: BOOL; + nErrorID: UDINT; + bErrorStop: BOOL; + bStandStill: BOOL; + bHasBeenStopped: BOOL; + bMoving: BOOL; + fPositionDifference: LREAL; + bDisabled: BOOL; + + nCycles: ULINT; //Number of PLC cycles executed before shutdown END_STRUCT END_TYPE ]]> From 49e09a82617f01c04ff904d3c42c319d05828eea Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 7 Apr 2026 10:41:40 +0200 Subject: [PATCH 07/16] MBP-247: Remove enums E_RestorePosition Remove the enums eRestoreWithHome and eRestoreWithoutHome. --- DUTs/E_RestorePosition.TcDUT | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT index 4d6cb5de..f6d32d82 100644 --- a/DUTs/E_RestorePosition.TcDUT +++ b/DUTs/E_RestorePosition.TcDUT @@ -6,9 +6,8 @@ TYPE E_RestorePosition : ( eDontRestore := 0, - eRestoreWithoutHome := 1, //Restores the position of the axis to that when the power was lost (incremental) - eRestoreWithHome := 2, // Restores the position of the axis to that when the power was lost and sets the home calibration flag (incremental) - eRestorePositionBias := 3 //Restores position bias (absolute) + eRestorePosition := 1, //Restores the position of the axis to that when the power was lost (incremental) + eRestorePositionBias := 2 //Restores position bias (absolute) ); END_TYPE ]]> From 3a30e01062541a833a77a49e500f66a76115941c Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 7 Apr 2026 10:48:09 +0200 Subject: [PATCH 08/16] MBP-247: Remove persistent variables Only keep the persistent variables that are required for the position recovery. --- DUTs/Axis_Structures/ST_AxisPersistent.TcDUT | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT b/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT index 0bcb3519..c2b15cda 100644 --- a/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisPersistent.TcDUT @@ -8,20 +8,8 @@ STRUCT fEncoderBiasAtShutdown: LREAL; //Encoder bias value when the CPU was powered off bMovingAtShutdown: BOOL; //Indicates if the axis was moving during the shutdown (True if moving, false otherwise) bHomedAtShutdown: BOOL; //Homing status of the axis when the CPU was powered off - bInitialized: BOOL; //Initialized status of the axis when the CPU was powered off - - //Axis status variables - stMotionState: MC_AXISSTATES; - bError: BOOL; - nErrorID: UDINT; - bErrorStop: BOOL; - bStandStill: BOOL; - bHasBeenStopped: BOOL; - bMoving: BOOL; - fPositionDifference: LREAL; - bDisabled: BOOL; - - nCycles: ULINT; //Number of PLC cycles executed before shutdown + bInitializedAtShutdown: BOOL; //Initialized status of the axis when the CPU was powered off + fPositionDifferenceAtShutdown: LREAL; //Position difference between the sampled position and the position at shutdown END_STRUCT END_TYPE ]]> From 316a5c222a896ba38c59edaf23bd6717df401cd5 Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Wed, 22 Apr 2026 10:53:42 +0200 Subject: [PATCH 09/16] MBP-247: Create DUT for encoder reference system --- DUTs/E_EncoderRefSys.TcDUT | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 DUTs/E_EncoderRefSys.TcDUT diff --git a/DUTs/E_EncoderRefSys.TcDUT b/DUTs/E_EncoderRefSys.TcDUT new file mode 100644 index 00000000..0185f6eb --- /dev/null +++ b/DUTs/E_EncoderRefSys.TcDUT @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file From 19a8e8cb1da5f6e6f4e1b7351344ab7ea5f703ad Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Wed, 22 Apr 2026 10:55:28 +0200 Subject: [PATCH 10/16] MBP-247: Update E_RestorePosition Update the description of the E_RestorePosition in ST_AxisConfig and the DUT. --- DUTs/Axis_Structures/ST_AxisConfig.TcDUT | 2 +- DUTs/E_RestorePosition.TcDUT | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DUTs/Axis_Structures/ST_AxisConfig.TcDUT b/DUTs/Axis_Structures/ST_AxisConfig.TcDUT index bebc7820..4ba7b792 100644 --- a/DUTs/Axis_Structures/ST_AxisConfig.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisConfig.TcDUT @@ -12,7 +12,7 @@ STRUCT fHomePosition: LREAL := 0; //Position to set the axis to after completing the homing sequence fHomeFinishDistance: LREAL := 0; //Distance to move back into the working zone after homing is complete eHomeSeq: E_HomingRoutines; //Homing sequence routine to execute - eRestorePosition: E_RestorePosition; //Option to restore incremental axis position after power loss(0 = No, 1 = Yes) + eRestorePosition: E_RestorePosition; //Options for different restore modes bEnableStopWithAnyLimitSwitch: BOOL := TRUE; //Option to stop the axis when either the forward or backward limit switch is triggered //Advanced homing parameters diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT index f6d32d82..c4f50e8c 100644 --- a/DUTs/E_RestorePosition.TcDUT +++ b/DUTs/E_RestorePosition.TcDUT @@ -3,11 +3,12 @@ From fa2283e3e63a2e48897a7d5ad26d0200321e368c Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Wed, 22 Apr 2026 12:30:23 +0200 Subject: [PATCH 11/16] MBP-247: Add bAxisHasBeenRestored to ST_AxisStatus --- 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 fe4f65bd..782f6515 100644 --- a/DUTs/Axis_Structures/ST_AxisStatus.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisStatus.TcDUT @@ -5,6 +5,7 @@ STRUCT //Outputs & Status bAxisInitialized: BOOL := FALSE; //True when all parameters from actReadMcParameters are valid + bAxisHasBeenRestored: BOOL := FALSE;; bEnabled: BOOL; //Axis drive enabled bAxisReadyToMove: BOOL; //Axis enabled and input ok from additional equipment (e.g. airpad, brake). bCommandAborted: BOOL; //Command aborted output of the eCommand function blocks From b0d413bd481665879828725a01d608aa49d10e89 Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Thu, 23 Apr 2026 10:16:56 +0200 Subject: [PATCH 12/16] MBP-247: Fix typo --- DUTs/E_RestorePosition.TcDUT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT index c4f50e8c..833d6fcc 100644 --- a/DUTs/E_RestorePosition.TcDUT +++ b/DUTs/E_RestorePosition.TcDUT @@ -7,7 +7,7 @@ TYPE E_RestorePosition : ( eDontRestore := 0, - eRestorePosition := 1, //Restores the position of the axis to that when the power was lost (this restore mode is only valid for inremental encoders). + eRestorePosition := 1, //Restores the position of the axis to that when the power was lost (this restore mode is only valid for incremental encoders). eRestorePositionBias := 2 //Restores position bias (this restore mode is only valid for absolute encoders). ); END_TYPE From 1fa2066816d1dfae65e97824b5809a52d3b8f644 Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 28 Apr 2026 14:02:30 +0200 Subject: [PATCH 13/16] MBP-247: Remove enum restore positions Uses encoder reference system to decide restore type. Keeps only the check for whether restore is needed. --- DUTs/Axis_Structures/ST_AxisConfig.TcDUT | 2 +- DUTs/E_RestorePosition.TcDUT | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 DUTs/E_RestorePosition.TcDUT diff --git a/DUTs/Axis_Structures/ST_AxisConfig.TcDUT b/DUTs/Axis_Structures/ST_AxisConfig.TcDUT index 4ba7b792..b1e3b788 100644 --- a/DUTs/Axis_Structures/ST_AxisConfig.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisConfig.TcDUT @@ -12,7 +12,7 @@ STRUCT fHomePosition: LREAL := 0; //Position to set the axis to after completing the homing sequence fHomeFinishDistance: LREAL := 0; //Distance to move back into the working zone after homing is complete eHomeSeq: E_HomingRoutines; //Homing sequence routine to execute - eRestorePosition: E_RestorePosition; //Options for different restore modes + bRestorePosition: BOOL := TRUE; //Option to restore the position or not during a shutdown bEnableStopWithAnyLimitSwitch: BOOL := TRUE; //Option to stop the axis when either the forward or backward limit switch is triggered //Advanced homing parameters diff --git a/DUTs/E_RestorePosition.TcDUT b/DUTs/E_RestorePosition.TcDUT deleted file mode 100644 index 833d6fcc..00000000 --- a/DUTs/E_RestorePosition.TcDUT +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file From 2d5dad8a732a1d7e7845270222434fe73add7c5f Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 28 Apr 2026 14:14:55 +0200 Subject: [PATCH 14/16] MBP-247: Remove double semicolon Remove double semicolon from bAxisHasBeenRestored. --- DUTs/Axis_Structures/ST_AxisStatus.TcDUT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DUTs/Axis_Structures/ST_AxisStatus.TcDUT b/DUTs/Axis_Structures/ST_AxisStatus.TcDUT index 782f6515..24f616da 100644 --- a/DUTs/Axis_Structures/ST_AxisStatus.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisStatus.TcDUT @@ -5,7 +5,7 @@ STRUCT //Outputs & Status bAxisInitialized: BOOL := FALSE; //True when all parameters from actReadMcParameters are valid - bAxisHasBeenRestored: BOOL := FALSE;; + bAxisHasBeenRestored: BOOL := FALSE; bEnabled: BOOL; //Axis drive enabled bAxisReadyToMove: BOOL; //Axis enabled and input ok from additional equipment (e.g. airpad, brake). bCommandAborted: BOOL; //Command aborted output of the eCommand function blocks From 5cfafdf67de693d49025fb44ead3077ebdc0150a Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 28 Apr 2026 14:16:56 +0200 Subject: [PATCH 15/16] MBP-247: fix whitespace --- DUTs/Axis_Structures/ST_AxisConfig.TcDUT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DUTs/Axis_Structures/ST_AxisConfig.TcDUT b/DUTs/Axis_Structures/ST_AxisConfig.TcDUT index b1e3b788..175014bc 100644 --- a/DUTs/Axis_Structures/ST_AxisConfig.TcDUT +++ b/DUTs/Axis_Structures/ST_AxisConfig.TcDUT @@ -12,7 +12,7 @@ STRUCT fHomePosition: LREAL := 0; //Position to set the axis to after completing the homing sequence fHomeFinishDistance: LREAL := 0; //Distance to move back into the working zone after homing is complete eHomeSeq: E_HomingRoutines; //Homing sequence routine to execute - bRestorePosition: BOOL := TRUE; //Option to restore the position or not during a shutdown + bRestorePosition: BOOL := TRUE; //Option to restore the position or not during a shutdown bEnableStopWithAnyLimitSwitch: BOOL := TRUE; //Option to stop the axis when either the forward or backward limit switch is triggered //Advanced homing parameters From 99259876b09155084f3da52f15a7316dd4e0f33f Mon Sep 17 00:00:00 2001 From: aslanliafichev Date: Tue, 28 Apr 2026 14:48:10 +0200 Subject: [PATCH 16/16] MBP-247: Change name to follow PLCOpen standard --- GVLs/GVL.TcGVL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GVLs/GVL.TcGVL b/GVLs/GVL.TcGVL index b532928f..5bca2652 100644 --- a/GVLs/GVL.TcGVL +++ b/GVLs/GVL.TcGVL @@ -25,7 +25,7 @@ END_VAR VAR_GLOBAL PERSISTENT astAxesPersistent: ARRAY [1..GVL_APP.nAXIS_NUM] OF ST_AxisPersistent; - timeAtShutdownPersistent: DT; //Date and time when the CPU was powered off + dtAtShutdownPersistent: DT; //Date and time when the CPU was powered off END_VAR ]]>