Added tcUNIT libarary 1.0.0 references to resources and Test folder inc. app and common tests structure
This commit is contained in:
19
solution/tc_project_app/Test/app_tests/tcUNIT_APP_RUN.TcPOU
Normal file
19
solution/tc_project_app/Test/app_tests/tcUNIT_APP_RUN.TcPOU
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<POU Name="tcUNIT_APP_RUN" Id="{677fcae4-9d84-425e-8fcd-8e3d3a1985e8}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[(* tcUNIT Tests: Add this program to PLC task in order to run tcUNIT tests against the declared POU test suites.
|
||||
see https://tcunit.org/ for documentation.*)
|
||||
PROGRAM tcUNIT_APP_RUN
|
||||
|
||||
VAR
|
||||
(* Declare standard library POU tests to be run
|
||||
E.g. fbMoveNonLinearSlits: FB_MoveNonLinearSlits_Test;*)
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[TcUnit.RUN();]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="tcUNIT_APP_RUN">
|
||||
<LineId Id="45" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
149
solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU
Normal file
149
solution/tc_project_app/Test/common/FB_tcUNIT_common.TcPOU
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<POU Name="FB_tcUNIT_common" Id="{0f757d3d-99b7-46eb-bdc6-03aa126689f4}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[// tcUNIT Common function block: Contains helper methods for tcUNIT.
|
||||
FUNCTION_BLOCK FB_tcUNIT_common
|
||||
|
||||
VAR
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="mEnableAxis" Id="{12e91532-7139-4c17-998e-4c670b584b9d}">
|
||||
<Declaration><![CDATA[METHOD mEnableAxis : BOOL
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[GVL.axes[iAxisIndex].control.bEnable := TRUE;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="mExecute" Id="{010bd927-5568-40db-a7c5-fcfe995a5cb1}">
|
||||
<Declaration><![CDATA[METHOD mExecute : BOOL
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[GVL.axes[iAxisIndex].control.bExecute := TRUE;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="mPrepareDefaultMove" Id="{c23244d5-896c-49ad-8d8a-19390856e4dc}">
|
||||
<Declaration><![CDATA[METHOD mPrepareDefaultMove
|
||||
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Prepare an axis so it is ready to action a move using target defaults when executed.
|
||||
|
||||
GVL.axes[iAxisIndex].control.bEnable := TRUE;
|
||||
GVL.axes[iAxisIndex].control.eCommand := MotionFunctions.MoveAbsolute;
|
||||
|
||||
GVL.axes[iAxisIndex].inputs.bLimitBwd := TRUE;
|
||||
GVL.axes[iAxisIndex].inputs.bLimitFwd := TRUE;
|
||||
|
||||
GVL.axes[iAxisIndex].config.fVelocity := tcUNIT_GVL.fDEFAULT_TARGET_VELOCITY;
|
||||
GVL.axes[iAxisIndex].config.fAcceleration := tcUNIT_GVL.fDEFAULT_TARGET_ACCELERATION;
|
||||
GVL.axes[iAxisIndex].config.fDeceleration := tcUNIT_GVL.fDEFAULT_TARGET_DECCELERATION;
|
||||
GVL.axes[iAxisIndex].config.fOverride := tcUNIT_GVL.fDEFAULT_TARGET_OVERRIDE;
|
||||
GVL.axes[iAxisIndex].config.fPosition := tcUNIT_GVL.fDEFAULT_POSITION;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="mPrepareMove" Id="{97bd5417-d0a1-4d32-8732-16310a863fcc}">
|
||||
<Declaration><![CDATA[METHOD mPrepareMove
|
||||
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
fTargetVelocity: LREAL;
|
||||
fTargetAcceleration: LREAL;
|
||||
fTargetDeceleration: LREAL;
|
||||
fTargetPosition: LREAL;
|
||||
eMotionStrategy: MotionFunctions; // The desired MotionFunctions motion strategy.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Prepare the axis so it is ready to action a move when executed for a given motion strategy.
|
||||
|
||||
GVL.axes[iAxisIndex].control.bEnable := FALSE;
|
||||
GVL.axes[iAxisIndex].control.eCommand := eMotionStrategy;
|
||||
|
||||
GVL.axes[iAxisIndex].inputs.bLimitBwd := TRUE;
|
||||
GVL.axes[iAxisIndex].inputs.bLimitFwd := TRUE;
|
||||
|
||||
GVL.axes[iAxisIndex].config.fVelocity := fTargetVelocity;
|
||||
GVL.axes[iAxisIndex].config.fAcceleration := fTargetAcceleration;
|
||||
GVL.axes[iAxisIndex].config.fDeceleration := fTargetDeceleration;
|
||||
GVL.axes[iAxisIndex].config.fPosition := fTargetPosition;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="mSetAxisDefaults" Id="{5b9336be-4414-4858-a614-0fdb2847e171}">
|
||||
<Declaration><![CDATA[METHOD mSetAxisDefaults
|
||||
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Set PLC default values for the axis. Note: Status values can take multiple cycles to updated. This is not an instant reset.
|
||||
|
||||
IF GVL.axes[iAxisIndex].status.bBusy THEN
|
||||
GVL.axes[iAxisIndex].control.bStop := TRUE;
|
||||
END_IF
|
||||
IF GVL.axes[iAxisIndex].status.bError THEN
|
||||
GVL.axes[iAxisIndex].control.bReset := TRUE;
|
||||
END_IF
|
||||
IF NOT GVL.axes[iAxisIndex].control.bEnable AND GVL.axes[iAxisIndex].control.bStop THEN
|
||||
GVL.axes[iAxisIndex].control.bStop := FALSE;
|
||||
END_IF
|
||||
|
||||
GVL.axes[iAxisIndex].control.bEnable := FALSE;
|
||||
GVL.axes[iAxisIndex].control.bExecute := FALSE;
|
||||
GVL.axes[iAxisIndex].control.bReset := FALSE;
|
||||
GVL.axes[iAxisIndex].control.bJogFwd := FALSE;
|
||||
GVL.axes[iAxisIndex].control.bJogBwd := FALSE;
|
||||
GVL.axes[iAxisIndex].control.bStop := FALSE;
|
||||
GVL.axes[iAxisIndex].control.eCommand := MotionFunctions.MoveAbsolute;
|
||||
|
||||
GVL.axes[iAxisIndex].config.fVelocity := 0.0;
|
||||
GVL.axes[iAxisIndex].config.fAcceleration := 0.0;
|
||||
GVL.axes[iAxisIndex].config.fDeceleration := 0.0;
|
||||
GVL.axes[iAxisIndex].config.fPosition := 0;
|
||||
GVL.axes[iAxisIndex].config.fOverride := 0.0;
|
||||
GVL.axes[iAxisIndex].config.nHomeSeq := 0;
|
||||
|
||||
GVL.axes[iAxisIndex].inputs.bLimitBwd := FALSE;
|
||||
GVL.axes[iAxisIndex].inputs.bLimitFwd := FALSE;
|
||||
GVL.axes[iAxisIndex].inputs.bEncLAtch := FALSE;
|
||||
GVL.axes[iAxisIndex].inputs.bHomeSensor := FALSE;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<LineIds Name="FB_tcUNIT_common">
|
||||
<LineId Id="9" 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.mPrepareDefaultMove">
|
||||
<LineId Id="6" Count="0" />
|
||||
<LineId Id="38" Count="0" />
|
||||
<LineId Id="8" Count="1" />
|
||||
<LineId Id="39" Count="0" />
|
||||
<LineId Id="11" Count="6" />
|
||||
<LineId Id="19" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_tcUNIT_common.mPrepareMove">
|
||||
<LineId Id="17" Count="11" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_tcUNIT_common.mSetAxisDefaults">
|
||||
<LineId Id="6" Count="0" />
|
||||
<LineId Id="41" Count="0" />
|
||||
<LineId Id="34" Count="1" />
|
||||
<LineId Id="31" Count="0" />
|
||||
<LineId Id="44" Count="1" />
|
||||
<LineId Id="43" Count="0" />
|
||||
<LineId Id="36" Count="2" />
|
||||
<LineId Id="7" Count="19" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
23
solution/tc_project_app/Test/common/tcUNIT_GVL.TcGVL
Normal file
23
solution/tc_project_app/Test/common/tcUNIT_GVL.TcGVL
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
|
||||
<GVL Name="tcUNIT_GVL" Id="{4b23d6c9-6a88-40b7-9bf4-d55c4dfd4246}">
|
||||
<Declaration><![CDATA[// tcUNIT_GVL: Global variables used in tcUNIT tests.
|
||||
{attribute 'qualified_only'}
|
||||
VAR_GLOBAL CONSTANT
|
||||
// Constants for axis defaults.
|
||||
fDEFAULT_VELOCITY: LREAL := 0.0;
|
||||
fDEFAULT_ACCELERATION: LREAL := 0.0;
|
||||
fDEFAULT_DECCELERATION: LREAL := 0.0;
|
||||
fDEFAULT_POSITION: LREAL := 0.0;
|
||||
|
||||
fDEFAULT_TARGET_VELOCITY: LREAL := 1.0;
|
||||
fDEFAULT_TARGET_ACCELERATION: LREAL := 0.5;
|
||||
fDEFAULT_TARGET_DECCELERATION: LREAL := 0.5;
|
||||
fDEFAULT_TARGET_POSITION: LREAL := 10.0;
|
||||
fDEFAULT_TARGET_OVERRIDE: LREAL := 100;
|
||||
END_VAR
|
||||
|
||||
VAR_GLOBAL
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
@@ -229,6 +229,15 @@
|
||||
<Compile Include="tc_mca_std_lib\POUs\VISUs\visuTextLinks.TcTLO">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Test\app_tests\tcUNIT_APP_RUN.TcPOU">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Test\common\FB_tcUNIT_common.TcPOU">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Test\common\tcUNIT_GVL.TcGVL">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Visualization Manager.TcVMO">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -236,6 +245,7 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="DUTs" />
|
||||
<Folder Include="GVLs" />
|
||||
<Folder Include="Test" />
|
||||
<Folder Include="tc_mca_std_lib" />
|
||||
<Folder Include="tc_mca_std_lib\DUTs" />
|
||||
<Folder Include="tc_mca_std_lib\GVLs" />
|
||||
@@ -256,6 +266,8 @@
|
||||
<Folder Include="tc_mca_std_lib\POUs\ErrorHandling" />
|
||||
<Folder Include="tc_mca_std_lib\POUs\Motion\Homing" />
|
||||
<Folder Include="tc_mca_std_lib\POUs\VISUs" />
|
||||
<Folder Include="Test\app_tests" />
|
||||
<Folder Include="Test\common" />
|
||||
<Folder Include="VISUs" />
|
||||
<Folder Include="POUs" />
|
||||
</ItemGroup>
|
||||
@@ -334,6 +346,10 @@
|
||||
<DefaultResolution>Tc3_Module, * (Beckhoff Automation GmbH)</DefaultResolution>
|
||||
<Namespace>Tc3_Module</Namespace>
|
||||
</PlaceholderReference>
|
||||
<PlaceholderReference Include="TcUnit">
|
||||
<DefaultResolution>TcUnit, * (www.tcunit.org)</DefaultResolution>
|
||||
<Namespace>TcUnit</Namespace>
|
||||
</PlaceholderReference>
|
||||
<PlaceholderReference Include="VisuDialogs">
|
||||
<DefaultResolution>VisuDialogs, * (System)</DefaultResolution>
|
||||
<Namespace>VisuDialogs</Namespace>
|
||||
|
||||
Reference in New Issue
Block a user