194 lines
5.1 KiB
XML
194 lines
5.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
|
|
<POU Name="FB_Absaugtopf" Id="{d576f32d-5534-4480-b4a2-951a5fd0953a}" SpecialFunc="None">
|
|
<Declaration><![CDATA[FUNCTION_BLOCK FB_Absaugtopf
|
|
VAR_INPUT
|
|
bCmdTopfRunter : BOOL;
|
|
bCmdTopfHoch : BOOL;
|
|
bReset : BOOL;
|
|
nMHoch : UINT := 12;
|
|
nMRunter : UINT := 13;
|
|
nMRunterWZW : UINT := 100;
|
|
bSensorTopfOben : BOOL;
|
|
bSensorTopfUnten : BOOL;
|
|
bSensorKlemmungAktiv : BOOL;
|
|
bSensorKlemmungInaktiv : BOOL;
|
|
|
|
bBewegungKlemmungFertig : BOOL;
|
|
bKlemmungReferenziert : BOOL;
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
bVentilTopfRunter : BOOL;
|
|
bVentilKlemmungAus : BOOL;
|
|
|
|
fPositionKlemmung : LREAL;
|
|
bBewegeKlemmung : BOOL;
|
|
bHomingKlemmung : BOOL;
|
|
END_VAR
|
|
VAR
|
|
nState : INT;
|
|
tTimerRunter : TON;
|
|
tTimerHoch : TON;
|
|
|
|
rtCmdTopfHoch : R_TRIG;
|
|
rtCmdTopfRunter : R_TRIG;
|
|
rtReset : R_TRIG;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[rtCmdTopfHoch(CLK := bCmdTopfHoch);
|
|
rtCmdTopfRunter(CLK := bCmdTopfRunter);
|
|
rtReset(CLK := bReset);
|
|
|
|
IF rtReset.Q THEN
|
|
nState := 0;
|
|
bBewegeKlemmung := FALSE;
|
|
tTimerRunter(IN := FALSE);
|
|
tTimerHoch(IN := FALSE);
|
|
END_IF
|
|
|
|
CASE nState OF
|
|
0:
|
|
IF CNCSystem.Channel[0].M[nMRunter].bState_rw OR rtCmdTopfRunter.Q THEN
|
|
IF CNCSystem.Channel[0].M[nMRunter].bState_rw THEN
|
|
fPositionKlemmung := DINT_TO_LREAL(CNCSystem.Channel[0].M[nMRunter].nArgument_r) * 0.1;
|
|
IF bKlemmungReferenziert THEN
|
|
nState := 10;
|
|
ELSE
|
|
nState := 1;
|
|
END_IF
|
|
ELSE
|
|
bVentilKlemmungAus := FALSE;
|
|
nState := 12;
|
|
END_IF
|
|
END_IF
|
|
|
|
IF CNCSystem.Channel[0].M[nMHoch].bState_rw OR rtCmdTopfHoch.Q THEN
|
|
bVentilTopfRunter := FALSE;
|
|
nState := 20;
|
|
END_IF
|
|
|
|
IF CNCSystem.Channel[0].M[nMRunterWZW].bState_rw THEN
|
|
nState := 30;
|
|
bVentilTopfRunter := TRUE;
|
|
bVentilKlemmungAus := TRUE;
|
|
END_IF
|
|
|
|
1: // Referenzieren der Klemmung
|
|
bHomingKlemmung := TRUE;
|
|
|
|
IF bKlemmungReferenziert THEN
|
|
bHomingKlemmung := FALSE;
|
|
nState := 10;
|
|
END_IF
|
|
|
|
10: // Fahre Klemmung auf Position
|
|
bBewegeKlemmung := TRUE;
|
|
nState := 11;
|
|
|
|
11: // Warte auf Klemmung in Position
|
|
IF bBewegungKlemmungFertig THEN
|
|
bBewegeKlemmung := FALSE;
|
|
bVentilKlemmungAus := FALSE;
|
|
nState := 12;
|
|
END_IF
|
|
|
|
12: // Warte auf Klemmung aktiv
|
|
IF bSensorKlemmungAktiv THEN
|
|
bVentilTopfRunter := TRUE;
|
|
nState := 13;
|
|
END_IF
|
|
|
|
13: // Warte auf Topf unten
|
|
tTimerRunter(IN := TRUE, PT := T#3S);
|
|
|
|
IF tTimerRunter.Q THEN
|
|
tTimerRunter(IN := FALSE);
|
|
CNCSystem.Channel[0].M[nMRunter].bState_rw := FALSE;
|
|
nState := 0;
|
|
END_IF
|
|
|
|
20: // Warten auf druckaufbau bevor die Klemmung gelöst wird
|
|
// Damit der Topf nicht runterfällt
|
|
tTimerHoch(IN := TRUE, PT := T#500MS);
|
|
|
|
IF tTimerHoch.Q THEN
|
|
tTimerHoch(IN := FALSE);
|
|
bVentilKlemmungAus := TRUE;
|
|
nState := 21;
|
|
END_IF
|
|
|
|
21: // Warte auf Topf oben
|
|
IF bSensorTopfOben THEN
|
|
CNCSystem.Channel[0].M[nMHoch].bState_rw := FALSE;
|
|
nState := 0;
|
|
END_IF
|
|
|
|
30: // Topf runter ohne Klemmung
|
|
IF bSensorTopfUnten THEN
|
|
CNCSystem.Channel[0].M[nMRunterWZW].bState_rw := FALSE;
|
|
nState := 0;
|
|
END_IF
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
<LineIds Name="FB_Absaugtopf">
|
|
<LineId Id="70" Count="0" />
|
|
<LineId Id="72" Count="0" />
|
|
<LineId Id="192" Count="0" />
|
|
<LineId Id="194" Count="0" />
|
|
<LineId Id="193" Count="0" />
|
|
<LineId Id="195" Count="0" />
|
|
<LineId Id="197" Count="2" />
|
|
<LineId Id="196" Count="0" />
|
|
<LineId Id="22" Count="1" />
|
|
<LineId Id="25" Count="0" />
|
|
<LineId Id="28" Count="0" />
|
|
<LineId Id="183" Count="1" />
|
|
<LineId Id="232" Count="0" />
|
|
<LineId Id="186" Count="0" />
|
|
<LineId Id="233" Count="2" />
|
|
<LineId Id="187" Count="2" />
|
|
<LineId Id="185" Count="0" />
|
|
<LineId Id="29" Count="0" />
|
|
<LineId Id="27" Count="0" />
|
|
<LineId Id="31" Count="0" />
|
|
<LineId Id="140" Count="0" />
|
|
<LineId Id="32" Count="1" />
|
|
<LineId Id="96" Count="2" />
|
|
<LineId Id="100" Count="1" />
|
|
<LineId Id="99" Count="0" />
|
|
<LineId Id="236" Count="2" />
|
|
<LineId Id="240" Count="1" />
|
|
<LineId Id="244" Count="0" />
|
|
<LineId Id="242" Count="1" />
|
|
<LineId Id="34" Count="1" />
|
|
<LineId Id="162" Count="1" />
|
|
<LineId Id="151" Count="1" />
|
|
<LineId Id="171" Count="0" />
|
|
<LineId Id="182" Count="0" />
|
|
<LineId Id="175" Count="0" />
|
|
<LineId Id="172" Count="1" />
|
|
<LineId Id="176" Count="2" />
|
|
<LineId Id="181" Count="0" />
|
|
<LineId Id="179" Count="1" />
|
|
<LineId Id="153" Count="1" />
|
|
<LineId Id="165" Count="5" />
|
|
<LineId Id="164" Count="0" />
|
|
<LineId Id="44" Count="1" />
|
|
<LineId Id="134" Count="0" />
|
|
<LineId Id="46" Count="0" />
|
|
<LineId Id="135" Count="2" />
|
|
<LineId Id="141" Count="0" />
|
|
<LineId Id="139" Count="0" />
|
|
<LineId Id="138" Count="0" />
|
|
<LineId Id="129" Count="1" />
|
|
<LineId Id="142" Count="0" />
|
|
<LineId Id="144" Count="1" />
|
|
<LineId Id="133" Count="0" />
|
|
<LineId Id="102" Count="3" />
|
|
<LineId Id="107" Count="0" />
|
|
<LineId Id="106" Count="0" />
|
|
<LineId Id="26" Count="0" />
|
|
</LineIds>
|
|
</POU>
|
|
</TcPlcObject> |