Ignore:
Timestamp:
Jul 10, 2007, 4:28:27 PM (16 years ago)
Author:
Rodolfo Rodrigues
Message:

Added parameter estimation for reaction rate

File:
1 edited

Legend:

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

    r188 r309  
    149149
    150150#*---------------------------------------------------------------------
     151* Estimation of rate of reaction
     152*--------------------------------------------------------------------*#
     153
     154FlowSheet rate
     155        PARAMETERS
     156        a1              as Real                 (Brief="Parameter to estimate", Default=0.01);
     157        a2              as Real                 (Brief="Parameter to estimate", Default=0.01);
     158        a3              as Real                 (Brief="Parameter to estimate", Default=0.01);
     159        a4              as Real                 (Brief="Parameter to estimate", Default=0.01);
     160
     161        VARIABLES
     162        r               as reaction_mol (Brief="Rate of reaction", DisplayUnit='mol/l/s');
     163        X               as fraction             (Brief="Molar conversion", Unit='mol/mol');
     164       
     165        EQUATIONS
     166        "Rate of reaction" # Attributed expression
     167        (-r) = (a4*X^3 + a3*X^2 + a2*X + a1)*'mol/l/s';
     168       
     169        SPECIFY
     170        X = 0.5;
     171
     172        OPTIONS
     173        Dynamic = false;
     174end
     175
     176Estimation rate_of_reaction as rate
     177        ESTIMATE
     178        # PAR   START   LOWER  UPPER    UNIT
     179        a1              0.01    -1              1;
     180        a2              0.01    -1              1;
     181        a3              0.01    -1              1;
     182        a4              0.01    -1              1;
     183
     184        EXPERIMENTS
     185        # FILE                WEIGTH
     186        "raw_data.dat"          1;
     187
     188        OPTIONS
     189        NLPSolver(File = "ipopt_emso",
     190                ObjTol = 1e-6,
     191                AcceptableObjTol = 1e-6);
     192        Dynamic = false;
     193end
     194
     195
     196#*---------------------------------------------------------------------
    151197* Example 2-2: Scale-up an isotermic CSTR in gaseous phase
    152198*--------------------------------------------------------------------*#
     
    154200FlowSheet cstr_sample
    155201        PARAMETERS
     202        NT      as Integer              (Brief="Number of terms of rate of reaction expression", Default=4);
     203        a(NT) as Real           (Brief="Parameter of rate of reaction expression");
     204       
    156205        R       as Real                 (Brief="Universal gas constant", Unit='atm*l/mol/K', Default=0.082);
    157206        T       as temperature  (Brief="Temperatura in the reactor");
     
    175224       
    176225        "Rate of reaction"
    177         (-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*'mol/l/s';
     226        (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    178227       
    179228        "Total reactor volume"
    180229        Vt = R1.V;
    181230       
    182         SPECIFY
    183         "Inlet conversion"
    184         Inlet.X = 0.0;
    185         "Required conversion"
    186         R1.Outlet.X = 0.8;
    187        
    188         SET
     231        SET
     232        a       = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    189233        v0  = 6.0*'l/s';
    190234        T       = 422.2*'K';
     
    192236        zin     = 0.5;
    193237       
     238        SPECIFY
     239        "Inlet conversion"
     240        Inlet.X = 0.0;
     241        "Required conversion"
     242        R1.Outlet.X = 0.8;
     243       
    194244        OPTIONS
    195245        Dynamic = false;
     
    202252
    203253FlowSheet pfr_sample
     254        PARAMETERS
     255        NT              as Integer      (Brief="Number of terms", Default=4);
     256        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     257       
    204258        DEVICES
    205259        Inlet   as stream; # Inlet stream
     
    211265        EQUATIONS
    212266        "Rate of reaction"
    213         (-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*'mol/l/s';
     267        (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
     268       
     269        SET
     270        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    214271       
    215272        SPECIFY
     
    234291
    235292FlowSheet pfr_d_sample
     293        PARAMETERS
     294        NT              as Integer      (Brief="Number of terms", Default=4);
     295        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     296       
    236297        VARIABLES
    237298        Vt              as volume       (Brief="Total reactor volume", DisplayUnit='l');
     
    246307        EQUATIONS
    247308        "Rate of reaction"
    248         (-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*'mol/l/s';
     309        (-R1.r) = (a(4)*R1.X^3 + a(3)*R1.X^2 + a(2)*R1.X +a(1))*'mol/l/s';
    249310       
    250311        "Total reactor volume"
    251312        Vt = R1.V(R1.N);
    252313
    253 #       SET
    254 #       R1.N    = 100;
     314        SET
     315#       R1.N = 100;
     316        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    255317       
    256318        SPECIFY
     
    275337
    276338FlowSheet comparative
     339        PARAMETERS
     340        NT              as Integer      (Brief="Number of terms", Default=4);
     341        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     342       
    277343        VARIABLES
    278344        V_cstr  as volume       (Brief="CSTR volume", DisplayUnit='l');
     
    290356        EQUATIONS
    291357        "Rate of reaction in CSTR"
    292         (-CSTR.r) = (0.0092*CSTR.Outlet.X^3 - 0.0153*CSTR.Outlet.X^2 + 0.0013*CSTR.Outlet.X + 0.0053)*'mol/l/s';
     358        (-CSTR.r) = (a(4)*CSTR.Outlet.X^3 + a(3)*CSTR.Outlet.X^2 + a(2)*CSTR.Outlet.X + a(1))*'mol/l/s';
    293359        "Rate of reaction in PFR"
    294         (-PFR.r) = (0.0092*PFR.X^3 - 0.0153*PFR.X^2 + 0.0013*PFR.X + 0.0053)*'mol/l/s';
     360        (-PFR.r) = (a(4)*PFR.X^3 + a(3)*PFR.X^2 + a(2)*PFR.X + a(1))*'mol/l/s';
    295361       
    296362        "CSTR volume"
     
    299365        V_pfr = PFR.V(PFR.N);
    300366       
    301 #       SET
    302 #       PFR.N   = 100;
     367        SET
     368#       PFR.N = 100;
     369        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    303370       
    304371        SPECIFY
     
    326393
    327394FlowSheet cstr_cstr
     395        PARAMETERS
     396        NT              as Integer      (Brief="Number of terms", Default=4);
     397        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     398       
    328399        VARIABLES
    329400        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    342413        EQUATIONS
    343414        "Rate of reaction in 1st reactor"
    344         (-R1.r) = (0.0092*R1.Outlet.X^3 - 0.0153*R1.Outlet.X^2 + 0.0013*R1.Outlet.X + 0.0053)*'mol/l/s';
     415        (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    345416        "Rate of reaction in 2nd reactor"
    346         (-R2.r) = (0.0092*R2.Outlet.X^3 - 0.0153*R2.Outlet.X^2 + 0.0013*R2.Outlet.X + 0.0053)*'mol/l/s';
     417        (-R2.r) = (a(4)*R2.Outlet.X^3 + a(3)*R2.Outlet.X^2 + a(2)*R2.Outlet.X + a(1))*'mol/l/s';
    347418       
    348419        "1st volume reactor"
     
    353424        Vt = V1 + V2;
    354425       
     426        SET
     427        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
     428       
    355429        SPECIFY
    356430        "Inlet molar flow"
     
    374448
    375449FlowSheet pfr_pfr
     450        PARAMETERS
     451        NT              as Integer      (Brief="Number of terms", Default=4);
     452        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     453       
    376454        VARIABLES
    377455        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    390468        EQUATIONS
    391469        "Rate of reaction in 1st reactor"
    392         (-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*'mol/l/s';
     470        (-R1.r) = (a(4)*R1.X^3 + a(3)*R1.X^2 + a(2)*R1.X + a(1))*'mol/l/s';
    393471        "Rate of reaction in 2nd reactor"
    394         (-R2.r) = (0.0092*R2.X^3 - 0.0153*R2.X^2 + 0.0013*R2.X + 0.0053)*'mol/l/s';
     472        (-R2.r) = (a(4)*R2.X^3 + a(3)*R2.X^2 + a(2)*R2.X + a(1))*'mol/l/s';
    395473       
    396474        "1st reactor volume"
     
    401479        Vt = V1 + V2;
    402480       
     481        SET
     482        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
     483       
    403484        SPECIFY
    404485        "Inlet molar flow"
     
    427508
    428509FlowSheet pfr_cstr
     510        PARAMETERS
     511        NT              as Integer      (Brief="Number of terms", Default=4);
     512        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     513       
    429514        VARIABLES
    430515        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    443528        EQUATIONS
    444529        "Rate of reaction in 1st reactor"
    445         (-R1.r) = (0.0092*R1.X^3 - 0.0153*R1.X^2 + 0.0013*R1.X + 0.0053)*'mol/l/s';
     530        (-R1.r) = (a(4)*R1.X^3 + a(3)*R1.X^2 + a(2)*R1.X + a(1))*'mol/l/s';
    446531        "Rate of reaction in 2nd reactor"
    447         (-R2.r) = (0.0092*R2.Outlet.X^3 - 0.0153*R2.Outlet.X^2 + 0.0013*R2.Outlet.X + 0.0053)*'mol/l/s';
     532        (-R2.r) = (a(4)*R2.Outlet.X^3 + a(3)*R2.Outlet.X^2 + a(2)*R2.Outlet.X + a(1))*'mol/l/s';
    448533       
    449534        "1st reactor volume"
     
    454539        Vt = V1 + V2;
    455540       
    456 #       SET
    457 #       R1.N    = 100;
     541        SET
     542#       R1.N = 100;
     543        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    458544       
    459545        SPECIFY
     
    481567
    482568FlowSheet cstr_pfr
     569        PARAMETERS
     570        NT              as Integer      (Brief="Number of terms", Default=4);
     571        a(NT)   as Real         (Brief="Parameter of rate of reaction expression");
     572       
    483573        VARIABLES
    484574        V1              as volume       (Brief="1st reactor volume", DisplayUnit='l');
     
    497587        EQUATIONS
    498588        "Rate of reaction in 1st reactor"
    499         (-R1.r) = (9.2*R1.Outlet.X^3 - 15.3*R1.Outlet.X^2 + 1.3*R1.Outlet.X + 5.3)*1e-3*'mol/l/s';
     589        (-R1.r) = (a(4)*R1.Outlet.X^3 + a(3)*R1.Outlet.X^2 + a(2)*R1.Outlet.X + a(1))*'mol/l/s';
    500590        "Rate of reaction in 2nd reactor"
    501         (-R2.r) = (9.2*R2.X^3 - 15.3*R2.X^2 + 1.3*R2.X + 5.3)*1e-3*'mol/l/s';
     591        (-R2.r) = (a(4)*R2.X^3 + a(3)*R2.X^2 + a(2)*R2.X + a(1))*'mol/l/s';
    502592       
    503593        "1st reactor volume"
     
    508598        Vt = V1 + V2;
    509599       
    510 #       SET
    511 #       R2.N    = 100;
     600        SET
     601#       R2.N = 100;
     602        a = [0.00526633, 0.00133478, -0.0153321, 0.0092151]; # Estimated
    512603       
    513604        SPECIFY
Note: See TracChangeset for help on using the changeset viewer.