From fc58c1716a13b3d7f3068dd6ba3821c45c429d8a Mon Sep 17 00:00:00 2001 From: Roald Ruiter <98890535+rruiter87@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:13:16 +0200 Subject: [PATCH] add SetForceTask (#720) Co-authored-by: Roald Ruiter --- .../MotionTasks/SetForceTask.TcPOU | 207 ++++++++++++++++++ .../TcoDrivesBeckhoff.plcproj | 3 + 2 files changed, 210 insertions(+) create mode 100644 src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/SetForceTask.TcPOU diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/SetForceTask.TcPOU b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/SetForceTask.TcPOU new file mode 100644 index 000000000..7a43f7951 --- /dev/null +++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/POUs/Prototypes/TcoDriveSimple/MotionTasks/SetForceTask.TcPOU @@ -0,0 +1,207 @@ + + + + "} + _force_percent : LREAL; + {attribute addProperty Name "<#Velocity limit#>"} + _velocityLimit : LREAL; + {attribute addProperty Name "<#Torque ramp#>"} + _torqueRamp : LREAL; +END_VAR +VAR + {attribute 'hide'} + _axisRef : REFERENCE TO TcoAxisRef; + {attribute 'hide'} + _mcForceControl : Tc2_MC2.MC_TorqueControl; + {attribute 'hide'} + _forceOptions : Tc2_MC2.ST_TorqueControlOptions; + {attribute 'hide'} + _message : STRING(125); +END_VAR +]]> + + , + Active=>, + CommandAborted=>, + Error=>, + ErrorID=> + ); + + IF _mcForceControl.CommandAborted THEN + THIS^.Abort(); + END_IF + + DoneWhen(_mcForceControl.InTorque); + ThrowWhen(_mcForceControl.Error); +END_IF +]]> + + + + + + + + + + + + + + + + + + + + Executes when task is aborted. + + +~*) +METHOD PROTECTED OnAbort +]]> + + + + + + + + Executes when task reaches the ```Done``` state . + + +~*) +METHOD PROTECTED OnDone +]]> + + + + + + + + Executes when task reaches the ```Error``` state. + + Do not confuse with , that is called cyclically until '''Error''' state is left. + + + +~*) +METHOD PROTECTED OnError +]]> + + + + + + + + + + + + + + Restores this instance to the Ready state. Can be called explicitly or from within one of the restore mechanisms. + + See also + + + +~*) +METHOD Restore : ITcoRestorable +]]> + + + + + + + + Executes until task is in ```Error``` state . + + Do not confuse with , that is called just ones when '''Error''' state is entered. + + + +~*) +METHOD PROTECTED WhileError +]]> + + + + + + \ No newline at end of file diff --git a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj index dc03f8732..47c8a770a 100644 --- a/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj +++ b/src/TcoDrivesBeckhoff/src/XaeTcoDrivesBeckhoff/TcoDrivesBeckhoff/TcoDrivesBeckhoff.plcproj @@ -195,6 +195,9 @@ Code + + Code + Code