/[ascend]/trunk/doc/howto-model3.lyx
ViewVC logotype

Diff of /trunk/doc/howto-model3.lyx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1369 by johnpye, Tue Aug 22 01:34:33 2006 UTC revision 1370 by jpye, Fri Mar 30 02:27:41 2007 UTC
# Line 1  Line 1 
1  #LyX 1.4.1 created this file. For more info see http://www.lyx.org/  #LyX 1.4.3 created this file. For more info see http://www.lyx.org/
2  \lyxformat 245  \lyxformat 245
3  \begin_document  \begin_document
4  \begin_header  \begin_header
# Line 104  H_to_D_ratio Line 104  H_to_D_ratio
104  \series bold  \series bold
105  Plot  Plot
106  \series default  \series default
107   tool   option
108  \begin_inset LatexCommand \index{tool, Plot}  \begin_inset LatexCommand \index{tool, Plot}
109    
110  \end_inset  \end_inset
# Line 114  Plot Line 114  Plot
114    
115  \end_inset  \end_inset
116    
117   under the   under the Display menu in the
118  \series bold  \series bold
119  Display  Browser
120  \series default  \series default
121   button in the Browser window.   window.
122   While not obvious, it turns out we can plot the arrays we produce when   While not obvious, it turns out we can plot the arrays we produce when
123   we include instances of type   we include instances of type
124  \family typewriter  \family typewriter
# Line 143  plt_plot_symbol Line 143  plt_plot_symbol
143  \family typewriter  \family typewriter
144  plot.a4l  plot.a4l
145  \family default  \family default
146   located in the ASCEND4 models directory which is distributed with ASCEND.   located in the ASCEND
147    \family typewriter
148    models
149    \family default
150     directory which is distributed with ASCEND.
151   Figure   Figure
152  \begin_inset LatexCommand \ref{fig:model3.plot.a4l}  \begin_inset LatexCommand \ref{fig:model3.plot.a4l}
153    
# Line 151  plot.a4l Line 155  plot.a4l
155    
156    
157  \noun off  \noun off
158   is a print out of that file (but with line numbers added so we can reference   is shows a distilled version of that file.
  them here).  
159  \end_layout  \end_layout
160    
161  \begin_layout Standard  \begin_layout Standard
# Line 170  PROVIDE "plot.a4l"; Line 173  PROVIDE "plot.a4l";
173  \end_layout  \end_layout
174    
175  \begin_layout LyX-Code  \begin_layout LyX-Code
 (* some lines removed here...  
  *)  
 \end_layout  
   
 \begin_layout LyX-Code  
   
 \end_layout  
   
 \begin_layout LyX-Code  
 (*=============================================================================*  
 \end_layout  
   
 \begin_layout LyX-Code  
  P L O T .  
  A 4 L  
 \end_layout  
176    
 \begin_layout LyX-Code  
  ---------------  
 \end_layout  
   
 \begin_layout LyX-Code  
 AUTHOR:Ben Allan  
 \end_layout  
   
 \begin_layout LyX-Code  
 provoked by plot.lib by Peter Piela and Kirk A.  
  Abbott  
 \end_layout  
   
 \begin_layout LyX-Code  
 DATES:03/97 - Original code.  
 \end_layout  
   
 \begin_layout LyX-Code  
 CONTENTS:  
 \end_layout  
   
 \begin_layout LyX-Code  
 A parameterized plot library mostly compatible  
 \end_layout  
   
 \begin_layout LyX-Code  
 with plot.lib, but with variable graph titles.  
 \end_layout  
   
 \begin_layout LyX-Code  
 *)  
177  \end_layout  \end_layout
178    
179  \begin_layout LyX-Code  \begin_layout LyX-Code
# Line 229  END pltmodel; Line 185  END pltmodel;
185  \end_layout  \end_layout
186    
187  \begin_layout LyX-Code  \begin_layout LyX-Code
 MODEL plt_point(  
 \end_layout  
188    
 \begin_layout LyX-Code  
 x WILL_BE real;  
189  \end_layout  \end_layout
190    
191  \begin_layout LyX-Code  \begin_layout LyX-Code
192  y WILL_BE real;  MODEL plt_point(
193  \end_layout  \end_layout
194    
195  \begin_layout LyX-Code  \begin_layout LyX-Code
196  ) REFINES pltmodel();      x WILL_BE real;
197  \end_layout  \end_layout
198    
199  \begin_layout LyX-Code  \begin_layout LyX-Code
200  END plt_point;      y WILL_BE real;
201  \end_layout  \end_layout
202    
203  \begin_layout LyX-Code  \begin_layout LyX-Code
204  (***************************************************************)  )REFINES pltmodel();
205  \end_layout  \end_layout
206    
207  \begin_layout LyX-Code  \begin_layout LyX-Code
208  MODEL plt_curve(  END plt_point;
209  \end_layout  \end_layout
210    
211  \begin_layout LyX-Code  \begin_layout LyX-Code
 npnts IS_A set OF integer_constant;  
 \end_layout  
212    
 \begin_layout LyX-Code  
 y_data[npnts] WILL_BE real;  
213  \end_layout  \end_layout
214    
215  \begin_layout LyX-Code  \begin_layout LyX-Code
216  x_data[npnts] WILL_BE real;  MODEL plt_curve(
217  \end_layout  \end_layout
218    
219  \begin_layout LyX-Code  \begin_layout LyX-Code
220  ) REFINES pltmodel();      npnts IS_A set OF integer_constant;
221  \end_layout  \end_layout
222    
223  \begin_layout LyX-Code  \begin_layout LyX-Code
224  (* points of matching subscript will be plotted in order of      y_data[npnts] WILL_BE real;
225  \end_layout  \end_layout
226    
227  \begin_layout LyX-Code  \begin_layout LyX-Code
228   * increasing subscript value.      x_data[npnts] WILL_BE real;
229  \end_layout  \end_layout
230    
231  \begin_layout LyX-Code  \begin_layout LyX-Code
232   *)  )REFINES pltmodel();
233  \end_layout  \end_layout
234    
235  \begin_layout LyX-Code  \begin_layout LyX-Code
236  legendIS_A symbol; (* mutable now! *)      legendIS_A symbol;
237  \end_layout  \end_layout
238    
239  \begin_layout LyX-Code  \begin_layout LyX-Code
240  FOR i IN [npnts] CREATE      FOR i IN [npnts] CREATE
241  \end_layout  \end_layout
242    
243  \begin_layout LyX-Code  \begin_layout LyX-Code
244  pnt[i]IS_A plt_point(x_data[i],y_data[i]);          pnt[i]IS_A plt_point(x_data[i],y_data[i]);
245  \end_layout  \end_layout
246    
247  \begin_layout LyX-Code  \begin_layout LyX-Code
248  END FOR;      END FOR;
249  \end_layout  \end_layout
250    
251  \begin_layout LyX-Code  \begin_layout LyX-Code
# Line 305  END plt_curve; Line 253  END plt_curve;
253  \end_layout  \end_layout
254    
255  \begin_layout LyX-Code  \begin_layout LyX-Code
256  (***************************************************************)  
257  \end_layout  \end_layout
258    
259  \begin_layout LyX-Code  \begin_layout LyX-Code
# Line 313  MODEL plt_plot_integer( Line 261  MODEL plt_plot_integer(
261  \end_layout  \end_layout
262    
263  \begin_layout LyX-Code  \begin_layout LyX-Code
264  curve_set IS_A set OF integer_constant;      curve_set IS_A set OF integer_constant;
265  \end_layout  \end_layout
266    
267  \begin_layout LyX-Code  \begin_layout LyX-Code
268  curve[curve_set] WILL_BE plt_curve;      curve[curve_set] WILL_BE plt_curve;
269  \end_layout  \end_layout
270    
271  \begin_layout LyX-Code  \begin_layout LyX-Code
272  ) REFINES pltmodel();  )REFINES pltmodel();
273  \end_layout  \end_layout
274    
275  \begin_layout LyX-Code  \begin_layout LyX-Code
276  title, XLabel, YLabel IS_A symbol; (* mutable now! *)      title, XLabel, YLabel IS_A symbol;
277  \end_layout  \end_layout
278    
279  \begin_layout LyX-Code  \begin_layout LyX-Code
280  Xlow IS_A real;      Xlow IS_A real;
281  \end_layout  \end_layout
282    
283  \begin_layout LyX-Code  \begin_layout LyX-Code
284  Ylow IS_A real;      Ylow IS_A real;
285  \end_layout  \end_layout
286    
287  \begin_layout LyX-Code  \begin_layout LyX-Code
288  Xhigh IS_A real;      Xhigh IS_A real;
289  \end_layout  \end_layout
290    
291  \begin_layout LyX-Code  \begin_layout LyX-Code
292  Yhigh IS_A real;      Yhigh IS_A real;
293  \end_layout  \end_layout
294    
295  \begin_layout LyX-Code  \begin_layout LyX-Code
296  Xlog IS_A boolean;      Xlog IS_A boolean;
297  \end_layout  \end_layout
298    
299  \begin_layout LyX-Code  \begin_layout LyX-Code
300  Ylog IS_A boolean;      Ylog IS_A boolean;
301  \end_layout  \end_layout
302    
303  \begin_layout LyX-Code  \begin_layout LyX-Code
# Line 357  END plt_plot_integer; Line 305  END plt_plot_integer;
305  \end_layout  \end_layout
306    
307  \begin_layout LyX-Code  \begin_layout LyX-Code
308  (***************************************************************)  
309  \end_layout  \end_layout
310    
311  \begin_layout LyX-Code  \begin_layout LyX-Code
# Line 365  MODEL plt_plot_symbol( Line 313  MODEL plt_plot_symbol(
313  \end_layout  \end_layout
314    
315  \begin_layout LyX-Code  \begin_layout LyX-Code
316  curve_set IS_A set OF symbol_constant;      curve_set IS_A set OF symbol_constant;
317  \end_layout  \end_layout
318    
319  \begin_layout LyX-Code  \begin_layout LyX-Code
320  curve[curve_set] WILL_BE plt_curve;      curve[curve_set] WILL_BE plt_curve;
321  \end_layout  \end_layout
322    
323  \begin_layout LyX-Code  \begin_layout LyX-Code
324  ) REFINES pltmodel();  )REFINES pltmodel();
325  \end_layout  \end_layout
326    
327  \begin_layout LyX-Code  \begin_layout LyX-Code
328  title, XLabel, YLabel IS_A symbol; (* mutable now! *)      title, XLabel, YLabel IS_A symbol; (* mutable now! *)
329  \end_layout  \end_layout
330    
331  \begin_layout LyX-Code  \begin_layout LyX-Code
332  Xlow IS_A real;      Xlow IS_A real;
333  \end_layout  \end_layout
334    
335  \begin_layout LyX-Code  \begin_layout LyX-Code
336  Ylow IS_A real;      Ylow IS_A real;
337  \end_layout  \end_layout
338    
339  \begin_layout LyX-Code  \begin_layout LyX-Code
340  Xhigh IS_A real;      Xhigh IS_A real;
341  \end_layout  \end_layout
342    
343  \begin_layout LyX-Code  \begin_layout LyX-Code
344  Yhigh IS_A real;      Yhigh IS_A real;
345  \end_layout  \end_layout
346    
347  \begin_layout LyX-Code  \begin_layout LyX-Code
348  Xlog IS_A boolean;      Xlog IS_A boolean;
349  \end_layout  \end_layout
350    
351  \begin_layout LyX-Code  \begin_layout LyX-Code
352  Ylog IS_A boolean;      Ylog IS_A boolean;
353  \end_layout  \end_layout
354    
355  \begin_layout LyX-Code  \begin_layout LyX-Code
# Line 428  The file plot.a4l Line 376  The file plot.a4l
376  \end_layout  \end_layout
377    
378  \begin_layout Standard  \begin_layout Standard
379  As you can see, this file contains the two types we seek -- starting in  As you can see, this file contains the two types we seek.
  lines 59 and 71, respectively.  
380   However, before we can use them, we do need to understand them.   However, before we can use them, we do need to understand them.
381   We are, so to speak, on the receiving end of the reusability issue.   We are, so to speak, on the receiving end of the reusability issue.
382   If you spend some time, you will find that you can decipher these model   To make that less painful, we will examine how the above code works.
  definitions.  
  To make that less painful, we will help you do so here.  
383   If these models were better documented, they would be much less difficult   If these models were better documented, they would be much less difficult
384   to interpret.   to interpret.
385   In time we will add Notes to them to remedy this deficiency.   In time we will add Notes to them to remedy this deficiency.
# Line 655  If we look into this file we see the ref Line 600  If we look into this file we see the ref
600    
601  \noun default  \noun default
602  '  '
603  \noun off  \family typewriter
604  cmumodel  cmumodel
605  \noun default  \family default
606  '  '
607  \noun off  \noun off
608   is the parent model for all these models.   is the parent model for all these models.
# Line 709  The refinement hierarchy in the file plo Line 654  The refinement hierarchy in the file plo
654    
655  \begin_layout Standard  \begin_layout Standard
656  \begin_inset Marginal  \begin_inset Marginal
657  status open  status collapsed
658    
659  \begin_layout Standard  \begin_layout Standard
660  reasons for refinement  reasons for refinement
# Line 1038  METHODS Line 983  METHODS
983  \end_layout  \end_layout
984    
985  \begin_layout LyX-Code  \begin_layout LyX-Code
986  METHOD default_self;      METHOD default_self;
987  \end_layout  \end_layout
988    
989  \begin_layout LyX-Code  \begin_layout LyX-Code
990  (* set the title for the plot and the labels          (* set the title for the plot and the labels
991  \end_layout  \end_layout
992    
993  \begin_layout LyX-Code  \begin_layout LyX-Code
994     for the ordinate and abscissa *)             for the ordinate and abscissa *)
995  \end_layout  \end_layout
996    
997  \begin_layout LyX-Code  \begin_layout LyX-Code
998      massVSratio.title :=          massVSratio.title :=
999  \end_layout  \end_layout
1000    
1001  \begin_layout LyX-Code  \begin_layout LyX-Code
1002       'Metal mass of the walls vs H to D ratio              'Metal mass of the walls vs H to D ratio
1003  \backslash  \backslash
1004    
1005  \end_layout  \end_layout
1006    
1007  \begin_layout LyX-Code  \begin_layout LyX-Code
1008           for a thin-walled cylindrical vessel';               for a thin-walled cylindrical vessel';
1009  \end_layout  \end_layout
1010    
1011  \begin_layout LyX-Code  \begin_layout LyX-Code
1012      massVSratio.XLabel := 'H to D ratio';          massVSratio.XLabel := 'H to D ratio';
1013  \end_layout  \end_layout
1014    
1015  \begin_layout LyX-Code  \begin_layout LyX-Code
1016      massVSratio.YLabel := 'metal mass IN kg/m^3';          massVSratio.YLabel := 'metal mass IN kg/m^3';
1017  \end_layout  \end_layout
1018    
1019  \begin_layout LyX-Code  \begin_layout LyX-Code
1020  END default_self;      END default_self;
1021  \end_layout  \end_layout
1022    
1023  \begin_layout Caption  \begin_layout Caption
# Line 1165  The base case Line 1110  The base case
1110    
1111  \begin_layout Standard  \begin_layout Standard
1112  \begin_inset Marginal  \begin_inset Marginal
1113  status open  status collapsed
1114    
1115  \begin_layout Standard  \begin_layout Standard
1116  compile a vessel  compile a vessel
# Line 1173  compile a vessel Line 1118  compile a vessel
1118    
1119  \end_inset  \end_inset
1120    
   
 \end_layout  
   
 \begin_layout Standard  
1121  Select and compile the vessel model.  Select and compile the vessel model.
1122   Give the simulation the name V.   Give the simulation the name V.
1123   Select the simulation V in the bottom pane of the Library window and use   Select the simulation V in the bottom pane of the Library window and use
# Line 1185  Select and compile the vessel model. Line 1126  Select and compile the vessel model.
1126    
1127  \begin_layout Standard  \begin_layout Standard
1128  \begin_inset Marginal  \begin_inset Marginal
1129  status open  status collapsed
1130    
1131  \begin_layout Standard  \begin_layout Standard
1132  solving the base case  solving the base case
# Line 1193  solving the base case Line 1134  solving the base case
1134    
1135  \end_inset  \end_inset
1136    
   
 \end_layout  
   
 \begin_layout Standard  
1137  In the Browser, place the mouse cursor over the upper left pane.  In the Browser, place the mouse cursor over the upper left pane.
1138   Use the right mouse button to run methods reset and values, then send the   Use the right mouse button to run methods reset and values, then send the
1139   model to the Solver by typing Alt-x s.   model to the Solver by typing Alt-x s.
# Line 1206  In the Browser, place the mouse cursor o Line 1143  In the Browser, place the mouse cursor o
1143    
1144  \begin_layout Standard  \begin_layout Standard
1145  \begin_inset Marginal  \begin_inset Marginal
1146  status open  status collapsed
1147    
1148  \begin_layout Standard  \begin_layout Standard
1149  graphical case study optimization  graphical case study optimization
# Line 1214  graphical case study optimization Line 1151  graphical case study optimization
1151    
1152  \end_inset  \end_inset
1153    
   
 \end_layout  
   
 \begin_layout Standard  
1154  We now know that it takes 535.7 kg of metal to make a 250 cubic foot vessel  We now know that it takes 535.7 kg of metal to make a 250 cubic foot vessel
1155   which is twice as high as it is broad.   which is twice as high as it is broad.
1156   Suppose that now we want to know the largest volume that this amount of   Suppose that now we want to know the largest volume that this amount of
# Line 1232  We now know that it takes 535.7 kg of me Line 1165  We now know that it takes 535.7 kg of me
1165    
1166  \begin_layout Standard  \begin_layout Standard
1167  \begin_inset Marginal  \begin_inset Marginal
1168  status open  status collapsed
1169    
1170  \begin_layout Standard  \begin_layout Standard
1171  script recorded so far  script recorded so far
# Line 1240  script recorded so far Line 1173  script recorded so far
1173    
1174  \end_inset  \end_inset
1175    
   
 \end_layout  
   
 \begin_layout Standard  
1176  Turn off the recording button on the Script window.  Turn off the recording button on the Script window.
1177   The recording should look something like   The recording should look something like
1178  \end_layout  \end_layout
# Line 1294  Case study examples Line 1223  Case study examples
1223    
1224  \begin_layout Standard  \begin_layout Standard
1225  \begin_inset Marginal  \begin_inset Marginal
1226  status open  status collapsed
1227    
1228  \begin_layout Standard  \begin_layout Standard
1229  configuring a case study  configuring a case study
# Line 1302  configuring a case study Line 1231  configuring a case study
1231    
1232  \end_inset  \end_inset
1233    
   
 \end_layout  
   
 \begin_layout Standard  
1234  The STUDY command takes a lot of arguments.  The STUDY command takes a lot of arguments.
1235   Well explain them all momentarily, but should you forget them simply enter   Well explain them all momentarily, but should you forget them simply enter
1236   the command STUDY without arguments in the ASCEND Console window or xterm   the command STUDY without arguments in the ASCEND Console window or xterm
# Line 1584  STUDY behavior details Line 1509  STUDY behavior details
1509    
1510  \begin_layout Standard  \begin_layout Standard
1511  \begin_inset Marginal  \begin_inset Marginal
1512  status open  status collapsed
1513    
1514  \begin_layout Standard  \begin_layout Standard
1515  variable list  variable list
# Line 1592  variable list Line 1517  variable list
1517    
1518  \end_inset  \end_inset
1519    
   
 \end_layout  
   
 \begin_layout Standard  
1520  We now turn to the details of the STUDY statement.  We now turn to the details of the STUDY statement.
1521   As we saw in Section 4.2.2.1, any number of variables to be monitored can   As we saw in Section 4.2.2.1, any number of variables to be monitored can
1522   follow the STUDY keyword.   follow the STUDY keyword.
# Line 1604  We now turn to the details of the STUDY Line 1525  We now turn to the details of the STUDY
1525    
1526  \begin_layout Standard  \begin_layout Standard
1527  \begin_inset Marginal  \begin_inset Marginal
1528  status open  status collapsed
1529    
1530  \begin_layout Standard  \begin_layout Standard
1531  IN clause  IN clause
# Line 1612  IN clause Line 1533  IN clause
1533    
1534  \end_inset  \end_inset
1535    
   
 \end_layout  
   
 \begin_layout Standard  
1536  The IN clause specifies which part of a simulation is to be sent to the  The IN clause specifies which part of a simulation is to be sent to the
1537   Solver; a small part of a much larger model can be studied if you so desire.   Solver; a small part of a much larger model can be studied if you so desire.
1538   All the variable and parameter names that follow the STUDY keyword and   All the variable and parameter names that follow the STUDY keyword and
# Line 1625  The IN clause specifies which part of a Line 1542  The IN clause specifies which part of a
1542    
1543  \begin_layout Standard  \begin_layout Standard
1544  \begin_inset Marginal  \begin_inset Marginal
1545  status open  status collapsed
1546    
1547  \begin_layout Standard  \begin_layout Standard
1548  parameter list  parameter list
# Line 1633  parameter list Line 1550  parameter list
1550    
1551  \end_inset  \end_inset
1552    
   
 \end_layout  
   
 \begin_layout Standard  
1553  The VARYING clauses is a list of lists.  The VARYING clauses is a list of lists.
1554   Each inner list gives the name of the parameter to vary followed by its   Each inner list gives the name of the parameter to vary followed by its
1555   list of values.   list of values.
# Line 1648  ter studies. Line 1561  ter studies.
1561    
1562  \begin_layout Standard  \begin_layout Standard
1563  \begin_inset Marginal  \begin_inset Marginal
1564  status open  status collapsed
1565    
1566  \begin_layout Standard  \begin_layout Standard
1567  solver name  solver name
# Line 1656  solver name Line 1569  solver name
1569    
1570  \end_inset  \end_inset
1571    
   
 \end_layout  
   
 \begin_layout Standard  
1572  The solver named in the USING clause is invoked on each case.  The solver named in the USING clause is invoked on each case.
1573   The solver may be any of the algebraic solvers or optimizers, but the integrato   The solver may be any of the algebraic solvers or optimizers, but the integrato
1574  rs (e.g.  rs (e.g.
# Line 1669  rs (e.g. Line 1578  rs (e.g.
1578    
1579  \begin_layout Standard  \begin_layout Standard
1580  \begin_inset Marginal  \begin_inset Marginal
1581  status open  status collapsed
1582    
1583  \begin_layout Standard  \begin_layout Standard
1584  data file name  data file name
# Line 1677  data file name Line 1586  data file name
1586    
1587  \end_inset  \end_inset
1588    
   
 \end_layout  
   
 \begin_layout Standard  
1589  The case data are stored in the file name which appears in the OUTFILE clause.  The case data are stored in the file name which appears in the OUTFILE clause.
1590   By default, this file is overwritten when a STUDY is started, so if you   By default, this file is overwritten when a STUDY is started, so if you
1591   want multiple result files, use separate file names.   want multiple result files, use separate file names.
# Line 1688  The case data are stored in the file nam Line 1593  The case data are stored in the file nam
1593    
1594  \begin_layout Standard  \begin_layout Standard
1595  \begin_inset Marginal  \begin_inset Marginal
1596  status open  status collapsed
1597    
1598  \begin_layout Standard  \begin_layout Standard
1599  error handling  error handling
# Line 1696  error handling Line 1601  error handling
1601    
1602  \end_inset  \end_inset
1603    
   
 \end_layout  
   
 \begin_layout Standard  
1604  When the solver fails to converge or encounters an error, the STUDY can  When the solver fails to converge or encounters an error, the STUDY can
1605   either ignore it (ERROR IGNORE) and go on to the next case, warn you (ERROR   either ignore it (ERROR IGNORE) and go on to the next case, warn you (ERROR
1606   WARN) and go on to the next case, or stop (ERROR STOP).   WARN) and go on to the next case, or stop (ERROR STOP).

Legend:
Removed from v.1369  
changed lines
  Added in v.1370

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