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

159 lines
3.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_WZW" Id="{ca776168-414c-43f4-a7b2-3bac94c29b90}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_WZW
VAR_INPUT
bExecute : BOOL;
bReset : BOOL;
bSpindleInPosition : BOOL;
bPreselectOnly : BOOL;
uiToolPocket : DINT;
bInfeedActive : BOOL;
bSpindleOpen : BOOL;
END_VAR
VAR_IN_OUT
bExecutePreselect : BOOL;
END_VAR
VAR_OUTPUT
bCmdOpenSpindle : BOOL;
bDone : BOOL;
bError : BOOL;
END_VAR
VAR
fbWZWArm : FB_WZWArm;
bExecuteArm : BOOL;
fbWZWKette : FB_WZWKette;
bExecuteChain : BOOL;
rtExecute : R_TRIG;
rtPreselectTool : R_TRIG;
rtReset : R_TRIG;
nState : INT := 0;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Start command with rising edge
rtExecute(CLK := bExecute);
rtReset(CLK := bReset);
fbWZWArm(
bReset := bReset,
bExecute := bExecuteArm,
bSpindleOpen := bSpindleOpen,
bInfeedEnabled := bInfeedActive);
fbWZWKette(
bExecute := bExecuteChain OR bExecutePreselect,
bReset := bReset,
bInfeedEnabled := bInfeedActive,
uiToolPocket := uiToolPocket);
IF bExecutePreselect THEN
bExecutePreselect := FALSE;
END_IF
IF fbWZWArm.bError OR fbWZWKette.bError THEN
nState := 99;
END_IF
CASE nState OF
0: // Idle
bExecuteArm := FALSE;
bExecuteChain := FALSE;
bDone := TRUE;
IF rtExecute.Q AND bInfeedActive THEN
bExecuteChain := TRUE;
bDone := FALSE;
nState := 10;
END_IF
10: // Move chain to tool pocket
IF fbWZWKette.bDone THEN
bExecuteChain := FALSE;
IF bPreselectOnly THEN
nState := 0;
ELSE
nState := 20;
END_IF
END_IF
20: // Warte auf Spindel in Position zum Wechseln
IF bSpindleInPosition THEN
bExecuteArm := TRUE;
nState := 30;
END_IF
30: // Warte auf wechsel abgeschlossen
bCmdOpenSpindle := fbWZWArm.bCmdOpenSpindle;
IF fbWZWArm.bDone THEN
bExecuteArm := FALSE;
bDone := TRUE;
nState := 0;
END_IF
99: // Error
IF rtReset.Q THEN
nState := 0;
END_IF
bExecuteArm := FALSE;
bExecuteChain := FALSE;
END_CASE]]></ST>
</Implementation>
<LineIds Name="FB_WZW">
<LineId Id="79" Count="1" />
<LineId Id="213" Count="0" />
<LineId Id="212" Count="0" />
<LineId Id="94" Count="0" />
<LineId Id="93" Count="0" />
<LineId Id="246" Count="0" />
<LineId Id="100" Count="0" />
<LineId Id="150" Count="0" />
<LineId Id="105" Count="0" />
<LineId Id="101" Count="0" />
<LineId Id="95" Count="0" />
<LineId Id="102" Count="0" />
<LineId Id="179" Count="0" />
<LineId Id="106" Count="0" />
<LineId Id="103" Count="0" />
<LineId Id="281" Count="3" />
<LineId Id="142" Count="3" />
<LineId Id="82" Count="2" />
<LineId Id="148" Count="1" />
<LineId Id="136" Count="1" />
<LineId Id="85" Count="0" />
<LineId Id="108" Count="0" />
<LineId Id="138" Count="0" />
<LineId Id="86" Count="1" />
<LineId Id="89" Count="0" />
<LineId Id="91" Count="0" />
<LineId Id="109" Count="0" />
<LineId Id="118" Count="0" />
<LineId Id="122" Count="0" />
<LineId Id="110" Count="0" />
<LineId Id="112" Count="0" />
<LineId Id="115" Count="1" />
<LineId Id="113" Count="0" />
<LineId Id="111" Count="0" />
<LineId Id="119" Count="2" />
<LineId Id="129" Count="0" />
<LineId Id="123" Count="4" />
<LineId Id="130" Count="2" />
<LineId Id="135" Count="0" />
<LineId Id="134" Count="0" />
<LineId Id="133" Count="0" />
<LineId Id="139" Count="1" />
<LineId Id="214" Count="2" />
<LineId Id="146" Count="1" />
<LineId Id="92" Count="0" />
<LineId Id="28" Count="0" />
</LineIds>
</POU>
</TcPlcObject>