Changeset 698 for branches/gui/eml


Ignore:
Timestamp:
Dec 11, 2008, 7:30:42 PM (15 years ago)
Author:
gerson bicca
Message:

added heat_flow model for control purposes - starting to modify the reactive distillation column (BRANCH)

Location:
branches/gui/eml
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/eml/stage_separators/column.mso

    r694 r698  
    13171317*  Reactive Distillation Column
    13181318*
    1319 * ------------------------------------------------------------------*
     1319* ------------------------------------------------------------------*#
    13201320Model ReactiveDistillation
    13211321       
    13221322ATTRIBUTES
    13231323        Pallete         = true;
    1324         Icon            = "icon/DistillationKettleCond";
     1324        Icon            = "icon/DistillationReac";
    13251325        Brief           = "Model of a reactive distillation column with dynamic condenser and reboiler.";
    13261326        Info            =
     
    13491349";
    13501350       
    1351         PARAMETERS
     1351PARAMETERS
     1352       
    13521353        outer PP as Plugin(Type="PP");
    13531354        outer NComp as Integer;
     1355
    13541356        NumberOfTrays as Integer(Brief="Number of TRAYS", Default=2);
    1355         topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
    1356         top as Integer(Brief="Number of top tray");
    1357         bot as Integer(Brief="Number of bottom tray");
     1357
     1358        FeedTrayIndex(NumberOfTrays)                    as Integer                      (Brief="Number of trays", Default=0,Hidden=true);
     1359        LiqSideTrayIndex(NumberOfTrays)                 as Integer                      (Brief="Number of trays", Default=0,Hidden=true);
     1360        VapSideTrayIndex(NumberOfTrays)         as Integer                      (Brief="Number of trays", Default=0,Hidden=true);
     1361        FeedTrayLocation                                                                        as Integer                      (Brief="Feed tray Location", Default=2);
     1362        LiquidSideStreamLocation                                                as Integer                      (Brief="Liquid Side Stream Location", Default=2);
     1363        VapourSideStreamLocation                                        as Integer                      (Brief="Vapour Side Stream Location", Default=2);
     1364
    13581365        alfacond as Real;
    13591366
    1360         VapourFlow as Switcher(Valid = ["on", "off"], Default = "off");
    1361        
    1362         SET
    1363         top = (NumberOfTrays-1)*(1-topdown)/2+1;
    1364         bot = NumberOfTrays/top;
    1365        
    1366         VARIABLES
    1367         TRAYS(NumberOfTrays) as trayReactTeste;
    1368         cond as condenserReact;
    1369         reb as reboilerReact;
    1370         sp as splitter;
    1371         p as pump;
    1372        
    1373         EQUATIONS
    1374        
    1375         switch VapourFlow
     1367        VapourFlow                      as Switcher     (Valid = ["on", "off"], Default = "off",Hidden=true);
     1368        TrayVapourFlow  as Switcher     (Valid = ["on", "off"], Default = "off",Hidden=true);
     1369        TrayLiquidFlow          as Switcher     (Valid = ["on", "off"], Default = "off",Hidden=true);
     1370
     1371        V       as volume                               (Brief="Total Volume of the tray",Hidden=true);
     1372        Q       as power                                (Brief="Rate of heat supply",Hidden=true);
     1373        Ap      as area                                         (Brief="Plate area = Atray - Adowncomer",Hidden=true);
     1374        Ah      as      area                            (Brief="Total holes area",Hidden=true);
     1375        lw      as      length                          (Brief="Weir length",Hidden=true);
     1376        g               as acceleration                 (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
     1377        hw      as      length                          (Brief="Weir height",Hidden=true);
     1378        beta as         fraction                        (Brief="Aeration fraction");
     1379        alfa    as      fraction                        (Brief="Dry pressure drop coefficient");
     1380
     1381        VolumeOfTray            as volume               (Brief="Total Volume of the tray");
     1382        HeatSupply                      as heat_rate    (Brief="Rate of heat supply");
     1383        PlateArea                               as area                         (Brief="Plate area = Atray - Adowncomer");
     1384        HolesArea                               as area                         (Brief="Total holes area");
     1385        WeirLength                              as length               (Brief="Weir length");
     1386        WeirHeight                              as length               (Brief="Weir height");
     1387
     1388SET
     1389
     1390        FeedTrayIndex(FeedTrayLocation)                 =1;
     1391        VapSideTrayIndex(FeedTrayLocation)      =1;
     1392        LiqSideTrayIndex(FeedTrayLocation)      =1;
     1393
     1394        V=VolumeOfTray;
     1395        Q=HeatSupply;
     1396        Ap=PlateArea;
     1397        Ah=HolesArea;
     1398        lw=WeirLength;
     1399        hw=WeirHeight ;
     1400       
     1401VARIABLES
     1402       
     1403        in      FeedTray                        as stream                               (Brief="Feed stream", PosX=0, PosY=0.55);
     1404       
     1405        VapourDrawOffFlow  as flow_mol          (Brief = "Stream Molar Flow Rate");
     1406        LiquidDrawOffFlow   as flow_mol                         (Brief = "Stream Molar Flow Rate");
     1407       
     1408        out     VapourDrawOff   as vapour_stream                (Brief="Vapour Outlet in the section", PosX=1, PosY=0.46,Protected = true);
     1409        out     LiquidDrawOff           as liquid_stream                        (Brief="Liquid Outlet in the section", PosX=1, PosY=0.58,Protected = true);
     1410       
     1411        RebNoFlow       as sourceNoFlow (Brief="No Inlet Flow to Reboiler",Hidden=true);
     1412       
     1413        in              HeatToReboiler                          as power                                (Brief="Heat supplied to Reboiler", PosX=1, PosY=0.93);
     1414        in              HeatToCondenser                 as power                                (Brief="Heat supplied to Condenser", PosX=1, PosY=0.10);
     1415
     1416        TRAYS(NumberOfTrays)    as trayReac;
     1417        CONDENSER                                       as condenserReact;
     1418        REBOILER                                                as reboilerReact;
     1419        SPLITTER                                                        as splitter;
     1420        PUMP                                                                    as pump;
     1421
     1422out     VapourDistillate                                as vapour_stream        (Brief="Vapour outlet stream From Top Condenser", PosX=0.67, PosY=0);
     1423in              ConnectorCondenserVout  as stream       (Brief="Connector for Vapour outlet stream From Top Condenser", Hidden=true);
     1424
     1425out     LiquidDistillate                                as liquid_stream        (Brief="Liquid outlet stream From Top Splitter", PosX=1, PosY=0.33);
     1426in              ConnectorSplitterOut    as stream       (Brief="Connector for Liquid outlet stream From Top Splitter", Hidden=true);
     1427
     1428out     BottomProduct                           as liquid_stream        (Brief="Liquid outlet stream From Reboiler", PosX=1, PosY=0.99);
     1429in              ConnectorReboilerLout   as stream       (Brief="Connector for Liquid outlet stream From Reboiler", Hidden=true);
     1430
     1431
     1432CONNECTIONS
     1433#vapor
     1434        REBOILER.OutletV                                                                to TRAYS(NumberOfTrays).InletV;
     1435        TRAYS(1).OutletV                                                                        to CONDENSER.InletV;
     1436        TRAYS([2:NumberOfTrays]).OutletV        to TRAYS([1:NumberOfTrays-1]).InletV;
     1437
     1438#liquid
     1439        CONDENSER.OutletL                                                               to SPLITTER.Inlet;     
     1440        SPLITTER.Outlet2                                                                        to PUMP.Inlet;
     1441        PUMP.Outlet                                                                                             to TRAYS(1).InletL;
     1442        TRAYS([1:NumberOfTrays-1]).OutletL      to TRAYS([2:NumberOfTrays]).InletL;
     1443        TRAYS(NumberOfTrays).OutletL                    to REBOILER.InletL;
     1444
     1445#Connectors
     1446RebNoFlow.Outlet  to REBOILER.Inlet;
     1447
     1448CONDENSER.OutletV to ConnectorCondenserVout;
     1449SPLITTER.Outlet1                to ConnectorSplitterOut;
     1450REBOILER.OutletL        to ConnectorReboilerLout;
     1451
     1452EQUATIONS
     1453
     1454for i in [1:NumberOfTrays] do
     1455
     1456"Energy Holdup"
     1457        TRAYS(i).E = TRAYS(i).ML*TRAYS(i).OutletL.h + TRAYS(i).MV*TRAYS(i).OutletV.h - TRAYS(i).OutletL.P*V;
     1458
     1459"Energy Balance"
     1460        diff(TRAYS(i).E) = ( TRAYS(i).Inlet.F*TRAYS(i).Inlet.h + TRAYS(i).InletL.F*TRAYS(i).InletL.h + TRAYS(i).InletV.F*TRAYS(i).InletV.h- TRAYS(i).OutletL.F*TRAYS(i).OutletL.h - TRAYS(i).OutletV.F*TRAYS(i).OutletV.h
     1461        -TRAYS(i).VapourSideStream.F*TRAYS(i).VapourSideStream.h - TRAYS(i).LiquidSideStream.F*TRAYS(i).LiquidSideStream.h + Q ) + TRAYS(i).Hr * TRAYS(i).r3 *TRAYS(i). vL*TRAYS(i).ML;
     1462
     1463"Level of clear liquid over the weir"
     1464        TRAYS(i).Level = TRAYS(i).ML*TRAYS(i).vL/Ap;
     1465
     1466"Geometry Constraint"
     1467        V = TRAYS(i).ML* TRAYS(i).vL + TRAYS(i).MV*TRAYS(i).vV;
     1468
     1469end
     1470
     1471switch VapourFlow
    13761472                case "on":
    13771473                "Pressure Drop through the condenser"
    1378                 cond.InletV.F*TRAYS(top).vV / 'm^2' =
    1379                         sqrt((TRAYS(top).OutletV.P - cond.OutletL.P + 1e-8 * 'atm')/(TRAYS(top).rhoV*alfacond));
    1380                 when TRAYS(top).OutletV.P < cond.OutletL.P switchto "off";
     1474                CONDENSER.InletV.F*TRAYS(1).vV / 'm^2' =
     1475                        sqrt((TRAYS(1).OutletV.P - CONDENSER.OutletL.P + 1e-8 * 'atm')/(TRAYS(1).rhoV*alfacond));
     1476                when TRAYS(1).OutletV.P < CONDENSER.OutletL.P switchto "off";
    13811477               
    13821478                case "off":
    13831479                "Prato selado"
    1384                 cond.InletV.F = 0.0 * 'mol/s';
    1385                 when TRAYS(top).OutletV.P > cond.OutletL.P + 1e-3 * 'atm' switchto "on";
     1480                CONDENSER.InletV.F = 0.0 * 'mol/s';
     1481                when TRAYS(1).OutletV.P > CONDENSER.OutletL.P + 1e-3 * 'atm' switchto "on";
    13861482        end
    13871483
    1388         CONNECTIONS
    1389         #vapor
    1390         reb.OutletV to TRAYS(bot).InletV;
    1391         TRAYS([top+topdown:topdown:bot]).OutletV to TRAYS([top:topdown:bot-topdown]).InletV;
    1392         TRAYS(top).OutletV to cond.InletV;
    1393        
    1394         #liquid
    1395         cond.OutletL to sp.Inlet;       
    1396         sp.Outlet2 to p.Inlet;
    1397         p.Outlet to TRAYS(top).InletL;
    1398         TRAYS([top:topdown:bot-topdown]).OutletL to TRAYS([top+topdown:topdown:bot]).InletL;
    1399         TRAYS(bot).OutletL to reb.InletL;
    1400        
     1484for i in [1:NumberOfTrays] do
     1485
     1486        switch TrayLiquidFlow
     1487                case "on":
     1488                "Francis Equation"
     1489                TRAYS(i).OutletL.F*TRAYS(i).vL = 1.84*'1/s'*lw*((TRAYS(i).Level-(beta*hw)+1e-6*'m')/(beta))^2;
     1490                when TRAYS(i).Level < (beta * hw) switchto "off";
     1491               
     1492                case "off":
     1493                "Low level"
     1494                TRAYS(i).OutletL.F = 0 * 'mol/h';
     1495                when TRAYS(i).Level > (beta * hw) + 1e-6*'m' switchto "on";
     1496        end
     1497
     1498        switch TrayVapourFlow
     1499                case "on":
     1500                TRAYS(i).InletV.F*TRAYS(i).vV = sqrt((TRAYS(i).InletV.P - TRAYS(i).OutletV.P - TRAYS(i).Level*g*TRAYS(i).rhoL + 1e-8 * 'atm')/(TRAYS(i).rhoV*alfa))*Ah;
     1501                when TRAYS(i).InletV.P < TRAYS(i).OutletV.P + TRAYS(i).Level*g*TRAYS(i).rhoL switchto "off";
     1502               
     1503                case "off":
     1504                TRAYS(i).InletV.F = 0 * 'mol/s';
     1505                when TRAYS(i).InletV.P > TRAYS(i).OutletV.P + TRAYS(i).Level*g*TRAYS(i).rhoL + 3e-2 * 'atm' switchto "on";
     1506        end
     1507
     1508end
     1509
     1510# Connecting Trays
     1511        FeedTray.F*FeedTrayIndex= TRAYS.Inlet.F;
     1512        FeedTray.T = TRAYS.Inlet.T;
     1513        FeedTray.P = TRAYS.Inlet.P;
     1514        FeedTray.z = TRAYS.Inlet.z;
     1515        FeedTray.v = TRAYS.Inlet.v;
     1516        FeedTray.h = TRAYS.Inlet.h;
     1517
     1518        HeatToReboiler = REBOILER.InletQ;
     1519        HeatToCondenser         = CONDENSER.InletQ;
     1520
    14011521end
    14021522
  • branches/gui/eml/stage_separators/condenser.mso

    r655 r698  
    187187out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
    188188out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
    189 in      InletQ as power (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
     189        InletQ as power (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
    190190
    191191        M(NComp) as mol (Brief="Molar Holdup in the tray");
  • branches/gui/eml/stage_separators/reboiler.mso

    r649 r698  
    253253out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.2413, PosY=1, Symbol="_{outL}");
    254254out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.5079, PosY=0, Symbol="_{outV}");
    255 in      InletQ as power (Brief="Heat supplied", PosX=1, PosY=0.6123, Symbol="_{in}");
     255        InletQ as power (Brief="Heat supplied", PosX=1, PosY=0.6123, Symbol="_{in}");
    256256
    257257        M(NComp) as mol (Brief="Molar Holdup in the tray");
  • branches/gui/eml/stage_separators/tray.mso

    r676 r698  
    4343VARIABLES
    4444
    45         Inlet                   as stream                               (Brief="Feed stream", Hidden=true, PosX=0, PosY=0.4932, Symbol="_{in}");
    46         LiquidSideStream        as liquid_stream        (Brief="liquid Sidestream", Hidden=true, Symbol="_{outL}");
     45        Inlet                                                   as stream                               (Brief="Feed stream", Hidden=true, PosX=0, PosY=0.4932, Symbol="_{in}");
     46        LiquidSideStream                as liquid_stream        (Brief="liquid Sidestream", Hidden=true, Symbol="_{outL}");
    4747        VapourSideStream        as vapour_stream        (Brief="vapour Sidestream", Hidden=true, Symbol="_{outV}");
    48        
     48
    4949in      InletL                  as stream                               (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
    5050in      InletV                  as stream                               (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
     
    6161        Level                                   as length                       (Brief="Height of clear liquid on plate");
    6262        yideal(NComp)           as fraction;
    63        
    64        
     63
     64
    6565EQUATIONS
    6666"Component Molar Balance"
     
    161161* Model of a tray with reaction
    162162*-------------------------------------------------------------------*#
    163 Model trayReactTeste
     163Model trayReac
    164164        ATTRIBUTES
    165165        Pallete         = false;
     
    187187";
    188188
    189         PARAMETERS
    190         outer PP as Plugin(Type="PP");
    191         outer NComp as Integer;
    192         V as volume(Brief="Total Volume of the tray");
    193         Q as power (Brief="Rate of heat supply");
    194         Ap as area (Brief="Plate area = Atray - Adowncomer");
    195        
    196         Ah as area (Brief="Total holes area");
    197         lw as length (Brief="Weir length");
    198         g as acceleration (Default=9.81);
    199         hw as length (Brief="Weir height");
    200         beta as fraction (Brief="Aeration fraction");
    201         alfa as fraction (Brief="Dry pressure drop coefficient");
    202 
    203         stoic(NComp) as Real(Brief="Stoichiometric matrix");
    204         Hr as energy_mol;
    205         Pstartup as pressure;
    206        
    207         VapourFlow as Switcher(Valid = ["on", "off"], Default = "off");
    208         LiquidFlow as Switcher(Valid = ["on", "off"], Default = "off");
    209        
    210         VARIABLES
    211 in      Inlet as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
    212 in      InletL as stream (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
    213 in      InletV as stream (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
    214 out     OutletL as liquid_stream (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
    215 out     OutletV as vapour_stream (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
    216 
    217         yideal(NComp) as fraction;
    218         Emv as Real (Brief = "Murphree efficiency");
    219 
    220         M(NComp) as mol (Brief="Molar Holdup in the tray");
    221         ML as mol (Brief="Molar liquid holdup");
    222         MV as mol (Brief="Molar vapour holdup");
    223         E as energy (Brief="Total Energy Holdup on tray");
    224         vL as volume_mol (Brief="Liquid Molar Volume");
    225         vV as volume_mol (Brief="Vapour Molar volume");
    226         Level as length (Brief="Height of clear liquid on plate");
    227         Vol as volume;
    228        
    229         rhoL as dens_mass;
    230         rhoV as dens_mass;
    231         r3 as reaction_mol (Brief = "Reaction resulting ethyl acetate", DisplayUnit = 'mol/l/s');
    232         C(NComp) as conc_mol (Brief = "Molar concentration", Lower = -1); #, Unit = "mol/l");
    233        
    234         EQUATIONS
    235         "Molar Concentration"
     189PARAMETERS
     190
     191        outer PP                        as Plugin(Type="PP");
     192        outer NComp     as Integer;
     193       
     194        stoic(NComp)    as Real(Brief="Stoichiometric matrix");
     195        Hr                                              as energy_mol;
     196        Pstartup                                as pressure;
     197       
     198VARIABLES
     199
     200        Inlet                                           as stream                               (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
     201        LiquidSideStream        as liquid_stream        (Brief="liquid Sidestream", Hidden=true, Symbol="_{outL}");
     202        VapourSideStream as vapour_stream       (Brief="vapour Sidestream", Hidden=true, Symbol="_{outV}");
     203       
     204
     205in              InletL          as      stream                          (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
     206in              InletV          as      stream                          (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
     207out     OutletL         as      liquid_stream           (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
     208out     OutletV         as      vapour_stream   (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
     209
     210        yideal(NComp)   as fraction;
     211        Emv                                     as Real (Brief = "Murphree efficiency");
     212
     213        M(NComp)                as mol                          (Brief="Molar Holdup in the tray");
     214        ML                                              as mol                          (Brief="Molar liquid holdup");
     215        MV                                              as mol                          (Brief="Molar vapour holdup");
     216        E                                               as energy                       (Brief="Total Energy Holdup on tray");
     217        vL                                              as volume_mol   (Brief="Liquid Molar Volume");
     218        vV                                              as volume_mol   (Brief="Vapour Molar volume");
     219        Level                                   as length                       (Brief="Height of clear liquid on plate");
     220        Vol                                             as volume;
     221       
     222        rhoL                    as dens_mass;
     223        rhoV                    as dens_mass;
     224        r3                              as reaction_mol         (Brief = "Reaction resulting ethyl acetate", DisplayUnit = 'mol/l/s');
     225        C(NComp)        as conc_mol             (Brief = "Molar concentration", Lower = -1);
     226       
     227EQUATIONS
     228
     229"Molar Concentration"
    236230        OutletL.z = vL * C;
    237231       
    238         "Reaction"
     232"Reaction"
    239233        r3 = exp(-7150*'K'/OutletL.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4))*'l/mol/s';
    240234       
    241         "Component Molar Balance"
    242         diff(M)=Inlet.F*Inlet.z + InletL.F*InletL.z + InletV.F*InletV.z
    243                 - OutletL.F*OutletL.z - OutletV.F*OutletV.z + stoic*r3*ML*vL;
    244        
    245         "Energy Balance"
    246         diff(E) = ( Inlet.F*Inlet.h + InletL.F*InletL.h + InletV.F*InletV.h
    247                 - OutletL.F*OutletL.h - OutletV.F*OutletV.h + Q ) + Hr * r3 * vL*ML;
    248        
    249         "Molar Holdup"
     235"Component Molar Balance"
     236        diff(M)=Inlet.F*Inlet.z + InletL.F*InletL.z + InletV.F*InletV.z- OutletL.F*OutletL.z - OutletV.F*OutletV.z-
     237        LiquidSideStream.F*LiquidSideStream.z-VapourSideStream.F*VapourSideStream.z + stoic*r3*ML*vL;
     238
     239"Molar Holdup"
    250240        M = ML*OutletL.z + MV*OutletV.z;
    251        
    252         "Energy Holdup"
    253         E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V;
    254        
    255         "Mol fraction normalisation"
     241
     242"Thermal Equilibrium Vapour Side Stream"
     243        OutletV.T = VapourSideStream.T;
     244
     245"Thermal Equilibrium Liquid Side Stream"
     246        OutletL.T = LiquidSideStream.T;
     247
     248"Mechanical Equilibrium Vapour Side Stream"
     249        OutletV.P= VapourSideStream.P;
     250
     251"Mechanical Equilibrium Liquid Side Stream"
     252        OutletL.P = LiquidSideStream.P;
     253
     254"Composition Liquid Side Stream"
     255        OutletL.z= LiquidSideStream.z;
     256       
     257"Composition Vapour Side Stream"
     258        OutletV.z= VapourSideStream.z;
     259
     260"Mol fraction normalisation"
    256261        sum(OutletL.z)= 1.0;
    257        
    258         "Liquid Volume"
     262
     263"Liquid Volume"
    259264        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
    260         "Vapour Volume"
     265
     266"Vapour Volume"
    261267        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
    262268
    263         "Thermal Equilibrium"
     269"Thermal Equilibrium"
    264270        OutletV.T = OutletL.T;
    265        
    266         "Mechanical Equilibrium"
     271
     272"Mechanical Equilibrium"
    267273        OutletV.P = OutletL.P;
    268        
    269         "Level of clear liquid over the weir"
    270         Level = ML*vL/Ap;
    271274
    272275        Vol = ML*vL;
    273276       
    274         "Liquid Density"
     277"Liquid Density"
    275278        rhoL = PP.LiquidDensity(OutletL.T, OutletL.P, OutletL.z);
    276         "Vapour Density"
     279
     280"Vapour Density"
    277281        rhoV = PP.VapourDensity(InletV.T, InletV.P, InletV.z);
    278282
    279         switch LiquidFlow
    280                 case "on":
    281                 "Francis Equation"
    282                 OutletL.F*vL = 1.84*'1/s'*lw*((Level-(beta*hw)+1e-6*'m')/(beta))^2;
    283                 when Level < (beta * hw) switchto "off";
    284                
    285                 case "off":
    286                 "Low level"
    287                 OutletL.F = 0 * 'mol/h';
    288                 when Level > (beta * hw) + 1e-6*'m' switchto "on";
    289         end
    290 
    291         switch VapourFlow
    292                 case "on":
    293                 #InletV.P = OutletV.P + Level*g*rhoL + rhoV*alfa*(InletV.F*vV/Ah)^2;
    294                 InletV.F*vV = sqrt((InletV.P - OutletV.P - Level*g*rhoL + 1e-8 * 'atm')/(rhoV*alfa))*Ah;
    295                 when InletV.P < OutletV.P + Level*g*rhoL switchto "off";
    296                
    297                 case "off":
    298                 InletV.F = 0 * 'mol/s';
    299                 when InletV.P > OutletV.P + Level*g*rhoL + 3e-2 * 'atm' switchto "on";
    300                 #when InletV.P > OutletV.P + Level*beta*g*rhoL + 1e-2 * 'atm' switchto "on";
    301         end
    302 
    303         "Chemical Equilibrium"
    304         PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
    305                 PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, yideal)*yideal;
    306        
     283"Chemical Equilibrium"
     284        PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =       PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, yideal)*yideal;
     285
    307286        OutletV.z = Emv * (yideal - InletV.z) + InletV.z;
    308        
     287
    309288        sum(OutletL.z)= sum(OutletV.z);
    310        
    311         "Geometry Constraint"
    312         V = ML* vL + MV*vV;
     289
    313290end
    314291
Note: See TracChangeset for help on using the changeset viewer.