FUNCTION_BLOCK "FB_Main_skel_UH01"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
// ============================================================
// AUTOMATISCH GENERIERTES GRUNDGERUEST — create_skel.py
// Quelle: E/A-Listen UH01 (data/)
// TODO-Marken kennzeichnen manuell zu ergaenzende Stellen
// (Timings, Topologie/JamAreas, Safety, Release, Priority).
// ============================================================
   VAR
      TRO101 : "FB_ILS_MTRO_Vario";   // CV-M0100
      TRO102 : "FB_ILS_MTRO_1Sep";   // KR-M0101 / LS2
      TRO103 : "FB_ILS_MTRO_1Sep1Swi";   // KR-M0102
      TRO104 : "FB_ILS_MTRO_Vario";   // CV-M0103
      fbConveyor0105 : "FB_Conveyor";   // CV-M0105
      TRO106 : "FB_ILS_MTRO_Vario";   // CV-M0106
      TRO107 : "FB_ILS_MTRO_Vario";   // CV-M0107
      fbConveyor0109 : "FB_Conveyor";   // CV-M0109
      TRO109 : "FB_ILS_MTRO_Vario";   // CV-M0110
      fbConveyor4103 : "FB_Conveyor";   // CV-M4103
      TRO111 : "FB_ILS_MTRO_Vario";   // CV-M4103_A
      fbConveyor4103_B : "FB_Conveyor";   // CV-M4103_B
      TRO113 : "FB_ILS_MTRO_Vario";   // CV-M4104
      TRO114 : "FB_ILS_MTRO_1Sep";   // CV-M4203
      TRO115 : "FB_ILS_MTRO_Vario";   // CV-M4203_A
      fbConveyor4203_B : "FB_Conveyor";   // CV-M4203_B
      TRO117 : "FB_ILS_MTRO_1Sep1Swi";   // KR-M4204
      TRO118 : "FB_ILS_MTRO_1Sep";   // CV-M4302
      TRO119 : "FB_ILS_MTRO_Vario";   // CV-M4302_A
      TRO120 : "FB_ILS_MTRO_Vario";   // CV-M4302_B
      fbConveyor4402_A : "FB_Conveyor";   // CV-M4402_A
      TRO122 : "FB_ILS_MTRO_Vario";   // CV-M4402_B
      TRO123 : "FB_ILS_MTRO_Vario";   // CV-M4403
      TRO124 : "FB_ILS_MTRO_Vario";   // CV-M4501
      TRO125 : "FB_ILS_MTRO_Vario";   // CV-M4502
      TRO126 : "FB_ILS_MTRO_Vario";   // CV-M4503
      fbConveyorM0103 : "FB_Conveyor";   // CV-PM0103
   END_VAR

BEGIN
    REGION TRO101 (Vario) — CV-M0100
        #TRO101.stInSeparator1.Settings.nSeparatorNo := "cSep101.1";
        #TRO101.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO101.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3242"];
        #TRO101.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3292"];
        #TRO101.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3291"];
        #TRO101.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3241"];

        #TRO101(nInMainTroNo := "cMainTro101",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea101".stJam101_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea101".stJam101_1.stData,
                arInOutJamFinger := "DB_JamArea101".stJam101_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3290",
                xOutVarioMotor => "MA0057",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro101"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO101);
    END_REGION

    REGION TRO102 (1Sep) — KR-M0101 / LS2
        #TRO102.stInSeparator1.Settings.nSeparatorNo := "cSep102.1";
        #TRO102.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO102.stInSeparator1.Settings.tTrailingTime := T#500ms;      // TODO Timing
        #TRO102.stInSeparator1.Settings.tHandlingTime := T#200ms;      // TODO Timing
        #TRO102.stInSeparator1.Settings.tJam := "TimeForSepJam";
        #TRO102.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3246"];
        #TRO102.stInSenJam2 := "DB_Inputs".Sensors["cInBGxxxx"];

        #TRO102.stInPriorityManager.xReleaseOk := TRUE;                // TODO Priority

        #TRO102(nInMainTroNo := "cMainTro102",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInCarouselRun := TRUE,                                // TODO Conveyor
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea102".stJam102_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea102".stJam102_1.stData,
                arInOutJamExit2 := "DB_JamArea102".stJam102_2.arCarrier,   // TODO Topologie
                stInOutJamExit2 := "DB_JamArea102".stJam102_2.stData,
                xOutStopper1 => "MB3246",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro102"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO102);
    END_REGION

    REGION TRO103 (1Sep1Swi) — KR-M0102
        #TRO103.stInSeparator1.Settings.nSeparatorNo := "cSep103.1";
        #TRO103.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO103.stInSeparator1.Settings.tTrailingTime := T#100ms;      // TODO Timing
        #TRO103.stInSeparator1.Settings.tHandlingTime := T#50ms;       // TODO Timing
        #TRO103.stInSeparator1.Settings.tJam := "TimeForSepJam";
        #TRO103.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3300"];
        #TRO103.stInSenJam2 := "DB_Inputs".Sensors["cInBG3304"];
        #TRO103.stInSwitch1.Settings.nSwitchNo := "cSwi103.1";

        #TRO103(nInMainTroNo := "cMainTro103",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInCarouselRun1 := TRUE,                               // TODO Conveyor
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea103".stJam103_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea103".stJam103_1.stData,
                arInOutJamExit2 := "DB_JamArea103".stJam103_2.arCarrier,   // TODO Topologie (Dir1)
                stInOutJamExit2 := "DB_JamArea103".stJam103_2.stData,
                arInOutJamExit3 := "DB_JamArea103".stJam103_3.arCarrier,   // TODO Topologie (Dir2)
                stInOutJamExit3 := "DB_JamArea103".stJam103_3.stData,
                xOutStopper1 => "MB3300",
                xOutSw1ExTo3 => "MB3304",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro103"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO103);
    END_REGION

    REGION TRO104 (Vario) — CV-M0103
        #TRO104.stInSeparator1.Settings.nSeparatorNo := "cSep104.1";
        #TRO104.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO104.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3271"];
        #TRO104.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3272"];
        #TRO104.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3270"];
        #TRO104.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3305"];

        #TRO104(nInMainTroNo := "cMainTro104",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea104".stJam104_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea104".stJam104_1.stData,
                arInOutJamFinger := "DB_JamArea104".stJam104_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3271",
                xOutVarioMotor => "MAxxxx",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro104"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO104);
    END_REGION

    REGION fbConveyor0105 — CV-M0105
        #fbConveyor0105.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyor0105.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyor0105.Settings.sMotorProtectName := 'FC0063';

        #fbConveyor0105(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FC0063",
                xInPowerContactor := "MAxxxx",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyor0105);
    END_REGION

    REGION TRO106 (Vario) — CV-M0106
        #TRO106.stInSeparator1.Settings.nSeparatorNo := "cSep106.1";
        #TRO106.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO106.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO106.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO106.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3273"];
        #TRO106.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3276"];

        #TRO106(nInMainTroNo := "cMainTro106",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea106".stJam106_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea106".stJam106_1.stData,
                arInOutJamFinger := "DB_JamArea106".stJam106_2.arCarrier,  // TODO Topologie
                xOutStopper => "MBxxxx",
                xOutVarioMotor => "MA0064",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro106"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO106);
    END_REGION

    REGION TRO107 (Vario) — CV-M0107
        #TRO107.stInSeparator1.Settings.nSeparatorNo := "cSep107.1";
        #TRO107.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO107.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3283"];
        #TRO107.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3282"];
        #TRO107.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3284"];
        #TRO107.stInVario.stSenJam := "DB_Inputs".Sensors["cInBGxxxx"];

        #TRO107(nInMainTroNo := "cMainTro107",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea107".stJam107_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea107".stJam107_1.stData,
                arInOutJamFinger := "DB_JamArea107".stJam107_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3283",
                xOutVarioMotor => "MA0065",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro107"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO107);
    END_REGION

    REGION fbConveyor0109 — CV-M0109
        #fbConveyor0109.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyor0109.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyor0109.Settings.sMotorProtectName := 'FC0066';

        #fbConveyor0109(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FC0066",
                xInPowerContactor := "MAxxxx",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyor0109);
    END_REGION

    REGION TRO109 (Vario) — CV-M0110
        #TRO109.stInSeparator1.Settings.nSeparatorNo := "cSep109.1";
        #TRO109.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO109.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO109.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO109.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3285"];
        #TRO109.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3294"];

        #TRO109(nInMainTroNo := "cMainTro109",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea109".stJam109_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea109".stJam109_1.stData,
                arInOutJamFinger := "DB_JamArea109".stJam109_2.arCarrier,  // TODO Topologie
                xOutStopper => "MBxxxx",
                xOutVarioMotor => "MA0067",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro109"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO109);
    END_REGION

    REGION fbConveyor4103 — CV-M4103
        #fbConveyor4103.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyor4103.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyor4103.Settings.sMotorProtectName := 'FC0146';

        #fbConveyor4103(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FC0146",
                xInPowerContactor := "MAxxxx",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyor4103);
    END_REGION

    REGION TRO111 (Vario) — CV-M4103_A
        #TRO111.stInSeparator1.Settings.nSeparatorNo := "cSep111.1";
        #TRO111.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO111.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3003"];
        #TRO111.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3004"];
        #TRO111.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3002"];
        #TRO111.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3005"];

        #TRO111(nInMainTroNo := "cMainTro111",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea111".stJam111_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea111".stJam111_1.stData,
                arInOutJamFinger := "DB_JamArea111".stJam111_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3003",
                xOutVarioMotor => "MA0146",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro111"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO111);
    END_REGION

    REGION fbConveyor4103_B — CV-M4103_B
        #fbConveyor4103_B.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyor4103_B.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyor4103_B.Settings.sMotorProtectName := 'FC0152';

        #fbConveyor4103_B(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FC0152",
                xInPowerContactor := "MA0152",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyor4103_B);
    END_REGION

    REGION TRO113 (Vario) — CV-M4104
        #TRO113.stInSeparator1.Settings.nSeparatorNo := "cSep113.1";
        #TRO113.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO113.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3025"];
        #TRO113.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3026"];
        #TRO113.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3027"];
        #TRO113.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3001"];

        #TRO113(nInMainTroNo := "cMainTro113",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea113".stJam113_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea113".stJam113_1.stData,
                arInOutJamFinger := "DB_JamArea113".stJam113_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3025",
                xOutVarioMotor => "MA0145",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro113"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO113);
    END_REGION

    REGION TRO114 (1Sep) — CV-M4203
        #TRO114.stInSeparator1.Settings.nSeparatorNo := "cSep114.1";
        #TRO114.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO114.stInSeparator1.Settings.tTrailingTime := T#500ms;      // TODO Timing
        #TRO114.stInSeparator1.Settings.tHandlingTime := T#200ms;      // TODO Timing
        #TRO114.stInSeparator1.Settings.tJam := "TimeForSepJam";
        #TRO114.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3024"];
        #TRO114.stInSenJam2 := "DB_Inputs".Sensors["cInBGxxxx"];

        #TRO114.stInPriorityManager.xReleaseOk := TRUE;                // TODO Priority

        #TRO114(nInMainTroNo := "cMainTro114",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInCarouselRun := TRUE,                                // TODO Conveyor
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea114".stJam114_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea114".stJam114_1.stData,
                arInOutJamExit2 := "DB_JamArea114".stJam114_2.arCarrier,   // TODO Topologie
                stInOutJamExit2 := "DB_JamArea114".stJam114_2.stData,
                xOutStopper1 => "MB3024",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro114"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO114);
    END_REGION

    REGION TRO115 (Vario) — CV-M4203_A
        #TRO115.stInSeparator1.Settings.nSeparatorNo := "cSep115.1";
        #TRO115.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO115.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3120"];
        #TRO115.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3121"];
        #TRO115.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO115.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3124"];

        #TRO115(nInMainTroNo := "cMainTro115",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea115".stJam115_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea115".stJam115_1.stData,
                arInOutJamFinger := "DB_JamArea115".stJam115_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3120",
                xOutVarioMotor => "MA0147",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro115"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO115);
    END_REGION

    REGION fbConveyor4203_B — CV-M4203_B
        #fbConveyor4203_B.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyor4203_B.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyor4203_B.Settings.sMotorProtectName := 'FC0153';

        #fbConveyor4203_B(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FC0153",
                xInPowerContactor := "MA0153",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyor4203_B);
    END_REGION

    REGION TRO117 (1Sep1Swi) — KR-M4204
        #TRO117.stInSeparator1.Settings.nSeparatorNo := "cSep117.1";
        #TRO117.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO117.stInSeparator1.Settings.tTrailingTime := T#100ms;      // TODO Timing
        #TRO117.stInSeparator1.Settings.tHandlingTime := T#50ms;       // TODO Timing
        #TRO117.stInSeparator1.Settings.tJam := "TimeForSepJam";
        #TRO117.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3010"];
        #TRO117.stInSenJam2 := "DB_Inputs".Sensors["cInBG3012"];
        #TRO117.stInSwitch1.Settings.nSwitchNo := "cSwi117.1";

        #TRO117(nInMainTroNo := "cMainTro117",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInCarouselRun1 := TRUE,                               // TODO Conveyor
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea117".stJam117_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea117".stJam117_1.stData,
                arInOutJamExit2 := "DB_JamArea117".stJam117_2.arCarrier,   // TODO Topologie (Dir1)
                stInOutJamExit2 := "DB_JamArea117".stJam117_2.stData,
                arInOutJamExit3 := "DB_JamArea117".stJam117_3.arCarrier,   // TODO Topologie (Dir2)
                stInOutJamExit3 := "DB_JamArea117".stJam117_3.stData,
                xOutStopper1 => "MB3010",
                xOutSw1ExTo3 => "MB3015",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro117"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO117);
    END_REGION

    REGION TRO118 (1Sep) — CV-M4302
        #TRO118.stInSeparator1.Settings.nSeparatorNo := "cSep118.1";
        #TRO118.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO118.stInSeparator1.Settings.tTrailingTime := T#500ms;      // TODO Timing
        #TRO118.stInSeparator1.Settings.tHandlingTime := T#200ms;      // TODO Timing
        #TRO118.stInSeparator1.Settings.tJam := "TimeForSepJam";
        #TRO118.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3125"];
        #TRO118.stInSenJam2 := "DB_Inputs".Sensors["cInBGxxxx"];

        #TRO118.stInPriorityManager.xReleaseOk := TRUE;                // TODO Priority

        #TRO118(nInMainTroNo := "cMainTro118",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInCarouselRun := TRUE,                                // TODO Conveyor
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea118".stJam118_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea118".stJam118_1.stData,
                arInOutJamExit2 := "DB_JamArea118".stJam118_2.arCarrier,   // TODO Topologie
                stInOutJamExit2 := "DB_JamArea118".stJam118_2.stData,
                xOutStopper1 => "MB3125",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro118"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO118);
    END_REGION

    REGION TRO119 (Vario) — CV-M4302_A
        #TRO119.stInSeparator1.Settings.nSeparatorNo := "cSep119.1";
        #TRO119.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO119.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO119.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO119.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3122"];
        #TRO119.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3150"];

        #TRO119(nInMainTroNo := "cMainTro119",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea119".stJam119_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea119".stJam119_1.stData,
                arInOutJamFinger := "DB_JamArea119".stJam119_2.arCarrier,  // TODO Topologie
                xOutStopper => "MBxxxx",
                xOutVarioMotor => "MA0154",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro119"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO119);
    END_REGION

    REGION TRO120 (Vario) — CV-M4302_B
        #TRO120.stInSeparator1.Settings.nSeparatorNo := "cSep120.1";
        #TRO120.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO120.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3130"];
        #TRO120.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3131"];
        #TRO120.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3132"];
        #TRO120.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3126"];

        #TRO120(nInMainTroNo := "cMainTro120",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea120".stJam120_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea120".stJam120_1.stData,
                arInOutJamFinger := "DB_JamArea120".stJam120_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3130",
                xOutVarioMotor => "MA0150",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro120"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO120);
    END_REGION

    REGION fbConveyor4402_A — CV-M4402_A
        #fbConveyor4402_A.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyor4402_A.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyor4402_A.Settings.sMotorProtectName := 'FC0155';

        #fbConveyor4402_A(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FC0155",
                xInPowerContactor := "MA0155",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyor4402_A);
    END_REGION

    REGION TRO122 (Vario) — CV-M4402_B
        #TRO122.stInSeparator1.Settings.nSeparatorNo := "cSep122.1";
        #TRO122.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO122.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3135"];
        #TRO122.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3136"];
        #TRO122.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3137"];
        #TRO122.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3134"];

        #TRO122(nInMainTroNo := "cMainTro122",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea122".stJam122_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea122".stJam122_1.stData,
                arInOutJamFinger := "DB_JamArea122".stJam122_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3135",
                xOutVarioMotor => "MA0151",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro122"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO122);
    END_REGION

    REGION TRO123 (Vario) — CV-M4403
        #TRO123.stInSeparator1.Settings.nSeparatorNo := "cSep123.1";
        #TRO123.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO123.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3073"];
        #TRO123.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3074"];
        #TRO123.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3075"];
        #TRO123.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3071"];

        #TRO123(nInMainTroNo := "cMainTro123",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea123".stJam123_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea123".stJam123_1.stData,
                arInOutJamFinger := "DB_JamArea123".stJam123_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3073",
                xOutVarioMotor => "MA0143",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro123"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO123);
    END_REGION

    REGION TRO124 (Vario) — CV-M4501
        #TRO124.stInSeparator1.Settings.nSeparatorNo := "cSep124.1";
        #TRO124.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO124.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3020"];
        #TRO124.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3011"];
        #TRO124.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3021"];
        #TRO124.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3017"];

        #TRO124(nInMainTroNo := "cMainTro124",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea124".stJam124_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea124".stJam124_1.stData,
                arInOutJamFinger := "DB_JamArea124".stJam124_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3020",
                xOutVarioMotor => "MA0144",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro124"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO124);
    END_REGION

    REGION TRO125 (Vario) — CV-M4502
        #TRO125.stInSeparator1.Settings.nSeparatorNo := "cSep125.1";
        #TRO125.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO125.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3063"];
        #TRO125.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3064"];
        #TRO125.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3065"];
        #TRO125.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3067"];

        #TRO125(nInMainTroNo := "cMainTro125",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea125".stJam125_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea125".stJam125_1.stData,
                arInOutJamFinger := "DB_JamArea125".stJam125_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3063",
                xOutVarioMotor => "MA0142",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro125"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO125);
    END_REGION

    REGION TRO126 (Vario) — CV-M4503
        #TRO126.stInSeparator1.Settings.nSeparatorNo := "cSep126.1";
        #TRO126.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO126.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3060"];
        #TRO126.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3082"];
        #TRO126.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3081"];
        #TRO126.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3061"];

        #TRO126(nInMainTroNo := "cMainTro126",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea126".stJam126_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea126".stJam126_1.stData,
                arInOutJamFinger := "DB_JamArea126".stJam126_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3060",
                xOutVarioMotor => "MA0141",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro126"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO126);
    END_REGION

    REGION fbConveyorM0103 — CV-PM0103
        #fbConveyorM0103.Settings.tEnergySafeTime := "cTimeEnergySafe";
        #fbConveyorM0103.Settings.xGridActive := FALSE;                         // TODO Grid
        #fbConveyorM0103.Settings.sMotorProtectName := 'FCxxxx';

        #fbConveyorM0103(xInEnabled := TRUE,                                    // TODO Enable
                xInMotorProtection := "FCxxxx",
                xInPowerContactor := "MA0062",
                stInOutHMI := "DB_Interface_HMI".stConveyors.fbConveyorM0103);
    END_REGION

END_FUNCTION_BLOCK
