FUNCTION_BLOCK "FB_Visu"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR 
      Lfb_S_SCL_LaengenmessungAI : "FB_LaengenmessungAI";
      Lfb_S_SCL_SSCC1108 : "FB_SSCCAI";
      Lfb_S_SCL_SSCC1107 : "FB_SSCCAI";
      fbMeldAreaStopUZ1101 : "FB_SetAlarmAndLog";
      fbMeldAreaStopUZ1102 : "FB_SetAlarmAndLog";   // NIU
      fbMeldAreaStopUZ1103 : "FB_SetAlarmAndLog";
      fbMeldAreaStopUZ1104 : "FB_SetAlarmAndLog";
      fbMeldAreaStopUZ1105 : "FB_SetAlarmAndLog";
   END_VAR

   VAR_TEMP 
      nIdx : Int;
   END_VAR


BEGIN
	REGION Konfiguration TRO-Nummern und Namen
	    "DB_Interface_HMI".stTRO.TRO100.UDT_Config.sName := 'TRO100';
	    "DB_Interface_HMI".stTRO.TRO101.UDT_Config.sName := 'TRO101'; //Pin Storage
	    "DB_Interface_HMI".stTRO.TRO102.UDT_Config.sName := 'TRO102'; //Pin Storage
	    "DB_Interface_HMI".stTRO.TRO103.UDT_Config.sName := 'TRO103';
	    "DB_Interface_HMI".stTRO.TRO104.UDT_Config.sName := 'TRO104';
	    "DB_Interface_HMI".stTRO.TRO105.UDT_Config.sName := 'TRO105';
	    "DB_Interface_HMI".stTRO.TRO106.UDT_Config.sName := 'TRO106';
	    "DB_Interface_HMI".stTRO.TRO107.UDT_Config.sName := 'TRO107';
	    "DB_Interface_HMI".stTRO.TRO108.UDT_Config.sName := 'TRO108';
	    "DB_Interface_HMI".stTRO.TRO109.UDT_Config.sName := 'TRO109';
	    "DB_Interface_HMI".stTRO.TRO110.UDT_Config.sName := 'TRO110';
	    "DB_Interface_HMI".stTRO.TRO111.UDT_Config.sName := 'TRO111';
	    "DB_Interface_HMI".stTRO.TRO112.UDT_Config.sName := 'TRO112';
	    "DB_Interface_HMI".stTRO.TRO113.UDT_Config.sName := 'TRO113';
	    "DB_Interface_HMI".stTRO.TRO114.UDT_Config.sName := 'TRO114';
	    "DB_Interface_HMI".stTRO.TRO115.UDT_Config.sName := 'TRO115';
	    "DB_Interface_HMI".stTRO.TRO116.UDT_Config.sName := 'TRO116';
	    "DB_Interface_HMI".stTRO.TRO117.UDT_Config.sName := 'TRO117';
	    "DB_Interface_HMI".stTRO.TRO118.UDT_Config.sName := 'TRO118';
	    "DB_Interface_HMI".stTRO.TRO119.UDT_Config.sName := 'TRO119';
	    "DB_Interface_HMI".stTRO.TRO120.UDT_Config.sName := 'TRO120';
	    "DB_Interface_HMI".stTRO.TRO121.UDT_Config.sName := 'TRO121';
	    "DB_Interface_HMI".stTRO.TRO122.UDT_Config.sName := 'TRO122';
	    "DB_Interface_HMI".stTRO.TRO123.UDT_Config.sName := 'TRO123';
	    "DB_Interface_HMI".stTRO.TRO124.UDT_Config.sName := 'TRO124';
	    "DB_Interface_HMI".stTRO.TRO125.UDT_Config.sName := 'TRO125';
	    "DB_Interface_HMI".stTRO.TRO126.UDT_Config.sName := 'TRO126';
	    "DB_Interface_HMI".stTRO.TRO127.UDT_Config.sName := 'TRO127';
	    "DB_Interface_HMI".stTRO.TRO128.UDT_Config.sName := 'TRO128';
	    "DB_Interface_HMI".stTRO.TRO129.UDT_Config.sName := 'TRO129';
	    "DB_Interface_HMI".stTRO.TRO130.UDT_Config.sName := 'TRO130';
	    "DB_Interface_HMI".stTRO.TRO131.UDT_Config.sName := 'TRO131';
	    "DB_Interface_HMI".stTRO.TRO132.UDT_Config.sName := 'TRO132';
	    "DB_Interface_HMI".stTRO.TRO133.UDT_Config.sName := 'TRO133';
	    "DB_Interface_HMI".stTRO.TRO134.UDT_Config.sName := 'TRO134';
	END_REGION
	
	REGION Group-Error Schaltschränke
	    REGION UH01
	        "DB_Interface_HMI".stSystem.stGroupError.xUH01 :=
	        "DB_Interface_HMI".arEStops[0].xEStopActive OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UH01_24V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UH01_400V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMainContactor.UH01.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMotorProtection.UH01.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stPhase.UH01_400V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stPressure.UH01.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFireControl.NoFireAlarmFAS.xSigOk;
	    END_REGION
	    
	    REGION UC011
	        "DB_Interface_HMI".stSystem.stGroupError.xUC011 :=
	        "DB_Interface_HMI".arEStops[7].xEStopActive OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UC011_400V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UC011_24V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMainContactor.UC011.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMainContactor.UC011toUC061.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMotorProtection.UC011.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stPressure.UC011.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFireControl.FPCOpened.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFireControl.NoFault.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFireControl.NoFireAlarmFPG.xSigOk;
	    END_REGION
	END_REGION
	
	REGION Sammelnothalt
	    "DB_Interface_HMI".stSystem.stGroupError.UDT_Panel_EmergencyStopCollected.xEStopActive :=
	    "DB_Interface_HMI".arEStops[0].xEStopActive OR
	    "DB_Interface_HMI".arEStops[1].xEStopActive OR
	    "DB_Interface_HMI".arEStops[2].xEStopActive OR
	    "DB_Interface_HMI".arEStops[3].xEStopActive OR
	    "DB_Interface_HMI".arEStops[4].xEStopActive OR
	    "DB_Interface_HMI".arEStops[5].xEStopActive OR
	    "DB_Interface_HMI".arEStops[6].xEStopActive OR
	    "DB_Interface_HMI".arEStops[7].xEStopActive OR
	    "DB_Interface_HMI".arEStops[8].xEStopActive OR
	    "DB_Interface_HMI".arEStops[9].xEStopActive OR
	    "DB_Interface_HMI".arEStops[10].xEStopActive OR
	    "DB_Interface_HMI".arEStops[11].xEStopActive OR
	    "DB_Interface_HMI".arEStops[12].xEStopActive;
	END_REGION
	
	REGION Längenmessung
	    //INPUT FÜR AKTUELLE MESSUNG NOCH BELEGEN! MIT EMBI KLÄREN OB ABFRAGE FÜR TRIGGER ANGEPASST WERDEN MUSS
	    #Lfb_S_SCL_LaengenmessungAI(udt_LetzteMessung := "DB_Interface_HMI".stLengthMeasurement.stLastMeasurement,
	                                udt_LengthMeasurementHMI := "DB_Interface_HMI".stLengthMeasurement.arLastMeasurement,
	                                xInOutClear := "DB_Interface_HMI".stLengthMeasurement.xClear);
	END_REGION
	
	REGION SSCC
	    #Lfb_S_SCL_SSCC1108(udt_LetzteMessung := "DB_Interface_HMI".stSSCC.SSCC1108.stLastMeasurement,
	                        udt_SSCC := "DB_Interface_HMI".stSSCC.SSCC1108.arLastMeasurement,
	                        xInOutClear := "DB_Interface_HMI".stSSCC.SSCC1108.xClear);
	    
	    #Lfb_S_SCL_SSCC1107(udt_LetzteMessung := "DB_Interface_HMI".stSSCC.SSCC1107.stLastMeasurement,
	                        udt_SSCC := "DB_Interface_HMI".stSSCC.SSCC1107.arLastMeasurement,
	                        xInOutClear := "DB_Interface_HMI".stSSCC.SSCC1107.xClear);
	END_REGION
	
	REGION Bereichshalt 
	    REGION UZ1101
	        #fbMeldAreaStopUZ1101.stSettings.nNoMaxErrors := 1;
	        #fbMeldAreaStopUZ1101.stSettings.nType := 1;
	        #fbMeldAreaStopUZ1101(xInAlarm := NOT "SF0120",
	                              nInAlarmNumber := 0,
	                              wInTextListId_Function := 30,
	                              sInPrefix := 'UZ1101',
	                              sInSuffix := 'SF0120',
	                              wInTextListId_Message := 30,
	                              stInOutControlUnitCabinet := "DB_MachineGlobal".stStateMainOF2);
	    END_REGION
	    
	    REGION UZ1103
	        #fbMeldAreaStopUZ1103.stSettings.nNoMaxErrors := 1;
	        #fbMeldAreaStopUZ1103.stSettings.nType := 1;
	        #fbMeldAreaStopUZ1103(xInAlarm := NOT "SF0124",
	                              nInAlarmNumber := 0,
	                              wInTextListId_Function := 30,
	                              sInPrefix := 'UZ1103',
	                              sInSuffix := 'SF0124',
	                              wInTextListId_Message := 30,
	                              stInOutControlUnitCabinet := "DB_MachineGlobal".stStateMainOF2);
	    END_REGION
	    
	    REGION UZ1104
	        #fbMeldAreaStopUZ1104.stSettings.nNoMaxErrors := 1;
	        #fbMeldAreaStopUZ1104.stSettings.nType := 1;
	        #fbMeldAreaStopUZ1104(xInAlarm := NOT "SF0126",
	                              nInAlarmNumber := 0,
	                              wInTextListId_Function := 30,
	                              sInPrefix := 'UZ1104',
	                              sInSuffix := 'SF0126',
	                              wInTextListId_Message := 30,
	                              stInOutControlUnitCabinet := "DB_MachineGlobal".stStateMainOF2);
	    END_REGION
	    
	    REGION UZ1105
	        #fbMeldAreaStopUZ1105.stSettings.nNoMaxErrors := 1;
	        #fbMeldAreaStopUZ1105.stSettings.nType := 1;
	        #fbMeldAreaStopUZ1105(xInAlarm := NOT "SF0130",
	                              nInAlarmNumber := 0,
	                              wInTextListId_Function := 30,
	                              sInPrefix := 'UZ1105',
	                              sInSuffix := 'SF0130',
	                              wInTextListId_Message := 30,
	                              stInOutControlUnitCabinet := "DB_MachineGlobal".stStateMainOF2);
	    END_REGION
	    
	END_REGION
END_FUNCTION_BLOCK

