Changeset 374


Ignore:
Timestamp:
Sep 26, 2007, 2:10:19 PM (16 years ago)
Author:
Rodolfo Rodrigues
Message:

Improved models to use icons

Location:
trunk/sample/reactors/fogler/chap2
Files:
10 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sample/reactors/fogler/chap2/series_reactors.mso

    r373 r374  
    5454
    5555#*---------------------------------------------------------------------
    56 * Model of a stream
    57 *--------------------------------------------------------------------*#
    58 
    59 Model stream
    60         VARIABLES
    61         F as flow_mol   (Brief="Molar flow", DisplayUnit='mol/s');
    62         X as fraction   (Brief="Molar conversion");
    63 end
    64 
    65 
    66 #*---------------------------------------------------------------------
    67 * Model of a steady-state, isotermic, and isobaric CSTR
    68 *--------------------------------------------------------------------*#
    69 
    70 Model cstr     
    71         VARIABLES
    72 in      Inlet   as stream; # Inlet stream
    73 out     Outlet  as stream; # Outlet stream
    74         r               as reaction_mol(Brief="Rate of reaction", DisplayUnit='mol/l/s');
    75         V       as volume          (Brief="Volume", DisplayUnit='l', Upper=2e3);
    76 
    77         EQUATIONS
    78         "Component molar balance"
    79         Inlet.F - Outlet.F = (-r)*V;
    80        
    81         "Outlet molar flow"
    82         Outlet.F = Inlet.F*(1 - Outlet.X);
    83 end
    84 
    85 
    86 #*---------------------------------------------------------------------
    87 * Model of a steady-state, isotermic, and isobaric PFR
    88 *--------------------------------------------------------------------*#
    89 
    90 Model pfr
    91         VARIABLES
    92 in      Inlet   as stream; # Inlet stream
    93 out     Outlet  as stream; # Outlet stream
    94         V       as volume          (Brief="Volume", DisplayUnit='l', Upper=2e3);
    95         r               as reaction_mol(Brief="Rate of reaction", DisplayUnit='mol/l/s');
    96        
    97         EQUATIONS
    98         "Molar balance"
    99         diff(V) = Inlet.F/(-r)/'s';
    100 
    101         "Change time in X"
    102         Outlet.X = time/'s';
    103        
    104         "Molar flow"
    105         Outlet.F = Inlet.F*(1 - Outlet.X);
    106 end
    107 
    108 
    109 #*---------------------------------------------------------------------
    110 * Model of a discreted steady-state, isotermic, and isobaric PFR
    111 *--------------------------------------------------------------------*#
    112 
    113 Model pfr_d
    114         PARAMETERS
    115         N       as Integer              (Brief="Number of discrete points", Default=200);
    116        
    117         VARIABLES
    118 in      Inlet   as stream; # Inlet stream
    119 out     Outlet  as stream; # Outlet stream
    120         V(N)    as volume           (Brief="Volume", DisplayUnit='l', Upper=2e3);
    121         X(N)    as fraction             (Brief="Molar conversion");
    122         dx      as fraction     (Brief="Conversion increment");
    123         r(N)    as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
    124         F(N)    as flow_mol             (Brief="Molar flow", DisplayUnit='mol/s');
    125        
    126         EQUATIONS
    127         "Discrete interval"
    128         dx = X(N)/N;
    129        
    130         for i in [2:N]
    131         "Molar balance"
    132            V(i) - V(i-1) = Inlet.F*dx/(-r(i));
    133         "Discrete molar conversion"
    134            X(i-1) = X(i) - dx;
    135     end
    136        
    137         "Molar flow"
    138         F = Inlet.F*(1 - X);
    139        
    140         "Outlet molar flow"
    141         Outlet.F = F(N);
    142        
    143         "Outlet molar conversion"
    144         Outlet.X = X(N);
    145 end
    146 
    147 
    148 #*---------------------------------------------------------------------
    14956* Estimation of rate of reaction
    15057*--------------------------------------------------------------------*#
     
    18289        EXPERIMENTS
    18390        # FILE                WEIGTH
    184         "raw_data.dat"          1;
     91        "raw_data.dat"          1; # Table 2-1 (Fogler,1999)
    18592
    18693        OPTIONS
     
    193100
    194101#*---------------------------------------------------------------------
     102* Model of a stream
     103*--------------------------------------------------------------------*#
     104
     105Model stream
     106        VARIABLES
     107        F as flow_mol   (Brief="Molar flow", DisplayUnit='mol/s');
     108        X as fraction   (Brief="Molar conversion");
     109end
     110
     111Model source_
     112        ATTRIBUTES
     113        Pallete = true;
     114        Brief   = "Simple inlet stream";
     115        Icon    = "icon/inlet";
     116       
     117        VARIABLES
     118out Outlet      as stream       (Brief="Outlet stream", PosX=1, PosY=0.5);
     119end
     120
     121Model sink_
     122        ATTRIBUTES
     123        Pallete = true;
     124        Brief   = "Simple outlet stream";
     125        Icon    = "icon/outlet";
     126       
     127        VARIABLES
     128in      Inlet   as stream       (Brief="Inlet stream", PosX=0, PosY=0.5);
     129end
     130
     131
     132#*---------------------------------------------------------------------
     133* Model of a steady-state, isotermic, and isobaric CSTR
     134*--------------------------------------------------------------------*#
     135
     136Model simple_cstr
     137        ATTRIBUTES
     138        Pallete = true;
     139        Brief   = "Simple model of a steady-state CSTR";
     140        Icon    = "icon/simple_cstr";
     141       
     142        PARAMETERS
     143        NT              as Integer              (Brief="Number of terms of reaction rate expression", Default=4);
     144        a(NT)   as reaction_mol (Brief="Parameter of reaction rate expression");
     145       
     146        VARIABLES
     147in      Inlet   as stream               (Brief="Inlet stream", PosX=0, PosY=0);
     148out     Outlet  as stream               (Brief="Outlet stream", PosX=1, PosY=1);
     149        r               as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
     150        V       as volume               (Brief="Volume", DisplayUnit='l', Upper=2e3);
     151       
     152        SET
     153        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]*'mol/l/s'; # Estimated
     154       
     155        EQUATIONS
     156        "Component molar balance"
     157        Inlet.F - Outlet.F = (-r)*V;
     158       
     159        "Outlet molar flow"
     160        Outlet.F = Inlet.F*(1 - Outlet.X);
     161       
     162        "Rate of reaction"
     163        (-r) = sum(a*Outlet.X^[0:(NT-1)]);
     164end
     165
     166
     167#*---------------------------------------------------------------------
     168* Model of a steady-state, isotermic, and isobaric PFR
     169*--------------------------------------------------------------------*#
     170
     171Model simple_pfr       
     172        PARAMETERS
     173        NT              as Integer              (Brief="Number of terms of reaction rate expression", Default=4);
     174        a(NT)   as reaction_mol (Brief="Parameter of reaction rate expression");
     175       
     176        VARIABLES
     177in      Inlet   as stream               (Brief="Inlet stream");
     178out     Outlet  as stream               (Brief="Outlet stream");
     179        V       as volume               (Brief="Volume", DisplayUnit='l', Upper=2e3);
     180        r               as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
     181       
     182        SET
     183        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]*'mol/l/s'; # Estimated
     184       
     185        EQUATIONS
     186        "Molar balance"
     187        diff(V) = Inlet.F/(-r)/'s';
     188
     189        "Change time in X"
     190        Outlet.X = time/'s';
     191       
     192        "Molar flow"
     193        Outlet.F = Inlet.F*(1 - Outlet.X);
     194       
     195        "Rate of reaction"
     196#       (-r) = sum(a*Outlet.X^[0:(NT-1)]); # NOT CONVERGE
     197        (-r) = (a(4)*Outlet.X^3 + a(3)*Outlet.X^2 + a(2)*Outlet.X + a(1));
     198end
     199
     200
     201#*---------------------------------------------------------------------
     202* Model of a discreted steady-state, isotermic, and isobaric PFR
     203*--------------------------------------------------------------------*#
     204
     205Model simple_pfr_d
     206        ATTRIBUTES
     207        Pallete = true;
     208        Brief   = "Simple model of a steady-state PFR";
     209        Icon    = "icon/simple_pfr";
     210       
     211        PARAMETERS
     212        N       as Integer              (Brief="Number of discrete points", Default=200);
     213        NT              as Integer              (Brief="Number of terms of reaction rate expression", Default=4);
     214        a(NT)   as reaction_mol (Brief="Parameter of reaction rate expression");
     215       
     216        VARIABLES
     217in      Inlet   as stream               (Brief="Inlet stream", PosX=0, PosY=0.5);
     218out     Outlet  as stream               (Brief="Outlet stream", PosX=1, PosY=0.5);
     219        V(N)    as volume           (Brief="Volume", DisplayUnit='l', Upper=2e3);
     220        r(N)    as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
     221        F(N)    as flow_mol             (Brief="Molar flow", DisplayUnit='mol/s');
     222        X(N)    as fraction             (Brief="Molar conversion");
     223        dx      as fraction     (Brief="Conversion increment");
     224       
     225        SET
     226        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]*'mol/l/s'; # Estimated
     227       
     228        EQUATIONS
     229        "Outlet molar flow"
     230        Outlet.F = F(N);
     231       
     232        "Outlet molar conversion"
     233        Outlet.X = X(N);
     234       
     235        "Discrete interval"
     236        dx = Outlet.X/N;
     237       
     238        for i in [2:N]
     239        "Molar balance"
     240           V(i) - V(i-1) = Inlet.F*dx/(-r(i));
     241        "Discrete molar conversion"
     242           X(i-1) = X(i) - dx;
     243    end
     244       
     245        "Molar flow"
     246        F = Inlet.F*(1 - X);
     247       
     248        for i in [1:N]
     249        "Rate of reaction"
     250                (-r(i)) = sum(a*X(i)^[0:(NT-1)]);
     251        end     
     252end
     253
     254
     255#*---------------------------------------------------------------------
    195256* Example 2-2: Scale-up an isotermic CSTR in gaseous phase
    196257*--------------------------------------------------------------------*#
     
    198259FlowSheet cstr_sample
    199260        PARAMETERS
    200         NT      as Integer              (Brief="Number of terms of rate of reaction expression", Default=4);
    201         a(NT) as Real           (Brief="Parameter of rate of reaction expression");
    202        
    203261        R       as Real                 (Brief="Universal gas constant", Unit='atm*l/mol/K', Default=0.082);
    204262        T       as temperature  (Brief="Temperatura in the reactor");
     
    212270        DEVICES
    213271        Inlet   as stream; # Inlet stream
    214         R1              as cstr;
     272        R1              as simple_cstr;
    215273
    216274        CONNECTIONS
     
    220278        "Inlet molar flow"
    221279        Inlet.F = (zin*P/(R*T))*v0;
    222        
    223         "Rate of reaction"
    224         (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    225280       
    226281        "Total reactor volume"
     
    228283       
    229284        SET
    230         a       = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    231285        v0  = 6.0*'l/s';
    232286        T       = 422.2*'K';
     
    250304
    251305FlowSheet pfr_sample
    252         PARAMETERS
    253         NT              as Integer      (Brief="Number of terms", Default=4);
    254         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    255        
    256         DEVICES
    257         Inlet   as stream; # Inlet stream
    258         R1              as pfr;
     306        DEVICES
     307        Inlet   as stream; # Inlet stream
     308        R1              as simple_pfr;
    259309       
    260310        CONNECTIONS
    261311        Inlet   to R1.Inlet;
    262        
    263         EQUATIONS
    264         "Rate of reaction"
    265         (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    266        
    267         SET
    268         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    269312       
    270313        SPECIFY
     
    289332
    290333FlowSheet pfr_d_sample
    291         PARAMETERS
    292         NT              as Integer      (Brief="Number of terms", Default=4);
    293         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    294        
    295334        VARIABLES
    296335        Vt              as volume       (Brief="Total reactor volume", DisplayUnit='l');
     
    298337        DEVICES
    299338        Inlet   as stream; # Inlet stream
    300         R1              as pfr_d;
     339        R1              as simple_pfr_d;
    301340
    302341        CONNECTIONS
     
    304343       
    305344        EQUATIONS
    306         "Rate of reaction"
    307         (-R1.r) = (a(4)*R1.X^3 + a(3)*R1.X^2 + a(2)*R1.X +a(1))*'mol/l/s';
    308        
    309345        "Total reactor volume"
    310346        Vt = R1.V(R1.N);
     
    312348        SET
    313349#       R1.N = 100;
    314         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    315350       
    316351        SPECIFY
     
    335370
    336371FlowSheet comparative
    337         PARAMETERS
    338         NT              as Integer      (Brief="Number of terms", Default=4);
    339         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    340        
    341372        VARIABLES
    342373        V_cstr  as volume       (Brief="CSTR volume", DisplayUnit='l');
     
    345376        DEVICES
    346377        Inlet   as stream; # Inlet stream
    347         CSTR    as cstr;
    348         PFR             as pfr_d;
     378        CSTR    as simple_cstr;
     379        PFR             as simple_pfr_d;
    349380
    350381        CONNECTIONS
     
    353384       
    354385        EQUATIONS
    355         "Rate of reaction in CSTR"
    356         (-CSTR.r) = (a(4)*CSTR.Outlet.X^3 + a(3)*CSTR.Outlet.X^2 + a(2)*CSTR.Outlet.X + a(1))*'mol/l/s';
    357         "Rate of reaction in PFR"
    358         (-PFR.r) = (a(4)*PFR.X^3 + a(3)*PFR.X^2 + a(2)*PFR.X + a(1))*'mol/l/s';
    359        
    360386        "CSTR volume"
    361387        V_cstr = CSTR.V;
     388       
    362389        "PFR volume"
    363390        V_pfr = PFR.V(PFR.N);
     
    365392        SET
    366393#       PFR.N = 100;
    367         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    368394       
    369395        SPECIFY
     
    391417
    392418FlowSheet cstr_cstr
    393         PARAMETERS
    394         NT              as Integer      (Brief="Number of terms", Default=4);
    395         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    396        
    397419        VARIABLES
    398420        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    402424        DEVICES
    403425        Inlet   as stream; # Inlet stream
    404         R1              as cstr;
    405         R2              as cstr;
     426        R1              as simple_cstr;
     427        R2              as simple_cstr;
    406428
    407429        CONNECTIONS
     
    410432       
    411433        EQUATIONS
    412         "Rate of reaction in 1st reactor"
    413         (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    414         "Rate of reaction in 2nd reactor"
    415         (-R2.r) = (a(4)*R2.Outlet.X^3 + a(3)*R2.Outlet.X^2 + a(2)*R2.Outlet.X + a(1))*'mol/l/s';
    416        
    417434        "1st volume reactor"
    418435        V1 = R1.V;
     
    422439        Vt = V1 + V2;
    423440       
    424         SET
    425         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    426        
    427441        SPECIFY
    428442        "Inlet molar flow"
     
    446460
    447461FlowSheet pfr_pfr
    448         PARAMETERS
    449         NT              as Integer      (Brief="Number of terms", Default=4);
    450         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    451        
    452462        VARIABLES
    453463        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    457467        DEVICES
    458468        Inlet   as stream; # Inlet stream
    459         R1              as pfr_d;
    460         R2              as pfr_d;
     469        R1              as simple_pfr_d;
     470        R2              as simple_pfr_d;
    461471
    462472        CONNECTIONS
     
    465475       
    466476        EQUATIONS
    467         "Rate of reaction in 1st reactor"
    468         (-R1.r) = (a(4)*R1.X^3 + a(3)*R1.X^2 + a(2)*R1.X + a(1))*'mol/l/s';
    469         "Rate of reaction in 2nd reactor"
    470         (-R2.r) = (a(4)*R2.X^3 + a(3)*R2.X^2 + a(2)*R2.X + a(1))*'mol/l/s';
    471        
    472477        "1st reactor volume"
    473478        V1 = R1.V(R1.N);
     
    477482        Vt = V1 + V2;
    478483       
    479         SET
    480         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    481        
    482484        SPECIFY
    483485        "Inlet molar flow"
     
    506508
    507509FlowSheet pfr_cstr
    508         PARAMETERS
    509         NT              as Integer      (Brief="Number of terms", Default=4);
    510         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    511        
    512510        VARIABLES
    513511        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    517515        DEVICES
    518516        Inlet   as stream; # Inlet stream
    519         R1              as pfr_d;
    520         R2              as cstr;
     517        R1              as simple_pfr_d;
     518        R2              as simple_cstr;
    521519
    522520        CONNECTIONS
     
    525523       
    526524        EQUATIONS
    527         "Rate of reaction in 1st reactor"
    528         (-R1.r) = (a(4)*R1.X^3 + a(3)*R1.X^2 + a(2)*R1.X + a(1))*'mol/l/s';
    529         "Rate of reaction in 2nd reactor"
    530         (-R2.r) = (a(4)*R2.Outlet.X^3 + a(3)*R2.Outlet.X^2 + a(2)*R2.Outlet.X + a(1))*'mol/l/s';
    531        
    532525        "1st reactor volume"
    533526        V1 = R1.V(R1.N);
     
    539532        SET
    540533#       R1.N = 100;
    541         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    542534       
    543535        SPECIFY
     
    565557
    566558FlowSheet cstr_pfr
    567         PARAMETERS
    568         NT              as Integer      (Brief="Number of terms", Default=4);
    569         a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
    570        
    571559        VARIABLES
    572560        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    576564        DEVICES
    577565        Inlet   as stream; # Inlet stream
    578         R1              as cstr;
    579         R2              as pfr_d;
     566        R1              as simple_cstr;
     567        R2              as simple_pfr_d;
    580568
    581569        CONNECTIONS
     
    584572       
    585573        EQUATIONS
    586         "Rate of reaction in 1st reactor"
    587         (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    588         "Rate of reaction in 2nd reactor"
    589         (-R2.r) = (a(4)*R2.X^3 + a(3)*R2.X^2 + a(2)*R2.X + a(1))*'mol/l/s';
    590        
    591574        "1st reactor volume"
    592575        V1 = R1.V;
     
    598581        SET
    599582#       R2.N = 100;
    600         a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    601583       
    602584        SPECIFY
Note: See TracChangeset for help on using the changeset viewer.