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

Annotation of /trunk/models/when_demo.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 111 - (hide annotations) (download) (as text)
Wed Dec 14 01:25:23 2005 UTC (18 years, 6 months ago) by johnpye
File MIME type: text/x-ascend
File size: 19476 byte(s)
Added 'total cost' to the when_demo.a4c example.
It doesn't seem to be working for me though.
1 aw0a 1 REQUIRE "atoms.a4l";
2     (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *)
3     PROVIDE "when_demo.a4c";
4     (*
5     * This file is part of the ASCEND Modeling Library and is released
6     * under the GNU Public License as described at the end of this file.
7     *
8     * Use of this module is demonstrated by the associated script file
9     * when_demo.a4s.
10     *)
11    
12     (*
13     This model is intended to demonstrate the degree of flexibility
14     that the use of conditional statements -when statement- provides
15     to the representation of superstructures. We hope that this
16     application will become clear by looking at the MODEL flowsheet,
17     in which the existence/nonexistence of some of the unit operations
18     is represented by when statements. A particular combination of
19     user defined boolean variables -see method values, configuration2,
20     configuration3- will a define a particular configuration of the
21     problem.
22    
23     This model requires:
24     "system.a4l"
25     "atoms.a4l"
26     *)
27    
28    
29    
30     (* ************************************************* *)
31    
32     MODEL mixture;
33    
34     components IS_A set OF symbol_constant;
35     Cpi[components] IS_A heat_capacity;
36     y[components] IS_A fraction;
37     P IS_A pressure;
38     T IS_A temperature;
39     Cp IS_A heat_capacity;
40    
41    
42     SUM[y[i] | i IN components] = 1.0;
43     Cp = SUM[Cpi[i] * y[i] | i IN components];
44    
45     METHODS
46    
47     METHOD default_self;
48     END default_self;
49    
50     METHOD specify;
51     Cpi[components].fixed := TRUE;
52     P.fixed := TRUE;
53     T.fixed := TRUE;
54     y[components].fixed := TRUE;
55     y[CHOICE[components]].fixed := FALSE;
56     END specify;
57    
58     END mixture;
59    
60    
61     (* ************************************************* *)
62    
63    
64     MODEL molar_stream;
65     state IS_A mixture;
66     Ftot,f[components] IS_A molar_rate;
67     components IS_A set OF symbol_constant;
68     P IS_A pressure;
69     T IS_A temperature;
70     Cp IS_A heat_capacity;
71    
72     components, state.components ARE_THE_SAME;
73     P, state.P ARE_THE_SAME;
74     T, state.T ARE_THE_SAME;
75     Cp, state.Cp ARE_THE_SAME;
76    
77     FOR i IN components CREATE
78     f_def[i]: f[i] = Ftot*state.y[i];
79     END FOR;
80    
81     METHODS
82    
83     METHOD default_self;
84     END default_self;
85    
86     METHOD specify;
87     RUN state.specify;
88     state.y[components].fixed := FALSE;
89     f[components].fixed := TRUE;
90     END specify;
91    
92     END molar_stream;
93    
94    
95    
96     (* ************************************************* *)
97    
98    
99     MODEL cheap_feed;
100     stream IS_A molar_stream;
101     cost_factor IS_A cost_per_mole;
102     cost IS_A cost_per_time;
103    
104     stream.f['A'] = 0.060 {kg_mole/s};
105     stream.f['B'] = 0.025 {kg_mole/s};
106     stream.f['D'] = 0.015 {kg_mole/s};
107     stream.f['C'] = 0.00 {kg_mole/s};
108     stream.T = 300 {K};
109     stream.P = 5 {bar};
110    
111     cost = cost_factor * stream.Ftot;
112     METHODS
113    
114     METHOD default_self;
115     END default_self;
116    
117     METHOD specify;
118     RUN stream.specify;
119     stream.f[stream.components].fixed := FALSE;
120     cost_factor.fixed := TRUE;
121     stream.T.fixed := FALSE;
122     stream.P.fixed := FALSE;
123     END specify;
124    
125     END cheap_feed;
126    
127    
128     (* ************************************************* *)
129    
130    
131     MODEL expensive_feed;
132     stream IS_A molar_stream;
133     cost_factor IS_A cost_per_mole;
134     cost IS_A cost_per_time;
135    
136     stream.f['A'] = 0.065 {kg_mole/s};
137     stream.f['B'] = 0.030 {kg_mole/s};
138     stream.f['D'] = 0.05 {kg_mole/s};
139     stream.f['C'] = 0.00 {kg_mole/s};
140     stream.T = 320 {K};
141     stream.P = 6 {bar};
142    
143     cost = 3 * cost_factor * stream.Ftot;
144    
145     METHODS
146    
147     METHOD default_self;
148     END default_self;
149    
150     METHOD specify;
151     RUN stream.specify;
152     stream.f[stream.components].fixed := FALSE;
153     cost_factor.fixed := TRUE;
154     stream.T.fixed := FALSE;
155     stream.P.fixed := FALSE;
156     END specify;
157    
158     END expensive_feed;
159    
160    
161     (* ************************************************* *)
162    
163    
164     MODEL heater;
165     input,output IS_A molar_stream;
166     heat_supplied IS_A energy_rate;
167     components IS_A set OF symbol_constant;
168     cost IS_A cost_per_time;
169     cost_factor IS_A cost_per_energy;
170    
171     components,input.components,output.components ARE_THE_SAME;
172     FOR i IN components CREATE
173     input.state.Cpi[i], output.state.Cpi[i] ARE_THE_SAME;
174     END FOR;
175    
176     FOR i IN components CREATE
177     input.f[i] = output.f[i];
178     END FOR;
179    
180     input.P = output.P;
181    
182     heat_supplied = input.Cp *(output.T - input.T) * input.Ftot;
183    
184     cost = cost_factor * heat_supplied;
185    
186     METHODS
187    
188     METHOD default_self;
189     END default_self;
190    
191     METHOD specify;
192     RUN input.specify;
193     cost_factor.fixed := TRUE;
194     heat_supplied.fixed := TRUE;
195     END specify;
196    
197     METHOD seqmod;
198     cost_factor.fixed := TRUE;
199     heat_supplied.fixed := TRUE;
200     END seqmod;
201    
202     END heater;
203    
204    
205    
206     (* ************************************************* *)
207    
208    
209     MODEL cooler;
210    
211     input,output IS_A molar_stream;
212     heat_removed IS_A energy_rate;
213     components IS_A set OF symbol_constant;
214     cost IS_A cost_per_time;
215     cost_factor IS_A cost_per_energy;
216    
217     components,input.components,output.components ARE_THE_SAME;
218     FOR i IN components CREATE
219     input.state.Cpi[i],output.state.Cpi[i] ARE_THE_SAME;
220     END FOR;
221    
222     FOR i IN components CREATE
223     input.f[i] = output.f[i];
224     END FOR;
225    
226     input.P = output.P;
227     heat_removed = input.Cp *(input.T - output.T) * input.Ftot;
228     cost = cost_factor * heat_removed;
229    
230     METHODS
231    
232     METHOD default_self;
233     END default_self;
234    
235     METHOD specify;
236     RUN input.specify;
237     cost_factor.fixed := TRUE;
238     heat_removed.fixed := TRUE;
239     END specify;
240    
241     METHOD seqmod;
242     cost_factor.fixed := TRUE;
243     heat_removed.fixed := TRUE;
244     END seqmod;
245    
246     END cooler;
247    
248    
249     (* ************************************************* *)
250    
251    
252     MODEL single_compressor; (* Adiabatic Compression *)
253    
254     input,output IS_A molar_stream;
255     components IS_A set OF symbol_constant;
256     work_supplied IS_A energy_rate;
257     pressure_rate IS_A factor;
258     R IS_A gas_constant;
259     cost IS_A cost_per_time;
260     cost_factor IS_A cost_per_energy;
261    
262     components,input.components,output.components ARE_THE_SAME;
263     FOR i IN components CREATE
264     input.state.Cpi[i],output.state.Cpi[i] ARE_THE_SAME;
265     END FOR;
266    
267     FOR i IN components CREATE
268     input.f[i] = output.f[i];
269     END FOR;
270    
271     pressure_rate = output.P / input.P;
272    
273     output.T = input.T * (pressure_rate ^(R/input.Cp) );
274    
275     work_supplied = input.Ftot * input.Cp * (output.T - input.T);
276    
277     cost = cost_factor * work_supplied;
278    
279     METHODS
280    
281     METHOD default_self;
282     END default_self;
283    
284     METHOD specify;
285     RUN input.specify;
286     cost_factor.fixed := TRUE;
287     pressure_rate.fixed := TRUE;
288     END specify;
289    
290     METHOD seqmod;
291     cost_factor.fixed := TRUE;
292     pressure_rate.fixed := TRUE;
293     END seqmod;
294    
295     END single_compressor;
296    
297    
298     (* ************************************************* *)
299    
300    
301     MODEL staged_compressor;
302    
303     input,output IS_A molar_stream;
304     components IS_A set OF symbol_constant;
305     work_supplied IS_A energy_rate;
306     heat_removed IS_A energy_rate;
307     T_middle IS_A temperature;
308     n_stages IS_A factor;
309     pressure_rate IS_A factor;
310     stage_pressure_rate IS_A factor;
311     R IS_A gas_constant;
312     cost IS_A cost_per_time;
313     cost_factor_work IS_A cost_per_energy;
314     cost_factor_heat IS_A cost_per_energy;
315    
316     components,input.components,output.components ARE_THE_SAME;
317     FOR i IN components CREATE
318     input.state.Cpi[i],output.state.Cpi[i] ARE_THE_SAME;
319     END FOR;
320    
321     FOR i IN components CREATE
322     input.f[i] = output.f[i];
323     END FOR;
324    
325     output.T = input.T;
326    
327     pressure_rate = output.P / input.P;
328    
329     stage_pressure_rate =(pressure_rate)^(1.0/n_stages);
330    
331     T_middle = input.T * (stage_pressure_rate ^(R/input.Cp));
332    
333     work_supplied = input.Ftot * n_stages * input.Cp *
334     (T_middle - input.T);
335    
336     heat_removed = input.Ftot * (n_stages - 1.0) *
337     input.Cp * (T_middle - input.T);
338    
339     cost = cost_factor_work * work_supplied +
340     cost_factor_heat * heat_removed;
341    
342     METHODS
343    
344     METHOD default_self;
345     END default_self;
346    
347     METHOD specify;
348     RUN input.specify;
349     n_stages.fixed := TRUE;
350     cost_factor_heat.fixed := TRUE;
351     cost_factor_work.fixed := TRUE;
352     pressure_rate.fixed := TRUE;
353     END specify;
354    
355     METHOD seqmod;
356     n_stages.fixed := TRUE;
357     cost_factor_heat.fixed := TRUE;
358     cost_factor_work.fixed := TRUE;
359     pressure_rate.fixed := TRUE;
360     END seqmod;
361    
362     END staged_compressor;
363    
364    
365     (* ************************************************* *)
366    
367    
368     MODEL mixer;
369    
370     components IS_A set OF symbol_constant;
371     n_inputs IS_A integer_constant;
372     feed[1..n_inputs], out IS_A molar_stream;
373     To IS_A temperature;
374    
375     components,feed[1..n_inputs].components,
376     out.components ARE_THE_SAME;
377     FOR i IN components CREATE
378     feed[1..n_inputs].state.Cpi[i],out.state.Cpi[i] ARE_THE_SAME;
379     END FOR;
380    
381     FOR i IN components CREATE
382     cmb[i]: out.f[i] = SUM[feed[1..n_inputs].f[i]];
383     END FOR;
384    
385     SUM[(feed[i].Cp *feed[i].Ftot * (feed[i].T - To))|i IN [1..n_inputs]]=
386     out.Cp *out.Ftot * (out.T - To);
387    
388     SUM[( feed[i].Ftot * feed[i].T / feed[i].P )|i IN [1..n_inputs]] =
389     out.Ftot * out.T / out.P;
390    
391     METHODS
392    
393     METHOD default_self;
394     END default_self;
395    
396     METHOD specify;
397     To.fixed := TRUE;
398     RUN feed[1..n_inputs].specify;
399     END specify;
400    
401     METHOD seqmod;
402     To.fixed := TRUE;
403     END seqmod;
404    
405     END mixer;
406    
407    
408     (* ************************************************* *)
409    
410    
411     MODEL splitter;
412    
413     components IS_A set OF symbol_constant;
414     n_outputs IS_A integer_constant;
415     feed, out[1..n_outputs] IS_A molar_stream;
416     split[1..n_outputs] IS_A fraction;
417    
418     components, feed.components,
419     out[1..n_outputs].components ARE_THE_SAME;
420     feed.state,
421     out[1..n_outputs].state ARE_THE_SAME;
422    
423     FOR j IN [1..n_outputs] CREATE
424     out[j].Ftot = split[j]*feed.Ftot;
425     END FOR;
426    
427     SUM[split[1..n_outputs]] = 1.0;
428    
429     METHODS
430    
431     METHOD default_self;
432     END default_self;
433    
434     METHOD specify;
435     RUN feed.specify;
436     split[1..n_outputs-1].fixed:= TRUE;
437     END specify;
438    
439     METHOD seqmod;
440     split[1..n_outputs-1].fixed:= TRUE;
441     END seqmod;
442    
443     END splitter;
444    
445    
446     (* ************************************************* *)
447    
448    
449     MODEL cheap_reactor;
450     components IS_A set OF symbol_constant;
451     input, output IS_A molar_stream;
452     low_turnover IS_A molar_rate;
453     stoich_coef[input.components] IS_A factor;
454     cost_factor IS_A cost_per_mole;
455     cost IS_A cost_per_time;
456    
457     components,input.components, output.components ARE_THE_SAME;
458     FOR i IN components CREATE
459     input.state.Cpi[i], output.state.Cpi[i] ARE_THE_SAME;
460     END FOR;
461    
462     FOR i IN components CREATE
463     output.f[i] = input.f[i] + stoich_coef[i]*low_turnover;
464     END FOR;
465    
466     input.T = output.T;
467     (* ideal gas constant volume *)
468     input.Ftot * input.T / input.P = output.Ftot * output.T/output.P;
469    
470     cost = cost_factor * low_turnover;
471    
472     METHODS
473    
474     METHOD default_self;
475     END default_self;
476    
477     METHOD specify;
478     RUN input.specify;
479     low_turnover.fixed:= TRUE;
480     stoich_coef[input.components].fixed:= TRUE;
481     cost_factor.fixed := TRUE;
482     END specify;
483    
484     METHOD seqmod;
485     low_turnover.fixed:= TRUE;
486     stoich_coef[input.components].fixed:= TRUE;
487     cost_factor.fixed := TRUE;
488     END seqmod;
489    
490     END cheap_reactor;
491    
492    
493     (* ************************************************* *)
494    
495    
496     MODEL expensive_reactor;
497    
498     components IS_A set OF symbol_constant;
499     input, output IS_A molar_stream;
500     high_turnover IS_A molar_rate;
501     stoich_coef[input.components] IS_A factor;
502     cost_factor IS_A cost_per_mole;
503     cost IS_A cost_per_time;
504    
505     components,input.components, output.components ARE_THE_SAME;
506     FOR i IN components CREATE
507     input.state.Cpi[i], output.state.Cpi[i] ARE_THE_SAME;
508     END FOR;
509    
510     FOR i IN components CREATE
511     output.f[i] = input.f[i] + stoich_coef[i]*high_turnover;
512     END FOR;
513    
514     input.T = output.T;
515     (* ideal gas constant volume *)
516     input.Ftot * input.T / input.P = output.Ftot * output.T/output.P;
517    
518     cost = cost_factor * high_turnover;
519    
520     METHODS
521    
522     METHOD default_self;
523     END default_self;
524    
525     METHOD specify;
526     RUN input.specify;
527     high_turnover.fixed:= TRUE;
528     stoich_coef[input.components].fixed:= TRUE;
529     cost_factor.fixed := TRUE;
530     END specify;
531    
532     METHOD seqmod;
533     high_turnover.fixed:= TRUE;
534     stoich_coef[input.components].fixed:= TRUE;
535     cost_factor.fixed := TRUE;
536     END seqmod;
537    
538     END expensive_reactor;
539    
540    
541     (* ************************************************* *)
542    
543    
544     MODEL flash;
545    
546     components IS_A set OF symbol_constant;
547     feed,vap,liq IS_A molar_stream;
548     alpha[feed.components] IS_A factor;
549     ave_alpha IS_A factor;
550     vap_to_feed_ratio IS_A fraction;
551    
552     components,feed.components,
553     vap.components,
554     liq.components ARE_THE_SAME;
555     FOR i IN components CREATE
556     feed.state.Cpi[i],
557     vap.state.Cpi[i],
558     liq.state.Cpi[i] ARE_THE_SAME;
559     END FOR;
560    
561     vap_to_feed_ratio*feed.Ftot = vap.Ftot;
562    
563     FOR i IN components CREATE
564     cmb[i]: feed.f[i] = vap.f[i] + liq.f[i];
565     eq[i]: vap.state.y[i]*ave_alpha = alpha[i]*liq.state.y[i];
566     END FOR;
567    
568     feed.T = vap.T;
569     feed.T = liq.T;
570     feed.P = vap.P;
571     feed.P = liq.P;
572    
573     METHODS
574    
575     METHOD default_self;
576     END default_self;
577    
578     METHOD specify;
579     RUN feed.specify;
580     alpha[feed.components].fixed:= TRUE;
581     vap_to_feed_ratio.fixed := TRUE;
582     END specify;
583    
584     METHOD seqmod;
585     alpha[feed.components].fixed:= TRUE;
586     vap_to_feed_ratio.fixed := TRUE;
587     END seqmod;
588    
589     END flash;
590    
591    
592     (* ************************************************* *)
593    
594    
595     MODEL flowsheet;
596    
597     (* units *)
598    
599     f1 IS_A cheap_feed;
600     f2 IS_A expensive_feed;
601    
602     c1 IS_A single_compressor;
603     s1 IS_A staged_compressor;
604    
605     c2 IS_A single_compressor;
606     s2 IS_A staged_compressor;
607    
608     r1 IS_A cheap_reactor;
609     r2 IS_A expensive_reactor;
610    
611     co1,co2 IS_A cooler;
612     h1,h2,h3 IS_A heater;
613     fl1 IS_A flash;
614     sp1 IS_A splitter;
615     m1 IS_A mixer;
616    
617 johnpye 111 running_cost IS_A cost_per_time;
618     running_cost = compressor_cost + feed_cost + reactor_cost + compressor2_cost
619     + co1.cost + co2.cost + h1.cost + h2.cost + h3.cost;
620    
621 aw0a 1 (* boolean variables *)
622    
623     select_feed1 IS_A boolean_var;
624     select_single1 IS_A boolean_var;
625     select_cheapr1 IS_A boolean_var;
626     select_single2 IS_A boolean_var;
627    
628     (* define sets *)
629    
630     m1.n_inputs :== 2;
631     sp1.n_outputs :== 2;
632    
633     (* wire up flowsheet *)
634    
635     f1.stream, f2.stream, c1.input, s1.input ARE_THE_SAME;
636     c1.output, s1.output, m1.feed[2] ARE_THE_SAME;
637     m1.out,co1.input ARE_THE_SAME;
638     co1.output, h1.input ARE_THE_SAME;
639     h1.output, r1.input, r2.input ARE_THE_SAME;
640     r1.output, r2.output,co2.input ARE_THE_SAME;
641     co2.output, fl1.feed ARE_THE_SAME;
642     fl1.liq, h2.input ARE_THE_SAME;
643     fl1.vap, sp1.feed ARE_THE_SAME;
644     sp1.out[1], h3.input ARE_THE_SAME;
645     sp1.out[2],c2.input, s2.input ARE_THE_SAME;
646     c2.output, s2.output,m1.feed[1] ARE_THE_SAME;
647    
648    
649     (* Conditional statements *)
650    
651 johnpye 111 feed_cost IS_A cost_per_time;
652     fc1: feed_cost = f1.cost;
653     fc2: feed_cost = f2.cost;
654    
655 aw0a 1 WHEN (select_feed1)
656     CASE TRUE:
657     USE f1;
658 johnpye 111 USE fc1;
659 aw0a 1 CASE FALSE:
660     USE f2;
661 johnpye 111 USE fc2;
662 aw0a 1 END WHEN;
663    
664 johnpye 111 compressor_cost IS_A cost_per_time;
665     c1c1: compressor_cost = c1.cost;
666     c1s1: compressor_cost = s1.cost;
667 aw0a 1 WHEN (select_single1)
668     CASE TRUE:
669     USE c1;
670 johnpye 111 USE c1c1;
671 aw0a 1 CASE FALSE:
672     USE s1;
673 johnpye 111 USE c1s1;
674 aw0a 1 END WHEN;
675    
676 johnpye 111 reactor_cost IS_A cost_per_time;
677     rc1: reactor_cost = r1.cost;
678     rc2: reactor_cost = r2.cost;
679 aw0a 1 WHEN (select_cheapr1)
680     CASE TRUE:
681     USE r1;
682 johnpye 111 USE rc1;
683 aw0a 1 CASE FALSE:
684     USE r2;
685 johnpye 111 USE rc2;
686 aw0a 1 END WHEN;
687    
688 johnpye 111 compressor2_cost IS_A cost_per_time;
689     c2c2: compressor2_cost = c2.cost;
690     c2s2: compressor2_cost = s2.cost;
691 aw0a 1 WHEN (select_single2)
692     CASE TRUE:
693     USE c2;
694 johnpye 111 USE c2c2;
695 aw0a 1 CASE FALSE:
696     USE s2;
697 johnpye 111 USE c2s2;
698 aw0a 1 END WHEN;
699    
700    
701     METHODS
702    
703     METHOD default_self;
704     END default_self;
705    
706     METHOD seqmod;
707     RUN c1.seqmod;
708     RUN c2.seqmod;
709     RUN s1.seqmod;
710     RUN s2.seqmod;
711     RUN co1.seqmod;
712     RUN co2.seqmod;
713     RUN h1.seqmod;
714     RUN h2.seqmod;
715     RUN h3.seqmod;
716     RUN r1.seqmod;
717     RUN r2.seqmod;
718     RUN fl1.seqmod;
719     RUN sp1.seqmod;
720     RUN m1.seqmod;
721     END seqmod;
722    
723     METHOD specify;
724     RUN seqmod;
725     RUN f1.specify;
726     RUN f2.specify;
727     END specify;
728    
729     END flowsheet;
730    
731    
732     (* ************************************************* *)
733    
734    
735     MODEL test_flowsheet REFINES flowsheet;
736    
737     f1.stream.components :== ['A','B','C','D'];
738    
739     METHODS
740    
741     METHOD default_self;
742 johnpye 111 RUN reset;
743     RUN values;
744 aw0a 1 END default_self;
745    
746     METHOD values;
747    
748     (* Initial Configuration *)
749     select_feed1 := TRUE;
750     select_single1 := TRUE;
751     select_cheapr1 := TRUE;
752     select_single2 := TRUE;
753    
754     (* Fixed Values *)
755    
756     (* Physical Properties of Components *)
757    
758     f1.stream.state.Cpi['A'] := 0.04 {BTU/mole/K};
759     f1.stream.state.Cpi['B'] := 0.05 {BTU/mole/K};
760     f1.stream.state.Cpi['C'] := 0.06 {BTU/mole/K};
761     f1.stream.state.Cpi['D'] := 0.055 {BTU/mole/K};
762    
763     (* Feed 1 *)
764 johnpye 109 f1.cost_factor := 0.026 {USD/kg_mole};
765 aw0a 1
766     (* Feed 2 *)
767 johnpye 109 f2.cost_factor := 0.033 {USD/kg_mole};
768 aw0a 1
769     (* Cooler 1 *)
770 johnpye 109 co1.cost_factor := 0.7e-06 {USD/kJ};
771 aw0a 1 co1.heat_removed := 100 {BTU/s};
772    
773     (* Cooler 2 *)
774     co2.heat_removed := 150 {BTU/s};
775 johnpye 109 co2.cost_factor := 0.7e-06 {USD/kJ};
776 aw0a 1
777     (* Heater 1 *)
778     h1.heat_supplied := 200 {BTU/s};
779 johnpye 109 h1.cost_factor := 8e-06 {USD/kJ};
780 aw0a 1
781     (* Heater 2 *)
782     h2.heat_supplied := 180 {BTU/s};
783 johnpye 109 h2.cost_factor := 8e-06 {USD/kJ};
784 aw0a 1
785     (* Heater 3 *)
786     h3.heat_supplied := 190 {BTU/s};
787 johnpye 109 h3.cost_factor := 8e-06 {USD/kJ};
788 aw0a 1
789     (* Flash *)
790     fl1.alpha['A'] := 12.0;
791     fl1.alpha['B'] := 10.0;
792     fl1.alpha['C'] := 1.0;
793     fl1.alpha['D'] := 6.0;
794     fl1.vap_to_feed_ratio :=0.9;
795    
796     (* Splitter *)
797     sp1.split[1] := 0.05;
798    
799     (* Mixer *)
800     m1.To := 298 {K};
801    
802     (* Single Compressor 1 *)
803 johnpye 109 c1.cost_factor := 8.33333e-06 {USD/kJ};
804 aw0a 1 c1.pressure_rate := 2.5;
805    
806     (* Single Compressor 2 *)
807 johnpye 109 c2.cost_factor := 8.33333e-06 {USD/kJ};
808 aw0a 1 c2.pressure_rate := 1.5;
809    
810     (* Staged Compressor 1 *)
811 johnpye 109 s1.cost_factor_work := 8.33333e-06 {USD/kJ};
812     s1.cost_factor_heat := 0.7e-06 {USD/kJ};
813 aw0a 1 s1.pressure_rate := 2.5;
814     s1.n_stages := 2.0;
815    
816     (* Staged Compressor 2 *)
817 johnpye 109 s2.cost_factor_work := 8.33333e-06 {USD/kJ};
818     s2.cost_factor_heat := 0.7e-06 {USD/kJ};
819 aw0a 1 s2.pressure_rate := 1.5;
820     s2.n_stages := 2.0;
821    
822     (* Reactor 1 *)
823     r1.stoich_coef['A']:= -1;
824     r1.stoich_coef['B']:= -1;
825     r1.stoich_coef['C']:= 1;
826     r1.stoich_coef['D']:= 0;
827     r1.low_turnover := 0.0069 {kg_mole/s};
828    
829     (* Reactor 2 *)
830     r2.stoich_coef['A']:= -1;
831     r2.stoich_coef['B']:= -1;
832     r2.stoich_coef['C']:= 1;
833     r2.stoich_coef['D']:= 0;
834     r2.high_turnover := 0.00828 {kg_mole/s};
835    
836     (* Initial Guess *)
837    
838     (* Flash *)
839     fl1.ave_alpha := 5.0;
840    
841     END values;
842    
843     METHOD configuration2;
844     (* alternative configuration *)
845     select_feed1 := FALSE;
846     select_single1 := FALSE;
847     select_cheapr1 := FALSE;
848     select_single2 := FALSE;
849     END configuration2;
850    
851     METHOD configuration3;
852     (* alternative configuration *)
853     select_feed1 := FALSE;
854     select_single1 := TRUE;
855     select_cheapr1 := TRUE;
856     select_single2 := FALSE;
857     END configuration3;
858    
859     END test_flowsheet;
860    
861    
862     (*
863     * when_demo.a4c
864     * by Vicente Rico-Ramirez
865     * Part of the ASCEND Library
866     * $Date: 1998/06/17 19:15:07 $
867     * $Revision: 1.6 $
868     * $Author: mthomas $
869     * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/when_demo.a4c,v $
870     *
871     * This file is part of the ASCEND Modeling Library.
872     *
873     * Copyright (C) 1998 Carnegie Mellon University
874     *
875     * The ASCEND Modeling Library is free software; you can redistribute
876     * it and/or modify it under the terms of the GNU General Public
877     * License as published by the Free Software Foundation; either
878     * version 2 of the License, or (at your option) any later version.
879     *
880     * The ASCEND Modeling Library is distributed in hope that it will be
881     * useful, but WITHOUT ANY WARRANTY; without even the implied
882     * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
883     * See the GNU General Public License for more details.
884     *
885     * You should have received a copy of the GNU General Public License
886     * along with the program; if not, write to the Free Software
887     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
888     * the file named COPYING.
889     *)

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