From 47199a6a16d1cf9f62ead50587e618f329d36cb0 Mon Sep 17 00:00:00 2001 From: Federico Rojas Date: Wed, 18 Mar 2020 15:34:23 +0100 Subject: [PATCH] Change all DUT's variable names and references after merge with MBP-138 --- solution/tc_project_app/POUs/MAIN.TcPOU | 10 +-- .../Test/common/FB_tcUNIT_common.TcPOU | 82 +++++++++---------- .../standard_library_tests/FB_Axis_TEST.TcPOU | 28 +++---- solution/tc_project_app/tc_mca_std_lib | 2 +- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index 2da765a..aead7a4 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -83,7 +83,7 @@ END_IF]]> // This ACT will restore the position of an incremental axis on startup with the act position it read before losing power. // It checks the type of axis, 0=incremental, and that the axis was stationary at shut down. // Because 0 equates to incremental we also need to check that the data is valid, otherwise by default it would restore all axes. -// By default an axis will not restore the position unless it is set to opt-in, i.e. gvl.aAxes[GVL.iAxis].config.eRestorePosition is non-zero. +// By default an axis will not restore the position unless it is set to opt-in, i.e. gvl.aAxes[GVL.iAxis].stConfig.eRestorePosition is non-zero. // This needs to be initialised somewhere in TwinCAT code otherwise it will not be available at start up. // A restore will only be performed on a loss of power, this code shouldn't make any changes on a reset cold, a rest origin or a download. // There is a enum to allow for different types of restore modes, currently only one is implemented. @@ -116,7 +116,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN aFbRestorePosition[GVL.iAxis]( Axis := gvl.aAxes[GVL.iAxis].Axis, Execute := , - Position := aAxesPersistent[GVL.iAxis].iPositionAtShutdown); + Position := aAxesPersistent[GVL.iAxis].fPositionAtShutdown); END_FOR CASE eStartUp OF @@ -159,7 +159,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN // Execute position restore by setting aFbRestorePosition.execute = TRUE FOR GVL.iAxis:= 1 TO gvl_app.nAxisNum DO IF aFbReadEncRefSys[GVL.iAxis].Valid = TRUE AND aFbReadEncRefSys[GVL.iAxis].Value = 0 AND NOT(aAxesPersistent[GVL.iAxis].bMovingAtShutdown) THEN - IF GVL.aAxes[GVL.iAxis].config.eRestorePosition = E_RestorePosition.RestoreWithoutHome THEN + IF GVL.aAxes[GVL.iAxis].stConfig.eRestorePosition = E_RestorePosition.RestoreWithoutHome THEN aFbRestorePosition[GVL.iAxis].Execute := TRUE; END_IF END_IF @@ -172,7 +172,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN // bPositionRestoreDone will never get set to TRUE and will take up cycle time FOR GVL.iAxis:= 1 TO gvl_app.nAxisNum DO IF aFbReadEncRefSys[GVL.iAxis].Valid = TRUE AND aFbReadEncRefSys[GVL.iAxis].Value = 0 AND NOT(aAxesPersistent[GVL.iAxis].bMovingAtShutdown) THEN - IF GVL.aAxes[GVL.iAxis].config.eRestorePosition = E_RestorePosition.RestoreWithoutHome THEN + IF GVL.aAxes[GVL.iAxis].stConfig.eRestorePosition = E_RestorePosition.RestoreWithoutHome THEN IF NOT aFbRestorePosition[GVL.iAxis].Done THEN RETURN; END_IF @@ -195,7 +195,7 @@ END_IF]]> 0 THEN aAxesPersistent[GVL.iAxis].bMovingAtShutdown := TRUE; ELSE 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 ce7649f..fa2a214 100644 --- a/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU +++ b/solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU @@ -15,7 +15,7 @@ VAR_INPUT iAxisIndex: INT; // The idex of the axis to action the method on. END_VAR]]> - + @@ -24,7 +24,7 @@ VAR_INPUT iAxisIndex: INT; // The idex of the axis to action the method on. END_VAR]]> - + @@ -36,17 +36,17 @@ END_VAR]]> +GVL.aAxes[iAxisIndex].stConfig.fVelocity := tcUNIT_GVL.fDEFAULT_TARGET_VELOCITY; +GVL.aAxes[iAxisIndex].stConfig.fAcceleration := tcUNIT_GVL.fDEFAULT_TARGET_ACCELERATION; +GVL.aAxes[iAxisIndex].stConfig.fDeceleration := tcUNIT_GVL.fDEFAULT_TARGET_DECCELERATION; +GVL.aAxes[iAxisIndex].stConfig.fOverride := tcUNIT_GVL.fDEFAULT_TARGET_OVERRIDE; +GVL.aAxes[iAxisIndex].stConfig.fPosition := tcUNIT_GVL.fDEFAULT_POSITION;]]> @@ -63,16 +63,16 @@ END_VAR]]> +GVL.aAxes[iAxisIndex].stConfig.fVelocity := fTargetVelocity; +GVL.aAxes[iAxisIndex].stConfig.fAcceleration := fTargetAcceleration; +GVL.aAxes[iAxisIndex].stConfig.fDeceleration := fTargetDeceleration; +GVL.aAxes[iAxisIndex].stConfig.fPosition := fTargetPosition;]]> @@ -84,34 +84,34 @@ END_VAR]]> +GVL.aAxes[iAxisIndex].stInputs.bLimitBwd := FALSE; +GVL.aAxes[iAxisIndex].stInputs.bLimitFwd := FALSE; +GVL.aAxes[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 005b4d3..23673d2 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].status.bBusy; +Result := GVL.aAxes[iTargetAxis].stStatus.bBusy; IF nCycle > nMaxCycles OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, @@ -62,14 +62,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].config.fPosition; +InitialValue := GVL.aAxes[iTargetAxis].stConfig.fPosition; ExpectedResult := InitialValue + 10; -GVL.aAxes[iTargetAxis].config.fPosition := ExpectedResult; +GVL.aAxes[iTargetAxis].stConfig.fPosition := ExpectedResult; -GVL.aAxes[iTargetAxis].control.eCommand := E_MotionFunctions.eMoveAbsolute; -GVL.aAxes[iTargetAxis].control.bExecute := TRUE; +GVL.aAxes[iTargetAxis].stControl.eCommand := E_MotionFunctions.eMoveAbsolute; +GVL.aAxes[iTargetAxis].stControl.bExecute := TRUE; -Result := GVL.aAxes[iTargetAxis].status.fActPosition; +Result := GVL.aAxes[iTargetAxis].stStatus.fActPosition; IF nCycle > nCycleMax OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, @@ -96,7 +96,7 @@ END_VAR]]> ExpectedResult := tcUNIT_gvl.fDEFAULT_TARGET_ACCELERATION; fbCommon.mPrepareDefaultMove(iTargetAxis); -Result := GVL.aAxes[1].config.fAcceleration; +Result := GVL.aAxes[1].stConfig.fAcceleration; AssertEquals(Expected := ExpectedResult, Actual := Result, @@ -119,9 +119,9 @@ END_VAR]]> // example of test that requires multiple cycles to complete. Due to stateful behaviour of the axis structure. ExpectedResult := TRUE; -GVL.aAxes[1].control.bEnable := ExpectedResult; +GVL.aAxes[1].stControl.bEnable := ExpectedResult; -Result := GVL.aAxes[iTargetAxis].status.bEnabled; +Result := GVL.aAxes[iTargetAxis].stStatus.bEnabled; IF nCycle > nMaxCycles OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, @@ -148,11 +148,11 @@ END_VAR]]> // Example of using a tcUNIT assert for a specific type (in this case LREAL). -InitialValue := GVL.aAxes[iTargetAxis].config.fVelocity; +InitialValue := GVL.aAxes[iTargetAxis].stConfig.fVelocity; ExpectedResult := InitialValue + 0.5; -GVL.aAxes[iTargetAxis].config.fVelocity := ExpectedResult; +GVL.aAxes[iTargetAxis].stConfig.fVelocity := ExpectedResult; -Result := GVL.aAxes[iTargetAxis].config.fVelocity; +Result := GVL.aAxes[iTargetAxis].stConfig.fVelocity; AssertEquals_LREAL(Expected := ExpectedResult, Actual := Result, @@ -176,9 +176,9 @@ END_VAR]]> ExpectedResult := TRUE; -GVL.aAxes[iTargetAxis].inputs.bLimitFwd := TRUE; +GVL.aAxes[iTargetAxis].stInputs.bLimitFwd := TRUE; -Result := GVL.aAxes[iTargetAxis].status.bFwEnabled; +Result := GVL.aAxes[iTargetAxis].stStatus.bFwEnabled; IF nCycle > nMaxCycles OR ExpectedResult = Result THEN AssertEquals(Expected := ExpectedResult, diff --git a/solution/tc_project_app/tc_mca_std_lib b/solution/tc_project_app/tc_mca_std_lib index c58b432..8562f04 160000 --- a/solution/tc_project_app/tc_mca_std_lib +++ b/solution/tc_project_app/tc_mca_std_lib @@ -1 +1 @@ -Subproject commit c58b432be344cef10241d03c09f214d0f88041e6 +Subproject commit 8562f04c5bd1ff6ce796f1d4a12fe2096c483265