/[ascend]/trunk/models/separation_demos.a4s
ViewVC logotype

Contents of /trunk/models/separation_demos.a4s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download)
Fri Oct 29 20:54:12 2004 UTC (19 years, 10 months ago) by aw0a
File size: 7679 byte(s)
Setting up web subdirectory in repository
1 # This file is part of the ASCEND Modeling Library and is released
2 # under the GNU Public License as described at the end of this file.
3 #
4 # This file demonstrates the use of object passing
5
6 DELETE TYPES;
7 READ FILE "plotcol.a4c";
8
9 # C5/C6/C7 flash. VL feed, vapor and liquid products
10 COMPILE tvlf OF test_vapor_liquid_flash;
11 BROWSE {tvlf};
12 RUN {tvlf.values};
13 ASSIGN tvlf.equilibrated FALSE;
14 RUN {tvlf.reset};
15 SOLVE {tvlf} WITH QRSlv;
16 RUN tvlf.check_self;
17 DELETE SYSTEM;
18 ASSIGN tvlf.equilibrated TRUE;
19 RUN {tvlf.reset};
20 SOLVE {tvlf} WITH QRSlv;
21 RUN tvlf.check_self;
22 # You should see error messages.
23 # Script should stop here. Select more and continue.
24 ASSIGN {tvlf.liq.T} 350 {K};
25 SOLVE {tvlf} WITH QRSlv;
26 RUN tvlf.check_self; # you should see no new error messages, now.
27
28 # Acetone-Benzene-Chloroform flash
29 COMPILE thvlf OF test_hard_vapor_liquid_flash;
30 BROWSE {thvlf};
31 RUN {thvlf.values};
32 ASSIGN thvlf.equilibrated FALSE;
33 RUN {thvlf.reset};
34 SOLVE {thvlf} WITH QRSlv;
35 RUN thvlf.check_self;
36 DELETE SYSTEM;
37 ASSIGN thvlf.equilibrated TRUE;
38 RUN {thvlf.reset};
39 SOLVE {thvlf} WITH QRSlv;
40
41 # bypass user-defined method error handling behavior:
42 global old_btuifstop
43 set old_btuifstop $ascLibrVect(btuifstop); #save old value
44 set ascLibrVect(btuifstop) 1; # force check to ignore STOP statements.
45 RUN thvlf.check_self;
46 # Check should fail because vapor stream
47 # disappears. First failure seen, however,
48 # is the sum of small numbers not properly
49 # scaled in the flow equations.
50 #
51 # Restore error handling behavior:
52 set ascLibrVect(btuifstop) $old_btuifstop
53
54 # Internal Tray
55 COMPILE tt OF test_tray;
56 BROWSE {tt};
57 RUN {tt.values};
58 ASSIGN tt.equilibrated FALSE;
59 RUN {tt.reset};
60 SOLVE {tt} WITH QRSlv;
61 RUN tt.check_self;
62 DELETE SYSTEM
63 ASSIGN tt.equilibrated TRUE;
64 RUN {tt.reset};
65 SOLVE {tt} WITH QRSlv;
66 RUN tt.check_self;
67 RUN tt.Tray.reset_to_adiabatic;
68 SOLVE {tt} WITH QRSlv;
69 RUN tt.check_self;
70
71 # "Simple" feed tray with 1 V/L feed.
72 COMPILE tft OF test_feed_tray;
73 BROWSE {tft};
74 RUN {tft.values};
75 ASSIGN tft.equilibrated FALSE;
76 RUN {tft.reset};
77 SOLVE {tft} WITH QRSlv;
78 RUN tft.check_self;
79 DELETE SYSTEM;
80 ASSIGN tft.equilibrated TRUE;
81 RUN {tft.reset};
82 SOLVE {tft} WITH QRSlv;
83 RUN tft.check_self;
84 RUN {tft.Feed_tray.reset_to_adiabatic};
85 SOLVE {tft} WITH QRSlv;
86 RUN tft.check_self;
87
88 # "Simple" Condenser with 1 liquid product
89 COMPILE tc OF test_condenser;
90 BROWSE {tc};
91 RUN {tc.values};
92 RUN {tc.reset};
93 SOLVE {tc} WITH QRSlv;
94 RUN tc.check_self;
95 ASSIGN tc.equilibrated TRUE;
96 RUN tc.reset;
97 SOLVE {tc} WITH QRSlv
98 RUN tc.check_self;
99
100 # "Simple" Reboiler with 1 liquid product
101 COMPILE tr OF test_reboiler;
102 BROWSE {tr};
103 RUN {tr.values};
104 ASSIGN tr.equilibrated FALSE;
105 RUN {tr.reset};
106 SOLVE {tr} WITH QRSlv;
107 RUN tr.check_self;
108 DELETE SYSTEM;
109 ASSIGN tr.equilibrated TRUE;
110 RUN {tr.reset};
111 SOLVE {tr} WITH QRSlv;
112 RUN tr.check_self;
113
114 # Internal Tray Stack Model
115 COMPILE tts OF test_tray_stack;
116 BROWSE {tts};
117 ASSIGN {tts.equilibrated} FALSE;
118 RUN {tts.reset};
119 SOLVE {tts} WITH QRSlv;
120 RUN tts.check_self;
121 DELETE SYSTEM;
122 ASSIGN {tts.equilibrated} TRUE;
123 RUN {tts.reset};
124 SOLVE {tts} WITH QRSlv;
125 RUN tts.check_self;
126 RUN {tts.reset_to_adiabatic};
127 SOLVE {tts} WITH QRSlv;
128 RUN tts.check_self;
129
130 # "Simple" Column Model
131 # Note that some of the solves in the following model
132 # may require a few more iterations than the solver
133 # gives by default, depending on the solver scaling
134 # and factorization and step control options.
135 # Just hit the Solve button again.
136
137 COMPILE {tsc} OF {test_simple_column};
138 BROWSE {tsc};
139 RUN {tsc.values};
140
141 # Configure to solve mass balances first
142 ASSIGN tsc.Equilibrated FALSE;
143 RUN {tsc.Column.reset};
144 SOLVE tsc;
145 RUN tsc.check_self;
146
147 # Configure to solve mass and energy balances
148 # with slack Qin on each tray, fixed RR and BU.
149 # It might be easier to free BU (reboil_ratio) and
150 # specify the distillate.Ftot flow.
151 DELETE SYSTEM;
152 ASSIGN tsc.Equilibrated TRUE;
153 RUN {tsc.Column.reset};
154 SOLVE {tsc};
155 RUN tsc.check_self;
156
157 # Configure to solve energy balanced column
158 # with fixed RR and BU and saturated liquid feed.
159 RUN {tsc.Column.reset_to_adiabatic};
160 SOLVE {tsc};
161 RUN tsc.check_self;
162
163 COMPILE tmwdc OF mw_demo_column;
164 BROWSE {tmwdc};
165 RUN {tmwdc.values};
166 RUN {tmwdc.reset_to_mass_balance};
167 SOLVE {tmwdc} WITH QRSlv;
168 RUN tmwdc.check_self;
169 RUN {tmwdc.reset_to_full_thermo};
170 SOLVE {tmwdc} WITH QRSlv;
171 RUN tmwdc.check_self;
172 RUN {tmwdc.reset_to_adiabatic};
173 SOLVE {tmwdc} WITH QRSlv;
174 RUN tmwdc.check_self;
175
176 COMPILE tabcdc OF abc_demo_column;
177 BROWSE {tabcdc};
178 RUN tabcdc.values;
179 RUN {tabcdc.reset_to_mass_balance};
180 SOLVE {tabcdc} WITH QRSlv;
181 RUN tabcdc.check_self;
182 RUN {tabcdc.reset_to_full_thermo};
183 SOLVE {tabcdc} WITH QRSlv;
184 RUN tabcdc.check_self;
185 RUN {tabcdc.reset_to_adiabatic};
186 SOLVE {tabcdc} WITH QRSlv;
187 RUN tabcdc.check_self;
188
189 COMPILE tc567dc OF c567_demo_column;
190 BROWSE {tc567dc};
191 RUN {tc567dc.values};
192 RUN {tc567dc.reset_to_mass_balance};
193 SOLVE {tc567dc} WITH QRSlv;
194 RUN tc567dc.check_self;
195 RUN tc567dc.scale_self;
196 RUN {tc567dc.reset_to_full_thermo};
197 SOLVE {tc567dc} WITH QRSlv;
198 RUN tc567dc.check_self;
199 RUN tc567dc.scale_self;
200 RUN {tc567dc.reset_to_adiabatic};
201 SOLVE {tc567dc} WITH QRSlv;
202 RUN tc567dc.check_self;
203
204 #
205 # columns with graphical output.
206 #
207
208 # Define a macro for the script (a tcl proc)
209 # so we can make plotting simpler.
210 # This macro takes the name of a demo_plot_column.
211
212 proc DemoPlotMacro {simulation} {
213 PLOT $simulation.demo.Plot_K
214 SHOW LAST
215 PLOT $simulation.demo.Plot_x
216 SHOW LAST
217 PLOT $simulation.demo.Plot_y
218 SHOW LAST
219 PLOT $simulation.demo.Plot_P
220 SHOW LAST
221 PLOT $simulation.demo.Plot_T
222 SHOW LAST
223 PLOT $simulation.demo.Plot_Q
224 SHOW LAST
225 PLOT $simulation.demo.Plot_L
226 SHOW LAST
227 PLOT $simulation.demo.Plot_V
228 SHOW LAST
229 }
230
231 COMPILE mwdpc OF mw_demo_plot_column;
232 BROWSE {mwdpc};
233 RUN {mwdpc.values};
234 RUN {mwdpc.reset_to_mass_balance};
235 SOLVE {mwdpc} WITH QRSlv;
236 RUN mwdpc.check_self;
237 # call the macro to build 8 plots from tmwdpc
238 DemoPlotMacro mwdpc;
239
240 RUN {mwdpc.reset_to_full_thermo};
241 SOLVE {mwdpc} WITH QRSlv;
242 RUN mwdpc.check_self;
243 DemoPlotMacro mwdpc;
244
245 RUN {mwdpc.reset_to_adiabatic};
246 SOLVE {mwdpc} WITH QRSlv;
247 RUN mwdpc.check_self;
248 DemoPlotMacro mwdpc;
249
250 COMPILE c567dpc OF c567_demo_plot_column;
251 BROWSE {c567dpc};
252 RUN {c567dpc.values};
253 RUN {c567dpc.reset_to_mass_balance};
254 SOLVE {c567dpc} WITH QRSlv;
255 RUN c567dpc.check_self;
256 DemoPlotMacro c567dpc;
257
258 RUN {c567dpc.reset_to_full_thermo};
259 SOLVE {c567dpc} WITH QRSlv;
260 RUN c567dpc.check_self;
261 DemoPlotMacro c567dpc;
262
263 RUN {c567dpc.reset_to_adiabatic};
264 SOLVE {c567dpc} WITH QRSlv;
265 RUN c567dpc.check_self;
266 DemoPlotMacro c567dpc;
267
268 ########## separation_demos.a4s ends here ##########
269 #
270 # separation_demos.a4s
271 # by Benjamin Allan
272 # March 30, 1997.
273 # Part of the ASCEND Library
274 # $Date: 1998/06/17 20:08:42 $
275 # $Revision: 1.10 $
276 # $Author: mthomas $
277 # $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/separation_demos.a4s,v $
278 #
279 # This file is part of the ASCEND Modeling Library.
280 #
281 # Copyright (C) 1997 - 1998 Carnegie Mellon University
282 #
283 # The ASCEND Modeling Library is free software. You can redistribute
284 # it and/or modify it under the terms of the GNU General Public
285 # License as published by the Free Software Foundation---either
286 # version 2 of the License, or (at your option) any later version.
287 #
288 # The ASCEND Modeling Library is distributed in hope that it
289 # will be useful, but WITHOUT ANY WARRANTY--without even the implied
290 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
291 # See the GNU General Public License for more details.
292 #
293 # You should have received a copy of the GNU General Public License
294 # along with the program. If not, write to the Free Software
295 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
296 # the file named COPYING.

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22