Merge remote-tracking branch 'origin/MBP-198_OOP' into MBP-221-add-restore-position-bias

# Conflicts:
#	solution/tc_project_app/tc_mca_std_lib
This commit is contained in:
Federico Rojas
2022-10-14 15:55:30 +02:00
10 changed files with 226 additions and 72 deletions

1
.gitignore vendored
View File

@@ -13,6 +13,7 @@ UpgradeLog.htm
_Boot/
_CompileInfo/
_Libraries/
solution/tc_project_app/LineIDs.dbg
LineIDs.dbg
logs.0*
solution/TrialLicense.tclrs

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<TcSmItem 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.4024.11" ClassName="CNcSafTaskDef" SubType="0">
<TcSmItem 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.4024.32" ClassName="CNcSafTaskDef" SubType="0">
<NC>
<SafTask Priority="4" CycleTime="20000" AmsPort="501" IoAtBegin="true">
<Name>NC-Task 1 SAF</Name>

View File

@@ -3,12 +3,10 @@
<GVL Name="GVL_APP" Id="{8fe9690c-7907-432e-bedb-6fc99b5ce255}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL
END_VAR
VAR_GLOBAL CONSTANT
nAXIS_NUM: UINT := 0; (*~ (OPC: 1 : available for OPC-clients)
(OPC_PROP[0005]: 1 : OPC_PROP_RIGHTS, here read only) *)
nAXIS_NUM: UINT := 0; (*~ (OPC: 1 : available for OPC-clients)(OPC_PROP[0005]: 1 : OPC_PROP_RIGHTS, here read only)*)
nPNEUMATIC_AXIS_NUM: UINT := 0;
END_VAR]]></Declaration>
</GVL>

View File

@@ -10,9 +10,5 @@ END_VAR
<ST><![CDATA[//Program any specific code or safety code for an specific application when it involves multiple axes
//Eg. Collision avoidance, interlocks, sequencing, etc.]]></ST>
</Implementation>
<LineIds Name="Application_Template">
<LineId Id="5" Count="0" />
<LineId Id="10" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -8,8 +8,7 @@ VAR
//Hardware interlocks
//bInterlockFwdOK AT %I*: BOOL;
END_VAR
]]></Declaration>
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[//Initial parameters of an Axis
(*IF _TaskInfo[fbGetCurTaskIndex.index].FirstCycle THEN
@@ -21,20 +20,7 @@ END_IF*)
//Define ACTIONS() or write exclusive code for an specific axis.
(*Eg. Stop when temperature reaches certain values, reduce speed if a signal is activated, etc.
Eg. GVL.astAxes[x].stControl.bInterlockFwd := NOT bInterlockFwdOK;*)
]]></ST>
Eg. GVL.astAxes[x].stControl.bInterlockFwd := NOT bInterlockFwdOK;*)]]></ST>
</Implementation>
<LineIds Name="Axis_Template">
<LineId Id="20" Count="0" />
<LineId Id="5" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="17" Count="2" />
<LineId Id="14" Count="0" />
<LineId Id="22" Count="0" />
<LineId Id="21" Count="0" />
<LineId Id="24" Count="0" />
<LineId Id="33" Count="0" />
<LineId Id="23" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -17,17 +17,5 @@ END_VAR
]]></ST>
</Implementation>
<LineIds Name="Pneumatics_Template">
<LineId Id="8" Count="0" />
<LineId Id="89" Count="0" />
<LineId Id="33" Count="0" />
<LineId Id="32" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="31" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="27" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="30" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -4,6 +4,7 @@
<Declaration><![CDATA[PROGRAM MAIN
VAR
sVersion: STRING := '1.0.0';
aIAxes: ARRAY [1..GVL_APP.nAXIS_NUM] OF I_Axis;
afbAxes: ARRAY [1..GVL_APP.nAXIS_NUM] OF FB_Axis;
afbPneumaticAxes: ARRAY [1..GVL_APP.nPNEUMATIC_AXIS_NUM] OF FB_PneumaticAxis;
hmiAxisSelection: INT := 1; //Not possible to use local hmi variables for array indexes
@@ -16,7 +17,7 @@ VAR
bRestoreExecute: BOOL := FALSE;
bExecuteReadEncRefSys: BOOL := FALSE;
nRetry: INT;
iAxes : UINT; //index for for loops in Position recovery actions
iAxes: UINT; //index for for loops in Position recovery actions
afbReadEncRefSys: ARRAY [1..GVL_APP.nAXIS_NUM] OF MC_ReadParameter;
afbRestorePosition: ARRAY [1..GVL_APP.nAXIS_NUM] OF MC_SetPosition;
afbReadPositionBias: ARRAY [1..GVL_APP.nAXIS_NUM] OF MC_ReadParameter;
@@ -29,20 +30,30 @@ VAR PERSISTENT
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[POSITION_RECOVERY();
AXES();
PROG();]]></ST>
PROG();
AXES();]]></ST>
</Implementation>
<Folder Name="POSITION_RECOVERY" Id="{3561f6ef-e145-4ed3-9839-f17334bd2d97}" />
<Action Name="AXES" Id="{7eb32732-9b53-4934-8cd9-20ba971dd8ff}">
<Implementation>
<ST><![CDATA[//Get task index for Axes parameters initialization.
GVL.fbGetCurTaskIndex();
<ST><![CDATA[//First cycle, assign FB_axis to interface array
IF _TaskInfo[fbGetCurTaskIndex.index].FirstCycle THEN
FOR GVL.iAxis := 1 TO GVL_APP.nAXIS_NUM DO
afbAxes[GVL.iAxis].stAxis REF= astAxes[GVL.iAxis];
aIAxes[GVL.iAxis] := afbAxes[GVL.iAxis];
END_FOR
//Custom axis types defined and linked to aiAxes here
//FB_CustomAxis extends FB_axis
//fbCustomAxis.stAxis REF= astAxes[x];
//aIAxes[x] := fbCustomAxis;
END_IF
//Create an stAxisStruct for every axis in the project.
//Execute FB_Axis logic
FOR GVL.iAxis := 1 TO GVL_APP.nAXIS_NUM DO
afbAxes[GVL.iAxis](stAxisStruct := GVL.astAxes[GVL.iAxis]);
aIAxes[GVL.iAxis].Run();
END_FOR
//Execute Pneumatic Axis logic
FOR GVL.iPneumaticAxis := 1 TO GVL_APP.nPNEUMATIC_AXIS_NUM DO
afbPneumaticAxes[GVL.iPneumaticAxis](stPneumaticAxisStruct := GVL.astPneumaticAxes[GVL.iPneumaticAxis]);
END_FOR]]></ST>
@@ -86,7 +97,18 @@ END_IF]]></ST>
</Action>
<Action Name="PROG" Id="{5d03ebbb-2a47-4890-ad6d-e82daf72dc51}">
<Implementation>
<ST><![CDATA[Application_Template();]]></ST>
<ST><![CDATA[//Get task index for Axes parameters initialization.
GVL.fbGetCurTaskIndex();
//Call the programs that are defined in the "Application Specific" folder.
//Create as many programs in that folder as axes and applications you have or need
//Axes initial parameters and program
//Axis_Template();
//Pneumatics_Template();
//Application program calls
//Application_Template();]]></ST>
</Implementation>
</Action>
<Action Name="RESTORE_POSITIONS" Id="{0c7ee537-7bd9-4833-b428-c17cbb57e893}" FolderPath="POSITION_RECOVERY\">

View File

@@ -45,10 +45,10 @@
<d n="FbMethods" t="CaseInsensitiveHashtable" ckt="String" cvt="Guid">
<v>FB_Init</v>
<v>c98701bd-1e9f-450a-a2a8-a2474d536f2e</v>
<v>FB_Reinit</v>
<v>5b6e372a-a69d-40e8-aef7-f470b7c53d95</v>
<v>FB_Exit</v>
<v>0be1b9ab-e8eb-4b33-b803-109abb46bde4</v>
<v>FB_Reinit</v>
<v>5b6e372a-a69d-40e8-aef7-f470b7c53d95</v>
</d>
<v n="FbName">"NotImportant"</v>
<v n="FbGuid">{aa8b7e42-e967-427f-8f2e-f00f9d706470}</v>

View File

@@ -41,6 +41,33 @@
<Compile Include="POUs\MAIN.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisConfig.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisControl.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisDescription.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisError.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisInputs.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisPersistent.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisStatus.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_AxisStruct.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\Axis_Structures\ST_GearAxis.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\E_AxisParameters.TcTLEO">
<SubType>Code</SubType>
</Compile>
@@ -65,6 +92,9 @@
<Compile Include="tc_mca_std_lib\DUTs\E_RestorePosition.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\I_Axis.TcIO">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\E_SlitPairStatesV2.TcDUT">
<SubType>Code</SubType>
</Compile>
@@ -98,34 +128,10 @@
<Compile Include="tc_mca_std_lib\DUTs\ST_MonitoringAlarm.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisConfig.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisControl.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\E_MotionFunctions.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisDescription.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisError.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisInputs.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisPersistent.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_GearAxis.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisStatus.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\DUTs\ST_AxisStruct.TcDUT">
<Compile Include="tc_mca_std_lib\DUTs\ST_McStatus.TcDUT">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\GVLs\GVL.TcGVL">
@@ -156,6 +162,9 @@
<SubType>Code</SubType>
<DependentUpon>Visualization Manager.TcVMO</DependentUpon>
</Compile>
<Compile Include="tc_mca_std_lib\VISUs\ParameterTextList.TcTLO">
<SubType>Code</SubType>
</Compile>
<Compile Include="tc_mca_std_lib\VISUs\PneumaticsVisu.TcVIS">
<SubType>Code</SubType>
<DependentUpon>Visualization Manager.TcVMO</DependentUpon>
@@ -170,6 +179,7 @@
<Folder Include="POUs\Application_Specific" />
<Folder Include="POUs\Application_Specific\Applications" />
<Folder Include="POUs\Application_Specific\Axes" />
<Folder Include="tc_mca_std_lib\DUTs\Axis_Structures" />
<Folder Include="tc_mca_std_lib\DUTs\Pneumatics" />
<Folder Include="POUs\Application_Specific\Applications" />
<Folder Include="POUs\Application_Specific\Axes" />
@@ -276,9 +286,162 @@
</None>
</ItemGroup>
<ItemGroup>
<PlaceholderResolution Include="CAA Callback">
<Resolution>CAA Callback Extern, * (CAA Technical Workgroup)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CAA MemBlockMan">
<Resolution>CAA Memory Block Manager Extern, * (CAA Technical Workgroup)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CAA ResMan">
<Resolution>CAA Ressource Manager Extern, * (CAA Technical Workgroup)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CAA Types">
<Resolution>CAA Types Extern, * (CAA Technical Workgroup)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpApp">
<Resolution>CmpApp, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpBitmapPool">
<Resolution>CmpBitmapPool, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpDynamicText">
<Resolution>CmpDynamicText, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpEventMgr">
<Resolution>CmpEventMgr, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpLog">
<Resolution>CmpLog, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpSchedule">
<Resolution>CmpSchedule, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpTargetVisu">
<Resolution>CmpTargetVisu, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="CmpVisuHandler">
<Resolution>CmpVisuHandler, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Collections">
<Resolution>Collections, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Component Manager">
<Resolution>Component Manager, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="FloatingPointUtils">
<Resolution>FloatingPointUtils, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Standard">
<Resolution>Tc2_Standard, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Standard64">
<Resolution>Tc2_Standard, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="StringUtils">
<Resolution>StringUtils, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysCpuHandling">
<Resolution>SysCpuHandling, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysDir">
<Resolution>SysDir, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysFile">
<Resolution>SysFile, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysMem">
<Resolution>SysMem, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysProcess">
<Resolution>SysProcess, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysShm">
<Resolution>SysShm, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysTarget">
<Resolution>SysTarget, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElemBase">
<Resolution>VisuElemBase, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElemEventTable">
<Resolution>VisuElemEventTable, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElemMeter">
<Resolution>VisuElemMeter, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElems">
<Resolution>VisuElems, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElemsSpecialControls">
<Resolution>VisuElemsSpecialControls, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElemsWinControls">
<Resolution>VisuElemsWinControls, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuElemTextEditor">
<Resolution>VisuElemTextEditor, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="system_visuinputs">
<Resolution>VisuInputs, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuInputs">
<Resolution>VisuInputs, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="System_VisuNativeControl">
<Resolution>VisuNativeControl, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysTime">
<Resolution>SysTime, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysTimeCore">
<Resolution>SysTimeCore, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="SysTimeRtc">
<Resolution>SysTimeRtc, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_Drive">
<Resolution>Tc2_Drive, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_EtherCAT">
<Resolution>Tc2_EtherCAT, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_IoFunctions">
<Resolution>Tc2_IoFunctions, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_Math">
<Resolution>Tc2_Math, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_MC2">
<Resolution>Tc2_MC2, 3.3.48.0 (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_MC2_Drive">
<Resolution>Tc2_MC2_Drive, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_Standard">
<Resolution>Tc2_Standard, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_SUPS">
<Resolution>Tc2_SUPS, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_System">
<Resolution>Tc2_System, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc2_Utilities">
<Resolution>Tc2_Utilities, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc3_MC2_AdvancedHoming">
<Resolution>Tc3_MC2_AdvancedHoming, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Tc3_Module">
<Resolution>Tc3_Module, * (Beckhoff Automation GmbH)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="Util">
<Resolution>Util, * (System)</Resolution>
</PlaceholderResolution>
<PlaceholderResolution Include="VisuDialogs">
<Resolution>VisuDialogs, * (System)</Resolution>
</PlaceholderResolution>
</ItemGroup>
<ProjectExtensions>
<PlcProjectOptions>