Files
Adeco_20220119-01/TC3_CNCPLCBase/OEM/FB_WZWArm_old.TcPOU
Matthias Heisig 51d6e7e5c4 Initial commit
2024-10-22 14:22:54 +02:00

264 lines
6.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_WZWArm_old" Id="{47db9376-1829-4363-81cb-0972e2cb3efc}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_WZWArm_old
VAR_INPUT
bNextStep AT %I* : BOOL;
bFullAuto AT %I* : BOOL;
bInfeedReady : BOOL;
END_VAR
VAR_OUTPUT
bNextStepActive AT %Q* : BOOL;
bFullAutoActive AT %Q* : BOOL;
END_VAR
VAR
refAxis : AXIS_REF;
axPower : MC_Power;
axMoveAdd : MC_MoveAdditive;
axMoveAbsMod : MC_MoveModulo;
axReset : MC_Reset;
rtNextStep : R_TRIG;
rtFullAuto : R_Trig;
nState : INT := -20;
fHomePos : REAL := 0;
fGrabPos : REAL := 1433.5;
fChangePos : REAL := 5917;
fNextPosition : REAL := 0;
bEnable : BOOL;
bExecute : BOOL;
bResetAxis : BOOL;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[rtNextStep(CLK := bNextStep);
rtFullAuto(CLK := bFullAuto);
IF rtFullAuto.Q AND (nState = 0) THEN
bFullAutoActive := NOT bFullAutoActive;
END_IF
axPower(
Axis := refAxis,
Enable := bEnable OR bFullAutoActive,
Enable_Positive := TRUE,
Enable_Negative := TRUE);
axMoveAbsMod(
Axis := refAxis,
Execute := axPower.Status AND bExecute,
Position := fNextPosition,
Velocity := 4320, // 4320
Acceleration := 12960, // 12960
Deceleration := 12960, // 12960
Direction := MC_Direction.MC_Positive_Direction);
IF PLCReset THEN
bResetAxis := TRUE;
END_IF
axReset(Axis := refAxis, Execute := bResetAxis);
IF axReset.Done THEN
bResetAxis := FALSE;
END_IF
CASE nState OF
-20 : // Wait for start Tick
bNextStepActive := TRUE;
IF rtNextStep.Q AND bInfeedReady THEN
nState := -10;
bEnable := TRUE;
bExecute := TRUE;
fNextPosition := fHomePos;
bNextStepActive := FALSE;
END_IF
-10: // Move to home Position on first Startup
IF axMoveAbsMod.Done AND (NOT axMoveAbsMod.Error) AND (NOT axPower.Error) THEN
bEnable := FALSE;
bExecute := FALSE;
nState := 0;
END_IF
IF axMoveAbsMod.Error OR axPower.Error THEN
nState := 99;
END_IF
0: // In Home Position
bNextStepActive := TRUE;
IF rtNextStep.Q THEN
fNextPosition := fGrabPos;
bEnable := TRUE;
bExecute := TRUE;
bNextStepActive := FALSE;
IF bFullAutoActive THEN
fNextPosition := 7320;
nState := 60;
ELSE
fNextPosition := fGrabPos;
nState := 10;
END_IF
END_IF
10: // Move to Grab Position
IF axMoveAbsMod.Done AND (NOT axMoveAbsMod.Error) THEN
bEnable := FALSE;
bExecute := FALSE;
nState := 20;
END_IF
20: // In Grab Position
bNextStepActive := TRUE;
IF rtNextStep.Q OR bFullAutoActive THEN
fNextPosition := fChangePos;
bEnable := TRUE;
bExecute := TRUE;
nState := 30;
bNextStepActive := FALSE;
END_IF
30: // Wait for Change Position
IF axMoveAbsMod.Done AND (NOT axMoveAbsMod.Error) THEN
bEnable := FALSE;
bExecute := FALSE;
nState := 40;
END_IF
40: // In Change Position
bNextStepActive := TRUE;
IF rtNextStep.Q OR bFullAutoActive THEN
fNextPosition := fHomePos;
bEnable := TRUE;
bExecute := TRUE;
nState := 50;
bNextStepActive := FALSE;
END_IF
50: // Wait for Home Position
IF axMoveAbsMod.Done AND (NOT axMoveAbsMod.Error) THEN
bEnable := FALSE;
bExecute := FALSE;
nState := 0;
END_IF
60: // Move to Grab Position
IF axMoveAbsMod.Done AND (NOT axMoveAbsMod.Error) THEN
bEnable := FALSE;
bExecute := FALSE;
nState := 0;
END_IF
99: // Error
IF PLCReset THEN
bEnable := FALSE;
bExecute := FALSE;
bFullAutoActive := FALSE;
nState := -20;
END_IF
END_CASE
//bNextStepActive := bNextStepActive AND bInfeedReady;
// 0
// 1433,5
// 5917
// 7320]]></ST>
</Implementation>
<LineIds Name="FB_WZWArm_old">
<LineId Id="22" Count="0" />
<LineId Id="132" Count="0" />
<LineId Id="134" Count="0" />
<LineId Id="133" Count="0" />
<LineId Id="135" Count="1" />
<LineId Id="39" Count="0" />
<LineId Id="38" Count="0" />
<LineId Id="42" Count="8" />
<LineId Id="107" Count="2" />
<LineId Id="53" Count="0" />
<LineId Id="279" Count="3" />
<LineId Id="285" Count="0" />
<LineId Id="284" Count="0" />
<LineId Id="286" Count="2" />
<LineId Id="33" Count="1" />
<LineId Id="55" Count="0" />
<LineId Id="122" Count="0" />
<LineId Id="56" Count="1" />
<LineId Id="117" Count="0" />
<LineId Id="138" Count="0" />
<LineId Id="118" Count="0" />
<LineId Id="123" Count="0" />
<LineId Id="58" Count="1" />
<LineId Id="35" Count="0" />
<LineId Id="114" Count="1" />
<LineId Id="139" Count="0" />
<LineId Id="116" Count="0" />
<LineId Id="111" Count="0" />
<LineId Id="242" Count="3" />
<LineId Id="67" Count="1" />
<LineId Id="124" Count="0" />
<LineId Id="69" Count="1" />
<LineId Id="72" Count="0" />
<LineId Id="140" Count="0" />
<LineId Id="152" Count="1" />
<LineId Id="159" Count="0" />
<LineId Id="154" Count="0" />
<LineId Id="156" Count="0" />
<LineId Id="158" Count="0" />
<LineId Id="157" Count="0" />
<LineId Id="155" Count="0" />
<LineId Id="125" Count="0" />
<LineId Id="71" Count="0" />
<LineId Id="74" Count="1" />
<LineId Id="77" Count="1" />
<LineId Id="141" Count="0" />
<LineId Id="79" Count="0" />
<LineId Id="76" Count="0" />
<LineId Id="80" Count="1" />
<LineId Id="126" Count="0" />
<LineId Id="84" Count="2" />
<LineId Id="142" Count="0" />
<LineId Id="87" Count="0" />
<LineId Id="127" Count="0" />
<LineId Id="83" Count="0" />
<LineId Id="88" Count="1" />
<LineId Id="91" Count="1" />
<LineId Id="143" Count="0" />
<LineId Id="93" Count="0" />
<LineId Id="90" Count="0" />
<LineId Id="94" Count="1" />
<LineId Id="128" Count="0" />
<LineId Id="97" Count="2" />
<LineId Id="144" Count="0" />
<LineId Id="100" Count="0" />
<LineId Id="129" Count="0" />
<LineId Id="96" Count="0" />
<LineId Id="101" Count="1" />
<LineId Id="104" Count="1" />
<LineId Id="145" Count="0" />
<LineId Id="106" Count="0" />
<LineId Id="103" Count="0" />
<LineId Id="160" Count="0" />
<LineId Id="163" Count="4" />
<LineId Id="162" Count="0" />
<LineId Id="234" Count="3" />
<LineId Id="239" Count="0" />
<LineId Id="241" Count="0" />
<LineId Id="240" Count="0" />
<LineId Id="238" Count="0" />
<LineId Id="36" Count="0" />
<LineId Id="201" Count="0" />
<LineId Id="200" Count="0" />
<LineId Id="32" Count="0" />
<LineId Id="14" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="12" Count="1" />
</LineIds>
</POU>
</TcPlcObject>