From 803996ad3a01f75324bd3491fd3b5f00b9b1f6fa Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 12 Jun 2024 20:28:59 +0200
Subject: [PATCH] [NEW-FEATURE] Add MC_TorqueControl (#722)
---
.../Properties/Localizations.resx | 30 +++++
.../DUTs/TcoAxisConfig.TcDUT | 2 +
.../MotionTasks/MoveVelocityTask.TcPOU | 11 ++
...SetForceTask.TcPOU => SetTorqueTask.TcPOU} | 125 ++++++++++++------
.../TcoDriveSimple/TcoDriveSimple.TcPOU | 39 +++++-
.../TcoDrivesBeckhoff.plcproj | 2 +-
.../XaeTcoDrivesBeckhoff.tsproj | 2 +-
7 files changed, 167 insertions(+), 44 deletions(-)
rename src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/{SetForceTask.TcPOU => SetTorqueTask.TcPOU} (60%)
diff --git a/src/TcoDrivesBeckhoff/src/TcoDrivesBeckhoffConnector/Properties/Localizations.resx b/src/TcoDrivesBeckhoff/src/TcoDrivesBeckhoffConnector/Properties/Localizations.resx
index 1e6af784e..0ed5aa985 100644
--- a/src/TcoDrivesBeckhoff/src/TcoDrivesBeckhoffConnector/Properties/Localizations.resx
+++ b/src/TcoDrivesBeckhoff/src/TcoDrivesBeckhoffConnector/Properties/Localizations.resx
@@ -228,6 +228,30 @@
Distance
+
+ Torque/Force
+
+
+ Relative
+
+
+ Velocity limit high
+
+
+ Velocity limit low
+
+
+ Continuous update
+
+
+ Torque ramp
+
+
+ Torque Options: Enable Manual Torque Start value
+
+
+ Torque Options:Manual Torque Start value
+
Power enable
@@ -303,6 +327,9 @@
Jogging
+
+ Force/Torque
+
Move velocity
@@ -384,6 +411,9 @@
Hide MoveVelocity Tab
+
+ Hide SetTorque Tab
+
Override velocity in service [%]
diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/DUTs/TcoAxisConfig.TcDUT b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/DUTs/TcoAxisConfig.TcDUT
index 5cf2a6232..578db8639 100644
--- a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/DUTs/TcoAxisConfig.TcDUT
+++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/DUTs/TcoAxisConfig.TcDUT
@@ -24,6 +24,8 @@
HideMoveModulo : BOOL;
{attribute addProperty Name "<#Hide MoveVelocity Tab#>"}
HideMoveVelocity : BOOL;
+ {attribute addProperty Name "<#Hide SetTorque Tab#>"}
+ HideSetTorque : BOOL;
{attribute addProperty Name "<#Override velocity in service [%]#>"}
OverrideInService : LREAL;
diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/MoveVelocityTask.TcPOU b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/MoveVelocityTask.TcPOU
index 8f6b296df..0d630526a 100644
--- a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/MoveVelocityTask.TcPOU
+++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/MoveVelocityTask.TcPOU
@@ -90,6 +90,17 @@ END_VAR]]>
+
+
+
+
+
+
+
+
+
-
-
+ "}
- _force_percent : LREAL;
- {attribute addProperty Name "<#Velocity limit#>"}
- _velocityLimit : LREAL;
+ {attribute addProperty Name "<#Torque/Force#>"}
+ _torque : LREAL;
+ {attribute addProperty Name "<#Relative#>"}
+ _relative : BOOL;
+ {attribute addProperty Name "<#Velocity limit high#>"}
+ _velocityLimitHigh : LREAL;
+ {attribute addProperty Name "<#Velocity limit low#>"}
+ _velocityLimitLow : LREAL;
+ {attribute addProperty Name "<#Continuous update#>"}
+ _continuousUpdate: BOOL:=TRUE;
{attribute addProperty Name "<#Torque ramp#>"}
_torqueRamp : LREAL;
+ {attribute addProperty Name "<#Torque Options: Enable Manual Torque Start value #>"}
+ _enableManualTorqueStartValue : BOOL;
+ {attribute addProperty Name "<#Torque Options:Manual Torque Start value#>"}
+ _manualTorqueStartValue : LREAL;
+
+
END_VAR
VAR
{attribute 'hide'}
_axisRef : REFERENCE TO TcoAxisRef;
{attribute 'hide'}
- _mcForceControl : Tc2_MC2.MC_TorqueControl;
- {attribute 'hide'}
- _forceOptions : Tc2_MC2.ST_TorqueControlOptions;
+ _mcTorqueControl : Tc2_MC2.MC_TorqueControl;
+ {attribute 'hide'}
+ _torqueOptions : Tc2_MC2.ST_TorqueControlOptions;
{attribute 'hide'}
_message : STRING(125);
END_VAR
@@ -30,32 +45,40 @@ END_VAR
END_IF
END_IF
+
IF Execute() THEN
- _forceOptions.EnableManualTorqueStartValue := TRUE;
- _forceOptions.ManualTorqueStartValue := _axisRef.NcToPlc.ActTorque;
- _mcForceControl(
- Axis:=_axisRef,
- Execute:=NOT _mcForceControl.Busy,
- Torque:=_force_percent,
- BufferMode:=Tc2_MC2.MC_Aborting,
- ContinuousUpdate:=TRUE,
- Options:=_forceOptions,
- TorqueRamp:=_torqueRamp,
- VelocityLimitHigh:=_velocityLimit,
- VelocityLimitLow:=_velocityLimit * -1,
- Busy=>,
- Active=>,
- CommandAborted=>,
- Error=>,
- ErrorID=>
- );
+
+IF inIsServiceMode AND _enableManualTorqueStartValue THEN
+ _torqueOptions.EnableManualTorqueStartValue:=_enableManualTorqueStartValue;
+ _torqueOptions.ManualTorqueStartValue:=_manualTorqueStartValue;
+END_IF;
+
+_mcTorqueControl(
+ Axis:=_axisRef ,
+ Execute:=NOT _mcTorqueControl.Busy ,
+ ContinuousUpdate:=_continuousUpdate ,
+ Relative:= _relative,
+ Torque:= _torque ,
+ TorqueRamp:= _torqueRamp ,
+ VelocityLimitHigh:= _velocityLimitHigh,
+ VelocityLimitLow:= _velocityLimitLow,
+ BufferMode:= Tc2_MC2.MC_Aborting ,
+ Options:=_torqueOptions ,
+ InTorque=> ,
+ Busy=> ,
+ Active=> ,
+ CommandAborted=> ,
+ Error=> ,
+ ErrorId=> );
+
- IF _mcForceControl.CommandAborted THEN
+
+ IF _mcTorqueControl.CommandAborted THEN
THIS^.Abort();
END_IF
- DoneWhen(_mcForceControl.InTorque);
- ThrowWhen(_mcForceControl.Error);
+ DoneWhen(_mcTorqueControl.InTorque);
+ ThrowWhen(_mcTorqueControl.Error);
END_IF
]]>
@@ -75,18 +98,38 @@ END_IF
+
+
+
+
+
+
+
+
+
+
+ ]]>
-
@@ -111,7 +154,7 @@ METHOD PROTECTED OnAbort
END_IF
THIS^.DriveRef.Stop(-1, -1);
-_mcForceControl(Axis:=_axisRef, Execute:=FALSE);
+_mcTorqueControl(Axis:=_axisRef, Execute:=FALSE);
THIS^.DriveRef._movementState.Restore();
]]>
@@ -127,7 +170,7 @@ THIS^.DriveRef._movementState.Restore();
METHOD PROTECTED OnDone
]]>
-
@@ -152,7 +195,7 @@ IF NOT _axisRef.Status.Error THEN
DriveRef.SetErrorID(DriveRef._axisStatus.ErrorId);
END_IF
-_mcForceControl(Axis:=_axisRef, Execute:=FALSE);
+_mcTorqueControl(Axis:=_axisRef, Execute:=FALSE);
]]>
@@ -160,7 +203,7 @@ _mcForceControl(Axis:=_axisRef, Execute:=FALSE);
-
@@ -197,8 +240,8 @@ METHOD PROTECTED WhileError
]]>
diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/TcoDriveSimple.TcPOU b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/TcoDriveSimple.TcPOU
index 9849b8324..018002acb 100644
--- a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/TcoDriveSimple.TcPOU
+++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/TcoDriveSimple.TcPOU
@@ -48,6 +48,8 @@ VAR
_homeTask : HomeTask(THIS^);
{attribute addProperty Name "<#Jogging#>"}
_jog : Jog(THIS^);
+ {attribute addProperty Name "<#Force/Torque#>"}
+ _torqueTask : SetTorqueTask(THIS^);
{attribute addProperty Name "<#Move velocity#>"}
_moveVelocityTask : MoveVelocityTask(THIS^);
{attribute addProperty Name "<#Stop#>"}
@@ -75,6 +77,7 @@ END_IF
_axisRef REF= inoAxisRef;
+
_mcReadStatus(Axis := _axisRef, Enable := TRUE);
UpdateAxisStatus();
@@ -103,6 +106,7 @@ _haltTask();
_moveRelativeTask();
_moveAbsoluteTask();
_moveModuloTask();
+_torqueTask(inIsServiceMode:= THIS^.IsService);
IF(_axisStatus.Error) THEN Messenger.Error(_sb.Clear().Append('<#Drive error no #>').Append(UDINT_TO_STRING(_axisStatus.ErrorId)).Append(' |[[0]AdvancedDiagnosticMessage]|').Append('.').Append('For details see the service mode').ToString()); END_IF;
@@ -463,7 +467,8 @@ _haltTask.Restore();
_moveRelativeTask.Restore();
_moveAbsoluteTask.Restore();
_moveModuloTask.Restore();
-_movementState.Restore();]]>
+_movementState.Restore();
+_torqueTask.Restore();]]>
@@ -513,6 +518,38 @@ END_VAR]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj
index 47c8a770a..f67993741 100644
--- a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj
+++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj
@@ -195,7 +195,7 @@
Code
-
+
Code
diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/XaeTcoDrivesBeckhoff.tsproj b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/XaeTcoDrivesBeckhoff.tsproj
index 3d073fd03..bf73b8e3c 100644
--- a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/XaeTcoDrivesBeckhoff.tsproj
+++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/XaeTcoDrivesBeckhoff.tsproj
@@ -2797,7 +2797,7 @@ External Setpoint Generation:
-
+
TcoDrivesBeckhoffTests Instance
{08500001-0000-0000-F000-000000000064}