Initial commit

This commit is contained in:
Matthias Heisig
2024-10-22 14:22:54 +02:00
commit 51d6e7e5c4
120 changed files with 24764 additions and 0 deletions

View File

@@ -0,0 +1,194 @@
<?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>

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_AnschlagAbsaugung" Id="{268e7bad-7237-4eb6-ae17-e2c840d2dcaa}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_AnschlagAbsaugung
VAR_INPUT
bCmdPosition : BOOL;
bReset : BOOL;
fTargetPosition : LREAL;
bEnable : BOOL;
bCmdStartHoming : BOOL;
bHomeSwitch : BOOL;
END_VAR
VAR_OUTPUT
bNotEnableDrive AT %Q* : BOOL;
bDone : BOOL;
bHomed : BOOL;
END_VAR
VAR
refAxis : AXIS_REF;
axisPower : MC_Power;
axisHoming : MC_Home;
axisMoveAbs : MC_MoveAbsolute;
bStartHoming : BOOL;
bStartMoveAbs : BOOL;
rtStartHoming : R_TRIG;
rtHomingDone : R_TRIG;
rtStartMoving : R_TRIG;
rtMoveDone : R_TRIG;
rtReset : R_TRIG;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[bNotEnableDrive := NOT bEnable;
refAxis.ReadStatus();
rtStartHoming(CLK := bCmdStartHoming);
rtStartMoving(CLK := bCmdPosition);
rtReset(CLK := bReset);
axisPower(
Axis := refAxis,
Enable := bEnable,
Enable_Positive := TRUE,
Enable_Negative := TRUE,
Override := 100);
axisHoming(
Axis := refAxis,
Execute := bStartHoming,
HomingMode := MC_HomingMode.MC_DefaultHoming,
bCalibrationCam := NOT bHomeSwitch);
rtHomingDone(CLK := axisHoming.Done);
axisMoveAbs(
Axis := refAxis,
Execute := bStartMoveAbs,
Position := fTargetPosition,
Velocity := 50,
Acceleration := 0,
Deceleration := 0,
Jerk := 0);
rtMoveDone(CLK := axisMoveAbs.Done);
// Starte die Referenzpunktfahrt nur wenn die Achse auch aktiv ist
IF axisPower.Status AND rtStartHoming.Q THEN
bDone := FALSE;
bStartHoming := TRUE;
END_IF
IF rtHomingDone.Q THEN
bDone := TRUE;
bStartHoming := FALSE;
END_IF
// Starte das positionieren nur wenn die Achse aktiv und referenziert ist
IF axisPower.Status AND refAxis.Status.Homed AND rtStartMoving.Q THEN
bDone := FALSE;
bStartMoveAbs := TRUE;
END_IF
IF rtMoveDone.Q THEN
bDone := TRUE;
bStartMoveAbs := FALSE;
END_IF
bHomed := refAxis.Status.Homed;
// Reset
IF rtReset.Q THEN
bDone := FALSE;
bStartHoming := FALSE;
bStartMoveAbs := FALSE;
END_IF]]></ST>
</Implementation>
<LineIds Name="FB_AnschlagAbsaugung">
<LineId Id="9" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="51" Count="0" />
<LineId Id="50" Count="0" />
<LineId Id="102" Count="0" />
<LineId Id="110" Count="0" />
<LineId Id="25" Count="0" />
<LineId Id="24" Count="0" />
<LineId Id="26" Count="1" />
<LineId Id="29" Count="2" />
<LineId Id="43" Count="4" />
<LineId Id="49" Count="0" />
<LineId Id="105" Count="0" />
<LineId Id="83" Count="7" />
<LineId Id="123" Count="0" />
<LineId Id="57" Count="1" />
<LineId Id="42" Count="0" />
<LineId Id="39" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="100" Count="0" />
<LineId Id="40" Count="1" />
<LineId Id="54" Count="0" />
<LineId Id="53" Count="0" />
<LineId Id="101" Count="0" />
<LineId Id="55" Count="1" />
<LineId Id="92" Count="0" />
<LineId Id="91" Count="0" />
<LineId Id="93" Count="1" />
<LineId Id="106" Count="0" />
<LineId Id="95" Count="0" />
<LineId Id="119" Count="0" />
<LineId Id="118" Count="0" />
<LineId Id="120" Count="0" />
<LineId Id="122" Count="0" />
<LineId Id="121" Count="0" />
<LineId Id="158" Count="0" />
<LineId Id="157" Count="0" />
<LineId Id="112" Count="0" />
<LineId Id="111" Count="0" />
<LineId Id="113" Count="1" />
<LineId Id="116" Count="1" />
<LineId Id="115" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Blinker" Id="{7d2f1335-f667-4c98-8d51-a965a077362d}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Blinker
VAR_INPUT
timeTime : TIME := t#330ms;
END_VAR
VAR_OUTPUT
bQ : BOOL;
END_VAR
VAR
tonA : TON;
tonB : TON;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[tonA(IN := NOT tonB.Q, PT := timeTime, Q => bQ);
tonB(IN := tonA.Q, PT := timeTime);]]></ST>
</Implementation>
<LineIds Name="FB_Blinker">
<LineId Id="20" Count="0" />
<LineId Id="9" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_ControlUnit" Id="{40784e58-07f5-4c0c-bc44-0e5d4881e0e5}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_ControlUnit
VAR_INPUT
bReset : BOOL;
iZSW AT %I* : UINT;
END_VAR
VAR_OUTPUT
iSTW AT %Q* : UINT;
END_VAR
VAR
byteZSW : BYTE;
byteSTW : BYTE;
rtReset : R_TRIG;
tofReset : TOF;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[byteZSW := UINT_TO_BYTE(iZSW);
tofReset(IN := bReset, PT := T#2000MS);
byteSTW.7 := tofReset.Q;
iSTW := BYTE_TO_UINT(byteSTW);]]></ST>
</Implementation>
<LineIds Name="FB_ControlUnit">
<LineId Id="9" Count="0" />
<LineId Id="24" Count="0" />
<LineId Id="28" Count="1" />
<LineId Id="19" Count="0" />
<LineId Id="15" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Druckluftueberwachung" Id="{4ec61056-d0c8-4903-a1aa-fd76f3b805f6}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Druckluftueberwachung
VAR_INPUT
nErrorId : UINT := 1;
bSpindleStopped : BOOL;
bDruckluftOk : BOOL;
END_VAR
VAR_OUTPUT
bStopSpindle : BOOL;
END_VAR
VAR
tofDruckluftOk : TOF;
ftDruckluftOk : F_TRIG;
nState : INT := 0;
bDummy : BOOL;
fbAlarm : FB_Alarm;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[tofDruckluftOk(IN := bDruckluftOk, PT := T#1S);
// Abschalten bei fallender Flanke von Druckluft OK
ftDruckluftOk(CLK:= tofDruckluftOk.Q);
// Alarmbehandlung
fbAlarm(Event := TC_EVENTS.Alarms.Druckluft);
CASE nState OF
0: // IDLE
IF ftDruckluftOk.Q THEN
// MSG_ALARM_List[nErrorId] := TRUE;
fbAlarm.Raise := TRUE;
nState := 10;
END_IF
10: // Druck unter Wert gefallen -> Maschine anhalten und Freigabe wegnehmen
IF CNCSystem.Channel[0].ActState = HLI_IMCM_PROCESS_ACTIVE THEN
PLCMachineMode[0].Stop := TRUE;
nState := 20;
ELSE
bStopSpindle := TRUE;
PLCAxisEnable := FALSE;
nState := 30;
END_IF
20: // Warten auf Hold
IF CNCSystem.Channel[0].ActState = HLI_IMCM_PROCESS_HOLD THEN
bStopSpindle := TRUE;
nState := 30;
END_IF
30: // Warten auf Spindel stopp
IF bSpindleStopped THEN
nState := 60;
END_IF
60: // Warten auf Druckluft ok
IF bDruckluftOk THEN
fbAlarm.Raise := FALSE;
bStopSpindle := FALSE;
nState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<LineIds Name="FB_Druckluftueberwachung">
<LineId Id="98" Count="1" />
<LineId Id="14" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="140" Count="0" />
<LineId Id="139" Count="0" />
<LineId Id="141" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="15" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="114" Count="0" />
<LineId Id="137" Count="0" />
<LineId Id="20" Count="3" />
<LineId Id="90" Count="0" />
<LineId Id="24" Count="0" />
<LineId Id="47" Count="0" />
<LineId Id="92" Count="0" />
<LineId Id="95" Count="0" />
<LineId Id="94" Count="0" />
<LineId Id="93" Count="0" />
<LineId Id="91" Count="0" />
<LineId Id="38" Count="1" />
<LineId Id="49" Count="0" />
<LineId Id="61" Count="0" />
<LineId Id="65" Count="0" />
<LineId Id="62" Count="2" />
<LineId Id="66" Count="2" />
<LineId Id="81" Count="2" />
<LineId Id="116" Count="0" />
<LineId Id="86" Count="0" />
<LineId Id="84" Count="1" />
<LineId Id="72" Count="0" />
<LineId Id="18" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_MFunctions" Id="{cbc6d41c-7124-4f75-8f78-dc8f5d56d0c8}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_MFunctions
VAR_INPUT
nChannelIdx : INT := 0;
END_VAR
VAR_OUTPUT
END_VAR
VAR
bBSActive : BOOL;
iBSStatus : INT;
bMFunctionStatus : ARRAY [0..999] OF BOOL;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<LineIds Name="FB_MFunctions">
<LineId Id="9" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_MMS" Id="{6e8d53b3-dd5a-4cfe-a2ed-b0efb8ace903}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_MMS
VAR_INPUT
bEnable : BOOL;
END_VAR
VAR_OUTPUT
bAirOn AT %Q* : BOOL;
bLiquidPulse AT %Q* : BOOL;
END_VAR
VAR
tonA : TON;
tonB : TON;
bPulse : BOOL;
timeOnOff : TIME := t#400ms;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[bAirOn := bEnable;
bLiquidPulse := bEnable AND bPulse;
tonA(IN := NOT tonB.Q, PT := timeOnOff, Q => bPulse);
tonB(IN := tonA.Q, PT := timeOnOff);
]]></ST>
</Implementation>
<LineIds Name="FB_MMS">
<LineId Id="9" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="24" Count="0" />
<LineId Id="23" Count="0" />
<LineId Id="25" Count="0" />
<LineId Id="19" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,299 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Papiervorschub" Id="{668a62cf-64c8-49b5-ae3e-8fde0e3961f5}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Papiervorschub
VAR_INPUT
bExecute : BOOL;
bReset : BOOL;
bInfeedEnabled : BOOL;
fMMToGo : LREAL;
nMEnable : UINT := 50;
uiEncoderValue : UINT;
fMMPerRev : LREAL := 200;
nIncrPerRev : UINT := 1024;
fNSoll : LREAL := -400;
END_VAR
VAR_OUTPUT
bDone : BOOL;
bError : BOOL;
END_VAR
VAR
uiZSW1 AT %I* : UINT;
uiSTW1 AT %Q* : UINT;
iNSoll_A AT %Q* : INT;
iNIst_A AT %I* : INT;
wZSW1 : WORD;
wSTW1 : WORD;
nTargetPosition : DINT;
nActualPosition : DINT;
nDiff : DINT;
uiEncoderValueOld : UINT;
fPathToGo : LREAL;
nState : INT := 0;
nErrorState : INT := -1;
rtStart : R_TRIG;
rtReset : R_TRIG;
rtMFunctionStart : R_TRIG;
ftError : F_TRIG;
tofReset : TOF;
tonPollage : TON;
(*
bTest : BOOL;
fbADSRead : ADSREAD;
fbADSWrite : ADSWRITE;
ReadPort : T_AMSPort := 16#1002;
ReadGroup : UDINT := 16#F302;
ReadGroupOffset : UDINT := 16#0FA60000;
ReadLen : UDINT := 30;
ReadAdsDest : BYTE;
*)
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Einlesen
wZSW1 := UINT_TO_WORD(uiZSW1);
// Führung durch PLC
wSTW1.10 := 1;
// Start bei steigender Flanke
rtStart(CLK := bExecute);
rtMFunctionStart(CLK:= CNCSystem.Channel[0].M[nMEnable].bState_rw);
// Reset der Achse
tofReset(IN := bReset, PT := T#250MS);
wSTW1.7 := tofReset.Q;
// Error trigger
ftError(CLK := wZSW1.3);
// Fehlerzustand weitergeben
bError := wZSW1.3;
// Fehlerzustand
IF (wZSW1.3 = 1) AND (nState < 99) THEN
nErrorState := nState;
iNSoll_A := 0;
nState := 99;
END_IF
// Positionsnachführung
nDiff := ((nIncrPerRev + nIncrPerRev / 2 + (uiEncoderValue - uiEncoderValueOld)) MOD nIncrPerRev) - (nIncrPerRev / 2);
nActualPosition := nActualPosition + nDiff;
uiEncoderValueOld := uiEncoderValue;
CASE nState OF
0: // Idle -> Einschalten
wStW1.0 := 0; // Ein
wStW1.1 := 0; // Nicht Austrudel
wStW1.2 := 0; // Kein Schnellhalt
wStW1.3 := 0; // Betrieb freigeben
wSTW1.4 := 0; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
iNSoll_A := 0;
IF rtStart.Q AND bInfeedEnabled THEN
bDone := FALSE;
nActualPosition := 0;
nTargetPosition := LREAL_TO_DINT(nActualPosition + (nIncrPerRev * fMMToGo / fMMPerRev));
nState := 10;
END_IF
IF rtMFunctionStart.Q AND bInfeedEnabled THEN
bDone := FALSE;
nActualPosition := 0;
nTargetPosition := LREAL_TO_DINT(nActualPosition + (nIncrPerRev * CNCSystem.Channel[0].M[nMEnable].nArgument_r / fMMPerRev));
nState := 10;
END_IF
10: // Warten auf Einschaltbereit -> Betriebsbereit
wStW1.0 := 0; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // Hochlaufgeber freigeben
wSTW1.5 := 1; // Hochlaufgeber starten
wSTW1.6 := 1; // Sollwerte Freigeben
IF wZSW1.0 THEN // Einschaltbereit
nState := 20;
END_IF
20: // Warten auf Betriebsbereit
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // Hochlaufgeber freigeben
wSTW1.5 := 1; // Hochlaufgeber starten
wSTW1.6 := 1; // Sollwerte Freigeben
IF wZSW1.1 THEN // Betriebsbereit
nState := 25;
END_IF
25: // Warten auf pollagenidentifikation
tonPollage(IN := TRUE, PT := T#500MS);
IF tonPollage.Q THEN
tonPollage(IN := FALSE);
nState := 30;
END_IF
30: // Betriebsbereit -> Bewegungsparameter setzen
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // Hochlaufgeber freigeben
wSTW1.5 := 1; // Hochlaufgeber starten
wSTW1.6 := 1; // Sollwerte Freigeben
// Berechnung des Ausgabewertes
iNSoll_A := LREAL_TO_INT((16384 * fNSoll) / 1500);
IF nActualPosition >= nTargetPosition THEN
iNSoll_A := 0;
nState := 40;
END_IF
40: // Ausschalten
wStW1.0 := 0; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 0; // Hochlaufgeber freigeben
wSTW1.5 := 0; // Hochlaufgeber starten
wSTW1.6 := 0; // Sollwerte Freigeben
IF NOT wZSW1.1 THEN
nState := 0;
CNCSystem.Channel[0].M[nMEnable].bState_rw := FALSE;
bDone := TRUE;
END_IF
99: // Fehler
IF ftError.Q OR (wZSW1.3 = 0) THEN
nState := 0;
END_IF
END_CASE
(*
ReadGroupOffset := 16#0FA60000;
fbADSRead(
NETID := '172.18.236.82.5.17',
PORT := ReadPort,
IDXGRP := ReadGroup,
IDXOFFS := ReadGroupOffset,
LEN := ReadLen,
DESTADDR := ADR(ReadAdsDest),
READ := bTest,
TMOUT := T#1S);
*)
(*
ReadAdsDest := 1;
fbADSWrite(
NETID := '172.18.236.82.5.17',
PORT := ReadPort,
IDXGRP := ReadGroup,
IDXOFFS := ReadGroupOffset,
LEN := 1,
SRCADDR := ADR(ReadAdsDest),
WRITE := bTest,
TMOUT := T#1S);
*)
uiSTW1 := WORD_TO_UINT(wStw1);]]></ST>
</Implementation>
<LineIds Name="FB_Papiervorschub">
<LineId Id="39" Count="0" />
<LineId Id="37" Count="0" />
<LineId Id="41" Count="1" />
<LineId Id="40" Count="0" />
<LineId Id="59" Count="0" />
<LineId Id="61" Count="0" />
<LineId Id="60" Count="0" />
<LineId Id="387" Count="0" />
<LineId Id="47" Count="2" />
<LineId Id="38" Count="0" />
<LineId Id="195" Count="1" />
<LineId Id="194" Count="0" />
<LineId Id="198" Count="1" />
<LineId Id="197" Count="0" />
<LineId Id="54" Count="3" />
<LineId Id="147" Count="0" />
<LineId Id="58" Count="0" />
<LineId Id="53" Count="0" />
<LineId Id="165" Count="0" />
<LineId Id="162" Count="0" />
<LineId Id="333" Count="0" />
<LineId Id="161" Count="0" />
<LineId Id="164" Count="0" />
<LineId Id="64" Count="9" />
<LineId Id="145" Count="1" />
<LineId Id="76" Count="2" />
<LineId Id="151" Count="0" />
<LineId Id="158" Count="0" />
<LineId Id="80" Count="0" />
<LineId Id="84" Count="0" />
<LineId Id="388" Count="2" />
<LineId Id="392" Count="2" />
<LineId Id="391" Count="0" />
<LineId Id="85" Count="8" />
<LineId Id="96" Count="13" />
<LineId Id="111" Count="2" />
<LineId Id="63" Count="0" />
<LineId Id="398" Count="5" />
<LineId Id="405" Count="0" />
<LineId Id="404" Count="0" />
<LineId Id="116" Count="0" />
<LineId Id="118" Count="7" />
<LineId Id="136" Count="1" />
<LineId Id="144" Count="0" />
<LineId Id="148" Count="1" />
<LineId Id="168" Count="0" />
<LineId Id="166" Count="1" />
<LineId Id="169" Count="1" />
<LineId Id="172" Count="5" />
<LineId Id="171" Count="0" />
<LineId Id="178" Count="0" />
<LineId Id="180" Count="1" />
<LineId Id="395" Count="0" />
<LineId Id="182" Count="0" />
<LineId Id="179" Count="0" />
<LineId Id="183" Count="0" />
<LineId Id="185" Count="0" />
<LineId Id="188" Count="1" />
<LineId Id="184" Count="0" />
<LineId Id="143" Count="0" />
<LineId Id="331" Count="0" />
<LineId Id="313" Count="0" />
<LineId Id="312" Count="0" />
<LineId Id="253" Count="0" />
<LineId Id="252" Count="0" />
<LineId Id="254" Count="7" />
<LineId Id="326" Count="1" />
<LineId Id="315" Count="1" />
<LineId Id="319" Count="3" />
<LineId Id="318" Count="0" />
<LineId Id="323" Count="2" />
<LineId Id="328" Count="0" />
<LineId Id="317" Count="0" />
<LineId Id="193" Count="0" />
<LineId Id="192" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Spindel" Id="{50a6eecd-bacb-461c-81db-8d25d13f0ab9}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Spindel
VAR_INPUT
bSensor3 : BOOL;
bSensor4 : BOOL;
iAxNr : INT := 4;
bCmdOpenSpindle : BOOL;
bCmdStopSpindle : BOOL;
bAirCurtainEnabled : BOOL := TRUE;
END_VAR
VAR_OUTPUT
bSperrluft : BOOL := TRUE;
bKonusReiniung : BOOL;
bATCOn : BOOL;
bATCOff : BOOL;
bSpindleOpen : BOOL;
bSpindleClosed : BOOL;
bSpindleClosedWithTool : BOOL;
bSpindleStopped : BOOL;
END_VAR
VAR
ftATCOn : F_TRIG;
tofATCOff : TOF;
bInternCmdOpenSpindle : BOOL;
bCanOpenSpindle : BOOL;
rtCmdOpenSpindle : R_TRIG;
ftCmdOpenSpindle : F_TRIG;
tofCmdCloseSpindle : TOF;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// State spindle closed with tool
bSpindleClosedWithTool := bSensor3 AND bSensor4;
// State spindle closed without tool
bSpindleClosed := bSensor3 AND (NOT bSensor4);
// Spindle open
bSpindleOpen := (NOT bSensor3) AND bSensor4;
// Sperrluftbehandlung
bSperrluft := bAirCurtainEnabled;
rtCmdOpenSpindle(CLK := bCmdOpenSpindle);
IF rtCmdOpenSpindle.Q THEN
bInternCmdOpenSpindle := TRUE;
END_IF
ftCmdOpenSpindle(CLK := bCmdOpenSpindle);
IF ftCmdOpenSpindle.Q THEN
bInternCmdOpenSpindle := FALSE;
END_IF
// Freigabe der Spindel nur bei gespannten Werkzeug
gpAx[iAxNr]^.ipo_mc_control.feedhold.enable_w := TRUE;
gpAx[iAxNr]^.ipo_mc_control.feedhold.command_w := (NOT bSpindleClosedWithTool) OR bCmdStopSpindle;
// Enable taper cleaning air with open spindle
IF bSpindleOpen THEN
bKonusReiniung := TRUE;
ELSE
bKonusReiniung := FALSE;
END_IF
// Spindel öffnen
ftATCOn(CLK := bATCOn);
tofATCOff(In := ftATCOn.Q, PT := T#1S);
// bATCOn := bCmdOpenSpindle;
// Öffnen der Spindel nur bei stillstand der Spindel und programmierter 0 drehzahl
bSpindleStopped := gpAx[iAxNr]^.lr_state.rev_null_r;
bCanOpenSpindle := bSpindleStopped AND (gpAx[iAxNr]^.lr_state.active_rev_r = 0);
bATCOn := bInternCmdOpenSpindle AND bCanOpenSpindle;
bATCOff := tofATCOff.Q;]]></ST>
</Implementation>
<LineIds Name="FB_Spindel">
<LineId Id="24" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="50" Count="0" />
<LineId Id="49" Count="0" />
<LineId Id="52" Count="0" />
<LineId Id="56" Count="0" />
<LineId Id="55" Count="0" />
<LineId Id="57" Count="0" />
<LineId Id="186" Count="2" />
<LineId Id="116" Count="0" />
<LineId Id="115" Count="0" />
<LineId Id="117" Count="2" />
<LineId Id="152" Count="0" />
<LineId Id="151" Count="0" />
<LineId Id="153" Count="2" />
<LineId Id="95" Count="0" />
<LineId Id="94" Count="0" />
<LineId Id="97" Count="0" />
<LineId Id="96" Count="0" />
<LineId Id="26" Count="0" />
<LineId Id="25" Count="0" />
<LineId Id="27" Count="1" />
<LineId Id="30" Count="1" />
<LineId Id="29" Count="0" />
<LineId Id="62" Count="0" />
<LineId Id="61" Count="0" />
<LineId Id="67" Count="2" />
<LineId Id="63" Count="0" />
<LineId Id="219" Count="0" />
<LineId Id="254" Count="0" />
<LineId Id="220" Count="0" />
<LineId Id="113" Count="0" />
<LineId Id="64" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Staubsauger" Id="{50cee699-4f80-42b0-957b-fb687074a8d0}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Staubsauger
VAR_INPUT
bToggleEnable : BOOL;
nMOn : INT := 68;
nMOff : INT := 69;
END_VAR
VAR_OUTPUT
bVacuumOn AT %Q* : BOOL;
END_VAR
VAR
rtToggleEnable : R_TRIG;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[rtToggleEnable(CLK := bToggleEnable);
IF rtToggleEnable.Q THEN
bVacuumOn := NOT bVacuumOn;
END_IF
IF CNCSystem.Channel[0].M[nMOn].bState_rw THEN
bVacuumOn := TRUE;
CNCSystem.Channel[0].M[nMOn].bState_rw := FALSE;
END_IF
IF CNCSystem.Channel[0].M[nMOff].bState_rw THEN
bVacuumOn := FALSE;
CNCSystem.Channel[0].M[nMOff].bState_rw := FALSE;
END_IF]]></ST>
</Implementation>
<LineIds Name="FB_Staubsauger">
<LineId Id="9" Count="0" />
<LineId Id="25" Count="3" />
<LineId Id="15" Count="0" />
<LineId Id="14" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="21" Count="3" />
<LineId Id="20" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Vakuumfelder" Id="{b73b6e2f-4be0-410a-bacf-8c5aedb29f5d}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Vakuumfelder
VAR_IN_OUT
bExecuteHMI : BOOL;
END_VAR
VAR_INPUT
nFieldNumber : INT;
nMVakuumfeldEin : UINT := 51;
nMVakuumfeldAus : UINT := 52;
nMVakuumAlleEin : UINT := 53;
nMVakuumAlleAus : UINT := 54;
nChannelIdx : UINT := 0;
END_VAR
VAR_OUTPUT
bVentilVakuumfeld1 AT %Q* : BOOL;
bVentilVakuumfeld2 AT %Q* : BOOL;
bVentilVakuumfeld3 AT %Q* : BOOL;
bVentilVakuumfeld4 AT %Q* : BOOL;
bVentilVakuumfeld5 AT %Q* : BOOL;
bVentilVakuumfeld6 AT %Q* : BOOL;
bVentilVakuumfeld7 AT %Q* : BOOL;
bVentilVakuumfeld8 AT %Q* : BOOL;
bVentilVakuumfeld9 AT %Q* : BOOL;
bVentilVakuumfeld10 AT %Q* : BOOL;
bVentilBelueftung AT %Q* : BOOL;
END_VAR
VAR
bEinschalten : BOOL;
bSchalten : BOOL;
nVakuumfeldNummer : DINT;
nState : INT := 0;
rtExecuteHMI : R_TRIG;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[rtExecuteHMI(CLK := bExecuteHMI);
IF rtExecuteHMI.Q THEN
bExecuteHMI := FALSE;
bEinschalten := TRUE;
bSchalten := TRUE;
nVakuumfeldNummer := nFieldNumber;
END_IF
(* Einschalten aller Vakuumfelder *)
IF CNCSystem.Channel[nChannelIdx].M[nMVakuumAlleEin].bState_rw THEN
bVentilVakuumfeld10 := TRUE;
bVentilVakuumfeld9 := TRUE;
bVentilVakuumfeld8 := TRUE;
bVentilVakuumfeld7 := TRUE;
bVentilVakuumfeld6 := TRUE;
bVentilVakuumfeld5 := TRUE;
bVentilVakuumfeld4 := TRUE;
bVentilVakuumfeld3 := TRUE;
bVentilVakuumfeld2 := TRUE;
bVentilVakuumfeld1 := TRUE;
bVentilBelueftung := FALSE;
CNCSystem.Channel[nChannelIdx].M[nMVakuumAlleEin].bState_rw := FALSE;
END_IF
(* Ausschalten aller Vakuumfelder *)
IF CNCSystem.Channel[nChannelIdx].M[nMVakuumAlleAus].bState_rw THEN
bVentilVakuumfeld10 := FALSE;
bVentilVakuumfeld9 := FALSE;
bVentilVakuumfeld8 := FALSE;
bVentilVakuumfeld7 := FALSE;
bVentilVakuumfeld6 := FALSE;
bVentilVakuumfeld5 := FALSE;
bVentilVakuumfeld4 := FALSE;
bVentilVakuumfeld3 := FALSE;
bVentilVakuumfeld2 := FALSE;
bVentilVakuumfeld1 := FALSE;
bVentilBelueftung := TRUE;
CNCSystem.Channel[nChannelIdx].M[nMVakuumAlleAus].bState_rw := FALSE;
END_IF
(* Einschalten der Vakuumfelder *)
IF CNCSystem.Channel[nChannelIdx].M[nMVakuumfeldEin].bState_rw THEN
nVakuumfeldNummer := CNCSystem.Channel[nChannelIdx].M[nMVakuumfeldEin].nArgument_r;
bSchalten := TRUE;
bEinschalten := TRUE;
CNCSystem.Channel[nChannelIdx].M[nMVakuumfeldEin].bState_rw := FALSE;
END_IF
(* Ausschalten der Vakuumfelder *)
IF CNCSystem.Channel[nChannelIdx].M[nMVakuumfeldAus].bState_rw THEN
nVakuumfeldNummer := CNCSystem.Channel[nChannelIdx].M[nMVakuumfeldAus].nArgument_r;
bSchalten := TRUE;
bEinschalten := FALSE;
CNCSystem.Channel[nChannelIdx].M[nMVakuumfeldAus].bState_rw := FALSE;
END_IF
IF bSchalten THEN
bSchalten := FALSE;
bVentilVakuumfeld10 := FALSE;
bVentilVakuumfeld9 := FALSE;
bVentilVakuumfeld8 := FALSE;
bVentilVakuumfeld7 := FALSE;
bVentilVakuumfeld6 := FALSE;
bVentilVakuumfeld5 := FALSE;
bVentilVakuumfeld4 := FALSE;
bVentilVakuumfeld3 := FALSE;
bVentilVakuumfeld2 := FALSE;
bVentilVakuumfeld1 := FALSE;
bVentilBelueftung := NOT bEinschalten;
CASE nVakuumfeldNummer OF
1:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld2 := bEinschalten;
bVentilVakuumfeld5 := bEinschalten;
bVentilVakuumfeld6 := bEinschalten;
2:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld3 := bEinschalten;
3:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld2 := bEinschalten;
bVentilVakuumfeld3 := bEinschalten;
bVentilVakuumfeld4 := bEinschalten;
4:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld2 := bEinschalten;
bVentilVakuumfeld3 := bEinschalten;
bVentilVakuumfeld4 := bEinschalten;
bVentilVakuumfeld7 := bEinschalten;
5:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld2 := bEinschalten;
bVentilVakuumfeld3 := bEinschalten;
bVentilVakuumfeld4 := bEinschalten;
bVentilVakuumfeld5 := bEinschalten;
bVentilVakuumfeld7 := bEinschalten;
bVentilVakuumfeld8 := bEinschalten;
6:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld2 := bEinschalten;
bVentilVakuumfeld3 := bEinschalten;
bVentilVakuumfeld4 := bEinschalten;
bVentilVakuumfeld5 := bEinschalten;
bVentilVakuumfeld6 := bEinschalten;
bVentilVakuumfeld7 := bEinschalten;
bVentilVakuumfeld8 := bEinschalten;
bVentilVakuumfeld9 := bEinschalten;
7:
bVentilVakuumfeld1 := bEinschalten;
bVentilVakuumfeld2 := bEinschalten;
bVentilVakuumfeld3 := bEinschalten;
bVentilVakuumfeld4 := bEinschalten;
bVentilVakuumfeld5 := bEinschalten;
bVentilVakuumfeld6 := bEinschalten;
bVentilVakuumfeld7 := bEinschalten;
bVentilVakuumfeld8 := bEinschalten;
bVentilVakuumfeld9 := bEinschalten;
bVentilVakuumfeld10 := bEinschalten;
END_CASE
END_IF]]></ST>
</Implementation>
<LineIds Name="FB_Vakuumfelder">
<LineId Id="233" Count="0" />
<LineId Id="236" Count="0" />
<LineId Id="235" Count="0" />
<LineId Id="237" Count="0" />
<LineId Id="239" Count="1" />
<LineId Id="275" Count="0" />
<LineId Id="238" Count="0" />
<LineId Id="234" Count="0" />
<LineId Id="45" Count="15" />
<LineId Id="43" Count="1" />
<LineId Id="29" Count="2" />
<LineId Id="39" Count="0" />
<LineId Id="32" Count="6" />
<LineId Id="9" Count="0" />
<LineId Id="40" Count="0" />
<LineId Id="42" Count="0" />
<LineId Id="61" Count="1" />
<LineId Id="41" Count="0" />
<LineId Id="64" Count="0" />
<LineId Id="66" Count="2" />
<LineId Id="86" Count="0" />
<LineId Id="77" Count="0" />
<LineId Id="173" Count="0" />
<LineId Id="70" Count="4" />
<LineId Id="87" Count="0" />
<LineId Id="78" Count="0" />
<LineId Id="174" Count="0" />
<LineId Id="63" Count="0" />
<LineId Id="89" Count="0" />
<LineId Id="88" Count="0" />
<LineId Id="90" Count="0" />
<LineId Id="125" Count="0" />
<LineId Id="116" Count="8" />
<LineId Id="115" Count="0" />
<LineId Id="126" Count="1" />
<LineId Id="92" Count="2" />
<LineId Id="105" Count="0" />
<LineId Id="203" Count="2" />
<LineId Id="96" Count="0" />
<LineId Id="128" Count="0" />
<LineId Id="106" Count="0" />
<LineId Id="97" Count="0" />
<LineId Id="129" Count="1" />
<LineId Id="107" Count="0" />
<LineId Id="206" Count="0" />
<LineId Id="98" Count="0" />
<LineId Id="132" Count="1" />
<LineId Id="131" Count="0" />
<LineId Id="108" Count="0" />
<LineId Id="208" Count="0" />
<LineId Id="99" Count="0" />
<LineId Id="135" Count="2" />
<LineId Id="134" Count="0" />
<LineId Id="109" Count="0" />
<LineId Id="211" Count="1" />
<LineId Id="100" Count="0" />
<LineId Id="139" Count="3" />
<LineId Id="138" Count="0" />
<LineId Id="110" Count="0" />
<LineId Id="213" Count="2" />
<LineId Id="101" Count="0" />
<LineId Id="216" Count="7" />
<LineId Id="111" Count="0" />
<LineId Id="224" Count="0" />
<LineId Id="95" Count="0" />
<LineId Id="91" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Vakuumpumpe" Id="{56747386-4093-4ce8-86aa-e3f67ca94e13}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Vakuumpumpe
VAR_INPUT
bToggle : BOOL;
nMEin : INT := 74;
nMAus : INT := 75;
nChannelIdx : UINT := 0;
bReset : BOOL;
END_VAR
VAR_OUTPUT
bUmrichterFehler AT %I* : BOOL;
bVakuumpumpeEin AT %Q* : BOOL := FALSE;
iFrequenzVakuumpumpe AT %Q* : INT := 0; // 27230 = 50 Hz, 32767 = 60 Hz
END_VAR
VAR
rtToggle : R_TRIG;
rtReset : R_TRIG;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[rtReset(CLK := bReset);
rtToggle(CLK := bToggle);
IF rtToggle.Q THEN
IF NOT bVakuumpumpeEin THEN
bVakuumpumpeEin := TRUE;
iFrequenzVakuumpumpe := 32000;
ELSE
bVakuumpumpeEin := FALSE;
iFrequenzVakuumpumpe := 0;
END_IF
END_IF
IF CNCSystem.Channel[nChannelIdx].M[nMEin].bState_rw THEN
bVakuumpumpeEin := TRUE;
iFrequenzVakuumpumpe := 32000;
CNCSystem.Channel[nChannelIdx].M[nMEin].bState_rw := FALSE;
END_IF
IF CNCSystem.Channel[nChannelIdx].M[nMAus].bState_rw THEN
bVakuumpumpeEin := FALSE;
iFrequenzVakuumpumpe := 0;
CNCSystem.Channel[nChannelIdx].M[nMAus].bState_rw := FALSE;
END_IF
IF rtReset.Q THEN
bVakuumpumpeEin := FALSE;
iFrequenzVakuumpumpe := 0;
CNCSystem.Channel[nChannelIdx].M[nMEin].bState_rw := FALSE;
CNCSystem.Channel[nChannelIdx].M[nMAus].bState_rw := FALSE;
END_IF]]></ST>
</Implementation>
<LineIds Name="FB_Vakuumpumpe">
<LineId Id="9" Count="0" />
<LineId Id="56" Count="0" />
<LineId Id="55" Count="0" />
<LineId Id="58" Count="0" />
<LineId Id="57" Count="0" />
<LineId Id="61" Count="1" />
<LineId Id="64" Count="3" />
<LineId Id="63" Count="0" />
<LineId Id="60" Count="0" />
<LineId Id="18" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="21" Count="1" />
<LineId Id="20" Count="0" />
<LineId Id="26" Count="4" />
<LineId Id="25" Count="0" />
<LineId Id="32" Count="0" />
<LineId Id="31" Count="0" />
<LineId Id="33" Count="0" />
<LineId Id="35" Count="2" />
<LineId Id="34" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,159 @@
<?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>

View File

@@ -0,0 +1,274 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_WZWArm" Id="{0bd61078-7831-4aaf-91a6-e74717f4416a}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_WZWArm
VAR_INPUT
bReset : BOOL;
bExecute : BOOL;
bInfeedEnabled : BOOL;
bSpindleOpen : BOOL;
END_VAR
VAR_OUTPUT
bCmdOpenSpindle : BOOL;
bError : BOOL;
bDone : BOOL;
END_VAR
VAR
// Achssteuerung
uiZSW1 AT %I* : UINT;
uiAKTSATZ AT %I* : UINT;
uiSTW1 AT %Q* : UINT;
uiSatzAnw AT %Q* : UINT;
// Zustandsautomat
nState : INT := 0;
// Start bei steigender Flanke
rtStart : R_TRIG;
// Hilfsvariablen
wZSW1 : WORD;
wAktSatz : WORD;
wSTW1 : WORD;
tofReset : TOF;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Umrichterwerte lesen
wZSW1 := UINT_TO_WORD(uiZSW1);
wAktSatz := UINT_TO_WORD(uiAktSatz);
// Führung durch PLC
wSTW1.10 := 1;
// Reset der Achse wenn nötig
tofReset(IN := bReset, PT := T#250MS);
wSTW1.7 := tofReset.Q;
// Start bei steigender Flanke
rtStart(CLK := bExecute);
CASE nState OF
0 : // Idle
wStW1.0 := 0; // Ein
wStW1.1 := 0; // Nicht Austrudel
wStW1.2 := 0; // Kein Schnellhalt
wStW1.3 := 0; // Betrieb freigeben
wSTW1.4 := 0; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
bDone := TRUE;
bCmdOpenSpindle := FALSE;
IF rtStart.Q AND bInfeedEnabled THEN
bExecute := FALSE;
bDone := FALSE;
nState := 10;
END_IF
10: // Warten auf Einschaltbereit
wStW1.0 := 0; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 1; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF wZSW1.0 THEN // Einschaltbereit
nState := 20;
END_IF
20: // Warten auf Betriebsbereit
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 1; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF wZSW1.2 THEN // Betriebsbereit
nState := 30;
END_IF
30: // Betreibsbereit -> Greifen
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 1; // EPOS kein Zwischenhalt
wSTW1.6 := 1; // EPOS Verfahrauftrag aktivieren 0 -> 1
// Starte beim ersten Satz
uiSatzAnw := 0;
IF wZSW1.12 AND (NOT wZSW1.10) THEN // Verfahrauftrag aktiv
nState := 40;
END_IF
40: // Warten auf in Position
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF wZSW1.10 THEN
nState := 50;
END_IF
50: // Warten auf Spindel offen
bCmdOpenSpindle := TRUE;
uiSatzAnw := 1;
IF bSpindleOpen THEN
nState := 60;
END_IF
60: // Warten auf nächste Position (Werkzeuge getauscht)
wSTW1.6 := 1; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF wZSW1.12 AND (NOT wZSW1.10) THEN
nState := 65;
END_IF
65: // Warten auf in Position
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF wZSW1.10 THEN
nState := 70;
END_IF
70: // Warte auf Spindel zu
uiSatzAnw := 2;
wSTW1.6 := 0;
bCmdOpenSpindle := FALSE;
IF (NOT bSpindleOpen) THEN
nState := 80;
END_IF
80: // Warte auf nächste Position (Ruheposition)
wSTW1.6 := 1;
IF wZSW1.12 AND (NOT wZSW1.10) THEN
nState := 85;
END_IF
85: // Warte auf position erreicht
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF wZSW1.10 THEN
nState := 90;
END_IF
90: // Ausschalten
wStW1.0 := 0; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 0; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
IF NOT wZSW1.1 THEN
nState := 0;
END_IF
99: // Error
bError := TRUE;
END_CASE
// Umrichterwerte schreiben
uiSTW1 := WORD_TO_UINT(wSTW1);]]></ST>
</Implementation>
<LineIds Name="FB_WZWArm">
<LineId Id="132" Count="0" />
<LineId Id="378" Count="0" />
<LineId Id="288" Count="0" />
<LineId Id="433" Count="1" />
<LineId Id="432" Count="0" />
<LineId Id="600" Count="0" />
<LineId Id="599" Count="0" />
<LineId Id="601" Count="1" />
<LineId Id="398" Count="1" />
<LineId Id="397" Count="0" />
<LineId Id="33" Count="1" />
<LineId Id="162" Count="0" />
<LineId Id="379" Count="4" />
<LineId Id="363" Count="0" />
<LineId Id="435" Count="0" />
<LineId Id="560" Count="1" />
<LineId Id="555" Count="1" />
<LineId Id="400" Count="0" />
<LineId Id="402" Count="0" />
<LineId Id="500" Count="0" />
<LineId Id="562" Count="0" />
<LineId Id="403" Count="0" />
<LineId Id="401" Count="0" />
<LineId Id="384" Count="1" />
<LineId Id="387" Count="4" />
<LineId Id="386" Count="0" />
<LineId Id="436" Count="0" />
<LineId Id="404" Count="0" />
<LineId Id="406" Count="1" />
<LineId Id="405" Count="0" />
<LineId Id="408" Count="1" />
<LineId Id="411" Count="4" />
<LineId Id="410" Count="0" />
<LineId Id="437" Count="0" />
<LineId Id="416" Count="0" />
<LineId Id="418" Count="1" />
<LineId Id="417" Count="0" />
<LineId Id="420" Count="1" />
<LineId Id="424" Count="4" />
<LineId Id="423" Count="0" />
<LineId Id="438" Count="0" />
<LineId Id="429" Count="0" />
<LineId Id="431" Count="0" />
<LineId Id="430" Count="0" />
<LineId Id="439" Count="0" />
<LineId Id="441" Count="1" />
<LineId Id="440" Count="0" />
<LineId Id="443" Count="1" />
<LineId Id="503" Count="0" />
<LineId Id="445" Count="4" />
<LineId Id="554" Count="0" />
<LineId Id="502" Count="0" />
<LineId Id="450" Count="0" />
<LineId Id="493" Count="0" />
<LineId Id="451" Count="3" />
<LineId Id="504" Count="0" />
<LineId Id="495" Count="0" />
<LineId Id="455" Count="0" />
<LineId Id="463" Count="1" />
<LineId Id="543" Count="1" />
<LineId Id="546" Count="2" />
<LineId Id="545" Count="0" />
<LineId Id="465" Count="1" />
<LineId Id="506" Count="0" />
<LineId Id="505" Count="0" />
<LineId Id="557" Count="1" />
<LineId Id="497" Count="0" />
<LineId Id="467" Count="4" />
<LineId Id="507" Count="0" />
<LineId Id="499" Count="0" />
<LineId Id="473" Count="1" />
<LineId Id="472" Count="0" />
<LineId Id="509" Count="1" />
<LineId Id="550" Count="2" />
<LineId Id="549" Count="0" />
<LineId Id="475" Count="1" />
<LineId Id="478" Count="5" />
<LineId Id="477" Count="0" />
<LineId Id="484" Count="3" />
<LineId Id="234" Count="1" />
<LineId Id="564" Count="0" />
<LineId Id="36" Count="0" />
<LineId Id="201" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="392" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,264 @@
<?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>

View File

@@ -0,0 +1,399 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_WZWKette" Id="{de78c7b1-582b-4c7b-bb52-35e58f49ffdc}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_WZWKette
VAR_INPUT
bExecute : BOOL;
bReset : BOOL;
uiToolPocket : DINT := 1;
bInfeedEnabled : BOOL;
uiMaxToolPockets : UINT := 51;
END_VAR
VAR_OUTPUT
bDone : BOOL;
bError : BOOL;
nErrorId : INT;
END_VAR
VAR
uiZSW1 AT %I* : UINT;
uiAKTSATZ AT %I* : UINT;
uiZSW2 AT %I* : UINT;
uiX_IST AT %I* : UINT;
uiX_IST2 AT %I* : UINT;
uiSTW1 AT %Q* : UINT;
uiSATZANW AT %Q* : UINT;
uiSTW2 AT %Q* : UINT;
uiMDI_TARPOS AT %Q* : UINT;
uiMDI_TARPOS2 AT %Q* : UINT;
uiMDI_VELOCITY AT %Q* : UINT;
uiMDI_VELOCITY2 AT %Q* : UINT;
uiMDI_ACC AT %Q* : UINT;
uiMDI_DEC AT %Q* : UINT;
uiMDI_MOD AT %Q* : UINT;
rtStart : R_TRIG;
rtReset : R_TRIG;
ftError : F_TRIG;
nState : INT := 0;
nErrorState : INT := -1;
dwTargetPosition : DWORD;
dwCurrentPosition : DWORD;
dwTargetSpeed : DWORD := 17260; // MAX 17260
wTargetPositionLow : WORD;
wTargetPositionHigh : WORD;
wZSW1 : WORD;
wSATZANW : WORD;
wZSW2 : WORD;
wSTW1 : WORD;
wAKTSATZ : WORD;
wSTW2 : WORD;
wMDI_MOD : WORD;
tofReset : TOF;
tonWaitAktive : TON;
bTest : BOOL;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// VERSION FÜR EPOS
// Einlesen
wZSW1 := UINT_TO_WORD(uiZSW1);
wAKTSATZ := UINT_TO_WORD(uiAKTSATZ);
wZSW2 := UINT_TO_WORD(uiZSW2);
dwCurrentPosition := UINT_TO_DWORD(uiX_IST);
dwCurrentPosition := SHL(dwCurrentPosition, 16) + UINT_TO_DWORD(uiX_IST2);
IF uiToolPocket > 0 AND uiToolPocket < 51 THEN
dwTargetPosition := DINT_TO_DWORD(3672000 - ((uiToolPocket - 1) * 72000));
ELSE
dwTargetPosition := 0;
END_IF
// Führung durch PLC
wSTW1.10 := 1;
// Absolute positionierung
wMDI_MOD.0 := 1;
// Positionierung absolut kürzester Weg
wMDI_MOD.1 := 0;
// Start bei steigender Flanke
rtStart(CLK := bExecute);
// Reset
rtReset(CLK := bReset);
// Error trigger
ftError(CLK := wZSW1.3);
// Fehlerzustand weitergeben
bError := wZSW1.3;
// Fehlerzustand
IF (wZSW1.3 = 1) AND (nState < 99) THEN
nErrorState := nState;
nState := 99;
END_IF
// Reset der Achse
tofReset(IN := bReset, PT := T#250MS);
wSTW1.7 := tofReset.Q;
CASE nState OF
0: // Idle -> Einschalten
wStW1.0 := 0; // Ein
wStW1.1 := 0; // Nicht Austrudel
wStW1.2 := 0; // Kein Schnellhalt
wStW1.3 := 0; // Betrieb freigeben
wSTW1.4 := 0; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 0; // MDI aktivieren
IF rtStart.Q AND bInfeedEnabled THEN
bDone := FALSE;
IF dwTargetPosition <> dwCurrentPosition THEN
nState := 10;
ELSE
nState := 70;
END_IF
END_IF
10: // Warten auf Einschaltbereit -> Betriebsbereit
wStW1.0 := 0; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 0; // MDI aktivieren
IF wZSW1.0 THEN // Einschaltbereit
nState := 20;
END_IF
20: // Warten auf Betriebsbereit
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 0; // MDI aktivieren
IF wZSW1.1 THEN // Betriebsbereit
nState := 30;
END_IF
30: // Betriebsbereit -> Bewegungsparameter setzen
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 1; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 1; // MDI aktivieren
// Beschleunigungsausgabe
uiMDI_ACC := 16384;
uiMDI_DEC := 16384;
// Positionsausgabe in zwei udint
uiMDI_TARPOS := DWORD_TO_UINT(SHR(dwTargetPosition, 16));
uiMDI_TARPOS2 := DWORD_TO_UINT(dwTargetPosition);
// Geschwindigkeitsausgabe
uiMDI_VELOCITY := DWORD_TO_UINT(SHR(dwTargetSpeed, 16));
uiMDI_VELOCITY2 := DWORD_TO_UINT(dwTargetSpeed);
IF wAKTSATZ.15 THEN // MDI aktiviert
nState := 40;
END_IF
40: // Warten auf Fahrauftrag quittierung
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 1; // EPOS nicht Verwerfen
wSTW1.5 := 1; // EPOS kein Zwischenhalt
wSTW1.6 := 1; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 1; // MDI aktivieren
// Workaraound für kurze Fahrwege (optimierungsbedarf)
tonWaitAktive(In := TRUE, PT := T#1S);
IF wZSW1.12 AND (NOT wZSW1.10) THEN // Verfahrauftrag aktiv
tonWaitAktive(In := FALSE);
nState := 45;
END_IF
// Workaraound siehe oben
IF wZSW1.12 AND tonWaitAktive.Q AND (ABS(dwCurrentPosition - dwTargetPosition) < 10) THEN
tonWaitAktive(In := FALSE);
nState := 45;
END_IF
45: // Warten auf in position
IF wZSW1.10 THEN
nState := 50;
END_IF
50: // MDI abschalten
wStW1.0 := 1; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 0; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 0; // MDI aktivieren
IF NOT wAKTSATZ.10 THEN
nState := 60;
END_IF
60: // Ausschalten
wStW1.0 := 0; // Ein
wStW1.1 := 1; // Nicht Austrudel
wStW1.2 := 1; // Kein Schnellhalt
wStW1.3 := 1; // Betrieb freigeben
wSTW1.4 := 0; // EPOS nicht Verwerfen
wSTW1.5 := 0; // EPOS kein Zwischenhalt
wSTW1.6 := 0; // EPOS Verfahrauftrag aktivieren 0 -> 1
wSATZANW.15 := 0; // MDI aktivieren
IF NOT wZSW1.1 THEN
nState := 0;
bDone := TRUE;
END_IF
70: // Stehen schon an der Position, nichts machen
bDone := TRUE;
nState := 0;
99: // Fehler
bError := TRUE;
IF ftError.Q OR (wZSW1.3 = 0) THEN
nState := 0;
END_IF
END_CASE
// Ausgabe
uiSTW1 := WORD_TO_UINT(wStw1);
uiSATZANW := WORD_TO_UINT(wSATZANW);
uiSTW2 := WORD_TO_UINT(wStw2);
uiMDI_MOD := WORD_TO_UINT(wMDI_MOD);]]></ST>
</Implementation>
<LineIds Name="FB_WZWKette">
<LineId Id="162" Count="0" />
<LineId Id="181" Count="0" />
<LineId Id="184" Count="0" />
<LineId Id="490" Count="0" />
<LineId Id="182" Count="0" />
<LineId Id="580" Count="0" />
<LineId Id="579" Count="0" />
<LineId Id="581" Count="0" />
<LineId Id="585" Count="0" />
<LineId Id="584" Count="0" />
<LineId Id="583" Count="0" />
<LineId Id="586" Count="2" />
<LineId Id="276" Count="0" />
<LineId Id="183" Count="0" />
<LineId Id="163" Count="0" />
<LineId Id="280" Count="0" />
<LineId Id="279" Count="0" />
<LineId Id="281" Count="0" />
<LineId Id="283" Count="0" />
<LineId Id="282" Count="0" />
<LineId Id="284" Count="0" />
<LineId Id="382" Count="0" />
<LineId Id="381" Count="0" />
<LineId Id="380" Count="0" />
<LineId Id="525" Count="0" />
<LineId Id="524" Count="0" />
<LineId Id="526" Count="0" />
<LineId Id="540" Count="0" />
<LineId Id="539" Count="0" />
<LineId Id="544" Count="0" />
<LineId Id="678" Count="0" />
<LineId Id="677" Count="0" />
<LineId Id="679" Count="0" />
<LineId Id="511" Count="0" />
<LineId Id="510" Count="0" />
<LineId Id="512" Count="0" />
<LineId Id="530" Count="0" />
<LineId Id="527" Count="1" />
<LineId Id="805" Count="0" />
<LineId Id="742" Count="0" />
<LineId Id="741" Count="0" />
<LineId Id="743" Count="0" />
<LineId Id="373" Count="0" />
<LineId Id="372" Count="0" />
<LineId Id="374" Count="0" />
<LineId Id="386" Count="3" />
<LineId Id="385" Count="0" />
<LineId Id="446" Count="0" />
<LineId Id="407" Count="0" />
<LineId Id="465" Count="1" />
<LineId Id="390" Count="0" />
<LineId Id="379" Count="0" />
<LineId Id="674" Count="0" />
<LineId Id="865" Count="0" />
<LineId Id="383" Count="0" />
<LineId Id="866" Count="2" />
<LineId Id="384" Count="0" />
<LineId Id="391" Count="0" />
<LineId Id="376" Count="0" />
<LineId Id="471" Count="0" />
<LineId Id="393" Count="2" />
<LineId Id="392" Count="0" />
<LineId Id="447" Count="0" />
<LineId Id="408" Count="0" />
<LineId Id="467" Count="1" />
<LineId Id="396" Count="3" />
<LineId Id="410" Count="0" />
<LineId Id="377" Count="0" />
<LineId Id="401" Count="3" />
<LineId Id="400" Count="0" />
<LineId Id="448" Count="0" />
<LineId Id="409" Count="0" />
<LineId Id="469" Count="1" />
<LineId Id="405" Count="1" />
<LineId Id="411" Count="3" />
<LineId Id="417" Count="4" />
<LineId Id="449" Count="0" />
<LineId Id="416" Count="0" />
<LineId Id="439" Count="1" />
<LineId Id="422" Count="0" />
<LineId Id="424" Count="1" />
<LineId Id="423" Count="0" />
<LineId Id="431" Count="6" />
<LineId Id="427" Count="0" />
<LineId Id="450" Count="0" />
<LineId Id="486" Count="2" />
<LineId Id="451" Count="2" />
<LineId Id="457" Count="7" />
<LineId Id="454" Count="0" />
<LineId Id="472" Count="0" />
<LineId Id="940" Count="0" />
<LineId Id="932" Count="1" />
<LineId Id="473" Count="0" />
<LineId Id="934" Count="0" />
<LineId Id="474" Count="1" />
<LineId Id="935" Count="0" />
<LineId Id="941" Count="0" />
<LineId Id="936" Count="1" />
<LineId Id="939" Count="0" />
<LineId Id="938" Count="0" />
<LineId Id="569" Count="4" />
<LineId Id="455" Count="0" />
<LineId Id="476" Count="0" />
<LineId Id="478" Count="7" />
<LineId Id="477" Count="0" />
<LineId Id="491" Count="5" />
<LineId Id="498" Count="7" />
<LineId Id="497" Count="0" />
<LineId Id="506" Count="2" />
<LineId Id="673" Count="0" />
<LineId Id="509" Count="0" />
<LineId Id="869" Count="3" />
<LineId Id="415" Count="0" />
<LineId Id="378" Count="0" />
<LineId Id="675" Count="0" />
<LineId Id="547" Count="0" />
<LineId Id="542" Count="0" />
<LineId Id="545" Count="0" />
<LineId Id="532" Count="1" />
<LineId Id="375" Count="0" />
<LineId Id="179" Count="0" />
<LineId Id="165" Count="0" />
<LineId Id="180" Count="0" />
<LineId Id="441" Count="0" />
<LineId Id="185" Count="0" />
<LineId Id="285" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_Zentralschmierung" Id="{bcde91c3-50bd-4ca1-8148-e05e13bdb662}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Zentralschmierung
VAR_INPUT
bCmdStartCycle : BOOL;
bCycleSensor : BOOL;
bReset : BOOL;
END_VAR
VAR_OUTPUT
bError : BOOL;
bBusy : BOOL;
END_VAR
VAR
bEnablePump AT %Q* : BOOL;
rtStartCycle : R_TRIG;
rtReset : R_TRIG;
rtCycleSensor : R_TRIG;
tonError : TON;
nState : INT := 0;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Start cycle on rising edge
rtStartCycle(CLK := bCmdStartCycle);
// Cycle done on rising edge of sensor
rtCycleSensor(CLK := bCycleSensor);
// Reset on rising edge
rtReset(CLK := bReset);
CASE nState OF
0: // Idle
bEnablePump := FALSE;
bBusy := FALSE;
bError :=FALSE;
tonError(IN := FALSE);
IF rtStartCycle.Q THEN
nState := 10;
END_IF
10: // Cycle started
bEnablePump := TRUE;
bBusy := TRUE;
// Timeout protection (Normal cycle approx. 7 min 40 sec)
tonError(IN := TRUE, PT := T#15M);
IF tonError.Q THEN
nState := 99;
END_IF
// Cacle done
IF rtCycleSensor.Q THEN
nState := 0;
END_IF
99: // Error
bEnablePump := FALSE;
tonError(IN := FALSE);
bError := TRUE;
bBusy := FALSE;
IF rtReset.Q THEN
nState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<LineIds Name="FB_Zentralschmierung">
<LineId Id="18" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="21" Count="0" />
<LineId Id="60" Count="0" />
<LineId Id="59" Count="0" />
<LineId Id="61" Count="0" />
<LineId Id="27" Count="0" />
<LineId Id="26" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="36" Count="0" />
<LineId Id="51" Count="1" />
<LineId Id="47" Count="0" />
<LineId Id="37" Count="0" />
<LineId Id="30" Count="5" />
<LineId Id="50" Count="0" />
<LineId Id="38" Count="0" />
<LineId Id="67" Count="0" />
<LineId Id="39" Count="3" />
<LineId Id="62" Count="0" />
<LineId Id="66" Count="0" />
<LineId Id="63" Count="2" />
<LineId Id="43" Count="3" />
<LineId Id="48" Count="1" />
<LineId Id="55" Count="3" />
<LineId Id="29" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<GVL Name="GVL_HMI" Id="{14920b99-5488-4ef2-b48f-b63f88230741}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL
bAxisEnableAllowed : BOOL;
bProgramStartAllowed : BOOL;
iSpindleLoadPercent : INT;
bEnableStepper : BOOL;
bStartHoming : BOOL;
bSelectedField : INT;
bExecVacFieldChange : BOOL;
END_VAR]]></Declaration>
</GVL>
</TcPlcObject>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<GVL Name="GVL_OEM" Id="{0f5063c1-8c06-48ae-9b7a-47cf210f919b}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL
byteInputSpindlePin2 AT %I* : BYTE;
byteInputSpindlePin4 AT %I* : BYTE;
byteOutputSpindlePin2 AT %Q* : BYTE;
byteOutputSpindlePin4 AT %Q* : BYTE;
byteInputDruckluft0 AT %I* : BYTE;
byteInputDruckluft1 AT %I* : BYTE;
byteInputEncoder0 AT %I* : BYTE;
byteInputEncoder1 AT %I* : BYTE;
uiEncoderValuePaper : UINT;
// Tasten am Bildschirm 1
bBtnNCStart AT %I* : BOOL;
bBtnNCStartLED AT %Q* : BOOL;
bBtnNCStop AT %I* : BOOL;
bBtnNCStopLED AT %Q* : BOOL;
bBtnInfeedEnable AT %I* : BOOL;
bBtnInfeedEnableLED AT %Q* : BOOL;
bBtnToggleVakuumpumpe AT %I* : BOOL;
iSpindleLoad AT %I* : INT;
bMesstaster AT %I* : BOOL;
pVe : POINTER TO VE_CHANNEL_DATA_CH_1;
END_VAR
// bit 6 pin 4 -> Klemmung inaktiv
// BK -> Pin 4
// WHT -> Pin 2
// 1.6.2 -> Ventil Klemmung NC]]></Declaration>
</GVL>
</TcPlcObject>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.4">
<POU Name="POU_AutoOff" Id="{4150bdd9-8aaf-487c-9b90-517ff81ad5a8}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM POU_AutoOff
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<LineIds Name="POU_AutoOff">
<LineId Id="5" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="PRG_Einspeisung" Id="{5cd6801a-283d-4acd-9eba-b4e80aa15a2c}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM PRG_Einspeisung
VAR
// Einschalten der Einspeisung
bEnable : BOOL := TRUE;
// statuswort der Einspeisung
uiZsw AT %I* : UINT;
bError : BOOL;
// Steuerwort der Einspeisung
uiStw AT %Q* : UINT := 0;
// Ausgänge der CU
uiCUIO AT %Q* : USINT;
// Einspeisung aktiv (für extern)
bInfeedActive : BOOL;
wZsw : WORD := 0;
wStw : WORD := 0;
wCUIO : WORD := 0;
// Zustandsvariable
nState : INT := 0;
bBtnEnable : BOOL;
bBtnDisable AT %I* : BOOL;
bLEDBtnEnable : BOOL;
bLEDBtnDissable : BOOL;
rtEinschalten : R_TRIG;
rtAusschalten : R_TRIG;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Umwandeln des Zustandwortes
wZsw := UINT_TO_WORD(uiZsw);
wStw := UINT_TO_WORD(uiStw);
bError := (gpAx[0]^.lr_state.axis_state_r <> 7) AND (gpAx[1]^.lr_state.axis_state_r <> 7);
wStw.10 := 1;
bBtnEnable := GVL_OEM.bBtnInfeedEnable;
GVL_OEM.bBtnInfeedEnableLED := bLEDBtnEnable;
rtEinschalten(CLk := bBtnEnable AND bError);
IF rtEinschalten.Q THEN
bEnable := TRUE;
END_IF
rtAusschalten(CLK := bBtnDisable);
IF rtAusschalten.Q THEN
bEnable := FALSE;
END_IF
bLEDBtnEnable := wZsw.2;
bLEDBtnDissable := NOT wZsw.2;
wCUIO.4 := wZsw.2;
wCUIO.5 := wZsw.2;
CASE nState OF
0: // Einschaltsperre
wStw.0 := 0;
wStw.1 := 1;
bInfeedActive := FALSE;
IF wZsw.0 AND (NOT wZsw.1) AND (NOT wZsw.2) AND (NOT wZsw.6) AND bEnable THEN
nState := 10;
END_IF
10: // Einschaltbereit
wStw.0 := 1;
IF (wZsw.0 = 1) AND (wZsw.1 = 1) AND (wZsw.2 = 0) AND (wZsw.6 = 0) THEN
nState := 20;
END_IF
20: // Betriebsbereit
wStw.3 := 1;
IF (wZsw.0 = 1) AND (wZsw.1 = 1) AND (wZsw.2 = 1) AND (wZsw.6 = 0) THEN
nState := 30;
END_IF
30: //Betrieb
bInfeedActive := TRUE;
IF (NOT bEnable) THEN
wStw.0 := 0;
wStw.1 := 0;
wStw.3 := 0;
wCUIO.4 := 0;
wCUIO.5 := 0;
nState := 0;
END_IF
END_CASE
IF (wZsw.3) AND PLCReset THEN
wStw.7 := 1;
ELSE
wStw.7 := 0;
END_IF
// Umwandeln des Steuerwortes
uiStw := WORD_TO_UINT(wStw);
uiCUIO := WORD_TO_USINT(wCUIO);]]></ST>
</Implementation>
<LineIds Name="PRG_Einspeisung">
<LineId Id="48" Count="0" />
<LineId Id="5" Count="0" />
<LineId Id="52" Count="0" />
<LineId Id="297" Count="0" />
<LineId Id="296" Count="0" />
<LineId Id="74" Count="0" />
<LineId Id="73" Count="0" />
<LineId Id="334" Count="0" />
<LineId Id="333" Count="0" />
<LineId Id="335" Count="0" />
<LineId Id="137" Count="0" />
<LineId Id="136" Count="0" />
<LineId Id="138" Count="2" />
<LineId Id="142" Count="0" />
<LineId Id="141" Count="0" />
<LineId Id="143" Count="2" />
<LineId Id="150" Count="0" />
<LineId Id="149" Count="0" />
<LineId Id="151" Count="0" />
<LineId Id="261" Count="1" />
<LineId Id="260" Count="0" />
<LineId Id="18" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="21" Count="1" />
<LineId Id="181" Count="1" />
<LineId Id="23" Count="10" />
<LineId Id="35" Count="3" />
<LineId Id="40" Count="1" />
<LineId Id="39" Count="0" />
<LineId Id="42" Count="1" />
<LineId Id="184" Count="1" />
<LineId Id="44" Count="0" />
<LineId Id="85" Count="1" />
<LineId Id="84" Count="0" />
<LineId Id="224" Count="1" />
<LineId Id="55" Count="0" />
<LineId Id="54" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="105" Count="0" />
<LineId Id="104" Count="0" />
<LineId Id="106" Count="0" />
<LineId Id="108" Count="0" />
<LineId Id="110" Count="0" />
<LineId Id="107" Count="0" />
<LineId Id="50" Count="0" />
<LineId Id="49" Count="0" />
<LineId Id="51" Count="0" />
<LineId Id="226" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="PRG_LSB" Id="{a1421415-b581-4cdc-b4e6-91d688e67a9e}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM PRG_LSB
VAR
(*uiStw AT %Q* : UINT;*)
uiStw2 AT %I* : UINT;
uiZsw2 AT %I* : UINT;
uiZsw2Fake AT %Q* : UINT;
uiStw2Fake AT %Q* : UINT;
(*wStw : WORD;*)
wZsw2 : WORD;
wStw2 : WORD;
wZsw2Fake : WORD;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[wStw2 := UINT_TO_WORD(uiStw2);
wZsw2Fake := UINT_TO_WORD(uiZsw2);
// Slave Life Sign Bits einfügen
wZsw2Fake.12 := wStw2.12;
wZsw2Fake.13 := wStw2.13;
wZsw2Fake.14 := wStw2.14;
wZsw2Fake.15 := wStw2.15;
uiZsw2Fake := WORD_TO_UINT(wZsw2Fake);
uiStw2Fake := uiStw2;
(*
wStw.0 := 0; // AUS1 (3)
wStw.1 := 0; // AUS2 (1)
wStw.2 := 0; // AUS3 (2)
wStw.3 := 0; // Betrieb freigegeben (4)
wStw.4 := 0; // Hochlaufgeber freigeben (5)
wStw.5 := 0; // Hochlaufgeber fortsetzen
wStw.6 := 0; // Sollwert freigeben (6)
wStw.7 := 0; // Fehler Quittieren
wStw.10 := 1; // Führung PLC
*)
(*uiStw := WORD_TO_UINT(wStw);*)]]></ST>
</Implementation>
<LineIds Name="PRG_LSB">
<LineId Id="34" Count="0" />
<LineId Id="46" Count="1" />
<LineId Id="38" Count="0" />
<LineId Id="35" Count="0" />
<LineId Id="40" Count="0" />
<LineId Id="36" Count="0" />
<LineId Id="41" Count="0" />
<LineId Id="49" Count="0" />
<LineId Id="48" Count="0" />
<LineId Id="67" Count="0" />
<LineId Id="37" Count="0" />
<LineId Id="32" Count="0" />
<LineId Id="5" Count="0" />
<LineId Id="10" Count="7" />
<LineId Id="33" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="18" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="PRG_MFunction" Id="{6d431046-0b2c-4635-9f2b-6f0d304b2a61}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM PRG_MFunction
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[CNCSystem.Channel[0].M[10].nArgument_r]]></ST>
</Implementation>
<LineIds Name="PRG_MFunction">
<LineId Id="5" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="PRG_Master_Slave" Id="{72b05d60-0105-457d-b067-e2b055c3596a}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM PRG_Master_Slave
VAR
fDiffMasterSlave : DINT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[fDiffMasterSlave := gpAx[0]^.lr_state.current_position_acs_r - gpAx[1]^.lr_state.current_position_acs_r;]]></ST>
</Implementation>
<LineIds Name="PRG_Master_Slave">
<LineId Id="5" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="PRG_Safety" Id="{fb0a2b6b-e6cb-460c-a9a1-e601b08f918a}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM PRG_Safety
VAR
bRun AT %Q* : BOOL := TRUE;
bReset AT %Q* : BOOL;
bErrorAck AT %Q* : BOOL;
bFallNummerBit0 AT %Q* : BOOL;
bSiemensReset AT %Q* : BOOL;
bEStop AT %I* : BOOL;
bLSStop AT %I* : BOOL;
bLSReducedSpeed AT %I* : BOOL;
bTest : BOOL;
tofErrorAck : TOF;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[tofErrorAck(IN := PLCReset OR bTest, PT := T#500MS);
bFallNummerBit0 := TRUE;
// Nothalt Kanal
gpCh[0]^.bahn_mc_control.emergency_stop.enable_w :=TRUE;
gpCh[0]^.bahn_mc_control.emergency_stop.command_w := NOT bEStop;
// Nothalt Spindel
gpAx[4]^.ipo_mc_control.emergency_stop.enable_w := TRUE;
gpAx[4]^.ipo_mc_control.emergency_stop.command_w := NOT bEStop;
// Feedhold Laserscanner
gpCh[0]^.bahn_mc_control.e_feedhold.enable_w := TRUE;
gpCh[0]^.bahn_mc_control.e_feedhold.command_w := NOT bLSStop;
// Reduzierte Geschwindigkeit Laserscanner
gpCh[0]^.bahn_mc_control.reduced_speed.enable_w := TRUE;
gpCh[0]^.bahn_mc_control.reduced_speed.command_w := NOT bLSReducedSpeed;
//bErrorAck := tofErrorAck.Q;
bSiemensReset := tofErrorAck.Q;
bReset := tofErrorAck.Q;
bErrorAck := tofErrorAck.Q;
IF bTest THEN
bTest := FALSE;
END_IF]]></ST>
</Implementation>
<LineIds Name="PRG_Safety">
<LineId Id="25" Count="0" />
<LineId Id="45" Count="0" />
<LineId Id="65" Count="0" />
<LineId Id="63" Count="0" />
<LineId Id="62" Count="0" />
<LineId Id="66" Count="0" />
<LineId Id="69" Count="0" />
<LineId Id="68" Count="0" />
<LineId Id="70" Count="1" />
<LineId Id="89" Count="0" />
<LineId Id="88" Count="0" />
<LineId Id="118" Count="0" />
<LineId Id="90" Count="0" />
<LineId Id="114" Count="0" />
<LineId Id="113" Count="0" />
<LineId Id="115" Count="1" />
<LineId Id="24" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="11" Count="0" />
<LineId Id="67" Count="0" />
<LineId Id="109" Count="0" />
<LineId Id="108" Count="0" />
<LineId Id="110" Count="1" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<DUT Name="STRING_20" Id="{60ca124a-11fd-4280-bd99-97569231342c}">
<Declaration><![CDATA[TYPE STRING_20 :
STRUCT
token: STRING(20);
f1_st: ARRAY[0..2] OF BYTE;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<DUT Name="STRING_20_2" Id="{a6969424-b9d6-4c85-af94-a7810852125e}">
<Declaration><![CDATA[TYPE STRING_20_2 :
STRUCT
token: STRING(20);
f1_st: ARRAY[0..106] OF BYTE;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<DUT Name="VE_CHANNEL_DATA_CH_1" Id="{76b51807-10ab-45ea-99dc-732c4f0280ed}">
<Declaration><![CDATA[TYPE VE_CHANNEL_DATA_CH_1 :
STRUCT
ToolInSpindle: DINT;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_CmdDInfo" Id="{e0e28df1-2233-498b-971b-7f8c787db05a}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_CmdDInfo IMPLEMENTS ITF_ToolAction
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_tool : TC3_CNC.ST_CNC_TOOL_DATA_EXT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="Commit" Id="{25561adb-e2c3-4952-8971-6e0bd5714826}">
<Declaration><![CDATA[(* Commits the tool data transfer action if it returns true*)
METHOD Commit : BOOL
VAR_INPUT
t : Tc3_CNC.ST_CNC_TOOL_DATA_EXT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_tool := t;
GVL_ToolMgmt.stCurrentTool := _tool;
Commit := true;]]></ST>
</Implementation>
</Method>
<Property Name="Tool" Id="{55b786a9-d0b6-4eca-9acb-c4eac7ca1a59}">
<Declaration><![CDATA[PROPERTY Tool : Tc3_CNC.ST_CNC_TOOL_DATA_EXT
]]></Declaration>
<Get Name="Get" Id="{0ca7819b-ca71-4950-b112-4e0e7a01037b}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[Tool := _tool;]]></ST>
</Implementation>
</Get>
</Property>
<LineIds Name="FB_CmdDInfo">
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_CmdDInfo.Commit">
<LineId Id="8" Count="0" />
<LineId Id="10" Count="0" />
<LineId Id="9" Count="0" />
<LineId Id="12" Count="0" />
<LineId Id="11" Count="0" />
</LineIds>
<LineIds Name="FB_CmdDInfo.Tool.Get">
<LineId Id="2" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_CmdOldDInfo" Id="{a08c7560-7f97-4dff-8602-2d2f0ae3c977}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_CmdOldDInfo IMPLEMENTS ITF_ToolAction
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_tool : TC3_CNC.ST_CNC_TOOL_DATA_EXT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="Commit" Id="{5fb9d6fd-121d-4d04-a478-855a86ce4c09}">
<Declaration><![CDATA[(* Commits the tool data transfer action if it returns true*)
METHOD Commit : BOOL
VAR_INPUT
t : Tc3_CNC.ST_CNC_TOOL_DATA_EXT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_tool := t;
IF _tool.tool_desc.param[9] = 1 THEN
_tool.laenge := LREAL_TO_DINT(_tool.tool_desc.param[10] * 10000);
_tool.tool_desc.param[9] := 0;
END_IF
Commit := TRUE;]]></ST>
</Implementation>
</Method>
<Property Name="Tool" Id="{1a4f8238-9d9a-4932-b866-1ce4c82e67e8}">
<Declaration><![CDATA[PROPERTY Tool : Tc3_CNC.ST_CNC_TOOL_DATA_EXT
]]></Declaration>
<Get Name="Get" Id="{950e7d8b-6a41-4aac-8e65-03f8966c7c3a}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[Tool := _tool;]]></ST>
</Implementation>
</Get>
</Property>
<LineIds Name="FB_CmdOldDInfo">
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_CmdOldDInfo.Commit">
<LineId Id="15" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="18" Count="0" />
<LineId Id="17" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="21" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="8" Count="0" />
</LineIds>
<LineIds Name="FB_CmdOldDInfo.Tool.Get">
<LineId Id="2" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_CmdTInfo" Id="{adb7b52d-b0cb-47e5-92a4-3d78a8902e46}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_CmdTInfo IMPLEMENTS ITF_ToolAction
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_tool : Tc3_CNC.ST_CNC_TOOL_DATA_EXT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="Commit" Id="{fa444163-0c71-4c86-ba1b-725f5723ca12}">
<Declaration><![CDATA[(* Commits the tool data transfer action if it returns true*)
METHOD Commit : BOOL
VAR_INPUT
t : Tc3_CNC.ST_CNC_TOOL_DATA_EXT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_tool := t;
// Wenn das neue Werkzeug das Nullwerkzeug ist, lade die WZW-Position des Nullwerkzeugs
// aus den Remanenten Daten
IF _tool.tool_desc.tool_id.basic = 0 THEN
_tool.pos := GVL_ToolMgmt.diToolZeroPosition;
END_IF
GVL_ToolMgmt.stToolToPrep := _tool;
// Positioniere das Kettenmagazin nur vor, wenn das neue Werkzeug nicht das
// selbe wie das alte ist
IF _tool.tool_desc.tool_id.basic <> GVL_ToolMgmt.diToolInSpindle THEN
GVL_ToolMgmt.bExecuteToolPrep := TRUE;
END_IF
Commit := TRUE;]]></ST>
</Implementation>
</Method>
<Property Name="Tool" Id="{0d967f20-5453-46e3-8feb-60cef128eee6}">
<Declaration><![CDATA[PROPERTY Tool : Tc3_CNC.ST_CNC_TOOL_DATA_EXT
]]></Declaration>
<Get Name="Get" Id="{88ffee38-caad-4c7f-b82c-730b0c67a5e9}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[Tool := _tool;]]></ST>
</Implementation>
</Get>
</Property>
<LineIds Name="FB_CmdTInfo">
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_CmdTInfo.Commit">
<LineId Id="8" Count="0" />
<LineId Id="30" Count="0" />
<LineId Id="32" Count="3" />
<LineId Id="31" Count="0" />
<LineId Id="11" Count="1" />
<LineId Id="22" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="23" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="21" Count="0" />
<LineId Id="10" Count="0" />
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_CmdTInfo.Tool.Get">
<LineId Id="2" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<GVL Name="GVL_ToolMgmt" Id="{b8b980b7-8782-4a7d-86b6-be4993cff48f}">
<Declaration><![CDATA[{attribute 'qualified_only'}
VAR_GLOBAL PERSISTENT
diToolInSpindle : DINT;
diToolZeroPosition : DINT; // Aktuell = 1
END_VAR
VAR_GLOBAL
stToolToPrep : TC3_CNC.ST_CNC_TOOL_DATA_EXT;
stCurrentTool : TC3_CNC.ST_CNC_TOOL_DATA_EXT;
bExecuteToolPrep : BOOL;
END_VAR]]></Declaration>
</GVL>
</TcPlcObject>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="PRG_Platztausch" Id="{14050e21-b06c-4055-84da-8b2062df95a7}" SpecialFunc="None">
<Declaration><![CDATA[PROGRAM PRG_Platztausch
VAR
nState : INT := 0;
diTPos : DINT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[(* Initiate tool pocket change on M106 command *)
IF CNCSystem.Channel[0].M[106].bState_rw AND nState = 0 THEN
nState := 10;
END_IF
CASE nState OF
10: // Change pocket position of tool currently in Spindle to -1
// Save position of tool to change for old tool
diTPos := GVL_ToolMgmt.stToolToPrep.pos;
GVL_ToolMgmt.stToolToPrep.pos := -1;
CNCSystem.Channel[0].ToolData.stOldTool := GVL_ToolMgmt.stToolToPrep;
CNCSystem.Channel[0].ToolData.bOldToolDataExist := TRUE;
nState := 15;
15: // Wait for HMI to be done reading the tool
IF CNCSystem.Channel[0].ToolData.bOldToolDataExist = FALSE THEN
nState := 20;
END_IF
20: // Change pocket of old tool to pocketnumber of new tool
// Wenn das neue Werkzeug das Nullwerkzeug ist,
// Speichere die Position in den Remanenten Daten
IF GVL_ToolMgmt.stCurrentTool.tool_desc.tool_id.basic = 0 THEN
GVL_ToolMgmt.diToolZeroPosition := diTPos;
END_IF
GVL_ToolMgmt.stCurrentTool.pos := diTPos;
CNCSystem.Channel[0].ToolData.stOldTool := GVL_ToolMgmt.stCurrentTool;
CNCSystem.Channel[0].ToolData.bOldToolDataExist := TRUE;
nState := 25;
25: // Wait for HMI to be done reading the tool
IF CNCSystem.Channel[0].ToolData.bOldToolDataExist = FALSE THEN
CNCSystem.Channel[0].M[106].bState_rw := FALSE;
nState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<LineIds Name="PRG_Platztausch">
<LineId Id="10" Count="0" />
<LineId Id="8" Count="1" />
<LineId Id="5" Count="0" />
<LineId Id="12" Count="0" />
<LineId Id="11" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="15" Count="0" />
<LineId Id="17" Count="10" />
<LineId Id="44" Count="0" />
<LineId Id="50" Count="0" />
<LineId Id="45" Count="4" />
<LineId Id="28" Count="1" />
<LineId Id="42" Count="0" />
<LineId Id="30" Count="2" />
<LineId Id="34" Count="2" />
<LineId Id="33" Count="0" />
<LineId Id="14" Count="0" />
</LineIds>
</POU>
</TcPlcObject>