FUNCTION_BLOCK "FB_Main_skel_UH04"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
// ============================================================
// AUTOMATISCH GENERIERTES GRUNDGERUEST — create_skel.py
// Quelle: E/A-Listen UH04 (data/)
// TODO-Marken kennzeichnen manuell zu ergaenzende Stellen
// (Timings, Topologie/JamAreas, Safety, Release, Priority).
// ============================================================
   VAR
      TRO401 : "FB_ILS_MTRO_Vario";   // CV-M0401
      fbConveyor4000 : "FB_Conveyor";   // CV-M4000
      TRO403 : "FB_ILS_MTRO_Vario";   // CV-M4001
      TRO404 : "FB_ILS_MTRO_Vario";   // CV-M4002
      TRO405 : "FB_ILS_MTRO_1Sep1Swi";   // KR-M4003
      TRO406 : "FB_ILS_MTRO_Vario";   // CV-M4004
      TRO407 : "FB_ILS_MTRO_Vario";   // CV-M4005
      TRO408 : "FB_ILS_MTRO_Vario";   // CV-M4006
      TRO409 : "FB_ILS_MTRO_Vario";   // CV-M4007
      TRO410 : "FB_ILS_MTRO_Vario";   // CV-M4008
      TRO411 : "FB_ILS_MTRO_Vario";   // CV-M4009
      TRO412 : "FB_ILS_MTRO_Vario";   // CV-M4010
      TRO413 : "FB_ILS_MTRO_Vario";   // CV-M4011
   END_VAR

BEGIN
    REGION TRO401 (Vario) — CV-M0401
        #TRO401.stInSeparator1.Settings.nSeparatorNo := "cSep401.1";
        #TRO401.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO401.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3260"];
        #TRO401.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3261"];
        #TRO401.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3262"];
        #TRO401.stInVario.stSenJam := "DB_Inputs".Sensors["cInBGxxxx"];

        #TRO401(nInMainTroNo := "cMainTro401",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea401".stJam401_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea401".stJam401_1.stData,
                arInOutJamFinger := "DB_JamArea401".stJam401_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3260",
                xOutVarioMotor => "MAxxxx",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro401"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO401);
    END_REGION

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

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

    REGION TRO403 (Vario) — CV-M4001
        #TRO403.stInSeparator1.Settings.nSeparatorNo := "cSep403.1";
        #TRO403.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO403.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3242"];
        #TRO403.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO403.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3244"];
        #TRO403.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3246"];

        #TRO403(nInMainTroNo := "cMainTro403",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea403".stJam403_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea403".stJam403_1.stData,
                arInOutJamFinger := "DB_JamArea403".stJam403_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3242",
                xOutVarioMotor => "MA0071",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro403"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO403);
    END_REGION

    REGION TRO404 (Vario) — CV-M4002
        #TRO404.stInSeparator1.Settings.nSeparatorNo := "cSep404.1";
        #TRO404.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO404.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3386"];
        #TRO404.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3426"];
        #TRO404.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3421"];
        #TRO404.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3387"];

        #TRO404(nInMainTroNo := "cMainTro404",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea404".stJam404_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea404".stJam404_1.stData,
                arInOutJamFinger := "DB_JamArea404".stJam404_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3386",
                xOutVarioMotor => "MA0073",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro404"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO404);
    END_REGION

    REGION TRO405 (1Sep1Swi) — KR-M4003
        #TRO405.stInSeparator1.Settings.nSeparatorNo := "cSep405.1";
        #TRO405.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO405.stInSeparator1.Settings.tTrailingTime := T#100ms;      // TODO Timing
        #TRO405.stInSeparator1.Settings.tHandlingTime := T#50ms;       // TODO Timing
        #TRO405.stInSeparator1.Settings.tJam := "TimeForSepJam";
        #TRO405.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3300"];
        #TRO405.stInSenJam2 := "DB_Inputs".Sensors["cInBG3301"];
        #TRO405.stInSwitch1.Settings.nSwitchNo := "cSwi405.1";

        #TRO405(nInMainTroNo := "cMainTro405",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInCarouselRun1 := TRUE,                               // TODO Conveyor
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea405".stJam405_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea405".stJam405_1.stData,
                arInOutJamExit2 := "DB_JamArea405".stJam405_2.arCarrier,   // TODO Topologie (Dir1)
                stInOutJamExit2 := "DB_JamArea405".stJam405_2.stData,
                arInOutJamExit3 := "DB_JamArea405".stJam405_3.arCarrier,   // TODO Topologie (Dir2)
                stInOutJamExit3 := "DB_JamArea405".stJam405_3.stData,
                xOutStopper1 => "MB3300",
                xOutSw1ExTo3 => "MB3362",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro405"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO405);
    END_REGION

    REGION TRO406 (Vario) — CV-M4004
        #TRO406.stInSeparator1.Settings.nSeparatorNo := "cSep406.1";
        #TRO406.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO406.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBGxxxx"];
        #TRO406.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3316"];
        #TRO406.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3312"];
        #TRO406.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3311"];

        #TRO406(nInMainTroNo := "cMainTro406",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea406".stJam406_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea406".stJam406_1.stData,
                arInOutJamFinger := "DB_JamArea406".stJam406_2.arCarrier,  // TODO Topologie
                xOutStopper => "MBxxxx",
                xOutVarioMotor => "MA0061",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro406"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO406);
    END_REGION

    REGION TRO407 (Vario) — CV-M4005
        #TRO407.stInSeparator1.Settings.nSeparatorNo := "cSep407.1";
        #TRO407.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO407.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3321"];
        #TRO407.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3314"];
        #TRO407.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3315"];
        #TRO407.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3320"];

        #TRO407(nInMainTroNo := "cMainTro407",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea407".stJam407_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea407".stJam407_1.stData,
                arInOutJamFinger := "DB_JamArea407".stJam407_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3321",
                xOutVarioMotor => "MA0062",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro407"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO407);
    END_REGION

    REGION TRO408 (Vario) — CV-M4006
        #TRO408.stInSeparator1.Settings.nSeparatorNo := "cSep408.1";
        #TRO408.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO408.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3370"];
        #TRO408.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3376"];
        #TRO408.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3372"];
        #TRO408.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3371"];

        #TRO408(nInMainTroNo := "cMainTro408",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea408".stJam408_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea408".stJam408_1.stData,
                arInOutJamFinger := "DB_JamArea408".stJam408_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3370",
                xOutVarioMotor => "MA0063",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro408"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO408);
    END_REGION

    REGION TRO409 (Vario) — CV-M4007
        #TRO409.stInSeparator1.Settings.nSeparatorNo := "cSep409.1";
        #TRO409.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO409.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3381"];
        #TRO409.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3374"];
        #TRO409.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3375"];
        #TRO409.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3380"];

        #TRO409(nInMainTroNo := "cMainTro409",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea409".stJam409_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea409".stJam409_1.stData,
                arInOutJamFinger := "DB_JamArea409".stJam409_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3381",
                xOutVarioMotor => "MA0064",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro409"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO409);
    END_REGION

    REGION TRO410 (Vario) — CV-M4008
        #TRO410.stInSeparator1.Settings.nSeparatorNo := "cSep410.1";
        #TRO410.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO410.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3440"];
        #TRO410.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3446"];
        #TRO410.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3442"];
        #TRO410.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3437"];

        #TRO410(nInMainTroNo := "cMainTro410",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea410".stJam410_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea410".stJam410_1.stData,
                arInOutJamFinger := "DB_JamArea410".stJam410_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3440",
                xOutVarioMotor => "MA0065",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro410"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO410);
    END_REGION

    REGION TRO411 (Vario) — CV-M4009
        #TRO411.stInSeparator1.Settings.nSeparatorNo := "cSep411.1";
        #TRO411.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO411.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3436"];
        #TRO411.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3444"];
        #TRO411.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3445"];
        #TRO411.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3431"];

        #TRO411(nInMainTroNo := "cMainTro411",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea411".stJam411_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea411".stJam411_1.stData,
                arInOutJamFinger := "DB_JamArea411".stJam411_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3436",
                xOutVarioMotor => "MA0066",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro411"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO411);
    END_REGION

    REGION TRO412 (Vario) — CV-M4010
        #TRO412.stInSeparator1.Settings.nSeparatorNo := "cSep412.1";
        #TRO412.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO412.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3391"];
        #TRO412.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3392"];
        #TRO412.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3393"];
        #TRO412.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3423"];

        #TRO412(nInMainTroNo := "cMainTro412",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea412".stJam412_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea412".stJam412_1.stData,
                arInOutJamFinger := "DB_JamArea412".stJam412_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3391",
                xOutVarioMotor => "MA0074",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro412"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO412);
    END_REGION

    REGION TRO413 (Vario) — CV-M4011
        #TRO413.stInSeparator1.Settings.nSeparatorNo := "cSep413.1";
        #TRO413.stInSeparator1.Settings.tDelayToNextItem := "TimeForSepWaiting_Short";
        #TRO413.stInSeparator1.stSenInSep := "DB_Inputs".Sensors["cInBG3250"];
        #TRO413.stInVario.stSenCarrInPos := "DB_Inputs".Sensors["cInBG3255"];
        #TRO413.stInVario.stSenFinger := "DB_Inputs".Sensors["cInBG3253"];
        #TRO413.stInVario.stSenJam := "DB_Inputs".Sensors["cInBG3264"];

        #TRO413(nInMainTroNo := "cMainTro413",
                xInSftyOk := TRUE,                                     // TODO Safety
                xInAllRdyToStart := TRUE,
                xInRelease := TRUE,                                    // TODO Release
                stInOutMachineState := #stInOutControlUnit,            // TODO ControlUnit
                arInOutJamEntr1 := "DB_JamArea413".stJam413_1.arCarrier,   // TODO Topologie
                stInOutJamEntr1 := "DB_JamArea413".stJam413_1.stData,
                arInOutJamFinger := "DB_JamArea413".stJam413_2.arCarrier,  // TODO Topologie
                xOutStopper => "MB3250",
                xOutVarioMotor => "MA0072",
                nOutStateLast => "DB_GLOB_TroState".arTroState["cMainTro413"],
                stInOutHMI := "DB_Interface_HMI".stTRO.TRO413);
    END_REGION

END_FUNCTION_BLOCK
