Merge branch 'master' into mbp-100-read-write-axis-parameters

This commit is contained in:
Luke Nisbet
2020-04-27 15:16:01 +01:00
8 changed files with 366 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4023.119">
<Project ProjectGUID="{9CF97348-B9D3-4938-B1F2-5F0B0B6AA66A}" TargetNetId="169.254.216.243.1.1" Target64Bit="true" ShowHideConfigurations="#x106">
<Project ProjectGUID="{9CF97348-B9D3-4938-B1F2-5F0B0B6AA66A}" TargetNetId="5.54.104.144.1.1" Target64Bit="true" ShowHideConfigurations="#x106">
<System>
<Licenses>
<Target>
@@ -28,6 +28,26 @@
<Comment><![CDATA[Outputs: Power for Limit switches and Home Sensors (every 4th output)]]></Comment>
<Type>BOOL</Type>
</Var>
<Var>
<Name>MAIN.bOutput5</Name>
<Type>BOOL</Type>
</Var>
<Var>
<Name>MAIN.bOutput13</Name>
<Type>BOOL</Type>
</Var>
<Var>
<Name>MAIN.bOutput17</Name>
<Type>BOOL</Type>
</Var>
<Var>
<Name>MAIN.bOutput21</Name>
<Type>BOOL</Type>
</Var>
<Var>
<Name>MAIN.bOutput24</Name>
<Type>BOOL</Type>
</Var>
</Vars>
<TaskPouOids>
<TaskPouOid Prio="20" OTCID="#x08502041"/>

View File

@@ -140,6 +140,191 @@
<v n="TextDefault">"Clear All"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"712"</v>
<v n="TextDefault">"eHomeBwdLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"530"</v>
<v n="TextDefault">"eHomeBwdToEncRef"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"386"</v>
<v n="TextDefault">"eHomeBwdToEncRef2speed"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"341"</v>
<v n="TextDefault">"eHomeBwdToEncRef2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"387"</v>
<v n="TextDefault">"eHomeBwdToLimit2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"964"</v>
<v n="TextDefault">"eHomeBwdToRef"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"35"</v>
<v n="TextDefault">"eHomeBwdToRef2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"650"</v>
<v n="TextDefault">"eHomeBwdToReference"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"480"</v>
<v n="TextDefault">"eHomeBwdToReference2speed"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"339"</v>
<v n="TextDefault">"eHomeBwdToReference2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"986"</v>
<v n="TextDefault">"ehomeDirect"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"328"</v>
<v n="TextDefault">"eHomeFwdToEncRef"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"125"</v>
<v n="TextDefault">"eHomeFwdToEncRef2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"484"</v>
<v n="TextDefault">"eHomeFwdToEncRef_viaFwdLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"374"</v>
<v n="TextDefault">"eHomeFwdToLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"851"</v>
<v n="TextDefault">"eHomeFwdToLimit2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"693"</v>
<v n="TextDefault">"eHomeBwdToLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"489"</v>
<v n="TextDefault">"eHomeBwdToLimit2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"445"</v>
<v n="TextDefault">"eHomeBwdToLimitspeeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"637"</v>
<v n="TextDefault">"eHomeFwdToLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"351"</v>
<v n="TextDefault">"eHomeFwdToLimit2speeds"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"198"</v>
<v n="TextDefault">"eHomeToEncPulse_Bwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"510"</v>
<v n="TextDefault">"eHomeToEncPulse_Fwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"287"</v>
<v n="TextDefault">"eHomeToEncPulse_viaBwdLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"683"</v>
<v n="TextDefault">"eHomeToEncPulse_viaFwdLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"535"</v>
<v n="TextDefault">"eHomeToEncRefBwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"367"</v>
<v n="TextDefault">"eHomeToEncRefFwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"358"</v>
<v n="TextDefault">"eHomeToEncRef_viaBwdLimi"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"740"</v>
<v n="TextDefault">"eHomeToEncRef_viaBwdLimit"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"689"</v>
<v n="TextDefault">"eHomeToLimitBwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"504"</v>
<v n="TextDefault">"eHomeToLimitFwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"312"</v>
<v n="TextDefault">"eHomeToLimit_Bwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"635"</v>
<v n="TextDefault">"eHomeToLimit_Fwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"432"</v>
<v n="TextDefault">"eHomeToRefBwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"285"</v>
<v n="TextDefault">"eHomeToRefFwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"150"</v>
<v n="TextDefault">"eHomeToRef_Bwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"861"</v>
<v n="TextDefault">"eHomeToRef_Fwd"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"104"</v>
<v n="TextDefault">"ENABLE"</v>
@@ -200,6 +385,21 @@
<v n="TextDefault">"fDeceleration"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"531"</v>
<v n="TextDefault">"fHomeFinishDistance"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"613"</v>
<v n="TextDefault">"fHomePosition"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"157"</v>
<v n="TextDefault">"fHomePositions"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"957"</v>
<v n="TextDefault">"fPosition"</v>
@@ -245,6 +445,11 @@
<v n="TextDefault">"gearOut"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"169"</v>
<v n="TextDefault">"homeDirect"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"566"</v>
<v n="TextDefault">"homeSensorNeg"</v>
@@ -315,6 +520,11 @@
<v n="TextDefault">"reset"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"611"</v>
<v n="TextDefault">"shomeDirect"</v>
<l n="LanguageTexts" t="ArrayList" />
</o>
<o>
<v n="TextID">"115"</v>
<v n="TextDefault">"stop"</v>

View File

@@ -131,7 +131,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
eCheckReadDone:
//Check the encoder reference system has been read for all axis -> if busy then continue with PLC cycle and check again next time.
//If afbReadEncRefSys not started then go back a step.
//If any axes result in an error the code will get stuck here, this happens if GVL_APP.nAxisNum is not set correctly
//If any axes result in an error the code will get stuck here, this happens if GVL_APP.nAXIS_NUM is not set correctly
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
IF afbReadEncRefSys[iAxes].Valid = FALSE THEN
IF afbReadEncRefSys[iAxes].Busy = TRUE THEN

View File

@@ -10,6 +10,15 @@ END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="mDisableAxis" Id="{22a3dd98-69f0-4b92-8109-1b0c2fe2344d}">
<Declaration><![CDATA[METHOD mDisableAxis: BOOL
VAR_INPUT
iAxisIndex: UINT; //The idex of the axis to action the method on.
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[GVL.astAxes[iAxisIndex].stControl.bEnable := FALSE;]]></ST>
</Implementation>
</Method>
<Method Name="mEnableAxis" Id="{12e91532-7139-4c17-998e-4c670b584b9d}">
<Declaration><![CDATA[METHOD mEnableAxis: BOOL
VAR_INPUT
@@ -28,6 +37,25 @@ END_VAR]]></Declaration>
<ST><![CDATA[GVL.astAxes[iAxisIndex].stControl.bExecute := TRUE;]]></ST>
</Implementation>
</Method>
<Method Name="mExecute_SetFALSE" Id="{cc074392-b19d-414a-9010-72a4fa4d5f7a}">
<Declaration><![CDATA[METHOD mExecute_SetFALSE: BOOL
VAR_INPUT
iAxisIndex: UINT; //The idex of the axis to action the method on.
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[GVL.astAxes[iAxisIndex].stControl.bExecute := TRUE;]]></ST>
</Implementation>
</Method>
<Method Name="mGearOut" Id="{65c5860b-0759-45a5-a8a4-27fe9453aa76}">
<Declaration><![CDATA[METHOD mGearOut : BOOL
VAR_INPUT
iAxis: UINT; // The idex of the axis to action the method on.
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[GVL.astAxes[iAxis].stControl.eCommand := E_MotionFunctions.eGearOut;]]></ST>
</Implementation>
</Method>
<Method Name="mPrepareDefaultMove" Id="{c23244d5-896c-49ad-8d8a-19390856e4dc}">
<Declaration><![CDATA[METHOD mPrepareDefaultMove
@@ -50,6 +78,36 @@ GVL.astAxes[iAxisIndex].stConfig.fOverride := tcUNIT_GVL.fDEFAULT_TARGET_OVERRID
GVL.astAxes[iAxisIndex].stConfig.fPosition := tcUNIT_GVL.fDEFAULT_POSITION;]]></ST>
</Implementation>
</Method>
<Method Name="mPrepareGearInMultiMaster" Id="{b94784af-8414-4f79-a0cd-7d3b82710c1e}">
<Declaration><![CDATA[METHOD mPrepareGearInMultiMaster
VAR_INPUT
iAxisIndex: UINT; // The idex of the axis to action the method on.
astGearAxis: ARRAY[1..4] OF ST_GearAxis;
END_VAR
VAR
i: UINT;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[// Prepare the axis so it is ready to be coupled
GVL.astAxes[iAxisIndex].stControl.eCommand := E_MotionFunctions.eGearInMultiMaster;
FOR i:= 1 TO tcUNIT_GVL.nMAX_MASTERS DO
GVL.astAxes[iAxisIndex].stConfig.astMultiMasterAxis[i].nIndex:=astGearAxis[i].nIndex;
GVL.astAxes[iAxisIndex].stConfig.astMultiMasterAxis[i].fRatio:=astGearAxis[i].fRatio;
END_FOR]]></ST>
</Implementation>
</Method>
<Method Name="mPrepareHome" Id="{29a1cce2-2fc4-48e1-86f6-27b6dd699cd2}">
<Declaration><![CDATA[METHOD mPrepareHome
VAR_INPUT
iAxisIndex: UINT; // The idex of the axis to action the method on.
eHomingRoutine: E_HomingRoutines;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[GVL.astAxes[iAxisIndex].stControl.eCommand := E_MotionFunctions.eHome;
GVL.astAxes[iAxisIndex].stConfig.eHomeSeq:= eHomingRoutine;]]></ST>
</Implementation>
</Method>
<Method Name="mPrepareMove" Id="{97bd5417-d0a1-4d32-8732-16310a863fcc}">
<Declaration><![CDATA[METHOD mPrepareMove
@@ -76,6 +134,26 @@ GVL.astAxes[iAxisIndex].stConfig.fDeceleration := fTargetDeceleration;
GVL.astAxes[iAxisIndex].stConfig.fPosition := fTargetPosition;]]></ST>
</Implementation>
</Method>
<Method Name="mReset" Id="{59e8bfe4-ab50-4ad3-9095-95e359837091}">
<Declaration><![CDATA[METHOD mReset : BOOL
VAR_INPUT
iAxisIndex: UINT; // The idex of the axis to action the method on.
END_VAR
VAR
iCycles: UINT;
iMaxCycles: UINT := 100;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[GVL.astAxes[iAxisIndex].stControl.bExecute := FALSE;
FOR iCycles:= 1 TO iMaxCycles DO
GVL.astAxes[iAxisIndex].stControl.bReset := TRUE;
IF GVL.astaxes[iAxisIndex].stStatus.bError := FALSE THEN
EXIT;
END_IF
END_FOR]]></ST>
</Implementation>
</Method>
<Method Name="mSetAxisDefaults" Id="{5b9336be-4414-4858-a614-0fdb2847e171}">
<Declaration><![CDATA[METHOD mSetAxisDefaults
@@ -118,19 +196,44 @@ GVL.astAxes[iAxisIndex].stInputs.bHomeSensor := FALSE;]]></ST>
<LineIds Name="FB_tcUNIT_common">
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mDisableAxis">
<LineId Id="5" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mEnableAxis">
<LineId Id="5" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mExecute">
<LineId Id="5" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mExecute_SetFALSE">
<LineId Id="5" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mGearOut">
<LineId Id="5" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mPrepareDefaultMove">
<LineId Id="44" Count="11" />
<LineId Id="19" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mPrepareGearInMultiMaster">
<LineId Id="6" Count="0" />
<LineId Id="56" Count="0" />
<LineId Id="72" Count="1" />
<LineId Id="75" Count="0" />
<LineId Id="74" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mPrepareHome">
<LineId Id="6" Count="0" />
<LineId Id="5" Count="0" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mPrepareMove">
<LineId Id="17" Count="11" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mReset">
<LineId Id="21" Count="0" />
<LineId Id="7" Count="0" />
<LineId Id="16" Count="4" />
</LineIds>
<LineIds Name="FB_tcUNIT_common.mSetAxisDefaults">
<LineId Id="50" Count="28" />
<LineId Id="26" Count="0" />

View File

@@ -14,6 +14,7 @@ fDEFAULT_TARGET_ACCELERATION: LREAL := 0.5;
fDEFAULT_TARGET_DECCELERATION: LREAL := 0.5;
fDEFAULT_TARGET_POSITION: LREAL := 10.0;
fDEFAULT_TARGET_OVERRIDE: LREAL := 100;
nMAX_MASTERS : UINT := 4;
END_VAR
VAR_GLOBAL

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<DUT Name="E_TestStates" Id="{fa5c3f3c-c558-44f1-8e4d-ea57c6a7bb8e}">
<Declaration><![CDATA[{attribute 'qualified_only'}
{attribute 'strict'}
TYPE E_TestStates :
(
eInitialiseTest := 0,
ePreparePreTestConditions := 1,
eExecutePreTestConditions := 2,
ePrepareTest := 3,
eExecuteTest := 4,
eWaitForResults := 5,
ePrepareFinishTest := 6,
eExecuteFinishTest := 7,
eReportFinishedTest := 8
);
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -93,7 +93,7 @@
<Compile Include="tc_mca_std_lib\POUs\Motion\FB_Axis.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\POUs\Motion\Homing\FB_HomeReadNcVelocities.TcPOU">
<Compile Include="tc_mca_std_lib\POUs\Motion\Homing\FB_ReadNcVelocities.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\POUs\Motion\Homing\FB_Homing.TcPOU">
@@ -115,9 +115,15 @@
<Compile Include="Test\common\FB_tcUNIT_common.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Test\common\FB_tcUNIT_GenericHomingTest.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="Test\common\tcUNIT_GVL.TcGVL">
<SubType>Code</SubType>
</Compile>
<Compile Include="Test\standard_library_tests\E_TestStates.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="Test\standard_library_tests\FB_Axis_TEST.TcPOU">
<SubType>Code</SubType>
</Compile>