/[ascend]/trunk/models/simpleunits.a4c
ViewVC logotype

Contents of /trunk/models/simpleunits.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 469 - (show annotations) (download) (as text)
Mon Apr 17 03:21:29 2006 UTC (14 years, 7 months ago) by ben.allan
File MIME type: text/x-ascend
File size: 22272 byte(s)
getting rid of executable bits.
1 REQUIRE "stream_holdup.a4l";
2 REQUIRE "simpleunitsatoms.a4c";
3 PROVIDE "simpleunits.a4c";
4
5 (*
6 * simpleunits.a4c
7 * by Arthur W. Westerberg
8 * Part of the ASCEND Library
9 * $Date: 2006/04/10 09:56:47 $
10 * $Revision: 1.95 $
11 * $Author: a.westerberg $
12 *
13 * This file is part of the ASCEND Modeling Library.
14 *
15 * Copyright (C) 1998 Carnegie Mellon University
16 *
17 * The ASCEND Modeling Library is free software; you can redistribute
18 * it and/or modify it under the terms of the GNU General Public
19 * License as published by the Free Software Foundation; either
20 * version 2 of the License, or (at your option) any later version.
21 *
22 * The ASCEND Modeling Library is distributed in hope that it
23 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
24 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 * See the GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with the program; if not, write to the Free Software
29 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
30 * the file named COPYING.
31 *)
32
33
34 (*
35
36 This file (simpleUnits.a4c) contains models useful for developing heat
37 and material balances quickly for a flowsheet, when using simple unit
38 operation models and accurate physical property models.
39
40 This file contains three "basic" models with varying numbers of
41 streams in and out as suggested by the unit name:
42
43 unitOneInOneOut
44 unitOneInTwoOut
45 unitTwoInTwoOut
46
47 It also contains a simpleCompressor model built from two instances of
48 unitOneInOneOut.
49
50 What is different in these models is that the components listed for
51 the input and output streams need not be the same.
52
53 If a component leaves but does not enter the unit, then its flow out
54 is equated to zero.
55
56 If it enters but does not leave, then its flow is accumulated into the
57 variable "error_LostFlowOut." It is up to the user to decide if a
58 value greater than zero for this variable is to be interpreted as an
59 actual error.
60
61 For the model unitOneInTwoOut, each component that appears in all
62 three streams is split using a split factor, which is part of the
63 model. If a component enters but leaves in only one product stream,
64 all of it leaves in that stream.
65
66 All three units have a heat input possible for them. Thus each can be
67 used to heat or cool the input stream(s).
68
69
70 Default initial assumptions
71
72 Specifying a unit assumes all the input streams are specified. Output
73 stream flows are computed by the unit.
74
75 The basic models add delP variables to compute the output stream
76 pressures. The default is to fix these delP variables at zero; thus
77 the output pressures are by default equal to the input pressures. For
78 the unitTwoInOneOut, output pressure is related to the first input
79 stream only.
80
81 The units are also assumed to be adiabatic. For unitOneInTwoOut, the
82 product temperatures are assumed to be equal by setting the slack
83 delT12 on the equation relating them to zero. There are delT
84 variables, which are equivalent in use to the delP variables.
85 However, their default is to be calculated rather than fixed. If one
86 wishes to fix the outlet temperature equal to the inlet, fix the delT
87 variable at its default of zero and release Qin for the unit.
88
89 In the following we describe how one can use the first model in a
90 variety of useful ways to model all sorts of units in a flowsheet.
91 Similar ways of thinking can allow the other units to be used in a
92 variety of ways.
93
94
95 unitOneInOneOut
96
97 One can use this model to carry out a single reaction described by a
98 turnover rate and the reaction stoichiometric coefficients. Look
99 inside the model to find these variables. Use two units in a row to
100 model two reactions.
101
102 This unit can also represent one side of a heat exchanger. Two such
103 units can be a heat exchanger if one requires the heat into one to
104 equal the negative of the heat into the other. To be safe one should
105 adds constraints to prevent temperature crossover or monitor that
106 crossover does not occur.
107
108
109 simpleCompressor (two unitOneInOnOut units)
110
111 We modeled the simpleCompressor unit as follows.
112
113 1. We used two units of this type; the first part is used to compute
114 reversible behavior and the second part actual behavior.
115
116 2. The first part is a reversible isentropic gas compressor. It
117 computes the work needed for this type of compression and reports it
118 as the heat input requirement, Qin.
119
120 3. The second part is fed with the same input stream as used to feed
121 the first part, only it processes this stream irreversibly.
122
123 4. The overall model includes the equation Qin2*eff = Qin1 to relate
124 the heat input of the second unit to that of the first. As eff is
125 less than unity, Qin2 will be larger than Qin1 to accomplish the same
126 compression, reflecting the irreversibility of the compressor.
127
128 5. We set the outlet pressure of the second unit to be the same as
129 that of the first.
130
131
132 The unitOneInOneOut unit can approximate an adiabatic valve by
133 requiring Qin to be zero, setting the pressure out at the desired
134 lower value, and letting the unit compute the temperature out.
135
136 By now you should get the idea of how versatile these units can be in
137 creating a simple heat and material balance for a flowsheet.
138 *)
139
140 MODEL unitOneInOneOut
141 (
142 Qin WILL_BE energy_rate;
143 feed WILL_BE stream;
144 product WILL_BE stream;
145 );
146
147 compsFeed ALIASES feed.cd.components;
148 compsProduct ALIASES product.cd.components;
149 compsAll, compsCommon, compsNotInProd, compsNotInFeed
150 IS_A set OF symbol_constant;
151
152 compsAll :== compsFeed + compsProduct;
153 compsCommon :== compsFeed*compsProduct;
154 compsNotInFeed :== compsProduct - compsFeed;
155 compsNotInProd :== compsFeed - compsProduct;
156
157 stoichCoef[compsAll] IS_A factor;
158 turnover, error_LostFlowOut IS_A molar_rate;
159 delP IS_A delta_pressure;
160 delT IS_A delta_temperature;
161
162 (* material balance *)
163
164 FOR i IN compsCommon CREATE
165 cmbCommon[i]: product.f[i] = feed.f[i] + turnover*stoichCoef[i];
166 END FOR;
167
168 traceMF IS_A traceMoleFraction_constant;
169 FOR i IN compsNotInFeed CREATE
170 cmbNotInFeed[i]: product.f[i] = traceMF*product.flow + turnover*stoichCoef[i];
171 END FOR;
172
173 missingTotal: error_LostFlowOut = 0 {mol/s} + SUM[feed.f[i]+turnover*stoichCoef[i]
174 | i IN compsNotInProd];
175
176 (* heat balance *)
177 hb: feed.H_flow + Qin = product.H_flow;
178
179 (* pressure *)
180 eqnP: product.P = feed.P + delP;
181
182 (* temperature *)
183 eqnT: product.T = feed.T + delT;
184
185 (* computing molar entropies for streams *)
186 feedMolarEntropy, productMolarEntropy IS_A molar_entropy;
187 feedMolarEntropy*feed.T = feed.state.H - feed.state.G;
188 productMolarEntropy*product.T = product.state.H - product.state.G;
189
190 METHODS
191
192 METHOD default_self;
193 RUN feed.default_self;
194 RUN product.default_self;
195 stoichCoef[compsAll] := 0.0;
196 turnover := 0.0 {mol/s};
197 delP := 0.0 {atm};
198 delT := 0.0 {K};
199 Qin := 0.0 {kW};
200 END default_self;
201
202 METHOD specify;
203 (* first run specify on all parts *)
204 RUN feed.specify;
205 RUN product.specify;
206 stoichCoef[compsAll].fixed := TRUE;
207 turnover.fixed := TRUE;
208 delP.fixed := TRUE;
209 (* then patch up things such that this model is square *)
210 product.f[compsProduct].fixed := FALSE;
211 product.T.fixed := FALSE;
212 product.P.fixed := FALSE;
213 Qin.fixed := TRUE;
214 END specify;
215
216 END unitOneInOneOut;
217
218
219 (* ********************************************* *)
220
221 MODEL unitOneInTwoOut
222 (
223 Qin WILL_BE energy_rate;
224 feed WILL_BE stream;
225 product1 WILL_BE stream;
226 product2 WILL_BE stream;
227 );
228
229 compsFeed ALIASES feed.cd.components;
230 compsProduct1 ALIASES product1.cd.components;
231 compsProduct2 ALIASES product2.cd.components;
232
233 compsInFeedOnly,
234 compsInProd1NotInFeed,
235 compsInProd2NotInFeed,
236 compsInFeedProd1Only,
237 compsInFeedProd2Only,
238 compsInAll IS_A set OF symbol_constant;
239
240 compsInFeedOnly :== compsFeed - compsProduct1 - compsProduct2;
241 compsInProd1NotInFeed :== compsProduct1 - compsFeed;
242 compsInProd2NotInFeed :== compsProduct2 - compsFeed;
243 compsInFeedProd1Only :== compsFeed*compsProduct1 - compsProduct2;
244 compsInFeedProd2Only :== compsFeed*compsProduct2 - compsProduct1;
245 compsInAll :== compsFeed*compsProduct1*compsProduct2;
246
247 error_LostFlowOut IS_A molar_rate;
248 split[compsInAll] IS_A fraction;
249 delP1, delP12 IS_A delta_pressure;
250 delT1, delT12 IS_A delta_temperature;
251
252 (* material balances *)
253
254 (* in Feed only - flows lost *)
255 missingTotal: error_LostFlowOut = 0 {mol/s} + SUM[feed.f[i] | i IN compsInFeedOnly];
256
257 (* in products only - flows in products are zero *)
258 traceMF IS_A traceMoleFraction_constant;
259 FOR i IN compsInProd1NotInFeed CREATE
260 zeroProd1[i]: product1.y[i] = traceMF;
261 END FOR;
262 FOR i IN compsInProd2NotInFeed CREATE
263 zeroProd2[i]: product2.y[i] = traceMF;
264 END FOR;
265
266 (* in feed and product1 only - all flow goes to product1 *)
267 FOR i IN compsInFeedProd1Only CREATE
268 cmbInFeedProd1Only[i]: product1.f[i] = feed.f[i];
269 END FOR;
270
271 (* in feed and product2 only - all flow goes to product2 *)
272 FOR i IN compsInFeedProd2Only CREATE
273 cmbInFeedProd2Only[i]: product2.f[i] = feed.f[i];
274 END FOR;
275
276 (* in feed and both products *)
277 FOR i IN compsInAll CREATE
278 cmbCompsInAll[i]: feed.f[i] = product1.f[i]+product2.f[i];
279 splitMBEqn[i]: product1.f[i] = split[i]*feed.f[i];
280 END FOR;
281
282 (* heat balance *)
283 hb: feed.H_flow + Qin = product1.H_flow + product2.H_flow;
284
285
286 (* pressure *)
287 eqnP1: product1.P = feed.P + delP1;
288 eqnP2: product2.P = product1.P + delP12;
289
290 (* temperature *)
291 eqnT1: product1.T = feed.T + delT1;
292 eqnT2: product2.T = product1.T + delT12;
293
294 METHODS
295
296 METHOD default_self;
297 RUN feed.default_self;
298 RUN product1.default_self;
299 RUN product2.default_self;
300 delP1 := 0.0 {atm};
301 delP12 := 0.0 {atm};
302 delT1 := 0.0 {K};
303 delT12 := 0.0 {K};
304 Qin := 0.0 {kW};
305 END default_self;
306
307 METHOD specify;
308 RUN feed.specify;
309 RUN product1.specify;
310 RUN product2.specify;
311 split[compsInAll].fixed := TRUE;
312 delP1.fixed := TRUE;
313 delP12.fixed := TRUE;
314 delT12.fixed := TRUE;
315 product1.f[compsProduct1].fixed := FALSE;
316 product2.f[compsProduct2].fixed := FALSE;
317 product1.P.fixed := FALSE;
318 product1.T.fixed := FALSE;
319 product2.P.fixed := FALSE;
320 product2.T.fixed := FALSE;
321 Qin.fixed := TRUE;
322 END specify;
323
324 END unitOneInTwoOut;
325
326 MODEL unitTwoInOneOut
327 (
328 Qin WILL_BE energy_rate;
329 feed1 WILL_BE stream;
330 feed2 WILL_BE stream;
331 product WILL_BE stream;
332 );
333
334 compsFeed1 ALIASES feed1.cd.components;
335 compsFeed2 ALIASES feed2.cd.components;
336 compsProduct ALIASES product.cd.components;
337
338 compsInFeed1NotInProd,
339 compsInFeed2NotInProd,
340 compsInProdOnly,
341 compsInFeed1ProdOnly,
342 compsInFeed2ProdOnly,
343 compsInAll IS_A set OF symbol_constant;
344
345 compsInFeed1NotInProd :== compsFeed1 - compsProduct;
346 compsInFeed2NotInProd :== compsFeed2 - compsProduct;
347 compsInProdOnly :== compsProduct - compsFeed1 - compsFeed2;
348 compsInFeed1ProdOnly :== compsFeed1*compsProduct - compsFeed2;
349 compsInFeed2ProdOnly :== compsFeed2*compsProduct - compsFeed1;
350 compsInAll :== compsFeed1*compsFeed2*compsProduct;
351
352 error_LostFlowOut IS_A molar_rate;
353 delP1 IS_A delta_pressure;
354 delT1 IS_A delta_temperature;
355
356 (* material balance *)
357 (* in Feeds only - flows lost *)
358 missingTotal: error_LostFlowOut = 0 {mol/s}+
359 SUM[feed1.f[i] | i IN compsInFeed1NotInProd] +
360 SUM[feed2.f[i] | i IN compsInFeed2NotInProd];
361
362 (* in product only - flows in products are zero *)
363 traceMF IS_A traceMoleFraction_constant;
364 FOR i IN compsInProdOnly CREATE
365 zeroProd[i]: product.y[i] = traceMF;
366 END FOR;
367
368 (* in feed1 and product only - flow goes to product *)
369 FOR i IN compsInFeed1ProdOnly CREATE
370 cmbInFeed1ProdOnly[i]: product.f[i] = feed1.f[i];
371 END FOR;
372
373 (* in feed2 and product only - flow goes to product *)
374 FOR i IN compsInFeed2ProdOnly CREATE
375 cmbInFeed2ProdOnly[i]: product.f[i] = feed2.f[i];
376 END FOR;
377
378 (* in both feeds and product*)
379 FOR i IN compsInAll CREATE
380 cmbCompsInAll[i]: product.f[i] = feed1.f[i]+feed2.f[i];
381 END FOR;
382
383 (* heat balance *)
384 hb: feed1.H_flow + feed2.H_flow + Qin = product.H_flow;
385
386 (* pressure *)
387 eqnP1: product.P = feed1.P + delP1;
388
389 (* temperature *)
390 eqnT1: product.T = feed1.T + delT1;
391
392 METHODS
393
394 METHOD default_self;
395 RUN feed1.default_self;
396 RUN feed2.default_self;
397 RUN product.default_self;
398 delP1 := 0.0 {atm};
399 delT1 := 0.0 {K};
400 Qin := 0.0 {kW};
401 END default_self;
402
403 METHOD specify;
404 RUN feed1.specify;
405 RUN feed2.specify;
406 RUN product.specify;
407 delP1.fixed := TRUE;
408 product.f[compsProduct].fixed := FALSE;
409 product.P.fixed := FALSE;
410 product.T.fixed := FALSE;
411 Qin.fixed := TRUE;
412 END specify;
413
414 END unitTwoInOneOut;
415
416 MODEL simpleCompressor
417 (
418 Qin WILL_BE energy_rate;
419 compressionRatio WILL_BE factor;
420 efficiency WILL_BE fraction;
421 feed WILL_BE stream;
422 product WILL_BE stream;
423 );
424
425 idealOut IS_A stream(feed.cd,feed.pd,feed.equilibrated);
426 Qideal IS_A energy_rate;
427 idealCompressor IS_A unitOneInOneOut(Qideal, feed, idealOut);
428 realCompressor IS_A unitOneInOneOut(Qin, feed, product);
429 idealOut.P = compressionRatio*feed.P;
430 product.P = idealOut.P;
431 idealCompressor.productMolarEntropy = idealCompressor.feedMolarEntropy;
432 Qin*efficiency = Qideal;
433
434 METHODS
435
436 METHOD default_self;
437 RUN idealCompressor.default_self;
438 RUN realCompressor.default_self;
439 END default_self;
440
441 METHOD specify;
442 RUN idealCompressor.specify;
443 RUN realCompressor.specify;
444 idealCompressor.delP.fixed := FALSE;
445 realCompressor.delP.fixed := FALSE;
446 idealCompressor.Qin.fixed := FALSE;
447 Qin.fixed := FALSE;
448 compressionRatio.fixed := TRUE;
449 efficiency.fixed := TRUE;
450 END specify;
451
452 END simpleCompressor;
453
454
455 (* ******************************************** *)
456 (* ***************** testing ****************** *)
457 (* ******************************************** *)
458
459 MODEL testUnitOneInOneOut;
460
461 H2, O2, N2, CO, C1, H2O IS_A symbol_constant;
462 compsAll, allButC1, allButN2 IS_A set OF symbol_constant;
463
464 H2 :== 'hydrogen';
465 O2 :== 'oxygen';
466 N2 :== 'nitrogen';
467 CO :== 'carbon_monoxide';
468 C1 :== 'methane';
469 H2O :== 'water';
470
471 compsAll :== [H2, O2, N2, CO, C1, H2O];
472 allButC1 :== [H2, O2, N2, CO, H2O];
473 allButN2 :== [H2, O2, CO, C1, H2O];
474
475 cdAll IS_A components_data(compsAll, H2O);
476 cdAllButC1 IS_A components_data(allButC1, H2O);
477 cdAllButN2 IS_A components_data(allButN2, H2O);
478
479 pdV IS_A phases_data('V','Pitzer_vapor_mixture','none','none');
480 equilibrated IS_A boolean;
481
482 (* the following are not used in this model. They are included
483 here to be helpful to anyone using this test model as a guide to
484 producing their model.
485
486 pdL IS_A phases_data('L', 'none', 'UNIFAC_liquid_mixture','none');
487 pdVL IS_A phases_data('VL','Pitzer_vapor_mixture',
488 'UNIFAC_liquid_mixture','none');
489 *)
490
491 feedNormal IS_A stream(cdAll, pdV, equilibrated);
492 prodNormal IS_A stream(cdAll, pdV, equilibrated);
493 Normal_Qin IS_A energy_rate;
494
495 unitNormal IS_A unitOneInOneOut(Normal_Qin, feedNormal, prodNormal);
496
497 feedMissing IS_A stream(cdAllButC1, pdV, equilibrated);
498 prodMissing IS_A stream (cdAllButN2, pdV, equilibrated);
499 Missing_Qin IS_A energy_rate;
500
501 unitMissing IS_A unitOneInOneOut(Missing_Qin, feedMissing, prodMissing);
502
503 METHODS
504
505 METHOD default_self;
506 RUN unitNormal.default_self;
507 RUN unitMissing.default_self;
508 END default_self;
509
510 METHOD values;
511 feedNormal.T := 600 {K};
512 feedNormal.P := 1 {atm};
513 feedNormal.f[compsAll] := 10.0 {mol/s};
514 feedMissing.T := 600 {K};
515 feedMissing.P := 1 {atm};
516 feedMissing.f[allButC1] := 20.0 {mol/s};
517 equilibrated := TRUE;
518
519 (* set up reaction in reactor: C1 + H2O = CO + 3H2 *)
520 unitNormal.stoichCoef[C1] := -1.0;
521 unitNormal.stoichCoef[H2O] := -1.0;
522 unitNormal.stoichCoef[CO] := 1.0;
523 unitNormal.stoichCoef[H2] := 3.0;
524 unitNormal.turnover := 1.0 {mol/s};
525
526 (* set up reaction: 2H2 + O2 = 2H2O *)
527 unitMissing.stoichCoef[H2] := -2.0;
528 unitMissing.stoichCoef[O2] := -1.0;
529 unitMissing.stoichCoef[H2O] := 2.0;
530 unitMissing.turnover := 1.0 {mol/s};
531 END values;
532
533 METHOD specify;
534 RUN unitNormal.specify;
535 prodNormal.f[compsAll].fixed := FALSE;
536 RUN unitMissing.specify;
537 prodMissing.f[allButN2].fixed := FALSE;
538 END specify;
539
540 END testUnitOneInOneOut;
541
542
543 MODEL testUnitOneInTwoOut;
544 H2, O2, N2, C1, C2, nC3, H2O IS_A symbol_constant;
545 compsF, compsP1, compsP2 IS_A set OF symbol_constant;
546
547 H2 :== 'hydrogen';
548 O2 :== 'oxygen';
549 N2 :== 'nitrogen';
550 C1 :== 'methane';
551 C2 :== 'ethane';
552 nC3 :== 'propane';
553 H2O :== 'water';
554
555 (* create component lists where all combinations of components
556 in feed and products exist for testing missing components
557 code in model *)
558
559 compsF :== [H2, O2, N2, C1];
560 compsP1 :== [H2, O2, C2, nC3];
561 compsP2 :== [H2, N2, C2, H2O];
562 cdCompsF IS_A components_data(compsF, O2);
563 cdCompsP1 IS_A components_data(compsP1, O2);
564 cdCompsP2 IS_A components_data(compsP2, H2O);
565
566 pdV IS_A phases_data('V','Pitzer_vapor_mixture','none','none');
567 equilibrated IS_A boolean;
568
569 feedNormal IS_A stream(cdCompsF, pdV, equilibrated);
570 Normal_Qin IS_A energy_rate;
571
572 prod1Normal IS_A stream (cdCompsF, pdV, equilibrated);
573 prod2Normal IS_A stream (cdCompsF, pdV, equilibrated);
574
575 unitNormal IS_A unitOneInTwoOut(Normal_Qin, feedNormal, prod1Normal, prod2Normal);
576
577 feedMissing IS_A stream(cdCompsF, pdV, equilibrated);
578 prod1Missing IS_A stream (cdCompsP1, pdV, equilibrated);
579 prod2Missing IS_A stream (cdCompsP2, pdV, equilibrated);
580 Missing_Qin IS_A energy_rate;
581
582 unitMissing IS_A unitOneInTwoOut(Missing_Qin, feedMissing, prod1Missing, prod2Missing);
583
584 METHODS
585
586 METHOD default_self;
587 RUN unitNormal.default_self;
588 RUN unitMissing.default_self;
589 END default_self;
590
591 METHOD values;
592 feedNormal.T := 600 {K};
593 feedNormal.P := 1 {atm};
594 feedNormal.f[compsF] := 10.0 {mol/s};
595 unitNormal.split[H2] := 0.5;
596 unitNormal.split[O2] := 0.3;
597 unitNormal.split[N2] := 0.2;
598 feedMissing.T := 600 {K};
599 feedMissing.P := 1 {atm};
600 feedMissing.f[compsF] := 10.0 {mol/s};
601 unitMissing.product1.T := 550.0 {K};
602 equilibrated := TRUE;
603 END values;
604
605 METHOD specify;
606 RUN unitNormal.specify;
607 RUN feedNormal.specify;
608 RUN unitMissing.specify;
609 RUN feedMissing.specify;
610 unitMissing.Qin.fixed := FALSE;
611 unitMissing.product1.T.fixed := TRUE;
612 END specify;
613
614 END testUnitOneInTwoOut;
615
616 MODEL testUnitTwoInOneOut;
617 H2, O2, N2, C1, C2, nC3, H2O IS_A symbol_constant;
618 compsF1, compsF2, compsP IS_A set OF symbol_constant;
619
620 H2 :== 'hydrogen';
621 O2 :== 'oxygen';
622 N2 :== 'nitrogen';
623 C1 :== 'methane';
624 C2 :== 'ethane';
625 nC3 :== 'propane';
626 H2O :== 'water';
627
628 (* create component lists where all combinations of components
629 in feed and products exist for testing missing components
630 code in model *)
631
632 compsF1 :== [H2, O2, C2, nC3];
633 compsF2 :== [H2, N2, C2, H2O];
634 compsP :== [O2, N2, C1, C2];
635 cdCompsF1 IS_A components_data(compsF1, O2);
636 cdCompsF2 IS_A components_data(compsF2, H2O);
637 cdCompsP IS_A components_data(compsP, O2);
638
639 pdV IS_A phases_data('V','Pitzer_vapor_mixture','none','none');
640 equilibrated IS_A boolean;
641
642 feed1Normal IS_A stream(cdCompsF1, pdV, equilibrated);
643 feed2Normal IS_A stream(cdCompsF1, pdV, equilibrated);
644 Normal_Qin IS_A energy_rate;
645
646 prodNormal IS_A stream (cdCompsF1, pdV, equilibrated);
647
648 unitNormal IS_A unitTwoInOneOut(Normal_Qin, feed1Normal, feed2Normal, prodNormal);
649
650 feed1Missing IS_A stream(cdCompsF1, pdV, equilibrated);
651 feed2Missing IS_A stream(cdCompsF2, pdV, equilibrated);
652 prodMissing IS_A stream (cdCompsP, pdV, equilibrated);
653 Missing_Qin IS_A energy_rate;
654
655 unitMissing IS_A unitTwoInOneOut(Missing_Qin, feed1Missing, feed2Missing, prodMissing);
656
657 METHODS
658
659 METHOD default_self;
660 RUN unitNormal.default_self;
661 RUN unitMissing.default_self;
662 END default_self;
663
664 METHOD values;
665 feed1Normal.T := 600 {K};
666 feed1Normal.P := 1 {atm};
667 feed1Normal.f[compsF1] := 10.0 {mol/s};
668 feed2Normal.T := 610 {K};
669 feed2Normal.P := 2 {atm};
670 feed2Normal.f[compsF1] := 15.0 {mol/s};
671 feed1Missing.T := 600 {K};
672 feed1Missing.P := 1 {atm};
673 feed1Missing.f[compsF1] := 3 {mol/s};
674 feed2Missing.T := 610 {K};
675 feed2Missing.P := 2 {atm};
676 feed2Missing.f[compsF2] := 6 {mol/s};
677 unitMissing.product.T := 550 {K};
678 equilibrated := TRUE;
679 END values;
680
681 METHOD specify;
682 RUN unitNormal.specify;
683 RUN feed1Normal.specify;
684 RUN feed2Normal.specify;
685 RUN unitMissing.specify;
686 RUN feed1Missing.specify;
687 RUN feed2Missing.specify;
688 unitMissing.Qin.fixed := FALSE;
689 unitMissing.product.T.fixed := TRUE;
690 END specify;
691
692 END testUnitTwoInOneOut;
693
694 MODEL testSimpleCompressor;
695 H2, O2, N2, H2O IS_A symbol_constant;
696 comps IS_A set OF symbol_constant;
697
698 H2 :== 'hydrogen';
699 O2 :== 'oxygen';
700 N2 :== 'nitrogen';
701 H2O :== 'water';
702
703 (* create component lists where all combinations of components
704 in feed and products exist for testing missing components
705 code in model *)
706
707 comps :== [H2, O2, N2, H2O];
708 cdComps IS_A components_data(comps, H2O);
709 pdV IS_A phases_data('V','Pitzer_vapor_mixture','none','none');
710 equil IS_A boolean;
711
712 feed IS_A stream(cdComps, pdV, equil);
713 product IS_A stream(cdComps, pdV, equil);
714 Qin IS_A energy_rate;
715 compressionRatio IS_A factor;
716 eff IS_A fraction;
717
718 sC IS_A simpleCompressor(Qin, compressionRatio, eff, feed, product);
719
720 METHODS
721
722 METHOD default_self;
723 RUN sC.default_self;
724 END default_self;
725
726 METHOD values;
727 equil := FALSE;
728 compressionRatio := 2.5;
729 eff := 0.95;
730 feed.T := 350 {K};
731 feed.P := 2 {atm};
732 feed.f[comps] := 1 {mol/s};
733 END values;
734
735 METHOD specify;
736 RUN sC.specify;
737 END specify;
738
739 END testSimpleCompressor;

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