diff --git a/2_ILSLib/Eventlog/FB_EventLog_Booking.libinfo b/2_ILSLib/Eventlog/FB_EventLog_Booking.libinfo new file mode 100644 index 0000000..b567ce9 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Booking.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 330e3c73-0c6f-428c-bd04-06e779578b19 + Comment: + de-DE: 'CHNAGED: optimierung sk' +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/Eventlog/FB_EventLog_Booking.libint b/2_ILSLib/Eventlog/FB_EventLog_Booking.libint new file mode 100644 index 0000000..ae6ca91 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Booking.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FB_EventLog_Booking.scl + Hash: GAon6neSeTmiehUphFkhTmaLaBHrrxX3sBljzfsju0Y= +LibraryMetaFileHash: z7G26GfUmp5lBsYs6w3/RCCs3hdtM3iVof8oJMgmOl4= +LibraryVersion: + Guid: 6e61feb0-b755-46ad-858d-a6af74114a38 + DependsOn: + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: FC_DateAsString + VersionNumber: 0.0.14 + - TypeName: FC_TimeAsString + VersionNumber: 0.0.14 diff --git a/2_ILSLib/Eventlog/FB_EventLog_Booking.scl b/2_ILSLib/Eventlog/FB_EventLog_Booking.scl new file mode 100644 index 0000000..58fd4e9 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Booking.scl @@ -0,0 +1,68 @@ +FUNCTION_BLOCK "FB_EventLog_Booking" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInTrigger : Bool; + stInEventBookingInfo : "stEventBookingInfo"; + END_VAR + + VAR + fbPaEventLogBooking {InstructionName := 'Program_Alarm'; LibVersion := '1.0'} : Program_Alarm; + wStatus : Word; + sLogMessage : String; + sDelimiter : String[1] := ','; + sFunction : String[10]; + xTriggerFlag : Bool; + END_VAR + + VAR_TEMP + xError : Bool; + tRunProgramAlarm : Bool; + END_VAR + + +BEGIN + REGION Call: Program Alarm + IF #xTriggerFlag XOR #xInTrigger THEN + + REGION Meldetext + #sDelimiter := ';'; + #sFunction := 'Umbuchung'; + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventBookingInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventBookingInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventBookingInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventBookingInfo.sDest, + IN19 := ')', + IN20 := ' von ', + IN21 := #stInEventBookingInfo.sJamSrc, + IN22 := ' zu ', + IN23 := #stInEventBookingInfo.sJamDest, + IN24 := ' gebucht'); + END_REGION + + #fbPaEventLogBooking(SIG := #xInTrigger, + SD_1 := #sLogMessage, + Status => #wStatus, + Error => #xError); + END_IF; + END_REGION + + REGION Flanken + #xTriggerFlag := #xInTrigger; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/Eventlog/FB_EventLog_Correction.libinfo b/2_ILSLib/Eventlog/FB_EventLog_Correction.libinfo new file mode 100644 index 0000000..fa63d04 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Correction.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 873575bd-45c1-4e5d-ad81-32da723bf561 + Comment: + de-DE: Teststand vom 18.04.2025 aus der Testanlage ILS LL +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Teststand vom 18.04.2025 aus der Testanlage ILS LL diff --git a/2_ILSLib/Eventlog/FB_EventLog_Correction.libint b/2_ILSLib/Eventlog/FB_EventLog_Correction.libint new file mode 100644 index 0000000..5394bed --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Correction.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FB_EventLog_Correction.scl + Hash: 2MCjddGTpTlcpniYQ4ikq6Gu8vJ5Ca/+sZPRS2h5Us8= +LibraryMetaFileHash: gW+x1UWxB3WvyA9zs9xWcrTzUK0gswtXPnPxI1ojOYk= +LibraryVersion: + Guid: ef6d16a4-e489-47fe-ac26-6e1120abf3dc + DependsOn: + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: FC_DateAsString + VersionNumber: 0.0.14 + - TypeName: FC_TimeAsString + VersionNumber: 0.0.14 diff --git a/2_ILSLib/Eventlog/FB_EventLog_Correction.scl b/2_ILSLib/Eventlog/FB_EventLog_Correction.scl new file mode 100644 index 0000000..3c4fdc3 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Correction.scl @@ -0,0 +1,141 @@ +FUNCTION_BLOCK "FB_EventLog_Correction" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInTrigger : Bool; + stInEventCorrectionInfo : "stEventCorrectionInfo"; + END_VAR + + VAR + fbPaEventLogCorrection {InstructionName := 'Program_Alarm'; LibVersion := '1.0'} : Program_Alarm; + wStatus : Word; + sLogMessage : String; + sDelimiter : String[1] := ','; + sFunction : String[10]; + xTriggerFlag : Bool; + END_VAR + + VAR_TEMP + xError : Bool; + tRunProgramAlarm : Bool; + END_VAR + + +BEGIN + REGION Call Logging Program Alarm + IF #xTriggerFlag XOR #xInTrigger THEN + + REGION Build Message + #sDelimiter := ';'; + #sFunction := 'Korrektur'; + + CASE #stInEventCorrectionInfo.nCorrectionType OF + 0: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventCorrectionInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventCorrectionInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventCorrectionInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventCorrectionInfo.sDest, + IN19 := ')', + IN20 := ' aus HJ entfernt'); + 1: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventCorrectionInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventCorrectionInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventCorrectionInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventCorrectionInfo.sDest, + IN19 := ')', + IN20 := ' in ', + IN21 := #stInEventCorrectionInfo.sLoc, + IN22 := ' Pos ', + IN23 := #stInEventCorrectionInfo.sPos, + IN24 := ' entfernt und Rest nachgeschoben'); + 2: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventCorrectionInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventCorrectionInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventCorrectionInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventCorrectionInfo.sDest, + IN19 := ')', + IN20 := ' in ', + IN21 := #stInEventCorrectionInfo.sLoc, + IN22 := ' Pos ', + IN23 := #stInEventCorrectionInfo.sPos, + IN24 := ' durch Dummy ersetzt'); + 3: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventCorrectionInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventCorrectionInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventCorrectionInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventCorrectionInfo.sDest, + IN19 := ')', + IN20 := #sDelimiter, + IN21 := ' in Hyper-Jam eingefuegt'); + END_CASE; + + END_REGION + + #fbPaEventLogCorrection(SIG := #xInTrigger, + SD_1 := #sLogMessage, + Status => #wStatus, + Error => #xError); + END_IF; + END_REGION + + REGION Flags + #xTriggerFlag := #xInTrigger; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/Eventlog/FB_EventLog_Scan.libinfo b/2_ILSLib/Eventlog/FB_EventLog_Scan.libinfo new file mode 100644 index 0000000..fe31569 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Scan.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 7b2f674e-09cf-4295-8f62-286c90fb1e37 + Comment: + de-DE: Teststand vom 18.04.2025 aus der Testanlage ILS LL +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/Eventlog/FB_EventLog_Scan.libint b/2_ILSLib/Eventlog/FB_EventLog_Scan.libint new file mode 100644 index 0000000..d3a4e59 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Scan.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FB_EventLog_Scan.scl + Hash: lDZF2kT/iz7kyoDW4KkkP2kXs5UKAZhYt/nubJlWK0M= +LibraryMetaFileHash: WZh1tYScxyawfVngye9trL+/OlZLmUGH7rfPBpwMhzA= +LibraryVersion: + Guid: 0c32dfac-9456-4f09-94aa-e0c5522ed860 + DependsOn: + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: FC_DateAsString + VersionNumber: 0.0.14 + - TypeName: FC_TimeAsString + VersionNumber: 0.0.14 diff --git a/2_ILSLib/Eventlog/FB_EventLog_Scan.scl b/2_ILSLib/Eventlog/FB_EventLog_Scan.scl new file mode 100644 index 0000000..83c46e9 --- /dev/null +++ b/2_ILSLib/Eventlog/FB_EventLog_Scan.scl @@ -0,0 +1,167 @@ +FUNCTION_BLOCK "FB_EventLog_Scan" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInTrigger : Bool; + stInEventScanInfo : "stEventScanInfo"; + END_VAR + + VAR + fbPaEventLogScan {InstructionName := 'Program_Alarm'; LibVersion := '1.0'} : Program_Alarm; + wStatus : Word; + sLogMessage : String; + sDelimiter : String[1] := ','; + sFunction : String[10]; + xTriggerFlag : Bool; + END_VAR + + VAR_TEMP + xError : Bool; + tRunProgramAlarm : Bool; + END_VAR + + +BEGIN + REGION Call: Program Alarm + IF #xTriggerFlag XOR #xInTrigger THEN + + REGION Meldetext + #sDelimiter := ';'; + #sFunction := 'Scan'; + + CASE #stInEventScanInfo.nScanType OF + 0: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventScanInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventScanInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventScanInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventScanInfo.sDest, + IN19 := ')', + IN20 := ' bei SC', + IN21 := #stInEventScanInfo.sReaderId, + IN22 := ' Mat.Nr. nicht lesbar'); + + 1: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventScanInfo.sBarcode, + IN10 := '(erwartet)', + IN11 := #sDelimiter, + IN12 := 'JobNo:', + IN13 := #stInEventScanInfo.sJobNo, + IN14 := #sDelimiter, + IN15 := 'ProdNo:', + IN16 := #stInEventScanInfo.sProductNo, + IN17 := #sDelimiter, + IN18 := 'Dest:', + IN19 := #stInEventScanInfo.sDest, + IN20 := ')', + IN21 := ' bei SC', + IN22 := #stInEventScanInfo.sReaderId, + IN23 := ' nicht lesbar'); + 2: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventScanInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventScanInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventScanInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventScanInfo.sDest, + IN19 := ')', + IN20 := ' bei SC', + IN21 := #stInEventScanInfo.sReaderId, + IN22 := ' neu hinzugefuegt'); + 3: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventScanInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventScanInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventScanInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventScanInfo.sDest, + IN19 := ')', + IN20 := ' bei SC', + IN21 := #stInEventScanInfo.sReaderId, + IN22 := ' unbekannter Carrier hinzugefuegt'); + // Good Reads + 4: + #sLogMessage := CONCAT_STRING(IN1 := "FC_DateAsString"(), + IN2 := #sDelimiter, + IN3 := "FC_TimeAsString"(), + IN4 := #sDelimiter, + IN5 := #sFunction, + IN6 := #sDelimiter, + IN7 := 'Carrier(', + IN8 := 'Barcode:', + IN9 := #stInEventScanInfo.sBarcode, + IN10 := #sDelimiter, + IN11 := 'JobNo:', + IN12 := #stInEventScanInfo.sJobNo, + IN13 := #sDelimiter, + IN14 := 'ProdNo:', + IN15 := #stInEventScanInfo.sProductNo, + IN16 := #sDelimiter, + IN17 := 'Dest:', + IN18 := #stInEventScanInfo.sDest, + IN19 := ')', + IN20 := ' bei SC', + IN21 := #stInEventScanInfo.sReaderId, + IN22 := ' gelesen'); + + END_CASE; + + END_REGION + + #fbPaEventLogScan(SIG := #xInTrigger, + SD_1 := #sLogMessage, + Status => #wStatus, + Error => #xError); + END_IF; + END_REGION + + REGION Flanken + #xTriggerFlag := #xInTrigger; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Conveyor/FB_Conveyor.libinfo b/2_ILSLib/FB/Conveyor/FB_Conveyor.libinfo new file mode 100644 index 0000000..6035a64 --- /dev/null +++ b/2_ILSLib/FB/Conveyor/FB_Conveyor.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 0fb07577-0755-4aaa-8aa1-ed98c4a96d46 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.7 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: hmi diff --git a/2_ILSLib/FB/Conveyor/FB_Conveyor.libint b/2_ILSLib/FB/Conveyor/FB_Conveyor.libint new file mode 100644 index 0000000..8b92a4e --- /dev/null +++ b/2_ILSLib/FB/Conveyor/FB_Conveyor.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FB_Conveyor.scl + Hash: AkZneABZ/ZCE9GXeWUHhfZTOBC1MY7O564ODdIqVrq8= +LibraryMetaFileHash: uWjDioIkDAD8yLZibEPleeTTDnw+RI6TcYbR0dTPsLA= +LibraryVersion: + Guid: 80031440-bc66-4cb7-9dd8-353095fb8de0 + DependsOn: + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_Conveyor + VersionNumber: 0.0.15 diff --git a/2_ILSLib/FB/Conveyor/FB_Conveyor.scl b/2_ILSLib/FB/Conveyor/FB_Conveyor.scl new file mode 100644 index 0000000..3f68996 --- /dev/null +++ b/2_ILSLib/FB/Conveyor/FB_Conveyor.scl @@ -0,0 +1,315 @@ +FUNCTION_BLOCK "FB_Conveyor" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInEnabled : Bool := true; // This is for enabling or disabling this conveyor - e.G. for Testing + xInAutomaticMode : Bool; // When DriveGroup is in Automatic-Mode + xInMotorProtectionMonitoring : Bool; // Motor-Circuite-Breaker Monitoring; 0 = Error + xInRequestRun : Bool; + xInManualMode : Bool; // HMI Override + xInGridSen : Bool; // Rastersensor + xInGridQuit : Bool; // Rasterfehler quittieren + Settings : Struct + tEnergySafeTime : Time := T#60s; + tStartingTime : Time := T#50ms; + xGridActive : Bool; // Überwachung Rastersensor aktiv + sGridSenName : String[10]; // für fehlermeldung + sMotorProtectName : String[10]; // für fehlermeldung + END_STRUCT; + END_VAR + + VAR_OUTPUT + xOutPowerContactor : Bool; // Power contactor for motor + xOutConveyorFullSpeed : Bool; + xOutGridError : Bool; // Meldeausgang für Rasterfehler + END_VAR + + VAR_IN_OUT + stInOutControlUnitCabinet : "UDT_MainState"; + stInOutInterfaceHMI : "UDT_HMI_Conveyor"; // Nur für HMI + END_VAR + + VAR + nState : Int := -10; + nStateHold : Int := -10; + sStateText : String; + xReadyToStart : Bool; + xAutomaticMode : Bool; + TOnStartUpWarningTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + tStartUpTime : Time := T#50ms; + TOnEnergySafeTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + tEnergySafeTime : Time := T#60s; + TOnStandstillTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + tStandstillTime : Time := T#50ms; + TONStateTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + xStateTimer : Bool; + tStateTimer : Time; + tRestlaufzeit : Time; + TOnGridTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer für Rasterüberwachung + rTrigGrid {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; // Flanke von Rastersensor + xGridError : Bool; // Fehlerbit bei fehlendem Rastersignal + fbMonitoringGridError : "FB_Monitoring"; + fbMonitoringMotorProtection : "FB_Monitoring"; + END_VAR + + +BEGIN + REGION Automatic Mode + #xAutomaticMode := (#xInAutomaticMode OR #stInOutInterfaceHMI.xSemiAuto) AND #xInEnabled AND NOT #stInOutInterfaceHMI.xDisableConveyor; + END_REGION + + REGION ReadyToStart + #xReadyToStart := #xInMotorProtectionMonitoring AND #xInEnabled; + END_REGION ; + // ------------------------------------------------ + // Main State Machine + // ------------------------------------------------ + REGION MainStateMachine + CASE #nState OF + "E_DeviceState.eUndefined": + REGION Undefined + #sStateText := 'StartUp'; + #nState := "E_DeviceState.eStopped"; + #xStateTimer := 0; + END_REGION ; + "E_DeviceState.eStopped": + REGION Stopped + #sStateText := 'Stopped'; + IF #xReadyToStart AND NOT #Settings.xGridActive THEN + #nState := "E_DeviceState.eIdle"; + ELSIF #xReadyToStart AND #Settings.xGridActive AND NOT #xGridError THEN + #nState := "E_DeviceState.eIdle"; + END_IF; + END_REGION ; + "E_DeviceState.eIdle": + REGION IDLE + #sStateText := 'IDLE: Wait'; + IF NOT #xReadyToStart THEN + #nState := "E_DeviceState.eStopped"; + ELSIF #xAutomaticMode THEN + #nState := "E_DeviceState.eStarting"; + ELSIF #xInManualMode THEN + #nState := 500; + END_IF; + END_REGION ; + "E_DeviceState.eStarting": + REGION Starting + #sStateText := 'STARTING: Warning Timer'; + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #TOnStartUpWarningTimer.Q THEN + #nState := "E_DeviceState.eExecute"; + //#bInRequestRun := 0; + END_IF; + END_REGION ; + 500: + REGION Manual Mode + #sStateText := 'JOG: Manual Mode'; + IF NOT #xInManualMode THEN + #nState := "E_DeviceState.eStopping"; + END_IF; + END_REGION ; + "E_DeviceState.eExecute": + REGION Execute + #sStateText := 'EXECUTE: Running'; + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #Settings.xGridActive AND #xGridError THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #TOnEnergySafeTimer.Q THEN + #nState := "E_DeviceState.eHolding"; + #nStateHold := "E_DeviceState.eExecute"; + END_IF; + END_REGION ; + // ------------------------------------------------ + // HELD + // ------------------------------------------------ + + "E_DeviceState.eHolding": + REGION Holding + #sStateText := 'HOLDING: Start Energy Safing'; + IF #TOnStandstillTimer.Q THEN + #nState := "E_DeviceState.eHeld"; + END_IF; + END_REGION + + "E_DeviceState.eHeld": + REGION Held + #sStateText := 'HELD: Is Energy Safing'; + //ipAlarmSystem.Set(nAlarmNoOffset + 0); + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #xInRequestRun THEN + #nState := "E_DeviceState.eUnholding"; + END_IF; + END_REGION + + "E_DeviceState.eUnholding": + REGION Unholding + #sStateText := 'Un-Holding: Stops Energy Safing'; + #xStateTimer := 1; + #tStateTimer := #tStandstillTime; + IF #TONStateTimer.Q THEN + #nState := #nStateHold; + #xStateTimer := 0; + //ipAlarmSystem.Clr (nAlarmNoOffset + 0); + END_IF; + END_REGION + // ------------------------------------------------ + // STOPPING + // ------------------------------------------------ + + "E_DeviceState.eStopping": + REGION Stopping + #sStateText := 'Stopping'; + IF #TOnStandstillTimer.Q THEN + //ipAlarmSystem.Clr (nAlarmNoOffset + 0); + //ipAlarmSystem.Clr (nAlarmNoOffset + 3); + #nState := "E_DeviceState.eStopped"; + END_IF; + #xStateTimer := 0; + END_REGION + END_CASE; + END_REGION + //------------------------------------------------ + // Stop Conveyor by ChainBreakMonitor and MotorProtection + //------------------------------------------------ + IF (NOT #xReadyToStart) AND + (#nState > "E_DeviceState.eIdle") AND + (#nState < "E_DeviceState.eStopping") THEN + #nState := "E_DeviceState.eStopping"; + END_IF; + + REGION Rastersensor + #rTrigGrid(CLK := #xInGridSen); + + #TOnGridTimer(IN := NOT #rTrigGrid.Q AND #xOutPowerContactor, + PT := T#3s); + + IF #Settings.xGridActive AND #xOutConveyorFullSpeed AND #TOnGridTimer.Q THEN + #xGridError := TRUE; + ELSIF (#xGridError AND #xInGridQuit) OR (#xGridError AND NOT #Settings.xGridActive) THEN + #xGridError := FALSE; + END_IF; + + #xOutGridError := #xGridError; + END_REGION + //------------------------------------------------ + // Outputs + //------------------------------------------------ + REGION Outputs + #xOutPowerContactor := + ((#nState = "E_DeviceState.eExecute") OR + //(nState = E_DeviceState.eUnsuspending) OR + (#nState = "E_DeviceState.eUnholding") OR + (#nState = "E_DeviceState.eSuspending") OR + #stInOutInterfaceHMI.xManual OR + (#nState = 500)); + #xOutConveyorFullSpeed := #nState = "E_DeviceState.eExecute"; + END_REGION ; + (* + bOutLampMotorRunning := (#nState = "E_DeviceState.eStarting") OR + (#nState = "E_DeviceState.eExecute") OR + (#nState = "E_DeviceState.eHolding") OR + (#nState = "E_DeviceState.eSuspending") OR + (#nState = "E_DeviceState.eUnsuspending") OR + (#nState = "E_DeviceState.eStopping"); + *) + //------------------------------------------------ + // Timer + //------------------------------------------------ + REGION Timer + #tStartUpTime := #Settings.tStartingTime; + #TOnStartUpWarningTimer(IN := #nState = "E_DeviceState.eStarting", + PT := #tStartUpTime); + #TOnEnergySafeTimer( + IN := ((#nState = "E_DeviceState.eExecute") OR (#nState = "E_DeviceState.eSuspending")) AND + (NOT #xInRequestRun), + ET => #tRestlaufzeit, + PT := #Settings.tEnergySafeTime); + #TOnStandstillTimer(IN := (#nState = "E_DeviceState.eStopping") OR (#nState = "E_DeviceState.eHolding"), + PT := #tStandstillTime); + #TONStateTimer(IN := #xStateTimer, + PT := #tStateTimer); + END_REGION + + REGION Visu + + #stInOutInterfaceHMI.nState := #nState; + #stInOutInterfaceHMI.sStateText := #sStateText; + + REGION Status + IF #xReadyToStart THEN // Keine Fehler (Safety, ChainBreak, MotorProtection) + CASE #nState OF + "E_DeviceState.eUndefined", "E_DeviceState.eStopping", "E_DeviceState.eStopped", "E_DeviceState.eIdle": + #stInOutInterfaceHMI.bStatus := 0; // NOT_AVAILABLE + "E_DeviceState.eStarting", 500, "E_DeviceState.eExecute", "E_DeviceState.eHolding", "E_DeviceState.eHeld", "E_DeviceState.eUnholding", "E_DeviceState.eSuspending", "E_DeviceState.eSuspended", "E_DeviceState.eUnsuspending": + #stInOutInterfaceHMI.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutInterfaceHMI.bStatus := 0; // NOT AVAILABLE + END_CASE; + ELSE // Fehler + #stInOutInterfaceHMI.bStatus := 2; // ERROR + END_IF; + END_REGION + + REGION Modes + // Int16 Bit-codiert + #stInOutInterfaceHMI.nMode.%X0 := (#nState = "E_DeviceState.eUndefined") OR (#nState = "E_DeviceState.eStopped") OR (#nState = "E_DeviceState.eIdle"); // The device is turned off + #stInOutInterfaceHMI.nMode.%X1 := (#nState = "E_DeviceState.eStarting") OR (#nState = "E_DeviceState.eExecute") OR (#nState = "E_DeviceState.eUnholding"); // The device is turned on + #stInOutInterfaceHMI.nMode.%X2 := #stInOutInterfaceHMI.xDisableConveyor OR #stInOutInterfaceHMI.xManual OR #stInOutInterfaceHMI.xSemiAuto OR (#nState = 500) (* OR #xViSuManualMode OR #xViSuSemiAutoMode *); // The device is being manually operated + #stInOutInterfaceHMI.nMode.%X3 := (#nState = "E_DeviceState.eHeld"); //The device only is on when the device is needed (like standby) + #stInOutInterfaceHMI.nMode.%X10 := (#nState = "E_DeviceState.eSuspended"); // Overflow Error is set for this device + END_REGION + + #stInOutInterfaceHMI.xIsInAutomatic := #xAutomaticMode; + #stInOutInterfaceHMI.xEnergySaveReq := (NOT #xInRequestRun); + #stInOutInterfaceHMI.xPowerContactor := #xOutPowerContactor; + #stInOutInterfaceHMI.xPluggedChainBreak := #Settings.xGridActive; + #stInOutInterfaceHMI.xStatusChainBreak := (#Settings.xGridActive AND NOT #xGridError) OR NOT #Settings.xGridActive; + #stInOutInterfaceHMI.xStatusMotorProtect := #xInMotorProtectionMonitoring; + #stInOutInterfaceHMI.xConveyorFull1 := FALSE; + #stInOutInterfaceHMI.xConveyorFull2 := FALSE; + #stInOutInterfaceHMI.xReady2Receive := TRUE; + #stInOutInterfaceHMI.xNextConveyorReady := TRUE; + + END_REGION + + + REGION Monitoring + + REGION Grid Error + #fbMonitoringGridError.stSettings.nErrorType := 1; + #fbMonitoringGridError.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringGridError.stSettings.xSelfQuit := TRUE; + #fbMonitoringGridError.stSettings.tDelay := T#1s; + #fbMonitoringGridError(sInPrefix := #stInOutInterfaceHMI.sConveyorName, + wInTextListId_Function := 400, + wInTextListId_Message := 400, + sInSuffix := #Settings.sMotorProtectName, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #xInGridQuit, + xInSignal := NOT #xGridError, + sInAlarmMessage := 'Fehler Rastersensorueberwachung'); + END_REGION + + + REGION Motorschutz + #fbMonitoringMotorProtection.stSettings.nErrorType := 1; + #fbMonitoringMotorProtection.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringMotorProtection.stSettings.xSelfQuit := TRUE; + #fbMonitoringMotorProtection.stSettings.tDelay := T#1s; + #fbMonitoringMotorProtection(sInPrefix := #stInOutInterfaceHMI.sConveyorName, + wInTextListId_Function := 400, + wInTextListId_Message := 401, + sInSuffix := #Settings.sMotorProtectName, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError, + xInSignal := #xInMotorProtectionMonitoring, + sInAlarmMessage := 'Fehler Motorschutzschalter'); + END_REGION + + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.libinfo b/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.libinfo new file mode 100644 index 0000000..3a0fed0 --- /dev/null +++ b/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 7d4d00d5-3a74-48f2-a16d-c1df371b6b73 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.6 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Monitoring MoSchu diff --git a/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.libint b/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.libint new file mode 100644 index 0000000..6bc02af --- /dev/null +++ b/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FB_Conveyor_Sort.scl + Hash: OAHKG7Elzue3Gas/evCuv9ggYtU+MH5kA+1TJi90RgA= +LibraryMetaFileHash: G62tAZiPi7WBemXkAmWxMHsyC/Ye060c8SQGQXh0CSw= +LibraryVersion: + Guid: aa2b6c0a-fa07-4b36-bb79-186128730907 + DependsOn: + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: UDT_Conveyor + VersionNumber: 0.0.15 diff --git a/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.scl b/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.scl new file mode 100644 index 0000000..5b35f01 --- /dev/null +++ b/2_ILSLib/FB/Conveyor/FB_Conveyor_Sort.scl @@ -0,0 +1,475 @@ +FUNCTION_BLOCK "FB_Conveyor_Sort" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInEnabled : Bool; + xInFull : Bool; // If Connected Tracks are Full, Conveyor will set to Suspend + xInNextConveyorReady : Bool; // NextConveyor.xOutReadyToReceive + xInAutomaticMode : Bool; // nState = E_DeviceState.eExecute + xInEnergySafeRequest : Bool; // ConveyorInputSensor + xInChainBreakMonitoring : Bool; // ChainBreakSensor + xInChainBreakMonitoringSmoothing : Bool; + xInMotorProtectionMonitoring : Bool; // MotorProtectionInput + xInSafetyEnable : Bool; // fbSafetyEStopConveyor + xInGridSen : Bool; // Rastersensor + xInGridQuit : Bool; // Rasterfehler quittieren + Settings : Struct + tEnergySafeTime : Time; + tStartingTime : Time := T#750ms; + xGridActive : Bool; // Überwachung Rastersensor aktiv + sMotorProtectName : String[10]; + END_STRUCT; + END_VAR + + VAR_OUTPUT + xOutPowerContactor : Bool; // PowerContactor for Motor + xOutConveyorFullSpeed : Bool; + xOutMotStat : Bool; + xOutReadyToReceive : Bool; // For xInNextConveyorReady + xOutLampMotorRunning : Bool; + eOutState : Int; + sOutState : String[30]; + xOutInExecute : Bool; + xOutInSafeState : Bool; + xOutGridError : Bool; // Meldeausgang für Rasterfehler + END_VAR + + VAR_IN_OUT + stInOutControlUnitCabinet : "UDT_MainState"; + stInOutInterfaceHMI : "UDT_Conveyor"; // Nur für HMI + END_VAR + + VAR + xErrorChain : Bool; + xErrorMotorProtection : Bool; + StartWarningRequestFlag : Bool; + StartWarningRequest : Bool; + StateToStartFlag : Bool; + StateToStart : Bool; + StateToStopFlag : Bool; + StateToStop : Bool; + xReadyToStart : Bool; + nState : Int := -10; + nStateHold : Int; // Aus CRoot --> + sStateText : String; + xEnergySafeRequest : Bool; + "//TIMER" : Int; + TOfChainBreakTimer {InstructionName := 'TOF_TIME'; LibVersion := '1.0'} : TOF_TIME; + END_VAR + VAR RETAIN + tChainBreakTime : Time := T#1s; + END_VAR + VAR + TOnStartingWarningTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Aus CRoot --> + END_VAR + VAR RETAIN + tStartingWarningTime : Time := T#750ms; + END_VAR + VAR + TOnEnergySafeTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Aus CRoot --> + END_VAR + VAR RETAIN + tEnergySafeTime : Time := T#1m; + END_VAR + VAR + TOnNextConveyorReadyTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer On-Delay for xInNextConveyorReady -> Then Suspend + END_VAR + VAR RETAIN + tNextConveyorReadyTime : Time := T#1s; // Time for Conveyor Ready + END_VAR + VAR + TOnFullTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer On-Delay for Conveyor is Full + END_VAR + VAR RETAIN + tFullTime : Time := T#500ms; // Time for Conveyor is Full - Init is 3s + END_VAR + VAR + TONStateTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Aus CRoot --> + xStateTimer : Bool; + tStateTimer : Time; + xAutomaticMode : Bool; // xInAutomaticMode + Enable + fbMonitoringChainBreak : "FB_Monitoring"; + fbMonitoringMotorProtection : "FB_Monitoring"; + TOnGridTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer für Rasterüberwachung + rTrigGrid {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; // Flanke von Rastersensor + xGridError : Bool; // Fehlerbit bei fehlendem Rastersignal + END_VAR + + +BEGIN + #xEnergySafeRequest := #xInEnergySafeRequest; + #xAutomaticMode := (#xInAutomaticMode OR #stInOutInterfaceHMI.xSemiAuto) AND #xInEnabled AND NOT #stInOutInterfaceHMI.xDisableConveyor; + + REGION RootProperties + + REGION ErrorChain + IF "DB_MachineGlobal".nMachineMode = "E_MachineMode.eOn" THEN + #xErrorChain := (NOT #TOfChainBreakTimer.Q) (*OR (ipAlarmSystem.HI (nAlarmNoOffset + 2))*); + ELSE + #xErrorChain := 0; + END_IF; + END_REGION + + REGION ErrorMotorProtection + IF "DB_MachineGlobal".nMachineMode = "E_MachineMode.eOn" THEN + #xErrorMotorProtection := (NOT #xInMotorProtectionMonitoring) (* OR (ipAlarmSystem.HI (nAlarmNoOffset + 1)) *); + ELSE + #xErrorMotorProtection := 0; + END_IF; + END_REGION + + REGION InExecute + #xOutInExecute := #nState >= "E_DeviceState.eExecute"; + END_REGION + + REGION InSafeState + #xOutInSafeState := #nState <= "E_DeviceState.eIdle"; + END_REGION + + REGION ReadyToStart + #xReadyToStart := (NOT #xErrorChain) AND + (#xInSafetyEnable) AND + (NOT #xErrorMotorProtection); + END_REGION + + REGION StartWarningRequest + IF #StartWarningRequestFlag THEN + #StartWarningRequest := #nState = "E_DeviceState.eStarting"; + #StartWarningRequestFlag := 0; + END_IF; + END_REGION + + REGION StateToStart + IF #nState = "E_DeviceState.eIdle" AND #StateToStartFlag THEN + #nState := "E_DeviceState.eStarting"; + #StateToStart := 1; // benötigt?? Wird nirgendwo zurückgesetzt? + #StateToStartFlag := 0; + END_IF; + END_REGION + + REGION StateToStop + IF (#nState > "E_DeviceState.eIdle") AND #StateToStopFlag = 1 THEN + #nState := "E_DeviceState.eStopping"; + #StateToStop := 1; // benötigt?? Wird nirgendwo zurückgesetzt? + #StateToStopFlag := 0; + END_IF; + END_REGION + END_REGION + + REGION StateMain + CASE #nState OF + "E_DeviceState.eUndefined": + REGION Undefined + #sStateText := 'StartUp'; + #nState := "E_DeviceState.eStopped"; + END_REGION + + "E_DeviceState.eStopped": + REGION Stopped + #sStateText := 'Stopped'; + IF #xReadyToStart AND NOT #Settings.xGridActive THEN + #nState := "E_DeviceState.eIdle"; + ELSIF #xReadyToStart AND #Settings.xGridActive AND NOT #xGridError THEN + #nState := "E_DeviceState.eIdle"; + END_IF; + END_REGION + + "E_DeviceState.eIdle": + REGION IDLE + #sStateText := 'IDLE: Wait'; + IF NOT #xReadyToStart THEN + #nState := "E_DeviceState.eStopped"; + ELSIF #xAutomaticMode THEN + #nState := "E_DeviceState.eStarting"; + END_IF; + END_REGION + + "E_DeviceState.eStarting": + REGION Starting + #sStateText := 'STARTING: Warning Timer'; + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #TOnStartingWarningTimer.Q THEN + #nState := "E_DeviceState.eExecute"; + #xEnergySafeRequest := 0; + #xStateTimer := 0; + END_IF; + END_REGION + + "E_DeviceState.eExecute": + REGION Execute + #sStateText := 'EXECUTE: Running'; + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #Settings.xGridActive AND #xGridError THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #TOnEnergySafeTimer.Q THEN + #nState := "E_DeviceState.eHolding"; + #nStateHold := "E_DeviceState.eExecute"; + ELSIF #TOnFullTimer.Q OR #TOnNextConveyorReadyTimer.Q THEN //Könnte man vereinfachen + #nState := "E_DeviceState.eSuspending"; + END_IF; + END_REGION + + // ------------------------------------------------ + // HELD + // ------------------------------------------------ + "E_DeviceState.eHolding": + #sStateText := 'HOLDING: Start Energy Safing'; + // IF #TOnStandstillTimer.Q THEN + #nState := "E_DeviceState.eHeld"; + // END_IF; + + "E_DeviceState.eHeld": + REGION Held + #sStateText := 'HELD: Is Energy Safing'; + //ipAlarmSystem.Set(nAlarmNoOffset + 0); + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF NOT #xInEnergySafeRequest THEN + #nState := "E_DeviceState.eUnholding"; + END_IF; + END_REGION + + "E_DeviceState.eUnholding": + #sStateText := 'Un-Holding: Stops Energy Safing'; + #xStateTimer := 1; + IF #TONStateTimer.Q THEN + #nState := #nStateHold; + #xStateTimer := 0; + //ipAlarmSystem.Clr(nAlarmNoOffset + 0); + END_IF; + // ------------------------------------------------ + // SUSPENDED + // ------------------------------------------------ + "E_DeviceState.eSuspending": + #sStateText := 'SUSPENDING: This state is a result of a command change from the EXECUTE state. This state is typically required prior to the SUSPENDED wait state, and prepares the machine (ie stops glue cycles, stops carton feeds, etc) prior to the SUSPEND state.'; + IF NOT #xInAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF NOT #xInFull THEN + #nState := "E_DeviceState.eUnsuspending"; + END_IF; + + "E_DeviceState.eSuspended": + REGION Suspended + #sStateText := 'SUSPENDED: The machine may be running at the relevant setpoint speed, there is no product being produced. This state can be reached as a result of a machine status, and differs from HELD in that HELD is typically a result of an operator request.'; + //ipAlarmSystem.Set(nAlarmNoOffset + 3); + IF NOT #xAutomaticMode THEN + #nState := "E_DeviceState.eStopping"; + ELSIF #xInNextConveyorReady THEN + #nState := "E_DeviceState.eUnsuspending"; + END_IF; + END_REGION + + "E_DeviceState.eUnsuspending": + #sStateText := 'UN-SUSPENDING: This state is a result of a request from SUSPENDED state to go back to the EXECUTE state. This actions of this state may include: ramping up speeds, turning on vaccums, the re-engagement of clutches.'; + #xStateTimer := 1; + //#TONStateTimer.PT := #tStandstillTime; + IF #TONStateTimer.Q THEN + //ipAlarmSystem.Clr (nAlarmNoOffset + 3); + #nState := "E_DeviceState.eExecute"; + #xStateTimer := 0; + END_IF; + "E_DeviceState.eStopping": + REGION Stopping + #sStateText := 'STOPPING: This state executes the logic which brings the machine to a controlled and safe stop'; + #nState := "E_DeviceState.eStopped"; + END_REGION + END_CASE; + END_REGION + + REGION Rastersensor + #rTrigGrid(CLK := #xInGridSen); + + #TOnGridTimer(IN := NOT #rTrigGrid.Q AND #xOutPowerContactor, + PT := T#3s); + + IF #Settings.xGridActive AND #xOutConveyorFullSpeed AND #TOnGridTimer.Q THEN + #xGridError := TRUE; + ELSIF (#xGridError AND #xInGridQuit) OR (#xGridError AND NOT #Settings.xGridActive) THEN + #xGridError := FALSE; + END_IF; + + #xOutGridError := #xGridError; + END_REGION + + REGION Outputs + #xOutPowerContactor := (#nState = "E_DeviceState.eExecute") OR (#nState = "E_DeviceState.eUnsuspending") OR (#nState = "E_DeviceState.eUnholding"); + #xOutConveyorFullSpeed := #TOnStartingWarningTimer.Q;//#nState = "E_DeviceState.eExecute"; + #xOutMotStat := #xOutPowerContactor; + + #xOutLampMotorRunning := (#nState = "E_DeviceState.eStarting") OR + (#nState = "E_DeviceState.eExecute") OR + (#nState = "E_DeviceState.eHolding") OR + (#nState = "E_DeviceState.eUnsuspending") OR + (#nState = "E_DeviceState.eStopping"); + + // ????????? + #xOutReadyToReceive := (#nState = "E_DeviceState.eExecute"); + END_REGION + + REGION Timer + #TOfChainBreakTimer(IN := #xInChainBreakMonitoring, + PT := #tChainBreakTime); + + #tStartingWarningTime := #Settings.tStartingTime; + #TOnStartingWarningTimer(IN := #nState = "E_DeviceState.eStarting" OR #nState = "E_DeviceState.eExecute", + PT := #tStartingWarningTime); + + // Begrenzen + IF #stInOutInterfaceHMI.tEnergySafeTime <= T#0s THEN + #stInOutInterfaceHMI.tEnergySafeTime := #tEnergySafeTime; + END_IF; + + #TOnEnergySafeTimer(IN := ((#nState = "E_DeviceState.eExecute") OR (#nState = "E_DeviceState.eSuspending")) AND + (#xInEnergySafeRequest), + PT := (* #stInOutHMI.tEnergySafeTime *)#Settings.tEnergySafeTime); + #TOnNextConveyorReadyTimer(IN := NOT #xInNextConveyorReady, + PT := #tNextConveyorReadyTime); + #TOnFullTimer(IN := (#nState = "E_DeviceState.eExecute") AND #xInFull, + PT := #tFullTime); + + #TONStateTimer(IN := #xStateTimer, + PT := #tStateTimer); + + + END_REGION + + REGION StateStatus + CASE #nState OF + 0..9: + #eOutState := "E_DeviceState.eStopped"; + #sOutState := 'Stopped'; + (* // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := sw_300_300); *) + 10..99: + #eOutState := "E_DeviceState.eResetting"; + #sOutState := 'Resetting'; + 100..109: + #eOutState := "E_DeviceState.eIdle"; + #sOutState := 'Idle'; + (* // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := grau_300_300); *) + 110..999: + #eOutState := "E_DeviceState.eStarting"; + #sOutState := 'Starting'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := gelb_300_300); + 1000..1999: + #eOutState := "E_DeviceState.eExecute"; + #sOutState := 'Execute'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := gruen_300_300); + 2000..2499: + #eOutState := "E_DeviceState.eCompleting"; + #sOutState := 'Completing'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := gelb_300_300); + 2500..2999: + #eOutState := "E_DeviceState.eComplete"; + #sOutState := 'eComplete'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := ws_300_300); + 3000..3499: + #eOutState := "E_DeviceState.eHolding"; + #sOutState := 'Holding'; + 3500..3599: + #eOutState := "E_DeviceState.eHeld"; + #sOutState := 'Held'; + 3600..3999: + #eOutState := "E_DeviceState.eUnholding"; + #sOutState := 'Unholding'; + 4000..4499: + #eOutState := "E_DeviceState.eSuspending"; + #sOutState := 'Suspending'; + 4500..4599: + #eOutState := "E_DeviceState.eSuspended"; + #sOutState := 'Suspended'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := blau_300_300); + 4600..4999: + #eOutState := "E_DeviceState.eUnsuspending"; + #sOutState := 'Unsuspending'; + 5000..5999: + #eOutState := "E_DeviceState.eStopping"; + #sOutState := 'Stopping'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := rot_300_300); + 6000..6499: + #eOutState := "E_DeviceState.eAborting"; + #sOutState := 'Aborting'; + 6500..6599: + #eOutState := "E_DeviceState.eAborted"; + #sOutState := 'Aborted'; + 6600..6999: + #eOutState := "E_DeviceState.eClearing"; + #sOutState := 'Clearing'; + 10000..11000: + #eOutState := "E_DeviceState.eHeld"; + #sOutState := 'Held'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := rot_300_300); + ELSE + #eOutState := "E_DeviceState.eUndefined"; + #sOutState := 'Undefined'; + // #sStateColor := F_ImageSelectString(sImagePool := MachineParameter.cImagePoolPath, nImageNo := rot_300_300); + END_CASE; + END_REGION + + REGION Visu + + #stInOutInterfaceHMI.nState := #nState; + #stInOutInterfaceHMI.sStateText := #sStateText; + + REGION Status + IF #xReadyToStart THEN // Keine Fehler (Safety, ChainBreak, MotorProtection) + CASE #nState OF + "E_DeviceState.eUndefined", "E_DeviceState.eStopping", "E_DeviceState.eStopped", "E_DeviceState.eIdle": + #stInOutInterfaceHMI.bStatus := 0; // NOT_AVAILABLE + "E_DeviceState.eStarting", 500, "E_DeviceState.eExecute", "E_DeviceState.eHolding", "E_DeviceState.eHeld", "E_DeviceState.eUnholding", "E_DeviceState.eSuspending", "E_DeviceState.eSuspended", "E_DeviceState.eUnsuspending": + #stInOutInterfaceHMI.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutInterfaceHMI.bStatus := 0; // NOT AVAILABLE + END_CASE; + ELSE // Fehler + #stInOutInterfaceHMI.bStatus := 2; // ERROR + END_IF; + END_REGION + + REGION Modes + // Int16 Bit-codiert + #stInOutInterfaceHMI.nMode.%X0 := (#nState = "E_DeviceState.eUndefined") OR (#nState = "E_DeviceState.eStopped") OR (#nState = "E_DeviceState.eIdle"); // The device is turned off + #stInOutInterfaceHMI.nMode.%X1 := (#nState = "E_DeviceState.eStarting") OR (#nState = "E_DeviceState.eExecute") OR (#nState = "E_DeviceState.eUnholding"); // The device is turned on + #stInOutInterfaceHMI.nMode.%X2 := #stInOutInterfaceHMI.xDisableConveyor OR #stInOutInterfaceHMI.xManual OR #stInOutInterfaceHMI.xSemiAuto OR (#nState = 500) (* OR #xViSuManualMode OR #xViSuSemiAutoMode *); // The device is being manually operated + #stInOutInterfaceHMI.nMode.%X3 := (#nState = "E_DeviceState.eHeld"); //The device only is on when the device is needed (like standby) + #stInOutInterfaceHMI.nMode.%X10 := (#nState = "E_DeviceState.eSuspended"); // Overflow Error is set for this device + END_REGION + + #stInOutInterfaceHMI.xIsInAutomatic := #xAutomaticMode; + #stInOutInterfaceHMI.xEnergySaveReq := (#xInEnergySafeRequest); + #stInOutInterfaceHMI.xPowerContactor := #xOutPowerContactor; + #stInOutInterfaceHMI.xPluggedChainBreak := #Settings.xGridActive; + #stInOutInterfaceHMI.xStatusChainBreak := (#Settings.xGridActive AND NOT #xGridError) OR NOT #Settings.xGridActive; + #stInOutInterfaceHMI.xStatusMotorProtect := #xInMotorProtectionMonitoring; + #stInOutInterfaceHMI.xConveyorFull1 := FALSE; + #stInOutInterfaceHMI.xConveyorFull2 := FALSE; + #stInOutInterfaceHMI.xReady2Receive := TRUE; + #stInOutInterfaceHMI.xNextConveyorReady := TRUE; + + END_REGION + + REGION Monitoring + #fbMonitoringChainBreak.stSettings.nErrorType := 1; + #fbMonitoringChainBreak.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringChainBreak.stSettings.xSelfQuit := TRUE; + #fbMonitoringChainBreak(sInFctnName := 'Sort Conveyor', + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError, + xInSignal := NOT #xErrorChain, + sInAlarmMessage := 'Kettenspannung nicht ausreichend oder Kette gebrochen! Ueberpruefen Sie die Kette.'); + + #fbMonitoringMotorProtection.stSettings.nErrorType := 1; + #fbMonitoringMotorProtection.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringMotorProtection.stSettings.xSelfQuit := TRUE; + #fbMonitoringMotorProtection.stSettings.tDelay := T#1s; + #fbMonitoringMotorProtection(sInPrefix := #stInOutInterfaceHMI.sConveyorName, + wInTextListId_Function := 400, + wInTextListId_Message := 401, + sInSuffix := #Settings.sMotorProtectName, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError, + xInSignal := #xInMotorProtectionMonitoring); + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.libinfo b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.libinfo new file mode 100644 index 0000000..e52e2c6 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: d0ad9446-bc78-42a5-b84b-49a4797c28ac + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.32 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: DoNotDeleteOnScanCorrection benutzt um Meldung "Carrier kommt nicht an" einstellbar zu machen diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.libint b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.libint new file mode 100644 index 0000000..183079c --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.libint @@ -0,0 +1,57 @@ +DocumentHash: + - FileName: FB_ILS_MTRO_1Sep.scl + Hash: umhqNyG9FtW9SgmMzYIetWW2VbMzr2vIZ4SZtZBjNkc= +LibraryMetaFileHash: hzrYxyjc0YkD2PM6EBe8rUOdl36+kofESSfQNFnClu8= +LibraryVersion: + Guid: 574d1c63-2f47-400a-81d4-5ae98e38068a + DependsOn: + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: FB_SetAlarmAndLog + VersionNumber: 2.0.1 + - TypeName: FB_ILS_STRO_Sep + VersionNumber: 2.0.8 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Booking + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: FB_BarcodeReaderCognex + VersionNumber: 2.0.4 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: UDT_HMI_TRO + VersionNumber: 2.0.4 + - TypeName: FB_EventLog_Correction + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Scan + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: FB_CarrAccumulate1Sep + VersionNumber: 2.0.0 + - TypeName: FC_Route + VersionNumber: 2.0.1 + - TypeName: FC_TSHR_Shift + VersionNumber: 2.0.1 + - TypeName: FC_Ean8_CheckDigit + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.scl b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.scl new file mode 100644 index 0000000..f20c24a --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep.scl @@ -0,0 +1,1114 @@ +FUNCTION_BLOCK "FB_ILS_MTRO_1Sep" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : Struct // Einstellungen MTRO + nTroStopper1 : Int; + xIsBorner : Bool; // Bei diesem TRO werden immer neue Carrier angelegt (z.B. erster TRO bei Einfahrt in Gesamtanlage) + sJamSrc : String[16]; + sJamDest : String[16]; + bSepType : Byte; // X0: TRUE - erstes Bein halten, X1: TRUE- Beladekontrolle, X2: TRUE - Beladeerfassung + tPartSenHigh : Time := T#500ms; + tInSenHigh : Time := T#500ms; + nBornerDest : Int; // Standard Destination festlegen für Borner (variabel) + tDummyTimeNormal : Time := T#3s; // Zeit für Dummy anlegen (Dummy = 1) + tDummyTimeBorner : Time := T#0ms; // Zeit für Dummy anlegen (Dummy = 1000-2000) schneller... + END_STRUCT; + stInSeparator1 : Struct // Separator Parameter + stSenInSep : "UDT_Sensor"; // Sensor in Stopper + stSenSepLeft : "UDT_Sensor"; // Sensor nach Stopper + stSenPart : "UDT_Sensor"; // Checkt, ob der Bügelträger beladen ist + stSenStartScan : "UDT_Sensor"; // Sensor nach Stopper wenn Scanner vorhanden. Vermutlich startet dieser Sensor den Scanner + Settings : "SettingsSeparator"; + END_STRUCT; + stInBarcodeReader : Struct + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + stInSenJam2 : "UDT_Sensor"; // Stausensor Exit 2 + stInPriorityManager : "UDT_Response"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + nInMainTroNo : UInt; // TRO-Nummer + xInSftyOk : Bool; // Safety ok + xInAllRdyToStart : Bool; // Alles bereit + xInCarouselRun : Bool; // Förderer aktiv + xInTestMode : Bool; // Testmodus aktivieren + xInCancel : Bool; // TRO komplett rücksetzen + xInAreaStopActive : Bool; // Bereichshalt + xInRelease : Bool; // Freigabe/Anforderung + END_VAR + + VAR_OUTPUT + xOutStopper1 : Bool; // Separator Stopper öffnen (TRUE = Auf, FALSE = Zu) + xOutJamAtEntry1 : Bool; // Stau + xOutCarouselReq : Bool; // Förderer anfordern + xOutCorrection : Bool; + stOutPriorityManager : "UDT_Request"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + nOutStateLast : Int; + nOutScanResult : DInt; + xOutNewScan : Bool; + END_VAR + + VAR_IN_OUT + stInOutMachineState : "UDT_MainState"; // Maschinenzustand (Allgemien) + stInOutCognexInterface : "stCognexInterface"; // Cognex Barcode Reader Interface + arInOutJamEntr1 : Array[*] of "stCarrier"; // Daten Staubereich Eingang 1 + stInOutJamEntr1 : "stJamData"; // Konfig+Status-Daten Staubereich Eingang 1 + arInOutJamExit2 : Array[*] of "stCarrier"; // Carrier-Daten Staubereich Ausgang 1 + stInOutJamExit2 : "stJamData"; // Konfig+Status-Daten Staubereich Ausgang 1 + stInOutHMI : "UDT_HMI_TRO"; // HMI Schnittstelle + END_VAR + + VAR + fbBarcodeReader1 : "FB_BarcodeReaderCognex"; // Instanz Barcode-Reader + fbSeparator1 : "FB_ILS_STRO_Sep"; // Intanz Separator + fbStateManager : "FB_StateManager"; // Schrittketten Manager + END_VAR + VAR RETAIN + stActRequest : Struct // Aktuelle Schrittkettendaten + xNBT : Bool; // Es handelt sich um einen Nullbügelträger + xCancelled : Bool; // Abbruchanforderung durch MFR + nActArrIndex : USInt; + nActReqIndex : USInt; // 0 = nichts zu tun | 1-200: Aktuell bearbeiteter Index + nDirection : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A2 + nRequestedNoBT : USInt; // Anzahl Trolleys die ausgefahren werden sollen + nReasonForStop : USInt; // 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + nActNoStopper : USInt; // Anzahl der Stopper-öffnungen in diesem Auftrag + nCntAtStartSep1 : UDInt; // Absoluter Zähler an Separator 1 bei Start des Auftrages + nCntAtStartExit2 : UDInt; // Absoluter Zähler an Exit 2 bei Start des Auftrages + END_STRUCT; + END_VAR + VAR + sStateText : String[100]; // Aktueller State der Schrittkette (textuell) + END_VAR + VAR RETAIN + nState : Int; // Schrittkette Schrittnummer + xReleaseTrolleySep1 : Bool; // Öffne-Befehl + xErrorMotor : Bool; // Fehler weil Motor-Run fehlt + xMTRORdy : Bool; + END_VAR + VAR + tOnSvReleaseSep {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Supervision - Freigabe Separator + tOnMonCarrArrive {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Überwachungszeit zwischen Carrier Online & Separator Sensor Belegung + xTransportAllowed : Bool; + fbSetAlarmAndLog : "FB_SetAlarmAndLog"; + xStartScan : Bool; + nBarcodeResult : DInt; + wErrorWord : Word; + fbMonitoringCarrNotArrive : "FB_Monitoring"; + fbMonitoringCarrWoData : "FB_Monitoring"; + nArrayMax : Int; + stCarrierDummy { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : "stCarrier" := (1, (), 16#01); + xTrolleyWithPart : Bool; + xTrolleyWoPart : Bool; + xHandshakeScan : Bool; + xReadSecondLeg : Bool; + fbEventLog_Route : "FB_EventLog_Booking"; + xCodeEven : Bool; + nBarcodeHelp : DInt; + sBarcodeString : String; + fbEventLogCorrection1 : "FB_EventLog_Correction"; + fbEventLogCorrection2 : "FB_EventLog_Correction"; + fbEventLogCarrierUnknown : "FB_EventLog_Scan"; + fbEventLogCarrierNew : "FB_EventLog_Scan"; + fbEventLogGoodRead : "FB_EventLog_Scan"; + fbCarrierWait : "FB_CarrAccumulate1Sep"; + nBarcodeEmpty : Int; + END_VAR + + VAR_TEMP + xTemp : Bool; + nTempStopReasonInternal : Word; + nTempStopReasonExternal : Word; + nIndex : USInt; + tmpActUnivTon : Bool; + xBtEmpty : Bool; + tmpReasonForStop : USInt; // Anhaltegrund in der Schrittkette | 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + stEmptyCarrier : "stCarrier"; + stBookingInfo : "stEventBookingInfo"; + arEventCorrectionInfo : Array[0..1] of "stEventCorrectionInfo"; + arEmptyCarrier : Array[1..1] of "stCarrier"; // Platzhalter für CarrierArray + tmpCarrierEmpty : "stCarrier"; + xEventLogRoute : Bool; + stEventNew : "stEventScanInfo"; + stEventUnknown : "stEventScanInfo"; + xNewCarrier : Bool; + xGoodRead : Bool; + xTmpCorrection : Bool; + xUnknownCarrier : Bool; + stEventGoodRead : "stEventScanInfo"; + END_VAR + + VAR CONSTANT + c0000_StepOff : Int := 0; // Schrittkette aus + c0100_StepUndefined : Int := 100; // Schrittkette undefiniert / Init + c1000_StepWaitForTrolley1 : Int := 1000; // Warte auf Trolley 1 + c1100_StepScannerTrig1 : Int := 1100; // Scanner Triggern + c1200_StepScannerEval1 : Int := 1200; // Scanergebnis auswerten + c1300_StepCheckLoad : Int := 1300; // Beladung prüfen + c1400_StepCheckSep1 : Int := 1400; // Separator checken + c1500_StepReleaseSep1 : Int := 1500; // Freigabe an Separator + c2000_StepWaitForTrolley2 : Int := 2000; // Warte auf Trolley 2 + c2100_StepScannerTrig2 : Int := 2100; // Scanner Triggern (nur wenn 1.Achse kein Ergebnis) + c2200_StepScannerEval2 : Int := 2200; // Scanergebnis auswerten (nur wenn 1.Achse kein Ergebnis) + c2300_StepCheckSep2 : Int := 2300; // Separator checken + c2400_StepCheckJam : Int := 2400; // Stau überprüfen + c2500_StepReleaseSep2 : Int := 2500; // Freigabe an Separator + cCarrierDummy : Int := 1; + cCarrierUnknown : Int := 2; + END_VAR + + +BEGIN + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2025). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_MTRO_1Sep + Comment/Function: MainTRO-Function block for controlling TRO with Separator + Scanner(optional) + Library/Family: "MainTRO" + Author: department: "Automatisierung" ; person in charge / contact: E.Yüksel, T. Molina, T.Schiller + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V20 + Restrictions: - + Requirements: (hardware, technological package, etc.) + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2022-12-13 | - | Yüksel, Molina | Header added on 13.12.2022 + 002.000.000 | 2025-02-11 | - | Yüksel | Adapt to ILS with Minitrolley, without external MFR + + *) + + (* -----> + Sep. 1 + Entrance 1 -----------|---------- Exit 2 + + *) + + (*Hierarchie + Logistik = Priorität Modul (Vorfahrt, Ampel, mengengesteuert, zeitgesteuert, deterministisch) + MainTRO = TRansportObject Modul (Koordinierung der Fördertechnik) + SubTRO = Fördertechnik Modul (Ausführen der Fördertechnik)*) + + REGION Schrittkette Transport + + CASE #nState OF + #c0000_StepOff: + REGION 0000: Off + // akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + // SCHRITT 0 WIRD GEBRAUCHT! + //STATE MANAGER KÜMMERT SICH UM TRANSITION! + END_REGION + + #c0100_StepUndefined: + REGION 0100: Undefined + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xMTRORdy := FALSE; + #xCodeEven := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #nState := #c1000_StepWaitForTrolley1; + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + //akt. Zustand + #sStateText := 'Wait for Trolley'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + #xMTRORdy := TRUE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN // Wenn Pause an HMI gedrückt, dann warten + IF #fbSeparator1.stOutMainTro.xBtPresent THEN //Separator meldet Belegung + IF #stInSeparator1.Settings.xPluggedScanner THEN //Scanner verbaut? + #nState := #c1100_StepScannerTrig1; //Nächster Schritt -> Scannen + ELSIF #arInOutJamEntr1[1].bStatus.%X0 THEN // Kein Scanner verbaut, aber Carrier online (z.B. Dummy wurde angelegt) + IF #stInSeparator1.Settings.xPluggedPart THEN + #nState := #c1300_StepCheckLoad; // Nächster Schritt -> Beladung prüfen + ELSE + #nState := #c1400_StepCheckSep1; //Nächster Schritt -> Separator chekcen + END_IF; + END_IF; + END_IF; + END_IF; + END_REGION + + #"c1100_StepScannerTrig1": + REGION 1100: Scanner Trigger 1 + + // akt. Zustand + #sStateText := 'Scanner Trigger 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN //Scanner bereit + #xStartScan := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScan := FALSE; + #nState := #c1200_StepScannerEval1; //Weiter + END_IF; + END_REGION + + #"c1200_StepScannerEval1": + REGION 1200: Scanner Evaluation 1 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic - TODO in eigenen FC packen?.. + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader übernehmen + + REGION Event log Good read + #xGoodRead := TRUE; // Trigger + #stEventGoodRead.nScanType := 4; + #stEventGoodRead.sBarcode := DELETE(IN := DINT_TO_STRING(#nBarcodeResult), L := 1, P := 1); + #stEventGoodRead.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + END_REGION + + REGION Gerade Zahl erkannt + IF (((#nBarcodeResult / 10) MOD 100) MOD 2 <> 1) THEN //anderes Ergebnis als 1 bedeutet, (xxxxxYYx) YY=gerade, also hinteres Bein von MiniTrolley + #xCodeEven := TRUE; //Bit sagt Separator dass hinteres Bein und nicht erstes zur Korrektur in Schrittkette + // #nBarcodeTarget := #nBarcodeTarget - 10; //Mache danach die gerade Zahl zur ungeraden UPDATE: WEGEN 8. ZIFFER KLAPPT DAS SO NICHT + #nBarcodeHelp := (#nBarcodeResult / 10) - 1; + + "FC_Ean8_CheckDigit"(sInDigits := DELETE(IN := DINT_TO_STRING(IN := #nBarcodeHelp), L := 1, P := 1), + sOutBarcode => #sBarcodeString, + nOutBarcode => #nBarcodeResult); + + // #sOutBarcode := #sBarcodeString; + END_IF; + END_REGION + + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:= #stInBarcodeReader.Settings.nStation, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION_INBOUND"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:= #stInBarcodeReader.Settings.nStation, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + + REGION Event Log unknown Carrier + + #xUnknownCarrier := TRUE; // Trigger + #stEventUnknown.nScanType := 3; + #stEventUnknown.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + #stEventUnknown.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + #stEventUnknown.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation + 50), L := 1, P := 1); + + END_REGION + + END_IF; + + #xHandshakeScan := TRUE; + + #nOutScanResult := #nBarcodeResult; + #xOutNewScan := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + IF #stInSeparator1.Settings.xPluggedPart AND #stInSettings.bSepType.%X2 THEN + #nState := #c1300_StepCheckLoad; + // #nState := #c1400_StepCheckSep1; + ELSIF #xCodeEven THEN + #xCodeEven := FALSE; + #nState := #c2000_StepWaitForTrolley2; //Scanner bestätigt zweites Bein gelesen -> Korrigieren! + ELSE + #nState := #c1400_StepCheckSep1; + END_IF; + + END_REGION + (* + "1SeStep_CheckCorrectBt": + REGION 2000: Check if correct BT inside + + // akt. Zustand + #sStateText := 'Check Correct Bt'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xMTRORdy := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + + IF #stActRequest.nDirection = 1 THEN + IF #fbSeparator1.stOutMainTro.xNullBtPresent AND #stActRequest.nActReqIndex <> 201 THEN + #arReq[#stActRequest.nActArrIndex].xNullBT := TRUE; + #arReq[#stActRequest.nActArrIndex].xError := TRUE; + #tmpReasonForStop := "Rsn_NullBt"; // Warten auf MFR-Befehl wegen unerwartetem NullBt (MFR kann z.B. Auftrag abbrechen) + ELSIF + #fbSeparator1.stOutMainTro.xNullBtPresent AND #stActRequest.nActReqIndex = 201 THEN + #arReq[#stActRequest.nActArrIndex].xNullBT := TRUE; + #arReq[#stActRequest.nActArrIndex].xError := FALSE; + ELSIF + NOT #fbSeparator1.stOutMainTro.xNullBtPresent AND #fbSeparator1.stOutMainTro.xBtPresent AND #stActRequest.nActReqIndex = 201 THEN + #arReq[#stActRequest.nActArrIndex].xNullBT := FALSE; + #arReq[#stActRequest.nActArrIndex].xError := TRUE; + END_IF; + //*************************** + IF (NOT #arReq[#stActRequest.nActArrIndex].xNullBT AND #fbSeparator1.stOutMainTro.xBtPresent AND #stActRequest.nActReqIndex <> 201) OR + (#arReq[#stActRequest.nActArrIndex].xNullBT AND #fbSeparator1.stOutMainTro.xBtPresent AND #stActRequest.nActReqIndex = 201) + THEN //BT korrekt und es geht weiter + #nState := "1SeStep_CheckJam"; + ELSIF (#fbStateManager.tOutTimeInStep > #stInSeparator1.Settings.tDelayToNextItem) AND (NOT #fbSeparator1.stOutMainTro.xBtPresent) THEN + #xBtEmpty := true; + END_IF; + ELSIF #stActRequest.nDirection <> 1 THEN + #tmpReasonForStop := "Rsn_GeneralError"; + END_IF; + + END_REGION + + "1SeStep_CheckJam": + REGION 2100: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + + IF #stActRequest.nDirection = 1 THEN + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) OR #stInSenJam2.xJam (* #stInSeparator1.Settings.xPluggedJam AND #fbSeparator1.stOutMainTro.xJamAtEntry *) THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nState := "1SeStep_CheckMotor"; + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; + END_IF; + + END_REGION + + "1SeStep_CheckMotor": + REGION 2150: Check Motor + //akt. Zustand + #sStateText := 'Check Motor'; + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Transition + IF NOT #xInCarouselRun AND #fbStateManager.tOutTimeInStep > T#4s THEN + #xErrorMotor := TRUE; + #tmpReasonForStop := "Rsn_CarouselError"; + ELSIF #xInCarouselRun THEN + #xErrorMotor := FALSE; + #nState := "1SeStep_CheckSep"; + END_IF; + + END_REGION *) + + #c1300_StepCheckLoad: + REGION 1300: Check Load + + // akt. Zustand + #sStateText := 'Check Load'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + + IF #fbStateManager.tOutTimeInStep > #stInSettings.tPartSenHigh THEN //Verzögern wegen Auswertung + IF #xTrolleyWithPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := TRUE; + #nState := #c1400_StepCheckSep1; // Weiter + ELSIF #xTrolleyWoPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := FALSE; + #nState := #c1400_StepCheckSep1; // Weiter + END_IF; + END_IF; + + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xHandshakeScan := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c1500_StepReleaseSep1; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c1500_StepReleaseSep1: + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + #xReleaseTrolleySep1 := (NOT #fbCarrierWait.xOutLockSep1 AND #xInCarouselRun AND #xInSftyOk) AND + (NOT #stInSettings.bSepType.%X0 OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND NOT #stInSettings.bSepType.%X1) OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND #stInSettings.bSepType.%X1 AND + ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart)))); // Erste Achse darf vereinzelt werden + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + #nState := #c2000_StepWaitForTrolley2; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xHandshakeScan := FALSE; + #xOutNewScan := FALSE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN // Wenn Pause an HMI gedrückt, dann warten + IF #fbSeparator1.stOutMainTro.xBtPresent AND //Separator meldet Belegung + #arInOutJamEntr1[1].bStatus.%X0 // Carrier ist online + AND ((#xInRelease AND NOT #stInSettings.bSepType.%X0) OR #stInSettings.bSepType.%X0) //Freigabe + THEN + IF #xReadSecondLeg // zweites Bein muss gelesen werden (TODO!!!!) + AND #stInSeparator1.Settings.xPluggedScanner // Scanner verbaut? + THEN + #nState := #c2100_StepScannerTrig2; // Nächster Schritt -> Scannen + ELSE + #nState := #c2300_StepCheckSep2; // Nächster Schritt -> Separator + END_IF; + END_IF; + END_IF; + END_REGION + + #c2100_StepScannerTrig2: + REGION 2100: Scanner Trigger 2 + + // akt. Zustand + #sStateText := 'Scanner Trigger 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN + #xStartScan := TRUE; + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN + #xStartScan := FALSE; + #nState := #c2200_StepScannerEval2; + END_IF; + END_REGION + + #c2200_StepScannerEval2: + REGION 2200: Scanner Evaluation 2 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + + IF NOT #xTemp THEN + ; + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + ELSE + #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + ; + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + END_IF; + + #xHandshakeScan := TRUE; + + ///////// Timer ////////// + + //////// Transition //////// + #nState := #c2300_StepCheckSep2; + + END_REGION + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c2400_StepCheckJam; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) //Zielstaubereich ist datentechnisch voll + OR (#stInSeparator1.Settings.xPluggedJam AND #stInSenJam2.xJam) // Stausensor + THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nState := #"c2500_StepReleaseSep2"; + END_IF; + + END_REGION + + #c2500_StepReleaseSep2: + REGION 2500: Release Sep Second + // akt. Zustand + #sStateText := 'Leave Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #stOutPriorityManager.xTransportReq := #xInSftyOk AND #xInCarouselRun (* AND NOT #stInMfr.xPause *) AND NOT #xInAreaStopActive; + + + #xReleaseTrolleySep1 := #xInSftyOk AND #xInCarouselRun (* AND NOT #stInMfr.xPause *) AND NOT #fbCarrierWait.xOutLockSep1 AND NOT #xInAreaStopActive AND #stInPriorityManager.xReleaseOk AND NOT #stInOutJamEntr1.Status.bByte.%X3; // Freigabe an Separator + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + IF NOT #stInSettings.bSepType.%X6 THEN //Nicht buchen, TEST!!! + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen 1 -> 2 + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit2); + END_REGION + #xEventLogRoute := TRUE; + END_IF; + #nState := #c1000_StepWaitForTrolley1; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + (* "1SeStep_WaitForConfirm": + REGION 2600: Wait for Confirm after Leaving - NIU + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + // #xRunCarousels := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" OR #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForFirstLeg" THEN + #arReq[#stActRequest.nActArrIndex].xSepRelease := TRUE; + #arReq[#stActRequest.nActArrIndex].xDone := TRUE; + #nState := "1SeStep_WaitForMfr"; + // #nState := "1SeStep_CheckReqFinished"; + END_IF; + + END_REGION *) + + END_CASE; + + END_REGION + + REGION Carr Accumulate + #fbCarrierWait.stInTimes.tFreeSen1 := #stInSeparator1.Settings.tSenFree; + #fbCarrierWait.stInTimes.tTimerWait := #stInSeparator1.Settings.tSenWait; + #fbCarrierWait(stInSensor1 := #stInSeparator1.stSenInSep, + xInConvActive := #xInCarouselRun); + END_REGION + + + REGION Beladekontrolle + //Beladekontrolle aktiviert + IF #stInSeparator1.Settings.xPluggedPart THEN + + //Trolley beladen + #xTrolleyWithPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor + AND #stInSeparator1.stSenPart.xDirectSensor + AND #stInSeparator1.stSenPart.tDirectChangeLast > #stInSettings.tPartSenHigh; + + //Trolley nicht beladen + #xTrolleyWoPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tInSenHigh AND + NOT #stInSeparator1.stSenPart.xDirectSensor; + + //Plausibel? + IF #stInSeparator1.Settings.xPluggedPart AND ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart)) + THEN + #wErrorWord.%X2 := TRUE; + ELSE + #wErrorWord.%X2 := FALSE; + END_IF; + ELSE + #xTrolleyWithPart := #xTrolleyWoPart := FALSE; // Beladekontrolle (Sensor) nicht verbaut + END_IF; + END_REGION + + REGION Dummy Handling + + #nArrayMax := DINT_TO_INT(UPPER_BOUND(ARR := #arInOutJamEntr1, DIM := 1)); + + REGION Dummy erstellen + IF #stInSettings.xIsBorner THEN + IF #nBarcodeEmpty > 1999 OR #nBarcodeEmpty < 1000 THEN + #nBarcodeEmpty := 1000; + ELSE + IF #nState = 2500 AND #fbSeparator1.xOutTrolleyReleasedEdge THEN + #nBarcodeEmpty += 1; + END_IF; + END_IF; + + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tDummyTimeBorner AND + #arInOutJamEntr1[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr1[1].nBarcode := #nBarcodeEmpty; + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nDestination := #stInSettings.nBornerDest; + END_IF; + ELSE + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutJamEntr1[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr1[1].nBarcode := #cCarrierDummy; + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #nArrayMax > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) //Dummy an erster Position + AND #arInOutJamEntr1[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND //keine Belegung + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutJamEntr1[2].nBarcode = 1 (* #stCarrierDummy *) OR #arInOutJamEntr1[2].nBarcode > 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutJamEntr1); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + REGION Monitoring + + REGION Carrier kommt nicht an / Daten ohne Belegung + #tOnMonCarrArrive(IN := #arInOutJamEntr1[1].bStatus.%X0 AND NOT #stInSeparator1.stSenInSep.xDirectSensor AND NOT #stInSeparator1.Settings.DoNotDeleteOnScanCorrection, + PT := #stInSeparator1.Settings.tDelayToNextItem, + Q => #wErrorWord.%X10); //TODO + + #fbMonitoringCarrNotArrive.stSettings.nErrorType := 1; + #fbMonitoringCarrNotArrive.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrNotArrive.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrNotArrive(wInTextListId_Function := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + wInTextListId_Message := 1000, + sInSuffix := '', + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X10, + sInAlarmMessage := 'Carrier kommt nicht am Separator an', + InOutMachineState:=#stInOutMachineState); + + END_REGION + + REGION Carrier ohne Daten + + IF #stInSeparator1.stSenInSep.xDbncdSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#5s AND NOT #arInOutJamEntr1[1].bStatus.%X0 THEN + #wErrorWord.%X5 := TRUE; + ELSE + #wErrorWord.%X5 := FALSE; + END_IF; + + #fbMonitoringCarrWoData.stSettings.nErrorType := 1; + #fbMonitoringCarrWoData.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrWoData.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrWoData(wInTextListId_Function := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + wInTextListId_Message := 1001, + sInSuffix := '', + InOutMachineState := #stInOutMachineState, + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X5, + sInAlarmMessage := 'Sep-Belegung ohne Daten'); + END_REGION + + END_REGION + + REGION Motorüberwachung + IF (#nState = #c1500_StepReleaseSep1 OR #nState = #c2500_StepReleaseSep2) AND #fbStateManager.tOutTimeInStep > T#4s AND NOT #xInCarouselRun THEN + #wErrorWord.%X1 := TRUE; + ELSE + #wErrorWord.%X1 := FALSE; + END_IF; + END_REGION + + REGION Timer - Überwachungszeit + #tOnSvReleaseSep(IN := (#nState = #c1500_StepReleaseSep1 OR #nState = #c2500_StepReleaseSep2) AND #xReleaseTrolleySep1, + PT := T#3s); + END_REGION + + REGION Haltegrund Schrittkette + #stActRequest.nReasonForStop := #tmpReasonForStop; //tmp aus Schrittkette übernehmen + END_REGION + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManager.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := #stInOutMachineState.xRunning, // AND #xInSftyOk, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nState); + + END_REGION + + REGION Aufruf der Sub-TROs + + REGION Separator 1 + + #fbSeparator1(xInReset:= #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInErrQuit := #stInOutHMI.UDT_Ctrl.xErrorQuit, + stInOutMainState := #stInOutMachineState, + stInSettings := #stInSeparator1.Settings, + xInConveyorRun := #xInCarouselRun, + stInTrolley := #stInSeparator1.stSenInSep, + xInReceiveReady := #xReleaseTrolleySep1, + stInOutHMI := #stInOutHMI.UDT_Separator1, + stInOutCarrDataInJam := #arInOutJamEntr1); + + #stInOutHMI.UDT_Separator1.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + #stInOutHMI.UDT_Separator2.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + + IF #nState >= 1000 AND #nState < 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := FALSE; //1.Bein + ELSIF #nState >= 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := TRUE; //2.Bein + END_IF; + + END_REGION + + REGION Barcode Reader 1 + #fbBarcodeReader1(stInSettings := #stInBarcodeReader.Settings, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInHWError := false, // todo + xInStartReading := #xStartScan, + xInHandshakeDone := #xHandshakeScan, + stInOutInterface := #stInOutCognexInterface, + stInOutControlUnitCabinet := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader1); + END_REGION + + END_REGION + + REGION HMI + #stInOutHMI.UDT_Config.nTroType := 1; //1Sep + + #stInOutHMI.UDT_State.nState := #nState; //Schrittkette + #stInOutHMI.UDT_State.sState := #sStateText; + + #stInOutHMI.UDT_State.xError := // Error TRO -> + #fbSeparator1.wOutErrorWord > 0 OR // Error Separator + #stInOutHMI.UDT_Separator1.stStatus.bStatus = 2 OR //Error Separator + #wErrorWord.%X5 OR //Belegung ohne Daten + #wErrorWord.%X10 OR // Carrier kommt nicht an + #stInOutHMI.UDT_BarcodeReader1.bStatus = 2 //Error Reader + ; + + END_REGION + + REGION Ausgänge schreiben + REGION Output + #xOutStopper1 := #fbSeparator1.xOutStopper; + #xOutJamAtEntry1 := #fbSeparator1.stOutMainTro.xJamAtEntry; + #xOutCarouselReq := ((#nState = #c1500_StepReleaseSep1) OR (#nState = #c2500_StepReleaseSep2)) AND NOT #stInOutHMI.UDT_Ctrl.xPause AND NOT #xInAreaStopActive AND (#xInRelease OR NOT #stInSettings.bSepType.%X0); //Release ist TEST!!! + #xOutCorrection := #xTmpCorrection; + END_REGION + + END_REGION + + REGION Event Logs + REGION Event: Route (Umbuchung) + #stBookingInfo.sJamSrc := #stInSettings.sJamSrc; + #stBookingInfo.sJamDest := #stInSettings.sJamDest; + #fbEventLog_Route(xInTrigger := #xEventLogRoute, + stInEventBookingInfo := #stBookingInfo); + END_REGION + END_REGION + + // Pro Event wird ein Aufruf benötigt + REGION Korrekturvorgänge loggen + + #fbEventLogCorrection1(xInTrigger := #arEventCorrectionInfo[0].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[0]); + + #fbEventLogCorrection2(xInTrigger := #arEventCorrectionInfo[1].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[1]); + + #fbEventLogCarrierUnknown(xInTrigger := #xUnknownCarrier, + stInEventScanInfo := #stEventUnknown); + + #fbEventLogCarrierNew(xInTrigger := #xNewCarrier, + stInEventScanInfo := #stEventNew); + + #fbEventLogGoodRead(xInTrigger := #xGoodRead, + stInEventScanInfo := #stEventGoodRead); + END_REGION + + REGION Letzten Schritt wegschreiben + #nOutStateLast := #fbStateManager.nStateLast; + END_REGION + + REGION Priority Manager + #stOutPriorityManager.nTroId := #nInMainTroNo; + #stOutPriorityManager.stJamExit := #stInOutJamExit2; + // #stOutPriorityManager.stJamEntry := ; todo + #stOutPriorityManager.stSensor := #stInSeparator1.stSenInSep; + #stOutPriorityManager.xMovement := #xInCarouselRun; + // #stOutPriorityManager.xTrolleyPresent := ; // todo für mengengesteuert + #stOutPriorityManager.xTransportReq := (* (#stActRequest.nDirection = 1) AND *) #nState = #c2500_StepReleaseSep2; + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.libinfo b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.libinfo new file mode 100644 index 0000000..94c0197 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: 2dfa028b-93e2-4db3-a2df-573dd5f5a859 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.32 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.libint b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.libint new file mode 100644 index 0000000..6843560 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.libint @@ -0,0 +1,51 @@ +DocumentHash: + - FileName: FB_ILS_MTRO_1Sep1Swi.scl + Hash: Br5ZHa/6Yd6pW6CiwiDx/Ju0wsXPfgZ5++n/Uy45Zrg= +LibraryMetaFileHash: ykUAEsyT2ZOfMgaTTZTQEsCCIlSuM6tCeDahIMzVlQg= +LibraryVersion: + Guid: 9b45df8c-7bb0-44b6-97db-967b2a2d5925 + DependsOn: + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: SettingsSwitch + VersionNumber: 2.0.0 + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: FB_ILS_STRO_Sep + VersionNumber: 2.0.8 + - TypeName: FB_ILS_STRO_Switch + VersionNumber: 2.0.3 + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_HMI_TRO + VersionNumber: 2.0.4 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: FB_BarcodeReaderCognex + VersionNumber: 2.0.4 + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: FC_Ean8_CheckDigit + VersionNumber: 2.0.0 + - TypeName: FC_Route + VersionNumber: 2.0.1 + - TypeName: FC_TSHR_Shift + VersionNumber: 2.0.1 diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.scl b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.scl new file mode 100644 index 0000000..85ba877 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep1Swi.scl @@ -0,0 +1,1361 @@ +FUNCTION_BLOCK "FB_ILS_MTRO_1Sep1Swi" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : Struct + nTroStopper1 : Int; + nTroSwitchExit2 : Int; + nTroSwitchExit3 : Int; + xCar2NecRight : Bool; // 2. Kreisel ist notwendig für Richtung rechts + xCar2NecLeft : Bool; // 2. Kreisel ist notwendig für Richtung links + xPrioDir1 : Bool; // Für diese Direction ist Prio Funktion relevant + xPrioDir2 : Bool; // Für diese Direction ist Prio Funktion relevant + bSepType : Byte := 16#0; // X0: TRUE - erstes Bein halten, X1: TRUE- Beladekontrolle, X2: TRUE - Beladeerfassung + tPartSenHigh : Time := T#500ms; + tInSenHigh : Time := T#500ms; + xIsBorner : Bool; // Hiermit werden Dummys mit Barcode 1000-2000 angelegt + nBornerDest : Int; // Standard Destination festlegen für Borner (variabel) + tDummyTimeNormal : Time := T#3s; // Zeit für Dummy anlegen (Dummy = 1) + tDummyTimeBorner : Time := T#0ms; // Zeit für Dummy anlegen (Dummy = 1000-2000) schneller... + END_STRUCT; + stInSeparator1 : Struct + stSenInSep : "UDT_Sensor"; // Sensor in Stopper + stSenSepLeft : "UDT_Sensor"; // Sensor nach Stopper + stSenPart : "UDT_Sensor"; // Checkt, ob der Bügelträger beladen ist + stSenStartScan : "UDT_Sensor"; // Sensor nach Stopper wenn Scanner vorhanden. Vermutlich startet dieser Sensor den Scanner + Settings : "SettingsSeparator"; + END_STRUCT; + stInSwitch1 : Struct + stSenExit3 : "UDT_Sensor"; + stSenExit4 : "UDT_Sensor"; + Settings : "SettingsSwitch"; + END_STRUCT; + stInBarcodeReader : Struct + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + stInPriorityManagerDir1 : "UDT_Response"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + stInPriorityManagerDir2 : "UDT_Response"; + stInSenJam2 : "UDT_Sensor"; // Stausensor Exit 2 + stInSenJam3 : "UDT_Sensor"; // Stausensor Exit 3 + nInMainTroNo : UInt; + xInSftyOk : Bool; + xInAllRdyToStart : Bool; + xInJamAtExit2 : Bool; // NIU Stau Exit 2 + xInJamAtExit3 : Bool; // NIU Stau Exit 3 + xInCarouselRun1 : Bool; // Rückmeldesignal von Carousel1: Motor läuft + xInCarouselRun2 : Bool; // Rückmeldesignal von Carousel2: Motor läuft + xInTestMode : Bool; + xInCancel : Bool; + xInAreaStopActive : Bool; // Bereichshalt + xInRelease : Bool; // Freigabe/Anforderung + nInDirection : USInt; + END_VAR + + VAR_OUTPUT + xOutStopper1 : Bool; + xOutSw1EntrTo1 : Bool; // Weiche auf Eingang 1 stellen + xOutSw1EntrTo2 : Bool; // Weiche auf Eingang 2 stellen + xOutSw1ExTo3 : Bool; // Weiche auf Ausgang 3 stellen + xOutSw1ExTo4 : Bool; // Weiche auf Ausgang 4 stellen + xOutJamAtEntry1 : Bool; + xOutCarouselReq1 : Bool; // Motor 1 anfordern + xOutCarouselReq2 : Bool; // Motor 2 anfordern + xOutCorrection : Bool; + nOutStateLast : Int; + stOutPriorityManagerDir1 : "UDT_Request"; + stOutPriorityManagerDir2 : "UDT_Request"; + xOutBookedDir1 : Bool; + xOutBookedDir2 : Bool; + stOutLastCarrier : "stCarrier"; + nOutScanResult : DInt; + xOutNewScan : Bool; + END_VAR + + VAR_IN_OUT + stInOutMachineState : "UDT_MainState"; + stInOutCognexInterface : "stCognexInterface"; + arInOutJamEntr1 : Array[*] of "stCarrier"; // Daten Staubereich Eingang 1 + stInOutJamEntr1 : "stJamData"; + arInOutJamExit2 : Array[*] of "stCarrier"; // Daten Staubereich Ausgang 2 + stInOutJamExit2 : "stJamData"; + arInOutJamExit3 : Array[*] of "stCarrier"; // Daten Staubereich Ausgang 3 + stInOutJamExit3 : "stJamData"; + stInOutHMI : "UDT_HMI_TRO"; + END_VAR + + VAR + fbStateManager : "FB_StateManager"; + fbSeparator1 : "FB_ILS_STRO_Sep"; + fbSwitch1 : "FB_ILS_STRO_Switch"; + fbBarcodeReader1 : "FB_BarcodeReaderCognex"; // Instanz Barcode-Reader + END_VAR + VAR RETAIN + stActRequest : Struct + xNBT : Bool; // Es handelt sich um einen Nullbügelträger + xCancelled : Bool; // Abbruchanforderung durch MFR + xDirectionChange : Bool; + nActReqIndex : USInt; // 0 = nichts zu tun | 1-200: Aktuell bearbeiteter Index + nActArrIndex : USInt; + nDirection : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A3 | 2: E1->A4 | 3: E2->A3 | 4: E2->A4 + nLastDirection : USInt; + nRequestedNoBT : USInt; // Anzahl Trolleys die ausgefahren werden sollen + nReasonForStop : USInt; // 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF + nActNoStopper : USInt; // Anzahl der Stopper-öffnungen in diesem Auftrag + nActNoInSwitch : USInt; // Anzahl BT die sich noch in Weiche befinden müssten + nActNoInSwitchLast : USInt; + xLongSignal : Bool; + END_STRUCT; + nState : Int; + END_VAR + VAR + sStateText : String["cStateText"]; // Aktueller State der Schrittkette (textuell) + END_VAR + VAR RETAIN + nSetSwitch1 : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A2 | 2: E1->A3 + xReleaseTrolleySep1 : Bool; // Öffne-Befehl + xErrorMotor : Bool; // Fehler weil Motor-Run fehlt + xMTRORdy : Bool; // MainTRO ist bereit für neue Aufträge (Signal an JobManager) + xWrongDirDetect : Bool; // Wrong Dir wurde erkannt + END_VAR + VAR + tOnSvReleaseSep {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Supervision - Freigabe Separator + xStartScan : Bool; + xHandshakeScan : Bool; + nBarcodeResult : DInt; + nBarcodeHelp : DInt; + sBarcodeString : String; + xCodeEven : Bool; + xTrolleyWithPart : Bool; + xTrolleyWoPart : Bool; + xReadSecondLeg : Bool; + wErrorWord : Word; + nLastDirection : USInt; + tOnSwitchDelay {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + stCarrierDummy { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : "stCarrier" := (1, (), 16#01); + nArrayMax : Int; + nBarcodeEmpty : Int := 0; + tOnMonCarrArrive {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Überwachungszeit zwischen Carrier Online & Separator Sensor Belegung + fbMonitoringCarrNotArrive : "FB_Monitoring"; + fbMonitoringCarrWoData : "FB_Monitoring"; + END_VAR + + VAR_TEMP + nIndex : USInt; + tmpActUnivTon : Bool; + tmpReqFinished : Bool; // Temp Signal für Switch + xBtEmpty : Bool; + xCarouselRun : Bool; + tmpReasonForStop : USInt; // Anhaltegrund in der Schrittkette | 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + stEmptyCarrier : "stCarrier"; + stBookingInfo : "stEventBookingInfo"; + arEmptyCarrier : Array[1..1] of "stCarrier"; // Platzhalter für CarrierArray + xGoodRead : Bool; + stEventGoodRead : "stEventScanInfo"; + arEventCorrectionInfo : Array[0..1] of "stEventCorrectionInfo"; + stEventNew : "stEventScanInfo"; + stEventUnknown : "stEventScanInfo"; + xTemp : Bool; + xNewCarrier : Bool; + xUnknownCarrier : Bool; + xTmpCorrection : Bool; + xStartSwitchDelay : Bool; + xBookedDir1 : Bool; + xBookedDir2 : Bool; + stTempCarrier : "stCarrier"; + tmpCarrierEmpty : "stCarrier"; + END_VAR + + VAR CONSTANT + "1SEP1SWITCH" : USInt := 3; + c0000_StepOff : Int := 0; // Schrittkette aus + c0100_StepUndefined : Int := 100; // Schrittkette undefiniert / Init + c1000_StepWaitForTrolley1 : Int := 1000; // Warte auf Trolley 1 + c1100_StepScannerTrig1 : Int := 1100; // Scanner Triggern + c1200_StepScannerEval1 : Int := 1200; // Scanergebnis auswerten + c1300_StepCheckLoad : Int := 1300; // Beladung prüfen + c1400_StepCheckSep1 : Int := 1400; // Separator checken + c1500_StepReleaseSep1 : Int := 1500; // Freigabe an Separator + c2000_StepWaitForTrolley2 : Int := 2000; // Warte auf Trolley 2 + c2100_StepScannerTrig2 : Int := 2100; // Scanner Triggern (nur wenn 1.Achse kein Ergebnis) + c2200_StepScannerEval2 : Int := 2200; // Scanergebnis auswerten (nur wenn 1.Achse kein Ergebnis) + c2250_StepCheckDir : Int := 2250; + c2300_StepCheckSep2 : Int := 2300; // Separator checken + c2350_StepCheckSwi : Int := 2350; + c2400_StepCheckJam : Int := 2400; // Stau überprüfen + c2500_StepReleaseSep2 : Int := 2500; // Freigabe an Separator + cCarrierDummy : Int := 1; + cCarrierUnknown : Int := 2; + END_VAR + + +BEGIN + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2025). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_MTRO_1Sep1Swi + Comment/Function: MainTRO-Function block for controlling TRO with 1x Sep and 1x Switch + Library/Family: "MainTRO" + Author: department: "Automatisierung" ; person in charge / contact: E.Yüksel, T. Molina, T.Schiller + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V20 + Restrictions: - + Requirements: (hardware, technological package, etc.) + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2022-12-15 | - | Yüksel, Molina | Header added on 15.12.2022 + 002.000.000 | 2025-02-11 | - | Yüksel | Adapt to ILS with Minitrolley, without external MFR + + *) + + REGION Zweiten Motor einbinden + IF #stInSettings.xCar2NecLeft AND + (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 3) THEN + #xCarouselRun := #xInCarouselRun1 AND #xInCarouselRun2; //Nach links wird 2. Motor gebraucht und aktuelle Richtung ist LINKS + ELSIF #stInSettings.xCar2NecLeft AND + (#stActRequest.nDirection = 2 OR #stActRequest.nDirection = 4) THEN + #xCarouselRun := #xInCarouselRun1; //Nach links wird 2. Motor gebraucht und aktuelle Richtung ist RECHTS + ELSIF #stInSettings.xCar2NecRight AND + (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 3) THEN + #xCarouselRun := #xInCarouselRun1; //Nach rechts wird 2. Motor gebraucht und aktuelle Richtung ist LINKS + ELSIF #stInSettings.xCar2NecRight AND + (#stActRequest.nDirection = 2 OR #stActRequest.nDirection = 4) THEN + #xCarouselRun := #xInCarouselRun1 AND #xInCarouselRun2; //Nach rechts wird 2. Motor gebraucht und aktuelle Richtung ist RECHTS + ELSE + #xCarouselRun := #xInCarouselRun1; //normal + END_IF; + END_REGION + + REGION Schrittkette + + CASE #nState OF + + #c0000_StepOff: + REGION 0000: Off + //akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #nSetSwitch1 := 0; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + + END_REGION + + #c0100_StepUndefined: + + REGION 0100: Undefined + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #nSetSwitch1 := 0; + #xMTRORdy := FALSE; + #xCodeEven := FALSE; + + ///////// Timer ////////// + + //////// Transition //////// + + #nState := #c1000_StepWaitForTrolley1; + + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + //akt. Zustand + #sStateText := 'Wait for Trolley'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + #xMTRORdy := TRUE; + #xOutNewScan := FALSE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN + IF #fbSeparator1.stOutMainTro.xBtPresent THEN //Separator meldet Belegung + IF #stInSeparator1.Settings.xPluggedScanner THEN //Scanner verbaut? + #nState := #c1100_StepScannerTrig1; //Nächster Schritt -> Scannen + ELSIF #arInOutJamEntr1[1].bStatus.%X0 THEN // Kein Scanner verbaut, aber Carrier online (z.B. Dummy wurde angelegt) + IF #stInSeparator1.Settings.xPluggedPart THEN + #nState := #c1300_StepCheckLoad; // Nächster Schritt -> Beladung prüfen + ELSE + #nState := #c1400_StepCheckSep1; //Nächster Schritt -> Separator chekcen + END_IF; + END_IF; + END_IF; + END_IF; + + END_REGION + + #c1100_StepScannerTrig1: + REGION 1100: Scanner Trigger 1 + + // akt. Zustand + #sStateText := 'Scanner Trigger 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN //Scanner bereit + #xStartScan := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScan := FALSE; + #nState := #c1200_StepScannerEval1; //Weiter + END_IF; + END_REGION + + #"c1200_StepScannerEval1": + REGION 1200: Scanner Evaluation 1 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic - TODO in eigenen FC packen?.. + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader übernehmen + + REGION Event log Good read + #xGoodRead := TRUE; // Trigger + #stEventGoodRead.nScanType := 4; + #stEventGoodRead.sBarcode := DELETE(IN := DINT_TO_STRING(#nBarcodeResult), L := 1, P := 1); + #stEventGoodRead.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + END_REGION + + REGION Gerade Zahl erkannt + IF (((#nBarcodeResult / 10) MOD 100) MOD 2 <> 1) THEN //anderes Ergebnis als 1 bedeutet, (xxxxxYYx) YY=gerade, also hinteres Bein von MiniTrolley + #xCodeEven := TRUE; //Bit sagt Separator dass hinteres Bein und nicht erstes zur Korrektur in Schrittkette + // #nBarcodeTarget := #nBarcodeTarget - 10; //Mache danach die gerade Zahl zur ungeraden UPDATE: WEGEN 8. ZIFFER KLAPPT DAS SO NICHT + #nBarcodeHelp := (#nBarcodeResult / 10) - 1; + + "FC_Ean8_CheckDigit"(sInDigits := DELETE(IN := DINT_TO_STRING(IN := #nBarcodeHelp), L := 1, P := 1), + sOutBarcode => #sBarcodeString, + nOutBarcode => #nBarcodeResult); + + // #sOutBarcode := #sBarcodeString; + END_IF; + END_REGION + + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + + #xTmpCorrection := TRUE; + // REGION Carr_Glob_Correction + + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation := #stInBarcodeReader.Settings.nStation, + // xOutNotFound => #xTemp, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation := #stInBarcodeReader.Settings.nStation, + // xOutNotFound => #xTemp, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + + REGION Event Log unknown Carrier + + #xUnknownCarrier := TRUE; // Trigger + #stEventUnknown.nScanType := 3; + #stEventUnknown.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + #stEventUnknown.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + #stEventUnknown.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation + 50), L := 1, P := 1); + + END_REGION + + END_IF; + + #xHandshakeScan := TRUE; + + #nOutScanResult := #nBarcodeResult; + #xOutNewScan := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + IF #stInSeparator1.Settings.xPluggedPart AND #stInSettings.bSepType.%X2 THEN + #nState := #c1300_StepCheckLoad; + ELSIF #xCodeEven THEN + #xCodeEven := FALSE; + #nState := #c2000_StepWaitForTrolley2; //Scanner bestätigt zweites Bein gelesen -> Korrigieren! + ELSE + #nState := #c1400_StepCheckSep1; + END_IF; + + END_REGION + + #c1300_StepCheckLoad: + REGION 1300: Check Load + + // akt. Zustand + #sStateText := 'Check Load'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + // #tmpActUnivTon := TRUE; + // IF (#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart) OR //Daten und physikalisch -> beladen Ok! + // (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart) //Daten und physikalisch -> unbeladen Ok! + // THEN + // #nState := #c1400_StepCheckSep1; // Weiter + // ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + // #tmpReasonForStop := 123; // TODO: Beladekontrolle Fehler + // END_IF; + // + IF #fbStateManager.tOutTimeInStep > #stInSettings.tPartSenHigh THEN //Verzögern wegen Auswertung + IF #xTrolleyWithPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := TRUE; + #nState := #c1400_StepCheckSep1; // Weiter + ELSIF #xTrolleyWoPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := FALSE; + #nState := #c1400_StepCheckSep1; // Weiter + END_IF; + END_IF; + + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xHandshakeScan := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c1500_StepReleaseSep1; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + + #c1500_StepReleaseSep1: + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + #xReleaseTrolleySep1 := (#xCarouselRun AND #xInSftyOk) AND + (NOT #stInSettings.bSepType.%X0 OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND NOT #stInSettings.bSepType.%X1) OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND #stInSettings.bSepType.%X1 AND + ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart)))); // Erste Achse darf vereinzelt werden + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + #nState := #c2000_StepWaitForTrolley2; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xHandshakeScan := FALSE; + #xOutNewScan := FALSE; + + //Korrektur 2.Bein kommt nicht + (* IF NOT #fbSeparator1.stOutMainTro.xBtPresent (* AND #xInCarouselRun *)AND NOT #stInSeparator1.Settings.xPluggedScanner AND #fbStateManager.tOutTimeInStep > T#3s THEN + #nState := #c1000_StepWaitForTrolley1; + END_IF; *) + + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN + IF #fbSeparator1.stOutMainTro.xBtPresent AND //Separator meldet Belegung + #arInOutJamEntr1[1].bStatus.%X0 // Carrier ist online + AND ((#xInRelease AND NOT #stInSettings.bSepType.%X0) OR #stInSettings.bSepType.%X0)//Freigabe + THEN + IF #xReadSecondLeg // zweites Bein muss gelesen werden (TODO!!!!) + AND #stInSeparator1.Settings.xPluggedScanner // Scanner verbaut? + THEN + #nState := #c2100_StepScannerTrig2; // Nächster Schritt -> Scannen + ELSE + #nState := 2225;//#c2250_StepCheckDir; // Nächster Schritt -> Check Direction + END_IF; + END_IF; + END_IF; + END_REGION + + #c2100_StepScannerTrig2: + REGION 2100: Scanner Trigger 2 + + // akt. Zustand + #sStateText := 'Scanner Trigger 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN + #xStartScan := TRUE; + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN + #xStartScan := FALSE; + #nState := #c2200_StepScannerEval2; + END_IF; + END_REGION + + #c2200_StepScannerEval2: + REGION 2200: Scanner Evaluation 2 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + + IF NOT #xTemp THEN + ; + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + ELSE + #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + ; + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + END_IF; + + #xHandshakeScan := TRUE; + + ///////// Timer ////////// + + //////// Transition //////// + #nState := 2225;//#c2250_StepCheckDir; + END_REGION ; + + 2225: + REGION 2225: Get Direction + // akt. Zustand + #sStateText := 'Get Dir'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + #stActRequest.nDirection := #nInDirection; + + IF #stActRequest.nDirection = 0 THEN + #tmpReasonForStop := "Rsn_MfrMistake"; + ELSE + #nState := #c2400_StepCheckJam;//#c2250_StepCheckDir; + END_IF; + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + // #nSetSwitch1 := #stActRequest.nDirection; + + ///////// Timer ////////// + //////// Transition //////// + CASE #stActRequest.nDirection OF + 1: //Ausgang 2 wird auf Stau geprüft + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) OR #stInSenJam2.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit3 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2250_StepCheckDir;//#c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + 2: //Ausgang 3 wird auf Stau geprüft + IF (#stInOutJamExit3.Status.nCount = #stInOutJamExit3.Config.nCapacitySet) OR #stInSenJam3.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit4 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2250_StepCheckDir;//#c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; // Allgemeiner Fehler falls Direction irgendetwas anderes ist als 1 oder 2 + #nState := 2225; // zurückgehen zu Get Direction + END_CASE; + + END_REGION + + + + + + #c2250_StepCheckDir: + REGION 2250: Check Direction + + // akt. Zustand + #sStateText := 'Check Dir'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + //Richtungswechsel muss noch berücksichtigt werden! + IF #nLastDirection <> #stActRequest.nDirection THEN // Richtungswechsel -> Warten + // #tmpActUnivTon := TRUE; + #xStartSwitchDelay := true; + IF #tOnSwitchDelay.Q THEN + #nSetSwitch1 := #stActRequest.nDirection; + #nLastDirection := #stActRequest.nDirection; + #nState := #c2300_StepCheckSep2; + END_IF; + ELSIF #nLastDirection = #nInDirection THEN // Gleiche Richtung -> Weiter + #nSetSwitch1 := #stActRequest.nDirection; + #nLastDirection := #stActRequest.nDirection; + #nState := #c2300_StepCheckSep2; + END_IF; + END_REGION + + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c2350_StepCheckSwi; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + + #c2350_StepCheckSwi: + REGION 2300: Check Switch + + //akt. Zustand + #sStateText := 'Check Switch'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + #nSetSwitch1 := #stActRequest.nDirection; + ///////// Timer ////////// + + //////// Transition //////// + + CASE #stActRequest.nDirection OF + 1: + IF NOT #fbSwitch1.stOutMainTro.xStatusIn AND + NOT #fbSwitch1.stOutMainTro.xStatusOut AND NOT #fbSwitch1.xOutPermSigOutSen3 THEN + #fbSwitch1.xInOutEnq := FALSE; + #nState := #c2500_StepReleaseSep2;//#c2400_StepCheckJam; + ELSE + #tmpReasonForStop := "Rsn_SubError"; // Fehler im SubTRO: Weiche + END_IF; + 2: + IF NOT #fbSwitch1.stOutMainTro.xStatusIn AND + #fbSwitch1.stOutMainTro.xStatusOut AND NOT #fbSwitch1.xOutPermSigOutSen4 THEN + #fbSwitch1.xInOutEnq := FALSE; + #nState := #c2500_StepReleaseSep2;//#c2400_StepCheckJam; + ELSE + #tmpReasonForStop := "Rsn_SubError"; // Fehler im SubTRO: Weiche + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; // Allgemeiner Fehler falls Direction irgendetwas anderes ist als 1 oder 2 + #nState := 2225; // zurückgehen zu Get Direction + END_CASE; + END_REGION + + (* #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #nSetSwitch1 := #stActRequest.nDirection; + + ///////// Timer ////////// + //////// Transition //////// + CASE #stActRequest.nDirection OF + 1: //Ausgang 2 wird auf Stau geprüft + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) OR #stInSenJam2.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit3 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + 2: //Ausgang 3 wird auf Stau geprüft + IF (#stInOutJamExit3.Status.nCount = #stInOutJamExit3.Config.nCapacitySet) OR #stInSenJam3.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit4 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; // Allgemeiner Fehler falls Direction irgendetwas anderes ist als 1 oder 2 + #nState := 2225; // zurückgehen zu Get Direction + END_CASE; + + END_REGION *) + + #c2500_StepReleaseSep2: + REGION 2500: Leave, Switch confirmed + + // aktueller Zustand + + #sStateText := 'Leave Separator'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + // Freigabe an Separator, wenn alle Bedingungen erfüllt + #xReleaseTrolleySep1 := #xInSftyOk AND + #xCarouselRun AND + NOT #xWrongDirDetect AND + NOT #stActRequest.xLongSignal AND + NOT #stInOutJamEntr1.Status.bByte.%X3 AND + + (#stInPriorityManagerDir1.xReleaseOk AND #stActRequest.nDirection = 1 AND #stInSettings.xPrioDir1) + OR (#stActRequest.nDirection = 1 AND NOT #stInSettings.xPrioDir1) + OR (#stInPriorityManagerDir2.xReleaseOk AND #stActRequest.nDirection = 2 AND #stInSettings.xPrioDir2) + OR (#stActRequest.nDirection = 2 AND NOT #stInSettings.xPrioDir2) + OR (NOT #stInSettings.xPrioDir1 AND NOT #stInSettings.xPrioDir2) AND + + (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 2); + + #nSetSwitch1 := #stActRequest.nDirection; + ///////// Timer ////////// + + // Reason for Stop + + // IF #stInMfr.xPause THEN + // #tmpReasonForStop := "Rsn_MfrPausedTro"; + // END_IF; + + IF NOT #xCarouselRun THEN + #tmpReasonForStop := "Rsn_CarouselError"; + END_IF; + + IF #xWrongDirDetect THEN + #tmpReasonForStop := "Rsn_WrongDirection"; + END_IF; + + IF #stActRequest.xLongSignal THEN + #tmpReasonForStop := "Rsn_LongSignalDetected"; + END_IF; + + //////// Transition //////// + + CASE #stActRequest.nDirection OF + 1, 2: + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN // Separator meldet erfolgreiches Vereinzeln + REGION NEU: Buchen 1->3 + IF #stActRequest.nDirection = 1 THEN + #stTempCarrier := #arInOutJamEntr1[1]; + + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit2); + #xBookedDir1 := TRUE; + END_IF; + END_REGION + + REGION NEU: Buchen 1->4 + IF #stActRequest.nDirection = 2 THEN + #stTempCarrier := #arInOutJamEntr1[1]; + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit3); + + #xBookedDir2 := TRUE; + END_IF; + END_REGION + + + + #nState := #c1000_StepWaitForTrolley1; // Nächster Schritt + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN // Überwachungszeit nach Freigabe an Separator abgelaufen + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im Separator: Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; // Allgemeiner Fehler + #nState := 2225; + END_CASE; + END_REGION + END_CASE; + + END_REGION + + REGION Beladekontrolle + //Beladekontrolle aktiviert + IF #stInSeparator1.Settings.xPluggedPart THEN + + //Trolley beladen + #xTrolleyWithPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor + AND #stInSeparator1.stSenPart.xDirectSensor + AND #stInSeparator1.stSenPart.tDirectChangeLast > #stInSettings.tPartSenHigh; + + //Trolley nicht beladen + #xTrolleyWoPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tInSenHigh AND + NOT #stInSeparator1.stSenPart.xDirectSensor; + + //Plausibel? + IF #stInSeparator1.Settings.xPluggedPart AND ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart)) + THEN + #wErrorWord.%X2 := TRUE; + ELSE + #wErrorWord.%X2 := FALSE; + END_IF; + ELSE + #xTrolleyWithPart := #xTrolleyWoPart := FALSE; // Beladekontrolle (Sensor) nicht verbaut + END_IF; + END_REGION + + REGION Dummy Handling + + #nArrayMax := DINT_TO_INT(UPPER_BOUND(ARR := #arInOutJamEntr1, DIM := 1)); + + REGION Dummy erstellen + IF #stInSettings.xIsBorner THEN + IF #nBarcodeEmpty > 1999 OR #nBarcodeEmpty < 1000 THEN + #nBarcodeEmpty := 1000; + ELSE + IF #nState = 2500 AND #fbSeparator1.xOutTrolleyReleasedEdge THEN + #nBarcodeEmpty += 1; + END_IF; + END_IF; + + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tDummyTimeBorner AND + #arInOutJamEntr1[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr1[1].nBarcode := #nBarcodeEmpty; + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nDestination := #stInSettings.nBornerDest; + END_IF; + ELSE + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tDummyTimeNormal AND //Unterscheidung bei Borner? + #arInOutJamEntr1[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr1[1].nBarcode := #cCarrierDummy; + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #nArrayMax > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) //Dummy an erster Position + AND #arInOutJamEntr1[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND //keine Belegung + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutJamEntr1[2].nBarcode = 1 (* #stCarrierDummy *) OR #arInOutJamEntr1[2].nBarcode > 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutJamEntr1); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + REGION Monitoring + + REGION Carrier kommt nicht an / Daten ohne Belegung + #tOnMonCarrArrive(IN := #arInOutJamEntr1[1].bStatus.%X0 AND NOT #stInSeparator1.stSenInSep.xDirectSensor, + PT := #stInSeparator1.Settings.tDelayToNextItem, + Q => #wErrorWord.%X10); //TODO + + #fbMonitoringCarrNotArrive.stSettings.nErrorType := 1; + #fbMonitoringCarrNotArrive.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrNotArrive.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrNotArrive(wInTextListId_Function := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + wInTextListId_Message := 1000, + sInSuffix := '', + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X10, + sInAlarmMessage := 'Carrier kommt nicht am Separator an', + InOutMachineState := #stInOutMachineState); + + END_REGION + + REGION Carrier ohne Daten + + IF #stInSeparator1.stSenInSep.xDbncdSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#5s AND NOT #arInOutJamEntr1[1].bStatus.%X0 THEN + #wErrorWord.%X5 := TRUE; + ELSE + #wErrorWord.%X5 := FALSE; + END_IF; + + #fbMonitoringCarrWoData.stSettings.nErrorType := 1; + #fbMonitoringCarrWoData.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrWoData.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrWoData(wInTextListId_Function := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + wInTextListId_Message := 1001, + sInSuffix := '', + InOutMachineState := #stInOutMachineState, + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X5, + sInAlarmMessage := 'Sep-Belegung ohne Daten'); + END_REGION + + END_REGION + + REGION Timer - Überwachungszeit + + #tOnSwitchDelay(IN:= #xStartSwitchDelay, + PT:= T#5s); + + #tOnSvReleaseSep(IN := ((#nState = #c1500_StepReleaseSep1) OR (#nState = #c2500_StepReleaseSep2)) AND #xReleaseTrolleySep1, + PT := T#3s); + + END_REGION + + REGION Haltegrund Schrittkette + + #stActRequest.nReasonForStop := #tmpReasonForStop; //tmp aus Schrittkette übernehmen + + END_REGION + + REGION Motorüberwachung + + IF (#nState >= #c1500_StepReleaseSep1) AND (#nState <= #c2500_StepReleaseSep2) AND #fbStateManager.tOutTimeInStep > T#4s AND NOT #xCarouselRun THEN + #xErrorMotor := TRUE; + ELSE + #xErrorMotor := FALSE; + END_IF; + + END_REGION + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManager.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := #stInOutMachineState.xRunning, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nState); + END_REGION + + REGION Aufruf der Sub-TROs + + REGION Separator 1 + #fbSeparator1(xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInErrQuit := #stInOutHMI.UDT_Ctrl.xErrorQuit, + stInOutMainState := #stInOutMachineState, + stInSettings := #stInSeparator1.Settings, + xInConveyorRun := #xCarouselRun, + stInTrolley := #stInSeparator1.stSenInSep, + xInReceiveReady := #xReleaseTrolleySep1, + stInOutHMI := #stInOutHMI.UDT_Separator1, + stInOutCarrDataInJam := #arInOutJamEntr1); + + #stInOutHMI.UDT_Separator1.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + #stInOutHMI.UDT_Separator2.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + + IF #nState >= 1000 AND #nState < 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := FALSE; //1.Bein + ELSIF #nState >= 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := TRUE; //2.Bein + END_IF; + + END_REGION + + REGION Switch 1 + #fbSwitch1(stInSettings := #stInSwitch1.Settings, + stInSenExit3 := #stInSwitch1.stSenExit3, + stInSenExit4 := #stInSwitch1.stSenExit4, + nInMainTroNo := #nInMainTroNo, + nInSetSwitch := #nSetSwitch1, + nInSwitchNo := 0, + xInErrorQuit := "cTodoFalse", + xInSftyOk := #xInSftyOk, + xInAllRdyToStart := #xInAllRdyToStart, + xInCarouselRun := #xCarouselRun, + xInCancel := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInReqFinished := #tmpReqFinished, + xOutSwEntrTo1 => #xOutSw1EntrTo1, + xOutSwEntrTo2 => #xOutSw1EntrTo2, + xOutSwExTo3 => #xOutSw1ExTo3, + xOutSwExTo4 => #xOutSw1ExTo4, + stInOutMachineState:= #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_Switch1); + END_REGION ; + + REGION Barcode Reader 1 + #fbBarcodeReader1(stInSettings := #stInBarcodeReader.Settings, + xInHWError := false, // todo + xInStartReading := #xStartScan, + xInHandshakeDone := #xHandshakeScan, + stInOutInterface := #stInOutCognexInterface, + stInOutControlUnitCabinet := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader1); + END_REGION + END_REGION + + REGION BT und NBT zählen + + #stActRequest.nActNoInSwitch := #fbSwitch1.stOutMainTro.nFifoElementCount; + + END_REGION + + REGION Long-Signale von Switch verarbeiten + + (* //Switch gibt LongSignal aus und hier wird es für MainTRO gemerkt + IF (#stActRequest.nDirection = 1 AND #fbSwitch1.stOutMainTro.xSen3Long) OR + (#stActRequest.nDirection = 2 AND #fbSwitch1.stOutMainTro.xSen4Long) THEN + #stActRequest.xLongSignal := TRUE; + ELSIF #fbSwitch1.stOutMainTro.xFifoEmpty THEN + #stActRequest.xLongSignal := FALSE; + END_IF; + + #tOnLongSignal(IN := #stActRequest.xLongSignal, //Extra Timer für Long-Signal um nach dieser Zeit einen einzelnen BT der noch im Switch ist zu quittieren + PT := #stInSwitch1.Settings.tSenWaitAfterLong); //"TimeLongSignalQuitMax" + + #fbSwitch1.xInDeqExternal := //Dequeue wird hier an Switch weitergegeben falls (nachdem Sep gesperrt wurde) nur noch ein einzelenr BT vermisst wird nach LongSignal + NOT #fbSwitch1.xOutBtLeftSwitchWrongDir AND + ((#nSetSwitch1 = 1 OR #nSetSwitch1 = 2 OR #nSetSwitch1 = 3 OR #nSetSwitch1 = 4) AND #stActRequest.xLongSignal AND #tOnLongSignal.Q AND #stActRequest.nActNoInSwitch = 1); + + + IF #stActRequest.xLongSignal AND #tOnLongSignal.Q AND #stActRequest.nActNoInSwitch > 1 THEN //Falls nach LongSignal mehrere BT vermisst werden, werden die entsprechenden FIFO-Indizes an MFR als Missing ausgegeben + #nIndex := 1; + WHILE #nIndex <= 6 DO + IF #fbSwitch1.arOutFifo[#nIndex] > 0 AND #fbSwitch1.arOutFifo[#nIndex] <= 6 THEN + #arReq[#nIndex].xMissingBT := TRUE; + ELSIF #fbSwitch1.arOutFifo[#nIndex] = 0 THEN + #arReq[#nIndex].xMissingBT := FALSE; + END_IF; + #nIndex += 1; + END_WHILE; + ELSE //Wenn FIFO leer z.B. wegen Cancel, dann verschwinden hier die Missing Bits + #arReq[1].xMissingBT := FALSE; + #arReq[2].xMissingBT := FALSE; + #arReq[3].xMissingBT := FALSE; + #arReq[4].xMissingBT := FALSE; + #arReq[5].xMissingBT := FALSE; + #arReq[6].xMissingBT := FALSE; + END_IF; *) + + END_REGION + + REGION WrongDirection Handling + + (* IF #fbSwitch1.xOutBtLeftSwitchWrongDir THEN + #xWrongDirDetect := TRUE; + ELSIF #fbSwitch1.stOutMainTro.xFifoEmpty OR #stActRequest.xCancelled THEN + #xWrongDirDetect := FALSE; + END_IF; + + IF #xWrongDirDetect THEN + #nIndex := 1; + WHILE #nIndex <= 6 DO + IF #fbSwitch1.arOutFifo[#nIndex] > 0 AND #fbSwitch1.arOutFifo[#nIndex] <= 6 THEN + #arReq[#fbSwitch1.arOutFifo[#nIndex]].xWrongDirection := TRUE; + ELSE + #nIndex += 1; + END_IF; + #nIndex += 1; + END_WHILE; + ELSE + #arReq[1].xWrongDirection := FALSE; + #arReq[2].xWrongDirection := FALSE; + #arReq[3].xWrongDirection := FALSE; + #arReq[4].xWrongDirection := FALSE; + #arReq[5].xWrongDirection := FALSE; + #arReq[6].xWrongDirection := FALSE; + END_IF; *) + + END_REGION + + REGION HMI + #stInOutHMI.UDT_Config.nTroType := 2; //1Sep + + #stInOutHMI.UDT_State.nState := #nState; + #stInOutHMI.UDT_State.sState := #sStateText; + + #stInOutHMI.UDT_State.xError := // Error TRO -> + #fbSeparator1.wOutErrorWord > 0 OR // Error Separator + #stInOutHMI.UDT_Separator1.stStatus.bStatus = 2 OR //Error Separator + #wErrorWord.%X5 OR //Belegung ohne Daten + #wErrorWord.%X10 OR // Carrier kommt nicht an + #stInOutHMI.UDT_BarcodeReader1.bStatus = 2; //Error Reader + //Switch... + END_REGION + + REGION Ausgänge schreiben + + REGION Output + #xOutCorrection := #xTmpCorrection; + #xOutBookedDir1 := #xBookedDir1; + #xOutBookedDir2 := #xBookedDir2; + #stOutLastCarrier := #stTempCarrier; + + #xOutStopper1 := #fbSeparator1.xOutStopper; + #xOutSw1EntrTo1 := #fbSwitch1.xOutSwEntrTo1; + #xOutSw1EntrTo2 := #fbSwitch1.xOutSwEntrTo2; + #xOutSw1ExTo3 := #fbSwitch1.xOutSwExTo3; + #xOutSw1ExTo4 := #fbSwitch1.#xOutSwExTo4; + #xOutJamAtEntry1 := #fbSeparator1.stOutMainTro.xJamAtEntry; + #xOutCarouselReq1 := (#nState >= #c1500_StepReleaseSep1) AND (#nState <= #c2500_StepReleaseSep2) AND NOT #stInOutHMI.UDT_Ctrl.xPause AND NOT #xInAreaStopActive; + #xOutCarouselReq2 := #xOutCarouselReq1 AND + ((#stInSettings.xCar2NecLeft AND (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 3)) OR + (#stInSettings.xCar2NecRight AND (#stActRequest.nDirection = 2 OR #stActRequest.nDirection = 4))); + END_REGION + + END_REGION + + REGION Letzten Schritt wegschreiben + #nOutStateLast := #fbStateManager.nStateLast; + END_REGION + + REGION Priority Manager + #stOutPriorityManagerDir1.nTroId := #nInMainTroNo; + #stOutPriorityManagerDir1.stJamExit := #stInOutJamExit2; + // #stOutPriorityManagerDir1.stJamEntry := ; todo + #stOutPriorityManagerDir1.stSensor := #stInSeparator1.stSenInSep; + #stOutPriorityManagerDir1.xMovement := #xInCarouselRun1 AND #xInCarouselRun2; + //#stOutPriorityManagerDir1.xTrolleyPresent := ; // todo für mengengesteuert + + #stOutPriorityManagerDir2.nTroId := #nInMainTroNo; + #stOutPriorityManagerDir2.stJamExit := #stInOutJamExit3; + // #stOutPriorityManagerDir2.stJamEntry := ; todo + #stOutPriorityManagerDir2.stSensor := #stInSeparator1.stSenInSep; + #stOutPriorityManagerDir2.xMovement := #xInCarouselRun1 AND #xInCarouselRun2; + //#stOutPriorityManagerDir2.xTrolleyPresent := ; // todo für mengengesteuert + + IF #stInSettings.xPrioDir1 THEN + #stOutPriorityManagerDir1.xTransportReq := (#stActRequest.nDirection = 1) AND #nState = #c2500_StepReleaseSep2; + END_IF; + + IF #stInSettings.xPrioDir2 THEN + #stOutPriorityManagerDir2.xTransportReq := (#stActRequest.nDirection = 2) AND #nState = #c2500_StepReleaseSep2; + END_IF; + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.libinfo b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.libinfo new file mode 100644 index 0000000..63f49f1 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: ee0a8e96-59fd-4b31-b321-6af5535f2d37 +LibraryVersion: + VersionNumber: 2.0.5 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.libint b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.libint new file mode 100644 index 0000000..5a74e8a --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.libint @@ -0,0 +1,47 @@ +DocumentHash: + - FileName: FB_ILS_MTRO_1Sep2Swi.scl + Hash: ezNcvr15nq3IymiSoglgFPBP7lCoI1RCxwhQHFwariI= +LibraryMetaFileHash: ZdidBrjxDChTe+r5p/+8cYV6xW2yCj/02uWN9ly3TwI= +LibraryVersion: + Guid: 49847e72-1709-4b34-a0c5-c734164c1f45 + DependsOn: + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: SettingsSwitch + VersionNumber: 2.0.0 + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: UDT_HMI_TRO + VersionNumber: 2.0.4 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: FB_ILS_STRO_Sep + VersionNumber: 2.0.8 + - TypeName: FB_ILS_STRO_Switch + VersionNumber: 2.0.3 + - TypeName: FB_BarcodeReaderCognex + VersionNumber: 2.0.4 + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: FC_Ean8_CheckDigit + VersionNumber: 2.0.0 + - TypeName: FC_Route + VersionNumber: 2.0.1 diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.scl b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.scl new file mode 100644 index 0000000..c19c467 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep2Swi.scl @@ -0,0 +1,1281 @@ +FUNCTION_BLOCK "FB_ILS_MTRO_1Sep2Swi" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : Struct + nTroStopper1 : Int; + nTroSwitchExit2 : Int; + nTroSwitchExit3 : Int; + xCar2NecRight : Bool; // 2. Kreisel ist notwendig für Richtung rechts + xCar2NecLeft : Bool; // 2. Kreisel ist notwendig für Richtung links + xPrioDir1 : Bool; // Für diese Direction ist Prio Funktion relevant + xPrioDir2 : Bool; // Für diese Direction ist Prio Funktion relevant + bSepType : Byte := 16#0; // X0: TRUE - erstes Bein halten, X1: TRUE- Beladekontrolle, X2: TRUE - Beladeerfassung + tPartSenHigh : Time := T#500ms; + tInSenHigh : Time := T#500ms; + xIsBorner : Bool; // Hiermit werden Dummys mit Barcode 1000-2000 angelegt + nBornerDest : Int; // Standard Destination festlegen für Borner (variabel) + tDummyTimeNormal : Time := T#3s; // Zeit für Dummy anlegen (Dummy = 1) + tDummyTimeBorner : Time := T#0ms; // Zeit für Dummy anlegen (Dummy = 1000-2000) schneller... + END_STRUCT; + stInSeparator1 : Struct + stSenInSep : "UDT_Sensor"; // Sensor in Stopper + stSenSepLeft : "UDT_Sensor"; // Sensor nach Stopper + stSenPart : "UDT_Sensor"; // Checkt, ob der Bügelträger beladen ist + stSenStartScan : "UDT_Sensor"; // Sensor nach Stopper wenn Scanner vorhanden. Vermutlich startet dieser Sensor den Scanner + Settings : "SettingsSeparator"; + END_STRUCT; + stInSwitch1 : Struct + stSenExit3 : "UDT_Sensor"; + stSenExit4 : "UDT_Sensor"; + Settings : "SettingsSwitch"; + END_STRUCT; + stInSwitch2 : Struct + stSenExit3 : "UDT_Sensor"; + stSenExit4 : "UDT_Sensor"; + Settings : "SettingsSwitch"; + END_STRUCT; + stInBarcodeReader : Struct + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + stInPriorityManager : "UDT_Response"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + stInSenJam2 : "UDT_Sensor"; // Stausensor Exit 2 + stInSenJam3 : "UDT_Sensor"; // Stausensor Exit 3 + stInSenJam4 : "UDT_Sensor"; + nInMainTroNo : UInt; + xInSftyOk : Bool; + xInAllRdyToStart : Bool; + xInJamAtExit2 : Bool; // NIU Stau Exit 2 + xInJamAtExit3 : Bool; // NIU Stau Exit 3 + xInCarouselRun1 : Bool; // Rückmeldesignal von Carousel1: Motor läuft + xInCarouselRun2 : Bool; // Rückmeldesignal von Carousel2: Motor läuft + xInTestMode : Bool; + xInCancel : Bool; + xInAreaStopActive : Bool; // Bereichshalt + xInRelease : Bool; // Freigabe/Anforderung + nInDirection : USInt; + END_VAR + + VAR_OUTPUT + xOutStopper1 : Bool; + xOutSw1EntrTo1 : Bool; // Weiche auf Eingang 1 stellen + xOutSw1EntrTo2 : Bool; // Weiche auf Eingang 2 stellen + xOutSw1ExTo3 : Bool; // Weiche auf Ausgang 3 stellen + xOutSw1ExTo4 : Bool; // Weiche auf Ausgang 4 stellen + xOutSw2EntrTo1 : Bool; // Weiche auf Eingang 1 stellen + xOutSw2EntrTo2 : Bool; // Weiche auf Eingang 2 stellen + xOutSw2ExTo3 : Bool; // Weiche auf Ausgang 3 stellen + xOutSw2ExTo4 : Bool; // Weiche auf Ausgang 4 stellen + xOutJamAtEntry1 : Bool; + xOutCarouselReq1 : Bool; // Motor 1 anfordern + xOutCarouselReq2 : Bool; // Motor 2 anfordern + xOutCorrection : Bool; + nOutStateLast : Int; + stOutPriorityManager : "UDT_Request"; + nOutScanResult : DInt; + xOutNewScan : Bool; + END_VAR + + VAR_IN_OUT + stInOutMachineState : "UDT_MainState"; + stInOutCognexInterface : "stCognexInterface"; + arInOutJamEntr1 : Array[*] of "stCarrier"; // Daten Staubereich Eingang 1 + stInOutJamEntr1 : "stJamData"; + arInOutJamExit2 : Array[*] of "stCarrier"; // Daten Staubereich Ausgang 2 + stInOutJamExit2 : "stJamData"; + arInOutJamExit3 : Array[*] of "stCarrier"; // Daten Staubereich Ausgang 3 + stInOutJamExit3 : "stJamData"; + arInOutJamExit4 : Array[*] of "stCarrier"; // Daten Staubereich Ausgang 3 + stInOutJamExit4 : "stJamData"; + stInOutHMI : "UDT_HMI_TRO"; + END_VAR + + VAR + fbStateManager : "FB_StateManager"; + fbSeparator1 : "FB_ILS_STRO_Sep"; + fbSwitch1 : "FB_ILS_STRO_Switch"; + fbSwitch2 : "FB_ILS_STRO_Switch"; + fbBarcodeReader1 : "FB_BarcodeReaderCognex"; // Instanz Barcode-Reader + END_VAR + VAR RETAIN + stActRequest : Struct + xNBT : Bool; // Es handelt sich um einen Nullbügelträger + xCancelled : Bool; // Abbruchanforderung durch MFR + xDirectionChange : Bool; + nActReqIndex : USInt; // 0 = nichts zu tun | 1-200: Aktuell bearbeiteter Index + nActArrIndex : USInt; + nDirection : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A3 | 2: E1->A4 | 3: E2->A3 | 4: E2->A4 + nLastDirection : USInt; + nRequestedNoBT : USInt; // Anzahl Trolleys die ausgefahren werden sollen + nReasonForStop : USInt; // 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF + nActNoStopper : USInt; // Anzahl der Stopper-öffnungen in diesem Auftrag + nActNoInSwitch : USInt; // Anzahl BT die sich noch in Weiche befinden müssten + nActNoInSwitchLast : USInt; + xLongSignal : Bool; + END_STRUCT; + nState : Int; + END_VAR + VAR + sStateText : String["cStateText"]; // Aktueller State der Schrittkette (textuell) + END_VAR + VAR RETAIN + nSetSwitch1 : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A2 | 2: E1->A3 + END_VAR + VAR + nSetSwitch2 : USInt; + END_VAR + VAR RETAIN + xReleaseTrolleySep1 : Bool; // Öffne-Befehl + xErrorMotor : Bool; // Fehler weil Motor-Run fehlt + xMTRORdy : Bool; // MainTRO ist bereit für neue Aufträge (Signal an JobManager) + xWrongDirDetect : Bool; // Wrong Dir wurde erkannt + END_VAR + VAR + tOnSvReleaseSep {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Supervision - Freigabe Separator + xStartScan : Bool; + xHandshakeScan : Bool; + nBarcodeResult : DInt; + nBarcodeHelp : DInt; + sBarcodeString : String; + xCodeEven : Bool; + xTrolleyWithPart : Bool; + xTrolleyWoPart : Bool; + xReadSecondLeg : Bool; + wErrorWord : Word; + nLastDirection : USInt; + tOnSwitchDelay {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + END_VAR + + VAR_TEMP + nIndex : USInt; + tmpActUnivTon : Bool; + tmpReqFinished : Bool; // Temp Signal für Switch + xBtEmpty : Bool; + xCarouselRun : Bool; + tmpReasonForStop : USInt; // Anhaltegrund in der Schrittkette | 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + stEmptyCarrier : "stCarrier"; + stBookingInfo : "stEventBookingInfo"; + arEmptyCarrier : Array[1..1] of "stCarrier"; // Platzhalter für CarrierArray + xGoodRead : Bool; + stEventGoodRead : "stEventScanInfo"; + arEventCorrectionInfo : Array[0..1] of "stEventCorrectionInfo"; + stEventNew : "stEventScanInfo"; + stEventUnknown : "stEventScanInfo"; + xTemp : Bool; + xNewCarrier : Bool; + xUnknownCarrier : Bool; + xTmpCorrection : Bool; + xStartSwitchDelay : Bool; + END_VAR + + VAR CONSTANT + "1SEP1SWITCH" : USInt := 3; + c0000_StepOff : Int := 0; // Schrittkette aus + c0100_StepUndefined : Int := 100; // Schrittkette undefiniert / Init + c1000_StepWaitForTrolley1 : Int := 1000; // Warte auf Trolley 1 + c1100_StepScannerTrig1 : Int := 1100; // Scanner Triggern + c1200_StepScannerEval1 : Int := 1200; // Scanergebnis auswerten + c1300_StepCheckLoad : Int := 1300; // Beladung prüfen + c1400_StepCheckSep1 : Int := 1400; // Separator checken + c1500_StepReleaseSep1 : Int := 1500; // Freigabe an Separator + c2000_StepWaitForTrolley2 : Int := 2000; // Warte auf Trolley 2 + c2100_StepScannerTrig2 : Int := 2100; // Scanner Triggern (nur wenn 1.Achse kein Ergebnis) + c2200_StepScannerEval2 : Int := 2200; // Scanergebnis auswerten (nur wenn 1.Achse kein Ergebnis) + c2250_StepCheckDir : Int := 2250; + c2300_StepCheckSep2 : Int := 2300; // Separator checken + c2350_StepCheckSwi : Int := 2350; + c2400_StepCheckJam : Int := 2400; // Stau überprüfen + c2500_StepReleaseSep2 : Int := 2500; // Freigabe an Separator + cCarrierDummy : Int := 1; + cCarrierUnknown : Int := 2; + END_VAR + + +BEGIN + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2025). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_MTRO_1Sep1Swi + Comment/Function: MainTRO-Function block for controlling TRO with 1x Sep and 1x Switch + Library/Family: "MainTRO" + Author: department: "Automatisierung" ; person in charge / contact: E.Yüksel, T. Molina, T.Schiller + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V20 + Restrictions: - + Requirements: (hardware, technological package, etc.) + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2022-12-15 | - | Yüksel, Molina | Header added on 15.12.2022 + 002.000.000 | 2025-02-11 | - | Yüksel | Adapt to ILS with Minitrolley, without external MFR + + *) + + REGION Zweiten Motor einbinden + IF #stInSettings.xCar2NecLeft AND + (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 3) THEN + #xCarouselRun := #xInCarouselRun1 AND #xInCarouselRun2; //Nach links wird 2. Motor gebraucht und aktuelle Richtung ist LINKS + ELSIF #stInSettings.xCar2NecLeft AND + (#stActRequest.nDirection = 2 OR #stActRequest.nDirection = 4) THEN + #xCarouselRun := #xInCarouselRun1; //Nach links wird 2. Motor gebraucht und aktuelle Richtung ist RECHTS + ELSIF #stInSettings.xCar2NecRight AND + (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 3) THEN + #xCarouselRun := #xInCarouselRun1; //Nach rechts wird 2. Motor gebraucht und aktuelle Richtung ist LINKS + ELSIF #stInSettings.xCar2NecRight AND + (#stActRequest.nDirection = 2 OR #stActRequest.nDirection = 4) THEN + #xCarouselRun := #xInCarouselRun1 AND #xInCarouselRun2; //Nach rechts wird 2. Motor gebraucht und aktuelle Richtung ist RECHTS + ELSE + #xCarouselRun := #xInCarouselRun1; //normal + END_IF; + END_REGION + + REGION Schrittkette + + CASE #nState OF + + #c0000_StepOff: + REGION 0000: Off + //akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #nSetSwitch1 := 0; + #nSetSwitch2 := 0; + ///////// Timer ////////// + + //////// Transition //////// + + END_REGION + + #c0100_StepUndefined: + + REGION 0100: Undefined + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #nSetSwitch1 := 0; + #nSetSwitch2 := 0; + #xMTRORdy := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + + ///////// Timer ////////// + + //////// Transition //////// + + #nState := #c1000_StepWaitForTrolley1; + + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + //akt. Zustand + #sStateText := 'Wait for Trolley'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + #xMTRORdy := TRUE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN + IF #fbSeparator1.stOutMainTro.xBtPresent THEN //Separator meldet Belegung + IF #stInSeparator1.Settings.xPluggedScanner THEN //Scanner verbaut? + #nState := #c1100_StepScannerTrig1; //Nächster Schritt -> Scannen + ELSIF #arInOutJamEntr1[1].bStatus.%X0 THEN // Kein Scanner verbaut, aber Carrier online (z.B. Dummy wurde angelegt) + IF #stInSeparator1.Settings.xPluggedPart THEN + #nState := #c1300_StepCheckLoad; // Nächster Schritt -> Beladung prüfen + ELSE + #nState := #c1400_StepCheckSep1; //Nächster Schritt -> Separator chekcen + END_IF; + END_IF; + END_IF; + END_IF; + + END_REGION + + #c1100_StepScannerTrig1: + REGION 1100: Scanner Trigger 1 + + // akt. Zustand + #sStateText := 'Scanner Trigger 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN //Scanner bereit + #xStartScan := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScan := FALSE; + #nState := #c1200_StepScannerEval1; //Weiter + END_IF; + END_REGION + + #c1200_StepScannerEval1: + REGION 1200: Scanner Evaluation 1 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic - TODO in eigenen FC packen?.. + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader übernehmen + + REGION Event log Good read + #xGoodRead := TRUE; // Trigger + #stEventGoodRead.nScanType := 4; + #stEventGoodRead.sBarcode := DELETE(IN := DINT_TO_STRING(#nBarcodeResult), L := 1, P := 1); + #stEventGoodRead.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + END_REGION + + REGION Gerade Zahl erkannt + IF (((#nBarcodeResult / 10) MOD 100) MOD 2 <> 1) THEN //anderes Ergebnis als 1 bedeutet, (xxxxxYYx) YY=gerade, also hinteres Bein von MiniTrolley + #xCodeEven := TRUE; //Bit sagt Separator dass hinteres Bein und nicht erstes zur Korrektur in Schrittkette + // #nBarcodeTarget := #nBarcodeTarget - 10; //Mache danach die gerade Zahl zur ungeraden UPDATE: WEGEN 8. ZIFFER KLAPPT DAS SO NICHT + #nBarcodeHelp := (#nBarcodeResult / 10) - 1; + + "FC_Ean8_CheckDigit"(sInDigits := DELETE(IN := DINT_TO_STRING(IN := #nBarcodeHelp), L := 1, P := 1), + sOutBarcode => #sBarcodeString, + nOutBarcode => #nBarcodeResult); + + // #sOutBarcode := #sBarcodeString; + END_IF; + END_REGION + + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + + #xTmpCorrection := TRUE; + // REGION Carr_Glob_Correction + + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation := #stInBarcodeReader.Settings.nStation, + // xOutNotFound => #xTemp, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation := #stInBarcodeReader.Settings.nStation, + // xOutNotFound => #xTemp, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + + REGION Event Log unknown Carrier + + #xUnknownCarrier := TRUE; // Trigger + #stEventUnknown.nScanType := 3; + #stEventUnknown.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + #stEventUnknown.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + #stEventUnknown.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation + 50), L := 1, P := 1); + + END_REGION + + END_IF; + + #nOutScanResult := #nBarcodeResult; + #xOutNewScan := TRUE; + + #xHandshakeScan := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + IF #stInSeparator1.Settings.xPluggedPart AND #stInSettings.bSepType.%X2 THEN + #nState := #c1300_StepCheckLoad; + ELSIF #xCodeEven THEN + #xCodeEven := FALSE; + #nState := #c2000_StepWaitForTrolley2; //Scanner bestätigt zweites Bein gelesen -> Korrigieren! + ELSE + #nState := #c1400_StepCheckSep1; + END_IF;; + + END_REGION + + #c1300_StepCheckLoad: + REGION 1300: Check Load + + // akt. Zustand + #sStateText := 'Check Load'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + IF #fbStateManager.tOutTimeInStep > #stInSettings.tPartSenHigh THEN //Verzögern wegen Auswertung + IF #xTrolleyWithPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := TRUE; + #nState := #c1400_StepCheckSep1; // Weiter + ELSIF #xTrolleyWoPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := FALSE; + #nState := #c1400_StepCheckSep1; // Weiter + END_IF; + END_IF; + + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c1500_StepReleaseSep1; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + + #c1500_StepReleaseSep1: + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + // #xReleaseTrolleySep1 := #xCarouselRun AND #xInSftyOk; // Erste Achse darf vereinzelt werden + + #xReleaseTrolleySep1 := (#xCarouselRun AND #xInSftyOk) AND + (NOT #stInSettings.bSepType.%X0 OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND NOT #stInSettings.bSepType.%X1) OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND #stInSettings.bSepType.%X1 AND + ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart)))); // Erste Achse darf vereinzelt werden + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + #nState := #c2000_StepWaitForTrolley2; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + + + #xTrolleyWithPart := FALSE; + #xOutNewScan := FALSE; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + + //Korrektur 2.Bein kommt nicht + (* IF NOT #fbSeparator1.stOutMainTro.xBtPresent (* AND #xInCarouselRun *)AND NOT #stInSeparator1.Settings.xPluggedScanner AND #fbStateManager.tOutTimeInStep > T#3s THEN + #nState := #c1000_StepWaitForTrolley1; + END_IF; *) + + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN + IF #fbSeparator1.stOutMainTro.xBtPresent AND //Separator meldet Belegung + #arInOutJamEntr1[1].bStatus.%X0 // Carrier ist online + AND ((#xInRelease AND NOT #stInSettings.bSepType.%X0) OR #stInSettings.bSepType.%X0)//Freigabe + THEN + IF #xReadSecondLeg // zweites Bein muss gelesen werden (TODO!!!!) + AND #stInSeparator1.Settings.xPluggedScanner // Scanner verbaut? + THEN + #nState := #c2100_StepScannerTrig2; // Nächster Schritt -> Scannen + ELSE + #nState := 2225;//#c2250_StepCheckDir; // Nächster Schritt -> Check Direction + END_IF; + END_IF; + END_IF; + END_REGION + + #c2100_StepScannerTrig2: + REGION 2100: Scanner Trigger 2 + + // akt. Zustand + #sStateText := 'Scanner Trigger 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN + #xStartScan := TRUE; + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN + #xStartScan := FALSE; + #nState := #c2200_StepScannerEval2; + END_IF; + END_REGION + + #c2200_StepScannerEval2: + REGION 2200: Scanner Evaluation 2 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + + IF NOT #xTemp THEN + ; + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + ELSE + #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + ; + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + END_IF; + + #xHandshakeScan := TRUE; + + ///////// Timer ////////// + + //////// Transition //////// + #nState := 2225;//#c2250_StepCheckDir; + END_REGION ; + + 2225: + REGION 2225: Get Direction + // akt. Zustand + #sStateText := 'Get Dir'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + #stActRequest.nDirection := #nInDirection; + + IF #stActRequest.nDirection = 0 THEN + #tmpReasonForStop := "Rsn_MfrMistake"; + ELSE + #nState := #c2250_StepCheckDir; + END_IF; + END_REGION + + + + #c2250_StepCheckDir: + REGION 2250: Check Direction + + // akt. Zustand + #sStateText := 'Check Dir'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + //Richtungswechsel muss noch berücksichtigt werden! + IF #nLastDirection <> #stActRequest.nDirection THEN // Richtungswechsel -> Warten + // #tmpActUnivTon := TRUE; + #xStartSwitchDelay := true; + IF #tOnSwitchDelay.Q THEN + CASE #stActRequest.nDirection OF + 1: + #nSetSwitch1 := 1; + #nSetSwitch2 := 0; + 2: + #nSetSwitch1 := 2; + #nSetSwitch2 := 1; + 3: // + #nSetSwitch1 := 2; + #nSetSwitch2 := 2; + END_CASE; + #nLastDirection := #stActRequest.nDirection; + #nState := #c2300_StepCheckSep2; + END_IF; + ELSIF #nLastDirection = #nInDirection THEN // Gleiche Richtung -> Weiter + CASE #stActRequest.nDirection OF + 1: + #nSetSwitch1 := 1; + #nSetSwitch2 := 0; + 2: + #nSetSwitch1 := 2; + #nSetSwitch2 := 1; + 3: + #nSetSwitch1 := 2; + #nSetSwitch2 := 2; + END_CASE; + #nLastDirection := #stActRequest.nDirection; + #nState := #c2300_StepCheckSep2; + END_IF; + END_REGION + + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c2350_StepCheckSwi; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + + #c2350_StepCheckSwi: + REGION 2300: Check Switch + + //akt. Zustand + #sStateText := 'Check Switch'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + + //////// Transition //////// + + CASE #stActRequest.nDirection OF + 1: + IF NOT #fbSwitch1.stOutMainTro.xStatusIn AND + NOT #fbSwitch1.stOutMainTro.xStatusOut AND NOT #fbSwitch1.xOutPermSigOutSen3 THEN + #nState := #c2400_StepCheckJam; + ELSE + #tmpReasonForStop := "Rsn_SubError"; // Fehler im SubTRO: Weiche + END_IF; + 2: + IF NOT #fbSwitch1.stOutMainTro.xStatusIn AND + #fbSwitch1.stOutMainTro.xStatusOut AND + NOT #fbSwitch2.stOutMainTro.xStatusIn AND + NOT #fbSwitch2.stOutMainTro.xStatusOut + AND NOT #fbSwitch1.xOutPermSigOutSen4 + THEN + #nState := #c2400_StepCheckJam; + ELSE + #tmpReasonForStop := "Rsn_SubError"; // Fehler im SubTRO: Weiche + END_IF; + 3: + IF NOT #fbSwitch1.stOutMainTro.xStatusIn AND + #fbSwitch1.stOutMainTro.xStatusOut AND + NOT #fbSwitch2.stOutMainTro.xStatusIn AND + #fbSwitch2.stOutMainTro.xStatusOut + THEN + #nState := #c2400_StepCheckJam; + ELSE + #tmpReasonForStop := "Rsn_SubError"; // Fehler im SubTRO: Weiche + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; // Allgemeiner Fehler falls Direction irgendetwas anderes ist als 1 oder 2 + END_CASE; + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + CASE #stActRequest.nDirection OF + 1: //Ausgang 2 wird auf Stau geprüft + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) OR #stInSenJam2.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit3 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + 2: //Ausgang 3 wird auf Stau geprüft + IF (#stInOutJamExit3.Status.nCount = #stInOutJamExit3.Config.nCapacitySet) OR #stInSenJam3.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit4 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + 3: + IF (#stInOutJamExit4.Status.nCount = #stInOutJamExit4.Config.nCapacitySet) OR #stInSenJam4.xJam THEN //Stau vom nächsten MainTro wird gemeldet + #tmpReasonForStop := "Rsn_JamNextError"; + ELSIF #fbSwitch1.stOutMainTro.xJamAtExit4 THEN //Stau vom SubTro wird gemeldet + #tmpReasonForStop := "Rsn_SubError"; + ELSE + #nState := #c2500_StepReleaseSep2; //ohne Stau nächster Schritt + END_IF; + END_CASE; + + END_REGION + + #c2500_StepReleaseSep2: + REGION 2500: Leave, Switch confirmed + + // aktueller Zustand + + #sStateText := 'Leave Separator'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + // Freigabe an Separator, wenn alle Bedingungen erfüllt + #xReleaseTrolleySep1 := #xInSftyOk AND + #xCarouselRun AND + NOT #xWrongDirDetect AND + NOT #stActRequest.xLongSignal AND + NOT #stInOutJamEntr1.Status.bByte.%X3 AND + + (#stInPriorityManager.xReleaseOk AND #stActRequest.nDirection = 1 AND #stInSettings.xPrioDir1) + OR (#stActRequest.nDirection = 1 AND NOT #stInSettings.xPrioDir1) + OR (#stInPriorityManager.xReleaseOk AND #stActRequest.nDirection = 2 AND #stInSettings.xPrioDir2) + OR (#stActRequest.nDirection = 2 AND NOT #stInSettings.xPrioDir2) + OR (NOT #stInSettings.xPrioDir1 AND NOT #stInSettings.xPrioDir2) AND + + (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 2 OR #stActRequest.nDirection = 3); + + ///////// Timer ////////// + + // Reason for Stop + + // IF #stInMfr.xPause THEN + // #tmpReasonForStop := "Rsn_MfrPausedTro"; + // END_IF; + + IF NOT #xCarouselRun THEN + #tmpReasonForStop := "Rsn_CarouselError"; + END_IF; + + IF #xWrongDirDetect THEN + #tmpReasonForStop := "Rsn_WrongDirection"; + END_IF; + + IF #stActRequest.xLongSignal THEN + #tmpReasonForStop := "Rsn_LongSignalDetected"; + END_IF; + + //////// Transition //////// + + CASE #stActRequest.nDirection OF + 1, 2, 3: + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN // Separator meldet erfolgreiches Vereinzeln + REGION NEU: Buchen 1->2 + IF #stActRequest.nDirection = 1 THEN + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit2); + END_IF; + END_REGION + + REGION NEU: Buchen 1->3 + IF #stActRequest.nDirection = 2 THEN + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit3); + END_IF; + END_REGION + + REGION NEU: Buchen 1->4 + IF #stActRequest.nDirection = 3 THEN + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit4); + END_IF; + END_REGION + + + + #nState := #c1000_StepWaitForTrolley1; // Nächster Schritt + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN // Überwachungszeit nach Freigabe an Separator abgelaufen + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im Separator: Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; // Allgemeiner Fehler + END_CASE; + END_REGION + END_CASE; + + END_REGION + + REGION Beladekontrolle + //Beladekontrolle aktiviert + IF #stInSeparator1.Settings.xPluggedPart THEN + + //Trolley beladen + + // #xTrolleyWithPart := + // #stInSeparator1.Settings.xPluggedPart AND + // #stInSeparator1.stSenInSep.xDbncdSensor + // AND #stInSeparator1.stSenPart.xDirectSensor + // AND #stInSeparator1.stSenPart.tDirectChangeLast > #stInSettings.tPartSenHigh; + + IF #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor + AND #stInSeparator1.stSenPart.xDirectSensor + // AND #stInSeparator1.stSenPart.tDirectChangeLast > #stInSettings.tPartSenHigh + THEN + #xTrolleyWithPart := TRUE; + END_IF; + + //Trolley nicht beladen + #xTrolleyWoPart := + NOT #xTrolleyWithPart AND //NEU + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tInSenHigh AND + NOT #stInSeparator1.stSenPart.xDirectSensor; + + //Plausibel? + IF #stInSeparator1.Settings.xPluggedPart AND ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart)) + THEN + #wErrorWord.%X2 := TRUE; + ELSE + #wErrorWord.%X2 := FALSE; + END_IF; + ELSE + #xTrolleyWithPart := #xTrolleyWoPart := FALSE; // Beladekontrolle (Sensor) nicht verbaut + END_IF; + END_REGION + + REGION Timer - Überwachungszeit + + #tOnSwitchDelay(IN := #xStartSwitchDelay, + PT := T#5s); + + #tOnSvReleaseSep(IN := ((#nState = #c1500_StepReleaseSep1) OR (#nState = #c2500_StepReleaseSep2)) AND #xReleaseTrolleySep1, + PT := T#3s); + + END_REGION + + REGION Haltegrund Schrittkette + + #stActRequest.nReasonForStop := #tmpReasonForStop; //tmp aus Schrittkette übernehmen + + END_REGION + + REGION Motorüberwachung + + IF (#nState >= #c1500_StepReleaseSep1) AND (#nState <= #c2500_StepReleaseSep2) AND #fbStateManager.tOutTimeInStep > T#4s AND NOT #xCarouselRun THEN + #xErrorMotor := TRUE; + ELSE + #xErrorMotor := FALSE; + END_IF; + + END_REGION + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManager.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := #stInOutMachineState.xRunning, + xInReset := (* #stInMfr.xCancel OR *)#xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nState); + END_REGION + + REGION Aufruf der Sub-TROs + + REGION Separator 1 + #fbSeparator1(xInReset := #xInCancel, + stInOutMainState := #stInOutMachineState, + stInSettings := #stInSeparator1.Settings, + xInConveyorRun := #xCarouselRun, + stInTrolley := #stInSeparator1.stSenInSep, + xInReceiveReady := #xReleaseTrolleySep1, + stInOutHMI := #stInOutHMI.UDT_Separator1, + stInOutCarrDataInJam := #arInOutJamEntr1); + + #stInOutHMI.UDT_Separator1.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + #stInOutHMI.UDT_Separator2.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + + IF #nState >= 1000 AND #nState < 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := FALSE; //1.Bein + ELSIF #nState >= 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := TRUE; //2.Bein + END_IF; + + END_REGION + + REGION Switch 1 + #fbSwitch1(stInSettings := #stInSwitch1.Settings, + stInSenExit3 := #stInSwitch1.stSenExit3, + stInSenExit4 := #stInSwitch1.stSenExit4, + nInMainTroNo := #nInMainTroNo, + nInSetSwitch := #nSetSwitch1, + nInSwitchNo := 0, + xInErrorQuit := "cTodoFalse", + xInSftyOk := #xInSftyOk, + xInAllRdyToStart := #xInAllRdyToStart, + xInCarouselRun := #xCarouselRun, + xInCancel := (* #stInMfr.xCancel OR *)#xInCancel, + xInReqFinished := #tmpReqFinished, + xOutSwEntrTo1 => #xOutSw1EntrTo1, + xOutSwEntrTo2 => #xOutSw1EntrTo2, + xOutSwExTo3 => #xOutSw1ExTo3, + xOutSwExTo4 => #xOutSw1ExTo4, + stInOutMachineState := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_Switch1); + + END_REGION ; + + REGION Switch 2 + #fbSwitch2(stInSettings := #stInSwitch2.Settings, + stInSenExit3 := #stInSwitch2.stSenExit3, + stInSenExit4 := #stInSwitch2.stSenExit4, + nInMainTroNo := #nInMainTroNo, + nInSetSwitch := #nSetSwitch2, + nInSwitchNo := 0, + xInErrorQuit := "cTodoFalse", + xInSftyOk := #xInSftyOk, + xInAllRdyToStart := #xInAllRdyToStart, + xInCarouselRun := #xCarouselRun, + xInCancel := (* #stInMfr.xCancel OR *)#xInCancel, + xInReqFinished := #tmpReqFinished, + xOutSwEntrTo1 => #xOutSw2EntrTo1, + xOutSwEntrTo2 => #xOutSw2EntrTo2, + xOutSwExTo3 => #xOutSw2ExTo3, + xOutSwExTo4 => #xOutSw2ExTo4, + stInOutMachineState := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_Switch2); + + END_REGION ; + + REGION Barcode Reader 1 + #fbBarcodeReader1(stInSettings := #stInBarcodeReader.Settings, + xInHWError := false, // todo + xInStartReading := #xStartScan, + xInHandshakeDone := #xHandshakeScan, + stInOutInterface := #stInOutCognexInterface, + stInOutControlUnitCabinet := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader1); + END_REGION + END_REGION + + REGION BT und NBT zählen + + #stActRequest.nActNoInSwitch := #fbSwitch1.stOutMainTro.nFifoElementCount; + + END_REGION + + REGION Long-Signale von Switch verarbeiten + + (* //Switch gibt LongSignal aus und hier wird es für MainTRO gemerkt + IF (#stActRequest.nDirection = 1 AND #fbSwitch1.stOutMainTro.xSen3Long) OR + (#stActRequest.nDirection = 2 AND #fbSwitch1.stOutMainTro.xSen4Long) THEN + #stActRequest.xLongSignal := TRUE; + ELSIF #fbSwitch1.stOutMainTro.xFifoEmpty THEN + #stActRequest.xLongSignal := FALSE; + END_IF; + + #tOnLongSignal(IN := #stActRequest.xLongSignal, //Extra Timer für Long-Signal um nach dieser Zeit einen einzelnen BT der noch im Switch ist zu quittieren + PT := #stInSwitch1.Settings.tSenWaitAfterLong); //"TimeLongSignalQuitMax" + + #fbSwitch1.xInDeqExternal := //Dequeue wird hier an Switch weitergegeben falls (nachdem Sep gesperrt wurde) nur noch ein einzelenr BT vermisst wird nach LongSignal + NOT #fbSwitch1.xOutBtLeftSwitchWrongDir AND + ((#nSetSwitch1 = 1 OR #nSetSwitch1 = 2 OR #nSetSwitch1 = 3 OR #nSetSwitch1 = 4) AND #stActRequest.xLongSignal AND #tOnLongSignal.Q AND #stActRequest.nActNoInSwitch = 1); + + + IF #stActRequest.xLongSignal AND #tOnLongSignal.Q AND #stActRequest.nActNoInSwitch > 1 THEN //Falls nach LongSignal mehrere BT vermisst werden, werden die entsprechenden FIFO-Indizes an MFR als Missing ausgegeben + #nIndex := 1; + WHILE #nIndex <= 6 DO + IF #fbSwitch1.arOutFifo[#nIndex] > 0 AND #fbSwitch1.arOutFifo[#nIndex] <= 6 THEN + #arReq[#nIndex].xMissingBT := TRUE; + ELSIF #fbSwitch1.arOutFifo[#nIndex] = 0 THEN + #arReq[#nIndex].xMissingBT := FALSE; + END_IF; + #nIndex += 1; + END_WHILE; + ELSE //Wenn FIFO leer z.B. wegen Cancel, dann verschwinden hier die Missing Bits + #arReq[1].xMissingBT := FALSE; + #arReq[2].xMissingBT := FALSE; + #arReq[3].xMissingBT := FALSE; + #arReq[4].xMissingBT := FALSE; + #arReq[5].xMissingBT := FALSE; + #arReq[6].xMissingBT := FALSE; + END_IF; *) + + END_REGION + + REGION WrongDirection Handling + + (* IF #fbSwitch1.xOutBtLeftSwitchWrongDir THEN + #xWrongDirDetect := TRUE; + ELSIF #fbSwitch1.stOutMainTro.xFifoEmpty OR #stActRequest.xCancelled THEN + #xWrongDirDetect := FALSE; + END_IF; + + IF #xWrongDirDetect THEN + #nIndex := 1; + WHILE #nIndex <= 6 DO + IF #fbSwitch1.arOutFifo[#nIndex] > 0 AND #fbSwitch1.arOutFifo[#nIndex] <= 6 THEN + #arReq[#fbSwitch1.arOutFifo[#nIndex]].xWrongDirection := TRUE; + ELSE + #nIndex += 1; + END_IF; + #nIndex += 1; + END_WHILE; + ELSE + #arReq[1].xWrongDirection := FALSE; + #arReq[2].xWrongDirection := FALSE; + #arReq[3].xWrongDirection := FALSE; + #arReq[4].xWrongDirection := FALSE; + #arReq[5].xWrongDirection := FALSE; + #arReq[6].xWrongDirection := FALSE; + END_IF; *) + + END_REGION + + REGION HMI + #stInOutHMI.UDT_Config.nTroType := 3; //1Sep2Switch + + #stInOutHMI.UDT_State.nState := #nState; + #stInOutHMI.UDT_State.sState := #sStateText; + + #stInOutHMI.UDT_State.xError := // Error TRO -> + #fbSeparator1.wOutErrorWord > 0 OR // Error Separator + #stInOutHMI.UDT_Separator1.stStatus.bStatus = 2 OR //Error Separator + #wErrorWord.%X5 OR //Belegung ohne Daten + #wErrorWord.%X10 OR // Carrier kommt nicht an + #stInOutHMI.UDT_BarcodeReader1.bStatus = 2; //Error Reader + //Switch... + END_REGION + + REGION Ausgänge schreiben + + REGION Output + #xOutCorrection := #xTmpCorrection; + + //Separator + #xOutStopper1 := #fbSeparator1.xOutStopper; + //Switch1 + #xOutSw1EntrTo1 := #fbSwitch1.xOutSwEntrTo1; + #xOutSw1EntrTo2 := #fbSwitch1.xOutSwEntrTo2; + #xOutSw1ExTo3 := #fbSwitch1.xOutSwExTo3; + #xOutSw1ExTo4 := #fbSwitch1.#xOutSwExTo4; + //Switch2 + #xOutSw2EntrTo1 := #fbSwitch2.xOutSwEntrTo1; + #xOutSw2EntrTo2 := #fbSwitch2.xOutSwEntrTo2; + #xOutSw2ExTo3 := #fbSwitch2.xOutSwExTo3; + #xOutSw2ExTo4 := #fbSwitch2.#xOutSwExTo4; + + #xOutJamAtEntry1 := #fbSeparator1.stOutMainTro.xJamAtEntry; + #xOutCarouselReq1 := (#nState >= #c1500_StepReleaseSep1) AND (#nState <= #c2500_StepReleaseSep2) (* AND NOT #stInMfr.xPause *)AND NOT #xInAreaStopActive; + #xOutCarouselReq2 := #xOutCarouselReq1 AND + ((#stInSettings.xCar2NecLeft AND (#stActRequest.nDirection = 1 OR #stActRequest.nDirection = 3)) OR + (#stInSettings.xCar2NecRight AND (#stActRequest.nDirection = 2 OR #stActRequest.nDirection = 4))); + END_REGION + + END_REGION + + REGION Letzten Schritt wegschreiben + #nOutStateLast := #fbStateManager.nStateLast; + END_REGION + + REGION Priority Manager + #stOutPriorityManager.nTroId := #nInMainTroNo; + #stOutPriorityManager.stJamExit := #stInOutJamExit3; + // #stOutPriorityManager.stJamEntry := ; todo + #stOutPriorityManager.stSensor := #stInSeparator1.stSenInSep; + #stOutPriorityManager.xMovement := #xInCarouselRun1; // ?? + // #stOutPriorityManager.xTrolleyPresent := ; // todo für mengengesteuert + IF #stInSettings.xPrioDir1 THEN + #stOutPriorityManager.xTransportReq := (#stActRequest.nDirection = 1) AND #nState = #c2500_StepReleaseSep2; + ELSIF #stInSettings.xPrioDir2 THEN + #stOutPriorityManager.xTransportReq := (#stActRequest.nDirection = 2) AND #nState = #c2500_StepReleaseSep2; + END_IF; + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.libinfo b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.libinfo new file mode 100644 index 0000000..61fbe1c --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 63d716e2-f16e-400d-9ae2-7c900ae1baaa + Comment: + de-DE: Spezial TRO mit SSCC (im Test) +LibraryVersion: + VersionNumber: 0.0.8 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Spezial TRO mit SSCC diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.libint b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.libint new file mode 100644 index 0000000..630091d --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.libint @@ -0,0 +1,59 @@ +DocumentHash: + - FileName: FB_ILS_MTRO_1Sep_SSCC.scl + Hash: C2W6IrOSvJvrHD4EsDODFr8pfn5FCmXHKBGuoheWL0o= +LibraryMetaFileHash: SztRLFJMpsj0TCiK3yfu0MDP8gaYpmZAh9h+yuTHeD4= +LibraryVersion: + Guid: 184eacf8-1dc0-461f-b2c0-7c7695663004 + DependsOn: + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: FB_SetAlarmAndLog + VersionNumber: 2.0.1 + - TypeName: FB_ILS_STRO_Sep + VersionNumber: 2.0.8 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Booking + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: FB_BarcodeReaderCognex + VersionNumber: 2.0.4 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: UDT_HMI_TRO + VersionNumber: 2.0.4 + - TypeName: FB_EventLog_Correction + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Scan + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: FB_CarrAccumulate1Sep + VersionNumber: 2.0.0 + - TypeName: FB_SsccBarcodeReader + VersionNumber: 0.0.6 + - TypeName: FC_Route + VersionNumber: 2.0.1 + - TypeName: FC_TSHR_Shift + VersionNumber: 2.0.1 + - TypeName: FC_Ean8_CheckDigit + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.scl b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.scl new file mode 100644 index 0000000..7a39311 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_1Sep_SSCC.scl @@ -0,0 +1,1206 @@ +FUNCTION_BLOCK "FB_ILS_MTRO_1Sep_SSCC" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : Struct // Einstellungen MTRO + nTroStopper1 : Int; + xIsBorner : Bool; // Bei diesem TRO werden immer neue Carrier angelegt (z.B. erster TRO bei Einfahrt in Gesamtanlage) + sJamSrc : String[16]; + sJamDest : String[16]; + bSepType : Byte; // X0: TRUE - erstes Bein halten, X1: TRUE- Beladekontrolle, X2: TRUE - Beladeerfassung + tPartSenHigh : Time := T#500ms; + tInSenHigh : Time := T#500ms; + nBornerDest : Int; // Standard Destination festlegen für Borner (variabel) + tDummyTimeNormal : Time := T#3s; // Zeit für Dummy anlegen (Dummy = 1) + tDummyTimeBorner : Time := T#0ms; // Zeit für Dummy anlegen (Dummy = 1000-2000) schneller... + END_STRUCT; + stInSeparator1 : Struct // Separator Parameter + stSenInSep : "UDT_Sensor"; // Sensor in Stopper + stSenSepLeft : "UDT_Sensor"; // Sensor nach Stopper + stSenPart : "UDT_Sensor"; // Checkt, ob der Bügelträger beladen ist + stSenStartScan : "UDT_Sensor"; // Sensor nach Stopper wenn Scanner vorhanden. Vermutlich startet dieser Sensor den Scanner + Settings : "SettingsSeparator"; + END_STRUCT; + stInBarcodeReader : Struct + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + stInBarcodeReaderSSCC : Struct + stSenEndMeasurement : "UDT_Sensor"; + xInPluggedSSCC : Bool := true; + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + stInSenJam2 : "UDT_Sensor"; // Stausensor Exit 2 + stInPriorityManager : "UDT_Response"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + nInMainTroNo : UInt; // TRO-Nummer + xInSftyOk : Bool; // Safety ok + xInAllRdyToStart : Bool; // Alles bereit + xInCarouselRun : Bool; // Förderer aktiv + xInTestMode : Bool; // Testmodus aktivieren + xInCancel : Bool; // TRO komplett rücksetzen + xInAreaStopActive : Bool; // Bereichshalt + xInRelease : Bool; // Freigabe/Anforderung + END_VAR + + VAR_OUTPUT + xOutStopper1 : Bool; // Separator Stopper öffnen (TRUE = Auf, FALSE = Zu) + xOutJamAtEntry1 : Bool; // Stau + xOutCarouselReq : Bool; // Förderer anfordern + xOutCorrection : Bool; + stOutPriorityManager : "UDT_Request"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + nOutStateLast : Int; + nOutScanResult : DInt; + xOutNewScan : Bool; + nOutScanResultSSCC : LInt; + xOutNewScanSSCC : Bool; + xOutBookedDir1 : Bool; + stOutLastCarrier : "stCarrier"; + END_VAR + + VAR_IN_OUT + stInOutMachineState : "UDT_MainState"; // Maschinenzustand (Allgemien) + stInOutCognexInterface : "stCognexInterface"; // Cognex Barcode Reader Interface + stInOutCognexInterfaceSSCC : "stCognexInterface"; + arInOutJamEntr1 : Array[*] of "stCarrier"; // Daten Staubereich Eingang 1 + stInOutJamEntr1 : "stJamData"; // Konfig+Status-Daten Staubereich Eingang 1 + arInOutJamExit2 : Array[*] of "stCarrier"; // Carrier-Daten Staubereich Ausgang 1 + stInOutJamExit2 : "stJamData"; // Konfig+Status-Daten Staubereich Ausgang 1 + stInOutHMI : "UDT_HMI_TRO"; // HMI Schnittstelle + END_VAR + + VAR + fbBarcodeReader1 : "FB_BarcodeReaderCognex"; // Instanz Barcode-Reader + fbBarcodeReaderSSCC : "FB_SsccBarcodeReader"; // Teile lesen (z.B. SSCC) + fbSeparator1 : "FB_ILS_STRO_Sep"; // Intanz Separator + fbStateManager : "FB_StateManager"; // Schrittketten Manager + END_VAR + VAR RETAIN + stActRequest : Struct // Aktuelle Schrittkettendaten + xNBT : Bool; // Es handelt sich um einen Nullbügelträger + xCancelled : Bool; // Abbruchanforderung durch MFR + nActArrIndex : USInt; + nActReqIndex : USInt; // 0 = nichts zu tun | 1-200: Aktuell bearbeiteter Index + nDirection : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A2 + nRequestedNoBT : USInt; // Anzahl Trolleys die ausgefahren werden sollen + nReasonForStop : USInt; // 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + nActNoStopper : USInt; // Anzahl der Stopper-öffnungen in diesem Auftrag + nCntAtStartSep1 : UDInt; // Absoluter Zähler an Separator 1 bei Start des Auftrages + nCntAtStartExit2 : UDInt; // Absoluter Zähler an Exit 2 bei Start des Auftrages + END_STRUCT; + END_VAR + VAR + sStateText : String[100]; // Aktueller State der Schrittkette (textuell) + END_VAR + VAR RETAIN + nState : Int; // Schrittkette Schrittnummer + xReleaseTrolleySep1 : Bool; // Öffne-Befehl + xErrorMotor : Bool; // Fehler weil Motor-Run fehlt + xMTRORdy : Bool; + END_VAR + VAR + tOnSvReleaseSep {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Supervision - Freigabe Separator + tOnMonCarrArrive {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Überwachungszeit zwischen Carrier Online & Separator Sensor Belegung + xTransportAllowed : Bool; + fbSetAlarmAndLog : "FB_SetAlarmAndLog"; + xStartScan : Bool; + nBarcodeResult : DInt; + nBarcodeResultSSCC : LInt; + wErrorWord : Word; + fbMonitoringCarrNotArrive : "FB_Monitoring"; + fbMonitoringCarrWoData : "FB_Monitoring"; + nArrayMax : Int; + stCarrierDummy { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : "stCarrier" := (1, (), 16#01); + xTrolleyWithPart : Bool; + xTrolleyWoPart : Bool; + xHandshakeScan : Bool; + xReadSecondLeg : Bool; + fbEventLog_Route : "FB_EventLog_Booking"; + xCodeEven : Bool; + nBarcodeHelp : DInt; + sBarcodeString : String; + fbEventLogCorrection1 : "FB_EventLog_Correction"; + fbEventLogCorrection2 : "FB_EventLog_Correction"; + fbEventLogCarrierUnknown : "FB_EventLog_Scan"; + fbEventLogCarrierNew : "FB_EventLog_Scan"; + fbEventLogGoodRead : "FB_EventLog_Scan"; + fbCarrierWait : "FB_CarrAccumulate1Sep"; + nBarcodeEmpty : Int; + xStartScanSSCC : Bool; + xHandshakeScanSSCC : Bool; + END_VAR + + VAR_TEMP + xTemp : Bool; + nTempStopReasonInternal : Word; + nTempStopReasonExternal : Word; + nIndex : USInt; + tmpActUnivTon : Bool; + xBtEmpty : Bool; + tmpReasonForStop : USInt; // Anhaltegrund in der Schrittkette | 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + stEmptyCarrier : "stCarrier"; + stBookingInfo : "stEventBookingInfo"; + arEventCorrectionInfo : Array[0..1] of "stEventCorrectionInfo"; + arEmptyCarrier : Array[1..1] of "stCarrier"; // Platzhalter für CarrierArray + tmpCarrierEmpty : "stCarrier"; + xEventLogRoute : Bool; + stEventNew : "stEventScanInfo"; + stEventUnknown : "stEventScanInfo"; + xNewCarrier : Bool; + xGoodRead : Bool; + xTmpCorrection : Bool; + xUnknownCarrier : Bool; + stEventGoodRead : "stEventScanInfo"; + xBookedDir1 : Bool; + stTempCarrier : "stCarrier"; + END_VAR + + VAR CONSTANT + c0000_StepOff : Int := 0; // Schrittkette aus + c0100_StepUndefined : Int := 100; // Schrittkette undefiniert / Init + c1000_StepWaitForTrolley1 : Int := 1000; // Warte auf Trolley 1 + c1100_StepScannerTrig1 : Int := 1100; // Scanner Triggern + c1200_StepScannerEval1 : Int := 1200; // Scanergebnis auswerten + c1300_StepCheckLoad : Int := 1300; // Beladung prüfen + c1400_StepCheckSep1 : Int := 1400; // Separator checken + c1500_StepReleaseSep1 : Int := 1500; // Freigabe an Separator + c2000_StepWaitForTrolley2 : Int := 2000; // Warte auf Trolley 2 + c2100_StepScannerTrig2 : Int := 2100; // Scanner Triggern (nur wenn 1.Achse kein Ergebnis) + c2200_StepScannerEval2 : Int := 2200; // Scanergebnis auswerten (nur wenn 1.Achse kein Ergebnis) + c2300_StepCheckSep2 : Int := 2300; // Separator checken + c2400_StepCheckJam : Int := 2400; // Stau überprüfen + c2500_StepReleaseSep2 : Int := 2500; // Freigabe an Separator + cCarrierDummy : Int := 1; + cCarrierUnknown : Int := 2; + END_VAR + + +BEGIN + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2025). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_MTRO_1Sep + Comment/Function: MainTRO-Function block for controlling TRO with Separator + Scanner(optional) + Library/Family: "MainTRO" + Author: department: "Automatisierung" ; person in charge / contact: E.Yüksel, T. Molina, T.Schiller + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V20 + Restrictions: - + Requirements: (hardware, technological package, etc.) + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2022-12-13 | - | Yüksel, Molina | Header added on 13.12.2022 + 002.000.000 | 2025-02-11 | - | Yüksel | Adapt to ILS with Minitrolley, without external MFR + + *) + + (* -----> + Sep. 1 + Entrance 1 -----------|---------- Exit 2 + + *) + + (*Hierarchie + Logistik = Priorität Modul (Vorfahrt, Ampel, mengengesteuert, zeitgesteuert, deterministisch) + MainTRO = TRansportObject Modul (Koordinierung der Fördertechnik) + SubTRO = Fördertechnik Modul (Ausführen der Fördertechnik)*) + + REGION Schrittkette Transport + + CASE #nState OF + #c0000_StepOff: + REGION 0000: Off + // akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + // SCHRITT 0 WIRD GEBRAUCHT! + //STATE MANAGER KÜMMERT SICH UM TRANSITION! + END_REGION + + #c0100_StepUndefined: + REGION 0100: Undefined + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xMTRORdy := FALSE; + #xCodeEven := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #nState := #c1000_StepWaitForTrolley1; + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + //akt. Zustand + #sStateText := 'Wait for Trolley'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + #xMTRORdy := TRUE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN // Wenn Pause an HMI gedrückt, dann warten + IF #fbSeparator1.stOutMainTro.xBtPresent THEN //Separator meldet Belegung + IF #stInSeparator1.Settings.xPluggedScanner THEN //Scanner verbaut? + #nState := #c1100_StepScannerTrig1; //Nächster Schritt -> Scannen + ELSIF #arInOutJamEntr1[1].bStatus.%X0 THEN // Kein Scanner verbaut, aber Carrier online (z.B. Dummy wurde angelegt) + IF #stInSeparator1.Settings.xPluggedPart THEN + #nState := #c1300_StepCheckLoad; // Nächster Schritt -> Beladung prüfen + ELSE + #nState := #c1400_StepCheckSep1; //Nächster Schritt -> Separator chekcen + END_IF; + END_IF; + END_IF; + END_IF; + END_REGION + + #"c1100_StepScannerTrig1": + REGION 1100: Scanner Trigger 1 + + // akt. Zustand + #sStateText := 'Scanner Trigger 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN //Scanner bereit + #xStartScan := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScan := FALSE; + #nState := #c1200_StepScannerEval1; //Weiter + END_IF; + END_REGION + + #"c1200_StepScannerEval1": + REGION 1200: Scanner Evaluation 1 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic - TODO in eigenen FC packen?.. + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader übernehmen + + REGION Event log Good read + #xGoodRead := TRUE; // Trigger + #stEventGoodRead.nScanType := 4; + #stEventGoodRead.sBarcode := DELETE(IN := DINT_TO_STRING(#nBarcodeResult), L := 1, P := 1); + #stEventGoodRead.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + END_REGION + + REGION Gerade Zahl erkannt + IF (((#nBarcodeResult / 10) MOD 100) MOD 2 <> 1) THEN //anderes Ergebnis als 1 bedeutet, (xxxxxYYx) YY=gerade, also hinteres Bein von MiniTrolley + #xCodeEven := TRUE; //Bit sagt Separator dass hinteres Bein und nicht erstes zur Korrektur in Schrittkette + // #nBarcodeTarget := #nBarcodeTarget - 10; //Mache danach die gerade Zahl zur ungeraden UPDATE: WEGEN 8. ZIFFER KLAPPT DAS SO NICHT + #nBarcodeHelp := (#nBarcodeResult / 10) - 1; + + "FC_Ean8_CheckDigit"(sInDigits := DELETE(IN := DINT_TO_STRING(IN := #nBarcodeHelp), L := 1, P := 1), + sOutBarcode => #sBarcodeString, + nOutBarcode => #nBarcodeResult); + + // #sOutBarcode := #sBarcodeString; + END_IF; + END_REGION + + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:= #stInBarcodeReader.Settings.nStation, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION_INBOUND"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:= #stInBarcodeReader.Settings.nStation, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr1[1]); + // END_REGION + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + + REGION Event Log unknown Carrier + + #xUnknownCarrier := TRUE; // Trigger + #stEventUnknown.nScanType := 3; + #stEventUnknown.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr1[1].nBarcode), L := 1, P := 1); + #stEventUnknown.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr1[1].nDestination), L := 1, P := 1); + #stEventUnknown.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation + 50), L := 1, P := 1); + + END_REGION + + END_IF; + + #xHandshakeScan := TRUE; + + #nOutScanResult := #nBarcodeResult; + #xOutNewScan := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + IF #stInSeparator1.Settings.xPluggedPart AND #stInSettings.bSepType.%X2 THEN + #nState := #c1300_StepCheckLoad; + // #nState := #c1400_StepCheckSep1; + ELSIF #xCodeEven THEN + #xCodeEven := FALSE; + #nState := #c2000_StepWaitForTrolley2; //Scanner bestätigt zweites Bein gelesen -> Korrigieren! + ELSE + #nState := #c1400_StepCheckSep1; + END_IF; + + END_REGION + (* + "1SeStep_CheckCorrectBt": + REGION 2000: Check if correct BT inside + + // akt. Zustand + #sStateText := 'Check Correct Bt'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xMTRORdy := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + + IF #stActRequest.nDirection = 1 THEN + IF #fbSeparator1.stOutMainTro.xNullBtPresent AND #stActRequest.nActReqIndex <> 201 THEN + #arReq[#stActRequest.nActArrIndex].xNullBT := TRUE; + #arReq[#stActRequest.nActArrIndex].xError := TRUE; + #tmpReasonForStop := "Rsn_NullBt"; // Warten auf MFR-Befehl wegen unerwartetem NullBt (MFR kann z.B. Auftrag abbrechen) + ELSIF + #fbSeparator1.stOutMainTro.xNullBtPresent AND #stActRequest.nActReqIndex = 201 THEN + #arReq[#stActRequest.nActArrIndex].xNullBT := TRUE; + #arReq[#stActRequest.nActArrIndex].xError := FALSE; + ELSIF + NOT #fbSeparator1.stOutMainTro.xNullBtPresent AND #fbSeparator1.stOutMainTro.xBtPresent AND #stActRequest.nActReqIndex = 201 THEN + #arReq[#stActRequest.nActArrIndex].xNullBT := FALSE; + #arReq[#stActRequest.nActArrIndex].xError := TRUE; + END_IF; + //*************************** + IF (NOT #arReq[#stActRequest.nActArrIndex].xNullBT AND #fbSeparator1.stOutMainTro.xBtPresent AND #stActRequest.nActReqIndex <> 201) OR + (#arReq[#stActRequest.nActArrIndex].xNullBT AND #fbSeparator1.stOutMainTro.xBtPresent AND #stActRequest.nActReqIndex = 201) + THEN //BT korrekt und es geht weiter + #nState := "1SeStep_CheckJam"; + ELSIF (#fbStateManager.tOutTimeInStep > #stInSeparator1.Settings.tDelayToNextItem) AND (NOT #fbSeparator1.stOutMainTro.xBtPresent) THEN + #xBtEmpty := true; + END_IF; + ELSIF #stActRequest.nDirection <> 1 THEN + #tmpReasonForStop := "Rsn_GeneralError"; + END_IF; + + END_REGION + + "1SeStep_CheckJam": + REGION 2100: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + + IF #stActRequest.nDirection = 1 THEN + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) OR #stInSenJam2.xJam (* #stInSeparator1.Settings.xPluggedJam AND #fbSeparator1.stOutMainTro.xJamAtEntry *) THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nState := "1SeStep_CheckMotor"; + END_IF; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; + END_IF; + + END_REGION + + "1SeStep_CheckMotor": + REGION 2150: Check Motor + //akt. Zustand + #sStateText := 'Check Motor'; + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Transition + IF NOT #xInCarouselRun AND #fbStateManager.tOutTimeInStep > T#4s THEN + #xErrorMotor := TRUE; + #tmpReasonForStop := "Rsn_CarouselError"; + ELSIF #xInCarouselRun THEN + #xErrorMotor := FALSE; + #nState := "1SeStep_CheckSep"; + END_IF; + + END_REGION *) + + #c1300_StepCheckLoad: + REGION 1300: Check Load + + // akt. Zustand + #sStateText := 'Check Load'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + + IF #fbStateManager.tOutTimeInStep > #stInSettings.tPartSenHigh THEN //Verzögern wegen Auswertung + IF #xTrolleyWithPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := TRUE; + #nState := #c1400_StepCheckSep1; // Weiter + ELSIF #xTrolleyWoPart THEN + #arInOutJamEntr1[1].bStatus.%X1 := FALSE; + #nState := #c1400_StepCheckSep1; // Weiter + END_IF; + END_IF; + + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xHandshakeScan := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c1500_StepReleaseSep1; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c1500_StepReleaseSep1: + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + #xReleaseTrolleySep1 := (NOT #fbCarrierWait.xOutLockSep1 AND #xInCarouselRun AND #xInSftyOk) AND + (NOT #stInSettings.bSepType.%X0 OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND NOT #stInSettings.bSepType.%X1) OR + (#xInRelease AND #stInSettings.bSepType.%X0 AND #stInSettings.bSepType.%X1 AND + ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart)))); // Erste Achse darf vereinzelt werden + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + #nState := #c2000_StepWaitForTrolley2; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xHandshakeScan := FALSE; + #xOutNewScan := FALSE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN // Wenn Pause an HMI gedrückt, dann warten + IF #fbSeparator1.stOutMainTro.xBtPresent AND //Separator meldet Belegung + #arInOutJamEntr1[1].bStatus.%X0 // Carrier ist online + AND ((#xInRelease AND NOT #stInSettings.bSepType.%X0) OR #stInSettings.bSepType.%X0) //Freigabe + THEN + IF #xReadSecondLeg // zweites Bein muss gelesen werden (TODO!!!!) + AND #stInSeparator1.Settings.xPluggedScanner // Scanner verbaut? + THEN + #nState := #c2100_StepScannerTrig2; // Nächster Schritt -> Scannen + ELSIF #stInBarcodeReaderSSCC.xInPluggedSSCC THEN + #nState := 2260; // SSCC Scannen + ELSE + #nState := #c2300_StepCheckSep2; // Nächster Schritt -> Separator + END_IF; + END_IF; + END_IF; + END_REGION + + #c2100_StepScannerTrig2: + REGION 2100: Scanner Trigger 2 + + // akt. Zustand + #sStateText := 'Scanner Trigger 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN + #xStartScan := TRUE; + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN + #xStartScan := FALSE; + #nState := #c2200_StepScannerEval2; + END_IF; + END_REGION + + #c2200_StepScannerEval2: + REGION 2200: Scanner Evaluation 2 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr1[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr1[1].nBarcode = 0 OR #arInOutJamEntr1[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + + IF NOT #xTemp THEN + ; + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + ELSE + #arInOutJamEntr1[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + #arInOutJamEntr1[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr1[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr1[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr1[1].nBarcode <> 0 AND + #arInOutJamEntr1[1].nBarcode <> 1 THEN + ; + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr1[1].nDestination := 123; //todo + END_IF; + + #xHandshakeScan := TRUE; + + ///////// Timer ////////// + + //////// Transition //////// + #nState := #c2300_StepCheckSep2; + + END_REGION + + + 2260: + REGION 2260: Scanner Trigger SSCC + + // akt. Zustand + #sStateText := 'Scanner Trigger SSCC'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReaderSSCC.xOutReadyForNewScan THEN //Scanner bereit + #xStartScanSSCC := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReaderSSCC.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScanSSCC := FALSE; + #nState := 2270; //Weiter + END_IF; + END_REGION + + 2270: + REGION 2270: Scan SSCC Eval + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + #nBarcodeResultSSCC := #fbBarcodeReaderSSCC.#nOutBarcode; + + #xHandshakeScanSSCC := TRUE; + + #nOutScanResultSSCC := #nBarcodeResultSSCC; + #xOutNewScanSSCC := TRUE; + + // IF #stInBarcodeReaderSSCC.stSenEndMeasurement.xDirectSensor THEN + #nState := #c2300_StepCheckSep2; + // END_IF; + + END_REGION + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScanSSCC := FALSE; + #xOutNewScanSSCC := false; + + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c2400_StepCheckJam; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + + IF (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) //Zielstaubereich ist datentechnisch voll + OR (#stInSeparator1.Settings.xPluggedJam AND #stInSenJam2.xJam) // Stausensor + THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nState := #"c2500_StepReleaseSep2"; + END_IF; + + END_REGION + + #c2500_StepReleaseSep2: + REGION 2500: Release Sep Second + // akt. Zustand + #sStateText := 'Leave Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #stOutPriorityManager.xTransportReq := #xInSftyOk AND #xInCarouselRun (* AND NOT #stInMfr.xPause *) AND NOT #xInAreaStopActive; + + + #xReleaseTrolleySep1 := #xInSftyOk AND #xInCarouselRun (* AND NOT #stInMfr.xPause *) AND NOT #fbCarrierWait.xOutLockSep1 AND NOT #xInAreaStopActive AND #stInPriorityManager.xReleaseOk AND NOT #stInOutJamEntr1.Status.bByte.%X3; // Freigabe an Separator + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + #stTempCarrier := #arInOutJamEntr1[1]; + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen 1 -> 2 + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr1, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit2); + #xBookedDir1 := TRUE; + END_REGION + #xEventLogRoute := TRUE; + #nState := 2600;//#c1000_StepWaitForTrolley1; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + 2600: + #xReleaseTrolleySep1 := FALSE; + + IF #stInBarcodeReaderSSCC.stSenEndMeasurement.xDirectSensor THEN + #nState := #c1000_StepWaitForTrolley1; + END_IF; + + + (* "1SeStep_WaitForConfirm": + REGION 2600: Wait for Confirm after Leaving - NIU + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + // #xRunCarousels := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" OR #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForFirstLeg" THEN + #arReq[#stActRequest.nActArrIndex].xSepRelease := TRUE; + #arReq[#stActRequest.nActArrIndex].xDone := TRUE; + #nState := "1SeStep_WaitForMfr"; + // #nState := "1SeStep_CheckReqFinished"; + END_IF; + + END_REGION *) + + END_CASE; + + END_REGION + + REGION Carr Accumulate + #fbCarrierWait.stInTimes.tFreeSen1 := #stInSeparator1.Settings.tSenFree; + #fbCarrierWait.stInTimes.tTimerWait := #stInSeparator1.Settings.tSenWait; + #fbCarrierWait(stInSensor1 := #stInSeparator1.stSenInSep, + xInConvActive := #xInCarouselRun); + END_REGION + + + REGION Beladekontrolle + //Beladekontrolle aktiviert + IF #stInSeparator1.Settings.xPluggedPart THEN + + //Trolley beladen + #xTrolleyWithPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor + AND #stInSeparator1.stSenPart.xDirectSensor + AND #stInSeparator1.stSenPart.tDirectChangeLast > #stInSettings.tPartSenHigh; + + //Trolley nicht beladen + #xTrolleyWoPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tInSenHigh AND + NOT #stInSeparator1.stSenPart.xDirectSensor; + + //Plausibel? + IF #stInSeparator1.Settings.xPluggedPart AND ((#arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWoPart) OR + (NOT #arInOutJamEntr1[1].bStatus.%X1 AND #xTrolleyWithPart)) + THEN + #wErrorWord.%X2 := TRUE; + ELSE + #wErrorWord.%X2 := FALSE; + END_IF; + ELSE + #xTrolleyWithPart := #xTrolleyWoPart := FALSE; // Beladekontrolle (Sensor) nicht verbaut + END_IF; + END_REGION + + REGION Dummy Handling + + #nArrayMax := DINT_TO_INT(UPPER_BOUND(ARR := #arInOutJamEntr1, DIM := 1)); + + REGION Dummy erstellen + IF #stInSettings.xIsBorner THEN + IF #nBarcodeEmpty > 1999 OR #nBarcodeEmpty < 1000 THEN + #nBarcodeEmpty := 1000; + ELSE + IF #nState = 2500 AND #fbSeparator1.xOutTrolleyReleasedEdge THEN + #nBarcodeEmpty += 1; + END_IF; + END_IF; + + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tDummyTimeBorner AND + #arInOutJamEntr1[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr1[1].nBarcode := #nBarcodeEmpty; + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + #arInOutJamEntr1[1].nDestination := #stInSettings.nBornerDest; + END_IF; + ELSE + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutJamEntr1[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr1[1].nBarcode := #cCarrierDummy; + #arInOutJamEntr1[1].bStatus.%X0 := TRUE; + END_IF; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #nArrayMax > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) //Dummy an erster Position + AND #arInOutJamEntr1[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND //keine Belegung + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutJamEntr1[2].nBarcode = 1 (* #stCarrierDummy *) OR #arInOutJamEntr1[2].nBarcode > 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutJamEntr1); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutJamEntr1[1].nBarcode = 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr1[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + REGION Monitoring + + REGION Carrier kommt nicht an / Daten ohne Belegung + #tOnMonCarrArrive(IN := #arInOutJamEntr1[1].bStatus.%X0 AND NOT #stInSeparator1.stSenInSep.xDirectSensor, + PT := #stInSeparator1.Settings.tDelayToNextItem, + Q => #wErrorWord.%X10); //TODO + + #fbMonitoringCarrNotArrive.stSettings.nErrorType := 1; + #fbMonitoringCarrNotArrive.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrNotArrive.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrNotArrive(wInTextListId_Function := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + wInTextListId_Message := 1000, + sInSuffix := '', + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X10, + sInAlarmMessage := 'Carrier kommt nicht am Separator an', + InOutMachineState:=#stInOutMachineState); + + END_REGION + + REGION Carrier ohne Daten + + IF #stInSeparator1.stSenInSep.xDbncdSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#5s AND NOT #arInOutJamEntr1[1].bStatus.%X0 THEN + #wErrorWord.%X5 := TRUE; + ELSE + #wErrorWord.%X5 := FALSE; + END_IF; + + #fbMonitoringCarrWoData.stSettings.nErrorType := 1; + #fbMonitoringCarrWoData.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrWoData.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrWoData(wInTextListId_Function := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + wInTextListId_Message := 1001, + sInSuffix := '', + InOutMachineState := #stInOutMachineState, + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X5, + sInAlarmMessage := 'Sep-Belegung ohne Daten'); + END_REGION + + END_REGION + + REGION Motorüberwachung + IF (#nState = #c1500_StepReleaseSep1 OR #nState = #c2500_StepReleaseSep2) AND #fbStateManager.tOutTimeInStep > T#4s AND NOT #xInCarouselRun THEN + #wErrorWord.%X1 := TRUE; + ELSE + #wErrorWord.%X1 := FALSE; + END_IF; + END_REGION + + REGION Timer - Überwachungszeit + #tOnSvReleaseSep(IN := (#nState = #c1500_StepReleaseSep1 OR #nState = #c2500_StepReleaseSep2) AND #xReleaseTrolleySep1, + PT := T#3s); + END_REGION + + REGION Haltegrund Schrittkette + #stActRequest.nReasonForStop := #tmpReasonForStop; //tmp aus Schrittkette übernehmen + END_REGION + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManager.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := #stInOutMachineState.xRunning, // AND #xInSftyOk, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nState); + + END_REGION + + REGION Aufruf der Sub-TROs + + REGION Separator 1 + + #fbSeparator1(xInReset:= #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInErrQuit := #stInOutHMI.UDT_Ctrl.xErrorQuit, + stInOutMainState := #stInOutMachineState, + stInSettings := #stInSeparator1.Settings, + xInConveyorRun := #xInCarouselRun, + stInTrolley := #stInSeparator1.stSenInSep, + xInReceiveReady := #xReleaseTrolleySep1, + stInOutHMI := #stInOutHMI.UDT_Separator1, + stInOutCarrDataInJam := #arInOutJamEntr1); + + #stInOutHMI.UDT_Separator1.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + #stInOutHMI.UDT_Separator2.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + + IF #nState >= 1000 AND #nState < 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := FALSE; //1.Bein + ELSIF #nState >= 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := TRUE; //2.Bein + END_IF; + + END_REGION + + REGION Barcode Reader 1 + #fbBarcodeReader1(stInSettings := #stInBarcodeReader.Settings, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInHWError := false, // todo + xInStartReading := #xStartScan, + xInHandshakeDone := #xHandshakeScan, + stInOutInterface := #stInOutCognexInterface, + stInOutControlUnitCabinet := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader1); + END_REGION + + REGION Barcode Reader SSCC + #fbBarcodeReaderSSCC(stInSettings := #stInBarcodeReaderSSCC.Settings, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInCancel, + xInHWError := false, // todo + xInStartReading := #xStartScanSSCC, + xInHandshakeDone := #xHandshakeScanSSCC, + stInOutInterface := #stInOutCognexInterfaceSSCC, + stInOutControlUnitCabinet := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader2); + END_REGION + + END_REGION + + REGION HMI + #stInOutHMI.UDT_Config.nTroType := 1; //1Sep + + #stInOutHMI.UDT_State.nState := #nState; //Schrittkette + #stInOutHMI.UDT_State.sState := #sStateText; + + #stInOutHMI.UDT_State.xError := // Error TRO -> + #fbSeparator1.wOutErrorWord > 0 OR // Error Separator + #stInOutHMI.UDT_Separator1.stStatus.bStatus = 2 OR //Error Separator + #wErrorWord.%X5 OR //Belegung ohne Daten + #wErrorWord.%X10 OR // Carrier kommt nicht an + #stInOutHMI.UDT_BarcodeReader1.bStatus = 2 //Error Reader + ; + + END_REGION + + REGION Ausgänge schreiben + REGION Output + #xOutStopper1 := #fbSeparator1.xOutStopper; + #xOutJamAtEntry1 := #fbSeparator1.stOutMainTro.xJamAtEntry; + #xOutCarouselReq := (#nState = #c1500_StepReleaseSep1) OR (#nState = #c2500_StepReleaseSep2) AND NOT #stInOutHMI.UDT_Ctrl.xPause AND NOT #xInAreaStopActive; + #xOutCorrection := #xTmpCorrection; + + #xOutBookedDir1 := #xBookedDir1; + #stOutLastCarrier := #stTempCarrier; + END_REGION + + END_REGION + + REGION Event Logs + REGION Event: Route (Umbuchung) + #stBookingInfo.sJamSrc := #stInSettings.sJamSrc; + #stBookingInfo.sJamDest := #stInSettings.sJamDest; + #fbEventLog_Route(xInTrigger := #xEventLogRoute, + stInEventBookingInfo := #stBookingInfo); + END_REGION + END_REGION + + // Pro Event wird ein Aufruf benötigt + REGION Korrekturvorgänge loggen + + #fbEventLogCorrection1(xInTrigger := #arEventCorrectionInfo[0].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[0]); + + #fbEventLogCorrection2(xInTrigger := #arEventCorrectionInfo[1].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[1]); + + #fbEventLogCarrierUnknown(xInTrigger := #xUnknownCarrier, + stInEventScanInfo := #stEventUnknown); + + #fbEventLogCarrierNew(xInTrigger := #xNewCarrier, + stInEventScanInfo := #stEventNew); + + #fbEventLogGoodRead(xInTrigger := #xGoodRead, + stInEventScanInfo := #stEventGoodRead); + END_REGION + + REGION Letzten Schritt wegschreiben + #nOutStateLast := #fbStateManager.nStateLast; + END_REGION + + REGION Priority Manager + #stOutPriorityManager.nTroId := #nInMainTroNo; + #stOutPriorityManager.stJamExit := #stInOutJamExit2; + // #stOutPriorityManager.stJamEntry := ; todo + #stOutPriorityManager.stSensor := #stInSeparator1.stSenInSep; + #stOutPriorityManager.xMovement := #xInCarouselRun; + // #stOutPriorityManager.xTrolleyPresent := ; // todo für mengengesteuert + #stOutPriorityManager.xTransportReq := (* (#stActRequest.nDirection = 1) AND *) #nState = #c2500_StepReleaseSep2; + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.libinfo b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.libinfo new file mode 100644 index 0000000..8608c89 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: 20cde367-3b9c-47ac-a37d-81376520ad0c +LibraryVersion: + VersionNumber: 3.0.25 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Änderung bei UnloadStation (unterlagert) diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.libint b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.libint new file mode 100644 index 0000000..d33191b --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.libint @@ -0,0 +1,85 @@ +DocumentHash: + - FileName: FB_ILS_MTRO_PinStore_Auto.scl + Hash: /UCrEElUzeqrXW8RY8gEHrDLt4DMBYZprgOTZIkDYyk= +LibraryMetaFileHash: 30luMnC4OZLH2IAPu8Whn8fFX/PnYL4rZfsWCRHzXyM= +LibraryVersion: + Guid: 6d3f3d13-565a-4cd3-a766-c23713547842 + DependsOn: + - TypeName: UDT_HMI_TRO_PinStore + VersionNumber: 2.0.2 + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: UDT_UnloadingStation + VersionNumber: 0.0.6 + - TypeName: stConveyorStations + VersionNumber: 2.0.3 + - TypeName: FB_StationUnloadPin + VersionNumber: 2.0.6 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: stStorageLine + VersionNumber: 2.0.0 + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: FB_ILS_STRO_Sep + VersionNumber: 2.0.8 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: FB_BarcodeReaderCognex + VersionNumber: 2.0.4 + - TypeName: FB_EventLog_Booking + VersionNumber: 2.0.0 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: CarrierStatisticsStore + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: FB_SepPrio + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: FB_CarrAccumulate1Sep + VersionNumber: 2.0.0 + - TypeName: UDT_MFR_StoreTRO + VersionNumber: 2.0.2 + - TypeName: FB_PriorityManager + VersionNumber: 2.0.0 + - TypeName: UDT_PrioParameter + VersionNumber: 2.0.0 + - TypeName: UDT_MTRO_Prio + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Correction + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Scan + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stCarrierPin + VersionNumber: 2.0.0 + - TypeName: FC_TSHR_Shift + VersionNumber: 2.0.1 + - TypeName: FC_SHR_HangerAddPin + VersionNumber: 2.0.1 + - TypeName: FC_Route + VersionNumber: 2.0.1 + - TypeName: FC_Ean8_CheckDigit + VersionNumber: 2.0.0 + - TypeName: FC_TargetDecision + VersionNumber: 2.0.9 + - TypeName: FC_TSHR_AddAtEnd + VersionNumber: 2.0.0 + - TypeName: FC_SHR_CyclePin + VersionNumber: 2.0.0 + - TypeName: FC_SHR_CheckStationPin + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.scl b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.scl new file mode 100644 index 0000000..3a97a54 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_PinStore_Auto.scl @@ -0,0 +1,4666 @@ +FUNCTION_BLOCK "FB_ILS_MTRO_PinStore_Auto" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInEncoderParameter : Struct + nPosActDif : DInt; + nPosPitchPart : DInt; + END_STRUCT; + stInSeparatorPin : Struct // Separator Pin- Band | Lagerblock Eingang + stSenTrolley : "UDT_Sensor"; + stSettings : "SettingsSeparator"; + END_STRUCT; + arInSep : Array[1..21] of Struct + stSenTrolley : "UDT_Sensor"; + stSettings : "SettingsSeparator"; + END_STRUCT; + stInBarcodeReader : Struct // Scanner Einstellungen + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + arInJamSensor : Array[1..#cUnloadingStations] of "UDT_Sensor"; // Sensor Stau / Abwurf überprüfen + xInQuitLocal : Bool; // Fehler quittieren + stInStorageCarrStats : "CarrierStatisticsStore"; + xInConveyorRunIn : Bool; // Einlagerkreisel (Pin) + xInConveyorRunOut : Bool; // Auslagerkreisel + stInSensorReference : "UDT_Sensor"; + stInAddHangerSensor : "UDT_Sensor"; // Sensor, der Carrier in das SHR einfügt + stInSyncSensor1 : "UDT_Sensor"; // Syncsensor Pinband 1 + stInSyncSensor2 : "UDT_Sensor"; // Syncsensor Pinband 2 + stInSyncSensor3 : "UDT_Sensor"; // Syncsensor Pinband 3 + stInSyncSensor4 : "UDT_Sensor"; // Syncsensor Pinband 4 + stInSyncSensor5 : "UDT_Sensor"; // Syncsensor Pinband 5 + stInSettings : Struct + nDestGeneral : Int; + nConvStations : Int; + nStationsMax : Int; + nStorageThreshold : Int := 10; + nNoOfLines : USInt := 13; + nNoOfPositions : USInt := 90; + sJamSrc : String; + sJamDest : String; + END_STRUCT; + stInSenJam2 : "UDT_Sensor"; + xInTestMode : Bool; // Testmodus aktivieren + xInCancel : Bool; // TRO komplett rücksetzen + xInAreaStopActive : Bool; // Bereichshalt + xInRelease : Bool; // Freigabe/Anforderung + nInMainTroNo : UInt; // TRO-Nummer + xInSftyOk : Bool; // Safety ok + xInAllRdyToStart : Bool; // Alles bereit + stInPriorityManager : "UDT_Response"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + nInTestTarget : Int; + END_VAR + + VAR_OUTPUT + arOutSwitch : Array[1..#cUnloadingStations] of Bool; // Ausgänge Ausschleusselemente + arOutUnloadingError : Array[1..#cUnloadingStations] of Bool; + xOutUnloadingError : Bool; + arOutLineOverloaded : Array[1..#cUnloadingStations] of Bool; + xOutSeparatorPin : Bool; // Ausgang Separator Pin Ventil + arOutSeparatorStore : Array[1..#cUnloadingStations] of Bool; // Ausgänge Separator Lagerstrecken Ventil + xOutConvReqSort : Bool; // Einlagerkreisel anfordern + xOutConvReqExit : Bool; // Auslagerkreisel anfordern + stOutPriorityManager : "UDT_Request"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + xOutCorrection : Bool; + END_VAR + + VAR_IN_OUT + stInOutControlUnitCabinet : "UDT_MainState"; // Hauptzustandsmaschine + arInOutStorageLines : Array[*] of "stStorageLine"; // Daten Lagerlinien + arInOutJamEntr : Array[*] of "stCarrier"; // Jam vor Separator Pin (?) + stInOutJamEntr : "stJamData"; + arInOutJamExit : Array[*] of "stCarrier"; // Jam nach Linien-Separatoren + stInOutJamExit : "stJamData"; // Konfig+Status-Daten Staubereich Ausgang 1 + arInOutJamBypass : Array[*] of "stCarrier"; + stInOutJamBypass : "stJamData"; + stInOutHMI : "UDT_HMI_TRO_PinStore"; // HMI Schnittstelle Separator Lagerlinien + stCognexInterfacePin : "stCognexInterface"; // Schnittstelle Cognex Barcode Reader + stMFRStorageRemovalInterface : "UDT_MFR_StoreTRO"; + stConveyorStations : "stConveyorStations"; + END_VAR + + VAR + fbSeparatorPin : "FB_ILS_STRO_Sep"; // Aufruf Separator Pin + fbCarrierWaitSepPin : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore1 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore2 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore3 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore4 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore5 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore6 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore7 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore8 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore9 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore10 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore11 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore12 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore13 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore14 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore15 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore16 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore17 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore18 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore19 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore20 : "FB_CarrAccumulate1Sep"; + fbCarrierWaitStore21 : "FB_CarrAccumulate1Sep"; + arfbStationUnloadPin : Array[1..#cUnloadingStations] of "FB_StationUnloadPin"; // Aufruf Abwurfstationen + fbBarcodeReader1 : "FB_BarcodeReaderCognex"; + fbStateManagerE : "FB_StateManager"; // Schrittketten Manager + fbStateManagerA : "FB_StateManager"; + END_VAR + VAR RETAIN + xStartScan : Bool; + END_VAR + VAR + nBarcodeResult : DInt; + xHandshakeScan : Bool; + xReadSecondLeg : Bool; + END_VAR + VAR RETAIN + nTarget1 : USInt := 11; // Ziel vergeben Pinband + END_VAR + VAR + arfbSeparatorStorage : Array[1..#cUnloadingStations] of "FB_ILS_STRO_Sep"; // Aufruf Separatoren Lagerlinien + rTrigBypass {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; + nBarcodeBypass : DInt; + END_VAR + VAR RETAIN + nStateE : Int; + nStateA : Int; + END_VAR + VAR + xReleaseTrolleySep1 : Bool; + sStateText : String; + xMTRORdy : Bool; + stCarrierDummy { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : "stCarrier" := (1, (), 16#01); + xTrolleyWithPart : Bool; + xTrolleyWoPart : Bool; + tOnSvReleaseSep {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Supervision - Freigabe Separator + arConveyorEnable : Array[1..2] of Bool; + fbSepPrio : "FB_SepPrio"; + END_VAR + VAR RETAIN + nActLine : Int; + END_VAR + VAR + nLastLine : Int; + xCodeEven : Bool; + nBarcodeHelp : DInt; + sBarcodeString : String; + fbPrioManagerTest : "FB_PriorityManager"; // Eingefügt zum Testen + stPrioParam : "UDT_PrioParameter"; + stPrioSep1 : "UDT_MTRO_Prio"; + stPrioSep2 : "UDT_MTRO_Prio"; + fbEventLog_Route1 : "FB_EventLog_Booking"; + fbEventLog_Route2 : "FB_EventLog_Booking"; + fbEventLogCorrection1 : "FB_EventLog_Correction"; + fbEventLogCorrection2 : "FB_EventLog_Correction"; + fbEventLogCarrierUnknown : "FB_EventLog_Scan"; + fbEventLogCarrierNew : "FB_EventLog_Scan"; + fbEventLogGoodRead : "FB_EventLog_Scan"; + nArrayMax : Int; + arArrayMax : Array[1..21] of Int; + nTestStorageOut : Int := 1; + xStart : Bool; + xHand : Bool; + stDummyCarrier : "stCarrier" := (1, 0, 16#1); + xVersatz : Bool; + stActRequest : Struct + nMode : Int; + nActLine : Int; + nCountReq : Int; + nCountAct : Int; + END_STRUCT; + xBypassStat : Bool; + END_VAR + + VAR_TEMP + nIdx1 : Int; + arStartUnloading : Array[1..#cUnloadingStations] of Bool; + arStopUnloading : Array[1..#cUnloadingStations] of Bool; + stEmptyCarrier : "stCarrier"; + stCarrierPin : "stCarrierPin"; + stBookingInfo : "stEventBookingInfo"; + arEmptyCarrier : Array[1..1] of "stCarrier"; + arLineRelease : Array[1.."cNoLines"] of Bool; + nTargetHelp : Int; + nNoOfLines : Int; + nActNo : USInt; + xTemp : Bool; + tmpActUnivTon : Bool; + tmpReasonForStop : USInt; // Anhaltegrund in der Schrittkette | 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + nNoOfSameTarget1 : Int; + nIdx2 : Int; + arStoreCount1 : Array[1.."cNoLines"] of Int; + xFreeAhead1 : Bool; + xSepFree : Bool; + arEventCorrectionInfo : Array[0..1] of "stEventCorrectionInfo"; + xEventLogBookSHR : Bool; + xEventLogBookExit : Bool; + stEventNew : "stEventScanInfo"; + stEventUnknown : "stEventScanInfo"; + xNewCarrier : Bool; + xGoodRead : Bool; + xUnknownCarrier : Bool; + stEventGoodRead : "stEventScanInfo"; + tmpCarrierEmpty : "stCarrier"; + xTmpCorrection : Bool; + stDummyHmiUnloading : "UDT_HMI_UnloadingStation"; + xBypass : Bool; + nCounter : DInt; + xResult : Bool; + END_VAR + + VAR CONSTANT + c0000_StepOff : Int := 0; // Schrittkette aus + c0100_StepUndefined : Int := 100; // Schrittkette undefiniert / Init + c1000_StepWaitForTrolley1 : Int := 1000; // Warte auf Trolley 1 + c1100_StepScannerTrig1 : Int := 1100; // Scanner Triggern + c1200_StepScannerEval1 : Int := 1200; // Scanergebnis auswerten + c1300_StepCheckLoad : Int := 1300; // Beladung prüfen + c1400_StepCheckSep1 : Int := 1400; // Separator checken + c1500_StepReleaseSep1 : Int := 1500; // Freigabe an Separator + c2000_StepWaitForTrolley2 : Int := 2000; // Warte auf Trolley 2 + c2100_StepScannerTrig2 : Int := 2100; // Scanner Triggern (nur wenn 1.Achse kein Ergebnis) + c2200_StepScannerEval2 : Int := 2200; // Scanergebnis auswerten (nur wenn 1.Achse kein Ergebnis) + c2300_StepCheckSep2 : Int := 2300; // Separator checken + c2400_StepCheckJam : Int := 2400; // Stau überprüfen + c2500_StepReleaseSep2 : Int := 2500; // Freigabe an Separator + cUnloadingStations : Int := 22; + cCarrierDummy : Int := 1; + cCarrierUnknown : Int := 2; + END_VAR + + +BEGIN + (* IF "fbMain_DB".TRO344.xOutCorrection THEN + #xVersatz := TRUE; + END_IF; *) + + REGION Arraygrößen ermitteln + #nNoOfLines := DINT_TO_INT(UPPER_BOUND(ARR := #arInOutStorageLines, DIM := 1)); + END_REGION + + REGION Prüfung Lager voll + //Prüfe ob Lager voll + FOR #nIdx1 := 1 TO USINT_TO_INT(#stInSettings.nNoOfLines) DO //Prüfe ob Lager schon voll ist oder voll wird mit denen die unterwegs sind und gib zusätzlich die resultierenden Gesamtfüllstände aus + IF #arInOutStorageLines[#nIdx1].stData.Status.nCount < #stInSettings.nStorageThreshold AND NOT #arInOutStorageLines[#nIdx1].stData.Status.bByte.%X2 THEN + IF #stConveyorStations.stData.nTrolleysOnline > 0 THEN //zähle gleiche Ziele zusammen erst wenn überhaupt etwas unterwegs ist + FOR #nIdx2 := 1 TO #stConveyorStations.stData.nTrolleysOnline DO + IF #stConveyorStations.arTrolleysOnline[#nIdx2].stPinValues.nTargetPos = #nIdx1 + 10 THEN + #nNoOfSameTarget1 += 1; //addiere die gleichen vergebenen Ziele auf dem Pinband + END_IF; + END_FOR; + END_IF; + #arStoreCount1[#nIdx1] := #nNoOfSameTarget1 + #arInOutStorageLines[#nIdx1].stData.Status.nCount; //resultierender Gesamtfüllstand pro Linie + IF #arStoreCount1[#nIdx1] < #stInSettings.nStorageThreshold THEN + #xFreeAhead1 := TRUE; //Wenn True, dann ist irgendwo bei mid. einer Linie noch Platz + END_IF; + #nNoOfSameTarget1 := 0; //Zähler nullen da er für jede Linie verwendet wird + ELSE + #arStoreCount1[#nIdx1] := #arInOutStorageLines[#nIdx1].stData.Status.nCount; //Wenn Linie bereits max Kapazität hat, schreibe diese in Gesamtzahl hinein + END_IF; + END_FOR; + + IF NOT #xFreeAhead1 THEN //Verhindere dass SepPin überhaupt rauslässt falls alles voll ist + #xSepFree := FALSE; + ELSE + #xSepFree := TRUE; + END_IF; + END_REGION + + REGION Schrittkette Einlagern + CASE #nStateE OF + #c0000_StepOff: + REGION 0000: Off + // akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xCodeEven := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + // SCHRITT 0 WIRD GEBRAUCHT! + //STATE MANAGER KÜMMERT SICH UM TRANSITION! + END_REGION + + #c0100_StepUndefined: + REGION 0100: Undefined + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xMTRORdy := FALSE; + #xCodeEven := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #nStateE := #c1000_StepWaitForTrolley1; + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + //akt. Zustand + #sStateText := 'Wait for Trolley'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xMTRORdy := TRUE; + #xCodeEven := FALSE; + + //Transition + IF #fbSeparatorPin.stOutMainTro.xBtPresent THEN //Separator meldet Belegung + IF #stInSeparatorPin.stSettings.xPluggedScanner THEN //Scanner verbaut? + #nStateE := #c1100_StepScannerTrig1; //Nächster Schritt -> Scannen + ELSIF #arInOutJamEntr[1].bStatus.%X0 THEN // Kein Scanner verbaut, aber Carrier online (z.B. Dummy wurde angelegt) + IF #stInSeparatorPin.stSettings.xPluggedPart THEN + #nStateE := #c1300_StepCheckLoad; // Nächster Schritt -> Beladung prüfen + ELSE + #nStateE := #c1400_StepCheckSep1; //Nächster Schritt -> Separator chekcen + END_IF; + END_IF; + END_IF; + END_REGION + + #"c1100_StepScannerTrig1": + REGION 1100: Scanner Trigger 1 + + // akt. Zustand + #sStateText := 'Scanner Trigger 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN //Scanner bereit + #xStartScan := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScan := FALSE; + #nStateE := #c1200_StepScannerEval1; //Weiter + END_IF; + END_REGION + + #"c1200_StepScannerEval1": + REGION 1200: Scanner Evaluation 1 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic - TODO in eigenen FC packen?.. + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader übernehmen + + REGION Event log Good read + #xGoodRead := TRUE; // Trigger + #stEventGoodRead.nScanType := 4; + #stEventGoodRead.sBarcode := DELETE(IN := DINT_TO_STRING(#nBarcodeResult), L := 1, P := 1); + #stEventGoodRead.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + END_REGION + + + REGION Gerade Zahl erkannt + IF (((#nBarcodeResult / 10) MOD 100) MOD 2 <> 1) THEN //anderes Ergebnis als 1 bedeutet, (xxxxxYYx) YY=gerade, also hinteres Bein von MiniTrolley + #xCodeEven := TRUE; //Bit sagt Separator dass hinteres Bein und nicht erstes zur Korrektur in Schrittkette + // #nBarcodeTarget := #nBarcodeTarget - 10; //Mache danach die gerade Zahl zur ungeraden UPDATE: WEGEN 8. ZIFFER KLAPPT DAS SO NICHT + #nBarcodeHelp := (#nBarcodeResult / 10) - 1; + + "FC_Ean8_CheckDigit"(sInDigits := DELETE(IN := DINT_TO_STRING(IN := #nBarcodeHelp), L := 1, P := 1), + sOutBarcode => #sBarcodeString, + nOutBarcode => #nBarcodeResult); + + // #sOutBarcode := #sBarcodeString; + END_IF; + END_REGION + + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr[1].nBarcode = 0 OR #arInOutJamEntr[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:=1, + // xOutNotFound => #xTemp, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr[1]); + // END_REGION + + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr[1].nBarcode <> 0 AND + #arInOutJamEntr[1].nBarcode <> 1 THEN + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:=1, + // xOutNotFound => #xTemp, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr[1]); + // END_REGION + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + #arInOutJamEntr[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr[1].nDestination := 123; //todo + + REGION Event Log unknown Carrier + + #xUnknownCarrier := TRUE; // Trigger + #stEventUnknown.nScanType := 3; + #stEventUnknown.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr[1].nBarcode), L := 1, P := 1); + #stEventUnknown.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr[1].nDestination), L := 1, P := 1); + #stEventUnknown.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation + 50), L := 1, P := 1); + // #stEventUnknown.sJobNo := DELETE(IN := DINT_TO_STRING(#stInOutCarrier.stLoadData.nJobNo), L := 1, P := 1); + // #stEventUnknown.sProductNo := DELETE(IN := DINT_TO_STRING(#stInOutCarrier.stLoadData.nProductNo), L := 1, P := 1); + + END_REGION + + END_IF; + + #xHandshakeScan := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + IF #stInSeparatorPin.stSettings.xPluggedPart THEN + #nStateE := #c1300_StepCheckLoad; + ELSIF #xCodeEven THEN + #xCodeEven := FALSE; + #nStateE := #c2000_StepWaitForTrolley2; //Scanner bestätigt zweites Bein gelesen -> Korrigieren! + ELSE + #nStateE := #c1400_StepCheckSep1; + END_IF; + + END_REGION + #c1300_StepCheckLoad: + REGION 1300: Check Load + + // akt. Zustand + #sStateText := 'Check Load'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF (#arInOutJamEntr[1].bStatus.%X1 AND #xTrolleyWithPart) OR //Daten und physikalisch -> beladen Ok! + (NOT #arInOutJamEntr[1].bStatus.%X1 AND #xTrolleyWoPart) //Daten und physikalisch -> unbeladen Ok! + THEN + #nStateE := #c1400_StepCheckSep1; // Weiter + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := 123; // TODO: Beladekontrolle Fehler + END_IF; + + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparatorPin.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateE := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c1500_StepReleaseSep1: + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + #xReleaseTrolleySep1 := #xInConveyorRunIn AND #xInSftyOk; // Erste Achse darf vereinzelt werden + + //////// Transition //////// + IF #fbSeparatorPin.stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateE := #c2000_StepWaitForTrolley2; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + + //Korrektur 2.Bein kommt nicht + // IF NOT #fbSeparatorPin.stOutMainTro.xBtPresent (* AND #xInCarouselRun *) AND NOT #stInSeparatorPin.stSettings.xPluggedScanner AND #fbStateManagerE.tOutTimeInStep > T#3s THEN + // #nStateE := #c1000_StepWaitForTrolley1; + // END_IF; + + + //Transition + IF #fbSeparatorPin.stOutMainTro.xBtPresent AND //Separator meldet Belegung + #arInOutJamEntr[1].bStatus.%X0 // Carrier ist online + AND #xInRelease //Freigabe + THEN + IF #xReadSecondLeg // zweites Bein muss gelesen werden (TODO!!!!) + AND #stInSeparatorPin.stSettings.xPluggedScanner // Scanner verbaut? + THEN + #nStateE := #c2100_StepScannerTrig2; // Nächster Schritt -> Scannen + ELSE + #nStateE := #c2300_StepCheckSep2; // Nächster Schritt -> Separator + END_IF; + END_IF; + END_REGION + + #c2100_StepScannerTrig2: + REGION 2100: Scanner Trigger 2 + + // akt. Zustand + #sStateText := 'Scanner Trigger 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN + #xStartScan := TRUE; + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN + #xStartScan := FALSE; + #nStateE := #c2200_StepScannerEval2; + END_IF; + END_REGION + + #c2200_StepScannerEval2: + REGION 2200: Scanner Evaluation 2 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr[1].nBarcode = 0 OR #arInOutJamEntr[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + + IF NOT #xTemp THEN + ; + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + ELSE + #arInOutJamEntr[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + #arInOutJamEntr[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + END_IF; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr[1].nBarcode <> 0 AND + #arInOutJamEntr[1].nBarcode <> 1 THEN + ; + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + #arInOutJamEntr[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr[1].nDestination := 123; //todo + END_IF; + + #xHandshakeScan := TRUE; + + ///////// Timer ////////// + + //////// Transition //////// + #nStateE := #c2300_StepCheckSep2; + + END_REGION + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparatorPin.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateE := #c2500_StepReleaseSep2;//#c2400_StepCheckJam; Anders lösen, Target Decision entscheidet + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + + // IF (#arInOutJamEntr[1].nDestination <> #stInSettings.nDestGeneral) AND (#arInOutJamEntr[1].nDestination <> 0) + // IF (#arInOutJamEntr[1].nDestination > #stInSettings.nDestGeneral + #stInSettings.nNoOfLines) //Bypass + // THEN + // IF (#stInOutJamBypass.Status.nCount >= #stInOutJamBypass.Config.nCapacitySet) + // THEN + // #tmpReasonForStop := "Rsn_JamNextError"; + // ELSE + // #nStateE := #c2500_StepReleaseSep2;//#"c2500_StepReleaseSep2"; + // END_IF; + // ELSE + IF (* (#stInOutJamExit2.Status.nCount = #stInOutJamExit2.Config.nCapacitySet) //Zielstaubereich ist datentechnisch voll + OR (#stInSeparatorPin.Settings.xPluggedJam AND #stInSenJam2.xJam) // Stausensor *) + NOT #xSepFree // Lager voll -> Am besten in Target Decision reinmachen + THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nStateE := #c2500_StepReleaseSep2;//#"c2500_StepReleaseSep2"; + END_IF; + // END_IF; + + END_REGION + + 2450: + REGION 2450: Calculate AND set Target + // akt. Zustand + #sStateText := 'CalcSetTarget'; + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + (* "FC_TargetDecision"(arInStorageLineCalc := #arStoreCount1, + arInStorage := #arInOutStorageLines, + arInSenStore := #arInJamSensor, + nInDestGeneral := #stInSettings.nDestGeneral, + nInNoOfLines := #stInSettings.nNoOfLines, + nInStorageThreshold := 3,//#stInSettings.nStorageThreshold, + nInMode := 3, //1 -> Abwechselnd; 2 -> Gleichmäßig befüllen , 3: Jede Linie nacheinander befüllen + nInOutTarget := #nTarget1, + xInOutFree := #arConveyorEnable[1], + stInOutConveyorStations := #stConveyorStations, + stInOutCarrier:=#arInOutJamEntr[1], *) + + + #nStateE := #c2500_StepReleaseSep2; + + END_REGION + + #c2500_StepReleaseSep2: + REGION 2500: Release Sep Second + // akt. Zustand + #sStateText := 'Leave Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #stOutPriorityManager.xTransportReq := #xInSftyOk AND #xInConveyorRunIn AND NOT #xInAreaStopActive; + + //////// Transition //////// + IF #xInSftyOk AND #xInConveyorRunIn AND NOT #xInAreaStopActive AND #stInPriorityManager.xReleaseOk AND + NOT #fbCarrierWaitSepPin.xOutLockSep1 AND #stInSensorReference.xDirectEdgePos THEN // Freigabe an Separator + REGION Target Decision und Release + // Ziel bestimmen + "FC_TargetDecision"(arInStorageLineCalc := #arStoreCount1, + arInStorage := #arInOutStorageLines, + arInSenStore := #arInJamSensor, + nInDestGeneral := #stInSettings.nDestGeneral, + nInNoOfLines := #stInSettings.nNoOfLines, + nInStorageThreshold := #stInSettings.nStorageThreshold, + nInMode := 3, //1 -> Abwechselnd; 2 -> Gleichmäßig befüllen; 3: jede Linie nacheinander befüllen + xOutBypass=> #xBypassStat, + nInOutTarget := #nTarget1, + xInOutFree := #xReleaseTrolleySep1,//arConveyorEnable[1], + stInOutConveyorStations := #stConveyorStations, + stInOutCarrier:=#arInOutJamEntr[1], + stInOutJamBypass:=#stInOutJamBypass); + + END_REGION + END_IF; + + IF #fbSeparatorPin.stOutMainTro.nStatus = "SepState_Finish" THEN + REGION SHR buchen + // Carrier in Zielbereich umbuchen + #stCarrierPin.stCarrier := #arInOutJamEntr[1]; + IF NOT #xBypassStat THEN + //Exakte Destination für Linie eintragen + #stCarrierPin.stCarrier.nDestination := #stInSettings.nDestGeneral + #nTarget1 - 10; //z.B. 21100 + 11 - 10 = 21101 + END_IF; + + "FC_SHR_HangerAddPin"(stInCarrier := #stCarrierPin, + nInPos := 2, + nInTarget := #nTarget1, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + stInOutConveyorStations := #stConveyorStations); + + // Quellbereich + IF NOT #xBypassStat THEN + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutJamEntr); + END_IF; + + #nTarget1 += 1; + + REGION Daten buchen zum Bypass + IF #xBypassStat THEN + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamBypass); + END_IF; + END_REGION + + #xEventLogBookSHR := TRUE; + END_REGION; + #nStateE := #c1000_StepWaitForTrolley1; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + END_REGION + END_CASE; + END_REGION + + REGION Schrittkette Auslagern + CASE #nStateA OF + #c0000_StepOff: + REGION 0000: Off + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := FALSE; + + // akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + + ///////// Timer ////////// + + //////// Transition //////// + // SCHRITT 0 WIRD GEBRAUCHT! + //STATE MANAGER KÜMMERT SICH UM TRANSITION! + END_REGION + + #c0100_StepUndefined: + REGION 0100: Undefined + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := FALSE; + + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + ///////// Timer ////////// + + //////// Transition //////// + #nStateA := #c1000_StepWaitForTrolley1; + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + + ///////// Statics ////////// + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + + #stMFRStorageRemovalInterface.UDT_State.xReady := TRUE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := FALSE; + + IF #stMFRStorageRemovalInterface.UDT_Ctrl.xStart THEN + #nStateA := 1100; + END_IF; + + (* IF #xStart THEN + #nActLine := #nTestStorageOut; + IF #nActLine <> #nLastLine THEN + #stDummyCarrier.nBarcode := 1; + END_IF; + #nLastLine := #nActLine; + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.xBtPresent AND (#arInOutStorageLines[#nActLine].arCarrier[1].bStatus.%X0 = TRUE) + THEN + #nStateA := #c1400_StepCheckSep1; + END_IF; + END_IF; *) + END_REGION + + 1100: + REGION 1100: Prepare Req + + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + #stActRequest.nMode := #stMFRStorageRemovalInterface.UDT_Ctrl.nMode; + #stActRequest.#nActLine := #stMFRStorageRemovalInterface.UDT_Ctrl.nLine; + #stActRequest.nCountReq := #stMFRStorageRemovalInterface.UDT_Ctrl.nAmount + #stMFRStorageRemovalInterface.UDT_Ctrl.nAmountOffset; + #stActRequest.nCountAct := 0; + + IF #stMFRStorageRemovalInterface.UDT_Ctrl.xStart AND + #stActRequest.nActLine > 0 AND #stActRequest.nMode > 0 AND ((#stActRequest.nMode = 1 AND #stActRequest.nCountReq > 0) OR #stActRequest.nMode = 2 OR #stActRequest.nMode = 3) + THEN + #nStateA := 1200; //Plausibel, Weiter + ELSE + #nStateA := 1000; //Fehler in Anfrage, Abbrechen + END_IF; + + + END_REGION + + 1200: + REGION 1200: Check Req + + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + IF #stMFRStorageRemovalInterface.UDT_Ctrl.xStart //Start-Befehl von MFR-Baustein + AND #stInOutJamExit.Status.nCount = 0 //Bei jedem neuen Start einer Linie, muss der Exit-Jam vom Lagerblock leer sein + THEN + IF #stMFRStorageRemovalInterface.UDT_Ctrl.nMode = 1 THEN //Job mit Anzahl + #nStateA := 1300; + ELSIF #stMFRStorageRemovalInterface.UDT_Ctrl.nMode = 2 THEN // RapidFire + #nStateA := 1310; + ELSIF #stMFRStorageRemovalInterface.UDT_Ctrl.nMode = 3 THEN // Initialisieren/Entleeren + #nStateA := 1320; + ELSE + #nStateA := 1000; + END_IF; + ELSE + #nStateA := 1000; + END_IF; + + END_REGION + + 1300: + REGION 1300: Mode Job + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + IF #stMFRStorageRemovalInterface.UDT_Ctrl.xStart AND (#stActRequest.nCountAct < #stActRequest.nCountReq) THEN + #nStateA := #c1400_StepCheckSep1; //Weitermachen + ELSIF (#stActRequest.nCountAct >= #stActRequest.nCountReq) OR NOT #stMFRStorageRemovalInterface.UDT_Ctrl.xStart THEN + #nStateA := 1000; //fertig + END_IF; + END_REGION + + 1310: + REGION 1310: Mode RapidFire + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + IF #stMFRStorageRemovalInterface.UDT_Ctrl.xStart THEN + #nStateA := #c1400_StepCheckSep1; + ELSE + #nStateA := 1000; //fertig + END_IF; + END_REGION + + + 1320: + REGION 1320: Mode Entleeren + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + IF #stMFRStorageRemovalInterface.UDT_Ctrl.xStart AND (#arInOutStorageLines[#stActRequest.nActLine].stData.Status.nCount > 0) AND (#stActRequest.nCountAct < #stActRequest.nCountReq) THEN + #nStateA := #c1400_StepCheckSep1; + ELSIF NOT #stMFRStorageRemovalInterface.UDT_Ctrl.xStart OR (#stActRequest.nCountAct >= #stActRequest.nCountReq) THEN + #nStateA := 3000; + //#nStateA := 1000; + END_IF; + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + + CASE #stActRequest.nActLine OF + 1: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 2: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 3: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 4: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 5: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 6: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 7: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 8: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 9: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 10: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 11: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 12: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 13: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 14: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 15: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 16: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 17: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 18: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 19: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 20: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 21: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c1500_StepReleaseSep1; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + END_CASE; + + END_REGION + + #c1500_StepReleaseSep1: + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + FOR #nIdx1 := 1 TO 21 DO + IF #nIdx1 = #stActRequest.nActLine THEN + #arLineRelease[#nIdx1] := TRUE; + ELSE + #arLineRelease[#nIdx1] := FALSE; + END_IF; + END_FOR; + + + //////// Transition //////// + CASE #stActRequest.nActLine OF + 1: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 2: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 3: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 4: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 5: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 6: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 7: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 8: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 9: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 10: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 11: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 12: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 13: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 14: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 15: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 16: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 17: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 18: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 19: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 20: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 21: + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + #nStateA := #c2000_StepWaitForTrolley2; + ELSIF #arLineRelease[#stActRequest.nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + END_CASE; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + + + //Transition + CASE #stActRequest.nActLine OF + 1: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + 2: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 3: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 4: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 5: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 6: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + 7: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 8: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 9: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 10: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 11: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + 12: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 13: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 14: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 15: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 16: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + 17: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 18: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 19: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 20: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + 21: // Statement section case 1 + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent AND #arInOutStorageLines[#stActRequest.nActLine].arCarrier[1].bStatus.%X0 THEN + #nStateA := #c2300_StepCheckSep2; + END_IF; + + END_CASE; + END_REGION + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + + //Transition + CASE #stActRequest.nActLine OF + 1: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 2: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 3: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 4: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 5: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 6: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 7: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 8: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 9: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 10: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 11: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 12: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 13: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 14: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 15: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 16: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + 17: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 18: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 19: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 20: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + 21: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nStateA := #c2400_StepCheckJam; + ELSIF #fbStateManagerE.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_CASE; + + + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + FOR #nIdx1 := 1 TO 21 DO + #arLineRelease[#nIdx1] := FALSE; + END_FOR; + + ///////// Timer ////////// + //////// Transition //////// + IF (#stInOutJamExit.Status.nCount = #stInOutJamExit.Config.nCapacitySet) //Zielstaubereich ist datentechnisch voll + OR (#arInSep[1].stSettings.xPluggedJam AND #stInSenJam2.xJam) // Stausensor *) + THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nStateA := #c2500_StepReleaseSep2; + END_IF; + END_REGION + + #c2500_StepReleaseSep2: + REGION 2500: Release Sep Second + #stMFRStorageRemovalInterface.UDT_State.xReady := FALSE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := TRUE; + + // akt. Zustand + #sStateText := 'Leave Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #stOutPriorityManager.xTransportReq := #xInSftyOk AND #xInConveyorRunOut (* AND NOT #stInMfr.xPause *)AND NOT #xInAreaStopActive; + + FOR #nIdx1 := 1 TO 21 DO + IF #nIdx1 = #stActRequest.nActLine THEN + #arLineRelease[#nIdx1] := #xInSftyOk AND #xInConveyorRunOut AND NOT #xInAreaStopActive AND #stInPriorityManager.xReleaseOk AND NOT #arInOutStorageLines[#nIdx1].stData.Status.bByte.%X3; + ELSE + #arLineRelease[#nIdx1] := FALSE; + END_IF; + END_FOR; + + //////// Transition //////// + //Transition + + FOR #nIdx1 := 1 TO #stActRequest.nActLine DO + IF #nIdx1 = #stActRequest.nActLine THEN + IF #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + IF NOT #xVersatz THEN // Alles normal buchen + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#stActRequest.nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + + ELSE // Dummy (=ohne Daten) buchen + "FC_TSHR_AddAtEnd"(stInTrolley := #stDummyCarrier, + nOutCounter => #nCounter, + xOutResult => #xResult, + arTSHR := #arInOutJamExit); + + #stDummyCarrier.nBarcode += 1; + + IF #stDummyCarrier.nBarcode > 99 THEN + #stDummyCarrier.nBarcode := 1; + END_IF; + END_IF; + #xVersatz := FALSE; + END_REGION ; + #xEventLogBookExit := TRUE; + + IF #stActRequest.nMode = 1 THEN + #stActRequest.nCountAct := #stActRequest.nCountAct + 1; //Hochzählen + #nStateA := 1300; + ELSIF #stActRequest.nMode = 2 THEN + #nStateA := 1310; + ELSIF #stActRequest.nMode = 3 THEN + #stActRequest.nCountAct := #stActRequest.nCountAct + 1; //Hochzählen + #nStateA := 1320; + END_IF; + + // #nStateA := #c1000_StepWaitForTrolley1; + EXIT; + END_IF; + END_IF; + END_FOR; + + + + + (* CASE #nActLine OF + 1: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 2: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam - TEST!! + (* "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); *) + + "FC_TSHR_AddAtEnd"(stInTrolley := #stDummyCarrier, + nOutCounter => #nCounter, + xOutResult => #xResult, + arTSHR := #arInOutJamExit); + + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 3: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 4: // Statement section case 1 + #tmpActUnivTon := TRUE; + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 5: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 6: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 7: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 8: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 9: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 10: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 11: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 12: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 13: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 14: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 15: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 16: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + 17: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 18: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 19: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 20: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + 21: // Statement section case 1 + IF #arfbSeparatorStorage[#nActLine].stOutMainTro.nStatus = "SepState_Finish" THEN + //Hier könnte man noch einbauen, ob optional nicht gebucht wird, z.B. für Fehlerkorrektur + REGION Daten buchen Store1 -> ExitJam + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutStorageLines[#nActLine].arCarrier, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_REGION + #xEventLogBookExit := TRUE; + #nStateA := #c1000_StepWaitForTrolley1; + ELSIF #arLineRelease[#nActLine] AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + END_CASE; *) + + END_REGION + + 3000: + REGION 3000: Finish + #stMFRStorageRemovalInterface.UDT_State.xReady := TRUE; + #stMFRStorageRemovalInterface.UDT_State.xBusy := FALSE; + + IF NOT #stMFRStorageRemovalInterface.UDT_Ctrl.xStart THEN + #nStateA := 1000; + END_IF; + END_REGION ; + + + END_CASE; + END_REGION + + REGION Auslagerjob überwachen + IF #stActRequest.nActLine > 0 THEN + IF (#nStateA > 1000) AND (#nStateA < 3000) AND (#fbStateManagerA.tOutTimeInStep > t#20s) AND //Wir warten seit langem in einem Schritt + (#stActRequest.nCountAct < #stActRequest.nCountReq) AND //Es werden noch Carrier erwartet + ((#arInOutStorageLines[#stActRequest.nActLine].stData.Status.nCount = 0) (* OR NOT #arfbSeparatorStorage[#stActRequest.nActLine].stOutMainTro.xBtPresent *)) //Keine Daten mehr oder keine Belegung mehr + THEN + #nStateA := 3000; //Auftrag beenden + //Optional den Grund mitgeben (Auftrga beendet... erfolgreich, keine Carrier mehr, keine Daten mehr...) + END_IF; + END_IF; + + END_REGION + + + REGION StateManager Einlagern + + #fbStateManagerE.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManagerE.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManagerE.stInSettings.xActUnivTOn := TRUE; + #fbStateManagerE.stInSettings.xRestartAtStartState := FALSE; + #fbStateManagerE(xInFunctionEnabled := #stInOutControlUnitCabinet.xRunning, // AND #xInSftyOk, + xInReset := (* #stInMfr.xCancel OR *)#xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nStateE); + + END_REGION + + REGION StateManager Auslagern + + #fbStateManagerA.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManagerA.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManagerA.stInSettings.xActUnivTOn := TRUE; + #fbStateManagerA.stInSettings.xRestartAtStartState := FALSE; + #fbStateManagerA(xInFunctionEnabled := #stInOutControlUnitCabinet.xRunning, // AND #xInSftyOk, + xInReset := (* #stInMfr.xCancel OR *)#xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nStateA); + + END_REGION + + REGION SHR - Cycle + "FC_SHR_CyclePin"(nInPosDiff := #stInEncoderParameter.nPosActDif, + nInPosPitchPart := #stInEncoderParameter.nPosPitchPart, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + stInOutConveyorStations := #stConveyorStations); + END_REGION + + REGION SHR - Check Station + // Funktioniert, aber TIA erlaubt kein Beobachten von Multiinstanzen innerhalb von Schleifen + (* FOR #index := 1 TO #cUnloadingStations DO + "FC_SHR_CheckStationPinTEST_1"(nInStation := #index + 10, //11-29 + xInTargetStation := 1, + xOutStationHi => #arStartUnloading[#index], + xOutStationNHi => #arStopUnloading[#index], + // xOutMiniTrolley=>#fbStationUnloading1_1.xInMiniTrolley, + xOutStationHiBefore => #arfbStationUnloadPin[#index].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#index].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#index].sInBarcode, + stConveyorStations := stConveyorStations); + END_FOR; *) + + REGION Check US1 + #nActNo := 1; + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_REGION + + REGION Check US2 + #nActNo := 2; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US3 + #nActNo := 3; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US4 + #nActNo := 4; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US5 + #nActNo := 5; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US6 + #nActNo := 6; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US7 + #nActNo := 7; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US8 + #nActNo := 8; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US9 + #nActNo := 9; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + + END_REGION + + REGION Check US10 + #nActNo := 10; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US11 + #nActNo := 11; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US12 + #nActNo := 12; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US13 + #nActNo := 13; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US14 + #nActNo := 14; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US15 + #nActNo := 15; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US16 + #nActNo := 16; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US17 + #nActNo := 17; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US18 + #nActNo := 18; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US19 + #nActNo := 19; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US20 + #nActNo := 20; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION Check US21 + #nActNo := 21; + IF #stInSettings.nNoOfLines >= #nActNo THEN + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + END_IF; + END_REGION + + REGION BYPASS + #nActNo := #stInSettings.nNoOfLines + 1; + //Wird immer aufgerufen und hat die Nummer "letzte Linie + 1" + "FC_SHR_CheckStationPin"(nInStation := #nActNo + 10,//32, + xInTargetStation := TRUE, + nInConvStations := #stInSettings.nConvStations, + nInStationsMax := #stInSettings.nStationsMax, + xOutStationHi => #arStartUnloading[#nActNo], + xOutStationNHi => #arStopUnloading[#nActNo], + xOutStationHiBefore => #arfbStationUnloadPin[#nActNo].xInBefore, + nOutBarcode => #arfbStationUnloadPin[#nActNo].nInBarcode, + sOutBarcode => #arfbStationUnloadPin[#nActNo].sInBarcode, + stInOutConveyorStations := #stConveyorStations); + + END_REGION + + END_REGION + + REGION Unloading Stations + // Funktioniert, aber TIA erlaubt kein Beobachten von Multiinstanzen innerhalb von Schleifen + (* FOR #index := 1 TO #cUnloadingStations DO + #arfbStationUnloadPin[#index](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#index], + xInStopUnloading := #arStopUnloading[#index], + xInUnloadingCheckSensor := #arInUnloadingCheckSensor[#index].xDirectEdgePos, + xInPartAfterSwitch := #arInPartAfterSwitch[#index].xDbncdSensor, + xInReRouteAllowed := FALSE, + xInQuitLocal := #arInQuitLocal[#index], + xOutSwitch => #arOutSwitch[#index], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + inOutConveyorStations := stConveyorStations, + InOutCarrierStorage := #arInOutStorageLines[#index], + stInOutHMI := #arHMIInOutUnloadingStations[#index]); + END_FOR; *) + + REGION US 1 + #nActNo := 1; + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation1); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_REGION + + REGION US 2 + #nActNo := 2; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation2); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 3 + #nActNo := 3; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation3); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 4 + #nActNo := 4; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation4); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 5 + #nActNo := 5; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation5); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 6 + #nActNo := 6; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation6); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 7 + #nActNo := 7; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation7); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 8 + #nActNo := 8; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation8); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 9 + #nActNo := 9; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation9); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 10 + #nActNo := 10; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation10); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 11 + #nActNo := 11; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation11); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 12 + #nActNo := 12; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation12); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 13 + #nActNo := 13; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation13); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 14 + #nActNo := 14; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation14); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 15 + #nActNo := 15; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation15); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 16 + #nActNo := 16; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation16); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 17 + #nActNo := 17; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation17); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 18 + #nActNo := 18; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation18); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 19 + #nActNo := 19; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation19); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 20 + #nActNo := 20; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation20); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION US 21 + #nActNo := 21; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := TRUE, + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stInOutHMI.UDT_UnloadingStation21); + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + END_IF; + END_REGION + + REGION BYPASS + #nActNo := #stInSettings.nNoOfLines + 1; + //Wird immer aufgerufen und hat die Nummer "letzte Linie + 1" + #arfbStationUnloadPin[#nActNo](xInMonitorUnloading := FALSE, //? + xInStartUnloading := #arStartUnloading[#nActNo], + xInStopUnloading := #arStopUnloading[#nActNo], + xInUnloadingCheckSensor := #arInJamSensor[#nActNo].xDirectEdgePos, + stInPartAfterSwitch := #arInJamSensor[#nActNo], + xInReRouteAllowed := FALSE, + xInBypass := TRUE, //! + xInQuitLocal := #xInQuitLocal, + xOutSwitch => #arOutSwitch[#nActNo], + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutConveyorStations := #stConveyorStations, + arInOutCarrier := #arInOutStorageLines[#nActNo].arCarrier, + stInOutHMI := #stDummyHmiUnloading); + + #arOutUnloadingError[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutUnloadingError; + #arOutLineOverloaded[#nActNo] := #arfbStationUnloadPin[#nActNo].xOutLineOverloaded; + + END_REGION + + + END_REGION + + REGION Separator Pin + #fbSeparatorPin(stInSettings := #stInSeparatorPin.stSettings, + xInConveyorRun := #xInConveyorRunIn, + stInTrolley := #stInSeparatorPin.stSenTrolley, + xInReceiveReady := #xReleaseTrolleySep1, + xOutStopper => #xOutSeparatorPin, + stInOutMainState := #stInOutControlUnitCabinet, + stInOutHMI := #stInOutHMI.UDT_SeparatorPin, + stInOutCarrDataInJam := #arInOutJamEntr); + + REGION Accumulate + #fbCarrierWaitSepPin.stInTimes.tFreeSen1 := #stInSeparatorPin.stSettings.tSenFree; + #fbCarrierWaitSepPin.stInTimes.tTimerWait := #stInSeparatorPin.stSettings.tSenWait; + #fbCarrierWaitSepPin(stInSensor1 := #stInSeparatorPin.stSenTrolley, + xInConvActive := #xInConveyorRunIn); + END_REGION + + REGION Dummy Handling + + #nArrayMax := DINT_TO_INT(UPPER_BOUND(ARR := #arInOutJamEntr, DIM := 1)); + + REGION Dummy erstellen + IF #fbSeparatorPin.stOutMainTro.xBtPresent AND + #fbSeparatorPin.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparatorPin.stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutJamEntr[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr[1].nBarcode := #cCarrierDummy; + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #nArrayMax > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutJamEntr[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutJamEntr[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #stInSeparatorPin.stSenTrolley.xDirectSensor AND #stInSeparatorPin.stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #fbSeparatorPin.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparatorPin.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutJamEntr[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutJamEntr[2] = #stCarrierDummy OR #arInOutJamEntr[2] <> #stCarrierDummy) AND + NOT #stInSeparatorPin.stSenTrolley.xDirectSensor AND #stInSeparatorPin.stSenTrolley.tDirectChangeLast > T#8s AND + #fbSeparatorPin.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparatorPin.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutJamEntr); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutJamEntr[1] = #stCarrierDummy) AND + NOT #stInSeparatorPin.stSenTrolley.xDirectSensor AND #stInSeparatorPin.stSenTrolley.tDirectChangeLast > T#8s AND + #fbSeparatorPin.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparatorPin.#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutJamEntr[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + + + END_REGION + + REGION Separator StorageLines + + REGION Separator Freigabe + //Benötigtem Sep Freigabe erteilen + // FOR #nIdx1 := 1 TO #stInSettings.nNoOfLines DO + // IF #stInStorageCarrStats.stRdyToLeave.nLine = #nIdx1 THEN + // #arLineRelease[#nIdx1] := TRUE; + // END_IF; + // END_FOR; + END_REGION + + REGION Sep 1 + #nActNo := 1; + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := NOT #fbCarrierWaitStore1.xOutLockSep1 AND #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutMainState := #stInOutControlUnitCabinet, + stInOutHMI := #stInOutHMI.UDT_Separator1, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + + REGION Carrier anstauen lassen + #fbCarrierWaitStore1.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore1.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore1(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + END_REGION + + REGION Sep 2 + #nActNo := 2; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := NOT #fbCarrierWaitStore2.xOutLockSep1 AND #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator2, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore2.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore2.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore2(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + + END_REGION + + REGION Sep 3 + #nActNo := 3; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator3, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore3.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore3.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore3(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + END_REGION + + REGION Sep 4 + #nActNo := 4; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator4, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore4.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore4.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore4(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 5 + #nActNo := 5; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator5, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore5.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore5.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore5(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 6 + #nActNo := 6; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator6, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore6.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore6.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore6(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 7 + #nActNo := 7; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator7, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore7.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore7.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore7(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 8 + #nActNo := 8; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator8, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore8.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore8.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore8(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 9 + #nActNo := 9; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator9, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore9.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore9.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore9(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 10 + #nActNo := 10; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator10, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore10.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore10.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore10(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 11 + #nActNo := 11; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator11, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore11.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore11.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore11(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 12 + #nActNo := 12; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutMainState := #stInOutControlUnitCabinet, + stInOutHMI := #stInOutHMI.UDT_Separator12, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + REGION Carrier anstauen lassen + #fbCarrierWaitStore12.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore12.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore12(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 13 + #nActNo := 13; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator13, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + REGION Carrier anstauen lassen + #fbCarrierWaitStore13.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore13.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore13(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 14 + #nActNo := 14; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator14, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + REGION Carrier anstauen lassen + #fbCarrierWaitStore14.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore14.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore14(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 15 + #nActNo := 15; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator15, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore15.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore15.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore15(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 16 + #nActNo := 16; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator16, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore16.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore16.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore16(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 17 + #nActNo := 17; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutMainState := #stInOutControlUnitCabinet, + stInOutHMI := #stInOutHMI.UDT_Separator17, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore17.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore17.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore17(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 18 + #nActNo := 18; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator18, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + REGION Carrier anstauen lassen + #fbCarrierWaitStore18.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore18.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore18(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 19 + #nActNo := 19; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutMainState := #stInOutControlUnitCabinet, + stInOutHMI := #stInOutHMI.UDT_Separator19, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore19.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore19.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore19(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + END_REGION + + REGION Sep 20 + #nActNo := 20; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator20, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore20.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore20.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore20(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + END_REGION + + REGION Sep 21 + #nActNo := 21; + IF #stInSettings.nNoOfLines >= #nActNo THEN + #arfbSeparatorStorage[#nActNo](stInSettings := #arInSep[#nActNo].stSettings, + xInConveyorRun := #xInConveyorRunOut, + stInTrolley := #arInSep[#nActNo].stSenTrolley, + xInReceiveReady := #arLineRelease[#nActNo] AND NOT #arInOutJamExit[#arInSep[#nActNo].stSettings.nJamLength].bStatus.%X0, + stInOutMainState := #stInOutControlUnitCabinet, + xOutStopper => #arOutSeparatorStore[#nActNo], + stInOutHMI := #stInOutHMI.UDT_Separator21, + stInOutCarrDataInJam := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + + REGION Carrier anstauen lassen + #fbCarrierWaitStore21.stInTimes.tFreeSen1 := T#2000ms; + #fbCarrierWaitStore21.stInTimes.tTimerWait := T#3000ms; + #fbCarrierWaitStore21(stInSensor1 := #arInSep[#nActNo].stSenTrolley, + xInConvActive := true); + END_REGION + + REGION Dummy Handling + + #arArrayMax[#nActNo] := 10; + + REGION Dummy erstellen + IF #arfbSeparatorStorage[#nActNo].stOutMainTro.xBtPresent AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForReq" AND + #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutStorageLines[#nActNo].arCarrier[1] = #tmpCarrierEmpty + THEN + #arInOutStorageLines[#nActNo].arCarrier[1].nBarcode := #cCarrierDummy; + #arInOutStorageLines[#nActNo].arCarrier[1].bStatus.%X0 := TRUE; + END_IF; + + END_REGION + + REGION Dummy löschen + IF #arArrayMax[#nActNo] > 1 THEN //Staubereich mit Capacity > 0 + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dummy an erster Position + AND #arInOutStorageLines[#nActNo].arCarrier[2] = #tmpCarrierEmpty AND //Keine Daten an zweiter Position + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND //keine Belegung + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; //Dummy löschen + ELSIF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) //Dasselbe wie oben aber mit nachrücken + AND (#arInOutStorageLines[#nActNo].arCarrier[2] = #stCarrierDummy OR #arInOutStorageLines[#nActNo].arCarrier[2] <> #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutStorageLines[#nActNo].arCarrier); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutStorageLines[#nActNo].arCarrier[1] = #stCarrierDummy) AND + NOT #arInSep[#nActNo].stSenTrolley.xDirectSensor AND #arInSep[#nActNo].stSenTrolley.tDirectChangeLast > T#8s AND + #arfbSeparatorStorage[#nActNo].stOutMainTro.nStatus = "SepState_WaitForBt" AND #arfbSeparatorStorage[#nActNo].#fbStateManager.tOutTimeInStep > T#8s //Separator Zustand abfragen + THEN + #arInOutStorageLines[#nActNo].arCarrier[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + END_REGION + + + END_REGION + + REGION Barcode Reader 1 + #fbBarcodeReader1(stInSettings := #stInBarcodeReader.Settings, + xInHWError := false, // todo + xInStartReading := #xStartScan, + xInHandshakeDone := #xHandshakeScan, + stInOutInterface := #stCognexInterfacePin, + stInOutControlUnitCabinet := #stInOutControlUnitCabinet, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader); + END_REGION + + REGION Output + #xOutConvReqSort := (#nStateE = #c1500_StepReleaseSep1) OR (#nStateE = #c2500_StepReleaseSep2); //TRUE;//#fbSeparatorPin.xOutConveyorRequest; + #xOutConvReqExit := (#nStateA = #c1500_StepReleaseSep1) OR (#nStateA = #c2500_StepReleaseSep2); + + FOR #nIdx2 := 1 TO #cUnloadingStations DO + IF #arfbStationUnloadPin[#nIdx2].xOutUnloadingError THEN + #xOutUnloadingError := TRUE; + EXIT; + ELSE + #xOutUnloadingError := FALSE; + END_IF; + END_FOR; + + #xOutCorrection := #xTmpCorrection; + END_REGION + + REGION BlockManager + // Funktionen die den ganzen Lagerblock betreffen + // z.B. Schrittkette + // Füllstandsmanagement + // Verschiedene Modi (Einlagern, Auslagern, Ein-und Auslagern...) + REGION Einlagern + // Zielvergabe nach entsprechender Einlagerstrategie (chaotisch, nach Sorten...) + + END_REGION + + REGION Auslagern + // TRO bearbeitet eine Auftragsliste, die Aufträge (Minitrolley) werden vom WES von außen übergeben + // Steuerung der Separatoren an den Lagerausgängen, je nachdem was angefordert wird + + END_REGION + + REGION Füllgrad + // Füllgrad der Linien ermitteln / überwachen und nach außen übergeben + + END_REGION + END_REGION + + REGION Vorfahrt-Logik Separatoren Auslagern + + #stPrioSep1.TroOut.nTroId := 1; + #stPrioSep1.TroOut.xTransportReq := #arfbSeparatorStorage[1].stOutMainTro.xBtPresent; + #stPrioSep1.TroOut.stJamExit := #stInOutJamExit; + + #stPrioSep2.TroOut.nTroId := 2; + #stPrioSep2.TroOut.xTransportReq := #arfbSeparatorStorage[2].stOutMainTro.xBtPresent; + #stPrioSep2.TroOut.stJamExit := #stInOutJamExit; + + #stPrioParam.nPrioMode := 1; + #fbPrioManagerTest(xInQuit := "cTodoFalse", + tIn_ReleaseTime := T#10s, + udtIn_Source1Req := #stPrioSep1.TroOut, + udtIn_Source2Req := #stPrioSep2.TroOut, + udt_PrioParameter := #stPrioParam); + + + + // #fbSepPrio(xInSepReq1 := #arfbSeparatorStorage[1].stInTrolley.xDbncdSensor, + // xInSepReq2 := #arfbSeparatorStorage[1].stInTrolley.xDbncdSensor, + // // xInSepRelease1 := #fbSepStore1_1.xOutTrolleyReleasedEdge, NIU + // // xInSepRelease2 := #fbSepStore1_2.xOutTrolleyReleasedEdge, NIU + // // xInActive := NOT #stHMI2.xDisableConveyor, NIU + // tInTime3 := T#8000ms, + // tInTime2 := T#6000ms, + // InOutJam := "DB_JamPinDown".stJam.stData); + END_REGION + + REGION Event Logs + REGION Event: Umbuchung SepPin auf SHR + #stBookingInfo.sJamSrc := #stInSettings.sJamSrc; + IF #nTarget1 = 11 THEN + #stBookingInfo.sJamDest := 'SHR'; + ELSIF #nTarget1 = 12 THEN + #stBookingInfo.sJamDest := 'SHR'; + END_IF; + #fbEventLog_Route1(xInTrigger := #xEventLogBookSHR, + stInEventBookingInfo := #stBookingInfo); + END_REGION + + REGION Event: Umbuchung Lagerlinie auf Exit + IF #nActLine = 1 THEN + #stBookingInfo.sJamSrc := 'JamStore1'; + ELSIF #nActLine = 2 THEN + #stBookingInfo.sJamSrc := 'JamStore2'; + END_IF; + + #stBookingInfo.sJamDest := #stInSettings.sJamDest; + + #fbEventLog_Route2(xInTrigger := #xEventLogBookExit, + stInEventBookingInfo := #stBookingInfo); + END_REGION + + // Pro Event wird ein Aufruf benötigt + REGION Korrekturvorgänge loggen + + #fbEventLogCorrection1(xInTrigger := #arEventCorrectionInfo[0].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[0]); + + #fbEventLogCorrection2(xInTrigger := #arEventCorrectionInfo[1].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[1]); + + END_REGION + + #fbEventLogCarrierUnknown(xInTrigger := #xUnknownCarrier, + stInEventScanInfo := #stEventUnknown); + + #fbEventLogCarrierNew(xInTrigger := #xNewCarrier, + stInEventScanInfo := #stEventNew); + + #fbEventLogGoodRead(xInTrigger := #xGoodRead, + stInEventScanInfo := #stEventGoodRead); + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.libinfo b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.libinfo new file mode 100644 index 0000000..0e59f9f --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 901da2f1-dd37-4f9f-ad1c-457a2942dfb5 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.44 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: unterlagerte Änderung + Error an HMI diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.libint b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.libint new file mode 100644 index 0000000..4c593ab --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.libint @@ -0,0 +1,63 @@ +DocumentHash: + - FileName: FB_ILS_MTRO_Vario.scl + Hash: ij8+quD1+6/Y2Gll+lwVcUtBDYJ55Jr2O9+3zkrVYWk= +LibraryMetaFileHash: nsBzoQhuClVvQibr/51Q+TUKf5a3/vLnUmtaLITQ8Kg= +LibraryVersion: + Guid: 8b55333c-b1cd-4393-90bf-b434182d114b + DependsOn: + - TypeName: FB_ILS_STRO_Vario + VersionNumber: 2.0.18 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: UDT_HMI_TRO + VersionNumber: 2.0.4 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: FB_ILS_STRO_Sep + VersionNumber: 2.0.8 + - TypeName: FB_BarcodeReaderCognex + VersionNumber: 2.0.4 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: SettingsVario + VersionNumber: 2.0.5 + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: FB_CarrAccumulate1Sep + VersionNumber: 2.0.0 + - TypeName: UDT_SettingsVarioFingerMonitoring + VersionNumber: 2.0.0 + - TypeName: FB_SetAlarmAndLog + VersionNumber: 2.0.1 + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Booking + VersionNumber: 2.0.0 + - TypeName: stEventCorrectionInfo + VersionNumber: 2.0.0 + - TypeName: stEventScanInfo + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Correction + VersionNumber: 2.0.0 + - TypeName: FB_EventLog_Scan + VersionNumber: 2.0.0 + - TypeName: FC_Route + VersionNumber: 2.0.1 + - TypeName: FC_TSHR_Shift + VersionNumber: 2.0.1 + - TypeName: FC_Ean8_CheckDigit + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.scl b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.scl new file mode 100644 index 0000000..4d0b411 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_ILS_MTRO_Vario.scl @@ -0,0 +1,1389 @@ +FUNCTION_BLOCK "FB_ILS_MTRO_Vario" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : Struct // Einstellungen MTRO + nTroStopper1 : Int; + xIsBorner : Bool; // Bei diesem TRO werden immer neue Carrier angelegt (z.B. erster TRO bei Einfahrt in Gesamtanlage) + sJamSrc : String[16]; + sJamDest : String[16]; + bSepType : Byte := 16#0; // X0: TRUE - erstes Bein halten, X1: TRUE- Beladekontrolle, X2: TRUE - Beladeerfassung + tPartSenHigh : Time := T#500ms; + tInSenHigh : Time := T#500ms; + nBornerDest : Int; // Standard Destination festlegen für Borner (variabel) + tDummyTimeNormal : Time := T#3s; // Zeit für Dummy anlegen (Dummy = 1) + tDummyTimeBorner : Time := T#0ms; // Zeit für Dummy anlegen (Dummy = 1000-2000) schneller... + END_STRUCT; + stInVario : Struct // Schnittstelle Vario + stSenFinger : "UDT_Sensor"; + stSenNextSep : "UDT_Sensor"; + stSenJam : "UDT_Sensor"; + stSenLastPos : "UDT_Sensor"; + stSenSepVario : "UDT_Sensor"; + stSenCarrInPos : "UDT_Sensor"; + Settings : "SettingsVario"; + SettingsVarioFingerMonitoring : "UDT_SettingsVarioFingerMonitoring"; + END_STRUCT; + stInSeparator1 : Struct // Schnittstelle Separator (vor Vario Förderer) + stSenInSep : "UDT_Sensor"; // Sensor in Stopper + stSenSepLeft : "UDT_Sensor"; // Sensor nach Stopper + stSenPart : "UDT_Sensor"; // Checkt, ob der Bügelträger beladen ist + stSenStartScan : "UDT_Sensor"; // Sensor nach Stopper wenn Scanner vorhanden. Vermutlich startet dieser Sensor den Scanner + Settings : "SettingsSeparator"; + END_STRUCT; + stInBarcodeReader : Struct // Schnittstelle Barcode-Leser + Settings : "UDT_SettingsBarcodeReader"; + END_STRUCT; + stInPriorityManager : "UDT_Response"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + nInMainTroNo : UInt; // TRO Nummer + xInRelease : Bool; + xInSftyOk : Bool; // Safety + xInMotorProtection : Bool; // Motorschutz Vario + xInAllRdyToStart : Bool; // Alles bereit + xInJamAtExit2 : Bool; // Stau am Ausgang + xInTestMode : Bool; // Testmodus + xInReset : Bool; // Baustein Reset + xInErrorQuit : Bool; + xInAutomatic : Bool; + END_VAR + + VAR_OUTPUT + stOutPriorityManager : "UDT_Request"; // Schnittstelle Prioritätenmanager (z.B. bei Kreuzungen) + xOutStopper : Bool; // Separator Stopper + xOutVarioMotor : Bool; // Vario Motor + xOutJamAtEntry1 : Bool; // Stau Eingang + xOutCarouselReq : Bool; // Motor anfordern (Prüfen) + xOutCorrection : Bool; + nOutStateLast : Int; + nOutScanResult : DInt; + xOutNewScan : Bool; + xOutBooked : Bool; + stOutLastCarrier : "stCarrier"; + END_VAR + + VAR_IN_OUT + arInOutJamEntr : Array[*] of "stCarrier"; // Daten Staubereich Eingang 1 + stInOutJamEntr : "stJamData"; + arInOutJamFinger : Array[*] of "stCarrier"; // Daten Staubereich Finger + stInOutJamFinger : "stJamData"; + stInOutMachineState : "UDT_MainState"; // Maschinenzustand (Allgemien) + stInOutCognexInterface : "stCognexInterface"; // Cognex Barcode Reader Interface + stInOutHMI : "UDT_HMI_TRO"; // HMI TRO + END_VAR + + VAR + fbStateManager : "FB_StateManager"; + fbSeparator1 : "FB_ILS_STRO_Sep"; + fbConvVario : "FB_ILS_STRO_Vario"; + fbBarcodeReader1 : "FB_BarcodeReaderCognex"; + fbSepWait : "FB_CarrAccumulate1Sep"; + END_VAR + VAR RETAIN + stActRequest : Struct + xNBT : Bool; // Es handelt sich um einen Nullbügelträger + xCancelled : Bool; // Abbruchanforderung durch MFR + nActArrIndex : USInt; + nActReqIndex : USInt; // 0 = nichts zu tun | 1-200: Aktuell bearbeiteter Index + nDirection : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A2 + nRequestedNoBT : USInt; // Anzahl Trolleys die ausgefahren werden sollen + nReasonForStop : USInt; // 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + nActNoStopper : USInt; // Anzahl der Stopper-öffnungen in diesem Auftrag + nCntAtStartSep1 : UDInt; // Absoluter Zähler an Separator 1 bei Start des Auftrages + nCntAtStartExit2 : UDInt; // Absoluter Zähler an Exit 2 bei Start des Auftrages + END_STRUCT; + END_VAR + VAR + sStateText : String["cStateText"]; // Aktueller State der Schrittkette (textuell) + END_VAR + VAR RETAIN + nState : Int; + END_VAR + VAR + nLastReqIndex : USInt; + tOfLastPos {InstructionName := 'TOF_TIME'; LibVersion := '1.0'} : TOF_TIME; // Flanke des letzten Trolleys verarbeiten + tOnSvReleaseSep {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Supervision - Freigabe Separator + END_VAR + VAR RETAIN + xReleaseTrolleySep1 : Bool; // Öffne-Befehl + xLastPosReached : Bool; + xErrorMotor : Bool; // Fehler weil Motor-Run fehlt + xMTRORdy : Bool; + END_VAR + VAR + xStartScan : Bool; + xHandshakeScan : Bool; + nBarcodeResult : DInt; + xTrolleyWithPart : Bool; + xTrolleyWoPart : Bool; + xVarioReq : Bool; + xReadSecondLeg : Bool; + wErrorWord : Word; + stCarrierDummy { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : "stCarrier" := (1, (), 16#01); + nArrayMax : Int; + fbMonitoringCarrNotArrive : "FB_Monitoring"; + fbMonitoringCarrWoData : "FB_Monitoring"; + tOnMonCarrArrive {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Überwachungszeit zwischen Carrier Online & Separator Sensor Belegung + fbEventLog_Route : "FB_EventLog_Booking"; + xCodeEven : Bool; + nBarcodeHelp : DInt; + sBarcodeString : String; + fbEventLogCorrection1 : "FB_EventLog_Correction"; + fbEventLogCorrection2 : "FB_EventLog_Correction"; + fbEventLogCarrierUnknown : "FB_EventLog_Scan"; + fbEventLogCarrierNew : "FB_EventLog_Scan"; + fbEventLogGoodRead : "FB_EventLog_Scan"; + fbAlarmVarioMTinPos : "FB_SetAlarmAndLog"; + nBarcodeEmpty : Int; + FTrig_CarrInPos {InstructionName := 'F_TRIG'; LibVersion := '1.0'} : F_TRIG; + xCarrierSensorPass : Bool; // MT hat Carr in Pos erreicht + xCarrierCorrectionDone : Bool; // Nur einmal versuchen zu korrigieren + END_VAR + + VAR_TEMP + xTemp : Bool; + nIndex : USInt; + tmpActUnivTon : Bool; + xBtEmpty : Bool; + xVarioRelease : Bool; + xVarioTrigger : Bool; + tmpReasonForStop : USInt; // Anhaltegrund in der Schrittkette | 0: Nichts | 5: Alle BT ausgefahren | 10: Fehler in SubTro | 15: Kein BT/NBT am Eingang | 20: Stau im nächsten MTRO | 25: NBT | 30: Falsch gefahren | 35: Initial-BT kam nicht am Ziel an | 40: Allgemeiner Fehler | 45: Abbruch durch MFR | 50: Fehler in Anfrage von MRF | 55: MFR hat TRO pausiert + nArrayMaxEntry : DInt; + nArrayMaxFinger : DInt; + nArrayMaxExit : DInt; + stEmptyCarrier : "stCarrier"; + stBookingInfo : "stEventBookingInfo"; + arEmptyCarrier : Array[1..1] of "stCarrier"; // Platzhalter für CarrierArray + tmpCarrierEmpty : "stCarrier"; + xEventLogRoute : Bool; + arEventCorrectionInfo : Array[0..1] of "stEventCorrectionInfo"; + stEventNew : "stEventScanInfo"; + stEventUnknown : "stEventScanInfo"; + xNewCarrier : Bool; + xGoodRead : Bool; + xTmpCorrection : Bool; + xUnknownCarrier : Bool; + stEventGoodRead : "stEventScanInfo"; + xBooked : Bool; + stTempCarrier : "stCarrier"; + END_VAR + + VAR CONSTANT + c0000_StepOff : Int := 0; // Aus + c0100_StepUndefined : Int := 100; // Undefiniert + c1000_StepWaitForTrolley1 : Int := 1000; // Warte auf Trolley + c1100_StepScannerTrig1 : Int := 1100; // Scanner Triggern + c1200_StepScannerEval1 : Int := 1200; // Scanergebnis auswerten + c1300_StepCheckLoad : Int := 1300; // Beladung prüfen + c1400_StepCheckSep1 : Int := 1400; // Separator checken + c1500_StepReleaseSep1 : Int := 1500; // Freigabe an Separator + c2000_StepWaitForTrolley2 : Int := 2000; // Warte auf Trolley 2 + c2100_StepScannerTrig2 : Int := 2100; // Scanner Triggern (nur wenn 1.Achse kein Ergebnis) + c2200_StepScannerEval2 : Int := 2200; // Scanergebnis auswerten (nur wenn 1.Achse kein Ergebnis) + c2300_StepCheckSep2 : Int := 2300; // Separator checken + c2400_StepCheckJam : Int := 2400; // Stau prüfen + c2500_StepWaitForConvRdy : Int := 2500; // Vario anforderung + c2600_StepReleaseSep2 : Int := 2600; // Freigabe an Separator + c2700_WaitForCarrInPos : Int := 2700; // Warte bis Carrier den Sensor "In Position" erreicht + cCarrierDummy : Int := 1; + END_VAR + + +BEGIN + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2025). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_MTRO_Vario + Comment/Function: MainTRO-Function block for controlling TRO with Separator/VarioConveyor + Library/Family: "MainTRO" + Author: department: "Automatisierung" ; person in charge / contact: E.Yüksel, T. Molina, T.Schiller + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V18 + Restrictions: - + Requirements: (hardware, technological package, etc.) + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2024-10-01 | - | Yüksel, Molina | + 002.000.000 | 2025-03-21 | - | Yüksel | TRO Concept integration + + *) + + (* -----> + O SenInSep + Sep. 1 Conveyor + Entrance 1 -----------|----(==l==l==l==l==l==l==l==l==l==l==l==l==l==l==)---------------------------- Exit 2 + O JamSenEntry O FingerSen O LastPosSen O JamSenExit + *) + + REGION Arraygrößen + #nArrayMaxEntry := UPPER_BOUND(ARR := #arInOutJamEntr, DIM := 1); + #nArrayMaxFinger := UPPER_BOUND(ARR := #arInOutJamFinger, DIM := 1); + END_REGION + + REGION Schrittkette + + CASE #nState OF + #c0000_StepOff: + REGION 0000: Off + // akt. Zustand + #sStateText := 'OFF'; + ///////// Ausgänge ///////// + // + #xLastPosReached := FALSE; + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xVarioTrigger := FALSE; + // #xVarioReq := FALSE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + + //STATE MANAGER KÜMMERT SICH UM TRANSITION! + END_REGION + + #c0100_StepUndefined: + REGION 0100: Undefined + // akt. Zustand + #sStateText := 'Undefined'; + ///////// Ausgänge ///////// + // + #xLastPosReached := FALSE; + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xVarioTrigger := FALSE; + // #xVarioReq := FALSE; + #xMTRORdy := FALSE; + #xCodeEven := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #nState := #c1000_StepWaitForTrolley1; + END_REGION + + #c1000_StepWaitForTrolley1: + REGION 1000: Wait for Trolley + //akt. Zustand + #sStateText := 'Wait for Trolley'; + ///////// Ausgänge ///////// + + #xLastPosReached := FALSE; + #xCarrierSensorPass := FALSE; + + #xCarrierCorrectionDone := FALSE; + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xVarioReq := FALSE; + #xVarioTrigger := FALSE; + #xMTRORdy := TRUE; + #xCodeEven := FALSE; + #xOutNewScan := FALSE; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN + IF #fbSeparator1.stOutMainTro.xBtPresent THEN //Separator meldet Belegung + IF #stInSeparator1.Settings.xPluggedScanner THEN //Scanner verbaut? + #nState := #c1100_StepScannerTrig1; //Nächster Schritt -> Scannen + ELSIF #arInOutJamEntr[1].bStatus.%X0 THEN // Kein Scanner verbaut, aber Carrier online (z.B. Dummy wurde angelegt) + IF #stInSeparator1.Settings.xPluggedPart THEN + #nState := #c1300_StepCheckLoad; // Nächster Schritt -> Beladung prüfen + ELSE + #nState := #c1400_StepCheckSep1; //Nächster Schritt -> Separator chekcen + END_IF; + END_IF; + END_IF; + END_IF; + END_REGION + + (* "VarioStep_Emptying": + REGION 1500: Emptying + // akt. Zustand + #sStateText := 'Emptying'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xVarioTrigger := FALSE; + #xMTRORdy := FALSE; // Handshake an JobManager! + + ///////// Timer ////////// + + //////// Transition //////// + + IF #stInVario.SenJam.xDirectEdgePos OR #stInVario.SenNextSep.xDirectEdgePos OR #fbStateManager.tOutTimeInStep > T#20s THEN + #xVarioRelease := FALSE; + ELSE + #xVarioRelease := TRUE; + END_IF; + + IF #stInVario.SenLastPos.xDirectEdgePos AND NOT #tOfLastPos.Q AND #arInOutJamFinger[1].bStatus.%X0 THEN + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamFinger, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamExit); + END_IF; + + IF #fbConvVario.xOutConveyorReady THEN + #nState := "VarioStep_WaitForMfr"; + ELSE + #tmpReasonForStop := "Rsn_GeneralError"; + END_IF; + END_REGION *) + + #c1100_StepScannerTrig1: + REGION 1100: Scanner Trigger 1 + + // akt. Zustand + #sStateText := 'Scanner Trigger 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN //Scanner bereit + #xStartScan := TRUE; //Startbefehl + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN //Scanner Rückmeldung + #xStartScan := FALSE; + #nState := #c1200_StepScannerEval1; //Weiter + END_IF; + END_REGION + + #c1200_StepScannerEval1: + REGION 1200: Scanner Evaluation 1 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 1'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic - TODO in eigenen FC packen?.. + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader übernehmen + + REGION Event log Good read + #xGoodRead := TRUE; // Trigger + #stEventGoodRead.nScanType := 4; + #stEventGoodRead.sBarcode := DELETE(IN := DINT_TO_STRING(#nBarcodeResult), L := 1, P := 1); + #stEventGoodRead.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + END_REGION + REGION Gerade Zahl erkannt + IF (((#nBarcodeResult / 10) MOD 100) MOD 2 <> 1) THEN //anderes Ergebnis als 1 bedeutet, (xxxxxYYx) YY=gerade, also hinteres Bein von MiniTrolley + #xCodeEven := TRUE; //Bit sagt Separator dass hinteres Bein und nicht erstes zur Korrektur in Schrittkette + // #nBarcodeTarget := #nBarcodeTarget - 10; //Mache danach die gerade Zahl zur ungeraden UPDATE: WEGEN 8. ZIFFER KLAPPT DAS SO NICHT + #nBarcodeHelp := (#nBarcodeResult / 10) - 1; + + "FC_Ean8_CheckDigit"(sInDigits := DELETE(IN := DINT_TO_STRING(IN := #nBarcodeHelp), L := 1, P := 1), + sOutBarcode => #sBarcodeString, + nOutBarcode => #nBarcodeResult); + + // #sOutBarcode := #sBarcodeString; + END_IF; + END_REGION + + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr[1].nBarcode = 0 OR #arInOutJamEntr[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION_INBOUND"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation := #stInBarcodeReader.Settings.nStation, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr[1]); + // END_REGION + + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr[1].nBarcode <> 0 AND + #arInOutJamEntr[1].nBarcode <> 1 THEN + + #xTmpCorrection := TRUE; + + // REGION Carr_Glob_Correction + + // "FC_CARR_GLOB_CORRECTION_INBOUND"(xInStart := TRUE, //Führe Korrektur aus + // nInBarcodeScan := #nBarcodeResult, + // nInStation:= #stInBarcodeReader.Settings.nStation, + // arOutEventLogInfo => #arEventCorrectionInfo, + // InOutCarrierExpect := #arInOutJamEntr[1]); + // END_REGION + + // IF NOT #xTemp THEN + // ; + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // ELSE + // #arInOutJamEntr[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // // #stInOutCarrier.stCarrData.nNrOfScans += 1; + // #arInOutJamEntr[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + // #arInOutJamEntr[1].bStatus.%X0 := TRUE; + // END_IF; + + // REGION Event Log New Carrier + + // #xNewCarrier := TRUE; // Trigger + // #stEventNew.nScanType := 2; + // #stEventNew.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr[1].nBarcode), L := 1, P := 1); + // #stEventNew.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr[1].nDestination), L := 1, P := 1); + // #stEventNew.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation), L := 1, P := 1); + + // END_REGION + + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + #arInOutJamEntr[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr[1].nDestination := 123; //todo + + REGION Event Log unknown Carrier + + #xUnknownCarrier := TRUE; // Trigger + #stEventUnknown.nScanType := 3; + #stEventUnknown.sBarcode := DELETE(IN := DINT_TO_STRING(#arInOutJamEntr[1].nBarcode), L := 1, P := 1); + #stEventUnknown.sDest := DELETE(IN := INT_TO_STRING(#arInOutJamEntr[1].nDestination), L := 1, P := 1); + #stEventUnknown.sReaderId := DELETE(IN := INT_TO_STRING(#stInBarcodeReader.Settings.#nStation + 50), L := 1, P := 1); + + END_REGION + END_IF; + + #xHandshakeScan := TRUE; + + #nOutScanResult := #nBarcodeResult; + #xOutNewScan := TRUE; + ///////// Timer ////////// + + //////// Transition //////// + IF #stInSeparator1.Settings.xPluggedPart THEN + #nState := #c1300_StepCheckLoad; + ELSIF #xCodeEven THEN + #xCodeEven := FALSE; + #nState := #c2000_StepWaitForTrolley2; //Scanner bestätigt zweites Bein gelesen -> Korrigieren! + ELSE + #nState := #c1400_StepCheckSep1; + END_IF; + + END_REGION + + #c1300_StepCheckLoad: + REGION 1300: Check Load + + // akt. Zustand + #sStateText := 'Check Load'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF (#arInOutJamEntr[1].bStatus.%X1 AND #xTrolleyWithPart) OR //Daten und physikalisch -> beladen Ok! + (NOT #arInOutJamEntr[1].bStatus.%X1 AND #xTrolleyWoPart) //Daten und physikalisch -> unbeladen Ok! + THEN + #nState := #c1400_StepCheckSep1; // Weiter + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := 123; // TODO: Beladekontrolle Fehler + END_IF; + + END_REGION + + #c1400_StepCheckSep1: + REGION 1400: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #xVarioReq := TRUE; + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c1500_StepReleaseSep1; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c1500_StepReleaseSep1: + REGION 1500: Release Sep 1 + // akt. Zustand + #sStateText := 'Leave Sep 1'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #stOutPriorityManager.xTransportReq := FALSE; // Beim ersten Bein noch nicht nötig + + #xReleaseTrolleySep1 := + (NOT #fbSepWait.xOutLockSep1 AND (* #xInCarouselRun AND *)#xInSftyOk) AND // Erste Achse darf vereinzelt werden + (NOT #stInSettings.bSepType.%X0 OR + (#xInRelease AND #stInSettings.bSepType.%X0)) + AND NOT #stInVario.stSenCarrInPos.xDirectSensor AND #stInVario.stSenCarrInPos.tDirectChangeLast > T#500ms; + + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + #nState := #c2000_StepWaitForTrolley2; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + IF (#stInVario.stSenCarrInPos.xDirectSensor AND #stInVario.stSenCarrInPos.tDirectChangeLast > T#3s) + AND #fbStateManager.tOutTimeInStep > t#3s + THEN + #nState := 1600; + END_IF; + + + END_REGION + + 1600: + REGION 1600: NEU: Korrektur Vario + #xReleaseTrolleySep1 := FALSE; + + #xVarioTrigger := TRUE; + + //IF #fbStateManager.tOutTimeInStep > t#500ms THEN + IF #fbStateManager.tOutTimeInStep > t#300ms THEN + #nState := #c1500_StepReleaseSep1; + END_IF; + + END_REGION + + #c2000_StepWaitForTrolley2: + REGION 2000: Wait for Trolley 2 + //akt. Zustand + #sStateText := 'Wait for Trolley 2'; + ///////// Ausgänge ///////// + + ///////// Statics ////////// + + #xReleaseTrolleySep1 := FALSE; + #xOutNewScan := FALSE; + //Korrektur 2.Bein kommt nicht + // IF NOT #fbSeparator1.stOutMainTro.xBtPresent (* AND #xInCarouselRun *) AND NOT #stInSeparator1.Settings.xPluggedScanner AND #fbStateManager.tOutTimeInStep > T#3s THEN + // #nState := #c1000_StepWaitForTrolley1; + // END_IF; + + //Transition + IF NOT #stInOutHMI.UDT_Ctrl.xPause THEN + IF #fbSeparator1.stOutMainTro.xBtPresent AND //Separator meldet Belegung + #arInOutJamEntr[1].bStatus.%X0 // Carrier ist online + AND (#xInRelease AND NOT #stInSettings.bSepType.%X0) OR #stInSettings.bSepType.%X0 + THEN + IF #xReadSecondLeg // zweites Bein muss gelesen werden (TODO!!!!) + AND #stInSeparator1.Settings.xPluggedScanner // Scanner verbaut? + THEN + #nState := #c2100_StepScannerTrig2; // Nächster Schritt -> Scannen + ELSE + #nState := #c2300_StepCheckSep2; // Nächster Schritt -> Separator + END_IF; + END_IF; + END_IF; + END_REGION + + #c2100_StepScannerTrig2: + REGION 2100: Scanner Trigger 2 + + // akt. Zustand + #sStateText := 'Scanner Trigger 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + IF #fbBarcodeReader1.xOutReadyForNewScan THEN + #xStartScan := TRUE; + END_IF; + + ///////// Timer ////////// + + //////// Transition //////// + + IF #fbBarcodeReader1.xOutReadingDone THEN + #xStartScan := FALSE; + #nState := #c2200_StepScannerEval2; + END_IF; + END_REGION + + #c2200_StepScannerEval2: + REGION 2200: Scanner Evaluation 2 + + // akt. Zustand + #sStateText := 'Scanner Evaluation 2'; + + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + // Logic + + IF #fbBarcodeReader1.xOutCodeGood THEN + #nBarcodeResult := LINT_TO_DINT(#fbBarcodeReader1.#nOutBarcode); // Good read vom Barcode reader + ELSIF #fbBarcodeReader1.#xOutCodeBad THEN + #nBarcodeResult := #arInOutJamEntr[1].nBarcode; //erwarteter Barcode wird aus JamDaten übernommen + END_IF; + + IF (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + (#arInOutJamEntr[1].nBarcode = 0 OR #arInOutJamEntr[1].nBarcode = 1) THEN //Wenn keine Daten oder ein Dummy erwartet werden + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + + IF NOT #xTemp THEN + ; + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + ELSE + #arInOutJamEntr[1].nDestination := "cDestNONE"; //neuer Carrier // TODO + // #stInOutCarrier.stCarrData.nNrOfScans += 1; + #arInOutJamEntr[1].nBarcode := #nBarcodeResult; //Hier werden neue Carrier im System angelegt + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + END_IF; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND // Good Read (2.147.483.647 Maximum von DINT) + #arInOutJamEntr[1].nBarcode = #nBarcodeResult THEN //Barcodes stimmen überein ODER es wird hier gelandet mit BadRead wobei normaler Barcode erwartet wird-> mache normal weiter + ; + ELSIF + (#nBarcodeResult > 100) AND + (#nBarcodeResult < 2147483647) AND + #arInOutJamEntr[1].nBarcode <> #nBarcodeResult AND //Barcodes stimmen nicht überein, erwarteter Carrier enthält aber normalen Barcode + #arInOutJamEntr[1].nBarcode <> 0 AND + #arInOutJamEntr[1].nBarcode <> 1 THEN + ; + REGION TODO + (* "FC_CARR_GLOB_CORRECTION"(xInStart := TRUE, //Führe Korrektur aus + nInBarcodeScan := #nBarcodeResult, + nInStation := 0, // todo + xOutNotFound => #xTemp, + arOutEventLogInfo => #arEventCorrectionInfo, + InOutCarrierExpect := #arInOutJamEntr1[1]); *) + END_REGION + + ELSE // Bad Read, falls nichts oder Dummy erwartet wird -> HANDLING TO DO!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + #arInOutJamEntr[1].nBarcode := 2; //unbekannter Carrier mit Badread, erwartet 0 und physikalisch vorhanden + #arInOutJamEntr[1].nDestination := 123; //todo + END_IF; + + #xHandshakeScan := TRUE; + + ///////// Timer ////////// + + //////// Transition //////// + #nState := #c2300_StepCheckSep2; + + END_REGION + + #c2300_StepCheckSep2: + REGION 2300: Check Separator + // akt. Zustand + #sStateText := 'Check Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xHandshakeScan := FALSE; + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + //////// Transition //////// + #tmpActUnivTon := TRUE; + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" THEN // Separator ist bereit + #nState := #c2400_StepCheckJam; + ELSIF #fbStateManager.tOutUnivTonR > T#3s THEN + #tmpReasonForStop := "Rsn_SubError"; // SubTRO: Separator ist nicht bereit + END_IF; + + END_REGION + + #c2400_StepCheckJam: + REGION 2400: Check Jam + // akt. Zustand + #sStateText := 'Check Jam'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + + ///////// Timer ////////// + //////// Transition //////// + + IF (#stInOutJamFinger.Status.nCount = #stInOutJamFinger.Config.nCapacitySet) //Zielstaubereich ist datentechnisch voll + THEN + #tmpReasonForStop := "Rsn_JamNextError"; + ELSE + #nState := #c2500_StepWaitForConvRdy; + END_IF; + + END_REGION + + #c2500_StepWaitForConvRdy: + REGION 2500: Wait for Finger Conveyor + // akt. Zustand + #sStateText := 'Wait Finger Conv'; + ///////// Ausgänge ///////// + ///////// Statics ////////// + #xReleaseTrolleySep1 := FALSE; + // #xVarioReq := TRUE; // Anforderung an Fingerförderer + + ///////// Timer ////////// + //////// Transition //////// + IF #fbConvVario.xOutConveyorReady THEN + #nState := #c2600_StepReleaseSep2; + END_IF; + END_REGION + + #c2600_StepReleaseSep2: + REGION 2600: Leave Sep + + // akt. Zustand + #sStateText := 'Leave Sep'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + #xReleaseTrolleySep1 := #xInSftyOk AND #fbConvVario.xOutConveyorReady (* AND NOT #stInMfr.xPause *)AND + #stInOutJamFinger.Status.nCount < #stInOutJamFinger.Config.nCapacitySet AND + NOT #stInOutJamFinger.Status.bByte.%X2 AND NOT #stInOutJamEntr.Status.bByte.%X3 AND + NOT #fbSepWait.xOutLockSep1 + AND NOT #stInVario.stSenCarrInPos.xDirectSensor AND #stInVario.stSenCarrInPos.tDirectChangeLast > T#500ms; + + #xVarioTrigger := FALSE; + ///////// Timer ////////// + + // Reason for Stop + (* IF #stInMfr.xPause THEN + #tmpReasonForStop := "Rsn_MfrPausedTro"; + END_IF; *) + + IF NOT #fbConvVario.xOutConveyorReady THEN + #tmpReasonForStop := "Rsn_CarouselError"; + END_IF; + + //////// Transition //////// + IF #fbSeparator1.stOutMainTro.nStatus = "SepState_Finish" THEN + + // REGION Buchen Entry -> Finger + // "FC_Route_1"(xInSingle := FALSE, + // xInSeparate := FALSE, + // xInSepEdge := TRUE, + // xInSensor := FALSE, + // xInDelay := FALSE, + // stInCarrier := #stEmptyCarrier, + // stOutBookingInfo => #stBookingInfo, + // arJamEntr := #arInOutJamEntr, + // arOnTheWay := #arEmptyCarrier, + // arJamExit := #arInOutJamFinger); + // END_REGION + + // #xVarioTrigger := TRUE; + // #xEventLogRoute := TRUE; + // #nState := #c1000_StepWaitForTrolley1; + + //NEU!!!!!!!!!! + #xLastPosReached := TRUE; + + #nState := #c2700_WaitForCarrInPos; + ELSIF #xReleaseTrolleySep1 AND #tOnSvReleaseSep.Q THEN + #tmpReasonForStop := "Rsn_SubError"; // Timeout-Fehler im SubTRO "Separator": Freigabe erteilt, aber Separator gibt keine Rückmeldung an MainTRO + END_IF; + + IF (#stInVario.stSenCarrInPos.xDirectSensor AND #stInVario.stSenCarrInPos.tDirectChangeLast > T#3s) + AND #fbStateManager.tOutTimeInStep > t#3s + THEN + #nState := 2650; + END_IF; + + END_REGION + + 2650: + REGION 2650: NEU: Korrektur Vario + #xReleaseTrolleySep1 := FALSE; + + #xVarioTrigger := TRUE; + + //IF #fbStateManager.tOutTimeInStep > t#500ms THEN + IF #fbStateManager.tOutTimeInStep > t#300ms THEN + #nState := #c2600_StepReleaseSep2; + END_IF; + + END_REGION + + + #c2700_WaitForCarrInPos: + REGION 2700: Wait for Sensor "In Pos" + + // akt. Zustand + #sStateText := 'Wait for Sensor "In Pos"'; + + ///////// Ausgänge ///////// + ///////// Statics ////////// + + + + #xReleaseTrolleySep1 := FALSE; + ///////// Timer ////////// + + IF NOT #fbConvVario.xOutConveyorReady THEN + #tmpReasonForStop := "Rsn_CarouselError"; + END_IF; + + //////// Transition //////// + + //***********************************************// + // IF (#stInVario.stSenCarrInPos.xDbncdSensor AND #stInVario.stSenCarrInPos.tDirectChangeLast > T#1s AND #fbStateManager.tOutTimeInStep > T#1s) OR // Sensor belegt + Mindestzeit vergangen + // (#fbStateManager.tOutTimeInStep > t#3s) // Timeout + //***********************************************// + + //ÄNDERUNG!!! Kein Timeout mehr, Schrittzeit hat auch keinen Mehrwert + IF (#stInVario.stSenCarrInPos.xDbncdSensor AND (#stInVario.stSenCarrInPos.tDirectChangeLast > #stInVario.Settings.tCarrierInPosDelay)) OR //Timer ggf. umbennen, wird ansonsten aktuell nirgendwo verwendet + //#FTrig_CarrInPos.Q + #xCarrierSensorPass + THEN + #stTempCarrier := #arInOutJamEntr[1]; + + REGION Buchen Entry -> Finger + "FC_Route"(xInSingle := FALSE, + xInSeparate := FALSE, + xInSepEdge := TRUE, + xInSensor := FALSE, + xInDelay := FALSE, + stInCarrier := #stEmptyCarrier, + stOutBookingInfo => #stBookingInfo, + arJamEntr := #arInOutJamEntr, + arOnTheWay := #arEmptyCarrier, + arJamExit := #arInOutJamFinger); + END_REGION + + #xCarrierSensorPass := FALSE; + #xCarrierCorrectionDone := FALSE; + + #xBooked := TRUE; + + #xLastPosReached := FALSE; + + #xVarioTrigger := TRUE; + #xEventLogRoute := TRUE; + #nState := #c1000_StepWaitForTrolley1; + ELSIF NOT #xCarrierCorrectionDone AND #fbStateManager.tOutTimeInStep > #stInVario.Settings.tTimeOutCarrierInPos AND NOT #stInVario.stSenCarrInPos.xDirectSensor AND #stInVario.stSenCarrInPos.tDirectChangeLast > #stInVario.Settings.tTimeOutCarrierInPos THEN // Wenn wir hier stecken bleiben, könnte man eine Korrektur versuchen... z.B. zurück zu nState = 2000 + #nState := #c2000_StepWaitForTrolley2; + #tmpReasonForStop := "Rsn_SubError"; + #xCarrierCorrectionDone := TRUE; + ELSIF #xCarrierCorrectionDone AND (#fbStateManager.tOutTimeInStep > #stInVario.Settings.tTimeOutCarrierInPos) THEN + #xBtEmpty := TRUE; //es geht nicht weiter + END_IF; + END_REGION ; + + + (* // "VarioStep_CheckVario": + // REGION 2550: Check Vario + + // // akt. Zustand + // #sStateText := 'Check Vario'; + + // ///////// Ausgänge ///////// + // ///////// Statics ////////// + + // #xReleaseTrolleySep1 := FALSE; + // ///////// Timer ////////// + + // // Reason for Stop + + // //////// Transition //////// + // IF NOT #arInOutJamExit[#nArrayMaxExit].bStatus.%X0 AND NOT #stInVario.SenJam.xDbncdSensor AND + // #xLastPosReached AND NOT #stInMfr.xPause THEN //darf takten wenn letzte Position erreicht und nachfolgender Bereich frei ist + // #xLastPosReached := FALSE; + // #xVarioTrigger := TRUE; + // #nState := "VarioStep_VarioMove"; + // //vorderstes Teil (LastPos) wird in Exit-Jam geschoben + // REGION Buchen Finger -> Exit + // "FC_Route"(xInSingle := FALSE, + // xInSeparate := FALSE, + // xInSepEdge := TRUE, + // xInSensor := FALSE, + // xInDelay := FALSE, + // stInCarrier := #stEmptyCarrier, + // stOutBookingInfo => #stBookingInfo, + // arJamEntr := #arInOutJamFinger, + // arOnTheWay := #arEmptyCarrier, + // arJamExit := #arInOutJamExit); + // END_REGION + + // ELSIF NOT #xLastPosReached AND NOT #stInMfr.xPause THEN //darf takten wenn letzte Position zuvor noch nicht erreicht wurde + // REGION Takten ohne Buchen + // #xLastPosReached := FALSE; + // #xVarioTrigger := TRUE; + // #nState := "VarioStep_VarioMove"; + // END_REGION + + // END_IF; + + // END_REGION + + // "VarioStep_VarioMove": + // REGION 2575: Vario Move + + // // akt. Zustand + // #sStateText := 'Vario Move'; + + // ///////// Ausgänge ///////// + // ///////// Statics ////////// + + // #xReleaseTrolleySep1 := FALSE; + // #xVarioTrigger := FALSE; + // ///////// Timer ////////// + + + // //////// Transition //////// + + // IF #stInVario.SenLastPos.xDirectEdgePos AND NOT #tOfLastPos.Q THEN + // #xLastPosReached := TRUE; + // END_IF; + + // IF #fbConvVario.xOutConveyorReady THEN + // #nState := "VarioStep_WaitForMfr"; + // END_IF; + + // END_REGION *) + + END_CASE; + + END_REGION + + REGION Timer - Überwachungszeit + + REGION Separator + #tOnSvReleaseSep(IN := (#nState = #c1500_StepReleaseSep1 OR #nState = #c2600_StepReleaseSep2) AND #xReleaseTrolleySep1, + PT := T#3s); + END_REGION + + REGION Carrier in Pos + #tOfLastPos(IN := ((#nState = #c2600_StepReleaseSep2) OR (#nState = #c2700_WaitForCarrInPos)) AND #stInVario.stSenCarrInPos.xDirectEdgePos, + PT := #stInVario.Settings.tCarrierInPosEdgeDelay); //z.B. + + IF (#nState <> #c2600_StepReleaseSep2) AND (#nState <> #c2700_WaitForCarrInPos) THEN + RESET_TIMER(#tOfLastPos); + END_IF; + + #FTrig_CarrInPos(CLK := #tOfLastPos.Q); + + IF #FTrig_CarrInPos.Q THEN + #xCarrierSensorPass := true;//#FTrig_CarrInPos.Q; + END_IF; + END_REGION + + END_REGION + + REGION Haltegrund Schrittkette + #stActRequest.nReasonForStop := #tmpReasonForStop; //tmp aus Schrittkette übernehmen + END_REGION + + REGION Beladekontrolle + //Beladekontrolle aktiviert + IF #stInSeparator1.Settings.xPluggedPart THEN + + //Trolley beladen + #xTrolleyWithPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor + AND #stInSeparator1.stSenPart.xDirectSensor + AND #stInSeparator1.stSenPart.tDirectChangeLast > #stInSettings.tPartSenHigh; + + //Trolley nicht beladen + #xTrolleyWoPart := + #stInSeparator1.Settings.xPluggedPart AND + #stInSeparator1.stSenInSep.xDbncdSensor AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tInSenHigh AND + NOT #stInSeparator1.stSenPart.xDirectSensor; + + //Plausibel? + IF #stInSeparator1.Settings.xPluggedPart AND ((#arInOutJamEntr[1].bStatus.%X1 AND #xTrolleyWoPart) OR + (NOT #arInOutJamEntr[1].bStatus.%X1 AND #xTrolleyWithPart)) + THEN + #wErrorWord.%X2 := TRUE; + ELSE + #wErrorWord.%X2 := FALSE; + END_IF; + ELSE + #xTrolleyWithPart := #xTrolleyWoPart := FALSE; // Beladekontrolle (Sensor) nicht verbaut + END_IF; + END_REGION + + REGION Dummy Handling + + #nArrayMax := DINT_TO_INT(UPPER_BOUND(ARR := #arInOutJamEntr, DIM := 1)); + + REGION Dummy erstellen + IF #stInSettings.xIsBorner THEN + IF #nBarcodeEmpty > 1999 OR #nBarcodeEmpty < 1000 THEN + #nBarcodeEmpty := 1000; + ELSE + IF #nState = 2600 AND #fbSeparator1.xOutTrolleyReleasedEdge THEN + #nBarcodeEmpty += 1; + END_IF; + END_IF; + + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > #stInSettings.tDummyTimeBorner AND + #arInOutJamEntr[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr[1].nBarcode := #nBarcodeEmpty; + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + #arInOutJamEntr[1].nDestination := #stInSettings.nBornerDest; + END_IF; + ELSE + IF #fbSeparator1.stOutMainTro.xBtPresent AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForReq" AND + #stInSeparator1.stSenInSep.tDirectChangeLast > T#3s AND // variabel machen, Dummy immer anlegen?, Unterscheidung bei Borner? + #arInOutJamEntr[1] = #tmpCarrierEmpty + THEN + #arInOutJamEntr[1].nBarcode := #cCarrierDummy; + #arInOutJamEntr[1].bStatus.%X0 := TRUE; + END_IF; + + END_IF; + + END_REGION + + REGION Dummy löschen - ÜBERARBEITEN! + IF #nArrayMax > 1 THEN //Wenn ein einzelner Dummy oder Barcode 2 vorhanden ohne Belegung nach 2 Min löschen (Ausnahme in Qualität) + IF (#arInOutJamEntr[1].nBarcode = 1 (* #stCarrierDummy *)) + AND #arInOutJamEntr[2] = #tmpCarrierEmpty AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s + THEN + #arInOutJamEntr[1] := #tmpCarrierEmpty; + ELSIF (#arInOutJamEntr[1].nBarcode = 1 (* #stCarrierDummy *)) + AND (#arInOutJamEntr[2].nBarcode = 1 (* #stCarrierDummy *) OR #arInOutJamEntr[2].nBarcode > 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s + THEN + #arInOutJamEntr[1] := #tmpCarrierEmpty; + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arInOutJamEntr); + END_IF; + ELSIF #nArrayMax = 1 THEN + IF (#arInOutJamEntr[1].nBarcode = 1 (* #stCarrierDummy *)) AND + NOT #stInSeparator1.stSenInSep.xDirectSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#8s AND + #fbSeparator1.stOutMainTro.nStatus = "SepState_WaitForBt" AND #fbSeparator1.#fbStateManager.tOutTimeInStep > T#8s + THEN + #arInOutJamEntr[1] := #tmpCarrierEmpty; + END_IF; + END_IF; + + END_REGION + + END_REGION + + REGION Monitoring + + REGION Carrier kommt nicht an / Daten ohne Belegung + + #tOnMonCarrArrive(IN := #arInOutJamEntr[1].bStatus.%X0 AND NOT #stInSeparator1.stSenInSep.xDirectSensor, + PT := #stInSeparator1.Settings.tDelayToNextItem, + Q => #wErrorWord.%X10); //TODO + + #fbMonitoringCarrNotArrive.stSettings.nErrorType := 1; + #fbMonitoringCarrNotArrive.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrNotArrive.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrNotArrive(sInFctnName := '', + wInTextListId_Function := 1000, + wInTextListId_Message := 1000, + sInPrefix := #stInOutHMI.UDT_Config.sName, + sInSuffix := #stInOutHMI.UDT_Separator1.stConfig.sName, + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X10, + sInAlarmMessage := 'Carrier kommt nicht am Separator an', + InOutMachineState := #stInOutMachineState); + + END_REGION + + REGION Carrier ohne Daten + + IF #stInSeparator1.stSenInSep.xDbncdSensor AND #stInSeparator1.stSenInSep.tDirectChangeLast > T#5s AND NOT #arInOutJamEntr[1].bStatus.%X0 THEN + #wErrorWord.%X5 := TRUE; + ELSE + #wErrorWord.%X5 := FALSE; + END_IF; + + #fbMonitoringCarrWoData.stSettings.nErrorType := 1; + #fbMonitoringCarrWoData.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrWoData.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrWoData(sInFctnName := '', + wInTextListId_Function := 1000, + wInTextListId_Message := 1001, + sInPrefix := #stInOutHMI.UDT_Config.sName, + sInSuffix := #stInOutHMI.UDT_Separator1.stConfig.sName, + InOutMachineState := #stInOutMachineState, + xInQuitError := #stInOutMachineState.xQuitError, + xInSignal := NOT #wErrorWord.%X5, + sInAlarmMessage := 'Sep-Belegung ohne Daten'); + END_REGION + + REGION MT in Pos + #fbAlarmVarioMTinPos.stSettings.nNoMaxErrors := 1; + #fbAlarmVarioMTinPos.stSettings.nType := 1; + #fbAlarmVarioMTinPos.stSettings.sFctnName := ''; + #fbAlarmVarioMTinPos(xInAlarm := #xBtEmpty, + nInAlarmNumber := 0, + sInPrefix := #stInOutHMI.UDT_Vario1.stConveyor.sConveyorName, + sInSuffix := '', //todo mt in pos sensor name + wInTextListId_Message := 300, + wInTextListId_Function := 300, + stInOutControlUnitCabinet := #stInOutMachineState); + END_REGION + + + END_REGION + + REGION Motorüberwachung - todo + IF #nState = 40000 AND #fbStateManager.tOutTimeInStep > T#4s THEN + #xErrorMotor := TRUE; + ELSE + #xErrorMotor := FALSE; + END_IF; + END_REGION + + REGION Fahrbedingungen für Vario + + // IF #arInOutJamExit[1].bStatus.%X0 AND + // NOT #stInVario.SenJam.xDirectSensor AND #stInVario.SenJam.tDirectChangeLast > #stInVario.Settings.tFreeJam AND + // NOT #stInVario.SenNextSep.xDirectSensor AND #stInVario.SenNextSep.tDirectChangeLast > #stInVario.Settings.tFreeNextSep AND + // NOT #stInVario.SenSepVario.xDirectSensor AND #stInVario.SenSepVario.tDirectChangeLast > #stInVario.Settings.tFreeVarioSep THEN + // #xVarioRelease := TRUE; + // ELSE + // #xVarioRelease := FALSE; + // END_IF; + + END_REGION + + REGION Wartezeit Separator + + #fbSepWait.stInTimes.tFreeSen1 := #stInSeparator1.Settings.tSenFree; + #fbSepWait.stInTimes.tTimerWait := #stInSeparator1.Settings.tSenWait; + #fbSepWait(stInSensor1:=#stInSeparator1.stSenInSep, + xInConvActive:=TRUE); + + END_REGION + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #c0100_StepUndefined; + #fbStateManager.stInSettings.nStartStateTestMode := #c0000_StepOff; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := #stInOutMachineState.xRunning, // AND #xInSftyOk, + xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInReset, + xInRunUnivTOn := #tmpActUnivTon, + xInTestMode := #xInTestMode, + nInOutState := #nState); + + END_REGION + + REGION Aufruf der Sub-TROs + + REGION Separator 1 + + #fbSeparator1(xInReset := #stInOutHMI.UDT_Ctrl.xReset OR #xInReset, + xInErrQuit := #stInOutHMI.UDT_Ctrl.xErrorQuit OR #xInErrorQuit, + stInOutMainState := #stInOutMachineState, + stInSettings := #stInSeparator1.Settings, + xInConveyorRun := TRUE, //Gefälle... + stInTrolley := #stInSeparator1.stSenInSep, + xInReceiveReady := #xReleaseTrolleySep1, + stInOutHMI := #stInOutHMI.UDT_Separator1, + stInOutCarrDataInJam := #arInOutJamEntr); + + #stInOutHMI.UDT_Separator1.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + #stInOutHMI.UDT_Separator2.stStatus.xNullBt := #stInOutHMI.UDT_Ctrl.xPause; + + IF #nState >= 1000 AND #nState < 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := FALSE; //1.Bein + ELSIF #nState >= 2000 THEN + #stInOutHMI.UDT_Separator1.stStatus.xMiniTrolley := TRUE; //2.Bein + END_IF; + + END_REGION + + REGION Vario Förderer + + #fbConvVario(stInSettings := #stInVario.Settings, + xInAutomatic := #xInAutomatic, + xInErrorQuit := #xInErrorQuit OR #stInOutHMI.UDT_Ctrl.xErrorQuit, + xInReleaseEdge := #xVarioTrigger, // Separator Release Edge + stInSenConvFingerInPos := #stInVario.stSenFinger, + stInSenJam := #stInVario.stSenJam, + stInSenLastPos := #stInVario.stSenLastPos, + stInSenCarrInPos := #stInVario.stSenCarrInPos, + xInRequest := #xVarioReq AND (NOT #fbSepWait.xOutLockSep1 OR #xLastPosReached), //AND NOT #stInOutHMI.UDT_Separator1.stControl.xLockSeparator, + xInMotorProtection := #xInMotorProtection, + xOutMotor => #xOutVarioMotor, + stInOutControlUnitCabinet:= #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_Vario1, + arInOutJamFinger:=#arInOutJamFinger); + + END_REGION + + REGION Barcode Reader 1 + #fbBarcodeReader1(stInSettings := #stInBarcodeReader.Settings, + xInReset := #stInOutHMI.UDT_Ctrl.xReset, + xInHWError := false, // todo + xInStartReading := #xStartScan, + xInHandshakeDone := #xHandshakeScan, + stInOutInterface := #stInOutCognexInterface, + stInOutControlUnitCabinet := #stInOutMachineState, + stInOutHMI := #stInOutHMI.UDT_BarcodeReader1); + END_REGION + + END_REGION + + REGION BT zählen - NIU + + CASE #stActRequest.nDirection OF + 0: + #stActRequest.nActNoStopper := 0; + 1: + #stActRequest.nActNoStopper := UDINT_TO_USINT(#fbSeparator1.stOutMainTro.nCounterBt - #stActRequest.nCntAtStartSep1); + END_CASE; + + + END_REGION + + REGION HMI + #stInOutHMI.UDT_Config.nTroType := 5; //Vario + + #stInOutHMI.UDT_State.nState := #nState; + #stInOutHMI.UDT_State.sState := #sStateText; + + #stInOutHMI.UDT_State.xError := // Error TRO -> + #fbSeparator1.wOutErrorWord > 0 OR // Error Separator + #stInOutHMI.UDT_Separator1.stStatus.bStatus = 2 OR //Error Separator + #wErrorWord.%X5 OR //Belegung ohne Daten + #wErrorWord.%X10 OR // Carrier kommt nicht an + #xBtEmpty OR + #stInOutHMI.UDT_BarcodeReader1.bStatus = 2 OR //Error Reader + #fbConvVario.wOutErrorWord > 0; // Vario Error + + END_REGION + + REGION Ausgänge schreiben + #xOutBooked := #xBooked; + #stOutLastCarrier := #stTempCarrier; + + REGION Output + + #xOutStopper := #fbSeparator1.xOutStopper; + #xOutJamAtEntry1 := #fbSeparator1.stOutMainTro.xJamAtEntry; + #xOutCorrection := #xTmpCorrection; + // #xOutCarouselReq := ((#nState >= "VarioStep_CheckCorrectBt" AND #nState <= "VarioStep_LeaveSep")) (* AND + // NOT #stInMfr.xPause *); + + END_REGION + + END_REGION + + REGION Event Logs + REGION Event: Route (Umbuchung) + #stBookingInfo.sJamSrc := #stInSettings.sJamSrc; + #stBookingInfo.sJamDest := #stInSettings.sJamDest; + #fbEventLog_Route(xInTrigger := #xEventLogRoute, + stInEventBookingInfo := #stBookingInfo); + END_REGION + END_REGION + + // Pro Event wird ein Aufruf benötigt + REGION Korrekturvorgänge loggen + + #fbEventLogCorrection1(xInTrigger := #arEventCorrectionInfo[0].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[0]); + + #fbEventLogCorrection2(xInTrigger := #arEventCorrectionInfo[1].xTrigger, + stInEventCorrectionInfo := #arEventCorrectionInfo[1]); + + END_REGION + + #fbEventLogCarrierUnknown(xInTrigger := #xUnknownCarrier, + stInEventScanInfo := #stEventUnknown); + + #fbEventLogCarrierNew(xInTrigger := #xNewCarrier, + stInEventScanInfo := #stEventNew); + + #fbEventLogGoodRead(xInTrigger := #xGoodRead, + stInEventScanInfo := #stEventGoodRead); + + REGION Letzten Schritt wegschreiben + #nOutStateLast := #fbStateManager.nStateLast; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.libinfo b/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.libinfo new file mode 100644 index 0000000..5cfb100 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 61279537-838f-481a-b050-d5fb621f0c51 + Comment: + de-DE: Spezial TRO mit SSCC +LibraryVersion: + VersionNumber: 0.0.6 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Spezial TRO mit SSCC diff --git a/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.libint b/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.libint new file mode 100644 index 0000000..232b969 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.libint @@ -0,0 +1,19 @@ +DocumentHash: + - FileName: FB_SsccBarcodeReader.scl + Hash: s4Af9OzYrvEKvlTQhFvtyxRQaXTM+eaAWgKjTuKcPc4= +LibraryMetaFileHash: mkFaUnatdEjxr6uhF/FwU8O4IU0JFGOxZWgP7l7jJcc= +LibraryVersion: + Guid: 2695c196-6166-42c7-8d1e-1f7bc4316779 + DependsOn: + - TypeName: UDT_SettingsBarcodeReader + VersionNumber: 2.0.0 + - TypeName: stCognexInterface + VersionNumber: 2.0.0 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: UDT_BarcodeReader + VersionNumber: 2.0.1 + - TypeName: stHMI_BRCognexDM + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 diff --git a/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.scl b/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.scl new file mode 100644 index 0000000..62d4634 --- /dev/null +++ b/2_ILSLib/FB/MTRO/FB_SsccBarcodeReader.scl @@ -0,0 +1,524 @@ +FUNCTION_BLOCK "FB_SsccBarcodeReader" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : "UDT_SettingsBarcodeReader"; + xInBorner : Bool; // NIU + xInStartReading : Bool; // Starte Lesevorgang + xInHandshakeDone : Bool; // Lesevorgang beendet Handshake rein + xInErrQuit : Bool; // Fehler rücksetzen + xInReset : Bool; // Baustein zurücksetzen + xInHWError : Bool; // Baugruppen Fehler + tInPlcTime {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; // SPS Zeit (z.B. für Zeitstempel) + END_VAR + + VAR_OUTPUT + xOutReadingDone : Bool; // Lesevorgang abgeschlossen / Handshake raus + xOutReadyForNewScan : Bool; // Reader ist bereit für Leseanforderung + nOutBarcode : LInt; // Letzter gelesener Barcode + sOutBarcode : String[20]; // Letzter gelesener Barcode (als Zeichenkette) + wOutErrorWord : Word; // Fehlercode + xOutCodeGood : Bool; // NIU + xOutCodeBad : Bool; // NIU + END_VAR + + VAR_IN_OUT + stInOutInterface : "stCognexInterface"; + stInOutControlUnitCabinet : "UDT_MainState"; + stInOutHMI : "UDT_BarcodeReader"; + END_VAR + + VAR + GETIO_PART {InstructionName := 'GETIO_PART'; LibVersion := '1.2'; ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : GETIO_PART; + xStartReading : Bool; + xTrigger : Bool; + xToggleBitFlg : Bool; + nBarcode : LInt; + sBarcodeString : String[20] := 'none'; + SETIO_PART {InstructionName := 'SETIO_PART'; LibVersion := '1.2'; ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : SETIO_PART; + stCtrlBitsIn : Struct + D0_DeviceReady : Bool; + D1_SystemReady : Bool; + D2_GoodRead : Bool; + D3_NoRead : Bool; + D4_ExtOut1 : Bool; + D5_ExtOut2 : Bool; + D6_Result1 : Bool; + D7_Result2 : Bool; + D8_ExtIn1 : Bool; + D9_ExtIn2 : Bool; + D10_Sensor1 : Bool; + D11_Sensor2 : Bool; + D12_Res : Bool; + D13_Res : Bool; + D14_Res : Bool; + D15_Toggle : Bool; + END_STRUCT; + nState : Int; + nLastStep { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Int; + arStepHistory : Array[0..10] of Struct + StepNum : Int; + TimeStamp {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; + END_STRUCT; + nResultID : Int; + nResultCode : Int; + nResultExtended : Int; + "64Byte_IN_Data" { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Array[0..63] of Byte; + tOnMonitoring {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + stHMI : "stHMI_BRCognexDM"; + fbMonitoringCamGeneralFault : "FB_Monitoring"; + fbMonitoringCamRuntimeFail : "FB_Monitoring"; + stStatistics : Struct + nReads : UDInt; + nGoodRead : UDInt; + nBadRead : UDInt; + nGoodReadBarcodeChanged : UDInt; + nBadReadBarcodeChanged : UDInt; + tLastBarcodeRecv {InstructionName := 'DTL'; LibVersion := '1.0'; ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : DTL; + tLastNoReadRecv {InstructionName := 'DTL'; LibVersion := '1.0'; ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : DTL; + tLastReset {InstructionName := 'DTL'; LibVersion := '1.0'; ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : DTL; + END_STRUCT; + tPLCTime {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; + END_VAR + VAR RETAIN + xReInit : Bool; + END_VAR + VAR + xCodeGood : Bool; + xCodeBad : Bool; + nBarcodeTarget : DInt; + sBarcodeTarget : String; + stTest : Struct + nGoodRead : Int; + nBadRead : Int; + nGoodReadBarcodeChanged : Int; + nBadReadBarcodeChanged : Int; + END_STRUCT; + END_VAR + + VAR_TEMP + tReadIO_Status : DWord; + tReadIO_Error : Bool; + tWriteIO_Status_01 : DWord; + tWriteIO_Error_01 : Bool; + t_BC_iO : Bool; + t_BC_niO : Bool; + t_Format : Word; + t_Status : Int; + t_Time : Int; + xTemp : Bool; + END_VAR + + VAR CONSTANT + "E_DeviceState.eInit2" : Int := 100; + "E_DeviceState.eInit1" : Int := 0; + "E_DeviceState.eNoJob" : Int := 200; + "E_DeviceState.eWaitReaderReady" : Int := 300; + "E_DeviceState.eWaitTriggerAck" : Int := 400; + "E_DeviceState.eGetResult" : Int := 500; + "E_DeviceState.eClearResult" : Int := 600; + "E_DeviceState.eOutput" : Int := 700; + "E_DeviceState.eHandshake" : Int := 800; + END_VAR + + +BEGIN + REGION Block Header + //================================================================================= + // Schönenberger Systeme GmbH / (c)Copyright 2025 + //--------------------------------------------------------------------------------- + // Title: FB_BarcodeReaderCognex + // Comment/Function: Cognex Barcode Reader + // Library/Family: BaseSystemLib/PROFINET/Devices + // Author: E.Yüksel + // Tested with: CPU 1515F-2 PN FW:V3.0 + // Engineering: TIA Portal V20 + // Restrictions: This function block ONLY works with Cognex Dataman Readers and PROFINET protocol + // Currently ONLY designed for Cognex trigger mode: Continuous + // Requirements: PLC (S7-1500) + //--------------------------------------------------------------------------------- + // Change log table: + // Version | Date | Expert in charge | Changes applied + //----------|------------|------------------------|-------------------------------- + // 01.00.00 | 25.04.2024 | Yüksel, Molina | First released version + // 02.00.00 | 20.11.2024 | Yüksel | Prepare for library integration + // 03.00.00 | 31.01.2025 | Yüksel | Refactoring, no functionality changes + //================================================================================= + END_REGION + + REGION Info + (* + Errors: + 00 Internal Error / Stepfailure + 01 Results available before trigger + 02 Runtime failure + 03 Barcode ASCI failure + 04 Res 4 + 05 ReadIO_Error + 06 Res 6 + 07 Res 7 + 08 Res 8 + 09 Res 9 + 10 Res 10 + 11 Res 11 + 12 Res 12 + 13 Res 13 + 14 Camera not ready / General Fault + 15 Modul reset + *) + END_REGION + + REGION INIT + REGION First Scan + IF "FirstScan" THEN + #nState := #"E_DeviceState.eInit1"; + END_IF; + END_REGION + + REGION Reset statistics + IF NOT #xReInit AND NOT "FirstScan" AND #tInPlcTime.YEAR > 1970 THEN + #stStatistics.nReads := 0; + #stStatistics.nGoodRead := 0; + #stStatistics.nBadRead := 0; + #stStatistics.nGoodReadBarcodeChanged := 0; + #stStatistics.nBadReadBarcodeChanged := 0; + #stStatistics.tLastBarcodeRecv := DTL#1970-01-01-00:00:00; + #stStatistics.tLastNoReadRecv := DTL#1970-01-01-00:00:00; + #stStatistics.tLastReset := DTL#1970-01-01-00:00:00; + + #xReInit := TRUE; + #stStatistics.tLastReset := #tInPlcTime; + END_IF; + END_REGION + + END_REGION + + REGION ErrorQuitt + IF #xInErrQuit THEN + #wOutErrorWord := 0; + END_IF; + END_REGION + + REGION reset step sequence + IF #xInReset THEN + #nState := #"E_DeviceState.eInit1"; + #wOutErrorWord := 0; + #wOutErrorWord.%X15 := TRUE; + END_IF; + END_REGION + + REGION Err check camera ready + #wOutErrorWord.%X14 := #stInOutInterface.#xInCamGeneralFault; + END_REGION + REGION stepsequence + + CASE #nState OF + #"E_DeviceState.eInit1": + REGION STEP 000 - INIT 1 + #xOutReadyForNewScan := FALSE; + #xCodeBad := FALSE; + #xCodeGood := FALSE; + #xOutReadingDone := FALSE; + #stInOutInterface.xOutCamTriggerEnable := FALSE; + #stInOutInterface.xOutCamTrigger := FALSE; + #stInOutInterface.xOutCamResultsAck := FALSE; + #nOutBarcode := #nBarcode := 0; + #sOutBarcode := #sBarcodeString := ''; + + #wOutErrorWord := 0; // no Error + + #nState := #"E_DeviceState.eInit2"; //Lade aktuelle Schrittnummer + END_REGION + #"E_DeviceState.eInit2": + REGION STEP 100 - INIT 2 + #xOutReadyForNewScan := FALSE; + #xCodeBad := FALSE; + #xCodeGood := FALSE; + #xOutReadingDone := FALSE; + #stInOutInterface.xOutCamTriggerEnable := FALSE; + #stInOutInterface.xOutCamTrigger := FALSE; + #stInOutInterface.xOutCamResultsAck := TRUE; // Reader Ergebnisse quittieren + #nOutBarcode := #nBarcode := 0; + #sOutBarcode := #sBarcodeString := ''; + + //Transition + IF + NOT #stInOutInterface.xInCamResultsAvailable + THEN + #nState := #"E_DeviceState.eNoJob"; //Lade aktuelle Schrittnummer + END_IF; + END_REGION + #"E_DeviceState.eNoJob": + REGION STEP 200 - IDLE + #xCodeBad := FALSE; + #xCodeGood := FALSE; + IF #stInOutInterface.xInCamResultsAvailable OR #xInErrQuit THEN + #stInOutInterface.xOutCamResultsAck := TRUE; + ELSE + #stInOutInterface.xOutCamResultsAck := FALSE; + END_IF; + + //#stInOutInterface.xOutCamResultsAck := #xInErrQuit; + #stInOutInterface.xOutCamTriggerEnable := FALSE; + #stInOutInterface.xOutCamTrigger := FALSE; + #xOutReadingDone := FALSE; + + #nBarcode := #nOutBarcode := 0; + + #xOutReadyForNewScan := TRUE; + + //Transition + IF #xInStartReading THEN // Leseanforderung + #nState := #"E_DeviceState.eWaitReaderReady"; //Lade aktuelle Schrittnummer + END_IF; + END_REGION + #"E_DeviceState.eWaitReaderReady": + REGION STEP 300 - WAIT READER READY + #xOutReadyForNewScan := FALSE; + #stInOutInterface.xOutCamTriggerEnable := TRUE; // Freigabe an Barcode Reader + #stInOutInterface.xOutCamResultsAck := FALSE; + + #wOutErrorWord.%X1 := #stInOutInterface.xInCamResultsAvailable; // Fehler wenn es schon Ergebnisse gibt + + //Transition + IF #stInOutInterface.xInCamTriggerReady THEN // Barcode Reader meldet bereit + #stInOutInterface.xOutCamTrigger := TRUE; // Barcode Reader triggern + #nState := #"E_DeviceState.eWaitTriggerAck"; + END_IF; + END_REGION + #"E_DeviceState.eWaitTriggerAck": + REGION STEP 400 - WAIT TRIGGER ACK + #xOutReadyForNewScan := FALSE; + #stInOutInterface.xOutCamTrigger := TRUE; + + //Transition + IF #stInOutInterface.xInCamTriggerAck THEN + #nState := #"E_DeviceState.eGetResult"; + END_IF; + END_REGION + #"E_DeviceState.eGetResult": + REGION STEP 500 - GET RESULT + // INFO: + // Beim Continous-Trigger (Modus der am Barcode Reader eingestellt wird) muss das Trigger-Signal im Gegensatz zum Single-Trigger immer high bleiben. + // Der Reader macht kontinuierlich Bilder und hört erst auf, wenn etwas gelesen wurde oder man den Trigger wegnimmt (z.B. nach Timeout) + // #stInOutInterface.xOutCamTrigger := #xInStartReading; + + + // Auf Ergebnis warten... + IF #stInOutInterface.xInCamResultsAvailable THEN // Ergebnis ist da + #stInOutInterface.xOutCamTrigger := FALSE; // Trigger wegnehmen + + REGION Read data + #GETIO_PART(ID := #stInOutInterface.hwInCamInspectionResults, //Einlesen IN 64 Byte Daten + OFFSET := 0, + LEN := 64, + STATUS => #tReadIO_Status, + ERROR => #wOutErrorWord.%X5, + INPUTS := #"64Byte_IN_Data"); + + Chars_TO_Strg(Chars := #"64Byte_IN_Data", + pChars := 8, //Zeichen ab 8.Byte InData + Cnt := 20, //10 Zeichen + Strg => #sBarcodeString); + END_REGION + + REGION Evaluation (+ optional check Ascii) + // ok - ASCI Zeichenprüfung 0 = 48 ... 9 = 57 + IF NOT #stInSettings.xActivateCheckASCI OR // next Step wenn ASCI Prüfung nicht aktiv + (#"64Byte_IN_Data"[08] >= 48 AND //Prüfung 1. Zeichen auf Zahlen größer/gleich 0 + #"64Byte_IN_Data"[08] <= 57 AND //Prüfung 1. Zeichen auf Zahlen kleiner/gleich 9 + + #"64Byte_IN_Data"[15] >= 48 AND //Prüfung 10. Zeichen auf Zahlen kleiner/gleich 0 + #"64Byte_IN_Data"[15] <= 57) //Prüfung 10. Zeichen auf Zahlen kleiner/gleich 9 + THEN + REGION SUCCESS + #stStatistics.tLastBarcodeRecv := #tInPlcTime; + #stStatistics.nReads += 1; + #stStatistics.nGoodRead += 1; + #xCodeGood := TRUE; + #wOutErrorWord.%X3 := FALSE; + REGION Convert to Integer + STRG_VAL(IN := #sBarcodeString, //Barcode nach DWord + FORMAT := w#16#0, + P := 1, //Ab Zeichen 1 bis zu Ungültigem wert umwandeln // + OUT => #nBarcode); + END_REGION + END_REGION + + ELSE + REGION FAIL / BAD + #stStatistics.nReads += 1; + #stStatistics.nBadRead += 1; + #stStatistics.tLastNoReadRecv := #tInPlcTime; + #wOutErrorWord.%X3 := TRUE; // Fehler ASCI Prüfung! zb NoRead von Cam + #xCodeBad := TRUE; + #nBarcode := -1; + #sBarcodeString := 'NOREAD'; // NEU + END_REGION + + END_IF; + + END_REGION + + REGION Acknowledge & Transition + //Transition + #stInOutInterface.xOutCamResultsAck := TRUE; + #nState := #"E_DeviceState.eClearResult"; + END_REGION + + END_IF; + END_REGION + + #"E_DeviceState.eClearResult": + REGION STEP 600 - CLEAR RESULT + #stInOutInterface.xOutCamResultsAck := TRUE; //Leseergebnis quittieren + + //Transition + IF + NOT #stInOutInterface.xInCamResultsAvailable // Auf Handshake warten + THEN + #nState := #"E_DeviceState.eOutput"; // Nächster Schritt + END_IF; + END_REGION + + #"E_DeviceState.eOutput": + REGION STEP 700 - WRITE OUTPUT + #xOutReadyForNewScan := FALSE; + #stInOutInterface.xOutCamTriggerEnable := FALSE; // Freigabe wegnehmen + #stInOutInterface.xOutCamTrigger := FALSE; + + #nOutBarcode := #nBarcode; + #sOutBarcode := #sBarcodeString; + + #xOutReadingDone := TRUE; + + //Transition + #nState := #"E_DeviceState.eHandshake"; + + END_REGION + #"E_DeviceState.eHandshake": + REGION STEP 800 - HANDSHAKE + #xOutReadyForNewScan := FALSE; + #xOutReadingDone := TRUE; + #stInOutInterface.xOutCamTriggerEnable := FALSE; // Freigabe wegnehmen + #stInOutInterface.xOutCamTrigger := FALSE; + IF #xInHandshakeDone THEN // Handshake + #nState := #"E_DeviceState.eNoJob"; + END_IF; + END_REGION + ELSE //keine gültige Schrittnummer vorhanden + #wOutErrorWord.%X0 := true; + END_CASE; + + REGION Step history + IF + #nState <> #nLastStep + THEN + #t_Status := MOVE_BLK_VARIANT(SRC := #arStepHistory, + COUNT := 10, + SRC_INDEX := 0, + DEST_INDEX := 1, + DEST => #arStepHistory); + #t_Status := RD_LOC_T(#arStepHistory[0].TimeStamp); //Zeitstempel + #arStepHistory[0].StepNum := #nState; + #nLastStep := #nState; + END_IF; + END_REGION + END_REGION + + REGION Output + #xOutCodeGood := #xCodeGood; + #xOutCodeBad := #xCodeBad; + END_REGION + + REGION Runtime monitoring + IF #tOnMonitoring.Q THEN // TIMEOUT + #stStatistics.nReads += 1; + #stStatistics.nBadRead += 1; + #stStatistics.tLastNoReadRecv := #tInPlcTime; + #xCodeBad := TRUE; + #wOutErrorWord.%X2 := TRUE; // Runtime failure + #nBarcode := -1; + #sBarcodeString := 'NOREAD'; + #nState := #"E_DeviceState.eOutput"; + END_IF; + END_REGION + + REGION HMI / Visu + + #stHMI.In16.%X0 := #stInOutInterface.xInCamTriggerReady; + #stHMI.In16.%X1 := #stInOutInterface.xInCamTriggerAck; + #stHMI.In16.%X2 := #stInOutInterface.xInCamResultsAvailable; + #stHMI.In16.%X3 := #stInOutInterface.xInCamGeneralFault; + #stHMI.BarcodeString := #sBarcodeString; + #stHMI.Barcode := #nBarcode; + #stHMI.ResultID := #nResultID; + #stHMI.ErrorWord := #wOutErrorWord; + + IF #stInOutInterface.xInCamGeneralFault OR #xInHWError THEN // Kamera nicht bereit + #stInOutHMI.bStatus := 2; // ERROR + ELSE + CASE #nState OF + #"E_DeviceState.eInit1", #"E_DeviceState.eInit2": + #stInOutHMI.bStatus := 0; // NOT_AVAILABLE + #"E_DeviceState.eNoJob", #"E_DeviceState.eWaitReaderReady", #"E_DeviceState.eWaitTriggerAck", + #"E_DeviceState.eGetResult", #"E_DeviceState.eClearResult", #"E_DeviceState.eOutput", + #"E_DeviceState.eHandshake": + #stInOutHMI.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutHMI.bStatus := 0; // NOT AVAILABLE + END_CASE; + END_IF; + + #stInOutHMI.nMode := 2; // Continuous + #stInOutHMI.stBRInterface := #stHMI; + #stInOutHMI.nNumberScans := #stStatistics.nReads; + #stInOutHMI.nNumberNoReads := #stStatistics.nBadRead; + #stInOutHMI.nNoReadPercentage := REAL_TO_USINT((UDINT_TO_REAL(#stStatistics.nBadRead) / UDINT_TO_REAL(#stStatistics.nReads)) * 100); + #stInOutHMI.tLastBarcodeRecv := #stStatistics.tLastBarcodeRecv; + #stInOutHMI.tLastNoReadRecv := #stStatistics.tLastNoReadRecv; + #stInOutHMI.tLastReset := #stStatistics.tLastReset; + + END_REGION + + REGION Timer + #tOnMonitoring(IN := #stInOutInterface.xOutCamTriggerEnable, + PT := #stInSettings.tTimeout); + END_REGION + + REGION Monitoring + + #fbMonitoringCamRuntimeFail.stSettings.nErrorType := 2; + #fbMonitoringCamRuntimeFail.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCamRuntimeFail.stSettings.xSelfQuit := TRUE; + #fbMonitoringCamRuntimeFail(sInFctnName := CONCAT_STRING(IN1 := 'Barcode Reader: ', IN2 := #stInOutHMI.sLocation), + sInPrefix := #stInOutHMI.sUnit, + sInSuffix := #stInOutHMI.sIpAdress, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError, + xInSignal := NOT #tOnMonitoring.Q, + sInAlarmMessage := 'Laufzeitfehler', + wInTextListId_Function := 1, + wInTextListId_Message := 1); + + #fbMonitoringCamGeneralFault.stSettings.nErrorType := 1; + #fbMonitoringCamGeneralFault.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCamGeneralFault.stSettings.xSelfQuit := TRUE; + #fbMonitoringCamGeneralFault(sInFctnName := CONCAT_STRING(IN1 := 'Barcode Reader: ', IN2 := #stInOutHMI.sLocation), + sInPrefix := #stInOutHMI.sUnit, + sInSuffix := #stInOutHMI.sIpAdress, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError, + xInSignal := NOT #stInOutInterface.xInCamGeneralFault AND NOT #xInHWError, + sInAlarmMessage := 'Barcode Reader ist nicht bereit.', + wInTextListId_Function := 1, + wInTextListId_Message := 1); + + END_REGION + + REGION Event Log + // Pro Event wird ein Aufruf benötigt + //TODO + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/MTRO/UDT_MFRCtrl.libinfo b/2_ILSLib/FB/MTRO/UDT_MFRCtrl.libinfo new file mode 100644 index 0000000..9c8280f --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRCtrl.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 0678257d-ddb5-460a-a4ac-69f4da95e1e7 +LibraryVersion: + VersionNumber: 2.0.2 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/MTRO/UDT_MFRCtrl.libint b/2_ILSLib/FB/MTRO/UDT_MFRCtrl.libint new file mode 100644 index 0000000..6074f0a --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRCtrl.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_MFRCtrl.xml + Hash: ia5Ybmih6KUb1UAZCcNHmDSCf8mh/M7Bn3w0vece/M0= +LibraryMetaFileHash: BORJ8JsdQ/k3ai0U6lB0Sv0RU0X0W14y7rsAafJm/es= +LibraryVersion: + Guid: 49f2be50-381b-4393-8619-be5f49876873 diff --git a/2_ILSLib/FB/MTRO/UDT_MFRCtrl.xml b/2_ILSLib/FB/MTRO/UDT_MFRCtrl.xml new file mode 100644 index 0000000..5098eea --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRCtrl.xml @@ -0,0 +1,85 @@ + + + + + + +
+ + + Freigabe an TRO + + + + + Linie + + + + + Modus (0: Undefiniert | 1: Job mit Anzahl | 2: RapidFire (bis xStart = False) | 3: Initialisieren/Entleeren + + + + + Anzahl die gefahren werden soll bei Modus 1 + + + + + Offset für die Anzahl die gefahren werden soll bei Modus 1 (nAmount + nAmountOffset) + + +
+
+ UDT_MFRCtrl + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/FB/MTRO/UDT_MFRScanResult.libinfo b/2_ILSLib/FB/MTRO/UDT_MFRScanResult.libinfo new file mode 100644 index 0000000..f65de36 --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRScanResult.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: b7c68d43-4365-44de-ab7f-fba3395c1007 +LibraryVersion: + VersionNumber: 2.0.2 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/MTRO/UDT_MFRScanResult.libint b/2_ILSLib/FB/MTRO/UDT_MFRScanResult.libint new file mode 100644 index 0000000..cf2c067 --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRScanResult.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_MFRScanResult.xml + Hash: 3CXSh2gEmrywZl/NhspsHfrtRA9IJ/668JI9dxJpplU= +LibraryMetaFileHash: cunPZD1SOwG27X/vitI7uTFs5V3rKtgCnFWGZ8YQgFc= +LibraryVersion: + Guid: b555681d-cc30-4f08-a0b2-dee1619f6f91 diff --git a/2_ILSLib/FB/MTRO/UDT_MFRScanResult.xml b/2_ILSLib/FB/MTRO/UDT_MFRScanResult.xml new file mode 100644 index 0000000..208a53c --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRScanResult.xml @@ -0,0 +1,75 @@ + + + + + + +
+ + + MFR Baustein ist beschäftigt + + + + + Neuer Carrier vom TRO gemeldet + + + + + Barcode vom Carrier der gemeldet wird + + +
+
+ UDT_MFRScanResult + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/FB/MTRO/UDT_MFRState.libinfo b/2_ILSLib/FB/MTRO/UDT_MFRState.libinfo new file mode 100644 index 0000000..e810f05 --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRState.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 54786651-aad8-47a2-81cb-747f166d4061 +LibraryVersion: + VersionNumber: 2.0.2 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/MTRO/UDT_MFRState.libint b/2_ILSLib/FB/MTRO/UDT_MFRState.libint new file mode 100644 index 0000000..355e90a --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRState.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_MFRState.xml + Hash: WUhPfKonCfTHnOx6tuyEMcX/KIOeL90x3dB0Vv9YAgw= +LibraryMetaFileHash: vg0jMdA+dQlp3rSAs5xG28dp25ybygxR80sv6payO7A= +LibraryVersion: + Guid: cdacc796-61cb-4ba8-897c-888bf3bf6238 diff --git a/2_ILSLib/FB/MTRO/UDT_MFRState.xml b/2_ILSLib/FB/MTRO/UDT_MFRState.xml new file mode 100644 index 0000000..61f0d1b --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFRState.xml @@ -0,0 +1,70 @@ + + + + + + +
+ + + TRO bereit für nächste Anfrage + + + + + TRO ist in Bearbeitung + + +
+
+ UDT_MFRState + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.libinfo b/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.libinfo new file mode 100644 index 0000000..dd0e3f8 --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 81de2ed6-0fbf-428c-bb68-76dfe2a4b58a +LibraryVersion: + VersionNumber: 2.0.2 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.libint b/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.libint new file mode 100644 index 0000000..dcf029a --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: UDT_MFR_StoreTRO.xml + Hash: gINNOVmyQuRKMWwSa16+ZLPxizwFFHxuWUH6DI8gfFY= +LibraryMetaFileHash: bEzpYnSmSIIFxVLaeI+YJuCoxGpqFLxoW9O05xIkB80= +LibraryVersion: + Guid: 5923cf16-1648-4160-81b0-6e1d8b948fa1 + DependsOn: + - TypeName: UDT_MFRCtrl + VersionNumber: 2.0.2 + - TypeName: UDT_MFRState + VersionNumber: 2.0.2 + - TypeName: UDT_MFRScanResult + VersionNumber: 2.0.2 diff --git a/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.xml b/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.xml new file mode 100644 index 0000000..c652cd7 --- /dev/null +++ b/2_ILSLib/FB/MTRO/UDT_MFR_StoreTRO.xml @@ -0,0 +1,75 @@ + + + + + + +
+ + + true + + + + + true + + + + + true + + +
+
+ UDT_MFR_StoreTRO + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.libinfo b/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.libinfo new file mode 100644 index 0000000..00a1d89 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 7d35be77-2a72-4530-b111-2a609340cc24 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.libint b/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.libint new file mode 100644 index 0000000..d953e02 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: FB_CarrAccumulate1Sep.scl + Hash: N6cbGozMRL5O0uRLedHuJdl8V+0Q+CiRYK3PiQpUby0= +LibraryMetaFileHash: L9r6Lmj4aURbtB++qYCQX/yQy2f8AdK1Wg/TnpZuXKU= +LibraryVersion: + Guid: 2ad8b4f4-249f-4013-ac79-66401f0d4420 + DependsOn: + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.scl b/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.scl new file mode 100644 index 0000000..f04ddbe --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_CarrAccumulate1Sep.scl @@ -0,0 +1,56 @@ +FUNCTION_BLOCK "FB_CarrAccumulate1Sep" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSensor1 : "UDT_Sensor"; // Sensor vom 1. Sep + xInConvActive : Bool; // Conveyor Rückmeldung + stInTimes : Struct + tFreeSen1 : Time := T#5000ms; // Zeit welche Sep 1 frei ist + tTimerWait : Time := T#10000ms; // Wartezeit + END_STRUCT; + END_VAR + + VAR_OUTPUT + xOutLockSep1 : Bool; // true = Sep 1 wird gesperrt + END_VAR + + VAR + tOn1 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer zählt wie lange Sep 1 warten muss + xTimerQ : Bool; // Timerausgang + xLockSep1 : Bool; + END_VAR + + +BEGIN + (* + <====== Fahrtrichtung <====== + ... -------<----------|o|--------<------ ... + Sep 1 + + Sep 1 lässt Carrier raus die sich angestaut haben, bis In-Sensor wieder mal eine gewisse Zeit frei ist. + Dann beginnt Wartezeit wenn in diesem Zustand Sep 1 erstmals wieder ein In-Signal bekommt. Usw.... + + *) + + IF NOT #stInSensor1.xDirectSensor AND #stInSensor1.tDirectChangeLast > #stInTimes.tFreeSen1 THEN + #xLockSep1 := TRUE; + ELSIF #xTimerQ THEN + #xLockSep1 := FALSE; + END_IF; + + REGION Timer + #tOn1(IN := #xLockSep1 AND #stInSensor1.xDirectSensor AND #xInConvActive, //Conveyoer Full Speed ok und Sep 1 wartet + PT := #stInTimes.tTimerWait); + + + #xTimerQ := #tOn1.Q (* OR (#stInSensor1.xDirectSensor AND #stInSensor1.tDirectChangeLast > #stInTimes.tFullSen1) *); + END_REGION + + + REGION Outputs + #xOutLockSep1 := #xLockSep1; + END_REGION + + +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Misc/FB_PriorityManager.libinfo b/2_ILSLib/FB/Misc/FB_PriorityManager.libinfo new file mode 100644 index 0000000..55d5cd2 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_PriorityManager.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 9efcce89-7b06-4891-9641-6b68006aed8c +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/Misc/FB_PriorityManager.libint b/2_ILSLib/FB/Misc/FB_PriorityManager.libint new file mode 100644 index 0000000..43274a6 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_PriorityManager.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FB_PriorityManager.scl + Hash: NzWfLNwbHCgIQ09FjswCJqLBoUjRikdGfu39QrN0RqE= +LibraryMetaFileHash: kqGkOm3+D2226hP+I8rIYA7hPZUG3JNIJHrkpd/7btg= +LibraryVersion: + Guid: d2f29772-001f-478c-97e1-1fcccbe27ee7 + DependsOn: + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: UDT_PrioParameter + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/Misc/FB_PriorityManager.scl b/2_ILSLib/FB/Misc/FB_PriorityManager.scl new file mode 100644 index 0000000..9b43ccf --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_PriorityManager.scl @@ -0,0 +1,1933 @@ +FUNCTION_BLOCK "FB_PriorityManager" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInQuit : Bool; + udtIn_Source1Req : "UDT_Request"; + udtIn_Source2Req : "UDT_Request"; + udtIn_Source3Req : "UDT_Request"; + udtIn_Source4Req : "UDT_Request"; + nIn_SwitchAmountSoruce1 : UDInt; + nIn_SwitchAmountSoruce2 : UDInt; + nIn_SwitchAmountSoruce3 : UDInt; + nIn_SwitchAmountSoruce4 : UDInt; + nIn_PrioInterrupt : UInt; + wsIn_ObjectName : WString[50]; + tIn_ReleaseTime : Time; + tIn_Watchdog : Time; + xInClearJam : Bool; + END_VAR + + VAR_OUTPUT + udtOut_Source1Resp : "UDT_Response"; + udtOut_Source2Resp : "UDT_Response"; + udtOut_Source3Resp : "UDT_Response"; + udtOut_Source4Resp : "UDT_Response"; + END_VAR + + VAR_IN_OUT + udt_PrioParameter : "UDT_PrioParameter"; + END_VAR + + VAR + PrgAlarm_Failmessage {InstructionName := 'Program_Alarm'; LibVersion := '1.0'} : Program_Alarm; + xDummy : Bool; + xError : Bool; + wsErrorMessage : WString[50]; + nErrorID : USInt; + n_AmountSource : USInt; + n_TimedMode2Source : USInt; + n_QuantityMode2Source : USInt; + n_TraficLightMode2Source : USInt; + n_TimedMode3Source : USInt; + n_QuantityMode3Source : USInt; + n_TraficLightMode3Source : USInt; + n_TimedMode4Source : USInt; + n_QuantityMode4Source : USInt; + n_TraficLightMode4Source : USInt; + n_CounterSource1 : UDInt; + n_CounterSource2 : UDInt; + n_CounterSource3 : UDInt; + n_CounterSource4 : UDInt; + ton_ReleaseSource1 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseSource2 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseSource3 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseSource4 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_WatchdogQuantity {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_runtime {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + arrx_SourcePrio : Array[0..4] of Bool; + arrx_SourcePrioClear : Array[0..4] of Bool; + END_VAR + + VAR_TEMP + nTempRetVal : Int; + tTempLocalTime {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; + nCount : USInt; + END_VAR + + VAR CONSTANT + "****NumberOfSources****" : Bool; + c4Sources : USInt := 4; + c3Sources : USInt := 3; + c2Sources : USInt := 2; + c1Source : USInt := 1; + c10ErrorNoSource : USInt := 10; + "****PrioMode******" : USInt; + c1ZeitGesteuert : USInt := 1; + c2MengenGesteuert : USInt := 2; + c3PrioAmpel : USInt := 3; + "****Sequence*****" : USInt; + c000_WaitForRequest : USInt; + c010_SetReleaseSource1 : USInt := 10; + c011_Countup : USInt := 11; + c012_WaitShuttleGone : USInt := 12; + c015_Reset : USInt := 15; + c020_SetReleaseSource2 : USInt := 20; + c021_Countup : USInt := 21; + c022_WaitShuttleGone : USInt := 22; + c025_Reset : USInt := 25; + c030_SetReleaseSource3 : USInt := 30; + c031_Countup : USInt := 31; + c032_WaitShuttleGone : USInt := 32; + c035_Reset : USInt := 35; + c040_SetReleaseSource4 : USInt := 40; + c041_Countup : USInt := 41; + c042_WaitShuttleGone : USInt := 42; + c045_Reset : USInt := 45; + END_VAR + + +BEGIN + REGION Info + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2022). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_PriorityManager + Comment/Function: controls the priority at intersections + Library/Family: - + Author: department: "Automatisierung" ; person in charge / contact: C.Nottelmann (Automated Intelligence) + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V20 + Restrictions: - + Requirements: - + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2025-03-17 | - | | Header added on 17.03.2025 + + *) + END_REGION + + REGION LocalTime + // read local time for timestamp ------------------------------------------ + #nTempRetVal := RD_LOC_T(#tTempLocalTime); + END_REGION + + REGION ToDo + + (* + + + + + + *) + + END_REGION + + REGION Times and Trigger + + #ton_ReleaseSource1(IN := #n_TimedMode2Source = #c010_SetReleaseSource1 + OR #n_TimedMode3Source = #c010_SetReleaseSource1 + OR #n_TimedMode4Source = #c010_SetReleaseSource1 + OR #n_TraficLightMode2Source = #c010_SetReleaseSource1 + OR #n_TraficLightMode3Source = #c010_SetReleaseSource1 + OR #n_TraficLightMode4Source = #c010_SetReleaseSource1, + PT := #tIn_ReleaseTime); + + #ton_ReleaseSource2(IN := #n_TimedMode2Source = #c020_SetReleaseSource2 + OR #n_TimedMode3Source = #c020_SetReleaseSource2 + OR #n_TimedMode4Source = #c020_SetReleaseSource2 + OR #n_TraficLightMode2Source = #c020_SetReleaseSource2 + OR #n_TraficLightMode3Source = #c020_SetReleaseSource2 + OR #n_TraficLightMode4Source = #c020_SetReleaseSource2, + PT := #tIn_ReleaseTime); + + #ton_ReleaseSource3(IN := #n_TimedMode3Source = #c030_SetReleaseSource3 + OR #n_TimedMode4Source = #c030_SetReleaseSource3 + OR #n_TraficLightMode3Source = #c030_SetReleaseSource3 + OR #n_TraficLightMode4Source = #c030_SetReleaseSource3, + PT := #tIn_ReleaseTime); + + #ton_ReleaseSource4(IN := #n_TimedMode4Source = #c040_SetReleaseSource4 + OR #n_TraficLightMode4Source = #c040_SetReleaseSource4, + PT := #tIn_ReleaseTime); + + #ton_WatchdogQuantity(IN := #n_QuantityMode2Source = #c010_SetReleaseSource1 + OR #n_QuantityMode2Source = #c020_SetReleaseSource2 + OR #n_QuantityMode3Source = #c010_SetReleaseSource1 + OR #n_QuantityMode3Source = #c020_SetReleaseSource2 + OR #n_QuantityMode3Source = #c030_SetReleaseSource3 + OR #n_QuantityMode4Source = #c010_SetReleaseSource1 + OR #n_QuantityMode4Source = #c020_SetReleaseSource2 + OR #n_QuantityMode4Source = #c030_SetReleaseSource3 + OR #n_QuantityMode4Source = #c040_SetReleaseSource4, + PT := #tIn_Watchdog); + + #ton_runtime(IN:= (#n_TimedMode2Source = #c015_Reset) OR (#n_TimedMode2Source = #c025_Reset), + PT:= T#10s); + + END_REGION + + REGION Check number of sources + //Auswertung wieviele Eingänge verwendet werden + #nCount := 0; + + IF #udtIn_Source1Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + IF #udtIn_Source2Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + IF #udtIn_Source3Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + IF #udtIn_Source4Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + + #n_AmountSource := #nCount; + + //Keine Quelle definiert + + IF #n_AmountSource = 0 + THEN + #xError := TRUE; + #nErrorID := #c10ErrorNoSource; + END_IF; + + + END_REGION + + REGION Prio Mapping + + #arrx_SourcePrio[1] := #nIn_PrioInterrupt = #c1Source AND #udtIn_Source1Req.xTransportReq; + #arrx_SourcePrio[2] := #nIn_PrioInterrupt = #c2Sources AND #udtIn_Source2Req.xTransportReq; + #arrx_SourcePrio[3] := #nIn_PrioInterrupt = #c3Sources AND #udtIn_Source3Req.xTransportReq; + #arrx_SourcePrio[4] := #nIn_PrioInterrupt = #c4Sources AND #udtIn_Source4Req.xTransportReq; + END_REGION + + + REGION Prio Logic + + CASE #n_AmountSource OF + #c1Source: + REGION 1 Source + + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //keine Vorfahrtsregelung notwendig// + + END_REGION + #c2Sources: + REGION 2 Sources + CASE #udt_PrioParameter.nPrioMode OF + #c1ZeitGesteuert: + REGION Zeit gesteuert + CASE #n_TimedMode2Source OF + #c000_WaitForRequest: + //Action + //Zurücksetzen der nicht aktiven Sequenzen der anderen Modi + #n_QuantityMode2Source := 0; + #n_TraficLightMode2Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq // Prüfung ob ein Request ansteht + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 //Prüfen ob ein Stau im Förderbereich ansteht + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear //Prüfen ob ein Prio Interrupt ansteht + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[1] // Prio Interrupt Quelle 1 und Request Quelle 1 aktiv + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] // Prio Interrupt Quelle 2 und Request Quelle 2 aktiv + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; //Freigabe an TRO wird erteilt + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q // Warten bis vorgegebene Durchlasszeit endet + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1] )//Prüfen ob während Druchlasszeit ein Prio interrupt ansteht + OR (NOT #udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source1Req.stSensor.xDbncdSensor AND #udtIn_Source1Req.stSensor.tDirectChangeLast > T#2s) + THEN + #n_TimedMode2Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; //Freigabe an TRO wird zurückgesetzt + + //Transition + IF (#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR #ton_runtime.Q THEN + IF #udtIn_Source2Req.xTransportReq + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + ELSIF + (#udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + END_IF; + ELSIF NOT #xInClearJam AND #ton_runtime.Q THEN + IF #udtIn_Source2Req.xTransportReq + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + ELSIF + (#udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + END_IF; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + OR (NOT #udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source2Req.stSensor.xDbncdSensor AND #udtIn_Source2Req.stSensor.tDirectChangeLast > T#2s) + THEN + #n_TimedMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF (#xInClearJam AND #udtIn_Source2Req.stJamExit.Status.nCount = 0) OR #ton_runtime.Q THEN + IF #udtIn_Source1Req.xTransportReq + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF + (#udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source1Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + END_IF; + ELSIF NOT #xInClearJam AND #ton_runtime.Q THEN + IF #udtIn_Source1Req.xTransportReq + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF + (#udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source1Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + END_IF; + END_IF; + + END_CASE; + END_REGION + + + #c2MengenGesteuert: + REGION Mengen gesteuert + CASE #n_QuantityMode2Source OF + #c000_WaitForRequest: + //Action + #n_TimedMode2Source := 0; + #n_TraficLightMode2Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source1Req.xTrolleyPresent + THEN + #n_QuantityMode2Source := #c011_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode2Source := #c015_Reset; + END_IF; + + + #c011_Countup: + //Action + #n_CounterSource1 += 1; + + //Transition + #n_QuantityMode2Source := #c012_WaitShuttleGone; + + #c012_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 < #nIn_SwitchAmountSoruce1 + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 >= #nIn_SwitchAmountSoruce1 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_QuantityMode2Source := #c015_Reset; + END_IF; + + + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF #udtIn_Source2Req.xTransportReq + OR (#udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c000_WaitForRequest; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source2Req.xTrolleyPresent + THEN + #n_QuantityMode2Source := #c021_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode2Source := #c025_Reset; + END_IF; + + #c021_Countup: + //Action + #n_CounterSource2 += 1; + + //Transition + #n_QuantityMode2Source := #c022_WaitShuttleGone; + + #c022_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 < #nIn_SwitchAmountSoruce2 + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 >= #nIn_SwitchAmountSoruce2 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_QuantityMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF #udtIn_Source1Req.xTransportReq + OR (#udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source1Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c000_WaitForRequest; + END_IF; + + END_CASE; + END_REGION + #c3PrioAmpel: + REGION Ampel gesteuert + CASE #n_TraficLightMode2Source OF + #c000_WaitForRequest: + //Action + #n_QuantityMode2Source := 0; + #n_TraficLightMode2Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode2Source := #c020_SetReleaseSource2; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c000_WaitForRequest; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode2Source := #c000_WaitForRequest; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c000_WaitForRequest; + END_IF; + + END_CASE; + END_REGION + + + + END_CASE; + ; + + END_REGION + #c3Sources: + REGION 3 Sources + CASE #udt_PrioParameter.nPrioMode OF + #c1ZeitGesteuert: + REGION Zeitgesteuer + CASE #n_TimedMode3Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[1] + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TimedMode3Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TimedMode3Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TimedMode3Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + + #n_TimedMode3Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + #c2MengenGesteuert: + REGION Mengen gesteuert + CASE #n_QuantityMode3Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source1Req.xTrolleyPresent + THEN + #n_QuantityMode3Source := #c011_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode3Source := #c015_Reset; + END_IF; + + #c011_Countup: + //Action + #n_CounterSource1 += 1; + + //Transition + #n_QuantityMode3Source := #c012_WaitShuttleGone; + + #c012_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 < #nIn_SwitchAmountSoruce1 + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + ELSIF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 >= #nIn_SwitchAmountSoruce1 + OR ( #arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_QuantityMode3Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + THEN + #n_QuantityMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source2Req.xTrolleyPresent + THEN + #n_QuantityMode3Source := #c021_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode3Source := #c025_Reset; + END_IF; + + #c021_Countup: + //Action + #n_CounterSource2 += 1; + + //Transition + #n_QuantityMode3Source := #c022_WaitShuttleGone; + + #c022_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 < #nIn_SwitchAmountSoruce2 + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 >= #nIn_SwitchAmountSoruce2 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_QuantityMode3Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + THEN + #n_QuantityMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source3Req.xTrolleyPresent + THEN + #n_QuantityMode3Source := #c031_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode3Source := #c035_Reset; + END_IF; + + #c031_Countup: + //Action + #n_CounterSource3 += 1; + + //Transition + #n_QuantityMode3Source := #c032_WaitShuttleGone; + + #c032_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 < #nIn_SwitchAmountSoruce3 + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + ELSIF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 >= #nIn_SwitchAmountSoruce3 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3] ) + THEN + #n_QuantityMode3Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + + #n_QuantityMode3Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + #c3PrioAmpel: + REGION Ampel gesteuert + CASE #n_TraficLightMode3Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c020_SetReleaseSource2; + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[1] + THEN + #n_TraficLightMode3Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TraficLightMode3Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TraficLightMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1] ) + THEN + #n_TraficLightMode3Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode3Source := #c020_SetReleaseSource2; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c000_WaitForRequest; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2] ) + THEN + #n_TraficLightMode3Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode3Source := #c030_SetReleaseSource3; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c000_WaitForRequest; + END_IF; + + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3] ) + THEN + #n_TraficLightMode3Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + + #n_TraficLightMode3Source := #c000_WaitForRequest; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c000_WaitForRequest; + END_IF; + + + END_CASE; + + + END_REGION + + + + END_CASE; + ; + END_REGION + #c4Sources: + REGION 4 Sources + CASE #udt_PrioParameter.nPrioMode OF + #c1ZeitGesteuert: + REGION Zeit gesteuert + CASE #n_TimedMode4Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + ELSIF #arrx_SourcePrio[1] + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[4] + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TimedMode4Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + + ELSIF NOT #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TimedMode4Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + ELSIF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TimedMode4Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source4Req.xTransportReq + AND (#udtIn_Source3Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source4Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + ELSIF #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c040_SetReleaseSource4: + //Action + IF NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source4Resp.xReleaseOk := True; + ELSE + #udtOut_Source4Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource4.Q + OR(#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[4]) + THEN + #n_TimedMode4Source := #c035_Reset; + END_IF; + + #c045_Reset: + //Action + #udtOut_Source4Resp.xReleaseOk := False; + + //Transition + + #n_TimedMode4Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + #c2MengenGesteuert: + REGION Mengen Gesteuert + + CASE #n_QuantityMode4Source OF + #c000_WaitForRequest: + //Action + + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[4] + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source1Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c011_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c015_Reset; + END_IF; + + #c011_Countup: + //Action + #n_CounterSource1 += 1; + + //Transition + #n_QuantityMode4Source := #c012_WaitShuttleGone; + + #c012_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 < #nIn_SwitchAmountSoruce1 + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + ELSIF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 >= #nIn_SwitchAmountSoruce1 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_QuantityMode4Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + + ELSIF NOT #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source2Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c021_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c025_Reset; + END_IF; + + #c021_Countup: + //Action + #n_CounterSource2 += 1; + + //Transition + #n_QuantityMode4Source := #c022_WaitShuttleGone; + + #c022_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 < #nIn_SwitchAmountSoruce2 + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 >= #nIn_SwitchAmountSoruce2 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_QuantityMode4Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source4Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + + ELSIF #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source3Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c031_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c035_Reset; + END_IF; + + #c031_Countup: + //Action + #n_CounterSource3 += 1; + + //Transition + #n_QuantityMode4Source := #c032_WaitShuttleGone; + + #c032_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 < #nIn_SwitchAmountSoruce3 + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + ELSIF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 >= #nIn_SwitchAmountSoruce3 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_QuantityMode4Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source4Req.xTransportReq + AND (#udtIn_Source3Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source4Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + ELSIF #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c040_SetReleaseSource4: + //Action + IF NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source4Resp.xReleaseOk := True; + ELSE + #udtOut_Source4Resp.xReleaseOk := False; + END_IF; + + //Transition + //Transition + IF #udtIn_Source4Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c041_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c045_Reset; + END_IF; + + #c041_Countup: + //Action + #n_CounterSource4 += 1; + + //Transition + #n_QuantityMode4Source := #c042_WaitShuttleGone; + + #c042_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source4Req.xTrolleyPresent + AND #n_CounterSource4 < #nIn_SwitchAmountSoruce4 + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + ELSIF NOT #udtIn_Source4Req.xTrolleyPresent + AND #n_CounterSource4 >= #nIn_SwitchAmountSoruce4 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[4]) + THEN + #n_QuantityMode4Source := #c045_Reset; + END_IF; + + #c045_Reset: + //Action + #udtOut_Source4Resp.xReleaseOk := False; + + //Transition + + #n_QuantityMode4Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + + #c3PrioAmpel: + REGION Ampel gestuert + CASE #n_TraficLightMode4Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c010_SetReleaseSource1; + + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c030_SetReleaseSource3; + + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c040_SetReleaseSource4; + + ELSIF #arrx_SourcePrio[1] + THEN + #n_TraficLightMode4Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TraficLightMode4Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TraficLightMode4Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[4] + THEN + #n_TraficLightMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR(#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TraficLightMode4Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode4Source := #c020_SetReleaseSource2; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c000_WaitForRequest; + END_IF; + + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR(#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TraficLightMode4Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode4Source := #c030_SetReleaseSource3; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c000_WaitForRequest; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR(#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TraficLightMode4Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode4Source := #c040_SetReleaseSource4; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c000_WaitForRequest; + END_IF; + + #c040_SetReleaseSource4: + //Action + IF NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source4Resp.xReleaseOk := True; + ELSE + #udtOut_Source4Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource4.Q + OR(#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[4]) + THEN + #n_TraficLightMode4Source := #c035_Reset; + END_IF; + + #c045_Reset: + //Action + #udtOut_Source4Resp.xReleaseOk := False; + + //Transition + + #n_TraficLightMode4Source := #c000_WaitForRequest; + + + END_CASE; + + END_REGION + + + + END_CASE; + ; + END_REGION + + END_CASE; + + + + + + END_REGION + + + + + REGION Error Management + //Quit setzt Error Word zurück + IF #xInQuit + THEN + #xError :=False; + END_IF; + + IF #xError AND #nErrorID = #c10ErrorNoSource + THEN + #wsErrorMessage := WSTRING#'Keine Quelle konfiguriert'; + + END_IF; + + #PrgAlarm_Failmessage(SIG:=#xError, + TIMESTAMP:=#tTempLocalTime, + SD_1:=#wsIn_ObjectName, + SD_2:=#wsErrorMessage); + + + + END_REGION + + + + + + + + + + + + + + + + + + + + + + + + + + + +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Misc/FB_SepPrio.libinfo b/2_ILSLib/FB/Misc/FB_SepPrio.libinfo new file mode 100644 index 0000000..195e923 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_SepPrio.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 147eef49-040b-42d5-ae7d-43bf675e04d5 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/Misc/FB_SepPrio.libint b/2_ILSLib/FB/Misc/FB_SepPrio.libint new file mode 100644 index 0000000..69574de --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_SepPrio.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: FB_SepPrio.scl + Hash: TiobJ+rsdBzTeu+UkBCNDx/iaFdgdPd64yzefoiS5DY= +LibraryMetaFileHash: /SJOtlF6TYllHtWLntRFYmq6E9lvJkhN6tgxX7jkSrQ= +LibraryVersion: + Guid: e2fffa67-74ab-4d49-9905-ebe62964e7d5 + DependsOn: + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/Misc/FB_SepPrio.scl b/2_ILSLib/FB/Misc/FB_SepPrio.scl new file mode 100644 index 0000000..6295bd4 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_SepPrio.scl @@ -0,0 +1,304 @@ +FUNCTION_BLOCK "FB_SepPrio" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInSepReq1 : Bool; // Anforderung von Sep1 + xInSepReq2 : Bool; // Anforderung von Sep2 + xInSepReq3 : Bool; // Anforderung von Sep3 + xInSepRelease1 : Bool; // Sep 1 hat rausgelassen + xInSepRelease2 : Bool; // Sep 2 hat rausgelassen + xInSepRelease3 : Bool; // Sep 3 hat rausgelassen + xInActive : Bool; // Freigabe grundsätzlich für Separatoren + xInCarRun : Bool; // NIU Motor läuft + tInTime3 : Time; // Zeit die Sep 3 braucht + tInTime2 : Time; // Zeit die Sep 2 braucht + END_VAR + + VAR_OUTPUT + xOutSepGo1 : Bool; // Freigabe für einzelnen Sep 1 + xOutSepGo2 : Bool; // Freigabe für einzelnen Sep 2 + xOutSepGo3 : Bool; // Freigabe für einzelnen Sep 3 + END_VAR + + VAR_IN_OUT + InOutJam : "stJamData"; + END_VAR + + VAR + fbStateManager : "FB_StateManager"; + nState : Int; // Schritt + tTime3 {InstructionName := 'TOF_TIME'; LibVersion := '1.0'} : TOF_TIME; // Timer von Sep 3 + tTime2 {InstructionName := 'TOF_TIME'; LibVersion := '1.0'} : TOF_TIME; // Timer von Sep 2 + tTime1 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + rTrigNotActive {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; + rTrig2 {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; + fTrig3 {InstructionName := 'F_TRIG'; LibVersion := '1.0'} : F_TRIG; + fTrig2 {InstructionName := 'F_TRIG'; LibVersion := '1.0'} : F_TRIG; + xTimeBit3 : Bool; // Merker für Timer falls unterbrochen wird + xTimeBit2 : Bool; // Merker für Timer falls unterbrochen wird + END_VAR + + VAR_TEMP + tmpActUnivTon : Bool; + END_VAR + + VAR CONSTANT + cOff : Int := 0; + cWaitAll : Int := 1; + cWaitFor3 : Int := 30; + cWaitFor2 : Int := 20; + cOnlySep1 : Int := 10; + END_VAR + + +BEGIN + (* + _______________________<== + | | | + | | | + \ \ \ + \ \ \ + ______3______2______1_____==> + + 3 hat vor 2 und 1 Vorfahrt + 2 hat vor 1 Vorfahrt aber muss Zeit 3 abwarten + 1 muss Zeit 3 und 2 abwarten + + *) + + + REGION Schrittkette + CASE #nState OF + #cOff: + REGION 000: Off + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + + // IF #xInActive THEN + #nState := #cWaitAll; + // END_IF; + END_REGION + #cWaitAll: + REGION 001: Wait All + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + //***************NEU*********** + #nState := 005; + //*************NEU ENDE******* + + + (*IF NOT #xInActive THEN + #nState := #cOff;*) + // //********************Kombinationen mit Sep3************************************************* + // IF #xInSepReq3 AND #xInSepReq2 AND #xInSepReq1 THEN + // #xOutSepGo3 := TRUE; + // #xOutSepGo2 := false;//TRUE; + // #xOutSepGo1 := false;//TRUE; + // #nState := #cWaitFor3; + // ELSIF #xInSepReq3 AND (#xInSepReq2 OR NOT #xInSepReq1) THEN + // #xOutSepGo3 := TRUE; + // #xOutSepGo2 := false;//TRUE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitFor3; + // ELSIF #xInSepReq3 AND (NOT #xInSepReq2 OR #xInSepReq1) THEN + // #xOutSepGo3 := TRUE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := false;//TRUE; + // #nState := #cWaitFor3; + // ELSIF #xInSepReq3 AND (NOT #xInSepReq2 AND NOT #xInSepReq1) THEN + // #xOutSepGo3 := TRUE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitFor3; + // //********************Kombinationen ohne Sep3************************************************ + // ELSIF NOT #xInSepReq3 AND (#xInSepReq2 AND #xInSepReq1) THEN + // #xOutSepGo3 := FALSE; + // #xOutSepGo2 := TRUE; + // #xOutSepGo1 := false;//TRUE; + // #nState := #cWaitFor2; + // ELSIF NOT #xInSepReq3 AND (#xInSepReq2 AND NOT #xInSepReq1) THEN + // #xOutSepGo3 := FALSE; + // #xOutSepGo2 := TRUE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitFor2; + // //********************Nur Sep1 alleine*************************************************** + // ELSIF NOT #xInSepReq3 AND (NOT #xInSepReq2 AND #xInSepReq1) THEN + // #xOutSepGo3 := FALSE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := TRUE; + // #nState := #cOnlySep1; + // END_IF; + END_REGION + 005: + REGION 005: NEU Zwischenschritt + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + + IF #fbStateManager.tOutTimeInStep > T#6s THEN + IF #xInSepReq1 THEN + #nState := 006; // Embi + // #nState := 010; + ELSIF #xInSepReq2 THEN + #nState := 16; // Embi + // #nState := 020; + // ELSIF #xInSepReq3 THEN + // #nState := 26; // Embi + // #nState := 030; + END_IF; + END_IF; + END_REGION + + 006: + REGION 006: Warten auf freie Ausfahrt + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + IF #InOutJam.Status.nCount = 0 OR #fbStateManager.tOutTimeInStep > T#24s THEN + #nState := #cOnlySep1; + END_IF; + END_REGION + #cOnlySep1: + REGION 010: Only Sep 1 + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := TRUE; + + //***************NEU*********** + IF #fbStateManager.tOutTimeInStep > T#10s THEN + #nState := 015; + END_IF; + //*************NEU ENDE******* + + // IF (#xInSepReq2 OR #xInSepReq3) AND #tTime1.Q THEN //Wird sofort von 2 oder 3 unterbrochen + // #xOutSepGo3 := FALSE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitAll; + // END_IF; + END_REGION + 015: + REGION 015: NEU Zwischenschritt + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + + IF #fbStateManager.tOutTimeInStep > T#4s THEN + IF #xInSepReq2 THEN + #nState := 16; // Embi + // #nState := 020; + // ELSIF #xInSepReq3 THEN + // #nState := 26; // Embi + // #nState := 030; + ELSIF #xInSepReq1 THEN + #nState := 6; // Embi + // #nState := 010; + END_IF; + END_IF; + END_REGION + + 016: + REGION 16: Warten auf freie Ausfahrt + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + IF #InOutJam.Status.nCount = 0 OR #fbStateManager.tOutTimeInStep > T#26s THEN + #nState := #cWaitFor2; + END_IF; + END_REGION + + #cWaitFor2: + REGION 020: Wait for 2 + #xOutSepGo3 := FALSE; + #xOutSepGo2 := TRUE; + #xOutSepGo1 := FALSE; + + //***************NEU*********** + IF #fbStateManager.tOutTimeInStep > T#11s THEN + // #nState := 025; + #nState := 5; + END_IF; + //*************NEU ENDE******* + + (*IF NOT #xInActive THEN + #nState := #cOff;*) + // IF #fTrig2.Q THEN //Bis Sep 2 fertig.... + // #xOutSepGo3 := FALSE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitAll; + // ELSIF #xInSepReq3 THEN //...oder sofort durch Sep 3 unterbrochen + // #xOutSepGo3 := TRUE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitFor3; + // END_IF; + END_REGION + 025: + REGION 025: NEU Zwischenschritt + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + + IF #fbStateManager.tOutTimeInStep > T#5s THEN + IF #xInSepReq3 THEN + #nState := 26; // Embi + // #nState := 030; + ELSIF #xInSepReq1 THEN + #nState := 6; // Embi + // #nState := 010; + ELSIF #xInSepReq2 THEN + #nState := 16; // Embi + // #nState := 020; + END_IF; + END_IF; + END_REGION + + 026: + REGION 26: Warten auf freie Ausfahrt + #xOutSepGo3 := FALSE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + IF #InOutJam.Status.nCount = 0 OR #fbStateManager.tOutTimeInStep > T#25s THEN + #nState := #cWaitFor3; + END_IF; + END_REGION + + #cWaitFor3: + REGION 030: Wait for 3 + #xOutSepGo3 := TRUE; + #xOutSepGo2 := FALSE; + #xOutSepGo1 := FALSE; + + //***************NEU*********** + IF #fbStateManager.tOutTimeInStep > T#11s THEN //war 8s + #nState := 005; + END_IF; + //*************NEU ENDE******* + + (*IF NOT #xInActive THEN + #nState := #cOff;*) + // IF #fTrig3.Q THEN //Bis Sep 3 fertig ist + // #xOutSepGo3 := FALSE; + // #xOutSepGo2 := FALSE; + // #xOutSepGo1 := FALSE; + // #nState := #cWaitAll; + // END_IF; + END_REGION + ELSE + ; + END_CASE; + END_REGION + + REGION State Manager + #fbStateManager.stInSettings.nStartState := 0; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled:=TRUE, + xInRunUnivTOn:=#tmpActUnivTon, + nInOutState:=#nState); + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.libinfo b/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.libinfo new file mode 100644 index 0000000..6345598 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: b2b7bae2-df01-45c1-b728-4f21f6dccf2b + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.2 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.libint b/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.libint new file mode 100644 index 0000000..54e3083 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: FB_SupervisionRasterSensor.scl + Hash: brsi2hAS6wrw9/jmi3v1V82anQUbZwQLOrO9MMcjTSE= +LibraryMetaFileHash: rP2CWmPh58VX2bM7MLVbOLWLkCnAMh6UXNcah+oCJ6c= +LibraryVersion: + Guid: 3b4a840b-d014-4f13-8b4b-a11a10747b6c + DependsOn: + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.scl b/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.scl new file mode 100644 index 0000000..e78e425 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_SupervisionRasterSensor.scl @@ -0,0 +1,74 @@ +FUNCTION_BLOCK "FB_SupervisionRasterSensor" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSenRaster : "UDT_Sensor"; // Das Signal das überwacht wird + xInMotorRun : Bool; // Motor dreht sich + stInSettings : Struct // Einstellungen + xInEnableSupervision : Bool := false; // Überwachung aktiviert + tInDelayMotorRun : Time := T#200ms; // Motor Delay + tInRasterHigh : Time := T#100ms; // High Signal + tInRasterLow : Time := T#100ms; // Low Signal + sInConveyorName : String; + wInTextListFunctionId : Word; + wInTextListMessageId : Word; + END_STRUCT; + xInErrorQuit : Bool; // Quittieren z.B. Button Reset + END_VAR + + VAR_OUTPUT + xOutErrorRasterSensor : Bool; // Fehler ausgeben + END_VAR + + VAR + tOn_RasterHigh {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Überwachungszeit High-Signal + tOn_RasterLow {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Überwachungszeit Low-Signal + tOnMotorRunningDelay {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Motor Delay Timer + xErrorRasterSensor : Bool; // Fehler + END_VAR + + +BEGIN + REGION Überwachung Raster Sensor + + #tOnMotorRunningDelay(IN := #xInMotorRun, // CarouselRun muss delayed benutzt werden, wegen Anfahrzeit vom ETF + PT := #stInSettings.tInDelayMotorRun); + + #tOn_RasterHigh(IN := #xInMotorRun AND #tOnMotorRunningDelay.Q AND #stInSenRaster.xDirectSensor, + PT := #stInSettings.tInRasterHigh); + + #tOn_RasterLow(IN := #xInMotorRun AND #tOnMotorRunningDelay.Q AND NOT #stInSenRaster.xDirectSensor, + PT := #stInSettings.tInRasterLow); + + IF #tOn_RasterHigh.Q OR #tOn_RasterLow.Q THEN // Wenn einer der beiden Timer abläuft, dann Fehler! + #xErrorRasterSensor := TRUE; + END_IF; + END_REGION + + REGION Quittieren + IF #xErrorRasterSensor AND #stInSettings.xInEnableSupervision AND #xInErrorQuit THEN + #xErrorRasterSensor := FALSE; + END_IF; + END_REGION + + REGION Ausgänge + #xOutErrorRasterSensor := #xErrorRasterSensor AND #stInSettings.xInEnableSupervision; // Fehler ausgeben, wenn Überwachung aktiviert + END_REGION + + (* REGION Monitoring + #fbMonitoring.stSettings.nErrorType := 1; + #fbMonitoring.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoring.stSettings.xSelfQuit := TRUE; + #fbMonitoring.stSettings.tDelay := T#1s; + #fbMonitoring(sInFctnName := 'Rastersensorueberwachung', + sInPrefix := #stInSettings.sInConveyorName, + wInTextListId_Function := #stInSettings.wInTextListFunctionId, + wInTextListId_Message := #stInSettings.wInTextListMessageId, + sInSuffix := #stInSenRaster.sName, + InOutMachineState := "DB_MachineGlobal".stStateMain, + xInQuitError := "DB_MachineGlobal".stStateMain.xQuitError, + xInSignal := NOT #xErrorRasterSensor, + sInAlarmMessage := 'Rastersensorueberwachung ausgeloest'); + END_REGION *) +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.libinfo b/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.libinfo new file mode 100644 index 0000000..ae1b480 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 2ed8a6f8-c110-4695-b999-af4dbf845bb4 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.libint b/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.libint new file mode 100644 index 0000000..37860b6 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: FB_VarioFingerMonitoring.scl + Hash: hO+7ulxM45sR+Y0DWMaxvkMhvex1mfxH3l0j+rQL7S4= +LibraryMetaFileHash: z1/42ZPNlHM3vfq0hKE+ij6RojciR6JTY4/0RBG4HBk= +LibraryVersion: + Guid: b65fb0a1-003f-4b71-8c59-64c01a419f06 + DependsOn: + - TypeName: UDT_SettingsVarioFingerMonitoring + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.scl b/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.scl new file mode 100644 index 0000000..dbba410 --- /dev/null +++ b/2_ILSLib/FB/Misc/FB_VarioFingerMonitoring.scl @@ -0,0 +1,43 @@ +FUNCTION_BLOCK "FB_VarioFingerMonitoring" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSenFinger : "UDT_Sensor"; // Das zu überwachende Fingerabfrage-Signal + xInMotorRun : Bool; // Vario an + stInSettings : "UDT_SettingsVarioFingerMonitoring"; // Parameter Einstellungen + END_VAR + + VAR_OUTPUT + xOutErrorSignal : Bool; // Fehler Ausgang + END_VAR + + VAR + tOn_SignalHigh {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Einschaltverzögerung High Signal + tOn_SignalLow {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Einschaltverzögerung Low Signal + tOnMotorRunningDelay {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Einschaltverzögerung Vario an + xErrorSignal : Bool; // Fehler + END_VAR + + +BEGIN + REGION Überwachung Raster Sensor + + #tOnMotorRunningDelay(IN := #xInMotorRun, // CarouselRun muss delayed benutzt werden, wegen Anfahrzeit vom ETF + PT := #stInSettings.tDelayMotorRun); + + #tOn_SignalHigh(IN := #xInMotorRun AND #tOnMotorRunningDelay.Q AND #stInSenFinger.xDirectSensor, + PT := #stInSettings.tSignalHigh); + + #tOn_SignalLow(IN := #xInMotorRun AND #tOnMotorRunningDelay.Q AND NOT #stInSenFinger.xDirectSensor, + PT := #stInSettings.tSignalLow); + + #xErrorSignal := #tOn_SignalHigh.Q OR #tOn_SignalLow.Q; // Wenn einer der beiden Timer abläuft, dann Fehler! + END_REGION + + REGION Ausgänge + + #xOutErrorSignal := #xErrorSignal AND #stInSettings.xEnableSupervision; // Fehler ausgeben, wenn Überwachung aktiviert + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.libinfo b/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.libinfo new file mode 100644 index 0000000..c44ba1c --- /dev/null +++ b/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: a394caf2-9e35-454c-b109-30b66c22bddd +LibraryVersion: + VersionNumber: 0.0.7 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Bugfix bei 3 Sources diff --git a/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.libint b/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.libint new file mode 100644 index 0000000..e2c166a --- /dev/null +++ b/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.libint @@ -0,0 +1,15 @@ +DocumentHash: + - FileName: Fb_PriorityManagerV2.scl + Hash: wqqBp67364m0gt+16CtbP8q4g79tHCbzSx8tBn/Ivl4= +LibraryMetaFileHash: 6XcCS8ObOmcFHFc3eoOsI0dRjol0UJSqGnS3J29XZwU= +LibraryVersion: + Guid: 9a9ac382-d0ec-462d-9753-478a90c82276 + DependsOn: + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 + - TypeName: UDT_PrioParameter + VersionNumber: 2.0.0 + - TypeName: udt_InterruptParameter + VersionNumber: 0.0.1 diff --git a/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.scl b/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.scl new file mode 100644 index 0000000..7b730cf --- /dev/null +++ b/2_ILSLib/FB/Misc/Fb_PriorityManagerV2.scl @@ -0,0 +1,2087 @@ +FUNCTION_BLOCK "Fb_PriorityManagerV2" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInQuit : Bool; + udtIn_Source1Req : "UDT_Request"; + udtIn_Source2Req : "UDT_Request"; + udtIn_Source3Req : "UDT_Request"; + udtIn_Source4Req : "UDT_Request"; + nIn_SwitchAmountSoruce1 : UDInt; + nIn_SwitchAmountSoruce2 : UDInt; + nIn_SwitchAmountSoruce3 : UDInt; + nIn_SwitchAmountSoruce4 : UDInt; + nIn_PrioInterrupt : UInt; + wsIn_ObjectName : WString[50]; + tIn_ReleaseTime1 : Time; + tIn_ReleaseTime2 : Time; + tIn_ReleaseTime3 : Time; + tIn_ReleaseTime4 : Time; + tIn_Watchdog : Time; + tin_InterruptMaxDuration : Time; + tIn_SourceChangeDelayTime : Time := T#10s; // Zeit die abgewartet wird bis ein Source Wechsel stattfinden darf + xInClearJam : Bool; + END_VAR + + VAR_OUTPUT + udtOut_Source1Resp : "UDT_Response"; + udtOut_Source2Resp : "UDT_Response"; + udtOut_Source3Resp : "UDT_Response"; + udtOut_Source4Resp : "UDT_Response"; + END_VAR + + VAR_IN_OUT + udt_PrioParameter : "UDT_PrioParameter"; + udt_InterruptParameter : "udt_InterruptParameter"; + END_VAR + + VAR + PrgAlarm_Failmessage {InstructionName := 'Program_Alarm'; LibVersion := '1.0'} : Program_Alarm; + xDummy : Bool; + xError : Bool; + wsErrorMessage : WString[50]; + nErrorID : USInt; + n_AmountSource : USInt; + n_TimedMode2Source : USInt; + n_QuantityMode2Source : USInt; + n_TraficLightMode2Source : USInt; + n_InterruptMode2Source : USInt; + n_TimedMode3Source : USInt; + n_QuantityMode3Source : USInt; + n_TraficLightMode3Source : USInt; + n_TimedMode4Source : USInt; + n_QuantityMode4Source : USInt; + n_TraficLightMode4Source : USInt; + n_CounterSource1 : UDInt; + n_CounterSource2 : UDInt; + n_CounterSource3 : UDInt; + n_CounterSource4 : UDInt; + ton_ReleaseSource1 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseSource2 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseSource3 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseSource4 {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_InterruptDelay {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_ReleaseInterrupt {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_WatchdogQuantity {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_runtime {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + ton_InterruptMaxDuration {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + arrx_SourcePrio : Array[0..4] of Bool; + arrx_SourcePrioClear : Array[0..4] of Bool; + udt_MainSourceResp : "UDT_Response"; + udt_InterruptSourceREsp : "UDT_Response"; + udt_InterruptSourceReq : "UDT_Request"; + END_VAR + + VAR_TEMP + nTempRetVal : Int; + tTempLocalTime {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; + nCount : USInt; + END_VAR + + VAR CONSTANT + "****NumberOfSources****" : Bool; + c4Sources : USInt := 4; + c3Sources : USInt := 3; + c2Sources : USInt := 2; + c1Source : USInt := 1; + c10ErrorNoSource : USInt := 10; + "****PrioMode******" : USInt; + c1ZeitGesteuert : USInt := 1; + c2MengenGesteuert : USInt := 2; + c3PrioAmpel : USInt := 3; + c4Interrupt : USInt := 4; + "****Sources****" : USInt; + cSource1 : USInt := 1; + cSource2 : USInt := 2; + "****Sequence*****" : USInt; + c000_WaitForRequest : USInt; + c010_SetReleaseSource1 : USInt := 10; + c010_WaitPathClear : USInt := 10; + c020_SetReleaseSourceInterrupt : USInt := 20; + c011_Countup : USInt := 11; + c012_WaitShuttleGone : USInt := 12; + c015_Reset : USInt := 15; + c020_SetReleaseSource2 : USInt := 20; + c021_Countup : USInt := 21; + c022_WaitShuttleGone : USInt := 22; + c025_Reset : USInt := 25; + c030_SetReleaseSource3 : USInt := 30; + c031_Countup : USInt := 31; + c032_WaitShuttleGone : USInt := 32; + c035_Reset : USInt := 35; + c040_SetReleaseSource4 : USInt := 40; + c041_Countup : USInt := 41; + c042_WaitShuttleGone : USInt := 42; + c045_Reset : USInt := 45; + END_VAR + + +BEGIN + REGION Info + (* Company: Schönenberger Systeme GmbH / (C) Copyright (2022). All rights reserved. + ----------------------------------------------------------------------------------------- + Title: FB_PriorityManager + Comment/Function: controls the priority at intersections + Library/Family: - + Author: department: "Automatisierung" ; person in charge / contact: C.Nottelmann (Automated Intelligence) + Target System: CPU 1518F-4 PN/DP + Engineering: TIA Portal V20 + Restrictions: - + Requirements: - + ----------------------------------------------------------------------------------------- + Change log table: + Version | Date | Signature (Safety) | Expert in charge | Changes applied + ------------|------------|--------------------|------------------|----------------------- + 001.000.000 | 2025-03-17 | - | | Header added on 17.03.2025 + + *) + END_REGION + + REGION LocalTime + // read local time for timestamp ------------------------------------------ + #nTempRetVal := RD_LOC_T(#tTempLocalTime); + END_REGION + + REGION ToDo + + (* + + - Blockierungen untereinander verhindern. MaxZeit offen? + + + + *) + + END_REGION + + REGION Times and Trigger + + #ton_ReleaseSource1(IN := #n_TimedMode2Source = #c010_SetReleaseSource1 + OR #n_TimedMode3Source = #c010_SetReleaseSource1 + OR #n_TimedMode4Source = #c010_SetReleaseSource1 + OR #n_TraficLightMode2Source = #c010_SetReleaseSource1 + OR #n_TraficLightMode3Source = #c010_SetReleaseSource1 + OR #n_TraficLightMode4Source = #c010_SetReleaseSource1, + PT := #tIn_ReleaseTime1); + + #ton_ReleaseSource2(IN := #n_TimedMode2Source = #c020_SetReleaseSource2 + OR #n_TimedMode3Source = #c020_SetReleaseSource2 + OR #n_TimedMode4Source = #c020_SetReleaseSource2 + OR #n_TraficLightMode2Source = #c020_SetReleaseSource2 + OR #n_TraficLightMode3Source = #c020_SetReleaseSource2 + OR #n_TraficLightMode4Source = #c020_SetReleaseSource2, + PT := #tIn_ReleaseTime2); + + #ton_ReleaseSource3(IN := #n_TimedMode3Source = #c030_SetReleaseSource3 + OR #n_TimedMode4Source = #c030_SetReleaseSource3 + OR #n_TraficLightMode3Source = #c030_SetReleaseSource3 + OR #n_TraficLightMode4Source = #c030_SetReleaseSource3, + PT := #tIn_ReleaseTime3); + + #ton_ReleaseSource4(IN := #n_TimedMode4Source = #c040_SetReleaseSource4 + OR #n_TraficLightMode4Source = #c040_SetReleaseSource4, + PT := #tIn_ReleaseTime4); + + #ton_WatchdogQuantity(IN := #n_QuantityMode2Source = #c010_SetReleaseSource1 + OR #n_QuantityMode2Source = #c020_SetReleaseSource2 + OR #n_QuantityMode3Source = #c010_SetReleaseSource1 + OR #n_QuantityMode3Source = #c020_SetReleaseSource2 + OR #n_QuantityMode3Source = #c030_SetReleaseSource3 + OR #n_QuantityMode4Source = #c010_SetReleaseSource1 + OR #n_QuantityMode4Source = #c020_SetReleaseSource2 + OR #n_QuantityMode4Source = #c030_SetReleaseSource3 + OR #n_QuantityMode4Source = #c040_SetReleaseSource4, + PT := #tIn_Watchdog); + + #ton_InterruptDelay(IN:=#n_InterruptMode2Source = #c010_WaitPathClear, + PT:=#udt_InterruptParameter.t_PathClearDelay); + + #ton_ReleaseInterrupt(IN:=#n_InterruptMode2Source = #c020_SetReleaseSourceInterrupt + AND NOT #udt_InterruptSourceReq.xTransportReq, + PT:=#udt_InterruptParameter.t_InterruptDuration); + + #ton_InterruptMaxDuration(IN:=#n_InterruptMode2Source = #c020_SetReleaseSourceInterrupt, + PT:=#tin_InterruptMaxDuration); + + + #ton_runtime(IN := (#n_TimedMode2Source = #c015_Reset) OR (#n_TimedMode2Source = #c025_Reset) OR (#n_TimedMode3Source = #c015_Reset) OR (#n_TimedMode3Source = #c025_Reset) OR (#n_TimedMode3Source = #c035_Reset), + PT := #tIn_SourceChangeDelayTime); + + END_REGION + + REGION Check number of sources + //Auswertung wieviele Eingänge verwendet werden + #nCount := 0; + + IF #udtIn_Source1Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + IF #udtIn_Source2Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + IF #udtIn_Source3Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + IF #udtIn_Source4Req.nTroId > 0 THEN + #nCount += 1; + END_IF; + + + #n_AmountSource := #nCount; + + //Keine Quelle definiert + + IF #n_AmountSource = 0 + THEN + #xError := TRUE; + #nErrorID := #c10ErrorNoSource; + END_IF; + + + END_REGION + + REGION Prio Mapping + + #arrx_SourcePrio[1] := #nIn_PrioInterrupt = #c1Source AND #udtIn_Source1Req.xTransportReq; + #arrx_SourcePrio[2] := #nIn_PrioInterrupt = #c2Sources AND #udtIn_Source2Req.xTransportReq; + #arrx_SourcePrio[3] := #nIn_PrioInterrupt = #c3Sources AND #udtIn_Source3Req.xTransportReq; + #arrx_SourcePrio[4] := #nIn_PrioInterrupt = #c4Sources AND #udtIn_Source4Req.xTransportReq; + END_REGION + + + REGION Prio Logic + + CASE #n_AmountSource OF + #c1Source: + REGION 1 Source + + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //keine Vorfahrtsregelung notwendig// + + END_REGION + #c2Sources: + REGION 2 Sources + CASE #udt_PrioParameter.nPrioMode OF + #c1ZeitGesteuert: + REGION Zeit gesteuert + CASE #n_TimedMode2Source OF + #c000_WaitForRequest: + //Action + //Zurücksetzen der nicht aktiven Sequenzen der anderen Modi + #n_QuantityMode2Source := 0; + #n_TraficLightMode2Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq // Prüfung ob ein Request ansteht + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 //Prüfen ob ein Stau im Förderbereich ansteht + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear //Prüfen ob ein Prio Interrupt ansteht + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[1] // Prio Interrupt Quelle 1 und Request Quelle 1 aktiv + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] // Prio Interrupt Quelle 2 und Request Quelle 2 aktiv + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; //Freigabe an TRO wird erteilt + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q // Warten bis vorgegebene Durchlasszeit endet + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1])//Prüfen ob während Druchlasszeit ein Prio interrupt ansteht + OR (NOT #udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source1Req.stSensor.xDbncdSensor AND #udtIn_Source1Req.stSensor.tDirectChangeLast > T#2s) + THEN + #n_TimedMode2Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; //Freigabe an TRO wird zurückgesetzt + + //Transition + // IF (#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam THEN + IF #udtIn_Source2Req.xTransportReq AND #ton_runtime.Q AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + ELSIF + (#udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + // END_IF; + // ELSIF NOT #xInClearJam AND #ton_runtime.Q THEN + (* IF #udtIn_Source2Req.xTransportReq + THEN + #n_TimedMode2Source := #c020_SetReleaseSource2; + ELSIF + (#udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + END_IF; *) + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + OR (NOT #udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source2Req.stSensor.xDbncdSensor AND #udtIn_Source2Req.stSensor.tDirectChangeLast > T#2s) + THEN + #n_TimedMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + // IF (#xInClearJam AND #udtIn_Source2Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam THEN + IF #udtIn_Source1Req.xTransportReq AND #ton_runtime.Q AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) + THEN + #n_TimedMode2Source := #c010_SetReleaseSource1; + ELSIF + (#udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source1Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode2Source := #c000_WaitForRequest; + END_IF; + // ELSIF NOT #xInClearJam AND #ton_runtime.Q THEN + // IF #udtIn_Source1Req.xTransportReq + // THEN + // #n_TimedMode2Source := #c010_SetReleaseSource1; + // ELSIF + // (#udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source1Req.xTransportReq) + // OR #arrx_SourcePrio <> #arrx_SourcePrioClear + // THEN + // #n_TimedMode2Source := #c000_WaitForRequest; + // END_IF; + // END_IF; + + END_CASE; + END_REGION + + + #c2MengenGesteuert: + REGION Mengen gesteuert + CASE #n_QuantityMode2Source OF + #c000_WaitForRequest: + //Action + #n_TimedMode2Source := 0; + #n_TraficLightMode2Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source1Req.xTrolleyPresent + THEN + #n_QuantityMode2Source := #c011_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode2Source := #c015_Reset; + END_IF; + + + #c011_Countup: + //Action + #n_CounterSource1 += 1; + + //Transition + #n_QuantityMode2Source := #c012_WaitShuttleGone; + + #c012_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 < #nIn_SwitchAmountSoruce1 + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 >= #nIn_SwitchAmountSoruce1 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_QuantityMode2Source := #c015_Reset; + END_IF; + + + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF #udtIn_Source2Req.xTransportReq + OR (#udtIn_Source1Req.xTransportReq AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c000_WaitForRequest; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source2Req.xTrolleyPresent + THEN + #n_QuantityMode2Source := #c021_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode2Source := #c025_Reset; + END_IF; + + #c021_Countup: + //Action + #n_CounterSource2 += 1; + + //Transition + #n_QuantityMode2Source := #c022_WaitShuttleGone; + + #c022_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 < #nIn_SwitchAmountSoruce2 + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 >= #nIn_SwitchAmountSoruce2 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_QuantityMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF #udtIn_Source1Req.xTransportReq + OR (#udtIn_Source2Req.xTransportReq AND NOT #udtIn_Source1Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode2Source := #c000_WaitForRequest; + END_IF; + + END_CASE; + END_REGION + #c3PrioAmpel: + REGION Ampel gesteuert + CASE #n_TraficLightMode2Source OF + #c000_WaitForRequest: + //Action + #n_QuantityMode2Source := 0; + #n_TimedMode2Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode2Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode2Source := #c020_SetReleaseSource2; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode2Source := #c020_SetReleaseSource2; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c000_WaitForRequest; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode2Source := #c000_WaitForRequest; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode2Source := #c000_WaitForRequest; + END_IF; + + END_CASE; + END_REGION + + #c4Interrupt: + + REGION Interrupt gesteuert + + REGION Interrupt Mapping + IF #udt_InterruptParameter.n_InterruptSource = #cSource1 + THEN + #udt_InterruptSourceReq := #udtIn_Source1Req; + ELSIF #udt_InterruptParameter.n_InterruptSource = #cSource2 + THEN + #udt_InterruptSourceReq := #udtIn_Source2Req; + (* ELSE + Error *) + END_IF; + + + + END_REGION + + CASE #n_InterruptMode2Source OF + #c000_WaitForRequest: + //Action + #n_TimedMode2Source := 0; + #n_QuantityMode2Source := 0; + #n_TraficLightMode2Source := 0; + #udt_MainSourceResp.xReleaseOk := True; + #udt_InterruptSourceREsp.xReleaseOk := False; + + //Transition + IF #udt_InterruptSourceReq.xTransportReq + AND NOT #udt_InterruptSourceReq.stJamExit.Status.bByte.%X2 + AND #udt_InterruptSourceReq.stJamExit.Status.nCount < #udt_InterruptSourceReq.stJamExit.Config.nCapacitySet + AND #udt_InterruptSourceReq.stJamExit.Status.nCount < #udt_InterruptSourceReq.stJamExit.Config.nCapacityMax + THEN + #n_InterruptMode2Source := #c010_WaitPathClear; + + + END_IF; + + #c010_WaitPathClear: + //Action + #udt_MainSourceResp.xReleaseOk := FALSE; + + //Transition + IF #ton_InterruptDelay.Q + THEN + #n_InterruptMode2Source := #c020_SetReleaseSourceInterrupt; + END_IF; + + #c020_SetReleaseSourceInterrupt: + //Action + IF NOT #udt_InterruptSourceReq.stJamExit.Status.bByte.%X2 + AND #udt_InterruptSourceReq.stJamExit.Status.nCount < #udt_InterruptSourceReq.stJamExit.Config.nCapacitySet + AND #udt_InterruptSourceReq.stJamExit.Status.nCount < #udt_InterruptSourceReq.stJamExit.Config.nCapacityMax + THEN + + #udt_InterruptSourceREsp.xReleaseOk := True; + ELSE + #udt_InterruptSourceREsp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseInterrupt.Q AND NOT #udt_InterruptSourceReq.xTransportReq + OR #ton_InterruptMaxDuration.Q + THEN + #n_InterruptMode2Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udt_InterruptSourceREsp.xReleaseOk := False; + + //Transition + #n_InterruptMode2Source := #c000_WaitForRequest; + + + ; + END_CASE; + + REGION Output Mapping + + IF #udt_InterruptParameter.n_InterruptSource = #cSource1 + THEN + #udtOut_Source1Resp := #udt_InterruptSourceREsp; + #udtOut_Source2Resp := #udt_MainSourceResp; + ELSIF #udt_InterruptParameter.n_InterruptSource = #cSource2 + THEN + #udtOut_Source2Resp := #udt_InterruptSourceREsp; + #udtOut_Source1Resp := #udt_MainSourceResp; + END_IF; + + END_REGION + + + END_REGION + + + + END_CASE; + ; + + END_REGION + #c3Sources: + REGION 3 Sources + CASE #udt_PrioParameter.nPrioMode OF + #c1ZeitGesteuert: + REGION Zeit gesteuert + CASE #n_TimedMode3Source OF + #c000_WaitForRequest: + //Action + //Zurücksetzen der nicht aktiven Sequenzen der anderen Modi + #n_QuantityMode3Source := 0; + #n_TraficLightMode3Source := 0; + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[1] + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TimedMode3Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + // IF (#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam THEN + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weiter transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq AND #ton_runtime.Q AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + ELSIF(* NOT #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND*) #udtIn_Source3Req.xTransportReq + AND #ton_runtime.Q AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + END_IF; + // END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TimedMode3Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + // IF (#xInClearJam AND #udtIn_Source2Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam THEN + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq AND #ton_runtime.Q AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode3Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source1Req.xTransportReq AND #ton_runtime.Q // übernächste Quelle darf transportieren + (* AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq*) + AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + END_IF; + // END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TimedMode3Source := #c035_Reset; + END_IF; + + #c035_Reset: + + + + //************************************************************** + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + // IF (#xInClearJam AND #udtIn_Source3Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam THEN + IF NOT #udtIn_Source1Req.xTransportReq + AND (#udtIn_Source3Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source1Req.xTransportReq AND #ton_runtime.Q AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq AND #ton_runtime.Q // übernächste Quelle darf transportieren + // AND NOT #udtIn_Source1Req.xTransportReq + // AND NOT #udtIn_Source3Req.xTransportReq + AND ((#xInClearJam AND #udtIn_Source1Req.stJamExit.Status.nCount = 0) OR NOT #xInClearJam) + THEN + #n_TimedMode3Source := #c020_SetReleaseSource2; + END_IF; + // END_IF; + + END_CASE; + END_REGION + #c2MengenGesteuert: + REGION Mengen gesteuert + CASE #n_QuantityMode3Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source1Req.xTrolleyPresent + THEN + #n_QuantityMode3Source := #c011_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode3Source := #c015_Reset; + END_IF; + + #c011_Countup: + //Action + #n_CounterSource1 += 1; + + //Transition + #n_QuantityMode3Source := #c012_WaitShuttleGone; + + #c012_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 < #nIn_SwitchAmountSoruce1 + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + ELSIF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 >= #nIn_SwitchAmountSoruce1 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_QuantityMode3Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + THEN + #n_QuantityMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source2Req.xTrolleyPresent + THEN + #n_QuantityMode3Source := #c021_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode3Source := #c025_Reset; + END_IF; + + #c021_Countup: + //Action + #n_CounterSource2 += 1; + + //Transition + #n_QuantityMode3Source := #c022_WaitShuttleGone; + + #c022_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 < #nIn_SwitchAmountSoruce2 + THEN + #n_QuantityMode3Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 >= #nIn_SwitchAmountSoruce2 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_QuantityMode3Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq) + THEN + #n_QuantityMode3Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source1Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode3Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source3Req.xTrolleyPresent + THEN + #n_QuantityMode3Source := #c031_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode3Source := #c035_Reset; + END_IF; + + #c031_Countup: + //Action + #n_CounterSource3 += 1; + + //Transition + #n_QuantityMode3Source := #c032_WaitShuttleGone; + + #c032_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 < #nIn_SwitchAmountSoruce3 + THEN + #n_QuantityMode3Source := #c030_SetReleaseSource3; + ELSIF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 >= #nIn_SwitchAmountSoruce3 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_QuantityMode3Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + + #n_QuantityMode3Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + #c3PrioAmpel: + REGION Ampel gesteuert + CASE #n_TraficLightMode3Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c010_SetReleaseSource1; + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c020_SetReleaseSource2; + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[1] + THEN + #n_TraficLightMode3Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TraficLightMode3Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TraficLightMode3Source := #c030_SetReleaseSource3; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TraficLightMode3Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode3Source := #c020_SetReleaseSource2; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c000_WaitForRequest; + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TraficLightMode3Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode3Source := #c030_SetReleaseSource3; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c000_WaitForRequest; + END_IF; + + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TraficLightMode3Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + + #n_TraficLightMode3Source := #c000_WaitForRequest; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode3Source := #c000_WaitForRequest; + END_IF; + + + END_CASE; + + + END_REGION + + + + END_CASE; + ; + END_REGION + #c4Sources: + REGION 4 Sources + CASE #udt_PrioParameter.nPrioMode OF + #c1ZeitGesteuert: + REGION Zeit gesteuert + CASE #n_TimedMode4Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + ELSIF #arrx_SourcePrio[1] + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[4] + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TimedMode4Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + + ELSIF NOT #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TimedMode4Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode4Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + + ELSIF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TimedMode4Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source4Req.xTransportReq + AND (#udtIn_Source3Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TimedMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source4Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_TimedMode4Source := #c040_SetReleaseSource4; + ELSIF #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_TimedMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c040_SetReleaseSource4: + //Action + IF NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source4Resp.xReleaseOk := True; + ELSE + #udtOut_Source4Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource4.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[4]) + THEN + #n_TimedMode4Source := #c035_Reset; + END_IF; + + #c045_Reset: + //Action + #udtOut_Source4Resp.xReleaseOk := False; + + //Transition + + #n_TimedMode4Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + #c2MengenGesteuert: + REGION Mengen Gesteuert + + CASE #n_QuantityMode4Source OF + #c000_WaitForRequest: + //Action + + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + ELSIF #arrx_SourcePrio[1] + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[4] + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source1Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c011_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c015_Reset; + END_IF; + + #c011_Countup: + //Action + #n_CounterSource1 += 1; + + //Transition + #n_QuantityMode4Source := #c012_WaitShuttleGone; + + #c012_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 < #nIn_SwitchAmountSoruce1 + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + ELSIF NOT #udtIn_Source1Req.xTrolleyPresent + AND #n_CounterSource1 >= #nIn_SwitchAmountSoruce1 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_QuantityMode4Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source2Req.xTransportReq + AND (#udtIn_Source1Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source2Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + + ELSIF NOT #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source2Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c021_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c025_Reset; + END_IF; + + #c021_Countup: + //Action + #n_CounterSource2 += 1; + + //Transition + #n_QuantityMode4Source := #c022_WaitShuttleGone; + + #c022_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 < #nIn_SwitchAmountSoruce2 + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + ELSIF NOT #udtIn_Source2Req.xTrolleyPresent + AND #n_CounterSource2 >= #nIn_SwitchAmountSoruce2 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_QuantityMode4Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source3Req.xTransportReq + AND (#udtIn_Source2Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source3Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + ELSIF #udtIn_Source4Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + + ELSIF #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #udtIn_Source3Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c031_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c035_Reset; + END_IF; + + #c031_Countup: + //Action + #n_CounterSource3 += 1; + + //Transition + #n_QuantityMode4Source := #c032_WaitShuttleGone; + + #c032_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 < #nIn_SwitchAmountSoruce3 + THEN + #n_QuantityMode4Source := #c030_SetReleaseSource3; + ELSIF NOT #udtIn_Source3Req.xTrolleyPresent + AND #n_CounterSource3 >= #nIn_SwitchAmountSoruce3 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_QuantityMode4Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + IF NOT #udtIn_Source4Req.xTransportReq + AND (#udtIn_Source3Req.xTransportReq //Prüfen ob die gleiche Quelle weitet transportieren darf oder andere Quellen warten + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source2Req.xTransportReq) + OR #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_QuantityMode4Source := #c000_WaitForRequest; + ELSIF #udtIn_Source4Req.xTransportReq // nächste Quelle in der Reihe darf transportieren + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + ELSIF #udtIn_Source2Req.xTransportReq // übernächste Quelle darf transportieren + AND NOT #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source1Req.xTransportReq // letzte Quelle darf transportieren + AND NOT #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source4Req.xTransportReq + THEN + #n_QuantityMode4Source := #c010_SetReleaseSource1; + END_IF; + + #c040_SetReleaseSource4: + //Action + IF NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source4Resp.xReleaseOk := True; + ELSE + #udtOut_Source4Resp.xReleaseOk := False; + END_IF; + + //Transition + //Transition + IF #udtIn_Source4Req.xTrolleyPresent + THEN + #n_QuantityMode4Source := #c041_Countup; + ELSIF #ton_WatchdogQuantity.Q + THEN + #n_QuantityMode4Source := #c045_Reset; + END_IF; + + #c041_Countup: + //Action + #n_CounterSource4 += 1; + + //Transition + #n_QuantityMode4Source := #c042_WaitShuttleGone; + + #c042_WaitShuttleGone: + //Action + // + + //Transition + IF NOT #udtIn_Source4Req.xTrolleyPresent + AND #n_CounterSource4 < #nIn_SwitchAmountSoruce4 + THEN + #n_QuantityMode4Source := #c040_SetReleaseSource4; + ELSIF NOT #udtIn_Source4Req.xTrolleyPresent + AND #n_CounterSource4 >= #nIn_SwitchAmountSoruce4 + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[4]) + THEN + #n_QuantityMode4Source := #c045_Reset; + END_IF; + + #c045_Reset: + //Action + #udtOut_Source4Resp.xReleaseOk := False; + + //Transition + + #n_QuantityMode4Source := #c000_WaitForRequest; + + + END_CASE; + END_REGION + + #c3PrioAmpel: + REGION Ampel gesteuert + CASE #n_TraficLightMode4Source OF + #c000_WaitForRequest: + //Action + // + + //Transition + IF #udtIn_Source1Req.xTransportReq + AND NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c010_SetReleaseSource1; + + ELSIF #udtIn_Source2Req.xTransportReq + AND NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source2Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c020_SetReleaseSource2; + + ELSIF #udtIn_Source3Req.xTransportReq + AND NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c030_SetReleaseSource3; + + ELSIF #udtIn_Source4Req.xTransportReq + AND NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + AND #arrx_SourcePrio = #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c040_SetReleaseSource4; + + ELSIF #arrx_SourcePrio[1] + THEN + #n_TraficLightMode4Source := #c010_SetReleaseSource1; + ELSIF #arrx_SourcePrio[2] + THEN + #n_TraficLightMode4Source := #c020_SetReleaseSource2; + ELSIF #arrx_SourcePrio[3] + THEN + #n_TraficLightMode4Source := #c030_SetReleaseSource3; + ELSIF #arrx_SourcePrio[4] + THEN + #n_TraficLightMode4Source := #c040_SetReleaseSource4; + + END_IF; + + #c010_SetReleaseSource1: + //Action + IF NOT #udtIn_Source1Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source1Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source1Resp.xReleaseOk := True; + ELSE + #udtOut_Source1Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource1.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[1]) + THEN + #n_TraficLightMode4Source := #c015_Reset; + END_IF; + + #c015_Reset: + //Action + #udtOut_Source1Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode4Source := #c020_SetReleaseSource2; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c000_WaitForRequest; + END_IF; + + + #c020_SetReleaseSource2: + //Action + IF NOT #udtIn_Source2Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source2Req.stJamExit.Status.nCount < #udtIn_Source1Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source2Resp.xReleaseOk := True; + ELSE + #udtOut_Source2Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource2.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[2]) + THEN + #n_TraficLightMode4Source := #c025_Reset; + END_IF; + + #c025_Reset: + //Action + #udtOut_Source2Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode4Source := #c030_SetReleaseSource3; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c000_WaitForRequest; + END_IF; + + #c030_SetReleaseSource3: + //Action + IF NOT #udtIn_Source3Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source3Req.stJamExit.Status.nCount < #udtIn_Source3Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source3Resp.xReleaseOk := True; + ELSE + #udtOut_Source3Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource3.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[3]) + THEN + #n_TraficLightMode4Source := #c035_Reset; + END_IF; + + #c035_Reset: + //Action + #udtOut_Source3Resp.xReleaseOk := False; + + //Transition + #n_TraficLightMode4Source := #c040_SetReleaseSource4; + IF #arrx_SourcePrio <> #arrx_SourcePrioClear + THEN + #n_TraficLightMode4Source := #c000_WaitForRequest; + END_IF; + + #c040_SetReleaseSource4: + //Action + IF NOT #udtIn_Source4Req.stJamExit.Status.bByte.%X2 + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacitySet + AND #udtIn_Source4Req.stJamExit.Status.nCount < #udtIn_Source4Req.stJamExit.Config.nCapacityMax + THEN + #udtOut_Source4Resp.xReleaseOk := True; + ELSE + #udtOut_Source4Resp.xReleaseOk := False; + END_IF; + + //Transition + IF #ton_ReleaseSource4.Q + OR (#arrx_SourcePrio <> #arrx_SourcePrioClear AND NOT #arrx_SourcePrio[4]) + THEN + #n_TraficLightMode4Source := #c035_Reset; + END_IF; + + #c045_Reset: + //Action + #udtOut_Source4Resp.xReleaseOk := False; + + //Transition + + #n_TraficLightMode4Source := #c000_WaitForRequest; + + + END_CASE; + + END_REGION + + + + END_CASE; + ; + END_REGION + + END_CASE; + + + + + + END_REGION + + + + + REGION Error Management + //Quit setzt Error Word zurück + IF #xInQuit + THEN + #xError := False; + END_IF; + + IF #xError AND #nErrorID = #c10ErrorNoSource + THEN + #wsErrorMessage := WSTRING#'Keine Quelle konfiguriert'; + + END_IF; + + #PrgAlarm_Failmessage(SIG := #xError, + TIMESTAMP := #tTempLocalTime, + SD_1 := #wsIn_ObjectName, + SD_2 := #wsErrorMessage); + + + + END_REGION + + + + + + + + + + + + + + + + + + + + + + + + + + + +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/Misc/udt_InterruptParameter.libinfo b/2_ILSLib/FB/Misc/udt_InterruptParameter.libinfo new file mode 100644 index 0000000..77bb6ec --- /dev/null +++ b/2_ILSLib/FB/Misc/udt_InterruptParameter.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 97355db0-90c7-4394-9656-3acdfec45b04 +LibraryVersion: + VersionNumber: 0.0.1 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FB/Misc/udt_InterruptParameter.libint b/2_ILSLib/FB/Misc/udt_InterruptParameter.libint new file mode 100644 index 0000000..fe6c54f --- /dev/null +++ b/2_ILSLib/FB/Misc/udt_InterruptParameter.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: udt_InterruptParameter.xml + Hash: /NW/PME3L1cRjrOlhQBiYc3MllTZmwH9rHeW0kDHx+8= +LibraryMetaFileHash: JrEilA2LwOeiJO3O1jHkH6aZ5ts+YupQo1GyUy1aXTE= +LibraryVersion: + Guid: bd3b46ca-0cf0-47fc-9154-7e6e814179d1 diff --git a/2_ILSLib/FB/Misc/udt_InterruptParameter.xml b/2_ILSLib/FB/Misc/udt_InterruptParameter.xml new file mode 100644 index 0000000..f456da9 --- /dev/null +++ b/2_ILSLib/FB/Misc/udt_InterruptParameter.xml @@ -0,0 +1,64 @@ + + + + + + +
+ + + + +
+
+ udt_InterruptParameter + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.libinfo b/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.libinfo new file mode 100644 index 0000000..0d6bf4b --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: d73846b1-6cd6-414c-ac23-6600e2c98ae1 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.8 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Änderung im unterlagerten Baustein diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.libint b/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.libint new file mode 100644 index 0000000..46c8b54 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.libint @@ -0,0 +1,23 @@ +DocumentHash: + - FileName: FB_ILS_STRO_Sep.scl + Hash: ClpGJAP0rCePPppOePfUPWKhtBF5jadrRtG4uqH1LqQ= +LibraryMetaFileHash: bMOFh4gjS1nJGgij/mqFtWyO0w1x3qlbe7js1JoclZA= +LibraryVersion: + Guid: 456c4cee-f3c8-4642-aa97-cf33a9152512 + DependsOn: + - TypeName: UDT_HMI_Separator + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: IntfSeparator + VersionNumber: 2.0.0 + - TypeName: SettingsSeparator + VersionNumber: 2.0.1 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.scl b/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.scl new file mode 100644 index 0000000..e3f11d2 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Sep.scl @@ -0,0 +1,644 @@ +FUNCTION_BLOCK "FB_ILS_STRO_Sep" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInConveyorRun : Bool; // Antrieb läuft + stInTrolley : "UDT_Sensor"; // Separator In-Sensor + xInReceiveReady : Bool; // Freigabe + xInErrQuit : Bool; // Fehler quittieren + xInReset : Bool; // Baustein rücksetzen + xInPinSort : Bool := false; // Sep für das Einsortieren am Pinband + stInSettings : "SettingsSeparator"; + END_VAR + + VAR_OUTPUT + stOutMainTro : "IntfSeparator"; // Interface für MainTro + xOutConveyorRequest : Bool; + xOutTrolleyRequest : Bool; + xOutTrolleyInSep : Bool; + xOutTrolleyReleasedEdge : Bool; // Flanke bei neuen Trolley am Ausgang + xOutStopper : Bool; + wOutErrorWord : Word; + END_VAR + + VAR_IN_OUT + stInOutMainState : "UDT_MainState"; + stInOutHMI : "UDT_HMI_Separator"; // HMI Schnittstelle + stInOutCarrDataInJam : Array[*] of "stCarrier"; + END_VAR + + VAR + fbStateManager : "FB_StateManager"; + stCarrierDummy { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : "stCarrier"; + tOnHandling {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + tOnTrailing {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + tOnMonitoring {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + END_VAR + VAR RETAIN + CountCarr {InstructionName := 'CTU_UDINT'; LibVersion := '1.0'} : CTU_UDINT; + END_VAR + VAR + rTrigCount {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; + nArrayMax : Int; + END_VAR + VAR RETAIN + nState : Int; + END_VAR + VAR + nLastStep { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Int; + arStepHistory : Array[0..10] of Struct + StepNum : Int; + TimeStamp {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; + END_STRUCT; + fbMonitoringCarrStuck : "FB_Monitoring"; // Carrier verlässt Separator nicht + fbMonitoringCarrMismatch : "FB_Monitoring"; // Separator Sensorik unplausibel (z.B. Part-Sensor ohne In-Sensor) + wErrorWord : Word; + stSimuSeparator : Struct + nState : Int; + xSensor : Bool; + END_STRUCT; + stSimuSensor : "UDT_Sensor"; + xCorrectionDone : Bool; // Einmal probieren + END_VAR + + VAR_TEMP + t_Status : Int; + t_Handling : Bool; + t_Trailing : Bool; + t_Monitoring : Bool; + tmpActUnivTon : Bool; + nCount : UDInt; + tmpCarrierEmpty : "stCarrier"; + tTrolley : "UDT_Sensor"; + END_VAR + + VAR CONSTANT + c000_StepInit : Int := 0; // Init + c100_StepWaitForTrolley : Int := 100; // Warte auf Trolley + c110_StepWaitForRelease : Int := 110; // Warte auf Freigabe + c120_StepOpen : Int := 120; // Separator öffnen + c130_StepWaitForLeave : Int := 130; // Warte auf Trolley verlassen + c140_StepClose1 : Int := 140; // Separator schliessen + END_VAR + + +BEGIN + // Prinzip: Unabhängig von Single Carrier oder Minitrolley -> Einzelachse am Separator takten + // Separator übernimmt nur die simple Funktion eines Separator-Moduls (In-Sensor, Stopper Auf, Stopper Zu) + // Alle anderen Überprüfungen (z.B. Zappler, Scanner) werden vom MainTro übernommen + + #nArrayMax := DINT_TO_INT(UPPER_BOUND(ARR := #stInOutCarrDataInJam, DIM := 1)); + + REGION Info + (*Errors + #wOutErrorWord.%X0 Step failure + #wOutErrorWord.%X1 Carrier stuck + #wOutErrorWord.%X2 Carrier mismatch + #wOutErrorWord.%X3 Carrier not arriving + #wOutErrorWord.%X4 Motor not running + #wOutErrorWord.%X5 res5 + #wOutErrorWord.%X6 res6 + #wOutErrorWord.%X7 res7 + #wOutErrorWord.%X8 res8 + #wOutErrorWord.%X9 res9 + #wOutErrorWord.%X10 res10 + #wOutErrorWord.%X11 res11 + #wOutErrorWord.%X12 res12 + #wOutErrorWord.%X13 res13 + #wOutErrorWord.%X14 res14 + #wOutErrorWord.%X15 Modul reset + *) + END_REGION + + REGION MT Separator Simu + //Simuliert Ablauf für Minitrolley (Sensorverhalten mit Timern nachgebildet) + IF #stInSettings.stSimu.xActive THEN + IF NOT #stInOutCarrDataInJam[1].bStatus.%X0 THEN + #stSimuSeparator.nState := 100; + END_IF; + + CASE #stSimuSeparator.nState OF + 100: //INIT / STANDBY + #stSimuSeparator.xSensor := FALSE; + IF #stInOutCarrDataInJam[1].bStatus.%X0 + // AND #stInOutCarrDataInJam[1].nSimuPos = #stInSettings.stSimu.stJamConfig.nMaxPos + AND (#stOutMainTro.nStatus = "SepState_WaitForBt" OR #stOutMainTro.nStatus = "SepState_WaitForReq") + THEN + #stSimuSeparator.nState := 200; + END_IF; + 200: // First MT + #stSimuSeparator.xSensor := TRUE; + IF #stOutMainTro.nStatus = "SepState_Open" THEN + #tmpActUnivTon := TRUE; + IF #fbStateManager.tOutUnivTonR > #stInSettings.stSimu.tSenTime THEN + #stSimuSeparator.xSensor := FALSE; + #stSimuSeparator.nState := 300; + END_IF; + END_IF; + 300: + IF #stOutMainTro.nStatus = "SepState_WaitForSecondLeg" THEN + #stSimuSeparator.nState := 400; + END_IF; + 400: + #stSimuSeparator.xSensor := TRUE; + IF #stOutMainTro.nStatus = "SepState_OpenSecond" THEN + #tmpActUnivTon := TRUE; + IF #fbStateManager.tOutUnivTonR > #stInSettings.stSimu.tSenTime THEN + #stSimuSeparator.xSensor := FALSE; + #stSimuSeparator.nState := 100; + END_IF; + END_IF; + END_CASE; + + END_IF; + REGION Sensor Simu + // #fbSimuSensorInput(sInName := #stInTrolley.sName, + // xInSensor := #stSimuSeparator.xSensor, + // stInOutSensor := #stSimuSensor, + // stInOutHMI:= #stInOutHMI. + // stInOutControlUnitCabinet:=#stInOutMainState); + END_REGION + + REGION State Manager Simu + (* #fbStateManager.stInSettings.nStartState := 0; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := TRUE, + xInRunUnivTOn := #tmpActUnivTon, + nInOutState := #stSimuSeparator.#nState); *) + END_REGION + END_REGION + + REGION Sensor Simu + IF #stInSettings.stSimu.xActive THEN + #tTrolley := #stSimuSensor; + ELSE + #tTrolley := #stInTrolley; + END_IF; + END_REGION + + REGION ErrorQuitt + IF #xInErrQuit THEN + #wErrorWord := 0; + END_IF; + END_REGION + + REGION Reset + IF #xInReset THEN + #nState := 000; // Setz alles auf 0 + #wErrorWord.%X15 := true; // warning, modul reset + END_IF; + END_REGION + + + REGION Step sequence + CASE #nState OF + #c000_StepInit: + REGION Step 000 - init + //akt. Zustand + #stOutMainTro.nStatus := "SepState_Init"; + //Outputs + #xOutStopper := FALSE; //Separator zu + #xOutTrolleyReleasedEdge := FALSE; //Datenübergabe rücksetzen + #xOutConveyorRequest := FALSE; // Förderer Anforderung rücksetzen + #xOutTrolleyRequest := FALSE; // Trolley Anforderung rücksetzen + #xOutTrolleyInSep := FALSE; // Trolley im Separator rücksetzen + + // SCHRITT 0 NICHT ENTFERNEN! + // STATE MANAGER MACHT DEN SCHRITTWECHSEL! + + END_REGION + #c100_StepWaitForTrolley: + REGION Step 100 - wait for trolley + //akt. Zustand + #stOutMainTro.nStatus := "SepState_WaitForBt"; // TODO + + #xOutStopper := FALSE; // Separator zu + #xOutTrolleyReleasedEdge := FALSE; // Datenübergabe rücksetzen + #xOutConveyorRequest := FALSE; // Förderer Anforderung rücksetzen + #xOutTrolleyRequest := TRUE; // Trolley Anforderung + + #xCorrectionDone := FALSE; + + IF #tTrolley.xDirectSensor THEN // Trolley im Separator + #nState := #c110_StepWaitForRelease; // Schrittwechsel + END_IF; + END_REGION + #c110_StepWaitForRelease: + REGION Step 110 - wait release request + // akt. Zustand + #stOutMainTro.nStatus := "SepState_WaitForReq"; + // Outputs + #xOutStopper := FALSE; // Separator ZU + #xOutTrolleyRequest := FALSE; + #xOutTrolleyInSep := (#xInPinSort AND #tTrolley.xDirectSensor) OR (NOT #xInPinSort AND #tTrolley.xDbncdSensor); + #xOutConveyorRequest := #xInReceiveReady AND NOT #stInOutHMI.stControl.xLockSeparator; //Bedingung von Außen erfüllt -> Conv anfordern + + #xCorrectionDone := FALSE; + //Transition + + IF #xInConveyorRun AND #xInReceiveReady AND #tTrolley.xDbncdSensor AND NOT #stInOutHMI.stControl.xLockSeparator THEN + #nState := #c120_StepOpen; + ELSIF NOT #tTrolley.xDirectSensor THEN + #nState := #c100_StepWaitForTrolley; + END_IF; + + (* //Transition + //Separator Pinband + IF #xInPinSort AND #xInConveyorRun AND NOT #xInScanDone AND #fbStateManager.tOutTimeInStep > T#80ms AND + #tTrolley.xDirectSensor THEN + #nState := #cStepOpen1; + // ELSIF #xInPinSort AND #xInConveyorRun AND #xInScanWrongLeg AND + // #tTrolley.xDirectSensor THEN + // #nState := #cStepOpen2Correction"; + //Normal + ELSIF (#xInConveyorRun AND + ((#xInPluggedScan AND #xInScanDone) OR NOT #xInPluggedScan) AND + ((#xInPluggedZappl AND #xInZappl) OR NOT #xInPluggedZappl) AND + #xInReceiveReady AND + + ((#tTrolley.xDbncdSensor AND NOT #xInPluggedScan) OR + (#tTrolley.xDirectSensor AND #xInPluggedScan)) AND //Freigabe + + NOT #stInOutHMI.stControl.xLockSeparator) // Keine HMI-Sperre + OR (#stInOutHMI.stControl.xReleaseOverride AND #tTrolley.xDbncdSensor) // HMI Override + THEN + #nState := #cStepOpen1; + //Fehlerhafte Lesung erkannt + ELSIF (#xInConveyorRun AND + #xInPluggedScan AND #xInScanWrongLeg AND + #xInReceiveReady AND + #tTrolley.xDirectSensor AND //Freigabe + + NOT #stInOutHMI.stControl.xLockSeparator) // Keine HMI-Sperre + OR (#stInOutHMI.stControl.xReleaseOverride AND #tTrolley.xDbncdSensor) // HMI Override + THEN + #nState := #cStepOpen2Correction; + // ??????????????????????????????? Kein Receive?! + (* ELSIF (NOT #xInPluggedScan AND + NOT #xInPluggedZappl AND + #tTrolley.xDbncdSensor AND //Freigabe + + NOT #stInOutHMI.stControl.xLockSeparator) // Keine HMI-Sperre + OR (#stInOutHMI.stControl.xReleaseOverride AND #tTrolley.xDbncdSensor) // HMI Override + THEN + #nState := #cStepOpen1; *) + // Trolley nicht mehr da + ELSIF NOT #tTrolley.xDirectSensor THEN + #nState := #cStepWaitForTrolley1; + END_IF; *) + END_REGION + + #c120_StepOpen: + REGION Step 120 - separator open + // akt. Zustand + #stOutMainTro.nStatus := "SepState_Open"; + + //Outputs + #xOutConveyorRequest := TRUE; // motor on + #xOutStopper := TRUE; // stopper open + #xOutTrolleyInSep := FALSE; + + //Überwachung + #t_Monitoring := #xInConveyorRun; + IF #tOnMonitoring.Q THEN + #wOutErrorWord.%X1 := TRUE; // err trolley stuck + END_IF; + + // Transition + IF NOT #tTrolley.xDbncdSensor THEN + #nState := #c130_StepWaitForLeave; + ELSIF #tOnMonitoring.Q AND #stInSettings.xStuckCorrection AND NOT #xCorrectionDone THEN + #nState := 121; + END_IF; + + (* //Transition + //Korrektur + IF #xInPinSort AND #xInScanWrongLeg THEN + #nState := #cStepOpen2Correction; + //Mit Scanner + ELSIF #xInPluggedScan AND NOT #tTrolley.xDirectSensor THEN + (* #xInConveyorRun AND *) // motor on? + #xOutStopper := FALSE; + #nState := #cStepWaitForRelease2; + #xOutFirstLegReleasedEdge := TRUE; + // Ohne Scanner + ELSIF NOT #xInPluggedScan AND + NOT #tTrolley.xDbncdSensor // trolley running out? + THEN + #nState := #cStepWaitForLeave1; + END_IF; *) + END_REGION + + 121: + // akt. Zustand + #stOutMainTro.nStatus := "SepState_Open"; + + //Outputs + #xOutConveyorRequest := TRUE; // motor on + #xOutStopper := FALSE; // stopper open + #xOutTrolleyInSep := FALSE; + + #xCorrectionDone := TRUE; + + IF #fbStateManager.tOutTimeInStep > t#500ms THEN + #nState := #c120_StepOpen; + END_IF; + #c130_StepWaitForLeave: + REGION Step 130 - wait trolley exit + // akt. Zustand + #stOutMainTro.nStatus := "SepState_WaitForLeaveFirst"; + + //Outputs + #xOutConveyorRequest := TRUE; // motor on + #xOutStopper := TRUE; // stopper open + #t_Trailing := #xInConveyorRun AND NOT #tTrolley.xDirectSensor; // Zeit neu aufziehen wenn Sensor frei wird + + #xCorrectionDone := FALSE; + // Transition + IF #tOnTrailing.Q THEN + #nState := #c140_StepClose1; + #xOutTrolleyReleasedEdge := TRUE; + END_IF; + END_REGION + #c140_StepClose1: + REGION Step 140 - separator close + // akt. Zustand + #stOutMainTro.nStatus := "SepState_Finish"; + + #xCorrectionDone := FALSE; + //Outputs + #xOutTrolleyReleasedEdge := FALSE; // Datenübergabe + #xOutStopper := FALSE; // Separator ZU + #t_Handling := #xInConveyorRun; + + //Transition + #nState := #c100_StepWaitForTrolley; + + END_REGION + (* #cStepWaitForTrolley2: + REGION Step 200 - wait for trolley second + // akt. Zustand + #stOutMainTro.nStatus := "SepState_WaitForSecondLeg"; + + //Outputs + #xOutStopper := FALSE; // Separator ZU + #xOutTrolleyReleasedEdge := FALSE; // Datenübergabe + #xOutFirstLegReleasedEdge := FALSE; + #xOutConveyorRequest := FALSE; // + #xOutTrolleyRequest := TRUE; + #xOutTrolleyScanRdy := FALSE; + + // Transition + // MT 2.Bein kommt nicht.. + IF #fbStateManager.tOutTimeInStep > T#3s AND #xInConveyorRun AND + NOT #xInPluggedScan THEN + #nState := #cStepWaitForTrolley1; + END_IF; + + //Normal + IF + #tTrolley.xDirectSensor // Trolley im Separator + THEN + #nState := #cStepWaitForRelease2; + END_IF; + END_REGION + #cStepWaitForRelease2: + REGION Step 210 - wait release request second + // akt. Zustand + #stOutMainTro.nStatus := "SepState_WaitForReqSecond"; + + //Outputs + #xOutStopper := FALSE; // Separator ZU + #xOutTrolleyRequest := FALSE; + #xOutTrolleyInSep := (#xInPinSort AND #tTrolley.xDirectSensor) OR (NOT #xInPinSort AND #tTrolley.xDbncdSensor); + #xOutConveyorRequest := #xInReceiveReady AND NOT #stInOutHMI.stControl.xLockSeparator; //Bedingung von Außen erfüllt -> Conv anfordern + #xOutTrolleyScanRdy := #xInPluggedScan (* AND #xInScanDone *); + + //Transition + + // IF (#xInConveyorRun AND + // ((#xInPinSort AND #xInScanWrongLeg) OR (#xInPinSort AND #xInScanDone)) AND + // ((#xInPluggedZappl AND #xInZappl) OR NOT #xInPluggedZappl) AND + // #xInReceiveReady AND + + // ((#tTrolley.xDbncdSensor AND NOT #xInPluggedScan) OR + // (#tTrolley.xDirectSensor AND #xInPluggedScan)) AND //Freigabe + + // NOT #stInOutHMI.stControl.xLockSeparator) // Keine HMI-Sperre + // OR (#stInOutHMI.stControl.xReleaseOverride AND #tTrolley.xDbncdSensor) // HMI Override + // THEN + // #nState := #cStepOpen2Correction; + IF (#xInConveyorRun AND + ((#xInPluggedScan (* AND #xInScanDone *)) OR NOT #xInPluggedScan) AND + ((#xInPluggedZappl AND #xInZappl) OR NOT #xInPluggedZappl) AND + #xInReceiveReady AND + + ((#tTrolley.xDbncdSensor AND NOT #xInPluggedScan) OR + (#tTrolley.xDirectSensor AND #xInPluggedScan)) AND //Freigabe + + NOT #stInOutHMI.stControl.xLockSeparator) // Keine HMI-Sperre + OR (#stInOutHMI.stControl.xReleaseOverride AND #tTrolley.xDbncdSensor) // HMI Override + THEN + #nState := #cStepOpen2; + ELSIF NOT #tTrolley.xDirectSensor THEN + #nState := #cStepWaitForTrolley2; + END_IF; + END_REGION + #cStepOpen2: + REGION Step 220 - separator open second + // akt. Zustand + #stOutMainTro.nStatus := "SepState_OpenSecond"; + + // Outputs + #xOutConveyorRequest := TRUE; // motor on + #xOutStopper := TRUE; // stopper open + #xOutTrolleyInSep := FALSE; + #xOutTrolleyScanRdy := FALSE; + + #t_Monitoring := #xInConveyorRun; + IF #tOnMonitoring.Q THEN + #wErrorWord.%X1 := TRUE; // err trolley stuck + END_IF; + + // Transition + // Mit Scanner + IF #xInPluggedScan AND NOT #tTrolley.xDirectSensor THEN + #xOutStopper := FALSE; + #nState := #cStepWaitForTrolley1; + #xOutTrolleyReleasedEdge := TRUE; // Datenübergabe + // Ohne Scanner + ELSIF NOT #xInPluggedScan AND + (* #xInConveyorRun AND *) // monor on? + NOT #tTrolley.xDbncdSensor // trolley running out? + THEN + #nState := #cStepWaitForLeave2; + END_IF; + END_REGION + #cStepOpen2Correction: + REGION Step 225 - separator open second without Data + // akt. Zustand + #stOutMainTro.nStatus := "SepState_OpenSecondCorrection"; + + // Outputs + #xOutConveyorRequest := TRUE; // motor on + #xOutStopper := TRUE; // stopper open + #xOutTrolleyInSep := FALSE; + #xOutTrolleyScanRdy := FALSE; + + #t_Monitoring := #xInConveyorRun; + IF #tOnMonitoring.Q THEN + #wErrorWord.%X1 := TRUE; // err trolley stuck + END_IF; + + // Transition + IF #xInPluggedScan AND NOT #tTrolley.xDirectSensor THEN + #xOutStopper := FALSE; + #nState := #cStepWaitForTrolley1; + END_IF; + END_REGION + #cStepWaitForLeave2: + REGION Step 230 - wait trolley exit second + // akt. Zustand + #stOutMainTro.nStatus := "SepState_WaitForLeaveSecond"; + + // Output + #xOutConveyorRequest := TRUE; // motor on + #xOutStopper := TRUE; // stopper open + #t_Trailing := TRUE(* #xInConveyorRun *); + + // Transition + IF #tOnTrailing.Q THEN //....ansonsten schließe normal nach Trailing-Zeit + #nState := #cStepClose2; + #xOutTrolleyReleasedEdge := TRUE; // Datenübergabe + END_IF; + + END_REGION + #cStepClose2: + REGION Step 240 - separator close second + // akt. Zustand + #stOutMainTro.nStatus := "SepState_Finish"; + + // Outputs + #xOutTrolleyReleasedEdge := FALSE; + #xOutStopper := FALSE; // Separator ZU + #t_Handling := TRUE;(* #xInConveyorRun *) + + // Transition + //WENN HIER BEARBEITUNGSZEIT EINGEFÜGT WIRD MUSS DER COUNTER UNTEN MIT FLANKE VERSORGT WERDEN + IF + #tOnHandling.Q + THEN + #nState := #cStepWaitForTrolley1; + END_IF; + END_REGION *) + ELSE + #wErrorWord.%X0 := true; // stepp error + END_CASE; + + REGION State Manager + #fbStateManager.stInSettings.nStartState := #c100_StepWaitForTrolley; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := TRUE, + xInRunUnivTOn := #tmpActUnivTon, + nInOutState := #nState); + END_REGION + + END_REGION + + REGION Counter + // #CountCarr(CU:=#nState = 040 AND NOT #xOutStopper, + // PV:=1, + // CV=>#nCount); + END_REGION + + REGION Monitoring + REGION Carrier stuck + #fbMonitoringCarrStuck.stSettings.nErrorType := 1; + #fbMonitoringCarrStuck.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrStuck.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrStuck(sInFctnName := #stInOutHMI.stConfig.sName, + sInPrefix := 'Ausfahren Carrier', + sInSuffix := #stInOutHMI.stConfig.sName, + wInTextListId_Function := 200, + wInTextListId_Message := 201, + InOutMachineState := #stInOutMainState, + xInQuitError := #xInErrQuit OR #stInOutMainState.xQuitError, + xInSignal := NOT #tOnMonitoring.Q, + sInAlarmMessage := 'Carrier verlaesst Separator nicht'); + END_REGION + + REGION Carrier Mismatch + #fbMonitoringCarrMismatch.stSettings.nErrorType := 1; + #fbMonitoringCarrMismatch.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrMismatch.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrMismatch(sInFctnName := #stInOutHMI.stConfig.sName, + sInPrefix := 'Carrier Mismatch', + InOutMachineState := #stInOutMainState, + xInQuitError := #xInErrQuit OR #stInOutMainState.xQuitError, + xInSignal := TRUE, //NOT #wOutErrorWord.%X2, + sInAlarmMessage := 'Carrier im Separator ist falsch'); + END_REGION + END_REGION + + REGION Timer + + #tOnHandling(IN := #t_Handling, + PT := #stInSettings.tHandlingTime); + + #tOnTrailing(IN := #t_Trailing, + PT := #stInSettings.tTrailingTime); + + #tOnMonitoring(IN := #t_Monitoring, + PT := t#4999ms, + Q => #wErrorWord.%X1); + END_REGION + + REGION HMI + + #stInOutHMI.InSensor := #tTrolley; + + REGION Status + #stInOutHMI.stStatus.nState := #nState; + #stInOutHMI.stStatus.xSepStatus := #xOutStopper; + + IF #wErrorWord > 0 THEN // Keine Fehler + #stInOutHMI.stStatus.bStatus := 2; // ERROR + ELSIF #stInOutHMI.stControl.xLockSeparator OR #stInOutHMI.stControl.xReleaseOverride THEN + #stInOutHMI.stStatus.bStatus := 3; // HMI Control aktiv + ELSE + CASE #nState OF + 0: + #stInOutHMI.stStatus.bStatus := 0; // NOT_AVAILABLE + 1, 10, 20, 30, 40, 101, 110, 120, 130, 140: + #stInOutHMI.stStatus.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutHMI.stStatus.bStatus := 0; // NOT AVAILABLE + END_CASE; + END_IF; + + #stInOutHMI.stStatus.xBtInSeparator := #tTrolley.xDbncdSensor; + #stInOutHMI.stStatus.xError := #wErrorWord > 0; + #stInOutHMI.stStatus.Errors.xBtNotLeaving := #wErrorWord.%X1; + // #stInOutHMI.stStatus.nCounterBt := #nCount; + #stInOutHMI.stStatus.xSepIsLocked := #stInOutHMI.stControl.xLockSeparator; + END_REGION + + END_REGION + + REGION MainTRO + + #stOutMainTro.xJamAtEntry := "cTodoFalse"; + #stOutMainTro.xBtPresent := #tTrolley.xDbncdSensor; + #stOutMainTro.xCarouselInRun := #xInConveyorRun; + // #stOutMainTro.nCounterBt := 0; TODO + + END_REGION + + + REGION Outputs + #wOutErrorWord := #wErrorWord; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.libinfo b/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.libinfo new file mode 100644 index 0000000..c4df1b8 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 2b644f30-a3a6-4abb-8b59-ef341fedf9f8 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.3 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Änderung im unterlagerten Baustein diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.libint b/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.libint new file mode 100644 index 0000000..5a88fd6 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.libint @@ -0,0 +1,27 @@ +DocumentHash: + - FileName: FB_ILS_STRO_Switch.scl + Hash: 9P7RKDDJCB4ecgwkOerVkPhsWbM1ghmNTGB0JOHqz9Y= +LibraryMetaFileHash: tW3IwZXtEUOhYe6m3WeSsBHU1VQgvUFATsU5LGcHoMI= +LibraryVersion: + Guid: 91175451-8c0e-4789-b302-fd2c134e9d15 + DependsOn: + - TypeName: IntfSwitch + VersionNumber: 2.0.0 + - TypeName: S2MSwitch + VersionNumber: 2.0.0 + - TypeName: FB_SetAlarmAndLog + VersionNumber: 2.0.1 + - TypeName: SettingsSwitch + VersionNumber: 2.0.0 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: UDT_UnloadingStation + VersionNumber: 0.0.6 + - TypeName: FC_Uint2TroString + VersionNumber: 2.0.0 + - TypeName: FC_usint2String + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.scl b/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.scl new file mode 100644 index 0000000..8d06105 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Switch.scl @@ -0,0 +1,1042 @@ +FUNCTION_BLOCK "FB_ILS_STRO_Switch" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : "SettingsSwitch" := (T#3s, (), (), (), (), (), (), (), (), (), (), (), (), (), ()); + stInSenExit3 : "UDT_Sensor"; // Sensor Input Exit 3 + stInSenExit4 : "UDT_Sensor"; // Sensor Input Exit 4 + nInMainTroNo : UInt; // Nummer des MainTro + nInSetSwitch : USInt; // 0: Es bleibt hier alles so wie es ist! | 1: E1->A3 | 2: E1->A4 | 3: E2->A3 | 4: E2->A4 + nInSwitchNo : USInt; // Nummer des Switch + nInActNoInSwitch : USInt; // Anzahl der BT die unterwegs sind von MainTRO gemeldet + xInBtInside : Bool; // Signal von Main TRO dass mind. ein BT "innerhalb der Weiche" ist + xInErrorQuit : Bool; // Error-Quit durch MainTro + xInSftyOk : Bool; // Safetyeingang + xInAllRdyToStart : Bool; // Eingang Anlage bereit + xInCarouselRun : Bool; // Carousel im Zustand Run + xInCancel : Bool; // Abbruchsignal durch MFR von MainTRO durchgeschleift + nInNextCarr : USInt; + xInReqFinished : Bool; // Info für Switch von MainTRO dass dieser fertig ist + xInDeqExternal : Bool; + tCarrierTransit : Time := T#2s; // Zeit, wie lange Carrier durch die Weiche braucht + END_VAR + + VAR_OUTPUT + stOutMfr : "S2MSwitch"; // Interface für MFR + stOutMainTro : "IntfSwitch"; // Interface MainTRO + arOutFifo : Array[1..6] of USInt; + xOutSwEntrTo1 : Bool; // Switch Entrance to 1 + xOutSwEntrTo2 : Bool; // Switch Entrance to 2 + xOutSwExTo3 : Bool; // Switch Exit to 3 + xOutSwExTo4 : Bool; // Switch Exit to 4 + nOutActCarrLeave : USInt; // Idx des Bt der die Weiche als letztes verlassen hat + nOutActCarrLeaveWrongDir : USInt; + xOutBtLeftSwitch : Bool; // Bt hat Weiche verlassen + xOutBtLeftSwitchWrongDir : Bool; + xOutPermSigOutSen3 : Bool; + xOutPermSigOutSen4 : Bool; + END_VAR + + VAR_IN_OUT + stInOutMachineState : "UDT_MainState"; + xInOutEnq : Bool; + stInOutHMI : "UDT_UnloadingStation"; + END_VAR + + VAR + fbSetAlarmAndLog : Array[0..1] of "FB_SetAlarmAndLog"; + fbStateManager : "FB_StateManager"; + END_VAR + VAR RETAIN + tOnTransitTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer der meldet wenn zu lange auf den BT am Ausgang gewartet wird + nState : Int; + xEntr1 : Bool; // Eingangsweiche zu Eingang 1 + xEntr2 : Bool; // Eingangsweiche zu Eingang 2 + xExit3 : Bool; // Ausgangsweiche zu Ausgang 3 + xExit4 : Bool; // Ausgangsweiche zu Ausgang 4 + END_VAR + VAR + xStartMotor : Bool; + xSwEntrState : Bool; // 0: Eingangsweiche geht auf Eingang 1 | 1: Eingangsweiche geht auf Eingang 2 + xSwExState : Bool; // 0: Ausgangsweiche geht auf Ausgang 3 | 1: Ausgangsweiche geht auf Ausgang 4 + END_VAR + VAR RETAIN + CountBTExit3 {InstructionName := 'CTU_UDINT'; LibVersion := '1.0'} : CTU_UDINT; // Instanz-CTU + CountBTExit4 {InstructionName := 'CTU_UDINT'; LibVersion := '1.0'} : CTU_UDINT; // Instanz-CTU + xCountUpExit3 : Bool; // Flag + xCountUpExit4 : Bool; // Flag + nCounterExit3 : UDInt; // Zähler am Ausgang 3 vom Switch + nCounterExit4 : UDInt; // Zähler am Ausgang 4 vom Switch + xTransitFlagState : Bool; // Wird für Erfassung des Flankenwechsels der BT-Anzahl im Transit benötigt + xSignalLongEx3 : Bool; // LongSignal an Ausgang 3 + xSignalVeryLongEx3 : Bool; // LongSignal an Ausgang 4 + xSignalLongEx4 : Bool; // VeryLongSignal an Ausgang 3 + xSignalVeryLongEx4 : Bool; // VeryLongSignal an Ausgang 4 + xTooEarlyTrigUnconf : Bool; // Trigger für die Zeitmessung des Too-Early-Signals bei Unconfirmed + END_VAR + VAR + xTooEarlyTrigConf : Bool; // Trigger für die Zeitmessung des Too-Early-Signals bei Confirmed + END_VAR + VAR RETAIN + tTooEarlyTimerUnconf {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer für Too-Early-Signal Unconfirmed + END_VAR + VAR + tTooEarlyTimerConf {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer für Too-Early-Signal Confirmed + END_VAR + VAR RETAIN + arCarrFifo : Array[1..6] of USInt; // Weichen-FIFO + nCarrIdxLeave : USInt; // Carrier (Index) der als nächster aus FIFO verschwindet + constInitialItem : USInt := 0; + xDeqSwitchFIFO : Bool; + xSwitchWrongDir : Bool; + END_VAR + VAR + xEnq : Bool; + END_VAR + VAR RETAIN + xPermSigSen3 : Bool; + xPermSigSen4 : Bool; + END_VAR + + VAR_TEMP + tmpStateWatch : Int; + tmpSetError : Bool; + tmpSetWarning : Bool; + tmpActUnivTon : Bool; // Trigger für Universal-Timer des StateManagers zur Verwendung in Schrittkette. + tmpTransitFlagChange : Bool; // Temp Bit für Flankenwechsel der BT-Anzahl im Transit + END_VAR + + VAR CONSTANT + cStep_Off : Int := 0; + cStep_Undefined : Int := 100; + cStep_WaitForReq : Int := 200; + cStep_WaitForCar : Int := 400; + cStep_Switch1To3 : Int := 700; + cStep_1To3OkWaitForTransit : Int := 750; + cStep_1To3OkWaitForChange : Int := 800; + cStep_Switch1To4 : Int := 900; + cStep_1To4OkWaitForTransit : Int := 950; + cStep_1To4OkWaitForChange : Int := 1000; + cStep_2To3OkWaitForTransit : Int := 1150; + cStep_2To3OkWaitForChange : Int := 1200; + cStep_2To4OkWaitForTransit : Int := 1350; + cStep_2To4OkWaitForChange : Int := 1400; + cStep_Switch2To3 : Int := 1100; + cStep_Switch2To4 : Int := 1300; + END_VAR + + +BEGIN + (* + SPS => MFR: Signal CARR (erfolgreiches Abbiegen an einer Weiche am Pinband??) + + SysFehler werden von Separator geprüft, nicht hier! + Unterscheiden, je nach dem ob alter oder neuer Switch: Ein- und Ausgang schalten oder nur Ausgang? + Unreserve-Funktion bei detektierter Fehlschaltung + Funktionen einfach: + - links oder rechts schalten + Funktionen detaillierter: + - HFS-ON, System-Fehler werden nicht geprüft, weil diese von Separator geprüft werden. + - TRO-Kommunikation Bearbeiten  + - Motoren starten und prüfen ob drehen. + - In-Switch schalten, falls vorhanden + - Switch schalten falls notwendig + - Verlassen-Sensor Signal  weiterbuchen + - Verlassen-Sensor LongSignal Bearbeiten + - Fehlschaltung detektieren und Bearbeiten  dorthin Buchen  in die ursprüngliche Richtung Unreserve Aufrufen + - Es kommt oft vor, dass die Quellen und dass die Verlassen-Sensoren von der Weiche ungleich weit entfernt sind.  unterschiedliche Jam-Timeouts. + Fehler Fälle: + a) LongSensorSignal + b) Switch Jam-Timeout: BT ist an den Verlassen-Sensor nicht angekommen + c) Fehlschaltung + d) Too early OutSensor-Signal + e) Verlassen-Sensor immer AN + *) + + // IntfInOutCarousel3 "IntfCarousel" Interface für Carousel am Ausgang 3 -> rausgenommen + // IntfInOutCarousel4 "IntfCarousel" Interface für Carousel am Ausgang 4 -> rausgenommen + + + REGION Schrittkette + //UNTERSCHIED ALTE WEICHE NEUE WEICHE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + CASE #nState OF + + #cStep_Off: + + REGION 0: Off + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := FALSE; + + #stOutMainTro.nStatus := "SwiState_OffEStop" - (5 * BOOL_TO_INT(#xInSftyOk)); + + + ////////// Timer /////////// + + //////// Transition //////// + END_REGION + #cStep_Undefined: + + REGION 100: Undefined + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := FALSE; + + #stOutMainTro.nStatus := "SwiState_Init";//2; + + + ////////// Timer /////////// + + //////// Transition //////// + IF #fbStateManager.tOutTimeInStep > #stInSettings.tSwitchSignal THEN + #nState := #cStep_WaitForReq;//0200; + END_IF; + END_REGION + #cStep_WaitForReq: + + REGION 200: Wait for Req + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := FALSE; + + #stOutMainTro.nStatus := "SwiState_WaitForReq";//3; + + + ////////// Timer /////////// + + //////// Transition //////// + IF #nInSetSwitch = 1 OR #nInSetSwitch = 2 OR #nInSetSwitch = 3 OR #nInSetSwitch = 4 THEN + #nState := #cStep_WaitForCar;//400; + END_IF; + + END_REGION + + #cStep_WaitForCar: + + REGION 400: Wait for Carousel + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := FALSE; + + //#xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_WaitForCarousel";//4; + + ////////// Timer /////////// + + //////// Transition //////// + IF #xInCarouselRun THEN + //#IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 AND #fbStateManager.tOutTimeInStep < T#10s THEN + + IF #nInSetSwitch = 1 THEN + #nState := #cStep_Switch1To3;//700; + ELSIF #nInSetSwitch = 2 THEN + #nState := #cStep_Switch1To4;//900; + ELSIF #nInSetSwitch = 3 THEN + #nState := #cStep_Switch2To3;//1100; + ELSIF #nInSetSwitch = 4 THEN + #nState := #cStep_Switch2To4;//1300; + END_IF; + + ELSIF #nInSetSwitch = 0 THEN + + #nState := #cStep_WaitForReq;//200; + + END_IF; + + END_REGION + + + #cStep_Switch1To3: + + REGION 700: Switch Entr1 -> Ex3 + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := TRUE; + #xEntr2 := FALSE; + #xExit3 := TRUE; + #xExit4 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_ChangeSwitch";//5; + #stOutMainTro.xStatusIn := FALSE; + #stOutMainTro.xStatusOut := FALSE; + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + + IF #fbStateManager.tOutTimeInStep > T#150ms THEN + #nState := #cStep_1To3OkWaitForTransit;//750; + ELSIF #stInSettings.xSwitchFixed THEN + #nState := #cStep_1To3OkWaitForChange; + END_IF; + + END_REGION + + #cStep_1To3OkWaitForTransit: + + REGION => 750: Entr1 -> Ex3 ok, wait for Transit + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := TRUE; + #xEntr2 := FALSE; + #xExit3 := TRUE; + #xExit4 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_NotConfirmed";//6; + #stOutMainTro.xStatusIn := FALSE; + #stOutMainTro.xStatusOut := FALSE; + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + //Switch Jam-Timeout: BT ist an den Verlassen-Sensor nicht angekommen. Auch too early!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)AND + IF #stInSenExit3.xDirectEdgeNeg AND #stInSettings.xPluggedExSen3 THEN + #xCountUpExit3 := TRUE; + #nState := #cStep_1To3OkWaitForChange;//800; + // ELSIF #stInSenExit4.xDirectEdgePos AND #stInSettings.xPluggedExSen4 THEN + // #nState := #cStep_ErrorSenUnexpected;//-100; + ELSIF (#fbStateManager.tOutTimeInStep > #tCarrierTransit) AND NOT #stInSettings.xPluggedExSen3 THEN + #xCountUpExit3 := TRUE; + #nState := #cStep_1To3OkWaitForChange; + ELSIF #fbStateManager.tOutTimeInStep > T#15000ms THEN + #nState := #cStep_WaitForReq;//200; + END_IF; + + END_REGION + + #cStep_1To3OkWaitForChange: + + REGION => 800: Entr1 -> Ex3 ok, wait for Change + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := TRUE; + #xEntr2 := FALSE; + #xExit3 := TRUE; + #xExit4 := FALSE; + #xCountUpExit3 := FALSE; + + //#xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_Confirmed";//7; + #stOutMainTro.xStatusIn := FALSE; + #stOutMainTro.xStatusOut := FALSE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)THEN + + IF #nInSetSwitch = 2 THEN + #nState := #cStep_Switch1To4;//900; + ELSIF #nInSetSwitch = 3 THEN + #nState := #cStep_Switch2To3;//1100; + ELSIF #nInSetSwitch = 4 THEN + #nState := #cStep_Switch2To4;//1300; + END_IF; + + END_IF; + + // IF #fbStateManager.tOutTimeInStep > T#30s THEN + // #nState := #cStep_WaitForReq;//200; + // END_IF; + + END_REGION + + + #cStep_Switch1To4: + + REGION 900: Switch Entr1 -> Ex4 + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := TRUE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := TRUE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_ChangeSwitch";//5; + #stOutMainTro.xStatusIn := FALSE; + #stOutMainTro.xStatusOut := TRUE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #fbStateManager.tOutTimeInStep > T#150ms THEN + #nState := #cStep_1To4OkWaitForTransit;//950; + ELSIF #stInSettings.xSwitchFixed THEN + #nState := #cStep_1To4OkWaitForChange; + END_IF; + + END_REGION + + #cStep_1To4OkWaitForTransit: + + REGION => 950: Entr1 -> Ex4 ok, wait for Transit + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := TRUE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := TRUE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_NotConfirmed";//6; + #stOutMainTro.xStatusIn := FALSE; + #stOutMainTro.xStatusOut := TRUE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + //Switch Jam-Timeout: BT ist an den Verlassen-Sensor nicht angekommen. Auch too early!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)AND + IF #stInSenExit4.xDirectEdgeNeg AND #stInSettings.xPluggedExSen4 THEN + #xCountUpExit4 := TRUE; + #nState := #cStep_1To4OkWaitForChange;//1000; + // ELSIF #stInSenExit3.xDirectEdgePos AND #stInSettings.xPluggedExSen3 THEN + // #nState := #cStep_ErrorSenUnexpected;//-100; + ELSIF (#fbStateManager.tOutTimeInStep > #tCarrierTransit) AND NOT #stInSettings.xPluggedExSen4 THEN + #xCountUpExit4 := TRUE; + #nState := #cStep_1To4OkWaitForChange; + ELSIF #fbStateManager.tOutTimeInStep > T#15000ms THEN + #nState := #cStep_WaitForReq;//200; + END_IF; + + END_REGION + + #cStep_1To4OkWaitForChange: + + REGION => 1000: Entr1 -> Ex4 ok, wait for Change + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := TRUE; + #xEntr2 := FALSE; + #xExit3 := FALSE; + #xExit4 := TRUE; + #xCountUpExit4 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_Confirmed";//7; + #stOutMainTro.xStatusIn := FALSE; + #stOutMainTro.xStatusOut := TRUE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)THEN + + IF #nInSetSwitch = 1 THEN + #nState := #cStep_Switch1To3;//700; + ELSIF #nInSetSwitch = 3 THEN + #nState := #cStep_Switch2To3;//1100; + ELSIF #nInSetSwitch = 4 THEN + #nState := #cStep_Switch2To4;//1300; + END_IF; + + END_IF; + + // IF #fbStateManager.tOutTimeInStep > T#30s THEN + // #nState := #cStep_WaitForReq;//200; + // END_IF; + + END_REGION + + + #cStep_Switch2To3: + + REGION 1100: Switch Entr2 -> Ex3 + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := TRUE; + #xExit3 := TRUE; + #xExit4 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_ChangeSwitch";//5; + #stOutMainTro.xStatusIn := TRUE; + #stOutMainTro.xStatusOut := FALSE; + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #fbStateManager.tOutTimeInStep > T#150ms THEN + #nState := #cStep_2To3OkWaitForTransit;//1150; + ELSIF #stInSettings.xSwitchFixed THEN + #nState := #cStep_2To3OkWaitForChange; + END_IF; + + END_REGION + + #cStep_2To3OkWaitForTransit: + + REGION => 1150: Entr2 -> Ex3 ok, wait for Transit + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := TRUE; + #xExit3 := TRUE; + #xExit4 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_NotConfirmed";//6; + #stOutMainTro.xStatusIn := TRUE; + #stOutMainTro.xStatusOut := FALSE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + //Switch Jam-Timeout: BT ist an den Verlassen-Sensor nicht angekommen. Auch too early!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)AND + IF #stInSenExit3.xDirectEdgeNeg AND #stInSettings.xPluggedExSen3 THEN + #xCountUpExit3 := TRUE; + #nState := #cStep_2To3OkWaitForChange;//1200; + // ELSIF #stInSenExit4.xDirectEdgePos AND #stInSettings.xPluggedExSen4 THEN + // #nState := #cStep_ErrorSenUnexpected;//-100; + ELSIF (#fbStateManager.tOutTimeInStep > #tCarrierTransit) AND NOT #stInSettings.xPluggedExSen3 THEN + #xCountUpExit3 := TRUE; + #nState := #cStep_2To3OkWaitForChange; + ELSIF #fbStateManager.tOutTimeInStep > T#15000ms THEN + #nState := #cStep_WaitForReq;//200; + END_IF; + + END_REGION + + #cStep_2To3OkWaitForChange: + + REGION => 1200: Entr2 -> Ex3 ok, wait for Change + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := TRUE; + #xExit3 := TRUE; + #xExit4 := FALSE; + #xCountUpExit3 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_Confirmed";//7; + #stOutMainTro.xStatusIn := TRUE; + #stOutMainTro.xStatusOut := FALSE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)THEN + + IF #nInSetSwitch = 1 THEN + #nState := #cStep_Switch1To3;//700; + ELSIF #nInSetSwitch = 2 THEN + #nState := #cStep_Switch1To4;//900; + ELSIF #nInSetSwitch = 4 THEN + #nState := #cStep_Switch2To4;//1300; + END_IF; + + END_IF; + + // IF #fbStateManager.tOutTimeInStep > T#30s THEN + // #nState := #cStep_WaitForReq;//200; + // END_IF; + + END_REGION + + #cStep_Switch2To4: + + REGION 1300: Switch Entr2 -> Ex4 + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := TRUE; + #xExit3 := FALSE; + #xExit4 := TRUE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_ChangeSwitch";//5; + #stOutMainTro.xStatusIn := TRUE; + #stOutMainTro.xStatusOut := TRUE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #fbStateManager.tOutTimeInStep > T#150ms THEN + #nState := #cStep_2To4OkWaitForTransit;//1350; + ELSIF #stInSettings.xSwitchFixed THEN + #nState := #cStep_2To4OkWaitForChange; + END_IF; + + END_REGION + + #cStep_2To4OkWaitForTransit: + + REGION => 1350: Entr2 -> Ex4 ok, wait for Transit + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := TRUE; + #xExit3 := FALSE; + #xExit4 := TRUE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_NotConfirmed";//6; + #stOutMainTro.xStatusIn := TRUE; + #stOutMainTro.xStatusOut := TRUE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + //Switch Jam-Timeout: BT ist an den Verlassen-Sensor nicht angekommen. Auch too early!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)AND + IF #stInSenExit4.xDirectEdgeNeg AND #stInSettings.xPluggedExSen4 THEN + #xCountUpExit4 := TRUE; + #nState := #cStep_2To4OkWaitForChange;//1400; + // ELSIF #stInSenExit3.xDirectEdgePos AND #stInSettings.xPluggedExSen3 THEN + // #nState := #cStep_ErrorSenUnexpected;//-100; + ELSIF (#fbStateManager.tOutTimeInStep > #tCarrierTransit) AND NOT #stInSettings.xPluggedExSen4 THEN + #xCountUpExit4 := TRUE; + #nState := #cStep_2To4OkWaitForChange; + ELSIF #fbStateManager.tOutTimeInStep > T#15000ms THEN + #nState := #cStep_WaitForReq;//200; + END_IF; + + END_REGION + #cStep_2To4OkWaitForChange: + + REGION => 1400: Entr2 -> Ex4 ok, wait for Change + ///////// Ausgänge ///////// + + ///////// Statics ////////// + #xEntr1 := FALSE; + #xEntr2 := TRUE; + #xExit3 := FALSE; + #xExit4 := TRUE; + #xCountUpExit4 := FALSE; + + // #xStartMotor := #xInCarouselRun; + + #stOutMainTro.nStatus := "SwiState_Confirmed";//7; + #stOutMainTro.xStatusIn := TRUE; + #stOutMainTro.xStatusOut := TRUE; + + + ////////// Timer /////////// + #tmpActUnivTon := FALSE; + //////// Transition //////// + IF #xInCarouselRun (* #IntfInOutCarousel3.nStatus = 4 AND #IntfInOutCarousel4.nStatus = 4 *)THEN + + IF #nInSetSwitch = 1 THEN + #nState := #cStep_Switch1To3;//700; + ELSIF #nInSetSwitch = 2 THEN + #nState := #cStep_Switch1To4;//900; + ELSIF #nInSetSwitch = 3 THEN + #nState := #cStep_Switch2To3;//1100; + END_IF; + + END_IF; + + // IF #fbStateManager.tOutTimeInStep > T#30s THEN + // #nState := #cStep_WaitForReq;//200; + // END_IF; + + END_REGION + + + // #cStep_ErrorSenUnexpected: + + // REGION -100: Error: Unexpected Sensor + // ///////// Ausgänge ///////// + + // ///////// Statics ////////// + // #xEntr1 := FALSE; + // #xEntr2 := FALSE; + // #xExit3 := FALSE; + // #xExit4 := FALSE; + // ///////// Timer ////////// + + // //////// Transition //////// + // IF #fbStateManager.tOutTimeInStep > T#10s THEN + // #nState := #cStep_WaitForReq;//200; + // END_IF; + + // END_REGION + // #cStep_ErrorSenTime: + + // REGION -200: Error: Sensor/Timer + // ///////// Ausgänge ///////// + + // ///////// Statics ////////// + // #xEntr1 := FALSE; + // #xEntr2 := FALSE; + // #xExit3 := FALSE; + // #xExit4 := FALSE; + // ///////// Timer ////////// + + // //////// Transition //////// + // IF #fbStateManager.tOutTimeInStep > T#10s THEN + // #nState := #cStep_WaitForReq;//200; + // END_IF; + + // END_REGION + ELSE + ; + END_CASE; + END_REGION + + // FIFO macht ohne Out-Sensoren nicht wirklich Sinn, kein Mehrwert + REGION Weichenbereich - FIFO + + // IF #fbSwitchFifo.dequeueDone OR #xInCancel THEN + // #xDeqSwitchFIFO := FALSE; + // ELSIF (#nInSetSwitch = 1 OR #nInSetSwitch = 3) AND #stInSenExit3.xDirectEdgeNeg AND #xDeqSwitchFIFO AND NOT #fbSwitchFifo.isEmpty THEN // Deq auf leeren FIFO nicht erlaubt! + // #xDeqSwitchFIFO := FALSE; + // ELSIF (#nInSetSwitch = 2 OR #nInSetSwitch = 4) AND #stInSenExit4.xDirectEdgeNeg AND #xDeqSwitchFIFO AND NOT #fbSwitchFifo.isEmpty THEN // Deq auf leeren FIFO nicht erlaubt! + // #xDeqSwitchFIFO := FALSE; + // ELSIF (#nInSetSwitch = 1 OR #nInSetSwitch = 3) AND (#stInSenExit3.xDirectEdgeNeg OR #xInDeqExternal) AND NOT #fbSwitchFifo.isEmpty THEN // Deq auf leeren FIFO nicht erlaubt! + // #xDeqSwitchFIFO := true; + // ELSIF (#nInSetSwitch = 2 OR #nInSetSwitch = 4) AND (#stInSenExit4.xDirectEdgeNeg OR #xInDeqExternal) AND NOT #fbSwitchFifo.isEmpty THEN // Deq auf leeren FIFO nicht erlaubt! + // #xDeqSwitchFIFO := true; + // END_IF; + + // #fbSwitchFifo(enqueue := #xInOutEnq, + // dequeue := #xDeqSwitchFIFO, + // clear := #xInCancel, + // initialItem := #constInitialItem, + // isEmpty => #stOutMainTro.xFifoEmpty, + // itemIn := #nInNextCarr, + // buffer := #arCarrFifo, + // itemOut := #nCarrIdxLeave); + + // IF #fbSwitchFifo.enqueueDone OR #xInCancel THEN + // #xInOutEnq := 0; + // END_IF; + + // IF #fbSwitchFifo.dequeueDone OR #xInCancel THEN + // #xDeqSwitchFIFO := FALSE; + // END_IF; + + END_REGION + + // Handlen wir mit Scannern/CarrGlobCorrection + REGION Wrong Direction + + // // Wrong Direction, MainTRO als falsch gefahren melden, siehe unten + + // IF (#nInSetSwitch = 1 OR #nInSetSwitch = 3) AND #fbSwitchFifo.elementCount > 0 AND (#nState = 750 OR #nState = 800 OR #nState = 1150 OR #nState = 1200) THEN + // #xSwitchWrongDir := #stInSenExit4.xDirectEdgePos; + // ELSIF (#nInSetSwitch = 2 OR #nInSetSwitch = 4) AND #fbSwitchFifo.elementCount > 0 AND #nInMainTroNo <> 245 AND #nInMainTroNo <> 247 AND (#nState = 950 OR #nState = 1000 OR #nState = 1350 OR #nState = 1400) THEN + // #xSwitchWrongDir := #stInSenExit3.xDirectEdgePos; + // END_IF; + + END_REGION ; + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #cStep_Undefined; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := #stInOutMachineState.xRunning, // AND #xInSftyOk, + xInReset := #xInCancel, + xInRunUnivTOn := #tmpActUnivTon, + nInOutState := #nState); + END_REGION + + REGION Überwachung BT verlässt Weiche nicht + //Während BT >0 durch die Weiche unterwegs sind, wird ermittelt ob sich diese Anzahl ändert. Bei einer Änderung des Wertes wird eine Zeit gestoppt um ggf. zu melden dass dies zu lange dauert. + //Wenn also welche unterwegs sind, ist alles in Ordnung wenn sich an der Anzahl was ändert bzw. wenn diese Anzahl Null wird. + + // #tmpTransitFlagChange := #fbSwitchFifo.elementCount.%X0; //Das LSB der INT-Zahl wird abgefragt um zu ermitteln ob es einen Zahl-Wechsel gibt Bit true = ungerade Zahl / Bit false = gerade Zahl + + // #tOnTransitTimer(IN := (#fbSwitchFifo.elementCount > 0 AND (#tmpTransitFlagChange = #xTransitFlagState)) OR "FirstScan", + // PT := #stInSettings.tTransitEx); + + // #xTransitFlagState := #tmpTransitFlagChange; //tmp-Variable ist bei einem Flankenwechsel für einen Zyklus anders als die Static, und erst hier unten gleich der Static. + + END_REGION + + //Gibts nicht + REGION Dauersignal Verlassen Sensor überprüfen + + // IF #stInSenExit3.xDirectSensor AND + // #stInSenExit3.tDirectChangeLast > T#2s + // THEN + // #xPermSigSen3 := TRUE; + // ELSIF NOT #stInSenExit3.xDirectSensor (*AND + // #stInSenExit3.tDirectChangeLast > T#1500ms *)THEN + // #xPermSigSen3 := FALSE; + // END_IF; + + // IF #stInSenExit4.xDirectSensor AND + // #stInSenExit4.tDirectChangeLast > T#2s + // THEN + // #xPermSigSen4 := TRUE; + // ELSIF NOT #stInSenExit4.xDirectSensor (*AND + // #stInSenExit4.tDirectChangeLast > T#1500ms *)THEN + // #xPermSigSen4 := FALSE; + // END_IF; + + + END_REGION + + REGION Alarm + // Error + #fbSetAlarmAndLog[0].stSettings.nType := 1; + #fbSetAlarmAndLog[0].stSettings.nNoMaxErrors := 5; + #fbSetAlarmAndLog[0].stSettings.sFctnName := CONCAT(IN1 := 'Switch ', IN2 := "FC_Uint2TroString_1"(#nInMainTroNo), IN3 := '.', IN4 := "FC_usint2String_1"(#stInSettings.nSwitchNo)); + #fbSetAlarmAndLog[0](xInAlarm := #tmpSetError, + stInOutControlUnitCabinet:=#stInOutMachineState); + + // Warning + #fbSetAlarmAndLog[1].stSettings.nType := 2; + #fbSetAlarmAndLog[1].stSettings.nNoMaxErrors := 5; + #fbSetAlarmAndLog[1].stSettings.sFctnName := CONCAT(IN1 := 'Switch ', IN2 := "FC_Uint2TroString_1"(#nInMainTroNo), IN3 := '.', IN4 := "FC_usint2String_1"(#stInSettings.nSwitchNo)); + #fbSetAlarmAndLog[1](stInOutControlUnitCabinet:=#stInOutMachineState, + xInAlarm := #tmpSetWarning); + END_REGION + + //Nicht möglich + REGION BT Zählen + + // #CountBTExit3(CU := #fbSwitchFifo.elementCount > 0 AND (((#nState = 750 OR #nState = 800) AND #stInSenExit3.xDirectEdgeNeg) OR ((#nState = 1150 OR #nState = 1200) AND #stInSenExit3.xDirectEdgeNeg)),//#xCountUpExit3,, + // PV := 1, + // CV => #nCounterExit3); + + // #CountBTExit4(CU := #fbSwitchFifo.elementCount > 0 AND (((#nState = 950 OR #nState = 1000) AND (#stInSenExit4.xDirectEdgeNeg OR (#stInSettings.nSwitchNo = "cSwi103.1" AND #stInSenExit4.xDirectEdgePos))) OR ((#nState = 1350 OR #nState = 1400) AND #stInSenExit4.xDirectEdgeNeg)),//#xCountUpExit4, + // PV := 1, + // CV => #nCounterExit4); + + END_REGION + + //who dis + REGION Long-Signal erfassen + + // IF #fbSwitchFifo.elementCount > 0 AND #stInSenExit3.xDirectSensor AND #stInSenExit3.tDirectChangeLast > #stInSettings.tSenLong THEN + // #xSignalLongEx3 := TRUE; + // ELSIF (* #xInReqFinished *)#stInSenExit3.xDirectEdgePos THEN + // #xSignalLongEx3 := FALSE; + // END_IF; + + // IF #fbSwitchFifo.elementCount > 0 AND #stInSenExit3.xDirectSensor AND #stInSenExit3.tDirectChangeLast > #stInSettings.tSenVeryLong THEN + // #xSignalVeryLongEx3 := TRUE; + // ELSIF (* #xInReqFinished *)#stInSenExit3.xDirectEdgePos THEN + // #xSignalVeryLongEx3 := FALSE; + // END_IF; + + // IF #fbSwitchFifo.elementCount > 0 AND #stInSenExit4.xDirectSensor AND #stInSenExit4.tDirectChangeLast > #stInSettings.tSenLong THEN + // #xSignalLongEx4 := TRUE; + // ELSIF (* #xInReqFinished *)#stInSenExit4.xDirectEdgePos THEN + // #xSignalLongEx4 := FALSE; + // END_IF; + + // IF #fbSwitchFifo.elementCount > 0 AND #stInSenExit4.xDirectSensor AND #stInSenExit4.tDirectChangeLast > #stInSettings.tSenVeryLong THEN + // #xSignalVeryLongEx4 := TRUE; + // ELSIF (* #xInReqFinished *)#stInSenExit4.xDirectEdgePos THEN + // #xSignalVeryLongEx4 := FALSE; + // END_IF; + + + END_REGION + + //wtf + REGION Too-Early-Signal erfassen + + // IF #fbSwitchFifo.elementCount = 1 AND (#nState = 750 OR #nState = 950 OR #nState = 1150 OR #nState = 1350) THEN + // #xTooEarlyTrigUnconf := true; + // ELSIF #xInReqFinished (* OR (#nState = 800 OR #nState = 1000 OR #nState = 1200 OR #nState = 1400) *)THEN + // #xTooEarlyTrigUnconf := FALSE; + // END_IF; + + // IF #fbSwitchFifo.elementCount = 1 AND NOT #xTooEarlyTrigUnconf THEN + // #xTooEarlyTrigConf := true; + // ELSIF #xInReqFinished THEN + // #xTooEarlyTrigConf := FALSE; + // END_IF; + + #tTooEarlyTimerUnconf(IN := #xTooEarlyTrigUnconf OR "FirstScan", + PT := T#20s); + // #tTooEarlyTimerConf(IN := #xTooEarlyTrigConf OR "FirstScan", + // PT := T#5s); + END_REGION ; + + REGION Ausgänge schreiben + + REGION MFR + #stOutMfr.xStatusInSwitch := NOT #xEntr1 AND #xEntr2; + #stOutMfr.xStatusOutSwitch := NOT #xExit3 AND #xExit4; + // #stOutMfr.xTrolleyInSwitch := #fbSwitchFifo.elementCount > 0; + #stOutMfr.xTransportRdy := "cTodoFalse"; + #stOutMfr.xError := #tOnTransitTimer.Q; + #stOutMfr.xBtNotLeaving := #tOnTransitTimer.Q; + #stOutMfr.xSenOut3 := #stInSenExit3.xDirectSensor; + #stOutMfr.xSenOut4 := #stInSenExit4.xDirectSensor; + #stOutMfr.xEx3Long := #xSignalLongEx3; //True sobald Zeit des Sensorsignals minimal höher als beim normalen Durchfahren + #stOutMfr.xEx4Long := #xSignalLongEx4; //True sobald Zeit des Sensorsignals minimal höher als beim normalen Durchfahren + #stOutMfr.xEx3VeryLong := #xSignalVeryLongEx3; //True sobald Sensorsignal länger als X anliegt + #stOutMfr.xEx4VeryLong := #xSignalVeryLongEx4; //True sobald Sensorsignal länger als X anliegt + + IF #tTooEarlyTimerUnconf.ET < T#1500ms AND (((#nInSetSwitch = 1 OR #nInSetSwitch = 3) AND #stInSenExit3.xDirectEdgePos) OR ((#nInSetSwitch = 2 OR #nInSetSwitch = 4) AND #stInSenExit4.xDirectEdgePos)) THEN + #stOutMfr.xSenTooEarly := FALSE;//TRUE -> für performancetest rausgemacht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ELSIF #xInReqFinished THEN + #stOutMfr.xSenTooEarly := FALSE; + ELSE //auch nur vorübergehend hinzugefügt!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + #stOutMfr.xSenTooEarly := FALSE; + END_IF; + + // IF #tTooEarlyTimerConf.ET < T#5s AND (((#nInSetSwitch = 1 OR #nInSetSwitch = 3) AND #stInSenExit3.xDirectEdgePos) OR ((#nInSetSwitch = 2 OR #nInSetSwitch = 4) AND #stInSenExit4.xDirectEdgePos)) THEN + // #stOutMfr.Bit13 := TRUE; + // ELSIF #xInReqFinished THEN + // #stOutMfr.Bit13 := FALSE; + // END_IF; + #stOutMfr.xJam := #xPermSigSen3 OR (#xPermSigSen4 AND #nInMainTroNo <> 183); + #stOutMfr.Bit14 := "cTodoFalse"; + #stOutMfr.Bit15 := "cTodoFalse"; + + END_REGION + + REGION MainTRO + + #stOutMainTro.nCounterExit3 := #nCounterExit3; + #stOutMainTro.nCounterExit4 := #nCounterExit4; + // #stOutMainTro.xSen3Long := #fbSwitchFifo.elementCount > 0 AND #stInSenExit3.xDirectSensor AND #stInSenExit3.tDirectChangeLast > #stInSettings.tSenLong; + // // #stOutMainTro.xSen3VeryLong := #xSignalVeryLongEx3; + // #stOutMainTro.xSen4Long := #fbSwitchFifo.elementCount > 0 AND #stInSenExit4.xDirectSensor AND #stInSenExit4.tDirectChangeLast > #stInSettings.tSenLong; + // // #stOutMainTro.xSen4VeryLong := #xSignalVeryLongEx4; + // #stOutMainTro.nFifoElementCount := #fbSwitchFifo.elementCount; + + #arOutFifo := #arCarrFifo; //Fifo Array zur Info an MainTRO übergeben + + END_REGION + + + REGION Output + + // #Status.nCounterExit3 := 123; Status oben in Schrittkette + // #Status.nCounterExit4 := 123; + // #Status.nStatus := 123; + // #Status.nError := 123; + // #Status.xStatusIn := #nState = 1150 OR #nState = 1200 OR #nState = 1350 OR #nState = 1400; + // #Status.xStatusOut := #nState = 950 OR #nState = 1000 OR #nState = 1350 OR #nState = 1400; + // #Status.xJamAtExit3 := "cTodoFALSE"; + // #Status.xJamAtExit4 := "cTodoFALSE"; + #xOutSwEntrTo1 := #xEntr1; + #xOutSwEntrTo2 := #xEntr2; + #xOutSwExTo3 := #xExit3; + #xOutSwExTo4 := #xExit4; + #nOutActCarrLeave := #nCarrIdxLeave; + // #nOutActCarrLeaveWrongDir := #nCarrIdxLeave; + // #xOutBtLeftSwitch := #fbSwitchFifo.dequeueDone;//#xDeqSwitchFIFO; + #xOutBtLeftSwitchWrongDir := #xSwitchWrongDir; + #xOutPermSigOutSen3 := #xPermSigSen3; + #xOutPermSigOutSen4 := #xPermSigSen4; + + + END_REGION + + + END_REGION + + REGION Visu + REGION Status + IF NOT #stOutMfr.#xError THEN // Keine Fehler + IF #stInOutHMI.xEnableControl THEN + #stInOutHMI.bStatus := 3; + ELSE + CASE #nState OF + 0,100: + #stInOutHMI.bStatus := 0; // NOT_AVAILABLE + 200, 400, 700, 750, 800, 900, 950, 1000, 1100, 1150, 1200, 1300, 1350, 1400: + #stInOutHMI.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutHMI.bStatus := 0; // NOT AVAILABLE + END_CASE; + END_IF; + ELSE // Fehler + #stInOutHMI.bStatus := 2; // ERROR + END_IF; + END_REGION + + REGION Modes + // Int16 Bit-codiert + #stInOutHMI.nMode.%X0 := (#nState = 0); // The device is turned off + #stInOutHMI.nMode.%X1 := (#nState = 10) OR (#nState = 20) OR (#nState = 30) OR (#nState = 40); // The device is turned on + #stInOutHMI.nMode.%X2 := #stInOutHMI.xEnableControl; + #stInOutHMI.nMode.%X3 := FALSE; //NIU + #stInOutHMI.nMode.%X10 := #stOutMfr.xError; // Timeout Error + END_REGION + + REGION Handbetrieb + IF #stInOutHMI.xEnableControl THEN + IF #stInSettings.nTo1Destinations = 3 THEN + #xOutSwExTo3 := #stInOutHMI.xSetSwitch; + ELSIF + #stInSettings.nTo1Destinations = 4 THEN + #xOutSwExTo4 := #stInOutHMI.xSetSwitch; + END_IF; + ELSE + IF #stInSettings.nTo1Destinations = 3 THEN + #stInOutHMI.xSetSwitch := #xOutSwExTo3; + ELSIF + #stInSettings.nTo1Destinations = 4 THEN + #stInOutHMI.xSetSwitch := #xOutSwExTo4; + END_IF; + END_IF; + END_REGION + + REGION Weichenstellung + IF #stInSettings.nTo1Destinations = 3 THEN + #stInOutHMI.xInHome := NOT #xOutSwExTo3; + #stInOutHMI.xInWork := #xOutSwExTo3; + ELSIF #stInSettings.nTo1Destinations = 4 THEN + #stInOutHMI.xInHome := NOT #xOutSwExTo4; + #stInOutHMI.xInWork := #xOutSwExTo4; + END_IF; + END_REGION + + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.libinfo b/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.libinfo new file mode 100644 index 0000000..4207988 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: fdb28b91-85cc-4257-9a7f-4ee21454e413 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.18 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Monitoring, Aufräumen, Kommentieren diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.libint b/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.libint new file mode 100644 index 0000000..4f9698b --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.libint @@ -0,0 +1,23 @@ +DocumentHash: + - FileName: FB_ILS_STRO_Vario.scl + Hash: Ll36gRlWS0phSkYkE0m2ct+2Cyo/U78RVe/T2hhXEmE= +LibraryMetaFileHash: 5hsMvUxuDSEOmiTQZdE8Ql+qyqi2hW6MyrV+d0jxvZ4= +LibraryVersion: + Guid: 6dc92fd5-41a8-4cf5-b077-be95aec75ae1 + DependsOn: + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: UDT_Vario + VersionNumber: 2.0.1 + - TypeName: FB_StateManager + VersionNumber: 2.0.0 + - TypeName: SettingsVario + VersionNumber: 2.0.5 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: FB_SupervisionRasterSensor + VersionNumber: 2.0.2 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.scl b/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.scl new file mode 100644 index 0000000..d4685f5 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_ILS_STRO_Vario.scl @@ -0,0 +1,483 @@ +FUNCTION_BLOCK "FB_ILS_STRO_Vario" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInSettings : "SettingsVario"; // Einstellungen Vario + xInReleaseEdge : Bool; // Flanke Carrier rausgelassen + stInSenConvFingerInPos : "UDT_Sensor"; // Mitnehmerfinger in Position (FingerInPos) + stInSenJam : "UDT_Sensor"; // Stausensor nach Vario (Jam) + stInSenLastPos : "UDT_Sensor"; // Letzte Position erreicht (Full) + stInSenCarrInPos : "UDT_Sensor"; // Carrier in Position (CarrInPos) + xInRelease : Bool := false; // Freigabe zum Entleeren + xInRequest : Bool; // Anfrage an Vario + xInMotorProtection : Bool := false; // Motorschutz + xInErrorQuit : Bool; // Fehler quittieren Überwachung Finger + xInAutomatic : Bool; // Automatik + END_VAR + + VAR_OUTPUT + xOutMotor : Bool := false; // Antrieb raumgängiger Förderer + xOutConveyorReady : Bool := false; // Vario bereit + xOutConveyorReleaseReq : Bool := false; + wOutErrorWord : Word; // Fehler rausgeben + END_VAR + + VAR_IN_OUT + arInOutJamFinger : Array[*] of "stCarrier"; // Daten Staubereich auf Vario + stInOutHMI : "UDT_Vario"; // HMI Schnittstelle + stInOutControlUnitCabinet : "UDT_MainState"; // Main State Schnittstelle + END_VAR + + VAR + fbStateManager : "FB_StateManager"; // Schrittkette Manager + fbFingerControl : "FB_SupervisionRasterSensor"; // Überwachung Finger + sStateText : String := ''; // Schritt Text (zum Beobachten) + END_VAR + VAR RETAIN + nState : Int := 0; // Schritt + nStateLast : Int := 0; // vorheriger Schritt (für State Manager) + xRunMotor : Bool := false; // Motor Start + xConveyorReady : Bool := false; // Förderer ist bereit + tOnAllBtOut {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Timer: Vario Entleerungsfahrt + counterCarrier {InstructionName := 'CTU_INT'; LibVersion := '1.0'} : CTU_INT; // Zum Eintakten von Carriern + nCounterCatch : Int := 0; // Zum Eintakten von Carriern + END_VAR + VAR + xErrorBtNotReaching : Bool := false; // NIU + tOn_ErrorConv {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // NIU + tOn_WaitForStop {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Für Testmodus + tOnJamCarrierInPos {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; // Prüfung: Vario dreht, aber Carrier in Position ist an + xSensorError : Bool; // Fehler Carrier in Position Sensor + fbMonitoringFinger : "FB_Monitoring"; // Monitoring Finger Überwachung + fbMonitoringMotorProtection : "FB_Monitoring"; // Motorschutzüberwachung + fbMonitoringCarrierInPos : "FB_Monitoring"; // Überwachung Sensor "CarrInPos" + xClearDone : Bool; // Prüffahrt um Finger leer zu fahren abgeschlossen + "////////" : Bool; // NIU + xTestMode : Bool; // Testmodus aktivieren + END_VAR + + VAR_TEMP + tmpActUnivTon : Bool; // Siehe State Manager + nArrayMaxFinger : DInt; // Array größe + END_VAR + + VAR CONSTANT + c0000_StepOff : Int := 0; // Aus + c0100_StepUndefined : Int := 100; // Undefiniert + c0200_StepReceive : Int := 200; // Förderer wartet auf Arbeit / Bereit aufzunehmen + c1200_StepWaitTime : Int := 1200; // Förderer wartet vor Fahrt + c2000_StepJog : Int := 2000; // Förderer eine Position weiter fahren (Jog Fw) + c2200_StepNormalStop : Int := 2200; // Normal anhalten + c2250_StepQuickStop : Int := 2250; // Sofort anhalten + c2500_StepCheckVario : Int := 2500; // Prüfen ob wirklich leer (NIU) + c3000_StepEmptying : Int := 3000; // Förderer entleeren + c5000_StepEnding : Int := 5000; // Förderer Ablauf beenden (Positionierung) + END_VAR + + +BEGIN + REGION Arraygrößen + #nArrayMaxFinger := UPPER_BOUND(ARR := #arInOutJamFinger, DIM := 1); + END_REGION + + REGION State Machine + // Off + // Idle (keine Daten und Prüffahrt abgeschlossen) + // Anforderung MTRO / Separator + // -> Entleeren + // Entleeren (Fahre bis Stau oder keine Daten) + // 1. Anforderung MTRO / Separator + // -> Entleeren Pausieren + // 2. Keine Daten mehr + // -> Idle + // Entleeren Pausieren + // + + CASE #nState OF + #c0000_StepOff: + REGION 0000: Off + + // Aktueller Zustand + #sStateText := 'OFF'; + + // Statics + #xRunMotor := FALSE; + #xConveyorReady := FALSE; + + END_REGION + + #c0100_StepUndefined: + REGION 0100: Undefined + + // Aktueller Zustand + #sStateText := 'UNDEFINED'; + + // Statics + #xRunMotor := FALSE; + #xConveyorReady := FALSE; + + #nState := #c0200_StepReceive; + END_REGION + + #c0200_StepReceive: + REGION 0200: Receive + + // Aktueller Zustand + #sStateText := 'RECEIVE'; + + // Statics + + #xRunMotor := FALSE; + #xConveyorReady := #xInMotorProtection; + + // Transition + // + IF #xTestMode OR #stInOutHMI.stControl.xTestMode THEN + #xConveyorReady := FALSE; + #nState := #c2000_StepJog; + ELSE + + IF (#xConveyorReady AND #counterCarrier.QU) OR ((* #arInOutJamFinger[1].bStatus.%X0 AND *)NOT #xInRequest AND NOT #xClearDone AND #fbStateManager.tOutTimeInStep > T#5000ms) THEN + #nState := #c1200_StepWaitTime; + + // ELSIF (#arInOutJamFinger[1].stCarrData.xOnline AND NOT #xClearDone AND NOT #xInRequest AND #fbStateManager.tOutTimeInStep > T#5000ms) AND + // (NOT #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > T#3000ms) THEN + // #nState := #c2500_StepCheckVario; + // ELSIF #arInOutJamFinger[1].stCarrData.xOnline AND NOT #xInRequest AND #fbStateManager.tOutTimeInStep > T#5000ms THEN + // #nState := #c3000_StepEmptying; + END_IF; + END_IF; + + END_REGION + + #c1200_StepWaitTime: + REGION 1200: Wait + // Aktueller Zustand + #sStateText := 'WAIT FOR TIMER'; + + #xRunMotor := FALSE; + #xConveyorReady := FALSE; + + IF #fbStateManager.tOutTimeInStep > #stInSettings.tWaitForJog (* AND NOT #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > T#3000ms *) THEN + IF #xInRequest THEN + #xClearDone := FALSE; + #nState := #c2000_StepJog; + ELSIF NOT #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > T#2s THEN + #nState := #c3000_StepEmptying; + (* ELSE + #nState := #c3000_StepEmptying; *) + END_IF; + END_IF; + END_REGION + + + #c2000_StepJog: + REGION 2000: Jog + + // Aktueller Zustand + #sStateText := 'JOG'; + + // Statics + #xRunMotor := TRUE; + #xConveyorReady := FALSE; + + IF #xTestMode OR #stInOutHMI.stControl.xTestMode THEN + IF #stInSenConvFingerInPos.xDirectEdgePos THEN + #nState := #c2200_StepNormalStop; + END_IF; + ELSE + IF ((* #fbStateManager.tOutTimeInStep > T#1000ms OR *)#fbFingerControl.xOutErrorRasterSensor) OR (NOT #stInSettings.xLongSlope AND #stInSenJam.xDirectSensor AND #stInSenLastPos.xDirectSensor) + OR (#stInSettings.xLongSlope AND #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > #stInSettings.tJamSenDelay AND #stInSenLastPos.xDirectSensor) + THEN + #nState := #c2250_StepQuickStop; + ELSIF (#stInSenJam.xDirectEdgePos AND NOT #stInSettings.xJamSenDelayActive) + OR (#stInSettings.xJamSenDelayActive AND #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > #stInSettings.tJamSenDelay) + THEN + #nState := #c2200_StepNormalStop; + ELSIF #stInSenConvFingerInPos.xDirectEdgePos THEN //////EMBI TEST + #nState := #c0200_StepReceive; + END_IF; + END_IF; + + END_REGION + + #c2200_StepNormalStop: //normal anhalten + REGION 2200: Normal Stop + + // Aktueller Zustand + #sStateText := 'NORMAL STOP'; + + #xRunMotor := FALSE; + #xConveyorReady := FALSE; + + #xConveyorReady := FALSE; + + IF #xTestMode OR #stInOutHMI.stControl.xTestMode THEN + + IF #tOn_WaitForStop.Q THEN + #nState := #c0200_StepReceive; + END_IF; + + ELSE + + IF (NOT #stInSenLastPos.xDirectSensor AND #stInSenLastPos.tDirectChangeLast > T#2s AND #stInSenJam.xDbncdSensor) OR + (NOT #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > T#3000ms) THEN + #nState := #c5000_StepEnding; + END_IF; + END_IF; + + END_REGION + + #c2250_StepQuickStop: + REGION 2250: Quick Stop + + // Aktueller Zustand + #sStateText := 'QUICK STOP'; + + #xRunMotor := FALSE; + #xConveyorReady := FALSE; + + IF ((NOT #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > T#3000ms) OR + (NOT #stInSenLastPos.xDirectSensor AND #stInSenLastPos.tDirectChangeLast > T#3000ms)) AND + NOT #fbFingerControl.xOutErrorRasterSensor + THEN + #nState := #c1200_StepWaitTime; + END_IF; + END_REGION + + #c3000_StepEmptying: + REGION 3000: Emptying + + // Aktueller Zustand + #sStateText := 'EMPTYING CONVEYOR'; + + // Statics + + #xRunMotor := TRUE; + #xConveyorReady := FALSE; + + ///////////////////// + + IF (NOT #stInSettings.xLongSlope AND #stInSenJam.xDirectSensor AND #stInSenLastPos.xDirectSensor) + OR (#stInSettings.xLongSlope AND #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > #stInSettings.tJamSenDelay AND #stInSenLastPos.xDirectSensor) + THEN + #nState := #c2250_StepQuickStop; + ELSIF (#stInSenJam.xDirectEdgePos AND NOT #stInSettings.xJamSenDelayActive) + OR (#stInSettings.xJamSenDelayActive AND #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > #stInSettings.tJamSenDelay) + THEN + #nState := #c2200_StepNormalStop; + ELSIF #xInRequest THEN + #xClearDone := FALSE; + #nState := #c5000_StepEnding; + ELSIF #tOnAllBtOut.Q THEN + #xClearDone := TRUE; + #nState := #c5000_StepEnding; + // ELSIF #tOnAllBtOut.Q THEN // Freigabe zum Entleeren ist wieder/noch da und Carousel-Motor läuft + // // Wenn nach einer gewissen Zeit nichts mehr kommt --> Alle Bt draußen --> Kette leer + // #nState := #c5000_StepEnding; // Weiter + END_IF; + /////////////////// + + END_REGION + + #c5000_StepEnding: + REGION 5000: Ending Step + + (*Dieser Schritt wird nur nach dem Entleeren angesprungen + damit sich die Kette zum Schluss noch richtig positioniert*) + + //Aktueller Zustand + #sStateText := 'STOPPING CONVEYOR'; + + //Statics + #xRunMotor := TRUE; + #xConveyorReady := FALSE; + + // Transition + IF ((* #fbStateManager.tOutTimeInStep > T#1000ms OR *)#fbFingerControl.xOutErrorRasterSensor) OR (NOT #stInSettings.xLongSlope AND #stInSenJam.xDirectSensor AND #stInSenLastPos.xDirectSensor) + OR (#stInSettings.xLongSlope AND #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > #stInSettings.tJamSenDelay AND #stInSenLastPos.xDirectSensor) + THEN + #xClearDone := FALSE; + #nState := #c2250_StepQuickStop; + ELSIF #stInSenConvFingerInPos.xDirectEdgePos (*or #fbStateManager.tOutTimeInStep > T#800ms OR *) (* #stInSenLastPos.xDirectEdgePos *)(* #stInSenConvFingerInPos.xDirectSensor *)THEN + #nState := #c0200_StepReceive; + ELSIF (#stInSenJam.xDirectEdgePos AND NOT #stInSettings.xJamSenDelayActive) + // OR (#stInSettings.xJamSenDelayActive AND #stInSenJam.xDirectSensor AND #stInSenJam.tDirectChangeLast > #stInSettings.tJamSenDelay) + THEN + #nState := #c2200_StepNormalStop; + END_IF; + + END_REGION + + END_CASE; + END_REGION + + REGION Timer + //Entleerungsfahrt Dauer + #tOnAllBtOut(IN := #nState = #c3000_StepEmptying, + PT := #stInSettings.tConvEmpty); + + //Wird für Testmodus verwendet, Start Stopp Intervall + #tOn_WaitForStop(IN := #nState = #c2200_StepNormalStop, + PT := #stInSettings.tWaitForStop); + END_REGION + + REGION Carrier zählen + #counterCarrier(CU := #xInReleaseEdge, + R := #nState > #c0200_StepReceive, + PV := #stInSettings.nCountCarrier, + CV => #nCounterCatch); + END_REGION + + REGION Überwachung Finger + + #fbFingerControl.stInSettings.xInEnableSupervision := TRUE; + #fbFingerControl.stInSettings.tInDelayMotorRun := #stInSettings.tRasterDelayMotorRun; + #fbFingerControl.stInSettings.tInRasterHigh := #stInSettings.tRasterHigh; + #fbFingerControl.stInSettings.tInRasterLow := #stInSettings.tRasterLow; + #fbFingerControl.stInSettings.sInConveyorName := #stInOutHMI.stConveyor.sConveyorName; + #fbFingerControl(stInSenRaster := #stInSenConvFingerInPos, + xInErrorQuit := #xInErrorQuit, + xInMotorRun := #xRunMotor); + + END_REGION + + REGION Überwachung Carrier in Pos Sensor + #tOnJamCarrierInPos(IN := #xRunMotor, + PT := t#3600s); + + IF #tOnJamCarrierInPos.ET > T#1s AND #stInSenCarrInPos.xDirectSensor AND #stInSenCarrInPos.tDirectChangeLast > t#3s THEN + #xSensorError := TRUE; + END_IF; + + IF #xSensorError AND #xInErrorQuit THEN + #xSensorError := FALSE; + END_IF; + END_REGION + + REGION StateManager + + #fbStateManager.stInSettings.nStartState := #c0200_StepReceive; + #fbStateManager.stInSettings.xActUnivTOn := TRUE; + #fbStateManager.stInSettings.xRestartAtStartState := FALSE; + #fbStateManager(xInFunctionEnabled := ((#xInAutomatic AND #stInOutControlUnitCabinet.xRunning) OR #stInOutHMI.stConveyor.xSemiAuto) AND NOT #stInOutHMI.stConveyor.xDisableConveyor AND NOT #fbFingerControl.xOutErrorRasterSensor AND NOT #xSensorError, + xInRunUnivTOn := #tmpActUnivTon, + nOutStateLast => #nStateLast, + nInOutState := #nState); + END_REGION + + REGION Ausgänge + + // Das ist der Motor vom Förderer + #xOutMotor := #xRunMotor OR #stInOutHMI.stConveyor.xManual; // Förderer-Motor angefordert und kein Bereichshalt + #xOutConveyorReady := #xConveyorReady; //Förderer bereit (aus SK) und kein Bereichshalt Förderer + + //???????????????????????????? + #xOutConveyorReleaseReq := #nState = #c3000_StepEmptying OR #nState = #c1200_StepWaitTime; + + END_REGION + + REGION Visu + + #stInOutHMI.stConveyor.nType := 7; // Vario + + #stInOutHMI.stConveyor.nState := #nState; + #stInOutHMI.stConveyor.sStateText := #sStateText; + + #stInOutHMI.FingerSensor := #stInSenConvFingerInPos; + #stInOutHMI.JamSensor := #stInSenJam; + #stInOutHMI.LastPosSensor := #stInSenLastPos; + + REGION Status + IF #xInMotorProtection THEN + IF #fbStateManager.xInFunctionEnabled THEN + CASE #nState OF + #c0000_StepOff, #c0100_StepUndefined: + #stInOutHMI.stConveyor.bStatus := 0; // NOT_AVAILABLE + #c0200_StepReceive, #c1200_StepWaitTime, #c2000_StepJog, #c2250_StepQuickStop, #c2200_StepNormalStop, #c3000_StepEmptying, #c5000_StepEnding: + #stInOutHMI.stConveyor.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutHMI.stConveyor.bStatus := 0; // NOT_AVAILABLE + END_CASE; + ELSE + #stInOutHMI.stConveyor.bStatus := 0; // NOT_AVAILABLE + END_IF; + ELSE + #stInOutHMI.stConveyor.bStatus := 2; // ERROR + END_IF; + END_REGION + REGION Modes + // Int16 Bit-codiert + #stInOutHMI.stConveyor.nMode.%X0 := (#nState = #c0000_StepOff) OR (#nState = #c0100_StepUndefined) OR (#nState = #c0200_StepReceive) OR (#nState = #c1200_StepWaitTime) OR (#nState = #c2200_StepNormalStop) OR (#nState = #c2250_StepQuickStop); // The device is turned off + #stInOutHMI.stConveyor.nMode.%X1 := (#nState = #c2000_StepJog) OR (#nState = #c3000_StepEmptying) OR (#nState = #c5000_StepEnding); + #stInOutHMI.stConveyor.nMode.%X2 := #stInOutHMI.stConveyor.xDisableConveyor OR #stInOutHMI.stConveyor.xManual OR #stInOutHMI.stConveyor.xSemiAuto OR #xTestMode OR #stInOutHMI.stControl.xTestMode (* OR #xViSuManualMode OR #xViSuSemiAutoMode *); // The device is being manually operated + #stInOutHMI.stConveyor.nMode.%X3 := FALSE;//(#nState = #STOPPED); //The device only is on when the device is needed (like standby) + #stInOutHMI.stConveyor.nMode.%X10 := FALSE; // Overflow Error is set for this device + END_REGION + #stInOutHMI.stConveyor.xIsInAutomatic := #stInOutControlUnitCabinet.xRunning; + #stInOutHMI.stConveyor.xEnergySaveReq := FALSE; + #stInOutHMI.stConveyor.xPowerContactor := #xOutMotor; + #stInOutHMI.stConveyor.xPluggedChainBreak := FALSE; + #stInOutHMI.stConveyor.xStatusChainBreak := TRUE; + #stInOutHMI.stConveyor.xStatusMotorProtect := #xInMotorProtection; + #stInOutHMI.stConveyor.xConveyorFull1 := FALSE; + #stInOutHMI.stConveyor.xConveyorFull2 := FALSE; + #stInOutHMI.stConveyor.xReady2Receive := TRUE; + #stInOutHMI.stConveyor.xNextConveyorReady := TRUE; + + END_REGION + + REGION Monitoring + REGION Fingerüberwachung + #fbMonitoringFinger.stSettings.nErrorType := 1; + #fbMonitoringFinger.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringFinger.stSettings.xSelfQuit := TRUE; + #fbMonitoringFinger.stSettings.tDelay := T#1s; + #fbMonitoringFinger(wInTextListId_Function := 300, + sInPrefix := #stInOutHMI.stConveyor.sConveyorName, + wInTextListId_Message := 301, + sInSuffix := #stInOutHMI.FingerSensor.sName, + xInQuitError := #stInOutControlUnitCabinet.xQuitError OR #xInErrorQuit, + xInSignal := NOT #fbFingerControl.xOutErrorRasterSensor, + InOutMachineState := #stInOutControlUnitCabinet); + END_REGION + + REGION Motorschutz + #fbMonitoringMotorProtection.stSettings.nErrorType := 1; + #fbMonitoringMotorProtection.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringMotorProtection.stSettings.xSelfQuit := TRUE; + #fbMonitoringMotorProtection.stSettings.tDelay := T#1s; + #fbMonitoringMotorProtection(wInTextListId_Function := 300, + sInPrefix := #stInOutHMI.stConveyor.sConveyorName, + wInTextListId_Message := 401, + sInSuffix := #stInOutHMI.stConveyor.sContactor, + xInQuitError := #stInOutControlUnitCabinet.xQuitError OR #xInErrorQuit, + xInSignal := #xInMotorProtection, + InOutMachineState := #stInOutControlUnitCabinet); + END_REGION + + REGION Carrier in Pos + #fbMonitoringCarrierInPos.stSettings.nErrorType := 1; + #fbMonitoringCarrierInPos.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringCarrierInPos.stSettings.xSelfQuit := TRUE; + #fbMonitoringCarrierInPos.stSettings.tDelay := T#1s; + #fbMonitoringCarrierInPos(wInTextListId_Function := 300, + sInPrefix := #stInOutHMI.stConveyor.sConveyorName, + wInTextListId_Message := 302, + sInSuffix := #stInSenCarrInPos.sName, + xInQuitError := #stInOutControlUnitCabinet.xQuitError OR #xInErrorQuit, + xInSignal := NOT #xSensorError, + InOutMachineState := #stInOutControlUnitCabinet); + + END_REGION + + END_REGION + + REGION Error + #wOutErrorWord.%X0 := #stInOutHMI.stConveyor.bStatus = 2; //Error + #wOutErrorWord.%X1 := #fbFingerControl.xOutErrorRasterSensor; //Fingerfehler + #wOutErrorWord.%X2 := NOT #xInMotorProtection; //Motorschutzfehler + #wOutErrorWord.%X3 := #xSensorError; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FB/STRO/FB_StationUnloadPin.libinfo b/2_ILSLib/FB/STRO/FB_StationUnloadPin.libinfo new file mode 100644 index 0000000..846cd0e --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_StationUnloadPin.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: 3d0c7919-902b-47bd-98b6-b1baea1057d3 +LibraryVersion: + VersionNumber: 2.0.6 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Monitoring Update diff --git a/2_ILSLib/FB/STRO/FB_StationUnloadPin.libint b/2_ILSLib/FB/STRO/FB_StationUnloadPin.libint new file mode 100644 index 0000000..a733b07 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_StationUnloadPin.libint @@ -0,0 +1,23 @@ +DocumentHash: + - FileName: FB_StationUnloadPin.scl + Hash: q/+gqEyu6e6ldC6QMMo2TZadq/PGbT9IxQG0y2nMnxk= +LibraryMetaFileHash: rFn/h2cLTyXm8U7IjoyzTHVC63letxreqp9J4QWH9oY= +LibraryVersion: + Guid: 3af372a4-e06c-4b34-9436-a82db4db70d2 + DependsOn: + - TypeName: FB_Monitoring + VersionNumber: 2.0.5 + - TypeName: UDT_MainState + VersionNumber: 2.0.0 + - TypeName: stConveyorStations + VersionNumber: 2.0.3 + - TypeName: UDT_UnloadingStation + VersionNumber: 0.0.6 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: FC_SHR_ExtractedHangerPin + VersionNumber: 2.0.3 + - TypeName: FC_SHR_TargetSet_ReRoutePin + VersionNumber: 2.0.3 diff --git a/2_ILSLib/FB/STRO/FB_StationUnloadPin.scl b/2_ILSLib/FB/STRO/FB_StationUnloadPin.scl new file mode 100644 index 0000000..a156e62 --- /dev/null +++ b/2_ILSLib/FB/STRO/FB_StationUnloadPin.scl @@ -0,0 +1,296 @@ +FUNCTION_BLOCK "FB_StationUnloadPin" +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInStartUnloading : Bool; + xInStopUnloading : Bool; + xInNextHanger : Bool; + xInBefore : Bool; + stInPartAfterSwitch : "UDT_Sensor"; + nInBarcode : DInt; + sInBarcode : String; + xInReRouteAllowed : Bool := TRUE; + xInUnloadingCheckSensor : Bool; + xInMonitorUnloading : Bool; + xInQuitLocal : Bool; + xInBypass : Bool; + END_VAR + + VAR_OUTPUT + xOutUnloadingDone : Bool; + nOutBarcode : DInt; + sOutBarcode : String; + xOutSwitch : Bool; + xOutLineOverloaded : Bool; + xOutLineOverloadAhead : Bool; + wOutErrorWord : Word; + xOutLineOverloadedHigh : Bool; + xOutLineOverloadedLow : Bool; + xOutUnloadingFail : Bool; + xOutUnloadingError : Bool; + END_VAR + + VAR_IN_OUT + stInOutControlUnitCabinet : "UDT_MainState"; + stInOutConveyorStations : "stConveyorStations"; + arInOutCarrier : Array[*] of "stCarrier"; + nNoReadCounter : UDInt; + stInOutHMI : "UDT_HMI_UnloadingStation"; + END_VAR + + VAR + nState : Int := -10; + TOnLineFullTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + tOnUnloadingCheck {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + END_VAR + VAR RETAIN + CountSwitch {InstructionName := 'CTU_UDINT'; LibVersion := '1.0'} : CTU_UDINT; + nCount : UDInt; + END_VAR + VAR + rTrigSwitch {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; + rTrigUnload {InstructionName := 'R_TRIG'; LibVersion := '1.0'} : R_TRIG; + tUnloadingCheckTime : Time := T#5s; + xUnloadingCheck : Bool; + tLineFullTime : Time := T#3s; + tOnStateTimer {InstructionName := 'TON_TIME'; LibVersion := '1.0'} : TON_TIME; + xStateTimer : Bool; + tStateTimer : Time; + xFlgTrolleySensor : Bool; + xFlgStartUnloading : Bool; + fbMonitoringLineOverload : "FB_Monitoring"; + fbMonitoringUnloadError : "FB_Monitoring"; + xEdgeStoreLineOverload : Bool; + stHangerStatus { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Struct + xOnline { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + nTarget { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Int; + xDoubleHangerOkay { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xTargetDoubleHanger { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xNoRead { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xPartMissing { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xTargetSetByMFS { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xReportedToMFS { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xReRouteOverflow { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xReRouteBalancing { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + xReRouteUnavailable { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : Bool; + END_STRUCT; + END_VAR + + VAR_TEMP + t_status : Bool; + tmpSuccess : Bool; + END_VAR + + +BEGIN + REGION xOutLineOverloaded Stau + IF #TOnLineFullTimer.Q THEN + //OR + //#tOnUnloadingCheck.Q THEN + #xFlgTrolleySensor := TRUE; + #xOutLineOverloaded := 1; + ELSE + #xFlgTrolleySensor := FALSE; + #xOutLineOverloaded := 0; + END_IF; + + // Detect change of Line Overload + #xOutLineOverloadedHigh := #TOnLineFullTimer.Q AND NOT #xEdgeStoreLineOverload; + + #xOutLineOverloadedLow := NOT #TOnLineFullTimer.Q AND #xEdgeStoreLineOverload; + + #xEdgeStoreLineOverload := #TOnLineFullTimer.Q; + + END_REGION + + IF #xInStartUnloading AND #xFlgTrolleySensor AND #xInReRouteAllowed THEN + #xOutUnloadingFail := TRUE; + #nOutBarcode := #nInBarcode; + #sOutBarcode := #sInBarcode; + "FC_SHR_TargetSet_ReRoutePin"(nInBarcodeNo := #nInBarcode, + nInTarget := INT_TO_USINT(#stInOutConveyorStations.stData.nStations), + xOutSuccess => #tmpSuccess, + stInOutConveyorStations := #stInOutConveyorStations); + ELSE + #xOutUnloadingFail := FALSE; + END_IF; + + #rTrigUnload(CLK:=#xInStartUnloading); + + REGION Schrittkette + CASE #nState OF + -10: // Init + #xOutSwitch := 0; + #xStateTimer := 0; + #xOutUnloadingDone := 0; + #nState := 0; + + 0: // Standby + #xOutUnloadingDone := 0; + + // IF #tOnStateTimer.Q (* #xFlgTrolleySensor *)THEN // Wenn Weiche voll //VON MYTHERESA -> STÖRT HIER, TEST + // #xUnloadingCheck := FALSE; // nicht möglich, da Flankenauswertung, bei dauerbelegtem Sensor sinnfrei + // #xOutSwitch := 0; // Switch schliessen + // END_IF; + + IF #rTrigUnload.Q (* AND NOT #tOnStateTimer.Q *)THEN //VON MYTHERESA -> STÖRT HIER, TEST + #xOutSwitch := 1; + #nOutBarcode := #nInBarcode; + #sOutBarcode := #sInBarcode; + IF #xInMonitorUnloading THEN + #xUnloadingCheck := 1; + END_IF; + "FC_SHR_ExtractedHangerPin"(xInUnloadingDone := TRUE, + nInBarcode := #nOutBarcode, + xInBypass:= #xInBypass, + stInOutConveyorStations := #stInOutConveyorStations, + arInOutCarrier:= #arInOutCarrier); + #xOutUnloadingDone := 1; + ELSIF #xInStopUnloading THEN + #xOutSwitch := 0; + END_IF; + + 1100: // Warten bis fertig mit Switch offen lassen + #xOutSwitch := 1; + IF NOT #xInStartUnloading THEN + #nState := 1110; // Switch offen lassen + END_IF; + + 1110: // Switch offen lassen + #xOutSwitch := 1; + #xOutUnloadingDone := 1; + #nState := 0; + 1200: // Warten bis fertig mit Switch offen lassen + #xOutSwitch := 1; + IF NOT #xInStartUnloading THEN + "FC_SHR_ExtractedHangerPin"(xInUnloadingDone := NOT #xInStartUnloading, + nInBarcode := #nOutBarcode, + xInBypass:=#xInBypass, + stInOutConveyorStations := #stInOutConveyorStations, + arInOutCarrier:= #arInOutCarrier); + #nState := 1210; // Switch offen lassen + END_IF; + 1210: // Switch schließen + #xOutSwitch := 0; + #xOutUnloadingDone := 1; + #nState := 0; + 1300: //Switch vorher öffnen + #xOutSwitch := 1; + #nState := 0; + END_CASE; + END_REGION + REGION Counter + #rTrigSwitch(CLK := #xOutSwitch); + #CountSwitch(CU := #rTrigSwitch.Q, + PV := 1, + CV => #nCount); + END_REGION ; + REGION Timer + #tOnStateTimer(IN := #xFlgTrolleySensor,//xStateTimer, + PT := T#800ms);//#tStateTimer); + + #TOnLineFullTimer(IN := #stInPartAfterSwitch.xDbncdSensor, + PT := #tLineFullTime); + + IF #xInUnloadingCheckSensor AND // Sensor nach Weiche + #xUnloadingCheck AND // Monitoring aktiviert + NOT #tOnUnloadingCheck.Q // Monitoring nicht bereits ausgeschlagen + THEN + #xUnloadingCheck := FALSE; + END_IF; + + IF #tOnUnloadingCheck.Q AND // Monitoring ausgeschlagen? + (#stInOutControlUnitCabinet.xQuitError OR #xInQuitLocal) // dann am Schaltschrank zu quittieren + THEN + #xUnloadingCheck := FALSE; // Monitoring Ende + END_IF; + + // Timer bis Teil am Sensor vorbei muss + #tOnUnloadingCheck(IN := #xUnloadingCheck AND #stInOutControlUnitCabinet.xRunning, + PT := #tUnloadingCheckTime); + + #xOutUnloadingError := #tOnUnloadingCheck.Q; + + END_REGION + + REGION Flanken + + #xFlgStartUnloading := #xInStartUnloading; + + END_REGION + + REGION Monitoring + + #fbMonitoringLineOverload.stSettings.nErrorType := 1; + #fbMonitoringLineOverload.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringLineOverload.stSettings.xSelfQuit := TRUE; + #fbMonitoringLineOverload(sInFctnName := #stInOutHMI.sName, + wInTextListId_Function := 500, + wInTextListId_Message := 500, + sInSuffix := #stInPartAfterSwitch.sName, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError OR #xInQuitLocal, + xInSignal := NOT #TOnLineFullTimer.Q, + sInAlarmMessage := 'Die Linie ist voll'); + + #fbMonitoringUnloadError.stSettings.nErrorType := 1; + #fbMonitoringUnloadError.stSettings.xErrLedIfMachineIsOff := TRUE; + #fbMonitoringUnloadError.stSettings.xSelfQuit := TRUE; + #fbMonitoringUnloadError(sInFctnName := #stInOutHMI.sName, + wInTextListId_Function := 500, + wInTextListId_Message := 501, + sInSuffix := #stInPartAfterSwitch.sName, + InOutMachineState := #stInOutControlUnitCabinet, + xInQuitError := #stInOutControlUnitCabinet.xQuitError OR #xInQuitLocal, + xInSignal := NOT #xOutUnloadingError, + sInAlarmMessage := 'Laufzeitfehler bei Weiche/Abwurf'); + + END_REGION + + REGION Visu + REGION Status + IF NOT #xOutUnloadingError AND (NOT #wOutErrorWord > 0) THEN + IF #stInOutHMI.xEnableControl THEN + #stInOutHMI.bStatus := 3; + ELSE + CASE #nState OF + -10: + #stInOutHMI.bStatus := 0; // NOT_AVAILABLE + 0, 1100, 1110, 1200, 1210, 1300: + #stInOutHMI.bStatus := 1; // AVAILABLE + ELSE //Fallback + #stInOutHMI.bStatus := 0; // NOT AVAILABLE + END_CASE; + END_IF; + ELSE // Fehler + #stInOutHMI.bStatus := 2; // ERROR + END_IF; + END_REGION + + REGION Modes + // Int16 Bit-codiert + #stInOutHMI.nMode.%X0 := (#nState = -10); // The device is turned off + #stInOutHMI.nMode.%X1 := (#nState = 0) OR (#nState = 1100) OR (#nState = 1110) OR (#nState = 1200) OR (#nState = 1210) OR (#nState = 1300); // The device is turned on + #stInOutHMI.nMode.%X2 := #stInOutHMI.xEnableControl; //Hand + #stInOutHMI.nMode.%X3 := FALSE; //NIU + #stInOutHMI.nMode.%X10 := #xOutUnloadingError; // Timeout Error + END_REGION + + // Idee: Schrittkette setzt im Normalfall den Switch. + // Wenn EnableControl TRUE ist, dann wird der Ausgang hier einfach überschrieben mit dem HMI-Wert + REGION Handbetrieb + IF #stInOutHMI.xEnableControl THEN + #xOutSwitch := #stInOutHMI.xSetSwitch; + ELSE + #stInOutHMI.xSetSwitch := #xOutSwitch; + END_IF; + + #stInOutHMI.xInHome := NOT #xOutSwitch; + #stInOutHMI.xInWork := #xOutSwitch; + + END_REGION + + #stInOutHMI.xLineFull := #TOnLineFullTimer.Q; + END_REGION +END_FUNCTION_BLOCK + diff --git a/2_ILSLib/FC/FC_Ean8_CheckDigit.libinfo b/2_ILSLib/FC/FC_Ean8_CheckDigit.libinfo new file mode 100644 index 0000000..2f01929 --- /dev/null +++ b/2_ILSLib/FC/FC_Ean8_CheckDigit.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 72f65cd0-2f82-4e9a-944e-763573262fcb + Comment: + de-DE: 'CHNAGED: optimierung sk' +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: 'CHNAGED: optimierung sk' diff --git a/2_ILSLib/FC/FC_Ean8_CheckDigit.libint b/2_ILSLib/FC/FC_Ean8_CheckDigit.libint new file mode 100644 index 0000000..f0d8219 --- /dev/null +++ b/2_ILSLib/FC/FC_Ean8_CheckDigit.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: FC_Ean8_CheckDigit.scl + Hash: R/NEMYYVcohoRaYvvfR00dVoXqRCxkaB2vrCapFAIKY= +LibraryMetaFileHash: kiYGeRw8WAjgxWPKrD0RU/pUGvFpQtxA5i+4VFRWOPU= +LibraryVersion: + Guid: 86087764-f9fa-4e00-99b4-fd1f0d046c81 diff --git a/2_ILSLib/FC/FC_Ean8_CheckDigit.scl b/2_ILSLib/FC/FC_Ean8_CheckDigit.scl new file mode 100644 index 0000000..6eb933e --- /dev/null +++ b/2_ILSLib/FC/FC_Ean8_CheckDigit.scl @@ -0,0 +1,40 @@ +FUNCTION "FC_Ean8_CheckDigit" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + sInDigits : String; // Barcode String (muss 7-stellig sein) + END_VAR + + VAR_OUTPUT + sOutBarcode : String; // 8-stelliges Resultat als String + nOutBarcode : DInt; // 8-stelliges Resultat als DINT + END_VAR + + VAR_TEMP + sBarcode : String; // Resultat als String + nLengthString : Int; // Ermittelte Länge des Eingangsstrings + nSum : Int; // Zwischensumme der berechneten Prüfziffer + nCheckDigit : Int; // berechnete Prüfziffer + END_VAR + + +BEGIN + (* + Prüft ob String siebenstellig ist. + Falls nein, dann RETURN. + Falls ja, dann errechne die Prüfziffer nach EAN8 und gebe Barcode als DINT sowie String aus. + *) + #nLengthString := LEN(#sInDigits); + IF #nLengthString <> 7 THEN + RETURN; + END_IF; + #nSum := STRING_TO_INT(#sInDigits[7]) * 3 + STRING_TO_INT(#sInDigits[6]) + STRING_TO_INT(#sInDigits[5]) * 3 + STRING_TO_INT(#sInDigits[4]) + STRING_TO_INT(#sInDigits[3]) * 3 + STRING_TO_INT(#sInDigits[2]) + STRING_TO_INT(#sInDigits[1]) * 3 ; + #nCheckDigit := 10 - (#nSum MOD 10); + IF #nCheckDigit = 10 THEN + #nCheckDigit := 0; + END_IF; + #sOutBarcode := #sBarcode := CONCAT(IN1 := #sInDigits, IN2 := DELETE(IN:=INT_TO_STRING(#nCheckDigit), L:=1, P:=1)); + #nOutBarcode := STRING_TO_DINT(#sBarcode); + +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_Route.libinfo b/2_ILSLib/FC/FC_Route.libinfo new file mode 100644 index 0000000..8a83b26 --- /dev/null +++ b/2_ILSLib/FC/FC_Route.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 487f8a43-4b39-46f6-a1db-76a1b3e0f176 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.1 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Änderung bei FC_TSHR_Shift diff --git a/2_ILSLib/FC/FC_Route.libint b/2_ILSLib/FC/FC_Route.libint new file mode 100644 index 0000000..5d3837b --- /dev/null +++ b/2_ILSLib/FC/FC_Route.libint @@ -0,0 +1,15 @@ +DocumentHash: + - FileName: FC_Route.scl + Hash: hIPhdrG77606oePl5SdGa7CHfrpBJY76vgPixX8iMW0= +LibraryMetaFileHash: pJYnAbURN79vKAyF0lpkfpnLgEHsh+6NHtKXtFDTF8c= +LibraryVersion: + Guid: a5ef1d68-80ec-445d-a745-78efb8a2a107 + DependsOn: + - TypeName: stEventBookingInfo + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: FC_TSHR_AddAtEnd + VersionNumber: 2.0.0 + - TypeName: FC_TSHR_Shift + VersionNumber: 2.0.1 diff --git a/2_ILSLib/FC/FC_Route.scl b/2_ILSLib/FC/FC_Route.scl new file mode 100644 index 0000000..9ae5bf1 --- /dev/null +++ b/2_ILSLib/FC/FC_Route.scl @@ -0,0 +1,140 @@ +FUNCTION "FC_Route" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInSingle : Bool; // true = einzelner Carrier wird losgeschickt, false = Array + xInSeparate : Bool; // Carrier und Ladung trennen + xInSepEdge : Bool; // Flanke vom Separator + xInSensor : Bool; // Sensor Eingang falls dieser verwendet wird + xInDelay : Bool; // true = Car werden auf den Weg geschickt bis Sensor kommt + stInCarrier : "stCarrier"; // Einzelner Carrier für den Eingang + END_VAR + + VAR_OUTPUT + stOutBookingInfo : "stEventBookingInfo"; // Infos für Logging + END_VAR + + VAR_IN_OUT + arJamEntr : Array[*] of "stCarrier"; // Jam am Eingang (Platzhalter verwenden falls kein Jam vorhanden) + arOnTheWay : Array[*] of "stCarrier"; // Carrier die für die Travel-Time unterwegs sind + arJamExit : Array[*] of "stCarrier"; // Jam am Ausgang (Platzhalter verwenden falls kein Jam vorhanden) + END_VAR + + VAR_TEMP + stCarrier : "stCarrier"; // Merker vom Eingang + stLoadOnly : "stCarrier"; // Nur Ladung am Ende + stCarrierOnly : "stCarrier"; + nCounter1 : DInt; // Temp für TSHR + nCounter2 : DInt; // Temp für TSHR + xResult1 : Bool; // Temp für TSHR + xResult2 : Bool; // Temp für TSHR + END_VAR + + +BEGIN + REGION Abfrage ob Singlecarrier oder Array + IF #xInSingle THEN + #stCarrier := #stInCarrier; //falls kein Array vorhanden, wird hier ein einzlener Carrier verwendet + ELSE + #stCarrier := #arJamEntr[1]; //erster Carrier des Eingangs-Staubereichs + END_IF; + END_REGION + REGION Weiterbuchen + IF NOT #xInDelay THEN //Shift zum Ziel-Bereich sofort + IF #xInSepEdge AND NOT #xInSeparate THEN + REGION Carrier normal weiterschieben + "FC_TSHR_AddAtEnd"(stInTrolley := #stCarrier, + nOutCounter => #nCounter1, + xOutResult => #xResult1, + arTSHR := #arJamExit); + + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arJamEntr); + + REGION Event Log + // Info rausgeben an Log-Baustein + #stOutBookingInfo.sBarcode := DELETE(IN := DINT_TO_STRING(#stCarrier.nBarcode), L := 1, P := 1); + #stOutBookingInfo.sDest := DELETE(IN := INT_TO_STRING(#stCarrier.nDestination), L := 1, P := 1); + // #stOutBookingInfo.sJobNo := DELETE(IN := DINT_TO_STRING(#stCarrier.stLoadData.nJobNo), L := 1, P := 1); + // #stOutBookingInfo.sProductNo := DELETE(IN := DINT_TO_STRING(#stCarrier.stLoadData.nProductNo), L := 1, P := 1); + + END_REGION + + + END_REGION + ELSIF #xInSepEdge AND #xInSeparate THEN + REGION Carrier/Ladung getrennt weiterschieben + + #stCarrierOnly := #stCarrier; + #stCarrierOnly.bStatus.%X1 := FALSE; + #stLoadOnly := #stCarrier; + + REGION Carrier + + "FC_TSHR_AddAtEnd"(stInTrolley := #stCarrierOnly, + nOutCounter => #nCounter1, + xOutResult => #xResult1, + arTSHR := #arJamExit); + + END_REGION + + REGION Ladung + "FC_TSHR_AddAtEnd"(stInTrolley := #stLoadOnly, + nOutCounter => #nCounter1, + xOutResult => #xResult1, + arTSHR := #arOnTheWay); + + END_REGION + + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arJamEntr); + + REGION Event Log + // Info rausgeben an Log-Baustein + #stOutBookingInfo.sBarcode := DELETE(IN := DINT_TO_STRING(#stCarrier.nBarcode), L := 1, P := 1); + #stOutBookingInfo.sDest := DELETE(IN := INT_TO_STRING(#stCarrier.nDestination), L := 1, P := 1); + END_REGION + + END_REGION + END_IF; + ELSE //Shift zum Ziel-Bereich über Verzögerung + IF #xInSepEdge THEN + REGION Carrier auf den Weg schieben + "FC_TSHR_AddAtEnd"(stInTrolley := #stCarrier, + nOutCounter => #nCounter1, + xOutResult => #xResult1, + arTSHR := #arOnTheWay); + + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arJamEntr); + END_REGION + + REGION Event Log + // Info rausgeben an Log-Baustein + #stOutBookingInfo.sBarcode := DELETE(IN := DINT_TO_STRING(#stCarrier.nBarcode), L := 1, P := 1); + #stOutBookingInfo.sDest := DELETE(IN := INT_TO_STRING(#stCarrier.nDestination), L := 1, P := 1); + END_REGION + + END_IF; + IF #xInSensor THEN + REGION Carrier unterwegs wird durch Sensor quittiert + "FC_TSHR_AddAtEnd"(stInTrolley := #arOnTheWay[1], + nOutCounter => #nCounter2, + xOutResult => #xResult2, + arTSHR := #arJamExit); + + "FC_TSHR_Shift"(xInShiftBack := TRUE, + arTSHR := #arOnTheWay); + END_REGION + + REGION Event Log + // Info rausgeben an Log-Baustein + #stOutBookingInfo.sBarcode := DELETE(IN := DINT_TO_STRING(#stCarrier.nBarcode), L := 1, P := 1); + #stOutBookingInfo.sDest := DELETE(IN := INT_TO_STRING(#stCarrier.nDestination), L := 1, P := 1); + END_REGION + + END_IF; + END_IF; + END_REGION +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_SHR_CheckStationPin.libinfo b/2_ILSLib/FC/FC_SHR_CheckStationPin.libinfo new file mode 100644 index 0000000..fa282b8 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_CheckStationPin.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: 6caf52bc-45ea-42bb-8864-ebe669724132 +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/FC/FC_SHR_CheckStationPin.libint b/2_ILSLib/FC/FC_SHR_CheckStationPin.libint new file mode 100644 index 0000000..2080113 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_CheckStationPin.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: FC_SHR_CheckStationPin.scl + Hash: nkMI480Ra4JgkPn02PCjzTtghlbgHDHdwzY/qUbRsZI= +LibraryMetaFileHash: yE1mYrZG1jiaC+YKm95dBPJV/BUzcSI0edoqzGeOMfk= +LibraryVersion: + Guid: be754d41-5565-4ed2-98d8-6257307063cd + DependsOn: + - TypeName: stConveyorStations + VersionNumber: 2.0.3 diff --git a/2_ILSLib/FC/FC_SHR_CheckStationPin.scl b/2_ILSLib/FC/FC_SHR_CheckStationPin.scl new file mode 100644 index 0000000..b486519 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_CheckStationPin.scl @@ -0,0 +1,62 @@ +FUNCTION "FC_SHR_CheckStationPin" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + nInStation : Int; + xInTargetStation : Bool; + nInConvStations : Int; // neu hinzugefügt, statt Konstante + nInStationsMax : Int; // neu hinzugefügt, statt Konstante + END_VAR + + VAR_OUTPUT + xOutStationHi : Bool; + xOutStationNHi : Bool; + xOutStationHiBefore : Bool; + nOutBarcode : DInt; + sOutBarcode : String; + END_VAR + + VAR_IN_OUT + stInOutConveyorStations : "stConveyorStations"; + END_VAR + + VAR_TEMP + nCounter : Int; + xStationHi : Bool; + END_VAR + + +BEGIN + // ************************************************************* + // Prüft ob Hanger aus dem Online-Register Station erreicht hat + // ************************************************************* + + IF #stInOutConveyorStations.stData.nTrolleysOnline = 0 OR + (#nInStation > #nInStationsMax) THEN + RETURN; + END_IF; + + FOR #nCounter := 1 TO #nInConvStations DO + IF #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.bStatus.%X0 AND // Teil vorhanden + ((#stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nTarget = #nInStation) OR NOT #xInTargetStation) AND // Zielstation GLEICH der eigenen Station + (#stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nPosAct >= #stInOutConveyorStations.arStationsPos[#nInStation].nPosIncr) THEN + + #xStationHi := 1; //sagt Abwurf abbiegen + + IF #xStationHi THEN + #nOutBarcode := #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.nBarcode; + END_IF; + EXIT; + ELSIF + #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.bStatus.%X0 AND // Teil vorhanden + ((#stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nTarget > #nInStation) OR NOT #xInTargetStation) AND // Zielstation GRÖßER der eigenen Station + (#stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nPosAct >= #stInOutConveyorStations.arStationsPos[#nInStation].nPosIncr) AND + (#stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nPosAct < #stInOutConveyorStations.arStationsPos[#nInStation].nPosIncr + 150) THEN + + #xOutStationNHi := 1; //sagt Abwurf geradeaus + EXIT; + END_IF; + END_FOR; + #xOutStationHi := #xStationHi; +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_SHR_CyclePin.libinfo b/2_ILSLib/FC/FC_SHR_CyclePin.libinfo new file mode 100644 index 0000000..a5700f4 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_CyclePin.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: ae3ad50b-36d6-449e-8326-46d4e3b3c847 +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/FC/FC_SHR_CyclePin.libint b/2_ILSLib/FC/FC_SHR_CyclePin.libint new file mode 100644 index 0000000..67f7c75 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_CyclePin.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: FC_SHR_CyclePin.scl + Hash: 5Kwg7lZUM2fqIhMBTpVACHs/GGTG39fxI16w+9mc5+4= +LibraryMetaFileHash: Zw+wjPFKzwXmUUpWTY7dgAvnGJBXef9gOjg0TjIrv68= +LibraryVersion: + Guid: 5abe1ca8-d687-4973-82d3-c99f7603ddad + DependsOn: + - TypeName: stCarrierPin + VersionNumber: 2.0.0 + - TypeName: FC_TSHR_AddAtEnd + VersionNumber: 2.0.0 + - TypeName: stConveyorStations + VersionNumber: 2.0.3 diff --git a/2_ILSLib/FC/FC_SHR_CyclePin.scl b/2_ILSLib/FC/FC_SHR_CyclePin.scl new file mode 100644 index 0000000..e56acde --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_CyclePin.scl @@ -0,0 +1,58 @@ +FUNCTION "FC_SHR_CyclePin" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + nInPosDiff : DInt; // zykl. Differenz der Inkremente + nInPosPitchPart : DInt; + nInConvStations : Int; // neu hinzugefügt, statt Konstante + nInStationsMax : Int; // neu hinzugefügt, statt Konstante + END_VAR + + VAR_IN_OUT + stInOutConveyorStations : "stConveyorStations"; + END_VAR + + VAR_TEMP + nCounter : Int; + stEmptyTrolley : "stCarrierPin"; + nLastStationPos : DInt; + Temp_1 : DInt; + Temp_2 : Bool; + END_VAR + + +BEGIN + // **************************************** + // Zyklischer Aufruf für Online-Register + // **************************************** + + // IF #stConveyorStations.nTrolleysOnline = 0 THEN + // ;//RETURN; + // END_IF; + + #stInOutConveyorStations.stData.nPosActPart := #nInPosPitchPart; + IF #nInPosDiff > 0 THEN + // Trolleys aus Stationen entfernen / Anzahl der Trolleys ermitteln + #stInOutConveyorStations.stData.nTrolleysOnline := 0; + FOR #nCounter := 1 TO #nInConvStations DO + + + // Wenn Trolley über letzte Station hinaus, dann löschen + IF (#stInOutConveyorStations.stData.nStations > 0) AND (#stInOutConveyorStations.stData.nStations <= #nInStationsMax) THEN + IF #stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nPosAct > #stInOutConveyorStations.arStationsPos[#stInOutConveyorStations.stData.nStations].nPosIncr THEN + "FC_TSHR_AddAtEnd"(stInTrolley := #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier, + nOutCounter => #Temp_1, + xOutResult => #Temp_2, + arTSHR := "DB_HyperJam".stHyperJam.arCarrier); //TODO Zugriff über inout Schnittstelle... + #stInOutConveyorStations.arTrolleysOnline[#nCounter] := #stEmptyTrolley; + END_IF; + END_IF; + // Ansonsten online bleiben + IF #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.bStatus.%X0 THEN + #stInOutConveyorStations.stData.nTrolleysOnline += 1; + #stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nPosAct += #nInPosDiff; + END_IF; + END_FOR; + END_IF; +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.libinfo b/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.libinfo new file mode 100644 index 0000000..553852c --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: c15aaa61-01ed-4442-82db-06b58abeebb9 +LibraryVersion: + VersionNumber: 2.0.3 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: aktualisiert wegen unterlagerter Änderung diff --git a/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.libint b/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.libint new file mode 100644 index 0000000..97701a8 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.libint @@ -0,0 +1,15 @@ +DocumentHash: + - FileName: FC_SHR_ExtractedHangerPin.scl + Hash: XyeHlDaPDHU4l/mIlfqMRb1ThUJh7fOEVbU6xxXAuso= +LibraryMetaFileHash: WzpdUNPAj9I5FTy+OuK14GfR78f5T0kQJt9dQatgSsQ= +LibraryVersion: + Guid: 94bbd898-ab59-4c22-a0ee-320804d0387a + DependsOn: + - TypeName: stConveyorStations + VersionNumber: 2.0.3 + - TypeName: stCarrierPin + VersionNumber: 2.0.0 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: FC_TSHR_AddAtEnd + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.scl b/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.scl new file mode 100644 index 0000000..7c548fe --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_ExtractedHangerPin.scl @@ -0,0 +1,63 @@ +FUNCTION "FC_SHR_ExtractedHangerPin" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInUnloadingDone : Bool; // trigger zum Offline Setzen des Trolleys + nInBarcode : DInt; // Arrayposition in arTrolleysOnline + xInBypass : Bool; + END_VAR + + VAR_IN_OUT + stInOutConveyorStations : "stConveyorStations"; + arInOutCarrier : Array[*] of "stCarrier"; + END_VAR + + VAR_TEMP + nCounter : Int; // Arraynummer bzw. Haken / Trolley + nTrolleyPosition : Int; + stEmptyTrolley : "stCarrierPin"; + tempTrolley : "stCarrier"; + TempCounter : DInt; + TempResult : Bool; + END_VAR + + +BEGIN + // **************************************** + // Setzt im Online-Register den Hanger im Abwurf auf Not Online + // **************************************** + // Passenden Eintrag finden + IF #xInUnloadingDone THEN + FOR #nCounter := 1 TO ("cHooksSorterMaxPin") DO + IF #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.nBarcode = #nInBarcode THEN + EXIT; + END_IF; + END_FOR; + // Wenn Eintrag gefunden, dann eintragen. + IF #nCounter < "cHooksSorterMaxPin" THEN + // #arOutTrolleyShiftRegister.arTrolley[1] := #arInOutTrolleysOnline[#nCounter].stTrolleyLoad; + IF NOT #xInBypass THEN //Wenn der Carrier am Block vorbeifährt (Bypass) NICHT buchen *****NEU***** + #tempTrolley := #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier; + "FC_TSHR_AddAtEnd"(stInTrolley := #tempTrolley, + nOutCounter => #TempCounter, + xOutResult => #TempResult, + arTSHR := #arInOutCarrier); + END_IF; + + IF NOT #TempResult + AND NOT #xInBypass //***NEU*** + THEN + RETURN; + ELSE + // Leeren des Hangers am Abwurf + #stInOutConveyorStations.stData.nTrolleysOnline -= 1; + // Alles im Online-Register eins weiter schieben + FOR #nCounter := #nCounter TO ("cHooksSorterMaxPin" - 1) DO // Weiterkopieren um eine Position + #stInOutConveyorStations.arTrolleysOnline[#nCounter] := #stInOutConveyorStations.arTrolleysOnline[#nCounter + 1]; + END_FOR; + #stInOutConveyorStations.arTrolleysOnline["cHooksSorterMaxPin"] := #stEmptyTrolley; + END_IF; + END_IF; + END_IF; +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_SHR_HangerAddPin.libinfo b/2_ILSLib/FC/FC_SHR_HangerAddPin.libinfo new file mode 100644 index 0000000..9f6941c --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_HangerAddPin.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: fbb06663-2a05-4c23-84a0-4d267ee6e385 +LibraryVersion: + VersionNumber: 2.0.1 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/FC/FC_SHR_HangerAddPin.libint b/2_ILSLib/FC/FC_SHR_HangerAddPin.libint new file mode 100644 index 0000000..dd186d2 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_HangerAddPin.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: FC_SHR_HangerAddPin.scl + Hash: SCQ7PgamkaxUa5QWVzGXY8NpJp3tKxxHpFGN8B/C5QE= +LibraryMetaFileHash: p7/L2jLnZLmPRtZL/Yb3rkBbLHJMxvNbFxE1zg7hips= +LibraryVersion: + Guid: 6640f592-83b1-4a46-8526-d2f636c28047 + DependsOn: + - TypeName: stCarrierPin + VersionNumber: 2.0.0 + - TypeName: stConveyorStations + VersionNumber: 2.0.3 diff --git a/2_ILSLib/FC/FC_SHR_HangerAddPin.scl b/2_ILSLib/FC/FC_SHR_HangerAddPin.scl new file mode 100644 index 0000000..97c3975 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_HangerAddPin.scl @@ -0,0 +1,73 @@ +FUNCTION "FC_SHR_HangerAddPin" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInCarrier : "stCarrierPin"; + nInPos : DInt; // Aktuelle Position auf der Kette + nInTarget : USInt; // Ziel-Station f. Trolley bei My Theresa = 1 + nInConvStations : Int; // neu hinzugefügt, statt Konstante + nInStationsMax : Int; // neu hinzugefügt, statt Konstante + END_VAR + + VAR_IN_OUT + stInOutConveyorStations : "stConveyorStations"; + END_VAR + + VAR_TEMP + nCounter : Int; // Arraynummer bzw. Haken / Trolley + END_VAR + + +BEGIN + // **************************************** + // Setzt im Online-Register einen neuen Hanger (am Anfang) + // **************************************** + + IF #stInOutConveyorStations.arTrolleysOnline[1].stPinValues.nPosAct = #stInOutConveyorStations.arStationsPos[#nInPos].nPosIncr THEN // Wenn bereits ein Bügel eingetragen ist auf der Position + RETURN; + END_IF; + // Alles im Online-Register eins weiter schieben + FOR #nCounter := (#nInConvStations - 1) TO 1 BY -1 DO // Weiterkopieren um eine Position + #stInOutConveyorStations.arTrolleysOnline[#nCounter + 1] := #stInOutConveyorStations.arTrolleysOnline[#nCounter]; + END_FOR; + // Startwerte setzen + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X0 := TRUE; + IF #nInTarget >= 1 AND #nInTarget <= #nInStationsMax THEN + #stInOutConveyorStations.arTrolleysOnline[1].stPinValues.nTarget := #nInTarget; + #stInOutConveyorStations.arTrolleysOnline[1].stPinValues.nTargetPos := #stInOutConveyorStations.arStationsPos[#nInTarget].nPosIncr; + END_IF; + + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.nBarcode := #stInCarrier.stCarrier.nBarcode; + + #stInOutConveyorStations.arTrolleysOnline[1].stPinValues.nPosAct := #stInOutConveyorStations.arStationsPos[#nInPos].nPosIncr; + #stInOutConveyorStations.stData.nTrolleysOnline += 1; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X1 := #stInCarrier.stCarrier.bStatus.%X1; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X2 := #stInCarrier.stCarrier.bStatus.%X2; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X3 := #stInCarrier.stCarrier.bStatus.%X3; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X4 := #stInCarrier.stCarrier.bStatus.%X4; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X5 := #stInCarrier.stCarrier.bStatus.%X5; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X6 := #stInCarrier.stCarrier.bStatus.%X6; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X7 := #stInCarrier.stCarrier.bStatus.%X7; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X8 := #stInCarrier.stCarrier.bStatus.%X8; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X9 := #stInCarrier.stCarrier.bStatus.%X9; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X10 := #stInCarrier.stCarrier.bStatus.%X10; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X11 := #stInCarrier.stCarrier.bStatus.%X11; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X12 := #stInCarrier.stCarrier.bStatus.%X12; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X13 := #stInCarrier.stCarrier.bStatus.%X13; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X14 := #stInCarrier.stCarrier.bStatus.%X14; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.bStatus.%X15 := #stInCarrier.stCarrier.bStatus.%X15; + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.nDestination := #stInCarrier.stCarrier.nDestination; // EMBI 11.06.2025 + + // Dummy-Barcode für Hanger vergeben. Negative Werte sind Dummys + #stInOutConveyorStations.stData.nBarcodeNew -= 1; + IF #stInOutConveyorStations.stData.nBarcodeNew < -2000000 THEN // Wenn Zähler Kleiner als 2 Mio dann von vorne anfangen. + #stInOutConveyorStations.stData.nBarcodeNew := -1; + END_IF; + + IF #stInCarrier.stCarrier.nBarcode > 0 THEN + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.nBarcode := #stInCarrier.stCarrier.nBarcode; + ELSE + #stInOutConveyorStations.arTrolleysOnline[1].stCarrier.nBarcode := #stInOutConveyorStations.stData.nBarcodeNew; + END_IF; +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.libinfo b/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.libinfo new file mode 100644 index 0000000..0769778 --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: bb985cb7-f19e-4e7f-9500-9a5edcac2865 +LibraryVersion: + VersionNumber: 2.0.3 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: aktualisiert wegen unterlagerter Änderung diff --git a/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.libint b/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.libint new file mode 100644 index 0000000..e139ccb --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: FC_SHR_TargetSet_ReRoutePin.scl + Hash: ofWTIcPOm/FlhfAHwD4CbfS3KmLT28gEa6SpVKGs5CA= +LibraryMetaFileHash: Zf2O+aidtu7ZZtbXq9pKYPNR0zxwwhzUGeT7vASQI2U= +LibraryVersion: + Guid: 10277776-2258-4ebc-81af-1e451bc796cc + DependsOn: + - TypeName: stConveyorStations + VersionNumber: 2.0.3 diff --git a/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.scl b/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.scl new file mode 100644 index 0000000..ca6fdff --- /dev/null +++ b/2_ILSLib/FC/FC_SHR_TargetSet_ReRoutePin.scl @@ -0,0 +1,48 @@ +FUNCTION "FC_SHR_TargetSet_ReRoutePin" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + nInBarcodeNo : DInt; // Barcode + nInTarget : USInt; // Ziel-Station f. Trolley bei My Theresa = 1 + END_VAR + + VAR_OUTPUT + xOutSuccess : Bool; + END_VAR + + VAR_IN_OUT + stInOutConveyorStations : "stConveyorStations"; + END_VAR + + VAR_TEMP + nCounter : Int; // Arraynummer bzw. Haken / Trolley + END_VAR + + +BEGIN + // // **************************************** + // // Ändert Ziel für Barcode in Online-Register Station + // // **************************************** + + IF #stInOutConveyorStations.stData.nTrolleysOnline = 0 THEN + RETURN; + END_IF; + // Passenden Eintrag finden + FOR #nCounter := 1 TO ("cHooksSorterMaxPin") DO + IF #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.nBarcode = #nInBarcodeNo THEN + EXIT; + END_IF; + END_FOR; + // Wenn Eintrag gefunden, dann eintragen. + IF #nCounter < "cHooksSorterMaxPin" THEN + #stInOutConveyorStations.arTrolleysOnline[#nCounter].stCarrier.nDestination := #nInTarget; + // #stConveyorStations.arTrolleysOnline[#nCounter].stCarrData.xReRouteOverflow := TRUE; // brauchen wir bei ILS nicht (?), war speziell für Pin/Klinke + IF (#nInTarget > 0) AND (#nInTarget <= #stInOutConveyorStations.stData.nStations) THEN + #stInOutConveyorStations.arTrolleysOnline[#nCounter].stPinValues.nTargetPos := #stInOutConveyorStations.arStationsPos[#nInTarget].nPosIncr; + #xOutSuccess := 1; + END_IF; + ELSE + #xOutSuccess := 0; + END_IF; +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_TSHR_AddAtEnd.libinfo b/2_ILSLib/FC/FC_TSHR_AddAtEnd.libinfo new file mode 100644 index 0000000..2278e0b --- /dev/null +++ b/2_ILSLib/FC/FC_TSHR_AddAtEnd.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 7fd3f712-0c70-464a-a178-3c0e9f56e7fd + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: stCarrier angepasst diff --git a/2_ILSLib/FC/FC_TSHR_AddAtEnd.libint b/2_ILSLib/FC/FC_TSHR_AddAtEnd.libint new file mode 100644 index 0000000..335f5bb --- /dev/null +++ b/2_ILSLib/FC/FC_TSHR_AddAtEnd.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: FC_TSHR_AddAtEnd.scl + Hash: lG/2SIkHPbNSGJwje2b2x+eGlM+zHxwJUz5jxsyDO0g= +LibraryMetaFileHash: fqf5hTjb9wPmlqRGgCD6Y+CnbAvNz0VlWqHeBP5JZvg= +LibraryVersion: + Guid: 42d9ac8f-436d-47fd-ad7b-f96d7f788df8 + DependsOn: + - TypeName: stCarrier + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FC/FC_TSHR_AddAtEnd.scl b/2_ILSLib/FC/FC_TSHR_AddAtEnd.scl new file mode 100644 index 0000000..396b160 --- /dev/null +++ b/2_ILSLib/FC/FC_TSHR_AddAtEnd.scl @@ -0,0 +1,53 @@ +FUNCTION "FC_TSHR_AddAtEnd" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + stInTrolley : "stCarrier"; + END_VAR + + VAR_OUTPUT + nOutCounter : DInt; + xOutResult : Bool; // 1 = Successfully; 0 = Error + END_VAR + + VAR_IN_OUT + arTSHR : Array[*] of "stCarrier"; + END_VAR + + VAR_TEMP + nCounter : DInt; + xMatch : Bool; + nArrayMax : DInt; + END_VAR + + +BEGIN + #nArrayMax := UPPER_BOUND(ARR := #arTSHR, DIM := 1); + IF #arTSHR[#nArrayMax].bStatus.%X0 = TRUE THEN + RETURN; + END_IF; + + FOR #nCounter := #nArrayMax - 1 TO 1 BY -1 DO + IF #arTSHR[#nCounter].bStatus.%X0 = TRUE THEN + #xMatch := 1; + EXIT; + END_IF; + END_FOR; + + IF #nCounter = 0 THEN + #xMatch := TRUE; + END_IF; + + IF #xMatch + THEN + #arTSHR[#nCounter + 1].nDestination := #stInTrolley.nDestination; + #arTSHR[#nCounter + 1].nBarcode := #stInTrolley.nBarcode; + #arTSHR[#nCounter + 1].bStatus := #stInTrolley.bStatus; + END_IF; + + #xOutResult := #xMatch; + #nOutCounter := #nCounter; + + +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_TSHR_Shift.libinfo b/2_ILSLib/FC/FC_TSHR_Shift.libinfo new file mode 100644 index 0000000..ac33324 --- /dev/null +++ b/2_ILSLib/FC/FC_TSHR_Shift.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: d80e8fca-e961-4f74-921c-a6b0d72f1eac + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.1 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Letzte Position mit Carrier ohne Daten überschreiben komplett diff --git a/2_ILSLib/FC/FC_TSHR_Shift.libint b/2_ILSLib/FC/FC_TSHR_Shift.libint new file mode 100644 index 0000000..7a37c8f --- /dev/null +++ b/2_ILSLib/FC/FC_TSHR_Shift.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: FC_TSHR_Shift.scl + Hash: 6AT5T7zTUDZWCJy0vQWjq9UZRCdYr1H0qVENFUzxOWM= +LibraryMetaFileHash: 7MKfTAQoPA7tnamjvhMFhTKhCDCMvY/xv+qtUkv2AH0= +LibraryVersion: + Guid: f6d0468d-7b77-4edd-9872-9c45f88f2433 + DependsOn: + - TypeName: stCarrier + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FC/FC_TSHR_Shift.scl b/2_ILSLib/FC/FC_TSHR_Shift.scl new file mode 100644 index 0000000..e413f26 --- /dev/null +++ b/2_ILSLib/FC/FC_TSHR_Shift.scl @@ -0,0 +1,50 @@ +FUNCTION "FC_TSHR_Shift" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + xInShiftBack : Bool; + END_VAR + + VAR_IN_OUT + arTSHR : Array[*] of "stCarrier"; + END_VAR + + VAR_TEMP + tStatus : Int; + tStatusSim : Int; + tSrcIdx : DInt; + tDestIdx : DInt; + nArrayMax : DInt; + stEmptyCarrier : "stCarrier"; // Carrier mit leeren Daten + END_VAR + + VAR CONSTANT + Constant_1 {InstructionName := 'DTL'; LibVersion := '1.0'} : DTL; + END_VAR + + +BEGIN + #nArrayMax := UPPER_BOUND(ARR := #arTSHR, DIM := 1); // get array size + + IF #xInShiftBack THEN // move backward + #tSrcIdx := 1; + #tDestIdx := 0; + ELSE // move forward + #tSrcIdx := 0; + #tDestIdx := 1; + END_IF; + + #tStatus := MOVE_BLK_VARIANT(SRC := #arTSHR, + COUNT := DINT_TO_UDINT(#nArrayMax-1), + SRC_INDEX := #tSrcIdx, + DEST_INDEX := #tDestIdx, + DEST => #arTSHR); + + #arTSHR[#nArrayMax] := #stEmptyCarrier; + + + + + +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_TargetDecision.libinfo b/2_ILSLib/FC/FC_TargetDecision.libinfo new file mode 100644 index 0000000..5ee0f13 --- /dev/null +++ b/2_ILSLib/FC/FC_TargetDecision.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 718b592c-b3f7-485a-b5db-163a6b763ce8 +LibraryVersion: + VersionNumber: 2.0.9 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/FC/FC_TargetDecision.libint b/2_ILSLib/FC/FC_TargetDecision.libint new file mode 100644 index 0000000..5daa9df --- /dev/null +++ b/2_ILSLib/FC/FC_TargetDecision.libint @@ -0,0 +1,17 @@ +DocumentHash: + - FileName: FC_TargetDecision.scl + Hash: kNd8G5z+HN1o9RuzkJtOXGe4eo2Buvf1y+1NaGO5ZZE= +LibraryMetaFileHash: FVB62exlMNV1jliCiCLS1KKSmFd70HRrQS7AAuiMRdE= +LibraryVersion: + Guid: d131374a-a6c5-4f85-90ef-e79fbf6a693d + DependsOn: + - TypeName: stStorageLine + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 + - TypeName: stConveyorStations + VersionNumber: 2.0.3 + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stJamData + VersionNumber: 2.0.0 diff --git a/2_ILSLib/FC/FC_TargetDecision.scl b/2_ILSLib/FC/FC_TargetDecision.scl new file mode 100644 index 0000000..9cc0b1a --- /dev/null +++ b/2_ILSLib/FC/FC_TargetDecision.scl @@ -0,0 +1,227 @@ +FUNCTION "FC_TargetDecision" : Void +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + arInStorageLineCalc : Array[1.."cNoLines"] of Int; + arInStorage : Array[*] of "stStorageLine"; + arInSenStore : Array[*] of "UDT_Sensor"; + nInDestGeneral : Int; + nInNoOfLines : Int; + nInStorageThreshold : Int; + nInMode : USInt; // 1 = abwechselnd; 2 = gleichmäßig füllen; 3 = nacheinander auffüllen + END_VAR + + VAR_OUTPUT + xOutBypass : Bool; + END_VAR + + VAR_IN_OUT + nInOutTarget : USInt; + xInOutFree : Bool; + stInOutConveyorStations : "stConveyorStations"; + stInOutCarrier : "stCarrier"; + stInOutJamBypass : "stJamData"; + END_VAR + + VAR_TEMP + nIdx : Int; // Schleifenindex + nIdx2 : Int; + nIdxMem : Int; // gemerkter Wert vom Schleifenindex + nTarget : Int; + nTargetMaxOnTheWay : Int; + nSum : Int; // Summe der Lagerbestände + nAverage : Int; // Durchschnitt der Lagerfüllstände + nThrTop : Int; // Obere Schwelle für Durchschnitt + nThrLow : Int; // Untere Schwelle für Durchschnitt + nNoOfSameTarget1 : Int; + END_VAR + + +BEGIN + (* + Funktion weist ab AddHanger-Sensor das Ziel des aktuellen Carriers zu, prüft aber vorher ob Ziel frei ist. Falls nicht, wird nächstes freies Ziel gesucht. + Falls alles voll ist, wird Stop-Befehl für Band ausgegeben + *) + + //Beispiel für Materialnummer Stand IBN: + //95001412-95001419 -> Sitz + //95001420-9500142x -> Lehne + //#nInProductNr DInt + + //************TEST FÜR DURCHSCHNITT************** + // FOR #nIdx := 1 TO "cNoLines" DO //Summe der Lagerlinien-Füllstände merken + // #nSum += #arInStorage[#nIdx].stData.Status.nCount; + // END_FOR; + // IF #nSum > 0 AND #nSum <= ("cNoLines" * "cNoPositions") THEN + // //Durchschnitt berechnen sowie obere/untere Schwelle, aber nur wenn Durchschnitt oberhalb eines festgelegten Wertes liegt + // #nAverage := #nSum / "cNoLines"; + // #nThrTop := #nAverage * "cAverageThrTop"; + // #nThrLow := #nAverage * "cAverageThrLow"; + // END_IF; + // "cAverageMin"... + + REGION Normierung für diesen FC + IF #nInOutTarget < 11 OR #nInOutTarget > #nInNoOfLines + 10 THEN // > nInNoLines hinzugefügt, für unterschiedlich große Lager-TRO + #nTarget := 1; //Wenn Ziel außerhalb des gültigen Bereichs, fange mit 1 an + ELSE + #nTarget := #nInOutTarget - 10; //nTarget benutzt Zahlen 1-21 statt von außen ab 11 beginnend zur einfacheren Handhabung + END_IF; + END_REGION + + CASE #nInMode OF + 1: + REGION ABWECHSELND - Ziele prüfen falls aktuelles belegt + IF #arInSenStore[#nTarget].xJam OR #arInStorage[#nTarget].stData.Status.nCount >= #nInStorageThreshold OR #arInStorageLineCalc[#nTarget] >= #nInStorageThreshold THEN //Wenn Ziel voll, dann.... + REGION Ziel korrigieren + IF #nTarget = #nInNoOfLines THEN //Wenn Ziel die letzte Linie ist, suche von 1. bis vorletzte Linie + REGION Suche von 1. bis vorletzte + FOR #nIdx := 1 TO (#nInNoOfLines - 1) DO + IF NOT #arInSenStore[#nIdx].xJam AND #arInStorage[#nIdx].stData.Status.nCount < #nInStorageThreshold AND #arInStorageLineCalc[#nIdx] < #nInStorageThreshold THEN + #nInOutTarget := INT_TO_USINT(#nIdx + 10); //nächstes freies Ziel. Fertig + RETURN; + END_IF; + END_FOR; + END_REGION + #xInOutFree := FALSE; //nichts freies gefunden -> Band stoppen + RETURN; + ELSE + REGION Suche bis zum Schluss... + FOR #nIdx := (#nTarget + 1) TO #nInNoOfLines DO //Suche AB der aktuellen Linie... + IF NOT #arInSenStore[#nIdx].xJam AND #arInStorage[#nIdx].stData.Status.nCount < #nInStorageThreshold AND #arInStorageLineCalc[#nIdx] < #nInStorageThreshold THEN + #nInOutTarget := INT_TO_USINT(#nIdx + 10); //nächstes freies Ziel. Fertig + RETURN; + END_IF; + END_FOR; + END_REGION + REGION ...und ggf. von 1. bis zum aktuellen + FOR #nIdx := 1 TO (#nTarget - 1) DO //...falls nichst gefunden, suche BIS zur aktuellen Linie + IF NOT #arInSenStore[#nIdx].xJam AND #arInStorage[#nIdx].stData.Status.nCount < #nInStorageThreshold AND #arInStorageLineCalc[#nIdx] < #nInStorageThreshold THEN + #nInOutTarget := INT_TO_USINT(#nIdx + 10); //nächstes freies Ziel. Fertig + RETURN; + END_IF; + END_FOR; + END_REGION + #xInOutFree := FALSE; //nichts freies gefunden -> Band stoppen + RETURN; + END_IF; + END_REGION + ELSE + REGION Ziel i.O. + #nInOutTarget := INT_TO_USINT(#nTarget + 10); //keine Korrektur nötig und übernehme Ziel einfach + END_REGION + END_IF; + END_REGION + 2: + REGION GLEICHMÄßIG BEFÜLLEN - Ziele prüfen + FOR #nIdx := 1 TO #nInNoOfLines DO + IF #nIdx = 1 THEN + IF NOT #arInSenStore[#nIdx].xJam AND #arInStorage[#nIdx].stData.Status.nCount < #nInStorageThreshold THEN + #nIdxMem := #nIdx; //Wenn beim 1. Schleifendurchlauf in L1 Platz ist, merke die 1 + END_IF; + ELSIF #nIdx > 1 THEN + // ab den folgenden Schleifendurchläufen, merke die Linie, welche weniger drin hat als die zuvor gemerkte (falls Platz ist) + IF NOT #arInSenStore[#nIdx].xJam AND #arInStorage[#nIdx].stData.Status.nCount < #nInStorageThreshold AND + #arInStorage[#nIdx].stData.Status.nCount < #arInStorage[#nIdxMem].stData.Status.nCount THEN + #nIdxMem := #nIdx; + END_IF; + END_IF; + END_FOR; + // nach der Schleife: Wenn nichts gemerkt wurde, heißt es dass alle Linien voll sind -> Band stoppen + IF #nIdxMem = 0 THEN + #xInOutFree := FALSE; //nichts freies gefunden -> Band stoppen + ELSE + #nInOutTarget := INT_TO_USINT(#nIdxMem + 10); //nächstes freies Ziel. Fertig + END_IF; + END_REGION + 3: + REGION JEDE LINIE NACHEINANDER BEFÜLLEN - Ziele prüfen + + //PRÜFEN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + REGION Richtungswechsel ermitteln TO DO ÜBERARBEITEN + (* IF #stInOutConveyorStations.stData.nTrolleysOnline > 0 THEN //wenn etwas unterwegs ist, ermittle ob der aktuelle Carrier ein kleineres Ziel hat als diese + FOR #nIdx2 := 1 TO #stInOutConveyorStations.stData.nTrolleysOnline DO + IF #nIdx2 = 1 THEN + #nTargetMaxOnTheWay := #stInOutConveyorStations.arTrolleysOnline[#nIdx2].stPinValues.nTarget; + ELSE + IF #stInOutConveyorStations.arTrolleysOnline[#nIdx2].stPinValues.nTarget > #nTargetMaxOnTheWay THEN + #nTargetMaxOnTheWay := #stInOutConveyorStations.arTrolleysOnline[#nIdx2].stPinValues.nTarget; + END_IF; + END_IF; + END_FOR; + IF (#stInOutCarrier.nDestination - #nInDestGeneral) > (#nTargetMaxOnTheWay - 10) THEN //Wenn aktueller Carrier ein höheres Ziel hat als die unterwegs, mach nichts + #xInOutFree := FALSE; + RETURN; + END_IF; + END_IF; *) + //Bearbeitung kann weiter gehen weil aktueller Carrier niedrigeres Ziel hat oder nichts + END_REGION + (* + Für Änderung dass man abwartet dass CarrierOnline leer ist vor Richtungswechsel: + -nicht TargetMaxOnTheWay ermitteln mit Schleife sondern einfach Ziel des ersten OnTheWay abfragen + -NoOfSameTarget muss nicht mit Schleife ermittelt werden sondern einfach von TrolleysOnline der nCount abgefragt werden + -..... + *) + REGION Linie ermitteln bzw. prüfen + //IF #stInOutCarrier.nDestination = 0 OR (#stInOutCarrier.nDestination >= #nInDestGeneral AND (#stInOutCarrier.nDestination <= #nInDestGeneral + #nInNoOfLines) AND NOT #stInOutCarrier.bStatus.%X5) THEN + IF #stInOutCarrier.nDestination = 0 OR (#stInOutCarrier.nDestination = #nInDestGeneral) THEN + (*normal Ziel ermitteln für neue Carrier*) + FOR #nIdx := 1 TO #nInNoOfLines DO + IF #stInOutConveyorStations.stData.nTrolleysOnline > 0 THEN //zähle gleiche Ziele zusammen erst wenn überhaupt etwas unterwegs ist + FOR #nIdx2 := 1 TO #stInOutConveyorStations.stData.nTrolleysOnline DO + IF #stInOutConveyorStations.arTrolleysOnline[#nIdx2].stPinValues.nTarget = #nIdx + 10 THEN + #nNoOfSameTarget1 += 1; //addiere die gleichen vergebenen Ziele auf dem Pinband + END_IF; + END_FOR; + END_IF; + + IF NOT #arInStorage[#nIdx].stData.Status.bByte.%X2 AND // Einfahrt gesperrt (HMI-Schnittstelle, manueller Eingriff) + NOT #arInSenStore[#nIdx].xJam AND //Phys. Stau + NOT #arInStorage[#nIdx].stData.Status.bByte.%X5 AND //reservierte Linie nicht anfahren + (#arInStorage[#nIdx].stData.Status.nCount + #nNoOfSameTarget1) < #nInStorageThreshold THEN + #nInOutTarget := INT_TO_USINT(#nIdx + 10); //nächstes freies Ziel. Fertig + #xInOutFree := TRUE; + RETURN; + END_IF; + #nNoOfSameTarget1 := 0; // Nullen + IF #nIdx = #nInNoOfLines THEN + #xInOutFree := FALSE; //nichts freies gefunden -> Band stoppen + END_IF; + END_FOR; + // ELSIF #stInOutCarrier.nDestination > #nInDestGeneral AND #stInOutCarrier.nDestination <= #nInDestGeneral + 21 THEN //zwischen 21101 und 21121 + // ELSIF (#stInOutCarrier.nDestination >= #nInDestGeneral AND #stInOutCarrier.nDestination <= #nInDestGeneral + #nInNoOfLines AND #stInOutCarrier.bStatus.%X5) THEN + ELSIF ((#stInOutCarrier.nDestination > #nInDestGeneral) AND (#stInOutCarrier.nDestination <= (#nInDestGeneral + #nInNoOfLines))) THEN + (*hat schon Ziel in diesem Block, daher prüfen ob diese Linie frei*) + + IF #stInOutConveyorStations.stData.nTrolleysOnline > 0 THEN //zähle gleiche Ziele zusammen erst wenn überhaupt etwas unterwegs ist + FOR #nIdx2 := 1 TO #stInOutConveyorStations.stData.nTrolleysOnline DO + IF #stInOutConveyorStations.arTrolleysOnline[#nIdx2].stPinValues.nTarget = (#stInOutCarrier.nDestination - #nInDestGeneral) + 10 THEN + #nNoOfSameTarget1 += 1; //addiere die gleichen vergebenen Ziele auf dem Pinband + END_IF; + END_FOR; + END_IF; + IF NOT #arInSenStore[#stInOutCarrier.nDestination - #nInDestGeneral].xJam AND //phys. Stau + NOT #arInStorage[#stInOutCarrier.nDestination - #nInDestGeneral].stData.Status.bByte.%X2 AND //Einfahrt gesperrt (HMI, manuell) + (#arInStorage[#stInOutCarrier.nDestination - #nInDestGeneral].stData.Status.nCount + #nNoOfSameTarget1) < #nInStorageThreshold THEN + #nInOutTarget := INT_TO_USINT((#stInOutCarrier.nDestination - #nInDestGeneral) + 10); //nächstes freies Ziel. Fertig + #xInOutFree := TRUE; + RETURN; + END_IF; + #xInOutFree := FALSE; //nichts freies gefunden -> Band stoppen + ELSE + (*Bypass*) + #nInOutTarget := INT_TO_USINT(#nInNoOfLines + 10 + 1); + #xOutBypass := TRUE; + IF NOT (#stInOutJamBypass.Status.nCount >= #stInOutJamBypass.Config.nCapacitySet) THEN + #xInOutFree := TRUE; + END_IF; + END_IF; + END_REGION + + END_REGION + ELSE + #xInOutFree := FALSE; //falsche Eingabe -> Band stoppen + END_CASE; + + +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_Uint2TroString.libinfo b/2_ILSLib/FC/FC_Uint2TroString.libinfo new file mode 100644 index 0000000..64c5657 --- /dev/null +++ b/2_ILSLib/FC/FC_Uint2TroString.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 080fec55-3e2f-4dd7-a4ef-294c5113ff9e + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: initial diff --git a/2_ILSLib/FC/FC_Uint2TroString.libint b/2_ILSLib/FC/FC_Uint2TroString.libint new file mode 100644 index 0000000..b2293d8 --- /dev/null +++ b/2_ILSLib/FC/FC_Uint2TroString.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: FC_Uint2TroString.scl + Hash: Gs1y9qS42iVf5AZEmG/pjCxOA+B8NRA14qLGfUhrcQA= +LibraryMetaFileHash: dsNZNzo5UmuqP9VU8rCmYwxrpDVyLoCN/2yQH46KEOE= +LibraryVersion: + Guid: 87ef5917-e524-4be6-9c25-711f27819aa2 diff --git a/2_ILSLib/FC/FC_Uint2TroString.scl b/2_ILSLib/FC/FC_Uint2TroString.scl new file mode 100644 index 0000000..f5914de --- /dev/null +++ b/2_ILSLib/FC/FC_Uint2TroString.scl @@ -0,0 +1,53 @@ +FUNCTION "FC_Uint2TroString" : String +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + nInNumber : UInt; + END_VAR + + VAR_TEMP + sTmp : String[5]; + END_VAR + + +BEGIN + // Funktion wandelt Uint zu einem Tro-String. Aus 123 wird 12.3, aus 0 wird 0.0 aus 12345 wird 1234.5 + // Autor: Christian Forkl + // Getestet: Ja + // 03.08.2021 + + #sTmp := RIGHT(IN := UINT_TO_STRING(#nInNumber), L := (LEN(UINT_TO_STRING(#nInNumber)) - 1)); + + #FC_Uint2TroString := ''; + + IF #nInNumber > 9999 THEN + #FC_Uint2TroString[1] := #sTmp[1]; + #FC_Uint2TroString[2] := #sTmp[2]; + #FC_Uint2TroString[3] := #sTmp[3]; + #FC_Uint2TroString[4] := #sTmp[4]; + #FC_Uint2TroString[5] := '.'; + #FC_Uint2TroString[6] := #sTmp[5]; + ELSIF #nInNumber > 999 THEN + #FC_Uint2TroString[1] := #sTmp[1]; + #FC_Uint2TroString[2] := #sTmp[2]; + #FC_Uint2TroString[3] := #sTmp[3]; + #FC_Uint2TroString[4] := '.'; + #FC_Uint2TroString[5] := #sTmp[4]; + ELSIF #nInNumber > 99 THEN + #FC_Uint2TroString[1] := #sTmp[1]; + #FC_Uint2TroString[2] := #sTmp[2]; + #FC_Uint2TroString[3] := '.'; + #FC_Uint2TroString[4] := #sTmp[3]; + ELSIF #nInNumber > 9 THEN + #FC_Uint2TroString[1] := #sTmp[1]; + #FC_Uint2TroString[2] := '.'; + #FC_Uint2TroString[3] := #sTmp[2]; + ELSIF #nInNumber > 0 THEN + #FC_Uint2TroString[1] := '0'; + #FC_Uint2TroString[2] := '.'; + #FC_Uint2TroString[3] := #sTmp[1]; + ELSE + #FC_Uint2TroString := '0.0'; + END_IF; +END_FUNCTION + diff --git a/2_ILSLib/FC/FC_usint2String.libinfo b/2_ILSLib/FC/FC_usint2String.libinfo new file mode 100644 index 0000000..7c415b8 --- /dev/null +++ b/2_ILSLib/FC/FC_usint2String.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 170b53d4-41f2-4a63-95d5-f1d211def922 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: initial diff --git a/2_ILSLib/FC/FC_usint2String.libint b/2_ILSLib/FC/FC_usint2String.libint new file mode 100644 index 0000000..38f2ba5 --- /dev/null +++ b/2_ILSLib/FC/FC_usint2String.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: FC_usint2String.scl + Hash: sccEToQ7qZ2iK+oOSrv6Rq5UMC5OehwiiZAV6HbYSQA= +LibraryMetaFileHash: xVWgpoJxAToKwiCXx005TzLRsm4th9GS44N6XJthX8U= +LibraryVersion: + Guid: f6da1f27-73cc-44c0-b509-a32a5cc418eb diff --git a/2_ILSLib/FC/FC_usint2String.scl b/2_ILSLib/FC/FC_usint2String.scl new file mode 100644 index 0000000..6566221 --- /dev/null +++ b/2_ILSLib/FC/FC_usint2String.scl @@ -0,0 +1,25 @@ +FUNCTION "FC_usint2String" : String +{ S7_Optimized_Access := 'TRUE' } +VERSION : 0.1 + VAR_INPUT + nInNumber : USInt; + END_VAR + + VAR_TEMP + sTmp : String; + END_VAR + + +BEGIN + // Funktion wandelt Int zu String. Im Gegensatz zu "Int_To_String" wird das "+" entfernt. Bei negativen Zahlen bleibt das "-" erhalten. + // Autor: Christian Forkl + // 28.07.2021 + + #sTmp := USINT_TO_STRING(#nInNumber); + IF #nInNumber >= 0 THEN + #FC_usint2String := RIGHT(IN := #sTmp, L := (LEN(#sTmp) - 1)); + ELSE + #FC_usint2String := #sTmp; + END_IF; +END_FUNCTION + diff --git a/2_ILSLib/UDT/Carrier/CarrierLeaveStore.libinfo b/2_ILSLib/UDT/Carrier/CarrierLeaveStore.libinfo new file mode 100644 index 0000000..e688d2f --- /dev/null +++ b/2_ILSLib/UDT/Carrier/CarrierLeaveStore.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 9104ccaf-90b1-4bd2-9886-5a742a918243 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/Carrier/CarrierLeaveStore.libint b/2_ILSLib/UDT/Carrier/CarrierLeaveStore.libint new file mode 100644 index 0000000..0680076 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/CarrierLeaveStore.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: CarrierLeaveStore.xml + Hash: TFQRB1uNLF+QfMPuBYnEuM6r8qpsHKL8+SxnM6qcgek= +LibraryMetaFileHash: VelI6ybo/cdlizUBs6BBHPU2Sm61GVYOYf9ebPBYBgE= +LibraryVersion: + Guid: 03bf98b2-85e2-4e19-839b-bf901ba95283 diff --git a/2_ILSLib/UDT/Carrier/CarrierLeaveStore.xml b/2_ILSLib/UDT/Carrier/CarrierLeaveStore.xml new file mode 100644 index 0000000..ec449d8 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/CarrierLeaveStore.xml @@ -0,0 +1,75 @@ + + + + + + +
+ + + false + + + Bereit zum Rausfahren Anzahl + + 0 + + + 0 + + + 0 + +
+
+ CarrierLeaveStore + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.libinfo b/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.libinfo new file mode 100644 index 0000000..afdfe5a --- /dev/null +++ b/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: f489a477-6112-494f-a6da-29f28a4a608b +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.libint b/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.libint new file mode 100644 index 0000000..611c506 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: CarrierStatisticsStore.xml + Hash: V4QduRV07kO09V4xoCqSn8LANENaAEcwP0SDn3Fch9c= +LibraryMetaFileHash: QiiZWlxn6mcVH0o/vCugbEpjH4gNOSX9ILSnFHeArZg= +LibraryVersion: + Guid: c850dd6c-db40-4adc-9182-d35aaf8da71a + DependsOn: + - TypeName: CarrierLeaveStore + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.xml b/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.xml new file mode 100644 index 0000000..33dab7e --- /dev/null +++ b/2_ILSLib/UDT/Carrier/CarrierStatisticsStore.xml @@ -0,0 +1,84 @@ + + + + + + +
+ + + false + + + Leere Carrier Anzahl + + + + + false + + + Dummys Anzahl + + + + + false + + + Bereit zum Rausfahren + + +
+
+ CarrierStatisticsStore + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Carrier/stCarrier.libinfo b/2_ILSLib/UDT/Carrier/stCarrier.libinfo new file mode 100644 index 0000000..bba8954 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stCarrier.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: e1e80a27-a133-4f03-83be-6ca64e2b017e +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Bits durch ein Byte ersetzt diff --git a/2_ILSLib/UDT/Carrier/stCarrier.libint b/2_ILSLib/UDT/Carrier/stCarrier.libint new file mode 100644 index 0000000..e75429a --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stCarrier.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stCarrier.xml + Hash: O9mB6aZ8kSY/5LlfFdtQFjN86AHgsAU3C3gFDQkn2z0= +LibraryMetaFileHash: okNjPW/S/BR8nzYTFUECTsFOIgNJfcn75pGSkHLaWko= +LibraryVersion: + Guid: 85ebb5d6-2793-4e8b-a9d6-e9553e3d00af diff --git a/2_ILSLib/UDT/Carrier/stCarrier.xml b/2_ILSLib/UDT/Carrier/stCarrier.xml new file mode 100644 index 0000000..18b43a7 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stCarrier.xml @@ -0,0 +1,76 @@ + + + + + + +
+ + + Barcode vom Carrier + + + + + Ziel vom Carrier (Beispiel: 0 [initial] -> 21100 [Einlagerziel allg.] -> 21101 [Einlagerziel Linie] -> 21105 [Sequenz] -> 30000 [Auslagern]) + + + + + %X0-Online,%X1-Loaded,%X2-Locked, %X3-Short, %X4-Long, %X5-Requested, %X6-Pre-Sequence, %X7Retrieve, %X8-StationAMR, %X9-StationF2H, %X10-Priority + + 16#0 + +
+
+ stCarrier + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Carrier/stCarrierPin.libinfo b/2_ILSLib/UDT/Carrier/stCarrierPin.libinfo new file mode 100644 index 0000000..504f257 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stCarrierPin.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: a6bfdf72-c89c-460c-b3ef-7dceae0b83c5 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/Carrier/stCarrierPin.libint b/2_ILSLib/UDT/Carrier/stCarrierPin.libint new file mode 100644 index 0000000..49822e6 --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stCarrierPin.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: stCarrierPin.xml + Hash: itYbfGPrba54KE0ZwBglhf9+vlXcErtRRWVjImTjJ68= +LibraryMetaFileHash: acu+75q9LY6VJZHXOWZlDcQ8XdZQg3YCZkPsCSLIWjM= +LibraryVersion: + Guid: 54f8309f-407f-4b75-b511-ff32eaba4f35 + DependsOn: + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stPinValues + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Carrier/stCarrierPin.xml b/2_ILSLib/UDT/Carrier/stCarrierPin.xml new file mode 100644 index 0000000..66f300a --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stCarrierPin.xml @@ -0,0 +1,70 @@ + + + + + + +
+ + + true + + + + + true + + +
+
+ stCarrierPin + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Carrier/stPinValues.libinfo b/2_ILSLib/UDT/Carrier/stPinValues.libinfo new file mode 100644 index 0000000..8c29e7c --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stPinValues.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 19be507e-e5bb-488c-84fc-6503bc39f793 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/Carrier/stPinValues.libint b/2_ILSLib/UDT/Carrier/stPinValues.libint new file mode 100644 index 0000000..7957ffe --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stPinValues.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stPinValues.xml + Hash: 2Blw9bQIgAAJynIR8zZ1FL0oAZ1Kp+AM6/AyfTpxfFI= +LibraryMetaFileHash: KlhBqXhZ9byKdKv7OPzFhvVKDT0XdzNj4Lh6PUq3XdE= +LibraryVersion: + Guid: dc3ac74d-005a-4d71-9c8a-996c602cca8a diff --git a/2_ILSLib/UDT/Carrier/stPinValues.xml b/2_ILSLib/UDT/Carrier/stPinValues.xml new file mode 100644 index 0000000..472138d --- /dev/null +++ b/2_ILSLib/UDT/Carrier/stPinValues.xml @@ -0,0 +1,75 @@ + + + + + + +
+ + + Aktuelle Inkrement-Position auf Band + + + + + Zielposition + + + + + Ziel auf Pin-Band (11 = erste Linie, 12 = zweite Linie usw.) + + +
+
+ stPinValues + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.libinfo b/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.libinfo new file mode 100644 index 0000000..cb4bccb --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: d409a80d-1225-4b09-b3f8-be8cb88bf155 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.libint b/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.libint new file mode 100644 index 0000000..5432062 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stConveyorStationPos.xml + Hash: zuRKGAh6O+uiDoNlwVU/YHvOIxOlI27VjRpUJe2Mz4M= +LibraryMetaFileHash: vACJ7bG7yxtpRbQty1W8MF5uyBXb9WpQ1+vgkclasM4= +LibraryVersion: + Guid: fa1b25cb-f689-4840-b5c7-eed9eb44f6dc diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.xml b/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.xml new file mode 100644 index 0000000..8a46cb3 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStationPos.xml @@ -0,0 +1,65 @@ + + + + + + +
+ + + Position auf Band (Inkrement) + + +
+
+ stConveyorStationPos + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStations.libinfo b/2_ILSLib/UDT/ConveyorStations/stConveyorStations.libinfo new file mode 100644 index 0000000..c410c97 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStations.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: f0150d72-81e3-4453-b014-3f59a78b88ee +LibraryVersion: + VersionNumber: 2.0.3 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: aktualisiert wegen unterlagerter Änderung diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStations.libint b/2_ILSLib/UDT/ConveyorStations/stConveyorStations.libint new file mode 100644 index 0000000..d1b8ec1 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStations.libint @@ -0,0 +1,13 @@ +DocumentHash: + - FileName: stConveyorStations.xml + Hash: HLCsGyEFIYI/sUzEvqVzX02SlSDTjDQc3/mbfGImHAo= +LibraryMetaFileHash: wtziLWElVqGJuNZqNz5mjNOcpv+ZNauCNhjDA7lhoAo= +LibraryVersion: + Guid: 1c208479-6334-4124-b854-d889080ed716 + DependsOn: + - TypeName: stCarrierPin + VersionNumber: 2.0.0 + - TypeName: stConveyorStationPos + VersionNumber: 2.0.0 + - TypeName: stConveyorStationsData + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStations.xml b/2_ILSLib/UDT/ConveyorStations/stConveyorStations.xml new file mode 100644 index 0000000..ebbf197 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStations.xml @@ -0,0 +1,135 @@ + + + + + + +
+ + +
+ + + + Seperator + + + + + Sensor Bügel auf Kette + + + + + KameraPos + + + + + DoppelbügelerkennungPos + + + + + Reserve + + + + + Reserve + + + + + Reserve + + + + + Reserve + + + + + Reserve + + + + + Reserve + + + + + Station 1 + + + + + Station n + + + + + + true + + + + + true + + +
+
+ stConveyorStations + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + \ No newline at end of file diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.libinfo b/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.libinfo new file mode 100644 index 0000000..56819b0 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 79d96156-eb37-422c-8537-94fb8ef0d7e3 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.libint b/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.libint new file mode 100644 index 0000000..c86400d --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stConveyorStationsData.xml + Hash: UqzmMgjNdxM2tjKEX58ZPN/nhgihzbQ1yUjY+kNpDKM= +LibraryMetaFileHash: gcIUblpo175vFvT4OyhKnPs0bt7P1ZTHgUChBIM8kZY= +LibraryVersion: + Guid: 1105b908-9f8f-440d-858c-0ca809e1b562 diff --git a/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.xml b/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.xml new file mode 100644 index 0000000..24aa1c9 --- /dev/null +++ b/2_ILSLib/UDT/ConveyorStations/stConveyorStationsData.xml @@ -0,0 +1,88 @@ + + + + + + +
+ + + Anzahl beladener Trolleys + + + + + true + + + Anzahl Stations auf Sorter + + + + + Encoder Wert Inkrement + + + + + Aktuelle Position im Pitch + + + + + Dummy-Barcode am Anfang vergeben + + +
+
+ stConveyorStationsData + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/EventLogging/stEventBookingInfo.libinfo b/2_ILSLib/UDT/EventLogging/stEventBookingInfo.libinfo new file mode 100644 index 0000000..f4c8b65 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventBookingInfo.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 82c85f0d-ccab-431d-aa92-eed22521aa25 + Comment: + de-DE: 'CHANGED: übersetzt' +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/UDT/EventLogging/stEventBookingInfo.libint b/2_ILSLib/UDT/EventLogging/stEventBookingInfo.libint new file mode 100644 index 0000000..8bb7953 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventBookingInfo.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stEventBookingInfo.xml + Hash: 927VtIHrAixwv1pBnilVyfNnGTl1mTWN/J/PvAurFkY= +LibraryMetaFileHash: juQ9iGU2KCZELBM4ifX7RHpmKtCZkhAuZUMgWXLJMMc= +LibraryVersion: + Guid: c4bb5b1d-d494-4ba9-8579-919f46480c1e diff --git a/2_ILSLib/UDT/EventLogging/stEventBookingInfo.xml b/2_ILSLib/UDT/EventLogging/stEventBookingInfo.xml new file mode 100644 index 0000000..2ac1e4a --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventBookingInfo.xml @@ -0,0 +1,66 @@ + + + + + + +
+ + + + + + +
+
+ stEventBookingInfo + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.libinfo b/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.libinfo new file mode 100644 index 0000000..c4b7ea2 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 77406f65-d326-40b7-8806-4eba40123000 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.libint b/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.libint new file mode 100644 index 0000000..c9802bc --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stEventCorrectionInfo.xml + Hash: VSqa75hDaGMeqnxxLzJgIcsY1kGLB/PbMgU5C9OzMaU= +LibraryMetaFileHash: 8/qXaepJXSkqD/scaEiEzRXd/Q7ZEfLlKV6l9H8M0Fk= +LibraryVersion: + Guid: ffd25bc8-8294-4342-8ce7-f912afc2ff0f diff --git a/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.xml b/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.xml new file mode 100644 index 0000000..82b4581 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventCorrectionInfo.xml @@ -0,0 +1,60 @@ + + + + + + +
+ + + + 0: aus HyperJam löschen | 1: Löschen und schieben | 2: Dummy anlegen | 3: In HyperJam einfügen + + + + + Barcode Carrier + + + + + Location: Linie oder Jam + + + + + Position + + + + + +
+
+ stEventCorrectionInfo + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/EventLogging/stEventScanInfo.libinfo b/2_ILSLib/UDT/EventLogging/stEventScanInfo.libinfo new file mode 100644 index 0000000..8683591 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventScanInfo.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 0ee040fd-7c22-447b-9f54-00ab7755a6de + Comment: + de-DE: 'CHANGED: übersetzt' +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/UDT/EventLogging/stEventScanInfo.libint b/2_ILSLib/UDT/EventLogging/stEventScanInfo.libint new file mode 100644 index 0000000..562e687 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventScanInfo.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stEventScanInfo.xml + Hash: GICCywGedk30cUSFUG5zeQcGmB6jvUVBAAoNiCB5U/o= +LibraryMetaFileHash: QPYq4Acuakdwsk6LHZ12iLp0E98RqdPWeIPLf/CSIbo= +LibraryVersion: + Guid: c2b9634d-aac2-4ebb-86d8-3d8f90f2857b diff --git a/2_ILSLib/UDT/EventLogging/stEventScanInfo.xml b/2_ILSLib/UDT/EventLogging/stEventScanInfo.xml new file mode 100644 index 0000000..31491a8 --- /dev/null +++ b/2_ILSLib/UDT/EventLogging/stEventScanInfo.xml @@ -0,0 +1,71 @@ + + + + + + +
+ + + 0: Material No-Read | 1: Carrier No-Read | 2: New Carrier | 3: Unknown Carrier + + + + + + + + +
+
+ stEventScanInfo + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.libinfo b/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.libinfo new file mode 100644 index 0000000..d769e8c --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: b4d5d6ca-cf66-497f-a4ea-5a850dec4413 + Comment: + de-DE: PriorityManager Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: PriorityManager Initial diff --git a/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.libint b/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.libint new file mode 100644 index 0000000..0c6d7e4 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: UDT_MTRO_Prio.xml + Hash: IueDmJNuofrwsoSK4WW3l0AtNRABlxtGDjMNS9vVkoM= +LibraryMetaFileHash: dWHHsx5RAICd+jj5+fJ9uc+XbrHpUy2aEQyc0UkUSGY= +LibraryVersion: + Guid: c353e6f7-87d9-4400-a81b-36e8565ec9dc + DependsOn: + - TypeName: UDT_Request + VersionNumber: 2.0.0 + - TypeName: UDT_Response + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.xml b/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.xml new file mode 100644 index 0000000..022d3c0 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_MTRO_Prio.xml @@ -0,0 +1,46 @@ + + + + + + +
+ + + true + + + + + true + + +
+
+ UDT_MTRO_Prio + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.libinfo b/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.libinfo new file mode 100644 index 0000000..b87bb81 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: ac195f4d-7528-46fe-91c5-5b291bdec8f5 + Comment: + de-DE: PriorityManager Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: PriorityManager Initial diff --git a/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.libint b/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.libint new file mode 100644 index 0000000..0c31f35 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_PrioParameter.xml + Hash: B3q/JOsCQz68I5WcZhb0HOLynQwb9hefmJ7xMdnwBn0= +LibraryMetaFileHash: 0pgwJJgHJDgeOchU6ScmzFqSeqNlO6xL2c78GiOKlTU= +LibraryVersion: + Guid: 151e4c54-a932-45b5-9177-45a33c57784a diff --git a/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.xml b/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.xml new file mode 100644 index 0000000..8e1a0ff --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_PrioParameter.xml @@ -0,0 +1,51 @@ + + + + + + +
+ + + 0= undefiniert, 1= zeitgesteuert, 2= Mengengesteuert, 3= Prio Ampel + + + + + Dauer des Prio Zyklus + + + + + Anzahl der Teile ab wann der Prio Zyklus wechselt + + +
+
+ UDT_PrioParameter + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/PriorityManager/UDT_Request.libinfo b/2_ILSLib/UDT/PriorityManager/UDT_Request.libinfo new file mode 100644 index 0000000..118bf41 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_Request.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: a8b25178-7578-447c-852f-a21404c4bfd6 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/UDT/PriorityManager/UDT_Request.libint b/2_ILSLib/UDT/PriorityManager/UDT_Request.libint new file mode 100644 index 0000000..36da611 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_Request.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: UDT_Request.xml + Hash: d3CmJeWuhJWfT3oOnrxq5L2JfnTp/nFec0IUsP2y4Wg= +LibraryMetaFileHash: +l4TZLnOpvhqWFM+/cUL0OEGV20tbXD2zgBDuXM/5J0= +LibraryVersion: + Guid: 74ec709b-866d-46f6-abc6-f5fa026b4bb7 + DependsOn: + - TypeName: stJamData + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/PriorityManager/UDT_Request.xml b/2_ILSLib/UDT/PriorityManager/UDT_Request.xml new file mode 100644 index 0000000..8ad07d8 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_Request.xml @@ -0,0 +1,83 @@ + + + + + + +
+ + + TRO-ID + + + + + Anfrage zum Fahren + + + + + true + + + Separator Belegung + + + + + true + + + Information Eingangs-Staubereich + + + + + true + + + Information Ausgangs-Staubereich + + + + + true + + + Motor aktiv + + + + + Low -> High: Neuer Trolley eingefahren | High -> Low: Trolley vereinzelt (z.B. zum Zählen) + + +
+
+ UDT_Request + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/PriorityManager/UDT_Response.libinfo b/2_ILSLib/UDT/PriorityManager/UDT_Response.libinfo new file mode 100644 index 0000000..9370498 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_Response.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 7c3b5bd8-2bd0-4142-8573-13628f5f670b + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/UDT/PriorityManager/UDT_Response.libint b/2_ILSLib/UDT/PriorityManager/UDT_Response.libint new file mode 100644 index 0000000..96102a1 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_Response.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_Response.xml + Hash: t7Q79+lqAXvg7y3zhfXf7vfRPZ/FfqYMb7USPOVzBxQ= +LibraryMetaFileHash: +NPBI94w/lDdzR4/s1BD7TZzlYxHnX6fYFVZt+LeVSw= +LibraryVersion: + Guid: fc376672-43cb-4b4c-8862-daf93d007513 diff --git a/2_ILSLib/UDT/PriorityManager/UDT_Response.xml b/2_ILSLib/UDT/PriorityManager/UDT_Response.xml new file mode 100644 index 0000000..8d2cd65 --- /dev/null +++ b/2_ILSLib/UDT/PriorityManager/UDT_Response.xml @@ -0,0 +1,41 @@ + + + + + + +
+ + + Freigabe + + +
+
+ UDT_Response + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/IntfSeparator.libinfo b/2_ILSLib/UDT/Separator/IntfSeparator.libinfo new file mode 100644 index 0000000..789b9f5 --- /dev/null +++ b/2_ILSLib/UDT/Separator/IntfSeparator.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 877895f5-b783-4a5d-bf45-e5aa8c52970f + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: initial diff --git a/2_ILSLib/UDT/Separator/IntfSeparator.libint b/2_ILSLib/UDT/Separator/IntfSeparator.libint new file mode 100644 index 0000000..4b66018 --- /dev/null +++ b/2_ILSLib/UDT/Separator/IntfSeparator.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: IntfSeparator.xml + Hash: dlM/Y7mXaEINPMS200N7hoG35LOwaOoMzaRQyWo98nE= +LibraryMetaFileHash: TCCd9d3tWLvsiSfLO3AF1TMY8NVVAgDJoiWSJ0vM7KE= +LibraryVersion: + Guid: 7a81ff69-aa42-4807-983a-58b7ed9583d0 diff --git a/2_ILSLib/UDT/Separator/IntfSeparator.xml b/2_ILSLib/UDT/Separator/IntfSeparator.xml new file mode 100644 index 0000000..5f6b999 --- /dev/null +++ b/2_ILSLib/UDT/Separator/IntfSeparator.xml @@ -0,0 +1,71 @@ + + + + + + +
+ + + Anzahl insgesamt ausgefahrener BT und NBT + + + + + 0: Aus wegen MainState | 5: Aus wegen EStop | 10: Initialisiere | 15: Warte auf Trolley | 20: Warte auf Motor | 25: Warte auf Anforderung durch MainTro | 30: Öffnet um Trolley auszufahren | 35: Schließt | 37: Warte auf Confirm Sensor | 40: Fehler beim Ausfahren + + + + + 0: geschlossen | 1: offen + + + + + 0: kein Stau | 1: Stau + + + + + 0: kein Bügelträger vorhanden (auch 0 wenn Nullbügelträger vorhanden) | 1: Bügelträger vorhanden + + + + + 0: Nullbügelträger nicht in Separator| 1: Nullbügelträger in Separator + + + + + Carousel ist im Zustand "Run" + + +
+
+ IntfSeparator + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/SettingsSeparator.libinfo b/2_ILSLib/UDT/Separator/SettingsSeparator.libinfo new file mode 100644 index 0000000..099edd2 --- /dev/null +++ b/2_ILSLib/UDT/Separator/SettingsSeparator.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 2e3914bf-0036-4580-8965-c56b76bd2003 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.1 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: initial diff --git a/2_ILSLib/UDT/Separator/SettingsSeparator.libint b/2_ILSLib/UDT/Separator/SettingsSeparator.libint new file mode 100644 index 0000000..0ef4854 --- /dev/null +++ b/2_ILSLib/UDT/Separator/SettingsSeparator.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: SettingsSeparator.xml + Hash: qGdmsovBD9OSYUvN0RQajWyOlRCZRwAHxqLlTdELhoo= +LibraryMetaFileHash: QTGhINRXJuIloMp6GP5fpmm/SZkPdt2iJIp3LdYIXD8= +LibraryVersion: + Guid: 31baee87-a116-43f0-b516-bd7914a74d0b + DependsOn: + - TypeName: stSimuJamConfig + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Separator/SettingsSeparator.xml b/2_ILSLib/UDT/Separator/SettingsSeparator.xml new file mode 100644 index 0000000..a274f4b --- /dev/null +++ b/2_ILSLib/UDT/Separator/SettingsSeparator.xml @@ -0,0 +1,190 @@ + + + + + + +
+ + + Zeit wie lange geöffnet bleibt + + T#100ms + + + + Zeit wie lange nach Herauslassen wartet + + T#10ms + + + + Zeit wie lange Sensor frei sein soll bis Ausschwingen startet + + + + + Zeit wie lange gewartet wird zum ausschwingen + + + + 100 + + + + Berceli fragen + + + + + Berceli fragen + + T#10s + + + + Zeit welche der BT hat um rauszufahren (Berceli fragen) + + T#5000ms + + + + Zeit wie lange der Separator das "öffne"- bzw. "schließe"-Signal bekommt + + T#100ms + + + + Zeit am Stausensor bis Stauwarnung auslöst + + + + + Zeit wie lange das Scannersignal maximal anliegen darf + + T#5s + + + + FÜR LAGER: Begrenzung bei nachfolgendem Stau + + 1 + + + + Nummer des Separators + + + + + Nummer des Carousels + + + + + Stau Nummer/Name + + + + + "Jam Sensor" ist angeschlossen + + + + + "Part Sensor" ist angeschlossen + + + + + "Nullbügelträger-Sensor" ist angeschlossen + + + + + "Confirm"-Sensor ist angeschlossen, kommt nach dem Scanner + + + + + Scanner angeschlossen + + + + + Berceli fragen + + true + + + + Berceli fragen + + + + + Berceli fragen + + + + + + + + true + + + +
+
+ SettingsSeparator + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_Separator.libinfo b/2_ILSLib/UDT/Separator/UDT_HMI_Separator.libinfo new file mode 100644 index 0000000..e8117aa --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_Separator.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 4facddbf-79fc-4650-bf17-d05e9e31b010 + Comment: + de-DE: 'Anwenderdatentyp für Separator ' +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: initial diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_Separator.libint b/2_ILSLib/UDT/Separator/UDT_HMI_Separator.libint new file mode 100644 index 0000000..06ccfd2 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_Separator.libint @@ -0,0 +1,15 @@ +DocumentHash: + - FileName: UDT_HMI_Separator.xml + Hash: 9CFGlf46XD89qDWTQnJfnIFo9OsK1Fb2eNwyPr0nJpA= +LibraryMetaFileHash: 3TRU4ljWWvOHIBrxCx247NgcVADSzD5FAQrzY80jtzg= +LibraryVersion: + Guid: 844e29dc-63f2-4fef-9e67-331444a7f3cc + DependsOn: + - TypeName: UDT_HMI_SeparatorStatus + VersionNumber: 2.0.0 + - TypeName: UDT_HMI_SeparatorControl + VersionNumber: 2.0.0 + - TypeName: UDT_HMI_SeparatorConfig + VersionNumber: 2.0.0 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_Separator.xml b/2_ILSLib/UDT/Separator/UDT_HMI_Separator.xml new file mode 100644 index 0000000..3c839bf --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_Separator.xml @@ -0,0 +1,90 @@ + + + + + + +
+ + + Separator Status + + + + + Separator Konfiguration + + + + + Separator Steuerung + + + + + In Sensor + + + + + Out Sensor + + + + + Part Sensor + + +
+
+ UDT_HMI_Separator + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.libinfo b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.libinfo new file mode 100644 index 0000000..d6c6120 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 7471d821-806b-499d-9418-56461cc6b168 + Comment: + de-DE: 'Anwenderdatentyp für Separator ' +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: 'Anwenderdatentyp für Separator ' diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.libint b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.libint new file mode 100644 index 0000000..28a947e --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_HMI_SeparatorConfig.xml + Hash: AEa0z2Da9w7bpZ6mDo9wugasXsNiRA+6FyHkoHx4+9w= +LibraryMetaFileHash: 1AUovJymA190jdiDc7vW3ZdMit9VT863cpXD2a8pLFw= +LibraryVersion: + Guid: a2c5419c-9cf7-473b-9fd8-031a55043337 diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.xml b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.xml new file mode 100644 index 0000000..5c55971 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorConfig.xml @@ -0,0 +1,40 @@ + + + + + + +
+ + + + +
+
+ UDT_HMI_SeparatorConfig + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.libinfo b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.libinfo new file mode 100644 index 0000000..d14f957 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: c96bc9f6-9ee8-4c73-a126-a839ed69f4dc + Comment: + de-DE: 'Anwenderdatentyp für Separator ' +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: 'Anwenderdatentyp für Separator ' diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.libint b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.libint new file mode 100644 index 0000000..e9cf5cd --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_HMI_SeparatorControl.xml + Hash: yMG+orLjGTjneVCz6yetICC8Jw3JPyknYCV0kTMGK/Y= +LibraryMetaFileHash: wXpDP9AO+NcgOUslnAgU5RQJZFbhHCEHu8d+yZkZQx0= +LibraryVersion: + Guid: 34a7aa2d-a226-4ff4-a1dd-02edfed02927 diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.xml b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.xml new file mode 100644 index 0000000..9428e76 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorControl.xml @@ -0,0 +1,46 @@ + + + + + + +
+ + + Separator sperren + + + + + Separator Freigabe Override + + +
+
+ UDT_HMI_SeparatorControl + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.libinfo b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.libinfo new file mode 100644 index 0000000..831f051 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 371d13d8-9fe5-4b50-b1ed-7c9f4e958058 + Comment: + de-DE: 'Anwenderdatentyp für Separator ' +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: 'Anwenderdatentyp für Separator ' diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.libint b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.libint new file mode 100644 index 0000000..0bd53e5 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_HMI_SeparatorError.xml + Hash: ijrgLQ6cWJvhU8DAEpIdMLwy2mntOjR9FDMtvesWA1U= +LibraryMetaFileHash: cg5jj7k73bMlcskUZ/kiNBQ/JjkvaCePagGeIMWXB5g= +LibraryVersion: + Guid: 264ad080-8c27-4751-8173-72e706002d25 diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.xml b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.xml new file mode 100644 index 0000000..b8cd209 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorError.xml @@ -0,0 +1,66 @@ + + + + + + +
+ + + Fehler Separator + + + + + Bt fährt nicht in Separator / kein Bt im Separator + + + + + Bt verlässt Separator nicht + + + + + Out Sensor hat Dauersignal + + + + + Überwachungszeit abgelaufen + + + + + Anzahl hintereinander fehlgeschlagener Vereinzelungsversuche + + +
+
+ UDT_HMI_SeparatorError + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.libinfo b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.libinfo new file mode 100644 index 0000000..c50ad99 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 86f8883d-433f-4543-98ce-b60a55b59c03 + Comment: + de-DE: 'Anwenderdatentyp für Separator ' +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: 'Anwenderdatentyp für Separator ' diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.libint b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.libint new file mode 100644 index 0000000..ac3c23d --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.libint @@ -0,0 +1,9 @@ +DocumentHash: + - FileName: UDT_HMI_SeparatorStatus.xml + Hash: RhSsYM0jJt43AM91A9fYj0HpX2pCUjoye+giGI3D1SY= +LibraryMetaFileHash: j0nFdJ3uO3NV4W7OIQRY0Ti+Jwdsvbk857Ke4lEZI14= +LibraryVersion: + Guid: dfc8b4c9-df23-466b-9ef8-77835fd74ff8 + DependsOn: + - TypeName: UDT_HMI_SeparatorError + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.xml b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.xml new file mode 100644 index 0000000..fa62cc5 --- /dev/null +++ b/2_ILSLib/UDT/Separator/UDT_HMI_SeparatorStatus.xml @@ -0,0 +1,99 @@ + + + + + + +
+ + + Status in Schrittkette / Zustandsmaschine + + + + + Separator Status | 0: zu | 1: offen + + + + + 0: Nicht verfügbar | 1: Verfügbar | 2: Error + + + + + Es befindet sich min. ein Bt im Separator + + + + + Part Sensor belegt + + + + + Nullbügelträger Sensor belegt + + + + + MiniTrolley Sensor belegt + + + + + Für Visu (z.B. farblich) + + + + + Fehler Separator + + + + + true + + + Anzahl hintereinander fehlgeschlagener Vereinzelungsversuche + + + + + Separator Öffnen/Schliessen Lebenszeit + + + + + Separator ist gesperrt + + +
+
+ UDT_HMI_SeparatorStatus + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Simu/stSimuJamConfig.libinfo b/2_ILSLib/UDT/Simu/stSimuJamConfig.libinfo new file mode 100644 index 0000000..50a4b86 --- /dev/null +++ b/2_ILSLib/UDT/Simu/stSimuJamConfig.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 09dc13df-4eb4-40b9-8f69-07fae8449920 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: initial diff --git a/2_ILSLib/UDT/Simu/stSimuJamConfig.libint b/2_ILSLib/UDT/Simu/stSimuJamConfig.libint new file mode 100644 index 0000000..91fdfc3 --- /dev/null +++ b/2_ILSLib/UDT/Simu/stSimuJamConfig.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stSimuJamConfig.xml + Hash: etrnXIMQjK05Akcvn99WXu8F167YvH8vjuHP1e56Ies= +LibraryMetaFileHash: tfC/oIg5mA506O5Z7+1EBhb1Z/YkMWIrb3VLFwV6aMI= +LibraryVersion: + Guid: 9c95005a-bc1a-478a-a4ce-272b58a3351f diff --git a/2_ILSLib/UDT/Simu/stSimuJamConfig.xml b/2_ILSLib/UDT/Simu/stSimuJamConfig.xml new file mode 100644 index 0000000..148ce4a --- /dev/null +++ b/2_ILSLib/UDT/Simu/stSimuJamConfig.xml @@ -0,0 +1,37 @@ + + + + + + +
+ +
+
+ stSimuJamConfig + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stJamConfig.libinfo b/2_ILSLib/UDT/Storage/stJamConfig.libinfo new file mode 100644 index 0000000..ab62738 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamConfig.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: 1ddce7e5-242b-4464-a0e7-b066a914b4f7 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Freigegeben für IBN (EY, 22.04.2025) diff --git a/2_ILSLib/UDT/Storage/stJamConfig.libint b/2_ILSLib/UDT/Storage/stJamConfig.libint new file mode 100644 index 0000000..d0af3ba --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamConfig.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stJamConfig.xml + Hash: Hr0YbNr+XjxiMM4RueU6k3DaZNEZuNGIZBlz2zeaP4Y= +LibraryMetaFileHash: T+Lu1ej6QQeVOVKYp7Cs9aUhK+y1wUda3Uw6Ki18a9A= +LibraryVersion: + Guid: d53d3312-8aec-491b-ab1a-cc6a44e0f5ce diff --git a/2_ILSLib/UDT/Storage/stJamConfig.xml b/2_ILSLib/UDT/Storage/stJamConfig.xml new file mode 100644 index 0000000..81a1f84 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamConfig.xml @@ -0,0 +1,46 @@ + + + + + + +
+ + + Maximale Kapazität + + + + + Eingestellte Kapazität + + +
+
+ stJamConfig + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stJamData.libinfo b/2_ILSLib/UDT/Storage/stJamData.libinfo new file mode 100644 index 0000000..9c04bed --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamData.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: e09ba931-ab24-4b18-8a43-afef3eeb1921 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Freigegeben für IBN (EY, 22.04.2025) diff --git a/2_ILSLib/UDT/Storage/stJamData.libint b/2_ILSLib/UDT/Storage/stJamData.libint new file mode 100644 index 0000000..e03e3b6 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamData.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: stJamData.xml + Hash: SogCObrsEUcm/e/gMDboM0Ng1GtyZL6utJ/r7msJXms= +LibraryMetaFileHash: WURtF1VFfplccv5yH4uKNUvfTN0E3vD0mn9L/DACzV8= +LibraryVersion: + Guid: 252760c3-1803-4302-8f47-dd828c2678b1 + DependsOn: + - TypeName: stJamStatus + VersionNumber: 2.0.0 + - TypeName: stJamConfig + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Storage/stJamData.xml b/2_ILSLib/UDT/Storage/stJamData.xml new file mode 100644 index 0000000..2a1a7d9 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamData.xml @@ -0,0 +1,52 @@ + + + + + + +
+ + + true + + + Infos + + + + + true + + + Parameter + + +
+
+ stJamData + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stJamStatus.libinfo b/2_ILSLib/UDT/Storage/stJamStatus.libinfo new file mode 100644 index 0000000..b5c54f9 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamStatus.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: e7f020f2-a247-4f5d-9690-9d9770f80f87 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Freigegeben für IBN (EY, 22.04.2025) diff --git a/2_ILSLib/UDT/Storage/stJamStatus.libint b/2_ILSLib/UDT/Storage/stJamStatus.libint new file mode 100644 index 0000000..ed2c2f4 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamStatus.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stJamStatus.xml + Hash: kZcczo1Pbpysol3X6hjBKm3aQ7LfbCq+vGsX8dGCd8E= +LibraryMetaFileHash: vfzcbrrm7xGjsQDs9zjMCRQq4yiSp1AlOxmahku73+U= +LibraryVersion: + Guid: 7c3c1e57-c31e-4152-893d-f265a4b6f222 diff --git a/2_ILSLib/UDT/Storage/stJamStatus.xml b/2_ILSLib/UDT/Storage/stJamStatus.xml new file mode 100644 index 0000000..b6114e4 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stJamStatus.xml @@ -0,0 +1,47 @@ + + + + + + +
+ + + Anzahl der Teile + + + + + %X0-Leer,%X1-JamSen,%X2-LockedEntr,%X3-LockedExit,%X4-Error + + 16#0 + +
+
+ stJamStatus + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stStorageConfig.libinfo b/2_ILSLib/UDT/Storage/stStorageConfig.libinfo new file mode 100644 index 0000000..ee8f115 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageConfig.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: 843394f5-9dc8-4d27-b12b-f45613d99a7d +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Freigegeben für IBN (EY, 22.04.2025) diff --git a/2_ILSLib/UDT/Storage/stStorageConfig.libint b/2_ILSLib/UDT/Storage/stStorageConfig.libint new file mode 100644 index 0000000..91e7c5d --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageConfig.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stStorageConfig.xml + Hash: xA+EI/DfcrV33TA4f/wbBNLg4p2KLqGyjldovj1fkMw= +LibraryMetaFileHash: Hzx9aokj9Aazwa9EJT56GnCrnuhm4qfs+D5ryW57geY= +LibraryVersion: + Guid: dd31f979-49ae-4241-9b52-2ebecdd977a2 diff --git a/2_ILSLib/UDT/Storage/stStorageConfig.xml b/2_ILSLib/UDT/Storage/stStorageConfig.xml new file mode 100644 index 0000000..dc52597 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageConfig.xml @@ -0,0 +1,77 @@ + + + + + + +
+ + + Maximale Kapazität + + 107 + + + + Eingestellte Kapazität + + + + + %X0-Locked,%X1-Reserved,%X2-FullCarrier,%X3-EmptyCarrier,%X4-MixedCarrier + + 16#0 + +
+
+ stStorageConfig + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stStorageData.libinfo b/2_ILSLib/UDT/Storage/stStorageData.libinfo new file mode 100644 index 0000000..c8263c4 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageData.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: fa2564d4-1a10-400a-918f-8624127faeb6 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Freigegeben für IBN (EY, 22.04.2025) diff --git a/2_ILSLib/UDT/Storage/stStorageData.libint b/2_ILSLib/UDT/Storage/stStorageData.libint new file mode 100644 index 0000000..f5f3e69 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageData.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: stStorageData.xml + Hash: Er/9/zUyHwGsn5ArT0STtzxgVWpnRkZJyGw/kH/oeY0= +LibraryMetaFileHash: h32sPUvLlk3Mw4xPMqCQzQ8obJ6/kBvDhIhER1PKrcY= +LibraryVersion: + Guid: 19e433b7-e839-4aab-95fc-f6902c197401 + DependsOn: + - TypeName: stStorageStatus + VersionNumber: 2.0.0 + - TypeName: stStorageConfig + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Storage/stStorageData.xml b/2_ILSLib/UDT/Storage/stStorageData.xml new file mode 100644 index 0000000..ccd7ce5 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageData.xml @@ -0,0 +1,76 @@ + + + + + + +
+ + + true + + + Infos + + + + + true + + + Parameter + + +
+
+ stStorageData + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stStorageLine.libinfo b/2_ILSLib/UDT/Storage/stStorageLine.libinfo new file mode 100644 index 0000000..8e9882b --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageLine.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: ec4fe52c-cf30-4e6b-a704-c8531a89da65 + Comment: + de-DE: initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: stCarrier angepasst diff --git a/2_ILSLib/UDT/Storage/stStorageLine.libint b/2_ILSLib/UDT/Storage/stStorageLine.libint new file mode 100644 index 0000000..4b07ccf --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageLine.libint @@ -0,0 +1,11 @@ +DocumentHash: + - FileName: stStorageLine.xml + Hash: d6kxZ/xAb4ykUHqGPJcLvpS+CSbb8cNp4gA3sDVtTio= +LibraryMetaFileHash: sIwWfEFTyZvbUkC7r7nfVr9bCN1HG0Tok9MwYUExM1Q= +LibraryVersion: + Guid: f59b5c77-3319-4499-843c-7e8a8da899b7 + DependsOn: + - TypeName: stCarrier + VersionNumber: 2.0.0 + - TypeName: stStorageData + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Storage/stStorageLine.xml b/2_ILSLib/UDT/Storage/stStorageLine.xml new file mode 100644 index 0000000..8ff251d --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageLine.xml @@ -0,0 +1,86 @@ + + + + + + +
+ + + gelagerte Carrier + + + + + true + + + Daten der Linie + + +
+ + +
+ + 107 + +
+
+
+
+
+
+
+
+ stStorageLine + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Storage/stStorageStatus.libinfo b/2_ILSLib/UDT/Storage/stStorageStatus.libinfo new file mode 100644 index 0000000..6dd3aff --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageStatus.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: ca24b447-abc3-449b-a8c1-21dbe238f0e7 +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Freigegeben für IBN (EY, 22.04.2025) diff --git a/2_ILSLib/UDT/Storage/stStorageStatus.libint b/2_ILSLib/UDT/Storage/stStorageStatus.libint new file mode 100644 index 0000000..33179d3 --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageStatus.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: stStorageStatus.xml + Hash: e0rX4SU5JRTTtYGeFaTonWg0PXotQ5NjeUl/GaafoBs= +LibraryMetaFileHash: +E5UyU/vFeC1k/xW6qx/hr0ncpxs5Wm5Y/lhGdZ5+Cg= +LibraryVersion: + Guid: b386d0be-b2b8-4929-a80b-8269a33c5ffc diff --git a/2_ILSLib/UDT/Storage/stStorageStatus.xml b/2_ILSLib/UDT/Storage/stStorageStatus.xml new file mode 100644 index 0000000..f495bff --- /dev/null +++ b/2_ILSLib/UDT/Storage/stStorageStatus.xml @@ -0,0 +1,47 @@ + + + + + + +
+ + + Anzahl der Teile + + + + + %X0-Empty,%X1-JamSen,%X2-LockedEntr,%X3-LockedExit,%X4-Error + + 16#0 + +
+
+ stStorageStatus + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Switch/IntfSwitch.libinfo b/2_ILSLib/UDT/Switch/IntfSwitch.libinfo new file mode 100644 index 0000000..782b3ba --- /dev/null +++ b/2_ILSLib/UDT/Switch/IntfSwitch.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 8a5e89a8-ccaf-4a9c-a733-f8d2084da0f6 + Comment: + de-DE: 'CHANGED: übersetzt' +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/UDT/Switch/IntfSwitch.libint b/2_ILSLib/UDT/Switch/IntfSwitch.libint new file mode 100644 index 0000000..17b8644 --- /dev/null +++ b/2_ILSLib/UDT/Switch/IntfSwitch.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: IntfSwitch.xml + Hash: 9ZFHajtUBbzqwil68Oc/nHXHsqQHHPX49FpEGJ79V3Q= +LibraryMetaFileHash: xpltmdyDJxORT6uLJRpj2I+bt3ZEN/GuHMXmWKHwa0w= +LibraryVersion: + Guid: 88616827-870a-4dfa-a549-e50acd9b24e5 diff --git a/2_ILSLib/UDT/Switch/IntfSwitch.xml b/2_ILSLib/UDT/Switch/IntfSwitch.xml new file mode 100644 index 0000000..dc9286a --- /dev/null +++ b/2_ILSLib/UDT/Switch/IntfSwitch.xml @@ -0,0 +1,106 @@ + + + + + + +
+ + + Zählt fortlaufend die Trolleys am Ausgang 3 + + + + + Zählt fortlaufend die Trolleys am Ausgang 4 + + + + + 0: Aus wegen MainState | 5: Aus wegen EStop | 10: Initialisiere | 15: Warte auf Anforderung durch MainTRO | 20: Warte auf Motor | 25: Schalte Weiche | 30: Geschalten, Zustand nicht bestätigt | 35: Geschalten, Zustand bestätigt | 40: Fehler + + + + + Muss noch definiert werden + + + + + 0: Eingangsweiche geht auf Eingang 1 | 1: Eingangsweiche geht auf Eingang 2 + + + + + 0: Ausgangsweiche geht auf Ausgang 3 | 1: Ausgangsweiche geht auf Ausgang 4 + + + + + Ausgangssensor 3 meldet Stau/Dauerbelegung + + + + + Ausgangssensor 4 meldet Stau/Dauerbelegung + + + + + + + + +
+
+ IntfSwitch + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Switch/S2MSwitch.libinfo b/2_ILSLib/UDT/Switch/S2MSwitch.libinfo new file mode 100644 index 0000000..72d2eb0 --- /dev/null +++ b/2_ILSLib/UDT/Switch/S2MSwitch.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: c3123c93-54bd-4570-b464-beb88c7c672e + Comment: + de-DE: 'CHANGED: übersetzt' +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/UDT/Switch/S2MSwitch.libint b/2_ILSLib/UDT/Switch/S2MSwitch.libint new file mode 100644 index 0000000..ab08758 --- /dev/null +++ b/2_ILSLib/UDT/Switch/S2MSwitch.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: S2MSwitch.xml + Hash: oBuEjLKhD2wRjGPCHbUI4QrgqBIiokEIg8JTRHmPHtY= +LibraryMetaFileHash: 9z43Gs53aPSWeCl02wU78IaPm5jg80TzAW++O9tkDrs= +LibraryVersion: + Guid: b62f2f76-ed11-4659-9833-ccaf2f344fd2 diff --git a/2_ILSLib/UDT/Switch/S2MSwitch.xml b/2_ILSLib/UDT/Switch/S2MSwitch.xml new file mode 100644 index 0000000..a1d1130 --- /dev/null +++ b/2_ILSLib/UDT/Switch/S2MSwitch.xml @@ -0,0 +1,152 @@ + + + + + + +
+ + + Bit 0: Einstellung der eingehenden Weiche | 0: Durchfahrtrichtung links | 1: Durchfahrtrichtung rechts + + + + + Bit 1: Einstellung der ausgehenden Weiche | 0: Durchfahrtrichtung links | 1: Durchfahrtrichtung rechts + + + + + Bit 2: Es befindet sich min. ein Trolley in der Weiche (wird vllt. nicht benötigt) + + + + + Bit 3: Weiche ist bereit zum Trolley transportieren + + + + + Bit 4: Fehlerbit + + false + + + + Bit 5: Der BT verlässt die Weiche nicht. Bitte prüfen Sie den Separator und den Weichenbereich. + + false + + + + Bit 6: Sensor Ausgang 3 belegt + + false + + + + Bit 7: Sensor Ausgang 4 belegt + + false + + + + Bit 8: Exit 3 Signal minimal länger als normal + + false + + + + Bit 9: Exit 4 Signal minimal länger als normal + + false + + + + Bit 10: Exit 3 Signal deutlich länger als normal + + false + + + + Bit 11: Exit 4 Signal deutlich länger als normal + + false + + + + Bit 12: Sensor-Signal zu früh + + false + + + + Bit 13: Am Ausgangssensor der Weiche wurde ein Dauersignal erkannt. Bitte prüfen Sie den Ausgangssensor. + + false + + + + Reserve + + false + + + + Reserve + + false + +
+
+ S2MSwitch + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Switch/SettingsSwitch.libinfo b/2_ILSLib/UDT/Switch/SettingsSwitch.libinfo new file mode 100644 index 0000000..05850cb --- /dev/null +++ b/2_ILSLib/UDT/Switch/SettingsSwitch.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: b987a8e1-c731-454f-8aef-c7a57cfd0be8 + Comment: + de-DE: 'CHANGED: übersetzt' +LibraryVersion: + VersionNumber: 2.0.0 + Author: t.molina + IsDefault: true + Comment: + de-DE: 'CHANGED: übersetzt' diff --git a/2_ILSLib/UDT/Switch/SettingsSwitch.libint b/2_ILSLib/UDT/Switch/SettingsSwitch.libint new file mode 100644 index 0000000..d237570 --- /dev/null +++ b/2_ILSLib/UDT/Switch/SettingsSwitch.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: SettingsSwitch.xml + Hash: jiY21qh5PgdLgxW6i4vkW6NrKrbdEmCzCO37E8mhRnY= +LibraryMetaFileHash: jgapWKgpw+CKgYhrQCYEpylzdrISIe9Jp8DT1KcSYf8= +LibraryVersion: + Guid: 594ad732-b8d7-4688-b883-1436e5f7c5eb diff --git a/2_ILSLib/UDT/Switch/SettingsSwitch.xml b/2_ILSLib/UDT/Switch/SettingsSwitch.xml new file mode 100644 index 0000000..dc31d3d --- /dev/null +++ b/2_ILSLib/UDT/Switch/SettingsSwitch.xml @@ -0,0 +1,140 @@ + + + + + + +
+ + + Zeit, wie lange es dauert bis gemeldet wird dass BT am Ausgang nicht ankommt + + T#10s + + + + Sensor erfasst nach Delay ein LongSignal, tSenLong entspr. Min.-Zeit welche zu diesem Delay addiert wird + + T#0s + + + + Sensor erfasst nach Delay ein LongSignal, tSenVeryLong entspr. sehr hoher Zeit welche zu diesem Delay addiert wird + + T#1000ms + + + + Wartezeit nach selbstquittierenden Longsignal + + T#2000ms + + + + Zeit wie lange der Switch das Steuer-Signal bekommt + + T#1000ms + + + + Out To One Destinations 0..4 (klären was ist was) + + + + + Nummer des Switch + + + + + Nummer des Carousels ab Ausgang 3 + + + + + Nummer des Carousels ab Ausgang 4 + + + + + Exit Sensor Long Signal Check 3 + + + + + Exit Sensor Long Signal Check 4 + + + + + ExSen3 ist angeschlossen + + + + + ExSen4 ist angeschlossen + + + + + Ist es ein "neuer" Switch? | 0: nein | 1: ja + + + + + Weiche ist fest und muss nicht Confirmed werden + + +
+
+ SettingsSwitch + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/TRO/UDT_HMI_TRO.libinfo b/2_ILSLib/UDT/TRO/UDT_HMI_TRO.libinfo new file mode 100644 index 0000000..30d8e6e --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_HMI_TRO.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: ef43cebe-2a8c-4da7-88df-8b7957091968 + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept +LibraryVersion: + VersionNumber: 2.0.4 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept diff --git a/2_ILSLib/UDT/TRO/UDT_HMI_TRO.libint b/2_ILSLib/UDT/TRO/UDT_HMI_TRO.libint new file mode 100644 index 0000000..b90963f --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_HMI_TRO.libint @@ -0,0 +1,21 @@ +DocumentHash: + - FileName: UDT_HMI_TRO.xml + Hash: LocLk7ouJ+oqjgrcTQBVlcrul/t/soRQZO8K72ePOZw= +LibraryMetaFileHash: dXMdWndMls0FIO4iYAcMY3lEnpLwPnTE/t69h7vg2ns= +LibraryVersion: + Guid: f233daa7-f3c9-4c51-848f-9442d6da7a88 + DependsOn: + - TypeName: UDT_HMI_Separator + VersionNumber: 2.0.0 + - TypeName: UDT_BarcodeReader + VersionNumber: 2.0.1 + - TypeName: UDT_TROCtrl + VersionNumber: 2.0.0 + - TypeName: UDT_TROState + VersionNumber: 2.0.1 + - TypeName: UDT_UnloadingStation + VersionNumber: 0.0.6 + - TypeName: UDT_TROConfig + VersionNumber: 2.0.0 + - TypeName: UDT_Vario + VersionNumber: 2.0.1 diff --git a/2_ILSLib/UDT/TRO/UDT_HMI_TRO.xml b/2_ILSLib/UDT/TRO/UDT_HMI_TRO.xml new file mode 100644 index 0000000..01d6e25 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_HMI_TRO.xml @@ -0,0 +1,193 @@ + + + + + + +
+ + + Konfiguration + + + + + Control + + + + + Status + + + + + Separator 1 + + + + + Separator 2 + + + + + Switch 1 + + + + + Switch 2 + + + + + Barcode-Reader 1 + + + + + Barcode-Reader 2 + + + + + Vario 1 + + +
+ + + Status + + + + + Förderer Interface Standard + + + + + Konfiguration + + + + + Control + + + + + Positioniert den Förderer + + + + + Stausensor + + + + + Letze Position erreicht + + +
+
+
+ + + Vario 1 + + +
+ + + Status + + + + + Förderer Interface Standard + + + + + Konfiguration + + + + + Control + + + + + Positioniert den Förderer + + + + + Stausensor + + + + + Letze Position erreicht + + +
+
+
+
+
+ UDT_HMI_TRO + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.libinfo b/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.libinfo new file mode 100644 index 0000000..5df3457 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.libinfo @@ -0,0 +1,6 @@ +LibraryType: + Guid: 3beb59d7-e33d-4360-b089-7c47be0d5c13 +LibraryVersion: + VersionNumber: 2.0.2 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.libint b/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.libint new file mode 100644 index 0000000..f5afad6 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.libint @@ -0,0 +1,19 @@ +DocumentHash: + - FileName: UDT_HMI_TRO_PinStore.xml + Hash: QX3moSxZexa0m0oEe1QKiqltUlXjqhc/lDpI9sgDlHQ= +LibraryMetaFileHash: h2Q9kQy4KayoRubs9s/K04fqUx+5VXK4ySsfguxjdWI= +LibraryVersion: + Guid: 845f29a7-ee05-441a-8c1d-fb0c4a72301a + DependsOn: + - TypeName: UDT_HMI_Separator + VersionNumber: 2.0.0 + - TypeName: UDT_UnloadingStation + VersionNumber: 0.0.6 + - TypeName: UDT_TROCtrl + VersionNumber: 2.0.0 + - TypeName: UDT_TROState + VersionNumber: 2.0.1 + - TypeName: UDT_TROConfig + VersionNumber: 2.0.0 + - TypeName: UDT_BarcodeReader + VersionNumber: 2.0.1 diff --git a/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.xml b/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.xml new file mode 100644 index 0000000..c8f5f4e --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_HMI_TRO_PinStore.xml @@ -0,0 +1,307 @@ + + + + + + +
+ + + true + + + + + TRO Control TODO + + + + + TRO Status TODO + + + + + true + + + Separator TRO Einfahrt + + + + + Separator Linie 1 + + + + + Separator Linie 2 + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + Separator Linie 21 + + + + + true + + + Abwurf 1 + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + Abwurf 21 + + + + + true + + +
+
+ UDT_HMI_TRO_PinStore + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/TRO/UDT_TROConfig.libinfo b/2_ILSLib/UDT/TRO/UDT_TROConfig.libinfo new file mode 100644 index 0000000..d9a5463 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROConfig.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 81115fd3-a033-4d1e-9ef0-41d839b84581 + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept diff --git a/2_ILSLib/UDT/TRO/UDT_TROConfig.libint b/2_ILSLib/UDT/TRO/UDT_TROConfig.libint new file mode 100644 index 0000000..efbc8fe --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROConfig.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_TROConfig.xml + Hash: 2zQxJrqtHQSbhwAnCTqI4vzcw07XkEPpgS/1/0lhIFo= +LibraryMetaFileHash: gJb7jZaJgSJDbiDAv9q/L3oSh6KNqO4A3JdLWFb/Fvw= +LibraryVersion: + Guid: b35a49c0-95d8-4cb2-82c8-4bfaccf74f0b diff --git a/2_ILSLib/UDT/TRO/UDT_TROConfig.xml b/2_ILSLib/UDT/TRO/UDT_TROConfig.xml new file mode 100644 index 0000000..30a1123 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROConfig.xml @@ -0,0 +1,71 @@ + + + + + + +
+ + + (0: Unbekannt, 1: 1Sep, 2: 1Sep1Switch, 3: 1Sep2Switch, 4: 2Sep1Switch, 5: Vario, 6: PinStore...) + + + + + TRO Name + + 'TROXXX' + +
+
+ UDT_TROConfig + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/TRO/UDT_TROCtrl.libinfo b/2_ILSLib/UDT/TRO/UDT_TROCtrl.libinfo new file mode 100644 index 0000000..223cd42 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROCtrl.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 0aa56e8c-afed-4343-a462-60d83cbdddb9 + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept diff --git a/2_ILSLib/UDT/TRO/UDT_TROCtrl.libint b/2_ILSLib/UDT/TRO/UDT_TROCtrl.libint new file mode 100644 index 0000000..8042c7b --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROCtrl.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_TROCtrl.xml + Hash: p2j22YgO6J3d/pgi0lEsh19QwDOfL8tzcC/1nWnA7FQ= +LibraryMetaFileHash: uMfcxKlKj+LY3NptC5u5TGeLrbQVgzlh7ASAla6932c= +LibraryVersion: + Guid: 29b196f7-9ed6-4672-aaba-212f20cd63de diff --git a/2_ILSLib/UDT/TRO/UDT_TROCtrl.xml b/2_ILSLib/UDT/TRO/UDT_TROCtrl.xml new file mode 100644 index 0000000..10c542f --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROCtrl.xml @@ -0,0 +1,75 @@ + + + + + + +
+ + + TRO rücksetzen + + + + + TRO anhalten + + + + + TRO Fehler quittieren + + +
+
+ UDT_TROCtrl + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/TRO/UDT_TROState.libinfo b/2_ILSLib/UDT/TRO/UDT_TROState.libinfo new file mode 100644 index 0000000..d0519d4 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROState.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 65033815-61c9-4fc1-9c62-4a635fbbcbc2 + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept +LibraryVersion: + VersionNumber: 2.0.1 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: HMI Datentyp angepasst gemäß aktuellem Konzept diff --git a/2_ILSLib/UDT/TRO/UDT_TROState.libint b/2_ILSLib/UDT/TRO/UDT_TROState.libint new file mode 100644 index 0000000..82096b8 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROState.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_TROState.xml + Hash: hlWOzYe2yvfFNY2lO7S/t1nKy+TVyrDKYxrkVzJZj9g= +LibraryMetaFileHash: Gll3CWtfo8xflaMLip1cE4I9HD8GnkFBSiMRCJvSV0E= +LibraryVersion: + Guid: 8542fb20-c1df-4944-9f28-bc8bed0abdc5 diff --git a/2_ILSLib/UDT/TRO/UDT_TROState.xml b/2_ILSLib/UDT/TRO/UDT_TROState.xml new file mode 100644 index 0000000..3c04ca1 --- /dev/null +++ b/2_ILSLib/UDT/TRO/UDT_TROState.xml @@ -0,0 +1,76 @@ + + + + + + +
+ + + Schrittkette + + + + + + TRO hat mind. einen Fehler (Sammelbit), z.B. für rote Anzeige am HMI + + + + + Unterlagerter TRO hat einen Fehler (z.B. Separator, Weiche...) + + +
+
+ UDT_TROState + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Vario/SettingsVario.libinfo b/2_ILSLib/UDT/Vario/SettingsVario.libinfo new file mode 100644 index 0000000..7ba8bf3 --- /dev/null +++ b/2_ILSLib/UDT/Vario/SettingsVario.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: f264aab0-1862-4125-b62f-509a81d1119d + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.5 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/Vario/SettingsVario.libint b/2_ILSLib/UDT/Vario/SettingsVario.libint new file mode 100644 index 0000000..2a85217 --- /dev/null +++ b/2_ILSLib/UDT/Vario/SettingsVario.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: SettingsVario.xml + Hash: KueMVpzB65E3ImmOOw5TB8TFkHLM+QT0Z2sAjyOm0pw= +LibraryMetaFileHash: Zej6DQF3Mhx0u43G0EZ1Fv7dxDf6imYBAccjY+nNtQU= +LibraryVersion: + Guid: 7f0024cb-17d0-4a97-88be-c6a1c812ecbd diff --git a/2_ILSLib/UDT/Vario/SettingsVario.xml b/2_ILSLib/UDT/Vario/SettingsVario.xml new file mode 100644 index 0000000..79fb5cf --- /dev/null +++ b/2_ILSLib/UDT/Vario/SettingsVario.xml @@ -0,0 +1,147 @@ + + + + + + +
+ + + true + + T#500ms + + + + true + + T#0ms + + + + Zeit wie lange nächster Sep frei ist damit Vario entleert + + T#100ms + + + + Zeit wie lange Carrier in Position Sensor belegt sein muss + + T#1200ms + + + + Zeit wie lange JamSen frei ist damit Vario entleert + + T#4s + + + + Zeit für LastPosSen (so lange werden Mehrfachflanken ignoriert) + + T#250ms + + + T#50ms + + + T#1500ms + + + T#1500ms + + + + Zeit für Leerfahren + + T#10s + + + + true + + 1 + + + + true + + false + + + + Langes Gefälle + + + + false + + + + Aktivierung: Delay-Zeit bis Stau nach Vario erkannt + + + + + Delay-Zeit bis Stau nach Vario erkannt + + T#2s + + + T#5s + + + +
+
+ SettingsVario + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.libinfo b/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.libinfo new file mode 100644 index 0000000..d7a8196 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 6dc43587-53cd-4590-bf75-c379c9999bb5 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.libint b/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.libint new file mode 100644 index 0000000..19c8371 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_SettingsVarioFingerMonitoring.xml + Hash: Y7N9FEwygnFxhhnOl8Jtvw+GdICEYcW1Ck7enUQgjPI= +LibraryMetaFileHash: lqDyCiTfbChK8QH0gMS6xFwcAtrDrny3fKsK444B2MI= +LibraryVersion: + Guid: b8bd3d69-0f56-4726-85de-e4f319ab8fda diff --git a/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.xml b/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.xml new file mode 100644 index 0000000..44d3aaa --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_SettingsVarioFingerMonitoring.xml @@ -0,0 +1,59 @@ + + + + + + +
+ + + Überwachung aktivieren + + true + + + + Verzögerung Förderer Anlauf + + + + + Zeit bis Überwachung für High-Signal anschlägt + + T#800ms + + + + Zeit bis Überwachung für Low-Signal anschlägt + + T#800ms + +
+
+ UDT_SettingsVarioFingerMonitoring + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Vario/UDT_Vario.libinfo b/2_ILSLib/UDT/Vario/UDT_Vario.libinfo new file mode 100644 index 0000000..c220ca1 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario.libinfo @@ -0,0 +1,8 @@ +LibraryType: + Guid: bfb39b7e-4084-4427-a1bc-c6e73fd0956d + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.1 + Author: e.yueksel + IsDefault: true diff --git a/2_ILSLib/UDT/Vario/UDT_Vario.libint b/2_ILSLib/UDT/Vario/UDT_Vario.libint new file mode 100644 index 0000000..1df43d9 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario.libint @@ -0,0 +1,17 @@ +DocumentHash: + - FileName: UDT_Vario.xml + Hash: PX77bmzjMmCeRaWUdpSY9D1nDk4QxscRPIFy0HB4jSo= +LibraryMetaFileHash: 4Ip5EMSewn5MBokvSQefffd5A25EISCjhxh9mGT5oUQ= +LibraryVersion: + Guid: e5da11d7-315b-4260-aa84-5d7366ea5a96 + DependsOn: + - TypeName: UDT_Vario_Status + VersionNumber: 2.0.0 + - TypeName: UDT_Vario_Config + VersionNumber: 2.0.0 + - TypeName: UDT_Vario_Control + VersionNumber: 2.0.0 + - TypeName: UDT_Conveyor + VersionNumber: 0.0.15 + - TypeName: UDT_Sensor + VersionNumber: 2.0.0 diff --git a/2_ILSLib/UDT/Vario/UDT_Vario.xml b/2_ILSLib/UDT/Vario/UDT_Vario.xml new file mode 100644 index 0000000..5a1a3c8 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario.xml @@ -0,0 +1,91 @@ + + + + + + +
+ + + true + + + + + true + + + + + true + + + + + true + + + + + + true + + + + + true + + +
+
+ UDT_Vario + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Config.libinfo b/2_ILSLib/UDT/Vario/UDT_Vario_Config.libinfo new file mode 100644 index 0000000..fb90e0b --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Config.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 18f99447-56a8-47ed-ada8-26d8690d4156 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Config.libint b/2_ILSLib/UDT/Vario/UDT_Vario_Config.libint new file mode 100644 index 0000000..9119f7e --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Config.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_Vario_Config.xml + Hash: y/VbPSxr03JLMD+03SHsINzc0Hj9woq+TfeW6L8JX50= +LibraryMetaFileHash: nKuRkpwDUSeTuZoe+teg9hozsVqkwPdvDL0hT0BzNLU= +LibraryVersion: + Guid: d63c4a33-def0-485c-b063-5612c8cfbfd6 diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Config.xml b/2_ILSLib/UDT/Vario/UDT_Vario_Config.xml new file mode 100644 index 0000000..d1a33ae --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Config.xml @@ -0,0 +1,41 @@ + + + + + + +
+ + + + + +
+
+ UDT_Vario_Config + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Control.libinfo b/2_ILSLib/UDT/Vario/UDT_Vario_Control.libinfo new file mode 100644 index 0000000..9a5d432 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Control.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: 44e87796-3e1b-411a-90d9-fd8646985fa8 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Control.libint b/2_ILSLib/UDT/Vario/UDT_Vario_Control.libint new file mode 100644 index 0000000..04caee0 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Control.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_Vario_Control.xml + Hash: PhYtGj+ABWBY90nYYneByzkE8uptZUsOxR70pEOXsAY= +LibraryMetaFileHash: GDa+g4sjbDz2TUuTzeqFgavHLlTkWNu+d8mGDhKzsfU= +LibraryVersion: + Guid: f93abcca-8010-4685-9e9d-314a45d61c46 diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Control.xml b/2_ILSLib/UDT/Vario/UDT_Vario_Control.xml new file mode 100644 index 0000000..3cff0c6 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Control.xml @@ -0,0 +1,65 @@ + + + + + + +
+ + + Testmodus aktivieren + + +
+
+ UDT_Vario_Control + +
+ + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + + + + + de-DE + + + + + + en-US + + + + + + cs-CZ + + + + + + +
+
\ No newline at end of file diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Status.libinfo b/2_ILSLib/UDT/Vario/UDT_Vario_Status.libinfo new file mode 100644 index 0000000..e3c4109 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Status.libinfo @@ -0,0 +1,10 @@ +LibraryType: + Guid: a65ddd12-dbf3-4d75-b457-97518258b198 + Comment: + de-DE: Initial +LibraryVersion: + VersionNumber: 2.0.0 + Author: e.yueksel + IsDefault: true + Comment: + de-DE: Initial diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Status.libint b/2_ILSLib/UDT/Vario/UDT_Vario_Status.libint new file mode 100644 index 0000000..3b9f3d7 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Status.libint @@ -0,0 +1,6 @@ +DocumentHash: + - FileName: UDT_Vario_Status.xml + Hash: DC0HT5CCRmh5zVdkV84c/bK5UYVqfT9ZoZCvNU8htKU= +LibraryMetaFileHash: 4FJ5JH9GGRdO5aBuVuIkFtGgUWDobxxPk6eksMlHhdo= +LibraryVersion: + Guid: 4d9adf77-28b8-4879-979e-12eadb52a01f diff --git a/2_ILSLib/UDT/Vario/UDT_Vario_Status.xml b/2_ILSLib/UDT/Vario/UDT_Vario_Status.xml new file mode 100644 index 0000000..a188006 --- /dev/null +++ b/2_ILSLib/UDT/Vario/UDT_Vario_Status.xml @@ -0,0 +1,38 @@ + + + + + + +
+ + +
+
+ UDT_Vario_Status + +
+ + + + + + de-DE + + + + + + + + + + de-DE + + + + + + +
+
\ No newline at end of file