/[ascend]/trunk/models/KenPendings.a4l
ViewVC logotype

Contents of /trunk/models/KenPendings.a4l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (show annotations) (download) (as text)
Tue May 9 03:42:08 2006 UTC (18 years ago) by johnpye
File MIME type: text/x-ascend
File size: 6008 byte(s)
Changed all cases of *.fixed := {TRUE,FALSE} to 'FIX' and 'FREE' statements.
1 REQUIRE "ben/benstream.a4l";
2 (* => ben/stream.a4l, ben/benHGthermo.a4l, ben/benpropertyoptions.a4l,
3 * ben/bencomponents.a4l, atoms.a4l, measures.a4l, system.a4l,
4 * basemodel.a4l *)
5 PROVIDE "KenPendings.a4l";
6
7 (*
8 * KenPendings.a4l
9 * by Kenneth H. Tyner
10 * Part of the ASCEND Library
11 * $Date: 1998/06/17 19:45:36 $
12 * $Revision: 1.4 $
13 * $Author: mthomas $
14 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/KenPendings.a4l,v $
15 *
16 * This file is part of the ASCEND Modeling Library.
17 *
18 * Copyright (C) 1997-1998 Carnegie Mellon University
19 *
20 * The ASCEND Modeling Library is free software; you can redistribute
21 * it and/or modify it under the terms of the GNU General Public
22 * License as published by the Free Software Foundation; either
23 * version 2 of the License, or (at your option) any later version.
24 *
25 * The ASCEND Modeling Library is distributed in hope that it
26 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
27 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28 * See the GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with the program; if not, write to the Free Software
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
33 * the file named COPYING.
34 *)
35
36 (*
37 * Various models that Ken finds useful but are not yet
38 * recomended for general use. Many of these models are
39 * currently hacks due to compiler bugs from the recent
40 * ASCEND version upgrade. When the compiler is fixed
41 * much more elegant models will replace these.
42 *
43 *)
44
45 MODEL mass_stream(
46 components IS_A set OF symbol_constant;
47 );
48 Ftot,f[components] IS_A molar_rate;
49
50 Ftot = SUM[f[i] | i IN components];
51
52 METHODS
53 METHOD clear;
54 FREE Ftot;
55 FREE f[components];
56 END clear;
57 METHOD reset;
58 FIX f[components];
59 END reset;
60 METHOD seqmod;
61 RUN clear;
62 END seqmod;
63 END mass_stream;
64
65 (****************************************************************************
66 MODELS USING HOMOTOPY METHODS
67 ****************************************************************************)
68
69 MODEL mass_balance_mixer_single_output_base(
70 );
71 (*
72 NOTES inline SELF {
73 Provides common methods FOR mass_balance_mixer_single_output class OF mixers.
74 NEVER CREATE one OF these
75 }
76 END NOTES;
77 *)
78 METHODS
79 METHOD clear;
80 RUN input[inputs].clear;
81 RUN output.clear;
82 END clear;
83 METHOD seqmod;
84 RUN output.specify;
85 FREE output.f[output.state.options.ds.components];
86 (* type OF inputs not know so must be handled somewhere ELSE *)
87 END seqmod;
88 METHOD specify;
89 RUN seqmod;
90 RUN input[inputs].specify;
91 END specify;
92 METHOD reset;
93 RUN clear;
94 RUN specify;
95 END reset;
96 METHOD scale;
97 RUN output.scale;
98 RUN input[inputs].scale;
99 END scale;
100 END mass_balance_mixer_single_output_base;
101
102 MODEL mass_balance_homotopy_mixer_single_output_int(
103 inputs IS_A set OF integer_constant;
104 input[inputs] WILL_BE mass_stream;
105 (* input[inputs] WILL_BE homogeneous_molar_stream;*)
106 output WILL_BE two_phase_molar_stream;
107 reduce WILL_BE factor;
108 ) WHERE (
109 ) REFINES mass_balance_mixer_single_output_base(
110 );
111 f_mult[output.components] IS_A factor;
112
113 FOR i IN output.components CREATE
114 cmb[i]: output.f[i] =
115 SUM[f_mult[i]*input[k].f[i] | k IN inputs];
116 END FOR;
117 METHODS
118 METHOD clear;
119 RUN mass_balance_mixer_single_output_base::clear;
120 FREE f_mult[output.components];
121 END clear;
122 METHOD seqmod;
123 (* RUN mass_balance_mixer_single_output_base::seqmod;*)
124 RUN output.specify;
125 FREE output.f[output.components];
126 FIX f_mult[output.components];
127 END seqmod;
128 METHOD calc_multipliers;
129 FREE f_mult[output.components];
130 FIX output.f[output.components];
131 END calc_multipliers;
132 METHOD calc_outputs;
133 FIX f_mult[output.components];
134 FREE output.f[output.components];
135 END calc_outputs;
136
137 METHOD reduce_mix_diff;
138 FOR i IN output.components DO
139 f_mult[i] := f_mult[i] + reduce*(1-f_mult[i]);
140 END FOR;
141 END reduce_mix_diff;
142
143 END mass_balance_homotopy_mixer_single_output_int;
144
145 MODEL mass_balance_homotopy_mixer_single_output_int2(
146 inputs IS_A set OF integer_constant;
147 input[inputs] WILL_BE mass_stream;
148 (* input[inputs] WILL_BE homogeneous_molar_stream;*)
149 output WILL_BE homogeneous_molar_stream;
150 reduce WILL_BE factor;
151 ) WHERE (
152 ) REFINES mass_balance_mixer_single_output_base(
153 );
154 f_mult[output.components] IS_A factor;
155
156 FOR i IN output.components CREATE
157 cmb[i]: output.f[i] =
158 SUM[f_mult[i]*input[k].f[i] | k IN inputs];
159 END FOR;
160 METHODS
161 METHOD clear;
162 RUN mass_balance_mixer_single_output_base::clear;
163 FREE f_mult[output.components];
164 END clear;
165 METHOD seqmod;
166 RUN mass_balance_mixer_single_output_base::seqmod;
167 FIX f_mult[output.components];
168 END seqmod;
169 METHOD calc_multipliers;
170 FREE f_mult[output.components];
171 FIX output.f[output.components];
172 END calc_multipliers;
173 METHOD reduce_mix_diff;
174 FOR i IN output.components DO
175 f_mult[i] := f_mult[i] + reduce*(1-f_mult[i]);
176 END FOR;
177 END reduce_mix_diff;
178
179 END mass_balance_homotopy_mixer_single_output_int2;
180
181 MODEL liquid_stream_splitter_int(
182 input WILL_BE liquid_stream;
183 outputs IS_A set OF integer_constant;
184 output[outputs] WILL_BE mass_stream;
185 (* ) WHERE (
186 input.state,
187 output[outputs].state WILL_NOT_BE_THE_SAME;*)
188 );
189 split[outputs] IS_A fraction;
190
191 FOR i IN [outputs] CREATE
192 FOR j IN input.state.options.ds.components CREATE
193 output[i].f[j] = split[i]*input.f[j];
194 END FOR;
195 END FOR;
196
197 (* SUM[split[i] | i IN outputs] = 1.0;*)
198 (*
199 FOR i IN [outputs] CREATE
200 output[i].state.T = input.state.T;
201 output[i].state.P = input.state.P;
202 END FOR;
203 *)
204 METHODS
205 METHOD clear;
206 RUN input.clear;
207 RUN output[outputs].clear;
208 (* output[outputs].saturated := FALSE;*)
209 FREE split[outputs];
210 END clear;
211 METHOD seqmod;
212 RUN clear;
213 END seqmod;
214 END liquid_stream_splitter_int;

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