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

Contents of /trunk/models/simpleunits.a4c

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

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