FUNCTION_BLOCK "FB_Visu"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR 
      Lfb_S_SCL_LaengenmessungAI : "FB_LaengenmessungAI";
   END_VAR

   VAR_TEMP 
      nIdx : Int;
   END_VAR


BEGIN
	REGION Konfiguration TRO-Nummern
	    "DB_Interface_HMI".stTRO.stTRO500.UDT_Config.sName := 'TRO500';
	    "DB_Interface_HMI".stTRO.stTRO501.UDT_Config.sName := 'TRO501';
	    "DB_Interface_HMI".stTRO.stTRO502.UDT_Config.sName := 'TRO502';
	    "DB_Interface_HMI".stTRO.stTRO503.UDT_Config.sName := 'TRO503';
	    "DB_Interface_HMI".stTRO.stTRO504.UDT_Config.sName := 'TRO504';
	    "DB_Interface_HMI".stTRO.stTRO505.UDT_Config.sName := 'TRO505';
	    "DB_Interface_HMI".stTRO.stTRO506.UDT_Config.sName := 'TRO506';
	    "DB_Interface_HMI".stTRO.stTRO507.UDT_Config.sName := 'TRO507';
	    "DB_Interface_HMI".stTRO.stTRO508.UDT_Config.sName := 'TRO508';
	    "DB_Interface_HMI".stTRO.stTRO509.UDT_Config.sName := 'TRO509';
	    "DB_Interface_HMI".stTRO.stTRO510.UDT_Config.sName := 'TRO510';
	    "DB_Interface_HMI".stTRO.stTRO511.UDT_Config.sName := 'TRO511';
	    "DB_Interface_HMI".stTRO.stTRO512.UDT_Config.sName := 'TRO512';
	    "DB_Interface_HMI".stTRO.stTRO513.UDT_Config.sName := 'TRO513';
	    "DB_Interface_HMI".stTRO.stTRO514.UDT_Config.sName := 'TRO514';
	    "DB_Interface_HMI".stTRO.stTRO515.UDT_Config.sName := 'TRO515';
	    "DB_Interface_HMI".stTRO.stTRO516.UDT_Config.sName := 'TRO516';
	    "DB_Interface_HMI".stTRO.stTRO517.UDT_Config.sName := 'TRO517';
	    "DB_Interface_HMI".stTRO.stTRO518.UDT_Config.sName := 'TRO518';
	    "DB_Interface_HMI".stTRO.stTRO519.UDT_Config.sName := 'TRO519';
	    "DB_Interface_HMI".stTRO.stTRO520.UDT_Config.sName := 'TRO520';
	    "DB_Interface_HMI".stTRO.stTRO521.UDT_Config.sName := 'TRO521';
	    "DB_Interface_HMI".stTRO.stTRO522.UDT_Config.sName := 'TRO522';
	    "DB_Interface_HMI".stTRO.stTRO523.UDT_Config.sName := 'TRO523';
	    "DB_Interface_HMI".stTRO.stTRO524.UDT_Config.sName := 'TRO524';
	    "DB_Interface_HMI".stTRO.stTRO525.UDT_Config.sName := 'TRO525';
	    "DB_Interface_HMI".stTRO.stTRO526.UDT_Config.sName := 'TRO526';
	    "DB_Interface_HMI".stTRO.stTRO527.UDT_Config.sName := 'TRO527';
	    "DB_Interface_HMI".stTRO.stTRO528.UDT_Config.sName := 'TRO528';
	    "DB_Interface_HMI".stTRO.stTRO529.UDT_Config.sName := 'TRO529';
	    "DB_Interface_HMI".stTRO.stTRO530.UDT_Config.sName := 'TRO530';
	    "DB_Interface_HMI".stTRO.stTRO531.UDT_Config.sName := 'TRO531';
	    
	END_REGION
	
	REGION Group-Error Schaltschränke
	    REGION UH01
	        "DB_Interface_HMI".stSystem.stGroupError.xUH05 :=
	        "DB_Interface_HMI".arEstops[0].xEStopActive OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UH05_400V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UH05_24V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stFuse.UH05_PreFuse.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMainContactor.UH05.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stMotorProtection.UH05.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stPhase.UH05_400V.xSigOk OR
	        NOT "DB_Interface_HMI".stSystem.stPressure.UH05.xSigOk OR
	        NOT  "DB_Interface_HMI".stSystem.stFireControl.stNoFireAlarmFAS.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;
	END_REGION
	
	REGION Workstations
	    "DB_Interface_HMI".stWorkStations.stWS1_1 := "DB_Prozessdaten".stWorkStations.arWorkStations[0];
	    "DB_Interface_HMI".stWorkStations.stWS1_0 := "DB_Prozessdaten".stWorkStations.arWorkStations[1];
	    "DB_Interface_HMI".stWorkStations.stWS2_0 := "DB_Prozessdaten".stWorkStations.arWorkStations[2];
	    "DB_Interface_HMI".stWorkStations.stWS3_0 := "DB_Prozessdaten".stWorkStations.arWorkStations[3];
	    "DB_Interface_HMI".stWorkStations.stWS4_0 := "DB_Prozessdaten".stWorkStations.arWorkStations[4];
	    
	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
END_FUNCTION_BLOCK

