/[ascend]/trunk/models/ben/benplotcol.a4c
ViewVC logotype

Contents of /trunk/models/ben/benplotcol.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (19 years, 8 months ago) by aw0a
File MIME type: text/x-ascend
File size: 6005 byte(s)
Setting up web subdirectory in repository
1 REQUIRE "ben/bencolumn.a4l";
2 (* --> measures,system,atoms,components,options,HGthermo,stream,flash,column *)
3 REQUIRE "plot.a4l";
4
5 MODEL demo_plot_column(
6 components IS_A set OF symbol_constant;
7 reference IS_A symbol_constant;
8 n_trays IS_A integer_constant;
9 feed_location IS_A integer_constant;
10 ) WHERE (
11 reference IN components == TRUE;
12 n_trays > 5;
13 feed_location > 2;
14 feed_location < n_trays - 2;
15 ) REFINES demo_column;
16
17 z_eq_tray_set IS_A set OF integer_constant;
18 z_eq_tray_set :== Column.VLE_set;
19 z_eq_tray_coord[z_eq_tray_set] IS_A real;
20 z_icmp IS_A set OF integer_constant;
21 z_icmp :== [1..CARD[components]];
22
23 FOR i IN [components] CREATE
24 x_curves[i] IS_A plt_curve(
25 Column.zx[i],
26 Column.Profile_x[i],
27 z_eq_tray_coord
28 );
29 y_curves[i] IS_A plt_curve(
30 Column.zy[i],
31 Column.Profile_y[i],
32 z_eq_tray_coord
33 );
34 k_curves[i] IS_A plt_curve(
35 Column.zk[i],
36 Column.Profile_kvalues_when_full_thermo[i],
37 z_eq_tray_coord
38 );
39 END FOR;
40 t_curve IS_A plt_curve(Column.zT,Column.Profile_T,z_eq_tray_coord);
41 t_curves[1] ALIASES t_curve;
42 p_curve IS_A plt_curve(Column.zP,Column.Profile_P,z_eq_tray_coord);
43 p_curves[2] ALIASES p_curve;
44 Plot_x IS_A plt_plot_symbol(components,x_curves);
45 Plot_y IS_A plt_plot_symbol(components,y_curves);
46 Plot_K IS_A plt_plot_symbol(components,k_curves);
47 Plot_T IS_A plt_plot_integer([1],t_curves);
48 Plot_P IS_A plt_plot_integer([2],p_curves);
49
50 (* this stuff needs work
51 (* in conversion process from bob's mcplot code.
52 SELECT (CARD[components])
53 CASE 2:
54 (* mccabe thiele plot only for 2 components *)
55
56 (* these get mapped into parameters *)
57 mceq.npnt :== Plot_x.curve[reference].npnt;
58 mcstages.npnt :== 2*(Plot_x.curve[reference].npnt) + 1;
59 mcopline.npnt :== Plot_x.curve[reference].npnt+1;
60 mcident.npnt :== 2;
61 mcqline.npnt :== 2;
62
63
64 FOR j IN [1..mceq.npnt] CREATE
65 mceq.pnt[j].x, Plot_x.curve[reference].pnt[j].y ARE_THE_SAME;
66 mceq.pnt[j].y, Plot_y.curve[reference].pnt[j].y ARE_THE_SAME;
67
68 mcstages.pnt[2*j-1], mcopline.pnt[j] ARE_THE_SAME;
69 mcstages.pnt[2*j], mceq.pnt[j] ARE_THE_SAME;
70 END FOR;
71
72 FOR j IN [2..mcopline.npnt-1] CREATE
73 mcopline.pnt[j].x, Plot_x.curve[reference].pnt[j-1].y
74 ARE_THE_SAME;
75 mcopline.pnt[j].y, Plot_y.curve[reference].pnt[j].y
76 ARE_THE_SAME;
77 END FOR;
78
79 mcstages.pnt[1].x, mcstages.pnt[1].y, Plot_y.curve[reference].pnt[1].y
80 ARE_THE_SAME;
81
82 mcstages.pnt[2*(Plot_x.curve[reference].npnt)+1].x,
83 mcstages.pnt[2*(Plot_x.curve[reference].npnt)+1].y,
84 Plot_x.curve[reference].pnt[Plot_x.curve[reference].npnt].y
85 ARE_THE_SAME;
86
87 mcstages.pnt[2*(Plot_x.curve[reference].npnt)+1],
88 mcopline.pnt[Plot_x.curve[reference].npnt+1] ARE_THE_SAME;
89
90 mcident.pnt[1], mcopline.pnt[1] ARE_THE_SAME;
91 mcident.pnt[2], mcopline.pnt[mcopline.npnt] ARE_THE_SAME;
92
93 mcqline.pnt[2], mceq.pnt[col.feed_loc] ARE_THE_SAME;
94
95 (* stuff below here or something very like should work when complete *)
96
97 (* I may be missing the distillate from mceq and mcstagex *)
98 mceq IS_A plt_curve(
99 Column.zx[reference],
100 Column.Profile_x[reference],
101 Column.Profile_y[reference]
102 );
103
104 mcstagex[mc_sx_pts] ALIASES ((
105 (Column.Profile_x[reference][k],Column.Profile_x[reference][k])
106 | k IN z_eq_tray_set),
107 Column.Profile_x[reference][Column.N_trays])
108 WHERE mc_sx_pts IS_A set OF integer_constant;
109
110 (* this one may be way off *)
111 mcstagey[mc_sy_pts] ALIASES ((
112 (Column.Profile_Y[reference][k+1],
113 Column.Profile_Y[reference][k])
114 | k IN z_eq_tray_set),
115 Column.Profile_x[reference][Column.N_trays])
116 WHERE mc_sy_pts IS_A set OF integer_constant;
117
118 (* If we get all the curves built ok, this part is a nobrainer *)
119 mc_curves[mc_set] ALIASES (mceq,mcstages,mcopline,mcident,mcqline)
120 WHERE mc_set IS_A set OF integer_constant;
121
122 Plot_MT IS_A plt_plot_integer(mc_set,mc_curves);
123
124 OTHERWISE
125 END FOR; (* select CARD components *)
126
127 *)
128 *)
129
130 METHODS
131 METHOD values;
132 RUN demo_column::values;
133 FOR i IN z_eq_tray_set DO
134 z_eq_tray_coord[i] := i;
135 END FOR;
136 t_curve.legend := 'temperature';
137 p_curve.legend := 'pressure';
138 FOR i IN components DO
139 y_curves[i].legend := i;
140 x_curves[i].legend := i;
141 k_curves[i].legend := i;
142 END FOR;
143 Plot_x.title := 'Liquid Compositions';
144 Plot_y.title := 'Vapor Compositions';
145 Plot_K.title := 'Volatilities';
146 Plot_T.title := 'Temperature';
147 Plot_P.title := 'Pressure';
148 Plot_P.XLabel := 'tray number';
149 Plot_T.XLabel := 'tray number';
150 Plot_y.XLabel := 'tray number';
151 Plot_x.XLabel := 'tray number';
152 Plot_K.XLabel := 'tray number';
153 Plot_T.YLabel := '{K}';
154 Plot_P.YLabel := '{Pascal}';
155 Plot_y.YLabel := 'mole fraction';
156 Plot_x.YLabel := 'mole fraction';
157 Plot_K.YLabel := 'K value';
158 (* make composition plots cover 0 - 1 *)
159 Plot_x.Ylow := 0;
160 Plot_x.Yhigh := 1;
161 Plot_y.Ylow := 0;
162 Plot_y.Yhigh := 1;
163 (* This part ok when Plot_MT is finished above.
164 IF CARD[components] == 2 THEN
165 Plot_MT.title := 'McCabe-Thiele Diagram';
166 Plot_MT.XLabel := 'Liquid composition';
167 Plot_MT.YLabel := 'Vapor composition';
168 mceq.legend := 'equilibrium';
169 mcstages.legend := 'stages';
170 mcopline.legend := 'operating line';
171 mcident.legend := 'x=y';
172 mcqline.legend := 'qline';
173 END FOR;
174 *)
175 END values;
176
177 END demo_plot_column;
178
179 MODEL testdemoplotmodel() REFINES testcmumodel();
180 END testdemoplotmodel;
181 MODEL mw_demo_plot_column() REFINES testdemoplotmodel();
182 mw_column IS_A demo_plot_column(['methanol','water'],'water',13,7);
183 METHODS
184 METHOD defaults;
185 RUN mw_column.defaults;
186 END defaults;
187 END mw_demo_plot_column;
188
189 MODEL abc_demo_plot_column() REFINES testdemoplotmodel();
190 abc_column IS_A
191 demo_plot_column(['benzene','chloroform','acetone'],'benzene',13,7);
192 METHODS
193 METHOD defaults;
194 RUN abc_column.defaults;
195 END defaults;
196 END abc_demo_plot_column;
197
198 MODEL c567_demo_plot_column() REFINES testdemoplotmodel();
199 c567_column IS_A
200 demo_plot_column(['n_pentane','n_hexane','n_heptane'],'n_heptane',13,7);
201 METHODS
202 METHOD defaults;
203 RUN c567_column.defaults;
204 END defaults;
205 END c567_demo_plot_column;

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