Ignore:
Timestamp:
Mar 7, 2007, 3:09:13 PM (17 years ago)
Author:
Rafael de Pelegrini Soares
Message:

Adapted PID models for the new language (the usage of switcher is still pending)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/newlanguage/sample/controllers/CSTR_noniso_pid.mso

    r84 r190  
    2222using "controllers/PIDs";
    2323
    24 const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit="m^2.5/h");
     24const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit='m^2.5/h');
    2525
    2626Model corrente
     
    3434
    3535        PARAMETERS
    36         ko  as frequency                (Unit="1/h");
     36        ko  as frequency                (DisplayUnit='1/h');
    3737        A   as area;
    3838        At  as area;   
    39         Ea  as energy_mol               (Unit="kJ/kmol");
    40         R   as Real                     (Unit="kJ/mol/K");
    41         ro  as dens_mol                 (Unit="kmol/m^3");
    42         Cp  as cp_mol                   (Unit="kJ/kmol/K");
    43         U   as heat_trans_coeff (Unit="kW/m^2/K");
    44         Hr  as heat_reaction    (Unit="kJ/kmol");
     39        Ea  as energy_mol               (DisplayUnit='kJ/kmol');
     40        R   as Real                     (Unit='kJ/mol/K');
     41        ro  as dens_mol                 (DisplayUnit='kmol/m^3');
     42        Cp  as cp_mol                   (DisplayUnit='kJ/kmol/K');
     43        U   as heat_trans_coeff (DisplayUnit='kW/m^2/K');
     44        Hr  as heat_reaction    (DisplayUnit='kJ/kmol');
    4545       
    4646        VARIABLES
     
    5353        tau      as time_h;
    5454        rA           as reaction_mol;
    55         k        as frequency   (Unit="1/h");
     55        k        as frequency   (DisplayUnit='1/h');
    5656in  Inlet    as corrente;
    5757out Outlet   as corrente;
     
    9494        DEVICES
    9595        FEED as corrente;
    96         CSTR as CSTR;
     96        CSTR1 as CSTR;
    9797        PIDL as PID_Ideal_AWBT;
    9898        PIDT as PID_Ideal_AWBT;
     
    107107       
    108108        CONNECTIONS
    109         FEED to CSTR.Inlet;
     109        FEED to CSTR1.Inlet;
    110110       
    111111        SET
    112112#       Parâmetros do CSTR"
    113         CSTR.R   = 8.3144 * "kJ/kmol/K";
    114         CSTR.U   = 300 * "kJ/h/m^2/K";
    115         CSTR.ro  = 55.56 * "kmol/m^3";
    116         CSTR.Cp  = 70*"kJ/kmol/K";
    117         CSTR.Hr  = -7000 * "kJ/kmol";
    118         CSTR.Ea  = 6e4 * "kJ/kmol";
    119         CSTR.ko  = 89 * "1/s";
    120         CSTR.A   = 8 * "m^2";
    121         CSTR.At  = 25 * "m^2";
     113        CSTR1.R   = 8.3144 * 'kJ/kmol/K';
     114        CSTR1.U   = 300 * 'kJ/h/m^2/K';
     115        CSTR1.ro  = 55.56 * 'kmol/m^3';
     116        CSTR1.Cp  = 70*'kJ/kmol/K';
     117        CSTR1.Hr  = -7000 * 'kJ/kmol';
     118        CSTR1.Ea  = 6e4 * 'kJ/kmol';
     119        CSTR1.ko  = 89 * '1/s';
     120        CSTR1.A   = 8 * 'm^2';
     121        CSTR1.At  = 25 * 'm^2';
    122122       
    123123        EQUATIONS
    124124
    125125        "Equações do PID para controle de nível"
    126         L_ad*(Lmax-Lmin)=CSTR.h-Lmin;
     126        L_ad*(Lmax-Lmin)=CSTR1.h-Lmin;
    127127        PIDL.Ports.input=L_ad;
    128128
    129129        "Equações do PID para controle de temperatura"
    130         T_ad*(Tmax-Tmin)=CSTR.T-Tmin;
     130        T_ad*(Tmax-Tmin)=CSTR1.T-Tmin;
    131131        PIDT.Ports.input=T_ad;
    132132       
    133133        "Variáveis manipulada"
    134         CSTR.Cv  = 2.2136 * "m^2.5/h" * (1 - PIDL.Ports.output);
    135         CSTR.Tw  = PIDT.Ports.output*(Tmax-Tmin)+Tmin;
     134        CSTR1.Cv  = 2.2136 * 'm^2.5/h' * (1 - PIDL.Ports.output);
     135        CSTR1.Tw  = PIDT.Ports.output*(Tmax-Tmin)+Tmin;
    136136       
    137137        #distúrbio regulatório
    138138        if time<1.6e5 then     
    139                 FEED.T = 300 * "K";
     139                FEED.T = 300 * 'K';
    140140        else
    141                 FEED.T = 285 * "K";
     141                FEED.T = 285 * 'K';
    142142        end
    143143
     
    152152        PIDL.Options.autoMan=0;
    153153        PIDL.Parameters.gain=20;
    154         PIDL.Parameters.intTime=5*"h";
    155         PIDL.Parameters.derivTime=0*"s";
     154        PIDL.Parameters.intTime=5*'h';
     155        PIDL.Parameters.derivTime=0*'s';
    156156        PIDL.Ports.setPoint=0.55;
    157         PIDL.Parameters.tau=1*"s";
    158         PIDL.Parameters.tauSet=1*"s";
     157        PIDL.Parameters.tau=1*'s';
     158        PIDL.Parameters.tauSet=1*'s';
    159159       
    160160        PIDT.Parameters.bias = 0;
     
    166166        PIDT.Options.autoMan=0;
    167167        PIDT.Parameters.gain=40;
    168         PIDT.Parameters.intTime=5*"h";
    169         PIDT.Parameters.derivTime=1*"h";
     168        PIDT.Parameters.intTime=5*'h';
     169        PIDT.Parameters.derivTime=1*'h';
    170170        PIDT.Ports.setPoint=0.85;
    171         PIDT.Parameters.tau=1*"s";
    172         PIDT.Parameters.tauSet=1*"s";   
     171        PIDT.Parameters.tau=1*'s';
     172        PIDT.Parameters.tauSet=1*'s';   
    173173       
    174174        "Valores limites para normalizações"
    175         Lmax=5*"m";
    176         Lmin=0*"m";
    177         Tmax=700*"K";
    178         Tmin=230*"K";   
     175        Lmax=5*'m';
     176        Lmin=0*'m';
     177        Tmax=700*'K';
     178        Tmin=230*'K';   
    179179       
    180180        "Variáveís da corrente de alimentação"
    181         FEED.Ca = 300 * "kmol/m^3";
    182         FEED.F = 3.5 * "m^3/h";
     181        FEED.Ca = 300 * 'kmol/m^3';
     182        FEED.F = 3.5 * 'm^3/h';
    183183
    184184        INITIAL
    185         CSTR.Ca = 50 * "kmol/m^3";
    186         CSTR.h = 2.5 * "m";
    187         CSTR.T = 650 * "K";
     185        CSTR1.Ca = 50 * 'kmol/m^3';
     186        CSTR1.h = 2.5 * 'm';
     187        CSTR1.T = 650 * 'K';
    188188       
    189189        OPTIONS
    190         time = [0:0.1:1 1:1:100] * "h";
     190        TimeStep = 0.1;
     191        TimeEnd = 100;
     192        TimeUnit = 'h';
    191193end
Note: See TracChangeset for help on using the changeset viewer.