72 lines
2.9 KiB
Plaintext
72 lines
2.9 KiB
Plaintext
FUNCTION "FC_Direction" : Void
|
|
{ S7_Optimized_Access := 'TRUE' }
|
|
VERSION : 0.1
|
|
VAR_INPUT
|
|
nInSwitchNo : USInt; // Switch Nummer
|
|
END_VAR
|
|
|
|
VAR_OUTPUT
|
|
nOutDirection : USInt; // Ziel für Switch-Baustein
|
|
END_VAR
|
|
|
|
VAR_IN_OUT
|
|
InOutCarrier : "stCarrier"; // Daten vom Carrier
|
|
END_VAR
|
|
|
|
|
|
BEGIN
|
|
// Destination vom Carrier, immer unterschiedlich je nach Anlagenbereich, soll übertragen werden auf universale Switch Direction (1-4)
|
|
//
|
|
// Es gibt noch mehr Weichen, aber noch unklar nach welchem Prinzip diese angesteuert werden
|
|
REGION Vergabe Direction
|
|
CASE #nInSwitchNo OF
|
|
"cSwi107.1":
|
|
REGION Switch 107.1 Boom 1
|
|
IF #InOutCarrier.nDestination = "cDestInboundLS" THEN // zu Ladeschleife
|
|
#nOutDirection := 1; // LINKS
|
|
ELSIF #InOutCarrier.nDestination = "cDestClearing" OR
|
|
#InOutCarrier.nDestination = "cDestInboundOut" OR
|
|
#InOutCarrier.nDestination = "cDestInboundLS_Extra" THEN // Zur Clearing-Station (Error-Station) oder Inbound verlassen
|
|
#nOutDirection := 2; // RECHTS
|
|
ELSE
|
|
#nOutDirection := 2; // Fallback, falls unerwartetes Ziel
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi112.1":
|
|
REGION Switch 112.1 Boom 2
|
|
IF #InOutCarrier.nDestination = "cDestInboundLS" OR
|
|
#InOutCarrier.nDestination = "cDestInboundLS_Extra" THEN // zu Ladeschleife
|
|
#nOutDirection := 1; // LINKS
|
|
ELSIF #InOutCarrier.nDestination = "cDestClearing" OR
|
|
#InOutCarrier.nDestination = "cDestInboundOut" THEN // Zur Clearing-Station (Error-Station) oder Inbound verlassen
|
|
#nOutDirection := 2; // RECHTS
|
|
ELSE
|
|
#nOutDirection := 2; // Fallback, falls unerwartetes Ziel
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi114.1":
|
|
REGION Switch 114.1
|
|
IF #InOutCarrier.nDestination = "cDestInboundOut" THEN // Inbound verlassen
|
|
#nOutDirection := 1; // LINKS
|
|
ELSIF #InOutCarrier.nDestination = "cDestClearing" THEN // Zur Clearing-Station (Error-Station)
|
|
#nOutDirection := 2; // RECHTS !!!!
|
|
ELSE
|
|
#nOutDirection := 0; // Test, Warten
|
|
END_IF;
|
|
END_REGION
|
|
"cSwi124.1":
|
|
REGION Switch 124.1
|
|
IF #InOutCarrier.nDestination = "cDestHighwayStorage" THEN // zum Storage fahren (Ausnahmefall)
|
|
#nOutDirection := 1; // LINKS
|
|
ELSIF #InOutCarrier.nDestination = 0 THEN // Zum Inbound (Standardfall)
|
|
#nOutDirection := 2; // RECHTS
|
|
ELSE
|
|
#nOutDirection := 2; //
|
|
END_IF;
|
|
END_REGION
|
|
END_CASE;
|
|
END_REGION
|
|
|
|
END_FUNCTION
|
|
|