/[ascend]/branches/ksenija2/models/simpleunits.a4c
ViewVC logotype

Contents of /branches/ksenija2/models/simpleunits.a4c

Parent Directory Parent Directory | Revision Log Revision Log


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

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