source: branches/gui/sample/miscellaneous/sample_high_index_optimal.mso @ 695

Last change on this file since 695 was 695, checked in by Rafael de Pelegrini Soares, 14 years ago

Added a high index sample (not yet finished)

File size: 2.5 KB
RevLine 
[695]1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*--------------------------------------------------------------------
16* Sample file for for a high-index optimal control problem.
17*--------------------------------------------------------------------
18* Author: Rafael de Pelegrini Soares
19* $Id$
20*--------------------------------------------------------------------*#
21using "types";
22
23Model FlashRaoult
24        ATTRIBUTES
25        Info = "
26        This is a very simple (wrong) model with dynamics only on the energy.
27       
28        It should be used for ilustration purposes only.";
29       
30        PARAMETERS
31        NComp as Integer;
32       
33        # Antoine constants
34        A(NComp) as Real;
35        B(NComp) as Real;
36        C(NComp) as Real;
37       
38        Cv as Real(Unit = 'J/mol/K');
39        DHvap as energy_mol;
40
41        VARIABLES
42        F as flow_mol;
43        L as flow_mol;
44        V as flow_mol;
45        z(NComp) as fraction;
46        x(NComp) as fraction;
47        y(NComp) as fraction;
48        n(NComp) as mol;
49        nt       as mol;
50       
51        T as temperature;
52        P as pressure;
53        Psat(NComp) as pressure;
54       
55        Q as power;
56        E as energy;
57       
58        EQUATIONS       
59        "Component Molar Balance"
60        diff(n) = F*z - (L*x + V*y);
61       
62        nt = sum(n);
63        x = n/nt;
64       
65        "Energy Balance"
66        diff(E) = Q - V*DHvap;
67       
68        "Internal energy"
69        E = nt*Cv*T;
70       
71        "Raoult's Law"
72        P*y = Psat*x;
73       
74        "Antoine for Vapour Pressure"
75        ln(Psat/'kPa') = A - B/(T/'K'- 273.15 + C);
76       
77        "Molar Fraction sum"
78        sum(y) = 1;
79end
80
81
82FlowSheet FlashRaoultTest
83        DEVICES
84        fl as FlashRaoult;
85       
86        SET
87        fl.NComp = 3;
88        # Antoine constants (Acetone, Acetonitrile, Nitromethane)
89        fl.A = [14.31, 14.89, 14.75];
90        fl.B = [2756,  3413,  3331];
91        fl.C = [228,   250,   227];
92       
93        fl.Cv = 30 * 'J/mol/K';
94        fl.DHvap = 30 * 'kJ/mol';
95       
96        EQUATIONS
97        if time < 1 * 'min' then
98                fl.z = [0.45, 0.35, 0.2];
99        else
100                fl.z = [0.55, 0.25, 0.2];
101        end
102
103
104        SPECIFY
105        # Feed conditions
106        fl.F = 1 * 'kmol/h';
107       
108        fl.V = 0.1 * 'kmol/h';
109        fl.L = 0.2 * 'kmol/h';
110       
111        # Operating conditions
112        #fl.T = (80+273.15) * 'K';
113        fl.Q = 0 * 'W';
114        #fl.P = 1.2 * 'atm';
115       
116        INITIAL
117        fl.T = (80+273.15) * 'K';
118        fl.x = [0.55, 0.25];
119       
120        OPTIONS
121        TimeEnd = 2;
122        TimeStep = 0.01;
123        TimeUnit = 'min';
124        Dynamic = true;
125end
Note: See TracBrowser for help on using the repository browser.