Changeset 536 for trunk


Ignore:
Timestamp:
Jun 15, 2008, 8:18:35 PM (15 years ago)
Author:
Argimiro Resende Secchi
Message:

Updating CSTR example.

Location:
trunk/sample/controllers
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sample/controllers/CSTR_noniso_pid.mso

    r295 r536  
    11#*-------------------------------------------------------------------
    2 * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
     2* EMSO Model Library (EML) Copyright (C) 2004 - 2008 ALSOC.
    33*
    44* This LIBRARY is free software; you can distribute it and/or modify
     
    66* http://www.enq.ufrgs.br/alsoc.
    77*
    8 * EMSO Copyright (C) 2004 - 2007 ALSOC, original code
     8* EMSO Copyright (C) 2004 - 2008 ALSOC, original code
    99* from http://www.rps.eng.br Copyright (C) 2002-2004.
    1010* All rights reserved.
     
    1616* Sample file for controllers
    1717*----------------------------------------------------------------------
    18 * Author:
     18* Author: Argimiro R. Secchi
    1919* $Id$
    2020*--------------------------------------------------------------------*#
     
    2424const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit='m^2.5/h');
    2525
    26 Model corrente
     26Model stream_cstr
    2727        VARIABLES
    2828        Ca     as conc_mol;
     
    3535        PARAMETERS
    3636        ko  as frequency                (DisplayUnit='1/h');
     37        D       as length;
    3738        A   as area;
    38         At  as area;   
    3939        Ea  as energy_mol               (DisplayUnit='kJ/kmol');
    4040        R   as Real                     (Unit='kJ/mol/K');
     
    4343        U   as heat_trans_coeff (DisplayUnit='kW/m^2/K');
    4444        Hr  as heat_reaction    (DisplayUnit='kJ/kmol');
    45        
     45        pi  as Real                             (Default = 3.141593);
     46        Cv  as const_valv;
     47
    4648        VARIABLES
    47         Cv       as const_valv;
     49        At               as area;       
    4850        T        as temperature;
    4951        Tw       as temperature;
     52        x                as fraction;
    5053        V        as volume;
    5154        Ca       as conc_mol;
     
    5659        q                as heat_rate   (DisplayUnit='kJ/h');
    5760        qr               as heat_rate   (DisplayUnit='kJ/h');
    58 in  Inlet    as corrente;
    59 out Outlet   as corrente;
    60 
     61in  Inlet    as stream_cstr;
     62out Outlet   as stream_cstr;
     63
     64        SET
     65        A = pi * D^2 / 4;
     66       
    6167        EQUATIONS
    6268
    63         "Balanço de Massa Global"
     69        "Overall Mass Balance"
    6470        diff(V) = Inlet.F - Outlet.F;
    6571       
    66         "Balanço de Massa por Componente"
     72        "Component Mass Balance"
    6773        V * diff(Ca) = Inlet.F * (Inlet.Ca - Ca) - (-rA) * V;
    6874
    69         "Tempo de residência médio"
     75        "Average Residence Time"
    7076        tau * Inlet.F = V;
    7177
    72         "Balanço de energia"
     78        "Energy Balance"
    7379        ro * V * Cp * diff(T) = Inlet.F * ro * Cp * (Inlet.T - T) + qr - q;
    7480
    75         "Taxa de calor transferido"
     81        "Heat Transfer Rate"
    7682        q = U * At * (T - Tw);
    7783
    78         "Taxa de calor gerado"
     84        "Reaction Heat Rate"
    7985        qr = (-Hr) * (-rA) * V;
    8086       
    81         "Taxa de reação"
     87        "Reaction Rate"
    8288        -rA = k * Ca;
    8389       
    84         "Equação de Arrhenius"
     90        "Arrhenius Equation"
    8591        k = ko * exp(-Ea/(R*T));
    8692       
    87         "Geometria"
     93        "Geometry"
    8894        A * h = V;
    89        
    90         "Equação da válvula"
    91         Outlet.F = Cv * sqrt(h);
    92 
    93         "Mistura perfeita"
     95        At = A + pi*D*h;
     96       
     97        "Valve Equation"
     98        Outlet.F = x * Cv * sqrt(h);
     99
     100        "Perfect Mixture"
    94101        Outlet.Ca = Ca;
    95102        Outlet.T  = T;
    96 end 
    97 
    98 # processo com 1 CSTR controlado
     103end
     104
     105# Process with controlled CSTR and multiple steady-states
    99106FlowSheet CSTR_controller
    100107
    101108        DEVICES
    102         FEED as corrente;
     109        FEED as stream_cstr;
    103110        CSTR1 as CSTR;
    104111        PIDL as PID;
     
    119126       
    120127        SET
    121 #       Parâmetros do CSTR"
     128#       CSTR Parameters
    122129        CSTR1.R   = 8.3144 * 'kJ/kmol/K';
    123130        CSTR1.U   = 300 * 'kJ/h/m^2/K';
     
    127134        CSTR1.Ea  = 6e4 * 'kJ/kmol';
    128135        CSTR1.ko  = 89 * '1/s';
    129         CSTR1.A   = 8 * 'm^2';
    130         CSTR1.At  = 25 * 'm^2';
     136        CSTR1.D   = 3.2 * 'm';
     137        CSTR1.Cv  = 2.7 * 'm^2.5/h';
    131138       
    132139        PIDL.PID_Select = "Ideal_AWBT";
     
    135142        EQUATIONS
    136143
    137         "Equações do PID para controle de nível"
     144        "Dimensionless level to connect PID"
    138145        L_ad*(Lmax-Lmin)=CSTR1.h-Lmin;
    139146        PIDL.Ports.input=L_ad;
    140147
    141         "Equações do PID para controle de temperatura"
     148        "Dimensionless temperature to connect PID"
    142149        T_ad*(Tmax-Tmin)=CSTR1.T-Tmin;
    143150        PIDT.Ports.input=T_ad;
    144151       
    145         "Variáveis manipulada"
    146         CSTR1.Cv  = 2.2136 * 'm^2.5/h' * PIDL.Ports.output;
     152        "Manipulated Variables"
     153        CSTR1.x  = PIDL.Ports.output;
    147154        CSTR1.Tw  = PIDT.Ports.output*(Tmax-Tmin)+Tmin;
    148155       
    149         #Parâmetros do PID de nível
     156#   Level control: PID parameters
    150157        PIDL.Parameters.bias=0;
    151158        PIDL.Parameters.alpha=0.1;
     
    161168        PIDL.Parameters.tau=1*'s';
    162169        PIDL.Parameters.tauSet=1*'s';
    163        
     170
     171#   Temperature control: PID parameters
    164172        PIDT.Parameters.bias = 0;
    165173        PIDT.Parameters.alpha=0.1;
     
    176184        PIDT.Parameters.tauSet=1*'s';   
    177185       
    178         "Valores limites para normalizações"
     186        "Operating range for control variables"
    179187        Lmax=5*'m';
    180188        Lmin=0*'m';
    181189        Tmax=700*'K';
    182190        Tmin=230*'K';   
    183        
    184         "Variáveís da corrente de alimentação"
     191
     192        "Feed Stream"
    185193        FEED.Ca = 300 * 'kmol/m^3';
    186194        FEED.F = 3.5 * 'm^3/h';
    187195
    188         #distúrbio regulatório
     196#   Disturbance
    189197        if time < 50 * 'h' then
    190198                FEED.T = 300 * 'K';
    191199        else
    192                 FEED.T = 285 * 'K';
     200                FEED.T = 285 * 'K'; # change to 350 K to saturate controller
    193201        end
    194202
    195         #mudança de set-point
     203#   Set-point changes
    196204        if time < 100 * 'h' then
    197205          Tsp = 630 * 'K';
     
    201209
    202210        if time < 150 * 'h' then
    203           Lsp = 2.5 * 'm';
     211          Lsp = 1.7 * 'm';
    204212        else
    205213          Lsp = 4 * 'm';
     
    208216        INITIAL
    209217        CSTR1.Ca = 50 * 'kmol/m^3';
    210         CSTR1.h = 2.5 * 'm';
    211         CSTR1.T = 550 * 'K';
     218        CSTR1.h = 1.7 * 'm';
     219        CSTR1.T = 570 * 'K';
    212220       
    213221        OPTIONS
     
    215223        TimeEnd = 250;
    216224        TimeUnit = 'h';
    217         DAESolver(File = "dasslc");
     225        DAESolver(File = "dassl");
    218226end
Note: See TracChangeset for help on using the changeset viewer.