{
    S7_Author := "ABH";
    S7_BlockNumber := "15175";
    S7_BlockTitle := "MLC_4xC";
    S7_Family := "ZeusControl";
    S7_Optimized := "TRUE";
    S7_PreferredLanguage := "LAD";
    S7_Version := "1.0"
}
FUNCTION_BLOCK "FB15175_ZC_COCINA_AD_PROD"
    VAR_INPUT
        { S7_MLC := "MLC_4cR" }
        NombreSecuencia : String := 'ADICION PRODUCTO';
        { S7_MLC := "MLC_4St" }
        Pulso1Seg : Bool;
        { S7_MLC := "MLC_4nm" }
        Ack : Bool;
        { S7_MLC := "MLC_4Pr" }
        OrdenMarcha : Bool;
        { S7_MLC := "MLC_4Ze" }
        EstadoEnMarcha : Bool;
        { S7_MLC := "MLC_4h9" }
        EnEtapa : Bool;
        { S7_MLC := "MLC_57C" }
        OrdenPausa : Bool;
        { S7_MLC := "MLC_3ij" }
        OrdenSaltarEtapa : Bool;
        { S7_MLC := "MLC_4fE" }
        EstadoBomba : Bool;
        { S7_MLC := "MLC_37x" }
        TipoValvulaDrenaje : Bool;
        OrdenCalcular : Bool;
        { S7_MLC := "MLC_4nd" }
        TT_Linea : Real;
        { S7_MLC := "MLC_33r" }
        TT_Tanque : Real;
        Parametros : _.UDT_ZC_RECETA_BATCH_ETAPA := (
            { S7_MLC := "MLC_3z7" }
            P_Real_1 := (),
            { S7_MLC := "MLC_NM" }
            P_Real_2 := (),
            { S7_MLC := "MLC_3aY" }
            P_Real_3 := (),
            { S7_MLC := "MLC_3XH" }
            P_Real_4 := (),
            { S7_MLC := "MLC_4kx" }
            P_Real_5 := (),
            { S7_MLC := "MLC_3yt" }
            P_Real_6 := (),
            { S7_MLC := "MLC_3Up" }
            P_Real_7 := (),
            { S7_MLC := "MLC_dL" }
            P_Real_8 := (),
            { S7_MLC := "MLC_u5" }
            P_Real_9 := (),
            { S7_MLC := "MLC_3Hs" }
            P_Real_10 := (),
            { S7_MLC := "MLC_3yh" }
            P_Real_11 := (),
            { S7_MLC := "MLC_3an" }
            P_Real_12 := (),
            { S7_MLC := "MLC_4wx" }
            P_Real_13 := (),
            { S7_MLC := "MLC_3ck" }
            P_Real_14 := (),
            { S7_MLC := "MLC_3te" }
            P_Real_15 := (),
            { S7_MLC := "MLC_3kb" }
            P_Real_16 := (),
            { S7_MLC := "MLC_hN" }
            P_Real_17 := (),
            { S7_MLC := "MLC_4BA" }
            P_Int_1 := (),
            { S7_MLC := "MLC_3dn" }
            P_Int_2 := (),
            { S7_MLC := "MLC_53u" }
            P_Int_3 := (),
            { S7_MLC := "MLC_3CU" }
            P_Int_4 := (),
            { S7_MLC := "MLC_af" }
            P_Int_5 := (),
            { S7_MLC := "MLC_ya" }
            P_Int_6 := (),
            { S7_MLC := "MLC_v8" }
            P_Int_7 := (),
            { S7_MLC := "MLC_Xm" }
            P_Int_8 := (),
            { S7_MLC := "MLC_vG" }
            P_Int_9 := (),
            { S7_MLC := "MLC_4AQ" }
            P_Int_10 := (),
            { S7_MLC := "MLC_4sH" }
            P_Int_11 := (),
            { S7_MLC := "MLC_3cx" }
            P_Int_12 := (),
            { S7_MLC := "MLC_NU" }
            P_Int_13 := (),
            { S7_MLC := "MLC_3aA" }
            P_Int_14 := (),
            { S7_MLC := "MLC_4fe" }
            P_Int_15 := (),
            { S7_MLC := "MLC_58T" }
            P_String_1 := (),
            { S7_MLC := "MLC_4Ay" }
            P_String_2 := (),
            { S7_MLC := "MLC_4dW" }
            P_String_3 := (),
            { S7_MLC := "MLC_wu" }
            P_String_4 := (),
            { S7_MLC := "MLC_3hW" }
            P_String_5 := (),
            { S7_MLC := "MLC_3Dy" }
            P_String_6 := (),
            { S7_MLC := "MLC_3zB" }
            P_String_7 := (),
            { S7_MLC := "MLC_3he" }
            P_String_8 := (),
            { S7_MLC := "MLC_32Q" }
            P_String_9 := (),
            { S7_MLC := "MLC_4pf" }
            P_String_10 := ()
        );
        AdicionProductoConfirmacion : Array[0..9] of Bool;
        AdicionProductoDosificado : Array[0..9] of Real;
        { S7_MLC := "MLC_3qS" }
        LitrosDrenajeInicial : Real := 150.0;
        { S7_MLC := "MLC_3BH" }
        LitrosEmpujeFinal : Real := 150.0;
        { S7_MLC := "MLC_3fQ" }
        TotalizadorDrenaje : Real := 0.0;
        { S7_MLC := "MLC_3qW" }
        TotalizadorEmpuje : Real := 0.0;
        { S7_MLC := "MLC_3HW" }
        TiempoAclarado : Int := 60;
        { S7_MLC := "MLC_3Qr" }
        TiempoMaximoDrenaje : Int := 80;
        { S7_MLC := "MLC_4qK" }
        TiempoMaximoEmpuje : Int := 80;
        { S7_MLC := "MLC_Sq" }
        KilosInicialTanque : Real := 0.0;
    END_VAR
    VAR_OUTPUT
        { S7_MLC := "MLC_vP" }
        MarchaBombaBlender : Bool;
        { S7_MLC := "MLC_Vy" }
        VelocidadBombaBlender : Real;
        { S7_MLC := "MLC_3JV" }
        MarchaBombaIntermedia : Bool;
        { S7_MLC := "MLC_3wt" }
        AperturaValvulaSalidaTanque : Bool;
        { S7_MLC := "MLC_4WB" }
        AperturaValvulaDrenaje : Bool;
        { S7_MLC := "MLC_58F" }
        AperturaValvulaEntradaTanque : Bool;
        { S7_MLC := "MLC_4sq" }
        AperturaValvulaEmpuje : Bool;
        { S7_MLC := "MLC_3sS" }
        OrdenCalentar : Bool;
        { S7_MLC := "MLC_3FG" }
        OrdenEnfriar : Bool;
        { S7_MLC := "MLC_43Z" }
        SP_CalEnf : Real;
        { S7_MLC := "MLC_4DS" }
        OrdenTotalizadorDrenaje : Bool;
        { S7_MLC := "MLC_4zV" }
        OrdenTotalizadorEmpuje : Bool;
        { S7_MLC := "MLC_3Q4" }
        ResetTotalizadorDrenaje : Bool;
        { S7_MLC := "MLC_3g9" }
        ResetTotalizadorEmpuje : Bool;
        VisibilidadLitrosDrenaje : Bool;
        VisibilidadLitrosEmpuje : Bool;
        VisibilidadCalEnf : Bool;
        { S7_MLC := "MLC_3TU" }
        ProductoActual : Int;
        { S7_MLC := "MLC_3F4" }
        AdicionProductoPermiso : Array[0..9] of Bool;
        { S7_MLC := "MLC_4tu" }
        AdicionProductoCalculado : Array[0..9] of Real;
        Despresurizar : Bool;
        { S7_MLC := "MLC_Tn" }
        PermisoSaltarEtapa : Bool;
        { S7_MLC := "MLC_Zi" }
        SecuenciaIniciada : Bool;
        { S7_MLC := "MLC_3fa" }
        FinSecuencia : Bool;
    END_VAR
    VAR RETAIN
        { S7_MLC := "MLC_3jq" }
        s_EtapaActual : Int;
        { S7_MLC := "MLC_4N9" }
        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_xU" }
        (),
            { S7_MLC := "MLC_52c" }
        (),
            { S7_MLC := "MLC_4Jw" }
        (),
            { S7_MLC := "MLC_4FW" }
        (),
            { S7_MLC := "MLC_4nv" }
        (),
            { S7_MLC := "MLC_YC" }
        (),
            { S7_MLC := "MLC_3pu" }
        (),
            { S7_MLC := "MLC_42g" }
        (),
            { S7_MLC := "MLC_395" }
        (),
            { S7_MLC := "MLC_ic" }
        (),
            { S7_MLC := "MLC_4XA" }
        ()
        ];
    END_VAR
    VAR RETAIN
        { S7_MLC := "MLC_3am" }
        s_TiempoEtapa : STRUCT
            { S7_MLC := "MLC_4Jn" }
            Activar : Bool;
            { S7_MLC := "MLC_kP" }
            Reset : Bool;
            { S7_MLC := "MLC_4iw" }
            Actual : Int;
            { S7_MLC := "MLC_4ZC" }
            SP : Int;
            { S7_MLC := "MLC_3YF" }
            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_4yC" }
        (),
            { S7_MLC := "MLC_4RQ" }
        ()
        ];
    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_4qm" }
        (),
            { S7_MLC := "MLC_zz" }
        (),
            { S7_MLC := "MLC_3S4" }
        (),
            { S7_MLC := "MLC_zQ" }
        (),
            { S7_MLC := "MLC_3Za" }
        ()
        ];
        {
            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_599";
            S7_Setpoint := "True"
        }
        s_ProductoActual : Int := 0;
        { S7_MLC := "MLC_4BM" }
        s_CalentarEnfriar : Bool;
    END_VAR
    VAR
        s_KilosInicialTanque : Real;
    END_VAR
    VAR_TEMP
        for_i : Int;
        t_TempHistSuperior : Real;
        t_TempHistInferior : Real;
        t_ProductoActual_Kg : Real;
        t_ProductoActual_Homo : Int;
        t_CalcularDosificacion : Bool;
    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_4kJ"
    }
    NETWORK
        (*
        ============================================================================
        ZEUS CONTROL, S.A.
        (c)Copyright (2024) All Rights Reserved
        -----------------------------------------------------------------------------
        
        Software:       TIA Portal 18
        Restricciones:  PLC serie 1200/1500
        
        
        Nombre:         FB15175_ZC_COCINA_AD_PROD
        Descripcion:    Bloque de gestión de fase adicion de producto
        
        Dependencias:   
            FC:         -
            FB:         -
            DB:         -
            UDT:        -
                     
        
        Change log:
        
            Version     Fecha       Tecnico a cargo     Descripción
            
            01.00.00    14.06.2024  (ABH)               Primera versión
            01.00.01    05.03.2025  (ABH)               Se añade salida para despresurizar tanque esteril
            01.00.02    17.09.2025  (ABH)               Se añade habilitacion para el tratamiento termico.
                                                        Se elimina condicion de temperatura Ok para contar tiempo de homogeneizacion.
          
         ============================================================================
         *)
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_uS"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4T8"
    }
    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_55F"
    }
    NETWORK
        RUNG wire#powerrail
            I_Contact( #EnEtapa )
            Move(
                in := 0,
                out1 => #s_EtapaActual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_3Ue"
    }
    NETWORK
        //  ================================================================
        //  TEXTO ETAPA
        CASE #s_EtapaActual OF
            0:
                #s_TextoEtapa := CONCAT_STRING(IN1:= #NombreSecuencia,IN2:= ' - REPOSO');
                
            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:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - ADICION DE PRODUCTO ', IN3 := "FC15001_ZC_INT_TO_STRING"(#s_ProductoActual+1));
            140:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - HOMOGENIZACION PRODUCTO ', IN3 := "FC15001_ZC_INT_TO_STRING"(#s_ProductoActual+1));
            150:
                #s_TextoEtapa := CONCAT_STRING(IN1 := #NombreSecuencia, IN2 := ' - HOMOGENIZACION FINAL');
                
            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 := "SCL";
        S7_NetworkTitle := "MLC_uY"
    }
    NETWORK
        
        //  ================================================================
        //  Limite producto actual
        IF #s_ProductoActual < 0 THEN
            #s_ProductoActual := 0;
        END_IF;
        IF #s_ProductoActual > 9 THEN
            #s_ProductoActual := 9;
        END_IF;
        
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3Rh"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_4pz"
    }
    NETWORK
        CASE #s_ProductoActual OF
                
            0:
                #t_ProductoActual_Homo := #Parametros.P_Int_1;
                #t_ProductoActual_Kg := #Parametros.P_Real_8;
            1:
                #t_ProductoActual_Homo := #Parametros.P_Int_2;
                #t_ProductoActual_Kg := #Parametros.P_Real_9;
            2:
                #t_ProductoActual_Homo := #Parametros.P_Int_3;
                #t_ProductoActual_Kg := #Parametros.P_Real_10;
            3:
                #t_ProductoActual_Homo := #Parametros.P_Int_4;
                #t_ProductoActual_Kg := #Parametros.P_Real_11;
            4:
                #t_ProductoActual_Homo := #Parametros.P_Int_5;
                #t_ProductoActual_Kg := #Parametros.P_Real_12;
            5:
                #t_ProductoActual_Homo := #Parametros.P_Int_6;
                #t_ProductoActual_Kg := #Parametros.P_Real_13;
            6:
                #t_ProductoActual_Homo := #Parametros.P_Int_7;
                #t_ProductoActual_Kg := #Parametros.P_Real_14;
            7:
                #t_ProductoActual_Homo := #Parametros.P_Int_8;
                #t_ProductoActual_Kg := #Parametros.P_Real_15;
            8:
                #t_ProductoActual_Homo := #Parametros.P_Int_9;
                #t_ProductoActual_Kg := #Parametros.P_Real_16;
            9:
                #t_ProductoActual_Homo := #Parametros.P_Int_10;
                #t_ProductoActual_Kg := #Parametros.P_Real_17;
                
        END_CASE;
        
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3Jc"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_34b"
    }
    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
            )
            wire#w1
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            Move(
                in := 0,
                out1 => #s_ProductoActual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3zb"
    }
    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_3Gb"
    }
    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_3Ax"
    }
    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_3iH"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            wire#w1
            P_Trig( #s_Pulsos[3] )
            Move(
                in := 2,
                out1 => #s_TiempoEtapa.SP
            )
        END_RUNG
        RUNG wire#w1
            S_Coil( #s_TiempoEtapa.Activar )
        END_RUNG
        RUNG wire#w1
            { S7_Templates := "SrcType := Real" }
            EQ_Contact(
                in1 := #t_ProductoActual_Kg,
                in2 := 0.0
            )
            { S7_Templates := "DestType := Int" }
            Inc( #s_ProductoActual )
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_ProductoActual,
                in2 := 9
            )
            Move(
                in := 140,
                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
            )
            Contact( #AdicionProductoConfirmacion[#s_ProductoActual] )
            Move(
                in := 140,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            Contact( #OrdenSaltarEtapa )
            Move(
                in := 160,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4aK"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 140
            )
            wire#w1
            P_Trig( #s_Pulsos[4] )
            Move(
                in := #t_ProductoActual_Homo,
                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
            )
            wire#w2
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_ProductoActual,
                in2 := 9
            )
            { S7_Templates := "DestType := Int" }
            Inc( #s_ProductoActual )
            Move(
                in := 130,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w2
            { S7_Templates := "SrcType := Int" }
            GT_Contact(
                in1 := #s_ProductoActual,
                in2 := 9
            )
            Move(
                in := 150,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            Contact( #OrdenSaltarEtapa )
            Move(
                in := 160,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_zH"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 150
            )
            wire#w1
            P_Trig( #s_Pulsos[5] )
            Move(
                in := #Parametros.P_Int_11,
                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
            )
            wire#w2
            Move(
                in := 160,
                out1 => #s_EtapaActual
            )
            Move(
                in := 0,
                out1 => #s_TiempoEtapa.Actual
            )
        END_RUNG
        RUNG wire#w1
            Contact( #OrdenSaltarEtapa )
        END_RUNG wire#w2
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3KM"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 160
            )
            wire#w1
            P_Trig( #s_Pulsos[6] )
            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_4BZ"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 170
            )
            wire#w1
            P_Trig( #s_Pulsos[7] )
            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_534"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 180
            )
            wire#w1
            P_Trig( #s_Pulsos[8] )
            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_3p6"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 190
            )
            wire#w1
            P_Trig( #s_Pulsos[9] )
            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_4Cv"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 999
            )
            wire#w1
            P_Trig( #s_Pulsos[10] )
            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_rS"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4uG"
    }
    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_4Vb"
    }
    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_3eu"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_37q"
    }
    NETWORK
        RUNG wire#powerrail
            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_4Bn"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Real" }
            GT_Contact(
                in1 := #TT_Tanque,
                in2 := #t_TempHistSuperior
            )
            S_Coil( #s_CalentarEnfriar )
        END_RUNG
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Real" }
            LT_Contact(
                in1 := #TT_Tanque,
                in2 := #t_TempHistInferior
            )
            R_Coil( #s_CalentarEnfriar )
        END_RUNG
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Real" }
            GT_Contact(
                in1 := #TT_Tanque,
                in2 := #t_TempHistInferior
            )
            { S7_Templates := "SrcType := Real" }
            LT_Contact(
                in1 := #TT_Tanque,
                in2 := #t_TempHistSuperior
            )
            S_Coil( #s_CalentarEnfriar )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_3Gc"
    }
    NETWORK
        RUNG wire#powerrail
            Contact( #OrdenCalcular )
            Coil( #t_CalcularDosificacion )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_Nx"
    }
    NETWORK
        
        IF #t_CalcularDosificacion THEN
            #s_KilosInicialTanque := #KilosInicialTanque;
            #AdicionProductoCalculado[0] := (#s_KilosInicialTanque * #Parametros.P_Real_8) / 1000.0;
            #AdicionProductoCalculado[1] := (#s_KilosInicialTanque * #Parametros.P_Real_9) / 1000.0;
            #AdicionProductoCalculado[2] := (#s_KilosInicialTanque * #Parametros.P_Real_10) / 1000.0;
            #AdicionProductoCalculado[3] := (#s_KilosInicialTanque * #Parametros.P_Real_11) / 1000.0;
            #AdicionProductoCalculado[4] := (#s_KilosInicialTanque * #Parametros.P_Real_12) / 1000.0;
            #AdicionProductoCalculado[5] := (#s_KilosInicialTanque * #Parametros.P_Real_13) / 1000.0;
            #AdicionProductoCalculado[6] := (#s_KilosInicialTanque * #Parametros.P_Real_14) / 1000.0;
            #AdicionProductoCalculado[7] := (#s_KilosInicialTanque * #Parametros.P_Real_15) / 1000.0;
            #AdicionProductoCalculado[8] := (#s_KilosInicialTanque * #Parametros.P_Real_16) / 1000.0;
            #AdicionProductoCalculado[9] := (#s_KilosInicialTanque * #Parametros.P_Real_17) / 1000.0;
            
        END_IF;
        
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4fx"
    }
    NETWORK
        RUNG wire#powerrail
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_Vq"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            Coil( #Despresurizar )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_58g"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #Parametros.P_Int_15,
                in2 := 1
            )
            { S7_Templates := "SrcType := Int" }
            GE_Contact(
                in1 := #s_EtapaActual,
                in2 := 130
            )
            { S7_Templates := "SrcType := Int" }
            LE_Contact(
                in1 := #s_EtapaActual,
                in2 := 150
            )
            I_Contact( #s_Pausa_V )
            wire#w1
            I_Contact( #s_CalentarEnfriar )
            Move(
                in := #t_TempHistSuperior,
                out1 => #SP_CalEnf
            )
            Coil( #OrdenCalentar )
        END_RUNG
        RUNG wire#w1
            Contact( #s_CalentarEnfriar )
            Move(
                in := #t_TempHistInferior,
                out1 => #SP_CalEnf
            )
            Coil( #OrdenEnfriar )
        END_RUNG
        RUNG wire#w1
            Coil( #VisibilidadCalEnf )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_4MM"
    }
    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_3ZM"
    }
    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_32v"
    }
    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_Q2"
    }
    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_3eZ"
    }
    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_f7"
    }
    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_4dA"
    }
    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_3Zh"
    }
    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_3kS"
    }
    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_M )
            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_3zX"
    }
    NETWORK
        RUNG wire#powerrail
            Move(
                in := #s_ProductoActual,
                out1 => #ProductoActual
            )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "SCL";
        S7_NetworkTitle := "MLC_4GR"
    }
    NETWORK
        
        //  =========================================================================================
        //  Permiso confirmar productos
        #AdicionProductoPermiso[0] := (#s_ProductoActual = 0) AND (#AdicionProductoDosificado[0] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[1] := (#s_ProductoActual = 1) AND (#AdicionProductoDosificado[1] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[2] := (#s_ProductoActual = 2) AND (#AdicionProductoDosificado[2] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[3] := (#s_ProductoActual = 3) AND (#AdicionProductoDosificado[3] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[4] := (#s_ProductoActual = 4) AND (#AdicionProductoDosificado[4] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[5] := (#s_ProductoActual = 5) AND (#AdicionProductoDosificado[5] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[6] := (#s_ProductoActual = 6) AND (#AdicionProductoDosificado[6] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[7] := (#s_ProductoActual = 7) AND (#AdicionProductoDosificado[7] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[8] := (#s_ProductoActual = 8) AND (#AdicionProductoDosificado[8] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        #AdicionProductoPermiso[9] := (#s_ProductoActual = 9) AND (#AdicionProductoDosificado[9] > 0.0) AND (#s_EtapaActual >= 130) AND (#s_EtapaActual <= 130);
        
        
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_rQ"
    }
    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 := 150
            )
            Coil( #PermisoSaltarEtapa )
        END_RUNG
    END_NETWORK
    {
        S7_Language := "LAD";
        S7_NetworkTitle := "MLC_zu"
    }
    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_4Bh"
    }
    NETWORK
        RUNG wire#powerrail
            { S7_Templates := "SrcType := Int" }
            EQ_Contact(
                in1 := #s_EtapaActual,
                in2 := 999
            )
            Coil( #FinSecuencia )
        END_RUNG
    END_NETWORK
END_FUNCTION_BLOCK
