From 5399e85127f28a2fb0a609d8380690620a6f685d Mon Sep 17 00:00:00 2001 From: Federico Rojas Date: Mon, 23 Mar 2020 15:13:51 +0100 Subject: [PATCH] Update refrences from GVL variable aAxes to astAxes --- solution/tc_project_app/POUs/MAIN.TcPOU | 31 ++++--- .../Test/common/FB_tcUNIT_common.TcPOU | 82 +++++++++---------- .../standard_library_tests/FB_Axis_TEST.TcPOU | 28 +++---- 3 files changed, 70 insertions(+), 71 deletions(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index a92e36b..248bc6e 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -43,7 +43,7 @@ AXES();]]> @@ -80,8 +80,7 @@ END_IF]]> - 0 THEN - aAxesPersistent[iAxes].bMovingAtShutdown := TRUE; + astAxesPersistent[iAxes].fPositionAtShutdown := GVL.astAxes[iAxes].Axis.NcToPlc.ActPos; + IF GVL.astAxes[iAxes].Axis.NcToPlc.ActVelo <> 0 THEN + astAxesPersistent[iAxes].bMovingAtShutdown := TRUE; ELSE - aAxesPersistent[iAxes].bMovingAtShutdown := FALSE; + astAxesPersistent[iAxes].bMovingAtShutdown := FALSE; END_IF - aAxesPersistent[iAxes].bMovingAtShutdown := aAxesPersistent[iAxes].bMovingAtShutdown OR GVL.aAxes[iAxes].Axis.Status.Moving; + astAxesPersistent[iAxes].bMovingAtShutdown := astAxesPersistent[iAxes].bMovingAtShutdown OR GVL.astAxes[iAxes].Axis.Status.Moving; END_FOR]]> @@ -225,7 +224,7 @@ END_FOR]]> - + diff --git a/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU b/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU index 8b6c22a..45b66bc 100644 --- a/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU +++ b/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU @@ -16,7 +16,7 @@ VAR_INPUT iAxisIndex: UINT; // The idex of the axis to action the method on. END_VAR]]> - + @@ -25,7 +25,7 @@ VAR_INPUT iAxisIndex: UINT; // The idex of the axis to action the method on. END_VAR]]> - + @@ -37,17 +37,17 @@ END_VAR]]> +GVL.astAxes[iAxisIndex].stConfig.fVelocity := tcUNIT_GVL.fDEFAULT_TARGET_VELOCITY; +GVL.astAxes[iAxisIndex].stConfig.fAcceleration := tcUNIT_GVL.fDEFAULT_TARGET_ACCELERATION; +GVL.astAxes[iAxisIndex].stConfig.fDeceleration := tcUNIT_GVL.fDEFAULT_TARGET_DECCELERATION; +GVL.astAxes[iAxisIndex].stConfig.fOverride := tcUNIT_GVL.fDEFAULT_TARGET_OVERRIDE; +GVL.astAxes[iAxisIndex].stConfig.fPosition := tcUNIT_GVL.fDEFAULT_POSITION;]]> @@ -64,16 +64,16 @@ END_VAR]]> +GVL.astAxes[iAxisIndex].stConfig.fVelocity := fTargetVelocity; +GVL.astAxes[iAxisIndex].stConfig.fAcceleration := fTargetAcceleration; +GVL.astAxes[iAxisIndex].stConfig.fDeceleration := fTargetDeceleration; +GVL.astAxes[iAxisIndex].stConfig.fPosition := fTargetPosition;]]> @@ -85,34 +85,34 @@ END_VAR]]> +GVL.astAxes[iAxisIndex].stInputs.bLimitBwd := FALSE; +GVL.astAxes[iAxisIndex].stInputs.bLimitFwd := FALSE; +GVL.astAxes[iAxisIndex].stInputs.bHomeSensor := FALSE;]]> diff --git a/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU b/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU index eb8f5cc..9166d5a 100644 --- a/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU +++ b/solution/tc_project_app/Test/standard_library_tests/FB_Axis_TEST.TcPOU @@ -34,7 +34,7 @@ ExpectedResult := TRUE; fbCommon.mPrepareDefaultMove(iTargetAxis); fbCommon.mExecute(iTargetAxis); -Result := GVL.aAxes[iTargetAxis].stStatus.bBusy; +Result := GVL.astAxes[iTargetAxis].stStatus.bBusy; IF nCycle > nMaxCycles OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, @@ -63,14 +63,14 @@ END_VAR]]> // a previous test. Therefore if we execute a move we should just check it's moved // from the initial location not some initial default. -InitialValue := GVL.aAxes[iTargetAxis].stConfig.fPosition; +InitialValue := GVL.astAxes[iTargetAxis].stConfig.fPosition; ExpectedResult := InitialValue + 10; -GVL.aAxes[iTargetAxis].stConfig.fPosition := ExpectedResult; +GVL.astAxes[iTargetAxis].stConfig.fPosition := ExpectedResult; -GVL.aAxes[iTargetAxis].stControl.eCommand := E_MotionFunctions.eMoveAbsolute; -GVL.aAxes[iTargetAxis].stControl.bExecute := TRUE; +GVL.astAxes[iTargetAxis].stControl.eCommand := E_MotionFunctions.eMoveAbsolute; +GVL.astAxes[iTargetAxis].stControl.bExecute := TRUE; -Result := GVL.aAxes[iTargetAxis].stStatus.fActPosition; +Result := GVL.astAxes[iTargetAxis].stStatus.fActPosition; IF nCycle > nCycleMax OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, @@ -97,7 +97,7 @@ END_VAR]]> ExpectedResult := tcUNIT_gvl.fDEFAULT_TARGET_ACCELERATION; fbCommon.mPrepareDefaultMove(iTargetAxis); -Result := GVL.aAxes[iTargetAxis].stConfig.fAcceleration; +Result := GVL.astAxes[iTargetAxis].stConfig.fAcceleration; AssertEquals(Expected := ExpectedResult, Actual := Result, @@ -121,9 +121,9 @@ END_VAR]]> // example of test that requires multiple cycles to complete. Due to stateful behaviour of the axis structure. ExpectedResult := TRUE; -GVL.aAxes[iTargetAxis].stControl.bEnable := ExpectedResult; +GVL.astAxes[iTargetAxis].stControl.bEnable := ExpectedResult; -Result := GVL.aAxes[iTargetAxis].stStatus.bEnabled; +Result := GVL.astAxes[iTargetAxis].stStatus.bEnabled; IF nCycle > nMaxCycles OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, @@ -150,11 +150,11 @@ END_VAR]]> // Example of using a tcUNIT assert for a specific type (in this case LREAL). -InitialValue := GVL.aAxes[iTargetAxis].stConfig.fVelocity; +InitialValue := GVL.astAxes[iTargetAxis].stConfig.fVelocity; ExpectedResult := InitialValue + 0.5; -GVL.aAxes[iTargetAxis].stConfig.fVelocity := ExpectedResult; +GVL.astAxes[iTargetAxis].stConfig.fVelocity := ExpectedResult; -Result := GVL.aAxes[iTargetAxis].stConfig.fVelocity; +Result := GVL.astAxes[iTargetAxis].stConfig.fVelocity; AssertEquals_LREAL(Expected := ExpectedResult, Actual := Result, @@ -178,9 +178,9 @@ END_VAR]]> ExpectedResult := TRUE; -GVL.aAxes[iTargetAxis].stInputs.bLimitFwd := TRUE; +GVL.astAxes[iTargetAxis].stInputs.bLimitFwd := TRUE; -Result := GVL.aAxes[iTargetAxis].stStatus.bFwEnabled; +Result := GVL.astAxes[iTargetAxis].stStatus.bFwEnabled; IF nCycle > nMaxCycles OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult,