1 |
jpye |
2785 |
#LyX 2.1 created this file. For more info see http://www.lyx.org/ |
2 |
|
|
\lyxformat 474 |
3 |
johnpye |
825 |
\begin_document |
4 |
|
|
\begin_header |
5 |
|
|
\textclass book |
6 |
jpye |
1385 |
\begin_preamble |
7 |
|
|
\usepackage[bookmarks,bookmarksnumbered=true]{hyperref} |
8 |
|
|
\usepackage{lmodern} |
9 |
|
|
\usepackage{color} |
10 |
|
|
\definecolor{darkred}{rgb}{0.55,0,0} |
11 |
|
|
\definecolor{darkgreen}{rgb}{0,0.55,0} |
12 |
|
|
|
13 |
|
|
\usepackage{listings} |
14 |
|
|
|
15 |
|
|
\lstdefinelanguage{ascend}{ |
16 |
|
|
morekeywords=[1]{ |
17 |
|
|
REQUIRE,IMPORT,NOTES, |
18 |
|
|
ATOM,MODEL,METHOD,METHODS, |
19 |
|
|
UNIVERSAL,CONSTANT,DIMENSION,DEFAULT, |
20 |
|
|
END,FOR,CREATE,DO,EXTERNAL, |
21 |
|
|
CONDITIONAL,SATISFIED,WHEN,CASE,OTHERWISE,TRUE, |
22 |
|
|
FALSE,SELF, |
23 |
|
|
}, |
24 |
|
|
morekeywords=[2]{ |
25 |
|
|
REFINES,IS_A,WILL_BE,ALIASES,INPUT,OUTPUT,DATA, |
26 |
|
|
FIX,FREE,RUN,ARE_THE_SAME |
27 |
|
|
}, |
28 |
|
|
morekeywords=[3]{ |
29 |
|
|
solver_var,integer_constant |
30 |
|
|
}, |
31 |
|
|
sensitive=true, |
32 |
|
|
morecomment=[s][\color{blue}]{(*}{*)}, |
33 |
|
|
morestring=[b][\color{darkgreen}]', |
34 |
|
|
morestring=[b][\color{darkgreen}]", |
35 |
|
|
morecomment=[s][\color{darkgreen}]{\{}{\}}, |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
\lstnewenvironment{ascend} |
39 |
|
|
{\lstset{basicstyle=\ttfamily\small, keywordstyle=\color{darkred}}} |
40 |
|
|
{} |
41 |
|
|
|
42 |
|
|
\lstdefinestyle{ascendlisting}{ |
43 |
|
|
style=ascendlisting, |
44 |
|
|
basicstyle=\small\ttfamily, |
45 |
|
|
numbers=left, |
46 |
|
|
numbersep=5pt, |
47 |
|
|
numberstyle=\tiny, |
48 |
|
|
escapeinside={(*@}{@*)} |
49 |
|
|
backgroundcolor=\color{lightgrey} |
50 |
|
|
} |
51 |
|
|
\end_preamble |
52 |
jpye |
2785 |
\use_default_options false |
53 |
|
|
\maintain_unincluded_children false |
54 |
johnpye |
825 |
\language english |
55 |
jpye |
2785 |
\language_package default |
56 |
johnpye |
825 |
\inputencoding auto |
57 |
jpye |
2785 |
\fontencoding global |
58 |
jpye |
1766 |
\font_roman default |
59 |
|
|
\font_sans default |
60 |
|
|
\font_typewriter default |
61 |
jpye |
2785 |
\font_math auto |
62 |
jpye |
1766 |
\font_default_family default |
63 |
jpye |
2785 |
\use_non_tex_fonts false |
64 |
jpye |
1766 |
\font_sc false |
65 |
|
|
\font_osf false |
66 |
|
|
\font_sf_scale 100 |
67 |
|
|
\font_tt_scale 100 |
68 |
johnpye |
825 |
\graphics default |
69 |
jpye |
2785 |
\default_output_format default |
70 |
|
|
\output_sync 0 |
71 |
|
|
\bibtex_command default |
72 |
|
|
\index_command default |
73 |
johnpye |
825 |
\paperfontsize default |
74 |
|
|
\spacing single |
75 |
jpye |
2785 |
\use_hyperref false |
76 |
johnpye |
825 |
\papersize a4paper |
77 |
|
|
\use_geometry false |
78 |
jpye |
2785 |
\use_package amsmath 2 |
79 |
|
|
\use_package amssymb 2 |
80 |
|
|
\use_package cancel 1 |
81 |
|
|
\use_package esint 0 |
82 |
|
|
\use_package mathdots 0 |
83 |
|
|
\use_package mathtools 1 |
84 |
|
|
\use_package mhchem 0 |
85 |
|
|
\use_package stackrel 1 |
86 |
|
|
\use_package stmaryrd 1 |
87 |
|
|
\use_package undertilde 1 |
88 |
johnpye |
825 |
\cite_engine basic |
89 |
jpye |
2785 |
\cite_engine_type default |
90 |
|
|
\biblio_style plain |
91 |
johnpye |
825 |
\use_bibtopic false |
92 |
jpye |
2785 |
\use_indices false |
93 |
johnpye |
825 |
\paperorientation portrait |
94 |
jpye |
2785 |
\suppress_date false |
95 |
|
|
\justification true |
96 |
|
|
\use_refstyle 0 |
97 |
|
|
\index Index |
98 |
|
|
\shortcut idx |
99 |
|
|
\color #008000 |
100 |
|
|
\end_index |
101 |
johnpye |
825 |
\secnumdepth 3 |
102 |
|
|
\tocdepth 3 |
103 |
|
|
\paragraph_separation indent |
104 |
jpye |
2785 |
\paragraph_indentation default |
105 |
johnpye |
825 |
\quotes_language english |
106 |
|
|
\papercolumns 1 |
107 |
|
|
\papersides 2 |
108 |
|
|
\paperpagestyle default |
109 |
|
|
\tracking_changes false |
110 |
jpye |
1766 |
\output_changes false |
111 |
jpye |
2785 |
\html_math_output 0 |
112 |
|
|
\html_css_as_file 0 |
113 |
|
|
\html_be_strict false |
114 |
johnpye |
825 |
\end_header |
115 |
|
|
|
116 |
|
|
\begin_body |
117 |
|
|
|
118 |
|
|
\begin_layout Chapter |
119 |
|
|
Preparing a model for reuse |
120 |
jpye |
2785 |
\begin_inset Index idx |
121 |
|
|
status collapsed |
122 |
johnpye |
825 |
|
123 |
jpye |
2785 |
\begin_layout Plain Layout |
124 |
|
|
reuse |
125 |
|
|
\end_layout |
126 |
|
|
|
127 |
johnpye |
825 |
\end_inset |
128 |
|
|
|
129 |
|
|
|
130 |
jpye |
2785 |
\begin_inset CommandInset label |
131 |
|
|
LatexCommand label |
132 |
jpye |
1766 |
name "cha:model2" |
133 |
johnpye |
825 |
|
134 |
|
|
\end_inset |
135 |
|
|
|
136 |
|
|
|
137 |
|
|
\end_layout |
138 |
|
|
|
139 |
|
|
\begin_layout Standard |
140 |
|
|
There are four major ways to prepare a model for reuse. |
141 |
|
|
First, you should add comments to a model. |
142 |
|
|
Second, you should add methods to a model definition to pass to a future |
143 |
|
|
user your experience in creating an instance of this type which is well-posed. |
144 |
|
|
Third, you should parameterize the model type definition to alert a future |
145 |
|
|
user as to which parts of this model you deem to be the most likely to |
146 |
|
|
be shared. |
147 |
|
|
And fourth, you should prepare a script that a future user can run to solve |
148 |
|
|
a sample problem involving an instance of the model. |
149 |
|
|
We shall consider each of these items in turn in what follows. |
150 |
jpye |
1352 |
\begin_inset Foot |
151 |
|
|
status open |
152 |
|
|
|
153 |
jpye |
2785 |
\begin_layout Plain Layout |
154 |
jpye |
1352 |
More detail on these is available in papers and reports by Allan, Zaher, |
155 |
|
|
Chittur et al |
156 |
jpye |
2785 |
\begin_inset CommandInset citation |
157 |
|
|
LatexCommand cite |
158 |
jpye |
1766 |
key "Allan1997d" |
159 |
jpye |
1352 |
|
160 |
|
|
\end_inset |
161 |
|
|
|
162 |
|
|
, |
163 |
jpye |
2785 |
\begin_inset CommandInset citation |
164 |
|
|
LatexCommand cite |
165 |
jpye |
1766 |
key "Allan1997b" |
166 |
jpye |
1352 |
|
167 |
|
|
\end_inset |
168 |
|
|
|
169 |
|
|
, |
170 |
jpye |
2785 |
\begin_inset CommandInset citation |
171 |
|
|
LatexCommand cite |
172 |
jpye |
1766 |
key "Allan1997" |
173 |
jpye |
1352 |
|
174 |
|
|
\end_inset |
175 |
|
|
|
176 |
|
|
, |
177 |
jpye |
2785 |
\begin_inset CommandInset citation |
178 |
|
|
LatexCommand cite |
179 |
jpye |
1766 |
key "Krishnan1993" |
180 |
jpye |
1352 |
|
181 |
|
|
\end_inset |
182 |
|
|
|
183 |
|
|
, |
184 |
jpye |
2785 |
\begin_inset CommandInset citation |
185 |
|
|
LatexCommand cite |
186 |
jpye |
1766 |
key "Zaher1991" |
187 |
jpye |
1352 |
|
188 |
|
|
\end_inset |
189 |
|
|
|
190 |
|
|
. |
191 |
johnpye |
825 |
\end_layout |
192 |
|
|
|
193 |
jpye |
1352 |
\end_inset |
194 |
|
|
|
195 |
|
|
|
196 |
|
|
\end_layout |
197 |
|
|
|
198 |
johnpye |
825 |
\begin_layout Section |
199 |
|
|
Adding comments |
200 |
jpye |
2785 |
\begin_inset Index idx |
201 |
|
|
status collapsed |
202 |
johnpye |
825 |
|
203 |
jpye |
2785 |
\begin_layout Plain Layout |
204 |
|
|
comments |
205 |
|
|
\end_layout |
206 |
|
|
|
207 |
johnpye |
825 |
\end_inset |
208 |
|
|
|
209 |
|
|
and notes |
210 |
jpye |
2785 |
\begin_inset Index idx |
211 |
|
|
status collapsed |
212 |
johnpye |
825 |
|
213 |
jpye |
2785 |
\begin_layout Plain Layout |
214 |
|
|
notes |
215 |
|
|
\end_layout |
216 |
|
|
|
217 |
johnpye |
825 |
\end_inset |
218 |
|
|
|
219 |
|
|
|
220 |
|
|
\end_layout |
221 |
|
|
|
222 |
|
|
\begin_layout Standard |
223 |
|
|
In ASCEND we can create traditional comments for a model -- i.e., add text |
224 |
|
|
to the code that aids anyone looking at the code to understand what is |
225 |
|
|
there. |
226 |
|
|
We do this by enclosing text with the delimiters |
227 |
|
|
\family typewriter |
228 |
|
|
(* |
229 |
|
|
\family default |
230 |
|
|
|
231 |
jpye |
2785 |
\begin_inset Index idx |
232 |
|
|
status collapsed |
233 |
johnpye |
825 |
|
234 |
jpye |
2785 |
\begin_layout Plain Layout |
235 |
|
|
(* |
236 |
|
|
\end_layout |
237 |
|
|
|
238 |
johnpye |
825 |
\end_inset |
239 |
|
|
|
240 |
jpye |
1766 |
and |
241 |
johnpye |
825 |
\family typewriter |
242 |
jpye |
1766 |
*) |
243 |
johnpye |
825 |
\family default |
244 |
|
|
|
245 |
jpye |
2785 |
\begin_inset Index idx |
246 |
|
|
status collapsed |
247 |
johnpye |
825 |
|
248 |
jpye |
2785 |
\begin_layout Plain Layout |
249 |
|
|
*) |
250 |
|
|
\end_layout |
251 |
|
|
|
252 |
johnpye |
825 |
\end_inset |
253 |
|
|
|
254 |
|
|
. |
255 |
|
|
Thus the line |
256 |
|
|
\end_layout |
257 |
|
|
|
258 |
|
|
\begin_layout LyX-Code |
259 |
jpye |
1385 |
\begin_inset ERT |
260 |
|
|
status open |
261 |
|
|
|
262 |
jpye |
2785 |
\begin_layout Plain Layout |
263 |
jpye |
1385 |
|
264 |
|
|
|
265 |
|
|
\backslash |
266 |
|
|
begin{ascend} |
267 |
|
|
\end_layout |
268 |
|
|
|
269 |
jpye |
2785 |
\begin_layout Plain Layout |
270 |
jpye |
1385 |
|
271 |
johnpye |
825 |
(* This is a comment *) |
272 |
|
|
\end_layout |
273 |
|
|
|
274 |
jpye |
2785 |
\begin_layout Plain Layout |
275 |
jpye |
1385 |
|
276 |
|
|
|
277 |
|
|
\backslash |
278 |
|
|
end{ascend} |
279 |
|
|
\end_layout |
280 |
|
|
|
281 |
|
|
\end_inset |
282 |
|
|
|
283 |
|
|
|
284 |
|
|
\end_layout |
285 |
|
|
|
286 |
|
|
\begin_layout Standard |
287 |
johnpye |
825 |
is a comment in ASCEND. |
288 |
|
|
Traditional comments are only visible when we display the code using the |
289 |
|
|
Display code tool |
290 |
jpye |
2785 |
\begin_inset Index idx |
291 |
|
|
status collapsed |
292 |
johnpye |
825 |
|
293 |
jpye |
2785 |
\begin_layout Plain Layout |
294 |
|
|
Display code tool |
295 |
|
|
\end_layout |
296 |
|
|
|
297 |
johnpye |
825 |
\end_inset |
298 |
|
|
|
299 |
|
|
|
300 |
jpye |
2785 |
\begin_inset Index idx |
301 |
|
|
status collapsed |
302 |
johnpye |
825 |
|
303 |
jpye |
2785 |
\begin_layout Plain Layout |
304 |
|
|
tool, Display code |
305 |
|
|
\end_layout |
306 |
|
|
|
307 |
johnpye |
825 |
\end_inset |
308 |
|
|
|
309 |
|
|
in the Library window or when we view the code in the text editor we used |
310 |
|
|
to create it. |
311 |
|
|
|
312 |
|
|
\end_layout |
313 |
|
|
|
314 |
|
|
\begin_layout Standard |
315 |
|
|
We suggest we can do more for the modeler with the concept of Notes, a form |
316 |
|
|
of "active" comments available in ASCEND. |
317 |
|
|
ASCEND has tools to extract notes and display them in searchable form. |
318 |
|
|
\end_layout |
319 |
|
|
|
320 |
|
|
\begin_layout Standard |
321 |
jpye |
2785 |
\begin_inset Index idx |
322 |
|
|
status collapsed |
323 |
johnpye |
825 |
|
324 |
jpye |
2785 |
\begin_layout Plain Layout |
325 |
|
|
comments, active |
326 |
|
|
\end_layout |
327 |
|
|
|
328 |
johnpye |
825 |
\end_inset |
329 |
|
|
|
330 |
|
|
In Figure |
331 |
jpye |
2785 |
\begin_inset CommandInset ref |
332 |
|
|
LatexCommand ref |
333 |
jpye |
1766 |
reference "fig:model2.vesselWithNotes" |
334 |
johnpye |
825 |
|
335 |
|
|
\end_inset |
336 |
|
|
|
337 |
|
|
|
338 |
|
|
\noun off |
339 |
|
|
we show two types of notes the modeler can add. |
340 |
jpye |
1385 |
|
341 |
|
|
\series bold |
342 |
johnpye |
825 |
\noun default |
343 |
jpye |
1385 |
Longer notes |
344 |
|
|
\series default |
345 |
|
|
\noun off |
346 |
|
|
are set off in block style starting with the keyword |
347 |
|
|
\family sans |
348 |
|
|
\noun default |
349 |
johnpye |
825 |
NOTES |
350 |
|
|
\family default |
351 |
|
|
\noun off |
352 |
|
|
and ending with |
353 |
jpye |
1385 |
\family sans |
354 |
johnpye |
825 |
\noun default |
355 |
|
|
END NOTES |
356 |
|
|
\family default |
357 |
|
|
\noun off |
358 |
|
|
. |
359 |
|
|
In this model, we declare two notes in this manner: (1) to indicate who |
360 |
|
|
the author is and (2) to indicate the creation date for this model. |
361 |
jpye |
1385 |
Note that the notes are director to documenting |
362 |
|
|
\family sans |
363 |
|
|
\noun default |
364 |
|
|
SELF |
365 |
|
|
\family default |
366 |
|
|
\noun off |
367 |
|
|
, which is the model itself -- i.e., the vessel model as a whole object. |
368 |
johnpye |
825 |
The object one documents can be any instance in the model -- any variable, |
369 |
|
|
equation or part. |
370 |
|
|
The tools for handling notes can sort on the terms enclosed in single quotes |
371 |
|
|
so one could, for example, isolate the author notes for all the models. |
372 |
|
|
\end_layout |
373 |
|
|
|
374 |
|
|
\begin_layout Standard |
375 |
jpye |
1385 |
Vessel model with |
376 |
|
|
\family sans |
377 |
|
|
NOTES |
378 |
|
|
\family default |
379 |
|
|
added (model |
380 |
|
|
\family typewriter |
381 |
|
|
vesselNotes.a4c |
382 |
|
|
\family default |
383 |
johnpye |
825 |
|
384 |
jpye |
2785 |
\begin_inset Index idx |
385 |
|
|
status collapsed |
386 |
johnpye |
825 |
|
387 |
jpye |
2785 |
\begin_layout Plain Layout |
388 |
|
|
vesselNotes.a4c |
389 |
|
|
\end_layout |
390 |
|
|
|
391 |
jpye |
1385 |
\end_inset |
392 |
johnpye |
825 |
|
393 |
jpye |
1385 |
) |
394 |
jpye |
2785 |
\begin_inset CommandInset label |
395 |
|
|
LatexCommand label |
396 |
jpye |
1766 |
name "fig:model2.vesselWithNotes" |
397 |
johnpye |
825 |
|
398 |
jpye |
1385 |
\end_inset |
399 |
johnpye |
825 |
|
400 |
|
|
|
401 |
|
|
\end_layout |
402 |
|
|
|
403 |
jpye |
1385 |
\begin_layout Standard |
404 |
|
|
\begin_inset ERT |
405 |
|
|
status open |
406 |
johnpye |
825 |
|
407 |
jpye |
2785 |
\begin_layout Plain Layout |
408 |
johnpye |
825 |
|
409 |
|
|
|
410 |
jpye |
1385 |
\backslash |
411 |
|
|
lstset{language=ASCEND} |
412 |
johnpye |
825 |
\end_layout |
413 |
|
|
|
414 |
jpye |
2785 |
\begin_layout Plain Layout |
415 |
johnpye |
825 |
|
416 |
|
|
|
417 |
jpye |
1385 |
\backslash |
418 |
|
|
lstinputlisting[firstline=24]{../models/vesselNotes.a4c} |
419 |
johnpye |
825 |
\end_layout |
420 |
|
|
|
421 |
jpye |
2785 |
\begin_layout Plain Layout |
422 |
johnpye |
825 |
|
423 |
|
|
\end_layout |
424 |
|
|
|
425 |
|
|
\end_inset |
426 |
|
|
|
427 |
|
|
|
428 |
|
|
\end_layout |
429 |
|
|
|
430 |
|
|
\begin_layout Standard |
431 |
|
|
A user may use any term desired in the single quotes. |
432 |
|
|
We have not decided yet what the better set of terms should be so we do |
433 |
|
|
not as yet suggest any. |
434 |
|
|
With time we expect the terms used to settle down to just a few that are |
435 |
|
|
repeated for all the models in a library. |
436 |
|
|
\end_layout |
437 |
|
|
|
438 |
|
|
\begin_layout Standard |
439 |
jpye |
1385 |
There are also |
440 |
|
|
\series bold |
441 |
|
|
short notes |
442 |
|
|
\series default |
443 |
|
|
we can attach to every variable in the model. |
444 |
johnpye |
825 |
A "one liner |
445 |
jpye |
2785 |
\begin_inset Index idx |
446 |
|
|
status collapsed |
447 |
johnpye |
825 |
|
448 |
jpye |
2785 |
\begin_layout Plain Layout |
449 |
|
|
notes, one liner |
450 |
|
|
\end_layout |
451 |
|
|
|
452 |
johnpye |
825 |
\end_inset |
453 |
|
|
|
454 |
|
|
|
455 |
jpye |
2785 |
\begin_inset Index idx |
456 |
|
|
status collapsed |
457 |
johnpye |
825 |
|
458 |
jpye |
2785 |
\begin_layout Plain Layout |
459 |
|
|
one liner |
460 |
|
|
\end_layout |
461 |
|
|
|
462 |
johnpye |
825 |
\end_inset |
463 |
|
|
|
464 |
|
|
" in double quotes just following the variable name allows the automatic |
465 |
|
|
annotation of variables in reports. |
466 |
|
|
\end_layout |
467 |
|
|
|
468 |
|
|
\begin_layout Standard |
469 |
|
|
The last few lines of Figure |
470 |
jpye |
2785 |
\begin_inset CommandInset ref |
471 |
|
|
LatexCommand ref |
472 |
jpye |
1766 |
reference "fig:model2.vesselWithNotes" |
473 |
johnpye |
825 |
|
474 |
|
|
\end_inset |
475 |
|
|
|
476 |
|
|
|
477 |
|
|
\noun off |
478 |
jpye |
1385 |
shows adding |
479 |
|
|
\series bold |
480 |
|
|
\noun default |
481 |
|
|
separate notes |
482 |
|
|
\series default |
483 |
|
|
\noun off |
484 |
|
|
we write using |
485 |
|
|
\family sans |
486 |
|
|
\noun default |
487 |
|
|
ADD NOTES IN |
488 |
|
|
\family default |
489 |
|
|
\noun off |
490 |
|
|
syntax |
491 |
jpye |
2785 |
\begin_inset Index idx |
492 |
|
|
status collapsed |
493 |
johnpye |
825 |
|
494 |
jpye |
2785 |
\begin_layout Plain Layout |
495 |
|
|
ADD NOTES IN object |
496 |
|
|
\end_layout |
497 |
|
|
|
498 |
johnpye |
825 |
\end_inset |
499 |
|
|
|
500 |
|
|
. |
501 |
|
|
This object can appear before or after or in a different file from the |
502 |
|
|
object it describes. |
503 |
|
|
This style of note writing is useful as it allows another person to add |
504 |
|
|
notes to a model without changing the code for a model. |
505 |
|
|
Thus it allows several different sets of notes to exist for a single model, |
506 |
|
|
with the choice of which to use being up to the person maintaining the |
507 |
|
|
model library. |
508 |
|
|
Finally, it allows one to eliminate the "clutter" the documentation often |
509 |
|
|
adds to the code. |
510 |
|
|
\end_layout |
511 |
|
|
|
512 |
|
|
\begin_layout Section |
513 |
|
|
Adding methods |
514 |
jpye |
2785 |
\begin_inset Index idx |
515 |
|
|
status collapsed |
516 |
johnpye |
825 |
|
517 |
jpye |
2785 |
\begin_layout Plain Layout |
518 |
|
|
methods, adding |
519 |
|
|
\end_layout |
520 |
|
|
|
521 |
johnpye |
825 |
\end_inset |
522 |
|
|
|
523 |
|
|
|
524 |
jpye |
2785 |
\begin_inset Index idx |
525 |
|
|
status collapsed |
526 |
johnpye |
825 |
|
527 |
jpye |
2785 |
\begin_layout Plain Layout |
528 |
|
|
adding methods |
529 |
|
|
\end_layout |
530 |
|
|
|
531 |
johnpye |
825 |
\end_inset |
532 |
|
|
|
533 |
|
|
|
534 |
|
|
\end_layout |
535 |
|
|
|
536 |
|
|
\begin_layout Standard |
537 |
|
|
We would next like to pass along our experiences in getting this model to |
538 |
|
|
be well-posed -- i.e., we would like to tell future users which variables |
539 |
|
|
we decided to fix and which we decided to calculate. |
540 |
|
|
We would also like to provide some typical values for the variables we |
541 |
|
|
decided to fix. |
542 |
|
|
ASCEND allows us to attach any number of methods to a type definition. |
543 |
|
|
Methods are procedural code that we can request be run through the interface |
544 |
|
|
while browsing a model instance. |
545 |
|
|
We shall include methods as described in Table |
546 |
jpye |
2785 |
\begin_inset CommandInset ref |
547 |
|
|
LatexCommand ref |
548 |
jpye |
1766 |
reference "tab:model2.reqdMethods" |
549 |
johnpye |
825 |
|
550 |
|
|
\end_inset |
551 |
|
|
|
552 |
|
|
|
553 |
|
|
\noun off |
554 |
|
|
to set just the right fixed flags and variable values for an instance of |
555 |
|
|
our vessel model to be well-posed. |
556 |
|
|
\end_layout |
557 |
|
|
|
558 |
|
|
\begin_layout Standard |
559 |
|
|
The system has defaults definitions for all these methods. |
560 |
|
|
You already saw that to be true if you went through the process of setting |
561 |
|
|
all the fixed flags to FALSE in the previous chapter. |
562 |
|
|
In case you did not, load and compile the vesselPlain.a4c model in ASCEND. |
563 |
|
|
Export the compiled instance to the Browser. |
564 |
|
|
Then in the Browser, under the Edit button, select Run method. |
565 |
|
|
You will see a list containing these and other methods we shall be describing |
566 |
|
|
shortly. |
567 |
|
|
Select specify and hit the OK button. |
568 |
|
|
Then look in the Console window. |
569 |
|
|
A message similar to the following will appear, with all but the first |
570 |
|
|
line being in red to signify you should pay attention to the message: |
571 |
|
|
\end_layout |
572 |
|
|
|
573 |
|
|
\begin_layout LyX-Code |
574 |
|
|
Running method specify in v |
575 |
|
|
\end_layout |
576 |
|
|
|
577 |
|
|
\begin_layout LyX-Code |
578 |
|
|
Found STOP |
579 |
jpye |
2785 |
\begin_inset Index idx |
580 |
|
|
status collapsed |
581 |
johnpye |
825 |
|
582 |
jpye |
2785 |
\begin_layout Plain Layout |
583 |
|
|
STOP |
584 |
|
|
\end_layout |
585 |
|
|
|
586 |
johnpye |
825 |
\end_inset |
587 |
|
|
|
588 |
|
|
statement in METHOD |
589 |
|
|
\end_layout |
590 |
|
|
|
591 |
|
|
\begin_layout LyX-Code |
592 |
|
|
C: |
593 |
|
|
\backslash |
594 |
|
|
PROGRAM FILES |
595 |
|
|
\backslash |
596 |
|
|
ASCEND |
597 |
|
|
\backslash |
598 |
|
|
ASCEND4 |
599 |
|
|
\backslash |
600 |
|
|
models |
601 |
|
|
\backslash |
602 |
|
|
basemodel.a4l:307 |
603 |
|
|
\end_layout |
604 |
|
|
|
605 |
|
|
\begin_layout LyX-Code |
606 |
|
|
STOP {Error |
607 |
jpye |
2785 |
\begin_inset Index idx |
608 |
|
|
status collapsed |
609 |
johnpye |
825 |
|
610 |
jpye |
2785 |
\begin_layout Plain Layout |
611 |
|
|
error |
612 |
|
|
\end_layout |
613 |
|
|
|
614 |
johnpye |
825 |
\end_inset |
615 |
|
|
|
616 |
|
|
! Standard method "specify" called but not |
617 |
|
|
\end_layout |
618 |
|
|
|
619 |
|
|
\begin_layout LyX-Code |
620 |
|
|
written in MODEL.}; |
621 |
|
|
\end_layout |
622 |
|
|
|
623 |
|
|
\begin_layout Standard |
624 |
|
|
This message is telling you that you have just run the default specify method |
625 |
jpye |
2785 |
\begin_inset Index idx |
626 |
|
|
status collapsed |
627 |
johnpye |
825 |
|
628 |
jpye |
2785 |
\begin_layout Plain Layout |
629 |
|
|
specify method, default |
630 |
|
|
\end_layout |
631 |
|
|
|
632 |
johnpye |
825 |
\end_inset |
633 |
|
|
|
634 |
|
|
. |
635 |
|
|
We have to hand-craft every specify method so the default method is not |
636 |
|
|
appropriate. |
637 |
|
|
This message is alerting us to the fact that we did not yet write a special |
638 |
|
|
specify method for this model type. |
639 |
|
|
\end_layout |
640 |
|
|
|
641 |
|
|
\begin_layout Standard |
642 |
|
|
Try running the ClearAll |
643 |
jpye |
2785 |
\begin_inset Index idx |
644 |
|
|
status collapsed |
645 |
johnpye |
825 |
|
646 |
jpye |
2785 |
\begin_layout Plain Layout |
647 |
|
|
ClearAll |
648 |
|
|
\end_layout |
649 |
|
|
|
650 |
johnpye |
825 |
\end_inset |
651 |
|
|
|
652 |
|
|
method. |
653 |
|
|
The default ClearAll method is always the one you will want so it does |
654 |
|
|
not put out a message to alert you that it is the default. |
655 |
|
|
|
656 |
|
|
\end_layout |
657 |
|
|
|
658 |
|
|
\begin_layout Standard |
659 |
|
|
\begin_inset Float table |
660 |
|
|
wide false |
661 |
|
|
sideways false |
662 |
|
|
status open |
663 |
|
|
|
664 |
jpye |
2785 |
\begin_layout Plain Layout |
665 |
|
|
\begin_inset Caption Standard |
666 |
johnpye |
825 |
|
667 |
jpye |
2785 |
\begin_layout Plain Layout |
668 |
|
|
\begin_inset CommandInset label |
669 |
|
|
LatexCommand label |
670 |
jpye |
1766 |
name "tab:model2.reqdMethods" |
671 |
|
|
|
672 |
johnpye |
825 |
\end_inset |
673 |
|
|
|
674 |
|
|
Some of the methods |
675 |
jpye |
2785 |
\begin_inset Index idx |
676 |
|
|
status collapsed |
677 |
johnpye |
825 |
|
678 |
jpye |
2785 |
\begin_layout Plain Layout |
679 |
|
|
methods, required |
680 |
|
|
\end_layout |
681 |
|
|
|
682 |
johnpye |
825 |
\end_inset |
683 |
|
|
|
684 |
|
|
we require for putting a model into an ASCEND library |
685 |
|
|
\end_layout |
686 |
|
|
|
687 |
jpye |
1766 |
\end_inset |
688 |
|
|
|
689 |
|
|
|
690 |
|
|
\end_layout |
691 |
|
|
|
692 |
jpye |
2785 |
\begin_layout Plain Layout |
693 |
johnpye |
825 |
\begin_inset Tabular |
694 |
|
|
<lyxtabular version="3" rows="5" columns="2"> |
695 |
jpye |
2785 |
<features rotate="0" tabularvalignment="middle"> |
696 |
|
|
<column alignment="center" valignment="top" width="1.25in"> |
697 |
|
|
<column alignment="center" valignment="top" width="3.5in"> |
698 |
|
|
<row> |
699 |
|
|
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> |
700 |
johnpye |
825 |
\begin_inset Text |
701 |
|
|
|
702 |
jpye |
2785 |
\begin_layout Plain Layout |
703 |
johnpye |
825 |
|
704 |
|
|
\end_layout |
705 |
|
|
|
706 |
|
|
\end_inset |
707 |
|
|
</cell> |
708 |
jpye |
2785 |
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> |
709 |
johnpye |
825 |
\begin_inset Text |
710 |
|
|
|
711 |
jpye |
2785 |
\begin_layout Plain Layout |
712 |
johnpye |
825 |
|
713 |
|
|
\end_layout |
714 |
|
|
|
715 |
|
|
\end_inset |
716 |
|
|
</cell> |
717 |
|
|
</row> |
718 |
jpye |
2785 |
<row> |
719 |
johnpye |
825 |
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> |
720 |
|
|
\begin_inset Text |
721 |
|
|
|
722 |
jpye |
2785 |
\begin_layout Plain Layout |
723 |
johnpye |
825 |
|
724 |
|
|
\family typewriter |
725 |
|
|
ClearAll |
726 |
|
|
\family default |
727 |
|
|
|
728 |
jpye |
2785 |
\begin_inset Index idx |
729 |
|
|
status collapsed |
730 |
johnpye |
825 |
|
731 |
jpye |
2785 |
\begin_layout Plain Layout |
732 |
|
|
ClearAll |
733 |
|
|
\end_layout |
734 |
|
|
|
735 |
johnpye |
825 |
\end_inset |
736 |
|
|
|
737 |
|
|
|
738 |
|
|
\end_layout |
739 |
|
|
|
740 |
|
|
\end_inset |
741 |
|
|
</cell> |
742 |
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> |
743 |
|
|
\begin_inset Text |
744 |
|
|
|
745 |
jpye |
2785 |
\begin_layout Plain Layout |
746 |
johnpye |
825 |
a method to set all the .fixed flags for variables in the type to FALSE. |
747 |
|
|
This puts these flags into a known standard state -- i.e., all are FALSE. |
748 |
|
|
All models inherit this method from the base model and the need to rewrite |
749 |
|
|
it is very, very rare. |
750 |
|
|
\end_layout |
751 |
|
|
|
752 |
|
|
\end_inset |
753 |
|
|
</cell> |
754 |
|
|
</row> |
755 |
jpye |
2785 |
<row> |
756 |
johnpye |
825 |
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> |
757 |
|
|
\begin_inset Text |
758 |
|
|
|
759 |
jpye |
2785 |
\begin_layout Plain Layout |
760 |
johnpye |
825 |
|
761 |
|
|
\family typewriter |
762 |
|
|
specify |
763 |
|
|
\family default |
764 |
|
|
|
765 |
jpye |
2785 |
\begin_inset Index idx |
766 |
|
|
status collapsed |
767 |
johnpye |
825 |
|
768 |
jpye |
2785 |
\begin_layout Plain Layout |
769 |
|
|
specify |
770 |
|
|
\end_layout |
771 |
|
|
|
772 |
johnpye |
825 |
\end_inset |
773 |
|
|
|
774 |
|
|
|
775 |
|
|
\end_layout |
776 |
|
|
|
777 |
|
|
\end_inset |
778 |
|
|
</cell> |
779 |
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> |
780 |
|
|
\begin_inset Text |
781 |
|
|
|
782 |
jpye |
2785 |
\begin_layout Plain Layout |
783 |
johnpye |
825 |
|
784 |
|
|
\family roman |
785 |
|
|
\series medium |
786 |
|
|
\shape up |
787 |
|
|
\size normal |
788 |
|
|
\emph off |
789 |
|
|
\bar no |
790 |
|
|
\noun off |
791 |
|
|
\color none |
792 |
|
|
a method which assumes all the fixed flags are currently FALSE and which |
793 |
|
|
then sets a suitable set of fixed flags to TRUE to make an instance of |
794 |
|
|
this type of model well-posed. |
795 |
|
|
A well-posed model is one that is square (n equations in n unknowns) and |
796 |
|
|
solvable. |
797 |
|
|
\end_layout |
798 |
|
|
|
799 |
|
|
\end_inset |
800 |
|
|
</cell> |
801 |
|
|
</row> |
802 |
jpye |
2785 |
<row> |
803 |
johnpye |
825 |
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> |
804 |
|
|
\begin_inset Text |
805 |
|
|
|
806 |
jpye |
2785 |
\begin_layout Plain Layout |
807 |
johnpye |
825 |
|
808 |
|
|
\family typewriter |
809 |
|
|
reset |
810 |
|
|
\family default |
811 |
|
|
|
812 |
jpye |
2785 |
\begin_inset Index idx |
813 |
|
|
status collapsed |
814 |
johnpye |
825 |
|
815 |
jpye |
2785 |
\begin_layout Plain Layout |
816 |
|
|
reset |
817 |
|
|
\end_layout |
818 |
|
|
|
819 |
johnpye |
825 |
\end_inset |
820 |
|
|
|
821 |
|
|
|
822 |
|
|
\end_layout |
823 |
|
|
|
824 |
|
|
\end_inset |
825 |
|
|
</cell> |
826 |
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> |
827 |
|
|
\begin_inset Text |
828 |
|
|
|
829 |
jpye |
2785 |
\begin_layout Plain Layout |
830 |
johnpye |
825 |
|
831 |
|
|
\family roman |
832 |
|
|
\series medium |
833 |
|
|
\shape up |
834 |
|
|
\size normal |
835 |
|
|
\emph off |
836 |
|
|
\bar no |
837 |
|
|
\noun off |
838 |
|
|
\color none |
839 |
|
|
a method which first runs the ClearAll method and then the specify method. |
840 |
|
|
We include this method because it is very convenient. |
841 |
|
|
We only have to run one method to make any simulation well-posed, no matter |
842 |
|
|
how its fixed flags are currently set. |
843 |
|
|
All models inherit this method from the base model, as with ClearAll . |
844 |
|
|
It should only rarely have to be rewritten for a model. |
845 |
|
|
\end_layout |
846 |
|
|
|
847 |
|
|
\end_inset |
848 |
|
|
</cell> |
849 |
|
|
</row> |
850 |
jpye |
2785 |
<row> |
851 |
|
|
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> |
852 |
johnpye |
825 |
\begin_inset Text |
853 |
|
|
|
854 |
jpye |
2785 |
\begin_layout Plain Layout |
855 |
johnpye |
825 |
|
856 |
|
|
\family typewriter |
857 |
|
|
values |
858 |
|
|
\family default |
859 |
|
|
|
860 |
jpye |
2785 |
\begin_inset Index idx |
861 |
|
|
status collapsed |
862 |
johnpye |
825 |
|
863 |
jpye |
2785 |
\begin_layout Plain Layout |
864 |
|
|
values |
865 |
|
|
\end_layout |
866 |
|
|
|
867 |
johnpye |
825 |
\end_inset |
868 |
|
|
|
869 |
|
|
|
870 |
|
|
\end_layout |
871 |
|
|
|
872 |
|
|
\end_inset |
873 |
|
|
</cell> |
874 |
jpye |
2785 |
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> |
875 |
johnpye |
825 |
\begin_inset Text |
876 |
|
|
|
877 |
jpye |
2785 |
\begin_layout Plain Layout |
878 |
johnpye |
825 |
|
879 |
|
|
\family roman |
880 |
|
|
\series medium |
881 |
|
|
\shape up |
882 |
|
|
\size normal |
883 |
|
|
\emph off |
884 |
|
|
\bar no |
885 |
|
|
\noun off |
886 |
|
|
\color none |
887 |
|
|
a method to establish typical values for the variables we have fixed in |
888 |
|
|
an application or test model. |
889 |
|
|
We may also supply values for some of the variables we will be computing |
890 |
|
|
to aid in solving a model instance of this type. |
891 |
|
|
These values reflectiveness that we have tested for a simulation of this |
892 |
|
|
type and found to work. |
893 |
|
|
\end_layout |
894 |
|
|
|
895 |
|
|
\end_inset |
896 |
|
|
</cell> |
897 |
|
|
</row> |
898 |
|
|
</lyxtabular> |
899 |
|
|
|
900 |
|
|
\end_inset |
901 |
|
|
|
902 |
|
|
|
903 |
|
|
\end_layout |
904 |
|
|
|
905 |
|
|
\end_inset |
906 |
|
|
|
907 |
|
|
|
908 |
|
|
\end_layout |
909 |
|
|
|
910 |
|
|
\begin_layout Standard |
911 |
|
|
To write the |
912 |
|
|
\family typewriter |
913 |
|
|
specify |
914 |
|
|
\family default |
915 |
|
|
and |
916 |
|
|
\family typewriter |
917 |
|
|
values |
918 |
|
|
\family default |
919 |
|
|
methods for our vessel model, we note that we have successfully solved |
920 |
|
|
the vessel model in at least two different ways above. |
921 |
jpye |
1385 |
Thus both variations are examples of being `well-posed'. |
922 |
|
|
We can choose which variation we shall use when creating the |
923 |
johnpye |
825 |
\family typewriter |
924 |
|
|
specify |
925 |
|
|
\family default |
926 |
|
|
method for our vessel type definition. |
927 |
|
|
Let us choose the alternative where we fixed |
928 |
|
|
\family typewriter |
929 |
|
|
vessel_volume |
930 |
|
|
\family default |
931 |
|
|
, |
932 |
|
|
\family typewriter |
933 |
|
|
H_to_D_ratio |
934 |
|
|
\family default |
935 |
|
|
, |
936 |
|
|
\family typewriter |
937 |
|
|
metal_density |
938 |
|
|
\family default |
939 |
|
|
and |
940 |
|
|
\family typewriter |
941 |
|
|
wall_thickness |
942 |
|
|
\family default |
943 |
jpye |
1385 |
and provided them with the values of |
944 |
|
|
\family typewriter |
945 |
|
|
250 ft^3 |
946 |
|
|
\family default |
947 |
|
|
, |
948 |
|
|
\family typewriter |
949 |
|
|
3 |
950 |
|
|
\family default |
951 |
|
|
, |
952 |
|
|
\family typewriter |
953 |
|
|
5000 kg/m^3 |
954 |
|
|
\family default |
955 |
|
|
and |
956 |
|
|
\family typewriter |
957 |
|
|
5 mm |
958 |
|
|
\family default |
959 |
|
|
respectively to be our `standard' specification. |
960 |
johnpye |
825 |
Default methods |
961 |
|
|
\family typewriter |
962 |
|
|
ClearAll |
963 |
|
|
\family default |
964 |
|
|
and |
965 |
|
|
\family typewriter |
966 |
|
|
reset |
967 |
|
|
\family default |
968 |
|
|
are appropriate |
969 |
|
|
\end_layout |
970 |
|
|
|
971 |
|
|
\begin_layout Standard |
972 |
|
|
As already noted, the purpose of |
973 |
|
|
\family typewriter |
974 |
|
|
ClearAll |
975 |
|
|
\family default |
976 |
jpye |
1385 |
is to set all the variables to |
977 |
|
|
\family sans |
978 |
|
|
FREE |
979 |
|
|
\family default |
980 |
|
|
, a well-defined state from which we can start over to set variables |
981 |
|
|
\family sans |
982 |
|
|
FIX |
983 |
|
|
\family default |
984 |
|
|
ed as we wish. |
985 |
|
|
The method |
986 |
johnpye |
825 |
\family typewriter |
987 |
|
|
reset |
988 |
|
|
\family default |
989 |
|
|
simply runs |
990 |
|
|
\family typewriter |
991 |
|
|
ClearAll |
992 |
|
|
\family default |
993 |
jpye |
1385 |
followed by the |
994 |
johnpye |
825 |
\family typewriter |
995 |
|
|
specify |
996 |
|
|
\family default |
997 |
jpye |
1385 |
method for a model. |
998 |
johnpye |
825 |
The default versions for these two methods are generally exactly what one |
999 |
|
|
wants so one need not write these. |
1000 |
|
|
\end_layout |
1001 |
|
|
|
1002 |
|
|
\begin_layout Standard |
1003 |
|
|
Figure |
1004 |
jpye |
2785 |
\begin_inset CommandInset ref |
1005 |
|
|
LatexCommand ref |
1006 |
jpye |
1766 |
reference "fig:model2.vesselWithMethods" |
1007 |
johnpye |
825 |
|
1008 |
|
|
\end_inset |
1009 |
|
|
|
1010 |
|
|
|
1011 |
|
|
\noun off |
1012 |
|
|
illustrates our vessel model with our local versions added for |
1013 |
|
|
\family typewriter |
1014 |
|
|
\noun default |
1015 |
|
|
specify |
1016 |
|
|
\family default |
1017 |
|
|
\noun off |
1018 |
|
|
and |
1019 |
|
|
\family typewriter |
1020 |
|
|
\noun default |
1021 |
|
|
values |
1022 |
|
|
\family default |
1023 |
|
|
\noun off |
1024 |
|
|
. |
1025 |
|
|
Look only at these for the moment and note that they do what we described |
1026 |
|
|
above. |
1027 |
|
|
We show some other methods we shall explain in a moment. |
1028 |
|
|
\end_layout |
1029 |
|
|
|
1030 |
|
|
\begin_layout Standard |
1031 |
jpye |
1385 |
Version of vessel with |
1032 |
|
|
\family sans |
1033 |
|
|
METHODS |
1034 |
|
|
\family default |
1035 |
|
|
added ( |
1036 |
|
|
\family typewriter |
1037 |
|
|
vesselMethods.a4c |
1038 |
|
|
\family default |
1039 |
johnpye |
825 |
|
1040 |
jpye |
2785 |
\begin_inset Index idx |
1041 |
|
|
status collapsed |
1042 |
johnpye |
825 |
|
1043 |
jpye |
2785 |
\begin_layout Plain Layout |
1044 |
|
|
vesselMethods.a4c |
1045 |
|
|
\end_layout |
1046 |
|
|
|
1047 |
jpye |
1385 |
\end_inset |
1048 |
johnpye |
825 |
|
1049 |
jpye |
1385 |
) |
1050 |
jpye |
2785 |
\begin_inset CommandInset label |
1051 |
|
|
LatexCommand label |
1052 |
jpye |
1766 |
name "fig:model2.vesselWithMethods" |
1053 |
johnpye |
825 |
|
1054 |
jpye |
1385 |
\end_inset |
1055 |
johnpye |
825 |
|
1056 |
|
|
|
1057 |
|
|
\end_layout |
1058 |
|
|
|
1059 |
jpye |
1385 |
\begin_layout Standard |
1060 |
|
|
\begin_inset ERT |
1061 |
|
|
status open |
1062 |
johnpye |
825 |
|
1063 |
jpye |
2785 |
\begin_layout Plain Layout |
1064 |
johnpye |
825 |
|
1065 |
|
|
|
1066 |
jpye |
1385 |
\backslash |
1067 |
|
|
lstset{language=ASCEND} |
1068 |
johnpye |
825 |
\end_layout |
1069 |
|
|
|
1070 |
jpye |
2785 |
\begin_layout Plain Layout |
1071 |
johnpye |
825 |
|
1072 |
|
|
|
1073 |
jpye |
1385 |
\backslash |
1074 |
|
|
lstinputlisting[firstline=23]{../models/vesselMethods.a4c} |
1075 |
johnpye |
825 |
\end_layout |
1076 |
|
|
|
1077 |
|
|
\end_inset |
1078 |
|
|
|
1079 |
|
|
|
1080 |
|
|
\end_layout |
1081 |
|
|
|
1082 |
|
|
\begin_layout Standard |
1083 |
|
|
In Table |
1084 |
jpye |
2785 |
\begin_inset CommandInset ref |
1085 |
|
|
LatexCommand ref |
1086 |
jpye |
1766 |
reference "tab:model2.addedReqdMethods" |
1087 |
johnpye |
825 |
|
1088 |
|
|
\end_inset |
1089 |
|
|
|
1090 |
|
|
|
1091 |
|
|
\noun off |
1092 |
|
|
we describe additional methods we require before we will put a model into |
1093 |
|
|
one of our libraries. |
1094 |
|
|
Each of these had two versions, both of which we require. |
1095 |
jpye |
1386 |
The designation |
1096 |
|
|
\family typewriter |
1097 |
|
|
\noun default |
1098 |
|
|
_self |
1099 |
|
|
\family default |
1100 |
|
|
\noun off |
1101 |
|
|
|
1102 |
jpye |
2785 |
\begin_inset Index idx |
1103 |
|
|
status collapsed |
1104 |
johnpye |
825 |
|
1105 |
jpye |
2785 |
\begin_layout Plain Layout |
1106 |
|
|
\begin_inset ERT |
1107 |
|
|
status collapsed |
1108 |
|
|
|
1109 |
|
|
\begin_layout Plain Layout |
1110 |
|
|
|
1111 |
|
|
|
1112 |
|
|
\backslash |
1113 |
|
|
_ |
1114 |
|
|
\end_layout |
1115 |
|
|
|
1116 |
johnpye |
825 |
\end_inset |
1117 |
|
|
|
1118 |
jpye |
2785 |
self |
1119 |
|
|
\end_layout |
1120 |
|
|
|
1121 |
|
|
\end_inset |
1122 |
|
|
|
1123 |
johnpye |
825 |
is for a method to do something for all the variables and/or parts we have |
1124 |
|
|
defined locally within the current model with an IS_A statement. |
1125 |
jpye |
1386 |
The designation |
1126 |
|
|
\family typewriter |
1127 |
|
|
\noun default |
1128 |
|
|
_all |
1129 |
|
|
\family default |
1130 |
|
|
\noun off |
1131 |
|
|
|
1132 |
jpye |
2785 |
\begin_inset Index idx |
1133 |
|
|
status collapsed |
1134 |
johnpye |
825 |
|
1135 |
jpye |
2785 |
\begin_layout Plain Layout |
1136 |
|
|
\begin_inset ERT |
1137 |
|
|
status collapsed |
1138 |
|
|
|
1139 |
|
|
\begin_layout Plain Layout |
1140 |
|
|
|
1141 |
|
|
|
1142 |
|
|
\backslash |
1143 |
|
|
_ |
1144 |
|
|
\end_layout |
1145 |
|
|
|
1146 |
johnpye |
825 |
\end_inset |
1147 |
|
|
|
1148 |
jpye |
2785 |
all |
1149 |
|
|
\end_layout |
1150 |
|
|
|
1151 |
|
|
\end_inset |
1152 |
|
|
|
1153 |
jpye |
1386 |
is for a method to do something for parts that are defined within an `outer' |
1154 |
johnpye |
825 |
model that has an instance of this model as a part. |
1155 |
jpye |
1386 |
The `outer' model is at a higher scope |
1156 |
jpye |
2785 |
\begin_inset Index idx |
1157 |
|
|
status collapsed |
1158 |
johnpye |
825 |
|
1159 |
jpye |
2785 |
\begin_layout Plain Layout |
1160 |
|
|
scope |
1161 |
|
|
\end_layout |
1162 |
|
|
|
1163 |
johnpye |
825 |
\end_inset |
1164 |
|
|
|
1165 |
|
|
. |
1166 |
|
|
It can share its parts with this model by passing them in as parameters, |
1167 |
|
|
a topic we cover shortly in |
1168 |
|
|
\noun default |
1169 |
|
|
Section |
1170 |
|
|
\noun off |
1171 |
|
|
|
1172 |
jpye |
2785 |
\begin_inset CommandInset ref |
1173 |
|
|
LatexCommand ref |
1174 |
jpye |
1766 |
reference "sec:model2.parameterizingVessel" |
1175 |
johnpye |
825 |
|
1176 |
|
|
\end_inset |
1177 |
|
|
|
1178 |
|
|
. |
1179 |
|
|
|
1180 |
|
|
\noun default |
1181 |
|
|
|
1182 |
|
|
\noun off |
1183 |
jpye |
1386 |
Only the |
1184 |
|
|
\family typewriter |
1185 |
johnpye |
825 |
\noun default |
1186 |
jpye |
1386 |
_self |
1187 |
|
|
\family default |
1188 |
|
|
\noun off |
1189 |
|
|
versions of these methods are relevant here and are in |
1190 |
|
|
\noun default |
1191 |
johnpye |
825 |
Figure |
1192 |
|
|
\noun off |
1193 |
|
|
|
1194 |
jpye |
2785 |
\begin_inset CommandInset ref |
1195 |
|
|
LatexCommand ref |
1196 |
jpye |
1766 |
reference "fig:model2.vesselWithMethods" |
1197 |
johnpye |
825 |
|
1198 |
|
|
\end_inset |
1199 |
|
|
|
1200 |
|
|
. |
1201 |
|
|
\end_layout |
1202 |
|
|
|
1203 |
|
|
\begin_layout Standard |
1204 |
|
|
\begin_inset Float table |
1205 |
|
|
wide false |
1206 |
|
|
sideways false |
1207 |
|
|
status open |
1208 |
|
|
|
1209 |
jpye |
2785 |
\begin_layout Plain Layout |
1210 |
|
|
\begin_inset Caption Standard |
1211 |
jpye |
1766 |
|
1212 |
jpye |
2785 |
\begin_layout Plain Layout |
1213 |
johnpye |
825 |
Additional methods |
1214 |
jpye |
2785 |
\begin_inset Index idx |
1215 |
|
|
status collapsed |
1216 |
johnpye |
825 |
|
1217 |
jpye |
2785 |
\begin_layout Plain Layout |
1218 |
|
|
methods. |
1219 |
|
|
required |
1220 |
|
|
\end_layout |
1221 |
|
|
|
1222 |
johnpye |
825 |
\end_inset |
1223 |
|
|
|
1224 |
|
|
required for model in ASCEND libraries |
1225 |
jpye |
2785 |
\begin_inset CommandInset label |
1226 |
|
|
LatexCommand label |
1227 |
jpye |
1766 |
name "tab:model2.addedReqdMethods" |
1228 |
johnpye |
825 |
|
1229 |
|
|
\end_inset |
1230 |
|
|
|
1231 |
|
|
|
1232 |
|
|
\end_layout |
1233 |
|
|
|
1234 |
jpye |
1766 |
\end_inset |
1235 |
|
|
|
1236 |
|
|
|
1237 |
|
|
\end_layout |
1238 |
|
|
|
1239 |
jpye |
2785 |
\begin_layout Plain Layout |
1240 |
johnpye |
825 |
\begin_inset Tabular |
1241 |
|
|
<lyxtabular version="3" rows="5" columns="2"> |
1242 |
jpye |
2785 |
<features rotate="0" tabularvalignment="middle"> |
1243 |
|
|
<column alignment="center" valignment="top" width="1.25in"> |
1244 |
|
|
<column alignment="center" valignment="top" width="3.5in"> |
1245 |
|
|
<row> |
1246 |
|
|
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> |
1247 |
johnpye |
825 |
\begin_inset Text |
1248 |
|
|
|
1249 |
jpye |
2785 |
\begin_layout Plain Layout |
1250 |
johnpye |
825 |
method |
1251 |
|
|
\end_layout |
1252 |
|
|
|
1253 |
|
|
\end_inset |
1254 |
|
|
</cell> |
1255 |
jpye |
2785 |
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> |
1256 |
johnpye |
825 |
\begin_inset Text |
1257 |
|
|
|
1258 |
jpye |
2785 |
\begin_layout Plain Layout |
1259 |
johnpye |
825 |
description |
1260 |
|
|
\end_layout |
1261 |
|
|
|
1262 |
|
|
\end_inset |
1263 |
|
|
</cell> |
1264 |
|
|
</row> |
1265 |
jpye |
2785 |
<row> |
1266 |
johnpye |
825 |
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> |
1267 |
|
|
\begin_inset Text |
1268 |
|
|
|
1269 |
jpye |
2785 |
\begin_layout Plain Layout |
1270 |
johnpye |
825 |
|
1271 |
|
|
\family typewriter |
1272 |
|
|
default_self |
1273 |
jpye |
2785 |
\begin_inset Index idx |
1274 |
|
|
status collapsed |
1275 |
johnpye |
825 |
|
1276 |
jpye |
2785 |
\begin_layout Plain Layout |
1277 |
|
|
default |
1278 |
|
|
\begin_inset ERT |
1279 |
|
|
status collapsed |
1280 |
|
|
|
1281 |
|
|
\begin_layout Plain Layout |
1282 |
|
|
|
1283 |
|
|
|
1284 |
|
|
\backslash |
1285 |
|
|
_ |
1286 |
|
|
\end_layout |
1287 |
|
|
|
1288 |
johnpye |
825 |
\end_inset |
1289 |
|
|
|
1290 |
jpye |
2785 |
self |
1291 |
|
|
\end_layout |
1292 |
|
|
|
1293 |
|
|
\end_inset |
1294 |
|
|
|
1295 |
johnpye |
825 |
, default_all |
1296 |
|
|
\family default |
1297 |
|
|
|
1298 |
jpye |
2785 |
\begin_inset Index idx |
1299 |
|
|
status collapsed |
1300 |
johnpye |
825 |
|
1301 |
jpye |
2785 |
\begin_layout Plain Layout |
1302 |
|
|
default |
1303 |
|
|
\begin_inset ERT |
1304 |
|
|
status collapsed |
1305 |
|
|
|
1306 |
|
|
\begin_layout Plain Layout |
1307 |
|
|
|
1308 |
|
|
|
1309 |
|
|
\backslash |
1310 |
|
|
_ |
1311 |
|
|
\end_layout |
1312 |
|
|
|
1313 |
johnpye |
825 |
\end_inset |
1314 |
|
|
|
1315 |
jpye |
2785 |
all |
1316 |
|
|
\end_layout |
1317 |
johnpye |
825 |
|
1318 |
jpye |
2785 |
\end_inset |
1319 |
|
|
|
1320 |
|
|
|
1321 |
johnpye |
825 |
\end_layout |
1322 |
|
|
|
1323 |
|
|
\end_inset |
1324 |
|
|
</cell> |
1325 |
|
|
<cell multicolumn="1" alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none" width="3.5in"> |
1326 |
|
|
\begin_inset Text |
1327 |
|
|
|
1328 |
jpye |
2785 |
\begin_layout Plain Layout |
1329 |
johnpye |
825 |
|
1330 |
|
|
\family roman |
1331 |
|
|
\series medium |
1332 |
|
|
\shape up |
1333 |
|
|
\size normal |
1334 |
|
|
\emph off |
1335 |
|
|
\bar no |
1336 |
|
|
\noun off |
1337 |
|
|
\color none |
1338 |
|
|
a method called automatically when any simulation is compiled to provide |
1339 |
|
|
default values and adjust bounds for any variables which may have unsuitable |
1340 |
|
|
defaults in their ATOM definitions. |
1341 |
|
|
Usually the variables selected are those for which the model becomes ill-behave |
1342 |
|
|
d if given poor initial guesses or bounds (e.g., zero). |
1343 |
|
|
\end_layout |
1344 |
|
|
|
1345 |
|
|
\end_inset |
1346 |
|
|
</cell> |
1347 |
|
|
</row> |
1348 |
jpye |
2785 |
<row> |
1349 |
johnpye |
825 |
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> |
1350 |
|
|
\begin_inset Text |
1351 |
|
|
|
1352 |
jpye |
2785 |
\begin_layout Plain Layout |
1353 |
johnpye |
825 |
|
1354 |
|
|
\family typewriter |
1355 |
|
|
bound_self |
1356 |
jpye |
2785 |
\begin_inset Index idx |
1357 |
|
|
status collapsed |
1358 |
johnpye |
825 |
|
1359 |
jpye |
2785 |
\begin_layout Plain Layout |
1360 |
|
|
bound |
1361 |
|
|
\begin_inset ERT |
1362 |
|
|
status collapsed |
1363 |
|
|
|
1364 |
|
|
\begin_layout Plain Layout |
1365 |
|
|
|
1366 |
|
|
|
1367 |
|
|
\backslash |
1368 |
|
|
_ |
1369 |
|
|
\end_layout |
1370 |
|
|
|
1371 |
johnpye |
825 |
\end_inset |
1372 |
|
|
|
1373 |
jpye |
2785 |
self |
1374 |
|
|
\end_layout |
1375 |
|
|
|
1376 |
|
|
\end_inset |
1377 |
|
|
|
1378 |
johnpye |
825 |
, bound_all |
1379 |
|
|
\family default |
1380 |
|
|
|
1381 |
jpye |
2785 |
\begin_inset Index idx |
1382 |
|
|
status collapsed |
1383 |
johnpye |
825 |
|
1384 |
jpye |
2785 |
\begin_layout Plain Layout |
1385 |
|
|
bound |
1386 |
|
|
\begin_inset ERT |
1387 |
|
|
status collapsed |
1388 |
|
|
|
1389 |
|
|
\begin_layout Plain Layout |
1390 |
|
|
|
1391 |
|
|
|
1392 |
|
|
\backslash |
1393 |
|
|
_ |
1394 |
|
|
\end_layout |
1395 |
|
|
|
1396 |
johnpye |
825 |
\end_inset |
1397 |
|
|
|
1398 |
jpye |
2785 |
all |
1399 |
|
|
\end_layout |
1400 |
johnpye |
825 |
|
1401 |
jpye |
2785 |
\end_inset |
1402 |
|
|
|
1403 |
|
|
|
1404 |
johnpye |
825 |
\end_layout |
1405 |
|
|
|
1406 |
|
|
\end_inset |
1407 |
|
|
</cell> |
1408 |
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> |
1409 |
|
|
\begin_inset Text |
1410 |
|
|
|
1411 |
jpye |
2785 |
\begin_layout Plain Layout |
1412 |
johnpye |
825 |
|
1413 |
|
|
\family roman |
1414 |
|
|
\series medium |
1415 |
|
|
\shape up |
1416 |
|
|
\size normal |
1417 |
|
|
\emph off |
1418 |
|
|
\bar no |
1419 |
|
|
\noun off |
1420 |
|
|
\color none |
1421 |
|
|
a method to update the . |
1422 |
|
|
upper_bound and . |
1423 |
|
|
lower_bound value for each of the variables. |
1424 |
|
|
ASCEND solvers use these bound values to help solve the model equations. |
1425 |
|
|
\end_layout |
1426 |
|
|
|
1427 |
|
|
\end_inset |
1428 |
|
|
</cell> |
1429 |
|
|
</row> |
1430 |
jpye |
2785 |
<row> |
1431 |
johnpye |
825 |
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> |
1432 |
|
|
\begin_inset Text |
1433 |
|
|
|
1434 |
jpye |
2785 |
\begin_layout Plain Layout |
1435 |
johnpye |
825 |
|
1436 |
|
|
\family typewriter |
1437 |
|
|
scale_self |
1438 |
jpye |
2785 |
\begin_inset Index idx |
1439 |
|
|
status collapsed |
1440 |
johnpye |
825 |
|
1441 |
jpye |
2785 |
\begin_layout Plain Layout |
1442 |
|
|
scale |
1443 |
|
|
\begin_inset ERT |
1444 |
|
|
status collapsed |
1445 |
|
|
|
1446 |
|
|
\begin_layout Plain Layout |
1447 |
|
|
|
1448 |
|
|
|
1449 |
|
|
\backslash |
1450 |
|
|
_ |
1451 |
|
|
\end_layout |
1452 |
|
|
|
1453 |
johnpye |
825 |
\end_inset |
1454 |
|
|
|
1455 |
jpye |
2785 |
self |
1456 |
|
|
\end_layout |
1457 |
|
|
|
1458 |
|
|
\end_inset |
1459 |
|
|
|
1460 |
johnpye |
825 |
, scale_all |
1461 |
|
|
\family default |
1462 |
|
|
|
1463 |
jpye |
2785 |
\begin_inset Index idx |
1464 |
|
|
status collapsed |
1465 |
johnpye |
825 |
|
1466 |
jpye |
2785 |
\begin_layout Plain Layout |
1467 |
|
|
scale |
1468 |
|
|
\begin_inset ERT |
1469 |
|
|
status collapsed |
1470 |
|
|
|
1471 |
|
|
\begin_layout Plain Layout |
1472 |
|
|
|
1473 |
|
|
|
1474 |
|
|
\backslash |
1475 |
|
|
_ |
1476 |
|
|
\end_layout |
1477 |
|
|
|
1478 |
johnpye |
825 |
\end_inset |
1479 |
|
|
|
1480 |
jpye |
2785 |
all |
1481 |
|
|
\end_layout |
1482 |
johnpye |
825 |
|
1483 |
jpye |
2785 |
\end_inset |
1484 |
|
|
|
1485 |
|
|
|
1486 |
johnpye |
825 |
\end_layout |
1487 |
|
|
|
1488 |
|
|
\end_inset |
1489 |
|
|
</cell> |
1490 |
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> |
1491 |
|
|
\begin_inset Text |
1492 |
|
|
|
1493 |
jpye |
2785 |
\begin_layout Plain Layout |
1494 |
johnpye |
825 |
|
1495 |
|
|
\family roman |
1496 |
|
|
\series medium |
1497 |
|
|
\shape up |
1498 |
|
|
\size normal |
1499 |
|
|
\emph off |
1500 |
|
|
\bar no |
1501 |
|
|
\noun off |
1502 |
|
|
\color none |
1503 |
|
|
a method to update the . |
1504 |
|
|
nominal value for each of the variables. |
1505 |
|
|
ASCEND solvers will use these nominal values to rescale the variable to |
1506 |
|
|
have a value of about one in magnitude to help solve the model equations. |
1507 |
|
|
\end_layout |
1508 |
|
|
|
1509 |
|
|
\end_inset |
1510 |
|
|
</cell> |
1511 |
|
|
</row> |
1512 |
jpye |
2785 |
<row> |
1513 |
|
|
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> |
1514 |
johnpye |
825 |
\begin_inset Text |
1515 |
|
|
|
1516 |
jpye |
2785 |
\begin_layout Plain Layout |
1517 |
johnpye |
825 |
|
1518 |
|
|
\family typewriter |
1519 |
|
|
check_self |
1520 |
jpye |
2785 |
\begin_inset Index idx |
1521 |
|
|
status collapsed |
1522 |
johnpye |
825 |
|
1523 |
jpye |
2785 |
\begin_layout Plain Layout |
1524 |
|
|
check |
1525 |
|
|
\begin_inset ERT |
1526 |
|
|
status collapsed |
1527 |
|
|
|
1528 |
|
|
\begin_layout Plain Layout |
1529 |
|
|
|
1530 |
|
|
|
1531 |
|
|
\backslash |
1532 |
|
|
_ |
1533 |
|
|
\end_layout |
1534 |
|
|
|
1535 |
johnpye |
825 |
\end_inset |
1536 |
|
|
|
1537 |
jpye |
2785 |
self |
1538 |
|
|
\end_layout |
1539 |
|
|
|
1540 |
|
|
\end_inset |
1541 |
|
|
|
1542 |
johnpye |
825 |
, check_all |
1543 |
|
|
\family default |
1544 |
|
|
|
1545 |
jpye |
2785 |
\begin_inset Index idx |
1546 |
|
|
status collapsed |
1547 |
johnpye |
825 |
|
1548 |
jpye |
2785 |
\begin_layout Plain Layout |
1549 |
|
|
check |
1550 |
|
|
\begin_inset ERT |
1551 |
|
|
status collapsed |
1552 |
|
|
|
1553 |
|
|
\begin_layout Plain Layout |
1554 |
|
|
|
1555 |
|
|
|
1556 |
|
|
\backslash |
1557 |
|
|
_ |
1558 |
|
|
\end_layout |
1559 |
|
|
|
1560 |
johnpye |
825 |
\end_inset |
1561 |
|
|
|
1562 |
jpye |
2785 |
all |
1563 |
|
|
\end_layout |
1564 |
johnpye |
825 |
|
1565 |
jpye |
2785 |
\end_inset |
1566 |
|
|
|
1567 |
|
|
|
1568 |
johnpye |
825 |
\end_layout |
1569 |
|
|
|
1570 |
|
|
\end_inset |
1571 |
|
|
</cell> |
1572 |
jpye |
2785 |
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none"> |
1573 |
johnpye |
825 |
\begin_inset Text |
1574 |
|
|
|
1575 |
jpye |
2785 |
\begin_layout Plain Layout |
1576 |
johnpye |
825 |
|
1577 |
|
|
\family roman |
1578 |
|
|
\series medium |
1579 |
|
|
\shape up |
1580 |
|
|
\size normal |
1581 |
|
|
\emph off |
1582 |
|
|
\bar no |
1583 |
|
|
\noun off |
1584 |
|
|
\color none |
1585 |
|
|
a method to check that the computations make sense. |
1586 |
|
|
At first this method may be empty, but, with experience, one can add statements |
1587 |
|
|
that detect answers that appear to be wrong. |
1588 |
|
|
As ASCEND already does bounds checking, one should not check for going |
1589 |
|
|
past bounds here. |
1590 |
|
|
However, there could be a rule of thumb available that suggests one computed |
1591 |
|
|
variable should be about an order of magnitude larger than another. |
1592 |
|
|
This check could be done in this method. |
1593 |
|
|
\end_layout |
1594 |
|
|
|
1595 |
|
|
\end_inset |
1596 |
|
|
</cell> |
1597 |
|
|
</row> |
1598 |
|
|
</lyxtabular> |
1599 |
|
|
|
1600 |
|
|
\end_inset |
1601 |
|
|
|
1602 |
|
|
|
1603 |
|
|
\end_layout |
1604 |
|
|
|
1605 |
|
|
\end_inset |
1606 |
|
|
|
1607 |
|
|
|
1608 |
|
|
\end_layout |
1609 |
|
|
|
1610 |
|
|
\begin_layout Standard |
1611 |
|
|
The |
1612 |
|
|
\family typewriter |
1613 |
|
|
bound_self |
1614 |
|
|
\family default |
1615 |
|
|
and |
1616 |
|
|
\family typewriter |
1617 |
|
|
scale_self |
1618 |
|
|
\family default |
1619 |
|
|
, methods we have written are both empty. |
1620 |
|
|
We anticipate no difficulties with variable scaling or bounding for this |
1621 |
|
|
small model. |
1622 |
|
|
Larger models can often give difficult problems in solving if the variables |
1623 |
|
|
in them are not properly scaled and bounded; these issues must be taken |
1624 |
|
|
very seriously for such models. |
1625 |
|
|
\end_layout |
1626 |
|
|
|
1627 |
|
|
\begin_layout Standard |
1628 |
|
|
We have included the variables that define the geometry of the vessel in |
1629 |
|
|
|
1630 |
|
|
\family typewriter |
1631 |
|
|
defaults_self |
1632 |
|
|
\family default |
1633 |
|
|
method to avoid such things as negative initial values for vessel_volume. |
1634 |
|
|
The compiler for ASCEND runs this method as soon as the model is compiled |
1635 |
|
|
into an instance so the variables mentioned here start with their default |
1636 |
|
|
values. |
1637 |
|
|
\end_layout |
1638 |
|
|
|
1639 |
|
|
\begin_layout Standard |
1640 |
|
|
Exit ASCEND and repeat all the steps above to edit, load and compile this |
1641 |
|
|
new vessel type definition. |
1642 |
|
|
Then proceed as follows. |
1643 |
|
|
\end_layout |
1644 |
|
|
|
1645 |
|
|
\begin_layout Itemize |
1646 |
|
|
In the Browser window, examine the values for those variables mentioned |
1647 |
jpye |
1386 |
in the |
1648 |
|
|
\family typewriter |
1649 |
|
|
default_self |
1650 |
|
|
\family default |
1651 |
|
|
method. |
1652 |
johnpye |
825 |
Note they already have their default values. |
1653 |
|
|
\end_layout |
1654 |
|
|
|
1655 |
|
|
\begin_layout Itemize |
1656 |
jpye |
1386 |
To place the new instance |
1657 |
|
|
\family typewriter |
1658 |
|
|
v |
1659 |
|
|
\family default |
1660 |
|
|
in a solvable state, go to the Browser window. |
1661 |
|
|
Select |
1662 |
|
|
\series bold |
1663 |
|
|
Run method |
1664 |
|
|
\series default |
1665 |
|
|
under the Edit menu. |
1666 |
johnpye |
825 |
Select first the method values and hit OK. |
1667 |
|
|
\end_layout |
1668 |
|
|
|
1669 |
|
|
\begin_layout Itemize |
1670 |
|
|
Repeat the last step but this time select the method reset. |
1671 |
|
|
|
1672 |
|
|
\end_layout |
1673 |
|
|
|
1674 |
|
|
\begin_layout Standard |
1675 |
|
|
In the Browser, examine the values for the variables listed in the method |
1676 |
|
|
values in Figure |
1677 |
jpye |
2785 |
\begin_inset CommandInset ref |
1678 |
|
|
LatexCommand ref |
1679 |
jpye |
1766 |
reference "fig:model2.vesselWithMethods" |
1680 |
johnpye |
825 |
|
1681 |
|
|
\end_inset |
1682 |
|
|
|
1683 |
|
|
|
1684 |
|
|
\noun off |
1685 |
|
|
. |
1686 |
|
|
They should be set to those stated (remember you can alter the units ASCEND |
1687 |
|
|
uses to report the values by using the tools in the Units window).Also examine |
1688 |
|
|
the fixed flags for these variables; they should all be TRUE (remember |
1689 |
|
|
that you can find which variables are fixed all at once by using the By |
1690 |
|
|
type command under the Find button). |
1691 |
|
|
|
1692 |
|
|
\end_layout |
1693 |
|
|
|
1694 |
|
|
\begin_layout Itemize |
1695 |
jpye |
1386 |
Finally export |
1696 |
|
|
\family typewriter |
1697 |
|
|
v |
1698 |
|
|
\family default |
1699 |
|
|
to the Solver. |
1700 |
johnpye |
825 |
The Eligible window should NOT appear; rather that Solver should report |
1701 |
|
|
the model to be square. |
1702 |
|
|
|
1703 |
|
|
\end_layout |
1704 |
|
|
|
1705 |
|
|
\begin_layout Itemize |
1706 |
jpye |
1386 |
Solve by selecting |
1707 |
|
|
\series bold |
1708 |
|
|
Solve |
1709 |
|
|
\series default |
1710 |
|
|
under the Execute menu. |
1711 |
johnpye |
825 |
\end_layout |
1712 |
|
|
|
1713 |
|
|
\begin_layout Standard |
1714 |
|
|
The inclusion of methods has made the process of making this model much |
1715 |
|
|
easier to get well-posed. |
1716 |
|
|
This approach is the one that works for really large, complex models. |
1717 |
|
|
\end_layout |
1718 |
|
|
|
1719 |
|
|
\begin_layout Section |
1720 |
|
|
Parameterizing the vessel model |
1721 |
jpye |
2785 |
\begin_inset CommandInset label |
1722 |
|
|
LatexCommand label |
1723 |
jpye |
1766 |
name "sec:model2.parameterizingVessel" |
1724 |
johnpye |
825 |
|
1725 |
|
|
\end_inset |
1726 |
|
|
|
1727 |
|
|
|
1728 |
|
|
\end_layout |
1729 |
|
|
|
1730 |
|
|
\begin_layout Standard |
1731 |
|
|
Reuse generally implies creating a model which will have as a part an instance |
1732 |
|
|
of a previously defined type. |
1733 |
|
|
For example, let us compute metal_mass as a function of the H_to_D_ratio |
1734 |
|
|
for a vessel for a fixed vessel_volume. |
1735 |
|
|
We would like to see if there is a value for the H_to_D_ratio for which |
1736 |
|
|
the metal_mass is minimum for a vessel with a given vessel_volume. |
1737 |
|
|
We might wonder if metal_mass goes to infinity as this ratio goes either |
1738 |
|
|
to zero or infinity. |
1739 |
|
|
\end_layout |
1740 |
|
|
|
1741 |
|
|
\begin_layout Subsection |
1742 |
|
|
Creating a parameterized version of vessel |
1743 |
|
|
\end_layout |
1744 |
|
|
|
1745 |
|
|
\begin_layout Standard |
1746 |
|
|
To use instances of our model as parts in another model, we can parameterize |
1747 |
|
|
it. |
1748 |
|
|
We use parameterization to tell a future user that the parameters are objects |
1749 |
|
|
he or she is likely to share among many different parts of a model. |
1750 |
jpye |
1369 |
We wish to create a table containing different values of |
1751 |
|
|
\family typewriter |
1752 |
|
|
H_to_D_ratio |
1753 |
|
|
\family default |
1754 |
|
|
vs. |
1755 |
|
|
|
1756 |
|
|
\family typewriter |
1757 |
|
|
metal_mass |
1758 |
|
|
\family default |
1759 |
|
|
. |
1760 |
johnpye |
825 |
We can accomplish this by computing simultaneously several different vessels |
1761 |
jpye |
1369 |
having the same |
1762 |
|
|
\family typewriter |
1763 |
|
|
vessel_volume |
1764 |
|
|
\family default |
1765 |
|
|
, |
1766 |
|
|
\family typewriter |
1767 |
|
|
wall_thickness |
1768 |
|
|
\family default |
1769 |
|
|
and |
1770 |
|
|
\family typewriter |
1771 |
|
|
metal_density |
1772 |
|
|
\family default |
1773 |
|
|
. |
1774 |
johnpye |
825 |
The objects we want to see and/or share for each instance of a vessel should |
1775 |
jpye |
1369 |
include, therefore: |
1776 |
|
|
\family typewriter |
1777 |
|
|
H_to_D_ratio |
1778 |
|
|
\family default |
1779 |
|
|
, |
1780 |
|
|
\family typewriter |
1781 |
|
|
metal_mass |
1782 |
|
|
\family default |
1783 |
|
|
, |
1784 |
|
|
\family typewriter |
1785 |
|
|
metal_density |
1786 |
|
|
\family default |
1787 |
|
|
, |
1788 |
|
|
\family typewriter |
1789 |
|
|
vessel_volume |
1790 |
|
|
\family default |
1791 |
|
|
and |
1792 |
|
|
\family typewriter |
1793 |
|
|
wall_thickness |
1794 |
|
|
\family default |
1795 |
|
|
. |
1796 |
johnpye |
825 |
\end_layout |
1797 |
|
|
|
1798 |
|
|
\begin_layout Standard |
1799 |
|
|
The code in Figure |
1800 |
jpye |
2785 |
\begin_inset CommandInset ref |
1801 |
|
|
LatexCommand ref |
1802 |
jpye |
1766 |
reference "fig:model2.parameterizedVessel" |
1803 |
johnpye |
825 |
|
1804 |
|
|
\end_inset |
1805 |
|
|
|
1806 |
|
|
|
1807 |
|
|
\noun off |
1808 |
|
|
indicates the changes we make to the model declaration statement and the |
1809 |
|
|
statements defining the variables to parameterize our model. |
1810 |
|
|
\end_layout |
1811 |
|
|
|
1812 |
|
|
\begin_layout Standard |
1813 |
jpye |
2785 |
\begin_inset CommandInset label |
1814 |
|
|
LatexCommand label |
1815 |
jpye |
1766 |
name "fig:model2.parameterizedVessel" |
1816 |
johnpye |
825 |
|
1817 |
jpye |
1385 |
\end_inset |
1818 |
johnpye |
825 |
|
1819 |
jpye |
1385 |
The parameterized version of vessel model ( |
1820 |
jpye |
2785 |
\begin_inset Index idx |
1821 |
|
|
status collapsed |
1822 |
johnpye |
825 |
|
1823 |
jpye |
2785 |
\begin_layout Plain Layout |
1824 |
|
|
1014608 |
1825 |
|
|
\end_layout |
1826 |
|
|
|
1827 |
jpye |
1385 |
\end_inset |
1828 |
johnpye |
825 |
|
1829 |
jpye |
1385 |
vesselParams.a4c) |
1830 |
johnpye |
825 |
\end_layout |
1831 |
|
|
|
1832 |
jpye |
1385 |
\begin_layout Standard |
1833 |
|
|
\begin_inset ERT |
1834 |
|
|
status open |
1835 |
johnpye |
825 |
|
1836 |
jpye |
2785 |
\begin_layout Plain Layout |
1837 |
johnpye |
825 |
|
1838 |
|
|
|
1839 |
jpye |
1385 |
\backslash |
1840 |
|
|
lstset{language=ASCEND} |
1841 |
johnpye |
825 |
\end_layout |
1842 |
|
|
|
1843 |
jpye |
2785 |
\begin_layout Plain Layout |
1844 |
johnpye |
825 |
|
1845 |
|
|
|
1846 |
jpye |
1385 |
\backslash |
1847 |
|
|
lstinputlisting[firstline=24]{../models/vesselParams.a4c} |
1848 |
johnpye |
825 |
\end_layout |
1849 |
|
|
|
1850 |
|
|
\end_inset |
1851 |
|
|
|
1852 |
|
|
|
1853 |
|
|
\end_layout |
1854 |
|
|
|
1855 |
|
|
\begin_layout Standard |
1856 |
|
|
Substitute the statements in Figure |
1857 |
jpye |
2785 |
\begin_inset CommandInset ref |
1858 |
|
|
LatexCommand ref |
1859 |
jpye |
1766 |
reference "fig:model2.parameterizedVessel" |
1860 |
johnpye |
825 |
|
1861 |
|
|
\end_inset |
1862 |
|
|
|
1863 |
|
|
|
1864 |
|
|
\noun off |
1865 |
|
|
for lines 2 through 9 in |
1866 |
|
|
\noun default |
1867 |
|
|
Figure |
1868 |
|
|
\noun off |
1869 |
|
|
|
1870 |
jpye |
2785 |
\begin_inset CommandInset ref |
1871 |
|
|
LatexCommand ref |
1872 |
jpye |
1766 |
reference "fig:model2.vesselWithMethods" |
1873 |
johnpye |
825 |
|
1874 |
|
|
\end_inset |
1875 |
|
|
|
1876 |
|
|
. |
1877 |
|
|
Save the result in the file vesselParam.a4c. |
1878 |
|
|
\end_layout |
1879 |
|
|
|
1880 |
|
|
\begin_layout Standard |
1881 |
|
|
Note the use of the |
1882 |
jpye |
2785 |
\begin_inset Index idx |
1883 |
|
|
status collapsed |
1884 |
johnpye |
825 |
|
1885 |
jpye |
2785 |
\begin_layout Plain Layout |
1886 |
|
|
1014610 |
1887 |
|
|
\end_layout |
1888 |
|
|
|
1889 |
johnpye |
825 |
\end_inset |
1890 |
|
|
|
1891 |
|
|
|
1892 |
jpye |
2785 |
\begin_inset Index idx |
1893 |
|
|
status collapsed |
1894 |
johnpye |
825 |
|
1895 |
jpye |
2785 |
\begin_layout Plain Layout |
1896 |
|
|
1014609 |
1897 |
|
|
\end_layout |
1898 |
|
|
|
1899 |
johnpye |
825 |
\end_inset |
1900 |
|
|
|
1901 |
jpye |
1369 |
|
1902 |
|
|
\family typewriter |
1903 |
|
|
WILL_BE |
1904 |
|
|
\family default |
1905 |
|
|
statement in the parameter list. |
1906 |
johnpye |
825 |
By declaring that the type of a parameter will be compatible with the types |
1907 |
|
|
shown, the compiler can tell immediately if a user of this model is passing |
1908 |
|
|
the wrong type of object when defining an instance of a vessel. |
1909 |
|
|
\end_layout |
1910 |
|
|
|
1911 |
|
|
\begin_layout Subsection |
1912 |
|
|
Using the parameterized vessel model |
1913 |
|
|
\end_layout |
1914 |
|
|
|
1915 |
|
|
\begin_layout Standard |
1916 |
jpye |
1385 |
A type definition will set up our |
1917 |
jpye |
2785 |
\begin_inset Index idx |
1918 |
|
|
status collapsed |
1919 |
johnpye |
825 |
|
1920 |
jpye |
2785 |
\begin_layout Plain Layout |
1921 |
|
|
1014611 |
1922 |
|
|
\end_layout |
1923 |
|
|
|
1924 |
johnpye |
825 |
\end_inset |
1925 |
|
|
|
1926 |
jpye |
1385 |
table of H_to_D_ratio values vs. |
1927 |
johnpye |
825 |
metal_mass so we can observe approximately where it attains a minimum value. |
1928 |
|
|
ASCEND allows us to create arrays of instances of any type. |
1929 |
|
|
Here we shall create an array of vessels. |
1930 |
|
|
The type definition is shown in Figure |
1931 |
jpye |
2785 |
\begin_inset CommandInset ref |
1932 |
|
|
LatexCommand ref |
1933 |
jpye |
1766 |
reference "fig:model2.tabulatedVessel" |
1934 |
johnpye |
825 |
|
1935 |
|
|
\end_inset |
1936 |
|
|
|
1937 |
|
|
|
1938 |
|
|
\noun off |
1939 |
|
|
. |
1940 |
|
|
Note that the line numbers are not a part of the actual code. |
1941 |
|
|
We include them here only so we can reference them as needed later. |
1942 |
|
|
\end_layout |
1943 |
|
|
|
1944 |
|
|
\begin_layout Standard |
1945 |
jpye |
1385 |
tabulated_vessel_values model |
1946 |
jpye |
2785 |
\begin_inset CommandInset label |
1947 |
|
|
LatexCommand label |
1948 |
jpye |
1766 |
name "fig:model2.tabulatedVessel" |
1949 |
johnpye |
825 |
|
1950 |
jpye |
1385 |
\end_inset |
1951 |
johnpye |
825 |
|
1952 |
|
|
|
1953 |
|
|
\end_layout |
1954 |
|
|
|
1955 |
jpye |
1385 |
\begin_layout Standard |
1956 |
|
|
\begin_inset ERT |
1957 |
|
|
status open |
1958 |
johnpye |
825 |
|
1959 |
jpye |
2785 |
\begin_layout Plain Layout |
1960 |
johnpye |
825 |
|
1961 |
|
|
|
1962 |
jpye |
1385 |
\backslash |
1963 |
|
|
lstset{language=ASCEND} |
1964 |
johnpye |
825 |
\end_layout |
1965 |
|
|
|
1966 |
jpye |
2785 |
\begin_layout Plain Layout |
1967 |
johnpye |
825 |
|
1968 |
|
|
|
1969 |
jpye |
1385 |
\backslash |
1970 |
|
|
lstinputlisting[firstline=26]{../models/vesselTabulated.a4c} |
1971 |
johnpye |
825 |
\end_layout |
1972 |
|
|
|
1973 |
|
|
\end_inset |
1974 |
|
|
|
1975 |
|
|
|
1976 |
|
|
\end_layout |
1977 |
|
|
|
1978 |
|
|
\begin_layout Standard |
1979 |
|
|
Add this model to the end of the file |
1980 |
|
|
\family typewriter |
1981 |
|
|
vesselParam.a4c |
1982 |
|
|
\family default |
1983 |
|
|
|
1984 |
jpye |
2785 |
\begin_inset Index idx |
1985 |
|
|
status collapsed |
1986 |
johnpye |
825 |
|
1987 |
jpye |
2785 |
\begin_layout Plain Layout |
1988 |
|
|
vesselTabulated.a4c |
1989 |
|
|
\end_layout |
1990 |
|
|
|
1991 |
johnpye |
825 |
\end_inset |
1992 |
|
|
|
1993 |
|
|
(after the vessel model) and save the file as |
1994 |
|
|
\family typewriter |
1995 |
|
|
vesselTabulated.a4c |
1996 |
|
|
\family default |
1997 |
|
|
. |
1998 |
jpye |
1369 |
Compile an instance of |
1999 |
johnpye |
825 |
\family typewriter |
2000 |
jpye |
1369 |
tabulated_vessel_values |
2001 |
|
|
\family default |
2002 |
|
|
(call it |
2003 |
|
|
\family typewriter |
2004 |
|
|
tvv |
2005 |
|
|
\family default |
2006 |
|
|
), run the values and specify methods for it, and then solve it. |
2007 |
|
|
You will discover that the tenth element of the |
2008 |
|
|
\family typewriter |
2009 |
|
|
metal_mass |
2010 |
|
|
\family default |
2011 |
|
|
array, corresponding to an |
2012 |
|
|
\family typewriter |
2013 |
johnpye |
825 |
H_to_D_ratio |
2014 |
|
|
\family default |
2015 |
|
|
of 1 has the minimum value of 510.257 kilograms. |
2016 |
|
|
\end_layout |
2017 |
|
|
|
2018 |
|
|
\begin_layout Section |
2019 |
|
|
Creating a script |
2020 |
jpye |
2785 |
\begin_inset Index idx |
2021 |
|
|
status collapsed |
2022 |
johnpye |
825 |
|
2023 |
jpye |
2785 |
\begin_layout Plain Layout |
2024 |
|
|
script, creating |
2025 |
|
|
\end_layout |
2026 |
|
|
|
2027 |
johnpye |
825 |
\end_inset |
2028 |
|
|
|
2029 |
|
|
to demonstrate this model |
2030 |
jpye |
2785 |
\begin_inset CommandInset label |
2031 |
|
|
LatexCommand label |
2032 |
jpye |
1766 |
name "sec:model2.creatingScript" |
2033 |
johnpye |
825 |
|
2034 |
|
|
\end_inset |
2035 |
|
|
|
2036 |
|
|
|
2037 |
|
|
\end_layout |
2038 |
|
|
|
2039 |
|
|
\begin_layout Standard |
2040 |
|
|
The last step to make the model reusable is to create a script that anyone |
2041 |
|
|
can easily run. |
2042 |
|
|
Running the model successfully will allow a user to demonstrate the use |
2043 |
|
|
of the model and to explore an instance it by browsing it. |
2044 |
|
|
\end_layout |
2045 |
|
|
|
2046 |
|
|
\begin_layout Standard |
2047 |
|
|
ASCEND allows one to create such a script using either an editor or the |
2048 |
jpye |
1369 |
tools in the |
2049 |
|
|
\series bold |
2050 |
|
|
Script |
2051 |
|
|
\series default |
2052 |
|
|
window. |
2053 |
johnpye |
825 |
\end_layout |
2054 |
|
|
|
2055 |
|
|
\begin_layout Standard |
2056 |
|
|
Restart the ASCEND system. |
2057 |
|
|
You will have three windows open plus the large one which disappears by |
2058 |
jpye |
1369 |
itself in a few seconds: the |
2059 |
|
|
\series bold |
2060 |
|
|
Script |
2061 |
|
|
\series default |
2062 |
|
|
, the |
2063 |
|
|
\series bold |
2064 |
|
|
Library |
2065 |
|
|
\series default |
2066 |
|
|
and the |
2067 |
|
|
\series bold |
2068 |
|
|
Console |
2069 |
|
|
\series default |
2070 |
|
|
windows. |
2071 |
johnpye |
825 |
\end_layout |
2072 |
|
|
|
2073 |
|
|
\begin_layout Standard |
2074 |
|
|
In the |
2075 |
|
|
\series bold |
2076 |
|
|
Script |
2077 |
|
|
\series default |
2078 |
|
|
window you will see the license agreement information for ASCEND. |
2079 |
jpye |
1369 |
First clear the license agreement |
2080 |
jpye |
2785 |
\begin_inset Index idx |
2081 |
|
|
status collapsed |
2082 |
johnpye |
825 |
|
2083 |
jpye |
2785 |
\begin_layout Plain Layout |
2084 |
|
|
license agreement |
2085 |
|
|
\end_layout |
2086 |
|
|
|
2087 |
johnpye |
825 |
\end_inset |
2088 |
|
|
|
2089 |
|
|
from this window by doing the following two steps: |
2090 |
|
|
\end_layout |
2091 |
|
|
|
2092 |
|
|
\begin_layout Itemize |
2093 |
jpye |
1369 |
Click |
2094 |
|
|
\series bold |
2095 |
|
|
Select all |
2096 |
|
|
\series default |
2097 |
|
|
under the Edit menu. |
2098 |
johnpye |
825 |
|
2099 |
|
|
\end_layout |
2100 |
|
|
|
2101 |
|
|
\begin_layout Itemize |
2102 |
jpye |
1369 |
Then click |
2103 |
|
|
\series bold |
2104 |
|
|
Delete statements |
2105 |
|
|
\series default |
2106 |
|
|
under the same button. |
2107 |
johnpye |
825 |
|
2108 |
|
|
\end_layout |
2109 |
|
|
|
2110 |
|
|
\begin_layout Standard |
2111 |
jpye |
1369 |
With the |
2112 |
johnpye |
825 |
\series bold |
2113 |
jpye |
1369 |
Script |
2114 |
johnpye |
825 |
\series default |
2115 |
jpye |
1766 |
window now cleared of text, select |
2116 |
jpye |
1369 |
\series bold |
2117 |
|
|
Record actions |
2118 |
|
|
\series default |
2119 |
|
|
under the Edit menu to start recording the steps you are about to undertake. |
2120 |
|
|
Then, |
2121 |
johnpye |
825 |
\end_layout |
2122 |
|
|
|
2123 |
|
|
\begin_layout Itemize |
2124 |
jpye |
1369 |
In the |
2125 |
|
|
\series bold |
2126 |
|
|
Library |
2127 |
|
|
\series default |
2128 |
|
|
window, under the Edit menu, select |
2129 |
|
|
\series bold |
2130 |
|
|
Delete all types |
2131 |
|
|
\series default |
2132 |
|
|
. |
2133 |
|
|
Hit |
2134 |
|
|
\series bold |
2135 |
|
|
Delete all |
2136 |
|
|
\series default |
2137 |
|
|
on the small window that appears. |
2138 |
johnpye |
825 |
\end_layout |
2139 |
|
|
|
2140 |
|
|
\begin_layout Itemize |
2141 |
jpye |
1369 |
Load the file |
2142 |
|
|
\family typewriter |
2143 |
|
|
vesselTabulated.a4c |
2144 |
|
|
\family default |
2145 |
|
|
, the file containing the model called |
2146 |
|
|
\family typewriter |
2147 |
|
|
tabulated_vessel_values |
2148 |
|
|
\family default |
2149 |
|
|
. |
2150 |
|
|
Do this by selecting the Read types from file tool under the File menu |
2151 |
johnpye |
825 |
and browsing the file system to find it. |
2152 |
jpye |
1369 |
If you have trouble finding it, be sure to set the |
2153 |
|
|
\series bold |
2154 |
|
|
Files of type |
2155 |
|
|
\series default |
2156 |
|
|
dropdown at the bottom of the file browsing window to allow all types of |
2157 |
|
|
files to be seen. |
2158 |
johnpye |
825 |
\end_layout |
2159 |
|
|
|
2160 |
|
|
\begin_layout Itemize |
2161 |
jpye |
1369 |
Select the type |
2162 |
|
|
\family typewriter |
2163 |
|
|
tabulated_vessel_value |
2164 |
|
|
\family default |
2165 |
|
|
s in the right |
2166 |
|
|
\series bold |
2167 |
|
|
Library |
2168 |
|
|
\series default |
2169 |
|
|
window and compile an instance of it by selecting |
2170 |
|
|
\series bold |
2171 |
|
|
Create simulation |
2172 |
|
|
\series default |
2173 |
|
|
under the Edit menu. |
2174 |
|
|
In the small window that appears, enter the name |
2175 |
|
|
\family typewriter |
2176 |
|
|
tvv |
2177 |
|
|
\family default |
2178 |
|
|
and hit OK. |
2179 |
johnpye |
825 |
\end_layout |
2180 |
|
|
|
2181 |
|
|
\begin_layout Itemize |
2182 |
jpye |
1369 |
Export the instance to the |
2183 |
|
|
\series bold |
2184 |
|
|
Browser |
2185 |
|
|
\series default |
2186 |
|
|
by selecting |
2187 |
|
|
\series bold |
2188 |
|
|
Simulation to Browser |
2189 |
|
|
\series default |
2190 |
|
|
under the Export menu. |
2191 |
johnpye |
825 |
\end_layout |
2192 |
|
|
|
2193 |
|
|
\begin_layout Itemize |
2194 |
jpye |
1369 |
Initialize the variable values by running the |
2195 |
|
|
\family typewriter |
2196 |
|
|
values |
2197 |
|
|
\family default |
2198 |
|
|
method. |
2199 |
|
|
Do this by selecting |
2200 |
|
|
\series bold |
2201 |
|
|
Run method |
2202 |
|
|
\series default |
2203 |
|
|
under the Edit menu. |
2204 |
|
|
Select the |
2205 |
|
|
\family typewriter |
2206 |
|
|
values |
2207 |
|
|
\family default |
2208 |
|
|
method and hit |
2209 |
|
|
\series bold |
2210 |
|
|
OK |
2211 |
|
|
\series default |
2212 |
|
|
. |
2213 |
johnpye |
825 |
\end_layout |
2214 |
|
|
|
2215 |
|
|
\begin_layout Itemize |
2216 |
jpye |
1369 |
Set the |
2217 |
|
|
\family typewriter |
2218 |
|
|
fixed |
2219 |
|
|
\family default |
2220 |
|
|
flags to get a well-posed problem by repeating the last step but this time |
2221 |
|
|
select the |
2222 |
|
|
\family typewriter |
2223 |
|
|
reset |
2224 |
|
|
\family default |
2225 |
|
|
method. |
2226 |
johnpye |
825 |
\end_layout |
2227 |
|
|
|
2228 |
|
|
\begin_layout Itemize |
2229 |
jpye |
1369 |
Export the instance |
2230 |
|
|
\family typewriter |
2231 |
|
|
tvv |
2232 |
|
|
\family default |
2233 |
|
|
to the Solver by selecting |
2234 |
|
|
\series bold |
2235 |
|
|
to Solver |
2236 |
|
|
\series default |
2237 |
|
|
under the Export menu. |
2238 |
johnpye |
825 |
\end_layout |
2239 |
|
|
|
2240 |
|
|
\begin_layout Itemize |
2241 |
jpye |
1369 |
Solve |
2242 |
|
|
\family typewriter |
2243 |
|
|
tvv |
2244 |
|
|
\family default |
2245 |
|
|
by selecting |
2246 |
|
|
\series bold |
2247 |
|
|
Solve |
2248 |
|
|
\series default |
2249 |
|
|
under the Execute menu in the |
2250 |
|
|
\series bold |
2251 |
|
|
Solver |
2252 |
|
|
\series default |
2253 |
johnpye |
825 |
window. |
2254 |
|
|
\end_layout |
2255 |
|
|
|
2256 |
|
|
\begin_layout Itemize |
2257 |
jpye |
1369 |
Return to the |
2258 |
|
|
\series bold |
2259 |
|
|
Script |
2260 |
|
|
\series default |
2261 |
|
|
window and turn off the recording by deselecting the |
2262 |
|
|
\series bold |
2263 |
|
|
Record actions |
2264 |
|
|
\series default |
2265 |
|
|
option under the Edit menu. |
2266 |
johnpye |
825 |
\end_layout |
2267 |
|
|
|
2268 |
|
|
\begin_layout Itemize |
2269 |
jpye |
1369 |
Save the script you have just created by selecting |
2270 |
|
|
\series bold |
2271 |
|
|
Save |
2272 |
|
|
\series default |
2273 |
|
|
under the File menu of the |
2274 |
|
|
\series bold |
2275 |
|
|
Script |
2276 |
|
|
\series default |
2277 |
|
|
window. |
2278 |
|
|
Name the file |
2279 |
|
|
\family typewriter |
2280 |
|
|
vesselTabulated.a4s |
2281 |
|
|
\family default |
2282 |
|
|
(note the 's' ending) to indicate it is a script file corresponding to |
2283 |
|
|
the model file |
2284 |
|
|
\family typewriter |
2285 |
|
|
vesselTabulated.a4c |
2286 |
|
|
\family default |
2287 |
johnpye |
825 |
(note the 'c' ending) file. |
2288 |
|
|
\end_layout |
2289 |
|
|
|
2290 |
|
|
\begin_layout Itemize |
2291 |
jpye |
1369 |
Exit by selecting |
2292 |
|
|
\series bold |
2293 |
|
|
Exit ASCEND |
2294 |
|
|
\series default |
2295 |
|
|
under the File menu on the |
2296 |
|
|
\series bold |
2297 |
|
|
Script |
2298 |
|
|
\series default |
2299 |
|
|
window. |
2300 |
|
|
The contents of the |
2301 |
|
|
\series bold |
2302 |
|
|
Script |
2303 |
|
|
\series default |
2304 |
|
|
window at this point will be similar to that in Figure |
2305 |
jpye |
2785 |
\begin_inset CommandInset ref |
2306 |
|
|
LatexCommand ref |
2307 |
jpye |
1766 |
reference "fig:model2.scriptVesselTabulated" |
2308 |
johnpye |
825 |
|
2309 |
|
|
\end_inset |
2310 |
|
|
|
2311 |
|
|
|
2312 |
|
|
\noun off |
2313 |
jpye |
1369 |
(although the path to the file may differ). |
2314 |
johnpye |
825 |
\end_layout |
2315 |
|
|
|
2316 |
|
|
\begin_layout Itemize |
2317 |
|
|
Restart ASCEND. |
2318 |
|
|
\end_layout |
2319 |
|
|
|
2320 |
|
|
\begin_layout Itemize |
2321 |
jpye |
1369 |
Open the script you just created by selecting |
2322 |
|
|
\series bold |
2323 |
|
|
Read file |
2324 |
|
|
\series default |
2325 |
|
|
under the File menu on the |
2326 |
|
|
\series bold |
2327 |
|
|
Script |
2328 |
|
|
\series default |
2329 |
|
|
window. |
2330 |
|
|
(Be sure you are allowing the system to see files with the ending |
2331 |
|
|
\family typewriter |
2332 |
|
|
.a4s |
2333 |
|
|
\family default |
2334 |
|
|
by using the |
2335 |
|
|
\series bold |
2336 |
|
|
Files of type |
2337 |
|
|
\series default |
2338 |
|
|
dropdown at the bottom of the file-browsing window.) |
2339 |
johnpye |
825 |
\end_layout |
2340 |
|
|
|
2341 |
|
|
\begin_layout Itemize |
2342 |
|
|
Highlight all the instructions in this script and then execute the highlighted |
2343 |
jpye |
1369 |
instructions by selecting |
2344 |
|
|
\series bold |
2345 |
|
|
Statements selected |
2346 |
|
|
\series default |
2347 |
|
|
under the |
2348 |
|
|
\series bold |
2349 |
|
|
Execute |
2350 |
|
|
\series default |
2351 |
|
|
menu. |
2352 |
johnpye |
825 |
\end_layout |
2353 |
|
|
|
2354 |
|
|
\begin_layout Standard |
2355 |
|
|
You will run the same sequence of instructions you ran to create the script. |
2356 |
|
|
\end_layout |
2357 |
|
|
|
2358 |
|
|
\begin_layout Standard |
2359 |
jpye |
2785 |
\begin_inset CommandInset label |
2360 |
|
|
LatexCommand label |
2361 |
jpye |
1766 |
name "fig:model2.scriptVesselTabulated" |
2362 |
johnpye |
825 |
|
2363 |
jpye |
1385 |
\end_inset |
2364 |
johnpye |
825 |
|
2365 |
jpye |
1369 |
Script to run |
2366 |
|
|
\family typewriter |
2367 |
|
|
vesselTabulated.a4c |
2368 |
|
|
\family default |
2369 |
|
|
(this is the contents of the file |
2370 |
|
|
\family typewriter |
2371 |
|
|
vesselTabulated.a4s |
2372 |
|
|
\family default |
2373 |
|
|
|
2374 |
jpye |
2785 |
\begin_inset Index idx |
2375 |
|
|
status collapsed |
2376 |
johnpye |
825 |
|
2377 |
jpye |
2785 |
\begin_layout Plain Layout |
2378 |
|
|
vesselTabultated.a4s |
2379 |
|
|
\end_layout |
2380 |
|
|
|
2381 |
johnpye |
825 |
\end_inset |
2382 |
|
|
|
2383 |
|
|
) |
2384 |
jpye |
1385 |
\end_layout |
2385 |
johnpye |
825 |
|
2386 |
jpye |
1385 |
\begin_layout Standard |
2387 |
|
|
\begin_inset ERT |
2388 |
|
|
status open |
2389 |
johnpye |
825 |
|
2390 |
jpye |
2785 |
\begin_layout Plain Layout |
2391 |
johnpye |
825 |
|
2392 |
jpye |
1385 |
|
2393 |
|
|
\backslash |
2394 |
|
|
lstinputlisting[firstline=29]{../models/vesselTabulated.a4s} |
2395 |
johnpye |
825 |
\end_layout |
2396 |
|
|
|
2397 |
|
|
\end_inset |
2398 |
|
|
|
2399 |
|
|
|
2400 |
|
|
\end_layout |
2401 |
|
|
|
2402 |
|
|
\begin_layout Section |
2403 |
|
|
Discussion |
2404 |
|
|
\end_layout |
2405 |
|
|
|
2406 |
|
|
\begin_layout Standard |
2407 |
|
|
In this chapter we converted the vessel model into a form where you and |
2408 |
|
|
others in the future will have a chance to reuse it. |
2409 |
|
|
We did this by first adding methods to make the problem well-posed and |
2410 |
|
|
to provide values for the fixed variables for which we readily found a |
2411 |
|
|
solution when playing with our original model as we did in the previous |
2412 |
|
|
chapter. |
2413 |
|
|
We then thought of a typical use for this model and developed a parameterized |
2414 |
|
|
version based on that use. |
2415 |
|
|
If this model were in a library, a future user of it would most often simply |
2416 |
|
|
have to understand the parameters to create an instance of this type of |
2417 |
|
|
model. |
2418 |
jpye |
1369 |
We next added |
2419 |
|
|
\family typewriter |
2420 |
|
|
NOTES |
2421 |
|
|
\family default |
2422 |
|
|
, a form of active comments, to the model. |
2423 |
johnpye |
825 |
We suggest that notes are much more useful than comments as we can provide |
2424 |
|
|
tools that can extract them and allow us to search them, for example, to |
2425 |
|
|
find a model with a given functionality. |
2426 |
|
|
Finally, we showed you how to create a script by turning on a "phone" session |
2427 |
|
|
where ASCEND records the actions one takes when loading, compiling and |
2428 |
|
|
solving a model. |
2429 |
|
|
One can save and play this script in the future to see a typical use of |
2430 |
|
|
the model. |
2431 |
|
|
\end_layout |
2432 |
|
|
|
2433 |
|
|
\begin_layout Standard |
2434 |
|
|
In the next chapter, we look at how we can plot the results we created in |
2435 |
jpye |
1369 |
the model |
2436 |
|
|
\family typewriter |
2437 |
|
|
vesselTabulated.a4c |
2438 |
|
|
\family default |
2439 |
|
|
. |
2440 |
johnpye |
825 |
We will have to reuse a model someone else has put into the library of |
2441 |
|
|
available models. |
2442 |
|
|
In other words, the "shoe is on the other foot," and we quickly experience |
2443 |
|
|
the difficulties with reuse first hand. |
2444 |
|
|
We will also learn how to run a case study from which we can extract the |
2445 |
|
|
same information with a single vessel model run multiple times. |
2446 |
|
|
\end_layout |
2447 |
|
|
|
2448 |
|
|
\end_body |
2449 |
|
|
\end_document |