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

Annotation of /trunk/models/KenPendings.a4l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2651 - (hide annotations) (download) (as text)
Thu Dec 13 07:29:48 2012 UTC (11 years, 6 months ago) by jpye
File MIME type: text/x-ascend
File size: 5923 byte(s)
Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)
1 aw0a 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 jpye 2651 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 aw0a 1 *)
33    
34     (*
35     * Various models that Ken finds useful but are not yet
36     * recomended for general use. Many of these models are
37     * currently hacks due to compiler bugs from the recent
38     * ASCEND version upgrade. When the compiler is fixed
39     * much more elegant models will replace these.
40     *
41     *)
42    
43     MODEL mass_stream(
44     components IS_A set OF symbol_constant;
45     );
46     Ftot,f[components] IS_A molar_rate;
47    
48     Ftot = SUM[f[i] | i IN components];
49    
50     METHODS
51     METHOD clear;
52 johnpye 576 FREE Ftot;
53     FREE f[components];
54 aw0a 1 END clear;
55     METHOD reset;
56 johnpye 576 FIX f[components];
57 aw0a 1 END reset;
58     METHOD seqmod;
59     RUN clear;
60     END seqmod;
61     END mass_stream;
62    
63     (****************************************************************************
64     MODELS USING HOMOTOPY METHODS
65     ****************************************************************************)
66    
67     MODEL mass_balance_mixer_single_output_base(
68     );
69     (*
70     NOTES inline SELF {
71     Provides common methods FOR mass_balance_mixer_single_output class OF mixers.
72     NEVER CREATE one OF these
73     }
74     END NOTES;
75     *)
76     METHODS
77     METHOD clear;
78     RUN input[inputs].clear;
79     RUN output.clear;
80     END clear;
81     METHOD seqmod;
82     RUN output.specify;
83 johnpye 576 FREE output.f[output.state.options.ds.components];
84 aw0a 1 (* type OF inputs not know so must be handled somewhere ELSE *)
85     END seqmod;
86     METHOD specify;
87     RUN seqmod;
88     RUN input[inputs].specify;
89     END specify;
90     METHOD reset;
91     RUN clear;
92     RUN specify;
93     END reset;
94     METHOD scale;
95     RUN output.scale;
96     RUN input[inputs].scale;
97     END scale;
98     END mass_balance_mixer_single_output_base;
99    
100     MODEL mass_balance_homotopy_mixer_single_output_int(
101     inputs IS_A set OF integer_constant;
102     input[inputs] WILL_BE mass_stream;
103     (* input[inputs] WILL_BE homogeneous_molar_stream;*)
104     output WILL_BE two_phase_molar_stream;
105     reduce WILL_BE factor;
106     ) WHERE (
107     ) REFINES mass_balance_mixer_single_output_base(
108     );
109     f_mult[output.components] IS_A factor;
110    
111     FOR i IN output.components CREATE
112     cmb[i]: output.f[i] =
113     SUM[f_mult[i]*input[k].f[i] | k IN inputs];
114     END FOR;
115     METHODS
116     METHOD clear;
117     RUN mass_balance_mixer_single_output_base::clear;
118 johnpye 576 FREE f_mult[output.components];
119 aw0a 1 END clear;
120     METHOD seqmod;
121     (* RUN mass_balance_mixer_single_output_base::seqmod;*)
122     RUN output.specify;
123 johnpye 576 FREE output.f[output.components];
124     FIX f_mult[output.components];
125 aw0a 1 END seqmod;
126     METHOD calc_multipliers;
127 johnpye 576 FREE f_mult[output.components];
128     FIX output.f[output.components];
129 aw0a 1 END calc_multipliers;
130     METHOD calc_outputs;
131 johnpye 576 FIX f_mult[output.components];
132     FREE output.f[output.components];
133 aw0a 1 END calc_outputs;
134    
135     METHOD reduce_mix_diff;
136     FOR i IN output.components DO
137     f_mult[i] := f_mult[i] + reduce*(1-f_mult[i]);
138     END FOR;
139     END reduce_mix_diff;
140    
141     END mass_balance_homotopy_mixer_single_output_int;
142    
143     MODEL mass_balance_homotopy_mixer_single_output_int2(
144     inputs IS_A set OF integer_constant;
145     input[inputs] WILL_BE mass_stream;
146     (* input[inputs] WILL_BE homogeneous_molar_stream;*)
147     output WILL_BE homogeneous_molar_stream;
148     reduce WILL_BE factor;
149     ) WHERE (
150     ) REFINES mass_balance_mixer_single_output_base(
151     );
152     f_mult[output.components] IS_A factor;
153    
154     FOR i IN output.components CREATE
155     cmb[i]: output.f[i] =
156     SUM[f_mult[i]*input[k].f[i] | k IN inputs];
157     END FOR;
158     METHODS
159     METHOD clear;
160     RUN mass_balance_mixer_single_output_base::clear;
161 johnpye 576 FREE f_mult[output.components];
162 aw0a 1 END clear;
163     METHOD seqmod;
164     RUN mass_balance_mixer_single_output_base::seqmod;
165 johnpye 576 FIX f_mult[output.components];
166 aw0a 1 END seqmod;
167     METHOD calc_multipliers;
168 johnpye 576 FREE f_mult[output.components];
169     FIX output.f[output.components];
170 aw0a 1 END calc_multipliers;
171     METHOD reduce_mix_diff;
172     FOR i IN output.components DO
173     f_mult[i] := f_mult[i] + reduce*(1-f_mult[i]);
174     END FOR;
175     END reduce_mix_diff;
176    
177     END mass_balance_homotopy_mixer_single_output_int2;
178    
179     MODEL liquid_stream_splitter_int(
180     input WILL_BE liquid_stream;
181     outputs IS_A set OF integer_constant;
182     output[outputs] WILL_BE mass_stream;
183     (* ) WHERE (
184     input.state,
185     output[outputs].state WILL_NOT_BE_THE_SAME;*)
186     );
187     split[outputs] IS_A fraction;
188    
189     FOR i IN [outputs] CREATE
190     FOR j IN input.state.options.ds.components CREATE
191     output[i].f[j] = split[i]*input.f[j];
192     END FOR;
193     END FOR;
194    
195     (* SUM[split[i] | i IN outputs] = 1.0;*)
196     (*
197     FOR i IN [outputs] CREATE
198     output[i].state.T = input.state.T;
199     output[i].state.P = input.state.P;
200     END FOR;
201     *)
202     METHODS
203     METHOD clear;
204     RUN input.clear;
205     RUN output[outputs].clear;
206     (* output[outputs].saturated := FALSE;*)
207 johnpye 576 FREE split[outputs];
208 aw0a 1 END clear;
209     METHOD seqmod;
210     RUN clear;
211     END seqmod;
212     END liquid_stream_splitter_int;

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