{
    S7_Author := "ABH";
    S7_BlockNumber := "15177";
    S7_BlockTitle := "MLC_4GL";
    S7_Family := "ZeusControl";
    S7_Optimized := "TRUE";
    S7_PreferredLanguage := "LAD";
    S7_Version := "1.0"
}
FUNCTION_BLOCK "FB15177_ZC_COCINA_CAL_ENF"
    VAR_INPUT
        { S7_MLC := "MLC_mw" }
        NombreSecuencia : String := 'CALENTAR/ENFRIAR';
        { S7_MLC := "MLC_3Ld" }
        Pulso1Seg : Bool;
        { S7_MLC := "MLC_zQ" }
        Ack : Bool;
        { S7_MLC := "MLC_4k6" }
        OrdenMarcha : Bool;
        { S7_MLC := "MLC_dW" }
        EstadoEnMarcha : Bool;
        { S7_MLC := "MLC_4uM" }
        EnEtapa : Bool;
        { S7_MLC := "MLC_53x" }
        OrdenPausa : Bool;
        { S7_MLC := "MLC_4wh" }
        EstadoBomba : Bool;
        { S7_MLC := "MLC_56f" }
        TipoValvulaDrenaje : Bool;
        { S7_MLC := "MLC_3Bf" }
        Tipo : Bool;
        { S7_MLC := "MLC_m5" }
        TT_Linea : Real;
        { S7_MLC := "MLC_4Fc" }
        TT_Tanque : Real;
        Parametros : _.UDT_ZC_RECETA_BATCH_ETAPA := (
            { S7_MLC := "MLC_3rj" }
            P_Real_1 := (),
            { S7_MLC := "MLC_Yv" }
            P_Real_2 := (),
            { S7_MLC := "MLC_bT" }
            P_Real_3 := (),
            { S7_MLC := "MLC_5Aj" }
            P_Real_4 := (),
            { S7_MLC := "MLC_32f" }
            P_Real_5 := (),
            { S7_MLC := "MLC_gC" }
            P_Real_6 := (),
            { S7_MLC := "MLC_4wt" }
            P_Real_7 := (),
            { S7_MLC := "MLC_36L" }
            P_Real_8 := (),
            { S7_MLC := "MLC_R8" }
            P_Real_9 := (),
            { S7_MLC := "MLC_pk" }
            P_Real_10 := (),
            { S7_MLC := "MLC_3Pv" }
            P_Real_11 := (),
            { S7_MLC := "MLC_YQ" }
            P_Real_12 := (),
            { S7_MLC := "MLC_4kW" }
            P_Real_13 := (),
            { S7_MLC := "MLC_3b2" }
            P_Real_14 := (),
            { S7_MLC := "MLC_3eB" }
            P_Real_15 := (),
            { S7_MLC := "MLC_3s7" }
            P_Real_16 := (),
            { S7_MLC := "MLC_ht" }
            P_Real_17 := (),
            { S7_MLC := "MLC_VN" }
            P_Int_1 := (),
            { S7_MLC := "MLC_zr" }
            P_Int_2 := (),
            { S7_MLC := "MLC_4x5" }
            P_Int_3 := (),
            { S7_MLC := "MLC_jx" }
            P_Int_4 := (),
            { S7_MLC := "MLC_55g" }
            P_Int_5 := (),
            { S7_MLC := "MLC_3cB" }
            P_Int_6 := (),
            { S7_MLC := "MLC_3nz" }
            P_Int_7 := (),
            { S7_MLC := "MLC_4tt" }
            P_Int_8 := (),
            { S7_MLC := "MLC_3eD" }
            P_Int_9 := (),
            { S7_MLC := "MLC_4VP" }
            P_Int_10 := (),
            { S7_MLC := "MLC_4Lb" }
            P_Int_11 := (),
            { S7_MLC := "MLC_3ub" }
            P_Int_12 := (),
            { S7_MLC := "MLC_4zm" }
            P_Int_13 := (),
            { S7_MLC := "MLC_4r6" }
            P_Int_14 := (),
            { S7_MLC := "MLC_3x5" }
            P_Int_15 := (),
            { S7_MLC := "MLC_3Mi" }
            P_String_1 := (),
            { S7_MLC := "MLC_k2" }
            P_String_2 := (),
            { S7_MLC := "MLC_4b7" }
            P_String_3 := (),
            { S7_MLC := "MLC_XL" }
            P_String_4 := (),
            { S7_MLC := "MLC_3dK" }
            P_String_5 := (),
            { S7_MLC := "MLC_48q" }
            P_String_6 := (),
            { S7_MLC := "MLC_3Yv" }
            P_String_7 := (),
            { S7_MLC := "MLC_3RM" }
            P_String_8 := (),
            { S7_MLC := "MLC_4tH" }
            P_String_9 := (),
            { S7_MLC := "MLC_4AM" }
            P_String_10 := ()
        );
        { S7_MLC := "MLC_4zj" }
        LitrosDrenajeInicial : Real := 150.0;
        { S7_MLC := "MLC_4ji" }
        LitrosEmpujeFinal : Real := 150.0;
        { S7_MLC := "MLC_3Cf" }
        TotalizadorDrenaje : Real := 0.0;
        { S7_MLC := "MLC_5BH" }
        TotalizadorEmpuje : Real := 0.0;
        { S7_MLC := "MLC_4WE" }
        TiempoAclarado : Int := 60;
        { S7_MLC := "MLC_hb" }
        TiempoMaximoDrenaje : Int := 80;
        { S7_MLC := "MLC_3dn" }
        TiempoMaximoEmpuje : Int := 80;
    END_VAR
    VAR_OUTPUT
        { S7_MLC := "MLC_3tq" }
        Calentar : Bool;
        { S7_MLC := "MLC_Ni" }
        Enfriar : Bool;
        { S7_MLC := "MLC_iz" }
        SP_CalEnf : Real;
        { S7_MLC := "MLC_4kJ" }
        MarchaBombaBlender : Bool;
        { S7_MLC := "MLC_4pd" }
        VelocidadBombaBlender : Real;
        { S7_MLC := "MLC_4Q8" }
        MarchaBombaIntermedia : Bool;
        { S7_MLC := "MLC_3pW" }
        AperturaValvulaSalidaTanque : Bool;
        { S7_MLC := "MLC_53c" }
        AperturaValvulaDrenaje : Bool;
        { S7_MLC := "MLC_4yH" }
        AperturaValvulaEntradaTanque : Bool;
        { S7_MLC := "MLC_XY" }
        AperturaValvulaEmpuje : Bool;
        { S7_MLC := "MLC_3qv" }
        AlarmaTiempoMaxRecirc : Bool;
        { S7_MLC := "MLC_3Mx" }
        OrdenTotalizadorDrenaje : Bool;
        { S7_MLC := "MLC_579" }
        OrdenTotalizadorEmpuje : Bool;
        { S7_MLC := "MLC_4rh" }
        ResetTotalizadorDrenaje : Bool;
        { S7_MLC := "MLC_4ei" }
        ResetTotalizadorEmpuje : Bool;
        VisibilidadLitrosDrenaje : Bool;
        VisibilidadLitrosEmpuje : Bool;
        VisibilidadCalEnf : Bool;
        { S7_MLC := "MLC_4ti" }
        SecuenciaIniciada : Bool;
        { S7_MLC := "MLC_4GP" }
        FinSecuencia : Bool;
    END_VAR
    VAR RETAIN
        { S7_MLC := "MLC_QM" }
        s_EtapaActual : Int;
        { S7_MLC := "MLC_37H" }
        s_TextoEtapa : String[100];
        s_Pausa_M : Bool;
        s_Pausa_V : Bool;
        s_Continuar : Bool;
    END_VAR
    VAR
        {
            S7_Access := "ReadOnly := External";
            S7_Visibility := "Hidden := External"
        }
        s_Pulsos : Array[0..15] of Bool := [
            { S7_MLC := "MLC_pm" }
        (),
            { S7_MLC := "MLC_gM" }
        (),
            { S7_MLC := "MLC_3Hm" }
        (),
            { S7_MLC := "MLC_4MB" }
        (),
            { S7_MLC := "MLC_3DY" }
        (),
            { S7_MLC := "MLC_4B4" }
        (),
            { S7_MLC := "MLC_4gf" }
        (),
            { S7_MLC := "MLC_3rK" }
        (),
            7(()),
            { S7_MLC := "MLC_3vF" }
        ()
        ];
    END_VAR
    VAR RETAIN
        { S7_MLC := "MLC_3zW" }
        s_TiempoEtapa : STRUCT
            { S7_MLC := "MLC_4zA" }
            Activar : Bool;
            { S7_MLC := "MLC_4bF" }
            Reset : Bool;
            { S7_MLC := "MLC_wB" }
            Actual : Int;
            { S7_MLC := "MLC_3DA" }
            SP : Int;
            { S7_MLC := "MLC_48j" }
            Restante : Int;
        END_STRUCT;
    END_VAR
    VAR
        {
            S7_Access := "ReadOnly := External";
            S7_Setpoint := "False";
            S7_Visibility := "Hidden := External"
        }
        s_TON : Array[1..#NUM_MAX_TON] of _.UDT_ZC_DISP_TON := [
            { S7_MLC := "MLC_4qB" }
        (),
            { S7_MLC := "MLC_nw" }
        ()
        ];
    END_VAR
    VAR RETAIN
        {
            S7_Access := "ReadOnly := External";
            S7_Setpoint := "False";
            S7_Visibility := "Hidden := External"
        }
        s_TOF : Array[1..#NUM_MAX_TOF] of _.UDT_ZC_DISP_TOF := [
            { S7_MLC := "MLC_3Z2" }
        (),
            { S7_MLC := "MLC_3RF" }
        (),
            { S7_MLC := "MLC_3Fq" }
        (),
            { S7_MLC := "MLC_4Ht" }
        (),
            { S7_MLC := "MLC_3bV" }
        ()
        ];
        {
            S7_Access := "ReadOnly := External";
            S7_Setpoint := "False";
            S7_Visibility := "Hidden := External"
        }
        s_TONR : Array[1..#NUM_MAX_TONR] of _.UDT_ZC_DISP_TONR := [
            { S7_MLC := "MLC_sj" }
        ()
        ];
        {
            S7_Access := "ReadOnly := External";
            S7_MLC := "MLC_49z";
            S7_Visibility := "Hidden := External"
        }
        s_TiempoMaxRecirc : Bool;
    END_VAR
    VAR_TEMP
        for_i : Int;
        t_TempHistSuperior : Real;
        t_TempHistInferior : Real;
    END_VAR
    VAR CONSTANT
        SiempreON : Bool := TRUE;
        SiempreOFF : Bool := FALSE;
        NUM_MAX_TON : Int := 2;
        NUM_MAX_TOF : Int := 5;
        NUM_MAX_TONR : Int := 1;
    END_VAR

    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_Nr"
    }
    NETWORK
        (*
        ============================================================================
        ZEUS CONTROL, S.A.
        (c)Copyright (2024) All Rights Reserved
        -----------------------------------------------------------------------------
        
        Software:       TIA Portal 18
        Restricciones:  PLC serie 1200/1500
        
        
        Nombre:         FB15177_ZC_COCINA_CAL_ENF
        Descripcion:    Bloque de gestión de fase Calentar/Enfriar
        
        Dependencias:   
            FC:         -
            FB:         -
            DB:         -
            UDT:        -
                     
        
        Change log:
        
            Version     Fecha       Tecnico a cargo     Descripción
            
            01.00.00    14.06.2024  (ABH)               Primera versión
            
         ============================================================================
         *)
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_52C"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3vS"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #SiempreON )
            Add(
                in1 := #Parametros.P_Real_6,
                in2 := #Parametros.P_Real_7,
                out => #t_TempHistSuperior
            )
            Sub(
                in1 := #Parametros.P_Real_6,
                in2 := #Parametros.P_Real_7,
                out => #t_TempHistInferior
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4Gy"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_cg"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #SiempreON )
            wire#w1
            Contact( #OrdenPausa )
            wire#w2
            S_Coil( #s_Pausa_M )
        END_RUNG
        RUNG wire#w1
            I_Contact( #EstadoEnMarcha )
        END_RUNG wire#w2
        RUNG wire#w1
            Contact( #s_Pausa_M )
            wire#w3
            Move(
                in := 3,
                out1 => #s_TON[1].SP
            )
            Coil( #s_TON[1].IN )
        END_RUNG
        RUNG wire#w3
            Contact( #s_TON[1].Q )
            I_Contact( #s_Continuar )
            S_Coil( #s_Pausa_V )
        END_RUNG
        RUNG wire#w1
            I_Contact( #OrdenPausa )
            Contact( #EstadoEnMarcha )
            wire#w4
            R_Coil( #s_Pausa_V )
        END_RUNG
        RUNG wire#w4
            S_Coil( #s_Continuar )
        END_RUNG
        RUNG wire#w1
            Contact( #s_Continuar )
            wire#w5
            Move(
                in := 3,
                out1 => #s_TON[2].SP
            )
            Coil( #s_TON[2].IN )
        END_RUNG
        RUNG wire#w5
            Contact( #s_TON[2].Q )
            wire#w6
            R_Coil( #s_Pausa_M )
        END_RUNG
        RUNG wire#w6
            R_Coil( #s_Continuar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 0
            )
            wire#w7
            R_Coil( #s_Pausa_M )
        END_RUNG
        RUNG wire#w7
            R_Coil( #s_Pausa_V )
        END_RUNG
        RUNG wire#w7
            R_Coil( #s_Continuar )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3v7"
    }
    NETWORK
        RUNG wire#powerrail
            I_Contact( #EnEtapa )
            Move(
                in := 0,
                out1 => #s_EtapaActual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_45S"
    }
    NETWORK
        //  ================================================================
        //  TEXTO ETAPA
        CASE #s_EtapaActual OF
            0:
                #s_TextoEtapa := CONCAT_STRING(IN1:= #NombreSecuencia,IN2:= ' - REPOSO');
                
                //  =========================================================================================
                //  Homogenizacion en linea
            100:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - APERTURA DE CAMINO');
            110:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - ENCENDIDO DE BOMBA');
            120:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - DRENAJE PREVIO');
            130:
                IF NOT #Tipo THEN
                    #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - CALENTAMIENTO');
                ELSE
                    #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - ENFRIAMIENTO');
                END_IF;
            160:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - EMPUJE');
            170:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - ACLARADO');
            180:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - APAGADO DE BOMBA');
            190:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - CIERRE CAMINO');
                
            999:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - FIN DE SECUENCIA');
                
            ELSE
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - FUERA DE ETAPA');
        END_CASE;
        
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_xw"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4vc"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 0
            )
            Contact( #EnEtapa )
            Contact( #OrdenMarcha )
            Move(
                in := 100,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4Bh"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 100
            )
            wire#w1
            P_Trig( #s_Pulsos[0] )
            Move(
                in := 3,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 110,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4uE"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 110
            )
            wire#w1
            P_Trig( #s_Pulsos[1] )
            Move(
                in := 1,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            Contact( #EstadoBomba )
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 120,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4eZ"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 120
            )
            wire#w1
            P_Trig( #s_Pulsos[2] )
            Move(
                in := #TiempoMaximoDrenaje,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Real" }
            GE_Contact(
                in1 := #TotalizadorDrenaje,
                in2 := #LitrosDrenajeInicial
            )
            wire#w2
            Move(
                in := 130,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
        END_RUNG wire#w2
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3yb"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            wire#w1
            P_Trig( #s_Pulsos[3] )
            Move(
                in := #Parametros.P_Int_1,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            I_Contact( #Tipo )
            { S7_Templates := "SrcType := Real" }
            GE_Contact(
                in1 := #TT_Tanque,
                in2 := #t_TempHistInferior
            )
            wire#w2
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            Contact( #Tipo )
            { S7_Templates := "SrcType := Real" }
            LE_Contact(
                in1 := #TT_Tanque,
                in2 := #t_TempHistSuperior
            )
        END_RUNG wire#w2
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 160,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            Contact( #s_TONR[1].Q )
            Move(
                in := 160,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
            S_Coil( #s_TiempoMaxRecirc )
        END_RUNG
        RUNG wire#w1
            Move(
                in := #Parametros.P_Int_2,
                out1 => #s_TONR[1].SP
            )
        END_RUNG
        RUNG wire#w1
            Coil( #s_TONR[1].IN )
        END_RUNG
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            NE_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            Coil( #s_TONR[1].RESET )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_49K"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 160
            )
            wire#w1
            P_Trig( #s_Pulsos[4] )
            Move(
                in := #TiempoMaximoEmpuje,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Real" }
            GE_Contact(
                in1 := #TotalizadorEmpuje,
                in2 := #LitrosEmpujeFinal
            )
            wire#w2
            Move(
                in := 170,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
        END_RUNG wire#w2
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3z3"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 170
            )
            wire#w1
            P_Trig( #s_Pulsos[5] )
            Move(
                in := #TiempoAclarado,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 180,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_ah"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 180
            )
            wire#w1
            P_Trig( #s_Pulsos[6] )
            Move(
                in := 1,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            I_Contact( #EstadoBomba )
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 190,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4Z2"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 190
            )
            wire#w1
            P_Trig( #s_Pulsos[7] )
            Move(
                in := 3,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 999,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3PN"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 999
            )
            wire#w1
            P_Trig( #s_Pulsos[15] )
            Move(
                in := 3,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            I_Contact( #EnEtapa )
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            Move(
                in := 0,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_5CY"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3wJ"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #s_TiempoEtapa.Activar )
            wire#w1
            Contact( #EstadoEnMarcha )
            I_Contact( #s_Pausa_M )
            Contact( #Pulso1Seg )
            { S7_Templates := "SrcType := Int" }
            LT_Contact(
                in1 := #s_TiempoEtapa.Actual,
                in2 := #s_TiempoEtapa.SP
            )
            { S7_Templates := "DestType := Int" }
            Inc( #s_TiempoEtapa.Actual )
        END_RUNG
        RUNG wire#w1
            Contact( #s_TiempoEtapa.Reset )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            R_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#powerrail
            Sub(
                in1 := #s_TiempoEtapa.SP,
                in2 := #s_TiempoEtapa.Actual,
                out => #s_TiempoEtapa.Restante
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_TiempoEtapa.Restante,
                in2 := 0
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Restante
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_3h6"
    }
    NETWORK
        
        //  ============================================================================
        //  TON
        FOR #for_i := 1 TO #NUM_MAX_TON DO
            "FC2928_ZC_TON_INDV"(Pulso1seg:=#Pulso1Seg,
                                 TON:=#s_TON[#for_i]);
        END_FOR;
        
        //  ============================================================================
        //  TOF
        FOR #for_i := 1 TO #NUM_MAX_TOF DO
            "FC2929_ZC_TOF_INDV"(Pulso1seg := #Pulso1Seg,
                                 TOF := #s_TOF[#for_i]);
        END_FOR;
        
        //  ============================================================================
        //  TONR
        FOR #for_i := 1 TO #NUM_MAX_TONR DO
            "FC2930_ZC_TONR_INDV"(Pulso1seg := #Pulso1Seg,
                                 TONR := #s_TONR[#for_i]);
        END_FOR;
        
        
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_32X"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3jP"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #Ack )
            R_Coil( #s_TiempoMaxRecirc )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3mu"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3ie"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            I_Contact( #s_Pausa_V )
            wire#w1
            I_Contact( #Tipo )
            Move(
                in := #t_TempHistSuperior,
                out1 => #SP_CalEnf
            )
            Coil( #Calentar )
        END_RUNG
        RUNG wire#w1
            Contact( #Tipo )
            Move(
                in := #t_TempHistInferior,
                out1 => #SP_CalEnf
            )
            Coil( #Enfriar )
        END_RUNG
        RUNG wire#w1
            Coil( #VisibilidadCalEnf )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3As"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 100
            )
            Coil( #ResetTotalizadorDrenaje )
        END_RUNG
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 120
            )
            Coil( #OrdenTotalizadorDrenaje )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3ed"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 100
            )
            Coil( #ResetTotalizadorEmpuje )
        END_RUNG
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 160
            )
            Coil( #OrdenTotalizadorEmpuje )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4H9"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #OrdenTotalizadorDrenaje )
            Coil( #VisibilidadLitrosDrenaje )
        END_RUNG
        RUNG wire#powerrail
            Contact( #OrdenTotalizadorEmpuje )
            Coil( #VisibilidadLitrosEmpuje )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3Z7"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 110
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 170
            )
            I_Contact( #s_Pausa_M )
            wire#w1
            Coil( #MarchaBombaBlender )
        END_RUNG
        RUNG wire#w1
            Move(
                in := #Parametros.P_Real_1,
                out1 => #VelocidadBombaBlender
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4dV"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 110
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 170
            )
            I_Contact( #s_Pausa_M )
            Coil( #MarchaBombaIntermedia )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3ra"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 100
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 150
            )
            I_Contact( #s_Pausa_V )
            Move(
                in := 2,
                out1 => #s_TOF[1].SP
            )
            Coil( #s_TOF[1].IN )
        END_RUNG
        RUNG wire#powerrail
            Contact( #s_TOF[1].Q )
            Coil( #AperturaValvulaSalidaTanque )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_35F"
    }
    NETWORK
        RUNG wire#powerrail
            I_Contact( #TipoValvulaDrenaje )
            wire#w1
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 100
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 120
            )
            wire#w2
            I_Contact( #s_Pausa_V )
            Move(
                in := 2,
                out1 => #s_TOF[3].SP
            )
            Coil( #s_TOF[3].IN )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 170
            )
        END_RUNG wire#w2
        RUNG wire#powerrail
            Contact( #TipoValvulaDrenaje )
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 160
            )
        END_RUNG wire#w2
        RUNG wire#powerrail
            Contact( #s_TOF[3].Q )
            Coil( #AperturaValvulaDrenaje )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3FD"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 160
            )
            I_Contact( #s_Pausa_V )
            Move(
                in := 2,
                out1 => #s_TOF[4].SP
            )
            Coil( #s_TOF[4].IN )
        END_RUNG
        RUNG wire#powerrail
            Contact( #s_TOF[4].Q )
            Coil( #AperturaValvulaEntradaTanque )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3ZB"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 160
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 170
            )
            I_Contact( #s_Pausa_V )
            Move(
                in := 2,
                out1 => #s_TOF[5].SP
            )
            Coil( #s_TOF[5].IN )
        END_RUNG
        RUNG wire#powerrail
            Contact( #s_TOF[5].Q )
            Coil( #AperturaValvulaEmpuje )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3zM"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #s_TiempoMaxRecirc )
            Coil( #AlarmaTiempoMaxRecirc )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3JK"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            GT_Contact(
                in1 := #s_EtapaActual,
                in2 := 0
            )
            Coil( #SecuenciaIniciada )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4Zm"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 999
            )
            Coil( #FinSecuencia )
        END_RUNG
    END_NETWORK
END_FUNCTION_BLOCK
