345 lines
14 KiB
Plaintext
345 lines
14 KiB
Plaintext
FUNCTION "FC_Direction" : Void
|
|
{ S7_Optimized_Access := 'TRUE' }
|
|
VERSION : 0.1
|
|
VAR_INPUT
|
|
nInSwitchNo : USInt;
|
|
END_VAR
|
|
|
|
VAR_OUTPUT
|
|
nOutDirection : USInt;
|
|
END_VAR
|
|
|
|
VAR_IN_OUT
|
|
InOutCarrier : "stCarrier";
|
|
END_VAR
|
|
|
|
VAR_TEMP
|
|
xDestB1 : Bool; // Ziel allgemein Block1
|
|
xDest111 : Bool; // Ziel befindet sich in erstem Viertel von B1
|
|
xDest112 : Bool; // Ziel befindet sich in zweitem Viertel von B1
|
|
xDest113 : Bool; // Ziel befindet sich in dritten Viertel von B1
|
|
xDest114 : Bool; // Ziel befindet sich in letztem Viertel von B1
|
|
xDestB2 : Bool; // Ziel allgemein Block2
|
|
xDest121 : Bool; // Ziel befindet sich in erstem Viertel von B2
|
|
xDest122 : Bool; // Ziel befindet sich in zweitem Viertel von B2
|
|
xDest123 : Bool; // Ziel befindet sich in dritten Viertel von B2
|
|
xDest124 : Bool; // Ziel befindet sich in letztem Viertel von B2
|
|
xDestB3 : Bool; // Ziel allgemein Block3
|
|
xDest131 : Bool; // Ziel befindet sich in erstem Viertel von B3
|
|
xDest132 : Bool; // Ziel befindet sich in zweitem Viertel von B3
|
|
xDest133 : Bool; // Ziel befindet sich in dritten Viertel von B3
|
|
xDest134 : Bool; // Ziel befindet sich in letztem Viertel von B3
|
|
END_VAR
|
|
|
|
|
|
BEGIN
|
|
// TODO: Konstanten für Destinations verwenden
|
|
|
|
REGION Lager Aufteilung
|
|
IF #InOutCarrier.nDestination >= 11100 AND #InOutCarrier.nDestination <= 11119 THEN
|
|
#xDestB1 := TRUE;
|
|
#xDest111 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 11200 AND #InOutCarrier.nDestination <= 11217 THEN
|
|
#xDestB1 := TRUE;
|
|
#xDest112 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 11300 AND #InOutCarrier.nDestination <= 11321 THEN
|
|
#xDestB1 := TRUE;
|
|
#xDest113 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 11400 AND #InOutCarrier.nDestination <= 11413 THEN
|
|
#xDestB1 := TRUE;
|
|
#xDest114 := TRUE;
|
|
////////////////////////////
|
|
ELSIF #InOutCarrier.nDestination >= 12100 AND #InOutCarrier.nDestination <= 12119 THEN
|
|
#xDestB2 := TRUE;
|
|
#xDest121 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 12200 AND #InOutCarrier.nDestination <= 12217 THEN
|
|
#xDestB2 := TRUE;
|
|
#xDest122 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 12300 AND #InOutCarrier.nDestination <= 12321 THEN
|
|
#xDestB2 := TRUE;
|
|
#xDest123 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 12400 AND #InOutCarrier.nDestination <= 12413 THEN
|
|
#xDestB2 := TRUE;
|
|
#xDest124 := TRUE;
|
|
////////////////////////////
|
|
ELSIF #InOutCarrier.nDestination >= 13100 AND #InOutCarrier.nDestination <= 13119 THEN
|
|
#xDestB3 := TRUE;
|
|
#xDest131 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 13200 AND #InOutCarrier.nDestination <= 13217 THEN
|
|
#xDestB3 := TRUE;
|
|
#xDest132 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 13300 AND #InOutCarrier.nDestination <= 13321 THEN
|
|
#xDestB3 := TRUE;
|
|
#xDest133 := TRUE;
|
|
ELSIF #InOutCarrier.nDestination >= 13400 AND #InOutCarrier.nDestination <= 13415 THEN
|
|
#xDestB3 := TRUE;
|
|
#xDest134 := TRUE;
|
|
END_IF;
|
|
END_REGION
|
|
|
|
|
|
REGION Vergabe Direction
|
|
CASE #nInSwitchNo OF
|
|
|
|
"cSwi202.1":
|
|
REGION Switch 202.1 ***Pinbänder Block1***
|
|
IF #xDest111 OR #xDest112 THEN
|
|
//RECHTS ABBIEGEN
|
|
#nOutDirection := 2;
|
|
ELSIF #xDest113 OR #xDest114 THEN
|
|
//LINKS ABBIEGEN
|
|
#nOutDirection := 1;
|
|
ELSE
|
|
#nOutDirection := 0; // undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi203.1":
|
|
REGION Switch 203.1
|
|
IF #xDest112 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 2; // GERADE/RECHTS ABBIEGEN, Block verlassen
|
|
ELSIF #xDest111
|
|
THEN
|
|
#nOutDirection := 1; //LINKS ABBIEGEN, im Block bleiben
|
|
ELSE
|
|
#nOutDirection := 0;
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi204.1":
|
|
REGION Switch 204.1
|
|
IF #InOutCarrier.nDestination = 11043 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 2;
|
|
//GERADE/RECHTS ABBIEGEN, Block verlassen zu Ausfahrt
|
|
ELSIF #xDest111 OR #xDest112 THEN //#xDestB1
|
|
#nOutDirection := 1;
|
|
//LINKS ABBIEGEN, im Block bleiben
|
|
ELSE
|
|
#nOutDirection := 0; // undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi205.1":
|
|
REGION Switch 205.1
|
|
IF #xDest114 THEN
|
|
#nOutDirection := 2;
|
|
; //RECHTS ABBIEGEN, im Block bleiben
|
|
ELSIF #xDest113 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 1; //GERADE/LINKS ABBIEGEN
|
|
ELSE
|
|
#nOutDirection := 2; //undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi206.1":
|
|
REGION Switch 206.1
|
|
IF #xDest113 OR #xDest114 THEN //#xDestB1
|
|
#nOutDirection := 2; //RECHTS ABBIEGEN, im Block bleiben
|
|
ELSIF
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 1; //GERADE/LINKS ABBIEGEN, Block verlassen zu Ausfahrt
|
|
ELSE
|
|
#nOutDirection := 2; //undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
|
|
"cSwi222.1":
|
|
REGION Switch 222.1 ***Pinbänder Block2***
|
|
IF #xDest121 OR #xDest122 THEN
|
|
//RECHTS ABBIEGEN
|
|
#nOutDirection := 2;
|
|
ELSIF #xDest123 OR #xDest124 THEN
|
|
//LINKS ABBIEGEN
|
|
#nOutDirection := 1;
|
|
ELSE
|
|
#nOutDirection := 0; // undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi223.1":
|
|
REGION Switch 223.1
|
|
IF #xDest122 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 2; // GERADE/RECHTS ABBIEGEN, Block verlassen
|
|
ELSIF #xDest121
|
|
THEN
|
|
#nOutDirection := 1; //LINKS ABBIEGEN, im Block bleiben
|
|
ELSE
|
|
#nOutDirection := 1;
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi224.1":
|
|
REGION Switch 224.1
|
|
IF #InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 2;
|
|
;//GERADE/RECHTS ABBIEGEN, Block verlassen zu Ausfahrt
|
|
ELSIF #xDest121 OR #xDest122 THEN //#xDestB1
|
|
#nOutDirection := 1;
|
|
;//LINKS ABBIEGEN, im Block bleiben
|
|
ELSE
|
|
#nOutDirection := 1; // undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi225.1":
|
|
REGION Switch 225.1
|
|
IF #xDest124 THEN
|
|
#nOutDirection := 2;
|
|
; //RECHTS ABBIEGEN, im Block bleiben
|
|
ELSIF #xDest113 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 1; //GERADE/LINKS ABBIEGEN
|
|
ELSE
|
|
#nOutDirection := 2; //undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi226.1":
|
|
REGION Switch 226.1
|
|
IF #xDest123 OR #xDest124 THEN //#xDestB1
|
|
#nOutDirection := 2; //RECHTS ABBIEGEN, im Block bleiben
|
|
ELSIF #InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 1; //GERADE/LINKS ABBIEGEN, Block verlassen zu Ausfahrt
|
|
ELSE
|
|
#nOutDirection := 2; //undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
|
|
"cSwi242.1":
|
|
REGION Switch 242.1 ***Pinbänder Block3***
|
|
IF #xDest131 OR #xDest132 THEN
|
|
//LINKS ABBIEGEN
|
|
#nOutDirection := 1;
|
|
ELSIF #xDest133 OR #xDest134 THEN
|
|
//RECHTS ABBIEGEN
|
|
#nOutDirection := 2;
|
|
ELSE
|
|
#nOutDirection := 0; // undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi243.1":
|
|
REGION Switch 243.1
|
|
IF #xDest132 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 1; //GERADE/LINKS ABBIEGEN, Block verlassen
|
|
ELSIF #xDest131
|
|
THEN
|
|
#nOutDirection := 2; //RECHTS ABBIEGEN, im Block bleiben
|
|
ELSE
|
|
#nOutDirection := 2;
|
|
END_IF;
|
|
END_REGION
|
|
|
|
"cSwi244.1":
|
|
REGION Switch 244.1
|
|
IF #InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 1; //GERADE/LINKS ABBIEGEN, Block verlassen zu Ausfahrt
|
|
ELSIF #xDest131 OR #xDest132 THEN //#xDestB1
|
|
#nOutDirection := 2; //RECHTS ABBIEGEN, im Block bleiben
|
|
ELSE
|
|
#nOutDirection := 2; // undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi245.1":
|
|
REGION Switch 245.1
|
|
IF #xDest134 THEN
|
|
#nOutDirection := 1; //LINKS ABBIEGEN, im Block bleiben
|
|
ELSIF #xDest133 OR
|
|
#InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 2; //GERADE/RECHTS ABBIEGEN
|
|
ELSE
|
|
#nOutDirection := 1; //undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi246.1":
|
|
REGION Switch 246.1
|
|
IF #xDest133 OR #xDest134 THEN
|
|
#nOutDirection := 1; //LINKS ABBIEGEN, im Block bleiben
|
|
ELSIF #InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty" OR
|
|
#InOutCarrier.nDestination = "cDestF2HLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestF2HEmpty"
|
|
THEN
|
|
#nOutDirection := 2; //GERADE/RECHTS ABBIEGEN, Block verlassen zu Ausfahrt
|
|
ELSE
|
|
#nOutDirection := 1; //undefined, todo
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi267.1":
|
|
REGION Switch 267.1
|
|
IF #InOutCarrier.nDestination = "cDestF2HLoaded" THEN
|
|
#nOutDirection := 1;
|
|
ELSIF #InOutCarrier.nDestination = "cDestF2HEmpty" THEN
|
|
#nOutDirection := 2;
|
|
ELSIF #InOutCarrier.nDestination = "cDestAMRLoaded" OR
|
|
#InOutCarrier.nDestination = "cDestInboundEmpty"
|
|
THEN
|
|
#nOutDirection := 3;
|
|
ELSE
|
|
#nOutDirection := 3;
|
|
END_IF;
|
|
END_REGION
|
|
|
|
"cSwi268.1":
|
|
REGION Switch 268.1
|
|
IF #InOutCarrier.nDestination = "cDestInboundEmpty" THEN
|
|
#nOutDirection := 1;
|
|
ELSIF (#InOutCarrier.nDestination = "cDestAMRLoaded") THEN
|
|
#nOutDirection := 2;
|
|
ELSE
|
|
#nOutDirection := 3;
|
|
END_IF;
|
|
END_REGION
|
|
|
|
ELSE
|
|
;
|
|
END_CASE;
|
|
END_REGION
|
|
|
|
|
|
|
|
|
|
|
|
END_FUNCTION
|
|
|