@@ -8,8 +8,8 @@ VAR_INPUT
88 iGapSize: UINT; //Axis ID for the size of gap between slit blades
99 iGapCentre: UINT; //Axis ID for the centre position of the gap formed by slit blades
1010 fEncoderScaling: LREAL := 10000; //default scaling denominator of 10000
11- bAutoHome: BOOL := TRUE; // Blades homing is automatically done if they are not homed
12- bAnticollisionEnable : BOOL := FALSE; // Blades anticolision option, only for when blades are moved independiently
11+ bAutoHome: BOOL := TRUE; //Blades homing is automatically done if they are not homed
12+ bAnticollisionEnable: BOOL := FALSE; // Blades anticollision option, only for when blades are moved independently
1313
1414END_VAR
1515VAR_OUTPUT
2525 bReset: BOOL; //Reset the slit set
2626 bResetting: BOOL := FALSE; //TRUE if axis going through a reset
2727 bAxesEnabled: BOOL := FALSE; //TRUE if all axes enabled
28- bSlitsHomed : BOOL := FALSE; //TRUE if all axes Homed after reboot
28+ bSlitsHomed: BOOL := FALSE; //TRUE if all axes Homed after reboot
2929 bBladesHomed: BOOL:= FALSE; //TRUE if blade axes are calibrated
3030 bGapHomed: BOOL:= FALSE; //TRUE if virtual axes are calibrated
3131 bBladesCoupled: BOOL:= FALSE; //TRUE if both blade axes are coupled
3737 fGapCentrePosition: LREAL;
3838 iGapCentrePosition AT %Q*: UDINT := 0;
3939 resetCounterTimeout: UINT :=0;
40- eSoftLimitsUpdate: E_SlitSoftLimits := E_SlitSoftLimits.START; // Sequence steps for update of soft limits
40+ eSoftLimitsUpdate: E_SlitSoftLimits := E_SlitSoftLimits.START; //Sequence steps for update of soft limits
4141 fbNoMovingRising: R_TRIG;
4242 fbInOpRising: R_TRIG;
4343 bUpdateSoftLimits: BOOL := FALSE;
@@ -68,7 +68,7 @@ actGapLimits(); //Set virtual axis limits to TRUE
6868actVirtualAxisPositions(); //Virtual axis encoder position subroutine
6969actRunMethods(); //Update statuses
7070actEnableAxes(); //Enable the axes
71- checkSlitsHomed(); // Status of the axes homing
71+ checkSlitsHomed(); //Status of the axes homing
7272IF bAnticollisionEnable THEN //Blades anticollision enabled
7373 actInterlocking();
7474END_IF
@@ -154,7 +154,7 @@ CASE eSlitPairState OF
154154 eSlitPairState := E_SlitPairStates.GEAROUT_BLADES;
155155 END_IF
156156 IF (GVL.astAxes[iGapSize].stControl.eCommand = E_MotionFunctions.eHome AND GVL.astAxes[iGapSize].stControl.bExecute) OR
157- (GVL.astAxes[iGapCentre].stControl.eCommand = E_MotionFunctions.eHome AND GVL.astAxes[iGapCentre].stControl.bExecute) THEN
157+ (GVL.astAxes[iGapCentre].stControl.eCommand = E_MotionFunctions.eHome AND GVL.astAxes[iGapCentre].stControl.bExecute) THEN
158158 eSlitPairState := E_SlitPairStates.GEAROUT_BLADES;
159159 bHomingRequested := TRUE;
160160 END_IF
@@ -230,11 +230,10 @@ GVL.astAxes[iBladePositive].stControl.bExecute := TRUE;
230230 </Action >
231231 <Action Name =" actEnableAxes" Id =" {1879c38a-aecf-0e8c-2a58-959e274ebc63}" >
232232 <Implementation >
233- <ST ><![CDATA[
234- // Enable all axis when one of the virtual axes is enabled
235- fbEnableRising(CLK := GVL.astAxes[iGapSize].stControl.bEnable OR GVL.astAxes[iGapCentre].stControl.bEnable );
233+ <ST ><![CDATA[ //Enable all axes when one of the virtual axes is enabled
234+ fbEnableRising(CLK := GVL.astAxes[iGapSize].stControl.bEnable OR GVL.astAxes[iGapCentre].stControl.bEnable);
236235
237- IF fbEnableRising.Q THEN
236+ IF fbEnableRising.Q THEN
238237 GVL.astAxes[iBladePositive].stControl.bEnable := TRUE;
239238 GVL.astAxes[iBladeNegative].stControl.bEnable := TRUE;
240239 GVL.astAxes[iGapSize].stControl.bEnable := TRUE;
@@ -243,8 +242,8 @@ IF fbEnableRising.Q THEN
243242END_IF
244243
245244
246- // Disable blade axes when both the virtuals are disabled
247- fbDisableRising(CLK := NOT GVL.astAxes[iGapSize].stControl.bEnable OR NOT GVL.astAxes[iGapCentre].stControl.bEnable );
245+ //Disable blade axes when both the virtuals are disabled
246+ fbDisableRising(CLK := NOT GVL.astAxes[iGapSize].stControl.bEnable OR NOT GVL.astAxes[iGapCentre].stControl.bEnable);
248247
249248IF fbDisableRising.Q THEN
250249 GVL.astAxes[iBladePositive].stControl.bEnable := FALSE;
@@ -253,11 +252,11 @@ IF fbDisableRising.Q THEN
253252 GVL.astAxes[iGapCentre].stControl.bEnable := FALSE;
254253END_IF
255254
256- // Set Enable flag when all axes are enabled
255+ //Set Enable flag when all axes are enabled
257256bEnable := GVL.astAxes[iBladePositive].stStatus.bEnabled AND GVL.astAxes[iBladeNegative].stStatus.bEnabled
258257 AND GVL.astAxes[iGapSize].stStatus.bEnabled AND GVL.astAxes[iGapCentre].stStatus.bEnabled;
259258
260- // Set flag when all axes are disable
259+ //Set flag when all axes are disable
261260fbDisabledRising(CLK := NOT GVL.astAxes[iBladePositive].stStatus.bEnabled AND GVL.astAxes[iBladeNegative].stStatus.bEnabled
262261 AND GVL.astAxes[iGapSize].stStatus.bEnabled AND GVL.astAxes[iGapCentre].stStatus.bEnabled);
263262]]> </ST >
@@ -297,21 +296,21 @@ END_IF
297296 </Action >
298297 <Action Name =" actGapLimits" Id =" {def3d604-4e23-0583-39ed-61c5876cfc85}" >
299298 <Implementation >
300- <ST ><![CDATA[ //Set Virtual axis inputs to TRUE to enable movement
299+ <ST ><![CDATA[ //Set Virtual axes inputs to TRUE to enable movement
301300GVL.astAxes[iGapSize].stInputs.bLimitBwd := GVL.astAxes[iBladeNegative].stInputs.bLimitFwd OR GVL.astAxes[iBladePositive].stInputs.bLimitBwd;
302- GVL.astAxes[iGapSize].stInputs.bLimitFwd := GVL.astAxes[iBladeNegative].stInputs.bLimitBwd OR GVL.astAxes[iBladePositive].stInputs.bLimitFwd;;
303- GVL.astAxes[iGapCentre].stInputs.bLimitBwd := GVL.astAxes[iBladeNegative].stInputs.bLimitFwd OR GVL.astAxes[iBladePositive].stInputs.bLimitBwd;;
304- GVL.astAxes[iGapCentre].stInputs.bLimitFwd :=GVL.astAxes[iBladeNegative].stInputs.bLimitBwd OR GVL.astAxes[iBladePositive].stInputs.bLimitFwd; ;
301+ GVL.astAxes[iGapSize].stInputs.bLimitFwd := GVL.astAxes[iBladeNegative].stInputs.bLimitBwd OR GVL.astAxes[iBladePositive].stInputs.bLimitFwd;
302+ GVL.astAxes[iGapCentre].stInputs.bLimitBwd := GVL.astAxes[iBladeNegative].stInputs.bLimitFwd OR GVL.astAxes[iBladePositive].stInputs.bLimitBwd;
303+ GVL.astAxes[iGapCentre].stInputs.bLimitFwd := GVL.astAxes[iBladeNegative].stInputs.bLimitBwd OR GVL.astAxes[iBladePositive].stInputs.bLimitFwd;
305304]]> </ST >
306305 </Implementation >
307306 </Action >
308307 <Action Name =" actInterlocking" Id =" {64063538-5b16-04d7-1d46-c493a7cc7a35}" >
309308 <Implementation >
310- <ST ><![CDATA[ //Blades interlocking for anticollition purposes
309+ <ST ><![CDATA[ //Blades interlocking for anticollision purposes
311310GVL.astAxes[iBladeNegative].stControl.bInterlockFwd := GVL.astAxes[iBladeNegative].stStatus.fActPosition >= GVL.astAxes[iBladePositive].stStatus.fActPosition
312- OR GVL.astAxes[iBladeNegative].stControl.fPosition >= GVL.astAxes[iBladePositive].stStatus.fActPosition ;
311+ OR GVL.astAxes[iBladeNegative].stControl.fPosition >= GVL.astAxes[iBladePositive].stStatus.fActPosition;
313312GVL.astAxes[iBladePositive].stControl.bInterlockBwd := GVL.astAxes[iBladePositive].stStatus.fActPosition <= GVL.astAxes[iBladeNegative].stStatus.fActPosition
314- OR GVL.astAxes[iBladePositive].stControl.fPosition <= GVL.astAxes[iBladeNegative].stStatus.fActPosition ;
313+ OR GVL.astAxes[iBladePositive].stControl.fPosition <= GVL.astAxes[iBladeNegative].stStatus.fActPosition;
315314]]> </ST >
316315 </Implementation >
317316 </Action >
@@ -346,7 +345,7 @@ GVL.astAxes[iBladePositive].stControl.bExecute := TRUE;
346345 </Action >
347346 <Action Name =" actStopAxes" Id =" {83b4f1fe-f696-016b-03db-3bcff9089f7d}" >
348347 <Implementation >
349- <ST ><![CDATA[ //Stop all axis when in error (Abort movements)
348+ <ST ><![CDATA[ //Stop all axes when in error (Abort movements)
350349GVL.astAxes[iBladePositive].stControl.bStop := TRUE;
351350GVL.astAxes[iBladeNegative].stControl.bStop := TRUE;
352351GVL.astAxes[iGapSize].stControl.bStop := TRUE;
@@ -356,13 +355,13 @@ GVL.astAxes[iGapCentre].stControl.bStop := TRUE;
356355 </Action >
357356 <Action Name =" actUpdateSoftLimits" Id =" {35e948c5-fa3a-0897-288a-c8995c0599d0}" >
358357 <Implementation >
359- <ST ><![CDATA[ //The soft limits of the virtual axes are updated everytime a movement has been accomplised .
360- //This is to avoid undesired errors if the user sets a targe position which is not allowed
358+ <ST ><![CDATA[ //The soft limits of the virtual axes are updated everytime a movement has been accomplished .
359+ //This is to avoid undesired errors if the user sets a target position which is not allowed
361360
362361CASE eSoftLimitsUpdate OF
363362
364363E_SlitSoftLimits.START: //START SEQ
365- eSoftLimitsUpdate := E_SlitSoftLimits.WRITE_GAP_CENTRE_FWD;
364+ eSoftLimitsUpdate := E_SlitSoftLimits.WRITE_GAP_CENTRE_FWD;
366365
367366E_SlitSoftLimits.WRITE_GAP_CENTRE_FWD: //WRITE GAP CENTRE FWD SOFT LIMIT
368367 IF NOT GVL.astAxes[iGapCentre].stStatus.bBusy AND NOT GVL.astAxes[iGapSize].stStatus.bBusy THEN
@@ -371,7 +370,7 @@ E_SlitSoftLimits.WRITE_GAP_CENTRE_FWD: //WRITE GAP CENTRE FWD SOFT LIMIT
371370 GVL.astAxes[iGapCentre].stControl.eCommand := E_MotionFunctions.eWriteParameter;
372371 GVL.astAxes[iGapCentre].stConfig.eAxisParameters := E_AxisParameters.SWLimitForward;
373372 GVL.astAxes[iGapCentre].stConfig.fWriteAxisParameter := (GVL.astAxes[iBladePositive].stConfig.fMaxSoftPosLimit
374- - GVL.astAxes[iGapSize].stStatus.fActPosition/2);
373+ - GVL.astAxes[iGapSize].stStatus.fActPosition/2);
375374 END_IF
376375
377376E_SlitSoftLimits.WRITE_GAP_CENTRE_BWD: //WRITE GAP CENTRE BWD SOFT LIMIT
@@ -381,7 +380,7 @@ E_SlitSoftLimits.WRITE_GAP_CENTRE_BWD: //WRITE GAP CENTRE BWD SOFT LIMIT
381380 GVL.astAxes[iGapCentre].stControl.eCommand := E_MotionFunctions.eWriteParameter;
382381 GVL.astAxes[iGapCentre].stConfig.eAxisParameters := E_AxisParameters.SWLimitBackward;
383382 GVL.astAxes[iGapCentre].stConfig.fWriteAxisParameter := (GVL.astAxes[iBladeNegative].stConfig.fMinSoftPosLimit
384- + GVL.astAxes[iGapSize].stStatus.fActPosition/2);
383+ + GVL.astAxes[iGapSize].stStatus.fActPosition/2);
385384 END_IF
386385
387386E_SlitSoftLimits.WRITE_GAP_SIZE_FWD: //WRITE GAP SIZE FWD SOFT LIMIT
@@ -391,19 +390,18 @@ E_SlitSoftLimits.WRITE_GAP_SIZE_FWD: //WRITE GAP SIZE FWD SOFT LIMIT
391390 GVL.astAxes[iGapSize].stControl.eCommand := E_MotionFunctions.eWriteParameter;
392391 GVL.astAxes[iGapSize].stConfig.eAxisParameters := E_AxisParameters.SWLimitForward;
393392 IF GVL.astAxes[iGapCentre].stStatus.fActPosition >= 0.0 THEN
394- GVL.astAxes[iGapSize].stConfig.fWriteAxisParameter := 2 * ABS(GVL.astAxes[iBladePositive].stConfig.fMaxSoftPosLimit
395- - GVL.astAxes[iGapCentre].stStatus.fActPosition);
393+ GVL.astAxes[iGapSize].stConfig.fWriteAxisParameter := 2 * ABS(GVL.astAxes[iBladePositive].stConfig.fMaxSoftPosLimit
394+ - GVL.astAxes[iGapCentre].stStatus.fActPosition);
396395 ELSE
397- GVL.astAxes[iGapSize].stConfig.fWriteAxisParameter := 2 * ABS(GVL.astAxes[iBladeNegative].stConfig.fMinSoftPosLimit
398- - GVL.astAxes[iGapCentre].stStatus.fActPosition);
396+ GVL.astAxes[iGapSize].stConfig.fWriteAxisParameter := 2 * ABS(GVL.astAxes[iBladeNegative].stConfig.fMinSoftPosLimit
397+ - GVL.astAxes[iGapCentre].stStatus.fActPosition);
399398 END_IF
400399 END_IF
401400
402401E_SlitSoftLimits.FINISH: //FINISHED WHEN LAST WRITING OF PARAMETERS IS DONE
403-
404402 IF GVL.astAxes[iGapSize].stStatus.bDone AND NOT GVL.astAxes[iGapSize].stControl.bExecute THEN
405- eSoftLimitsUpdate := E_SlitSoftLimits.START;
406- bUpdateSoftLimits := FALSE;
403+ eSoftLimitsUpdate := E_SlitSoftLimits.START;
404+ bUpdateSoftLimits := FALSE;
407405 END_IF
408406
409407END_CASE
@@ -568,7 +566,11 @@ VAR_OUTPUT
568566END_VAR
569567]]> </Declaration >
570568 <Implementation >
571- <ST ><![CDATA[ fbHomingRising(CLK:= GVL.astAxes[iBladeNegative].stStatus.bHomed AND GVL.astAxes[iBladePositive].stStatus.bHomed AND GVL.astAxes[iGapSize].stStatus.bHomed AND GVL.astAxes[iGapCentre].stStatus.bHomed );
569+ <ST ><![CDATA[ fbHomingRising(CLK:=
570+ GVL.astAxes[iBladeNegative].stStatus.bHomed
571+ AND GVL.astAxes[iBladePositive].stStatus.bHomed
572+ AND GVL.astAxes[iGapSize].stStatus.bHomed
573+ AND GVL.astAxes[iGapCentre].stStatus.bHomed);
572574IF fbHomingRising.Q THEN
573575 bOutput := FALSE;
574576 bSlitsHomed := TRUE;
@@ -578,8 +580,6 @@ END_IF
578580 </Method >
579581 <Method Name =" checkSoftLimits" Id =" {7b17dbf3-e1d6-0a6e-1aa4-6cded47f1f4b}" >
580582 <Declaration ><![CDATA[ METHOD checkSoftLimits : BOOL
581- VAR_INPUT
582- END_VAR
583583]]> </Declaration >
584584 <Implementation >
585585 <ST ><![CDATA[ fbNoMovingRising(CLK := NOT GVL.astAxes[iGapCentre].stStatus.bMoving AND NOT GVL.astAxes[iGapSize].stStatus.bMoving);
0 commit comments