| 1 |
#LyX 1.4.1 created this file. For more info see http://www.lyx.org/ |
| 2 |
\lyxformat 245 |
| 3 |
\begin_document |
| 4 |
\begin_header |
| 5 |
\textclass book |
| 6 |
\language english |
| 7 |
\inputencoding auto |
| 8 |
\fontscheme default |
| 9 |
\graphics default |
| 10 |
\paperfontsize default |
| 11 |
\spacing single |
| 12 |
\papersize a4paper |
| 13 |
\use_geometry false |
| 14 |
\use_amsmath 2 |
| 15 |
\cite_engine basic |
| 16 |
\use_bibtopic false |
| 17 |
\paperorientation portrait |
| 18 |
\secnumdepth 3 |
| 19 |
\tocdepth 3 |
| 20 |
\paragraph_separation indent |
| 21 |
\defskip medskip |
| 22 |
\quotes_language english |
| 23 |
\papercolumns 1 |
| 24 |
\papersides 2 |
| 25 |
\paperpagestyle default |
| 26 |
\tracking_changes false |
| 27 |
\output_changes true |
| 28 |
\end_header |
| 29 |
|
| 30 |
\begin_body |
| 31 |
|
| 32 |
\begin_layout Chapter |
| 33 |
Plotting |
| 34 |
\begin_inset LatexCommand \index{plotting} |
| 35 |
|
| 36 |
\end_inset |
| 37 |
|
| 38 |
data sampled from complex models |
| 39 |
\begin_inset LatexCommand \label{cha:plot} |
| 40 |
|
| 41 |
\end_inset |
| 42 |
|
| 43 |
|
| 44 |
\end_layout |
| 45 |
|
| 46 |
\begin_layout Standard |
| 47 |
Often you need a plot of data sampled from arbitrary locations in a model |
| 48 |
that are not naturally grouped in a single easily plotted vector. |
| 49 |
The |
| 50 |
\family typewriter |
| 51 |
plot.a4l |
| 52 |
\family default |
| 53 |
|
| 54 |
\begin_inset LatexCommand \index{plot.a4l} |
| 55 |
|
| 56 |
\end_inset |
| 57 |
|
| 58 |
library provides models ( |
| 59 |
\family typewriter |
| 60 |
plt_curve |
| 61 |
\family default |
| 62 |
|
| 63 |
\begin_inset LatexCommand \index{plt\_curve} |
| 64 |
|
| 65 |
\end_inset |
| 66 |
|
| 67 |
, |
| 68 |
\family typewriter |
| 69 |
plt_plot_symbol |
| 70 |
\family default |
| 71 |
|
| 72 |
\begin_inset LatexCommand \index{plt\_plot\_symbol} |
| 73 |
|
| 74 |
\end_inset |
| 75 |
|
| 76 |
, and |
| 77 |
\family typewriter |
| 78 |
plt_plot_integer |
| 79 |
\family default |
| 80 |
|
| 81 |
\begin_inset LatexCommand \index{plt\_plot\_integer} |
| 82 |
|
| 83 |
\end_inset |
| 84 |
|
| 85 |
) that can be used with the Browser's Display Plot button. |
| 86 |
In this chapter we see how to create such a plot using the ASCEND statement |
| 87 |
ALIASES/IS_A to sample data from a mechanical system of stretched springs, |
| 88 |
masses, anchors, and fingers. |
| 89 |
Creating plots of time series data output from ASCEND's initial value solver |
| 90 |
LSODE is discussed in Chapter\InsetSpace ~ |
| 91 |
|
| 92 |
\begin_inset LatexCommand \vref{cha:ivp} |
| 93 |
|
| 94 |
\end_inset |
| 95 |
|
| 96 |
. |
| 97 |
\end_layout |
| 98 |
|
| 99 |
\begin_layout Standard |
| 100 |
Chemical engineers who can tolerate distillation models should visit the |
| 101 |
file |
| 102 |
\family typewriter |
| 103 |
plotcol.a4c |
| 104 |
\family default |
| 105 |
in the models library for more complicated examples of plotting and visit |
| 106 |
the model |
| 107 |
\family typewriter |
| 108 |
simple_column_profiles |
| 109 |
\family default |
| 110 |
|
| 111 |
\begin_inset LatexCommand \index{simple\_column\_profiles} |
| 112 |
|
| 113 |
\end_inset |
| 114 |
|
| 115 |
in |
| 116 |
\family typewriter |
| 117 |
column.a4l |
| 118 |
\family default |
| 119 |
|
| 120 |
\begin_inset LatexCommand \index{column.a4l} |
| 121 |
|
| 122 |
\end_inset |
| 123 |
|
| 124 |
for more complicated examples of sampling data. |
| 125 |
Reading this chapter first may be of help in interpreting those models. |
| 126 |
\end_layout |
| 127 |
|
| 128 |
\begin_layout Section |
| 129 |
The graph we want |
| 130 |
\end_layout |
| 131 |
|
| 132 |
\begin_layout Standard |
| 133 |
We want to plot the positions X1 to X3 of the connecting hooks h1, h2, and |
| 134 |
h3 in a mechanical system as shown in Figure\InsetSpace ~ |
| 135 |
|
| 136 |
\begin_inset LatexCommand \ref{fig:plot.springSystem} |
| 137 |
|
| 138 |
\end_inset |
| 139 |
|
| 140 |
|
| 141 |
\noun off |
| 142 |
. |
| 143 |
The anchor, hooks, springs, and finger (we could replace either spring |
| 144 |
with a block mass, also) are all separate objects which we have modeled |
| 145 |
very simply. |
| 146 |
These models are given at the end of the chapter and can also be found |
| 147 |
(with improvements) in |
| 148 |
\family typewriter |
| 149 |
\noun default |
| 150 |
force1d.a4c |
| 151 |
\begin_inset LatexCommand \index{force1d.a4c} |
| 152 |
|
| 153 |
\end_inset |
| 154 |
|
| 155 |
|
| 156 |
\family default |
| 157 |
\noun off |
| 158 |
, a model file in the distributed ASCEND libraries. |
| 159 |
|
| 160 |
\end_layout |
| 161 |
|
| 162 |
\begin_layout Standard |
| 163 |
\begin_inset Float figure |
| 164 |
wide false |
| 165 |
sideways false |
| 166 |
status open |
| 167 |
|
| 168 |
\begin_layout Standard |
| 169 |
|
| 170 |
\noun off |
| 171 |
\InsetSpace ~ |
| 172 |
\InsetSpace ~ |
| 173 |
\InsetSpace ~ |
| 174 |
\InsetSpace ~ |
| 175 |
\InsetSpace ~ |
| 176 |
\InsetSpace ~ |
| 177 |
\InsetSpace ~ |
| 178 |
\InsetSpace ~ |
| 179 |
\InsetSpace ~ |
| 180 |
\InsetSpace ~ |
| 181 |
\InsetSpace ~ |
| 182 |
\InsetSpace ~ |
| 183 |
\InsetSpace ~ |
| 184 |
\InsetSpace ~ |
| 185 |
\InsetSpace ~ |
| 186 |
\InsetSpace ~ |
| 187 |
\InsetSpace ~ |
| 188 |
\InsetSpace ~ |
| 189 |
\InsetSpace ~ |
| 190 |
\InsetSpace ~ |
| 191 |
\InsetSpace ~ |
| 192 |
\InsetSpace ~ |
| 193 |
\InsetSpace ~ |
| 194 |
\InsetSpace ~ |
| 195 |
\InsetSpace ~ |
| 196 |
\InsetSpace ~ |
| 197 |
|
| 198 |
\begin_inset Graphics |
| 199 |
filename howto-plotFig1.eps |
| 200 |
scale 80 |
| 201 |
BoundingBox 0bp 0bp 400bp 200bp |
| 202 |
|
| 203 |
\end_inset |
| 204 |
|
| 205 |
|
| 206 |
\end_layout |
| 207 |
|
| 208 |
\begin_layout Caption |
| 209 |
Spring test model |
| 210 |
\begin_inset LatexCommand \index{spring test model} |
| 211 |
|
| 212 |
\end_inset |
| 213 |
|
| 214 |
system, |
| 215 |
\family typewriter |
| 216 |
st |
| 217 |
\family default |
| 218 |
|
| 219 |
\begin_inset LatexCommand \label{fig:plot.springSystem} |
| 220 |
|
| 221 |
\end_inset |
| 222 |
|
| 223 |
|
| 224 |
\end_layout |
| 225 |
|
| 226 |
\end_inset |
| 227 |
|
| 228 |
|
| 229 |
\end_layout |
| 230 |
|
| 231 |
\begin_layout Standard |
| 232 |
Plotting is usually a post-solution analysis |
| 233 |
\begin_inset LatexCommand \index{post-solution analysis} |
| 234 |
|
| 235 |
\end_inset |
| 236 |
|
| 237 |
tool, so our plots should not be entangled with the basic models or with |
| 238 |
the total mechanical system model, |
| 239 |
\family typewriter |
| 240 |
st |
| 241 |
\family default |
| 242 |
. |
| 243 |
We might want to explain the system |
| 244 |
\family typewriter |
| 245 |
st |
| 246 |
\family default |
| 247 |
to someone and this could be hard to do if the code is cluttered up with |
| 248 |
plot information. |
| 249 |
\end_layout |
| 250 |
|
| 251 |
\begin_layout Section |
| 252 |
Constructing a plot curve |
| 253 |
\end_layout |
| 254 |
|
| 255 |
\begin_layout Standard |
| 256 |
The plot library models follow object-oriented thinking carefully, perhaps |
| 257 |
a little too carefully. |
| 258 |
A |
| 259 |
\family typewriter |
| 260 |
plt_plot_integer |
| 261 |
\family default |
| 262 |
is a plottable model built out of plt_curves which are in turn built out |
| 263 |
of arrays of data points from the user. |
| 264 |
Constructing these data arrays is the only significant challenge in using |
| 265 |
the plot models. |
| 266 |
Begin by building a new model with the system st as a part: |
| 267 |
\end_layout |
| 268 |
|
| 269 |
\begin_layout LyX-Code |
| 270 |
MODEL plot_spring_test; |
| 271 |
\end_layout |
| 272 |
|
| 273 |
\begin_layout LyX-Code |
| 274 |
st IS_A spring_test; |
| 275 |
\end_layout |
| 276 |
|
| 277 |
\begin_layout LyX-Code |
| 278 |
Plot_X IS_A plt_plot_integer(curve_set,curves); |
| 279 |
\end_layout |
| 280 |
|
| 281 |
\begin_layout LyX-Code |
| 282 |
END plot_spring_test; |
| 283 |
\end_layout |
| 284 |
|
| 285 |
\begin_layout Standard |
| 286 |
We want to create a |
| 287 |
\family typewriter |
| 288 |
plt_curve |
| 289 |
\family default |
| 290 |
from the array of hook numbers |
| 291 |
\family typewriter |
| 292 |
y_data[1..3] |
| 293 |
\family default |
| 294 |
plotted against horizontal hook position |
| 295 |
\family typewriter |
| 296 |
x_data[1..3] |
| 297 |
\family default |
| 298 |
. |
| 299 |
There are obvious problems with the model above: |
| 300 |
\family typewriter |
| 301 |
curves |
| 302 |
\family default |
| 303 |
and |
| 304 |
\family typewriter |
| 305 |
curve_set |
| 306 |
\family default |
| 307 |
are used without being defined, and there is no mention of |
| 308 |
\family typewriter |
| 309 |
x_data |
| 310 |
\family default |
| 311 |
or |
| 312 |
\family typewriter |
| 313 |
y_data |
| 314 |
\family default |
| 315 |
. |
| 316 |
|
| 317 |
\end_layout |
| 318 |
|
| 319 |
\begin_layout Standard |
| 320 |
Begin by using an ALIASES |
| 321 |
\begin_inset LatexCommand \index{ALIASES} |
| 322 |
|
| 323 |
\end_inset |
| 324 |
|
| 325 |
/IS_A statement to construct the array of positions |
| 326 |
\family typewriter |
| 327 |
x_data |
| 328 |
\family default |
| 329 |
from the variables X stored in the hooks of model |
| 330 |
\family typewriter |
| 331 |
st |
| 332 |
\family default |
| 333 |
. |
| 334 |
\end_layout |
| 335 |
|
| 336 |
\begin_layout LyX-Code |
| 337 |
x_data[Xset] ALIASES (st.h1.X,st.h2.X,st.h3.X) |
| 338 |
\end_layout |
| 339 |
|
| 340 |
\begin_layout LyX-Code |
| 341 |
WHERE Xset IS_A set OF integer_constant; |
| 342 |
\end_layout |
| 343 |
|
| 344 |
\begin_layout Standard |
| 345 |
This statement creates a set, |
| 346 |
\family typewriter |
| 347 |
Xset |
| 348 |
\family default |
| 349 |
, indexing a new array |
| 350 |
\family typewriter |
| 351 |
x_data |
| 352 |
\family default |
| 353 |
with elements collected from |
| 354 |
\family typewriter |
| 355 |
st |
| 356 |
\family default |
| 357 |
. |
| 358 |
Since the value of |
| 359 |
\family typewriter |
| 360 |
Xset |
| 361 |
\family default |
| 362 |
is not specified, it becomes by default the set [1,2,3]. |
| 363 |
\end_layout |
| 364 |
|
| 365 |
\begin_layout Standard |
| 366 |
Now we need the hook numbers, |
| 367 |
\family typewriter |
| 368 |
y_data |
| 369 |
\family default |
| 370 |
. |
| 371 |
These do not exist in |
| 372 |
\family typewriter |
| 373 |
st |
| 374 |
\family default |
| 375 |
, so we create them. |
| 376 |
We will set the numeric values of these in the |
| 377 |
\family typewriter |
| 378 |
default_self |
| 379 |
\family default |
| 380 |
method. |
| 381 |
We will include method in the final model, but do not show it here. |
| 382 |
\end_layout |
| 383 |
|
| 384 |
\begin_layout LyX-Code |
| 385 |
y_data[Xset] IS_A real; |
| 386 |
\end_layout |
| 387 |
|
| 388 |
\begin_layout Standard |
| 389 |
Having both |
| 390 |
\family typewriter |
| 391 |
y_data |
| 392 |
\family default |
| 393 |
and |
| 394 |
\family typewriter |
| 395 |
x_data |
| 396 |
\family default |
| 397 |
, we can construct a curve from them: |
| 398 |
\end_layout |
| 399 |
|
| 400 |
\begin_layout LyX-Code |
| 401 |
X_curve IS_A plt_curve(Xset,y_data,x_data); |
| 402 |
\end_layout |
| 403 |
|
| 404 |
\begin_layout Section |
| 405 |
Constructing the array of curves |
| 406 |
\end_layout |
| 407 |
|
| 408 |
\begin_layout Standard |
| 409 |
We have a curve, but the |
| 410 |
\family typewriter |
| 411 |
plt_plot_integer |
| 412 |
\family default |
| 413 |
model |
| 414 |
\family typewriter |
| 415 |
Plot_x |
| 416 |
\family default |
| 417 |
expects an array of curves and the set indexing this array as input. |
| 418 |
We can make both from |
| 419 |
\family typewriter |
| 420 |
X_curve |
| 421 |
\family default |
| 422 |
easily using, once again, an ALIASES/IS_A statement. |
| 423 |
\end_layout |
| 424 |
|
| 425 |
\begin_layout LyX-Code |
| 426 |
curves[curve_set] ALIASES (X_curve) |
| 427 |
\end_layout |
| 428 |
|
| 429 |
\begin_layout LyX-Code |
| 430 |
WHERE curve_set IS_A set OF integer_constant; |
| 431 |
\end_layout |
| 432 |
|
| 433 |
\begin_layout Standard |
| 434 |
All the pieces are now in place, so we have the final model: |
| 435 |
\end_layout |
| 436 |
|
| 437 |
\begin_layout LyX-Code |
| 438 |
MODEL plot_spring_test; |
| 439 |
\end_layout |
| 440 |
|
| 441 |
\begin_layout LyX-Code |
| 442 |
|
| 443 |
\end_layout |
| 444 |
|
| 445 |
\begin_layout LyX-Code |
| 446 |
(* create our system model and plot. |
| 447 |
*) |
| 448 |
\end_layout |
| 449 |
|
| 450 |
\begin_layout LyX-Code |
| 451 |
st IS_A spring_test; |
| 452 |
\end_layout |
| 453 |
|
| 454 |
\begin_layout LyX-Code |
| 455 |
Plot_X IS_A plt_plot_integer(curve_set,curves); |
| 456 |
\end_layout |
| 457 |
|
| 458 |
\begin_layout LyX-Code |
| 459 |
|
| 460 |
\end_layout |
| 461 |
|
| 462 |
\begin_layout LyX-Code |
| 463 |
(* Gather the sampled data into an array *) |
| 464 |
\end_layout |
| 465 |
|
| 466 |
\begin_layout LyX-Code |
| 467 |
x_data[Xset] ALIASES (st.h1.X,st.h2.X,st.h3.X) |
| 468 |
\end_layout |
| 469 |
|
| 470 |
\begin_layout LyX-Code |
| 471 |
WHERE Xset IS_A set OF integer_constant; |
| 472 |
\end_layout |
| 473 |
|
| 474 |
\begin_layout LyX-Code |
| 475 |
(* Create the Y coordinates *) |
| 476 |
\end_layout |
| 477 |
|
| 478 |
\begin_layout LyX-Code |
| 479 |
y_data[Xset] IS_A real; |
| 480 |
\end_layout |
| 481 |
|
| 482 |
\begin_layout LyX-Code |
| 483 |
|
| 484 |
\end_layout |
| 485 |
|
| 486 |
\begin_layout LyX-Code |
| 487 |
(* create the curve *) |
| 488 |
\end_layout |
| 489 |
|
| 490 |
\begin_layout LyX-Code |
| 491 |
X_curve IS_A plt_curve(Xset,y_data,x_data); |
| 492 |
\end_layout |
| 493 |
|
| 494 |
\begin_layout LyX-Code |
| 495 |
(* Make X_curve into the array for plt_plot_integer *) |
| 496 |
\end_layout |
| 497 |
|
| 498 |
\begin_layout LyX-Code |
| 499 |
curves[curve_set] ALIASES (X_curve) WHERE |
| 500 |
\end_layout |
| 501 |
|
| 502 |
\begin_layout LyX-Code |
| 503 |
curve_set IS_A set OF integer_constant; |
| 504 |
\end_layout |
| 505 |
|
| 506 |
\begin_layout LyX-Code |
| 507 |
METHOD default_self; |
| 508 |
\end_layout |
| 509 |
|
| 510 |
\begin_layout LyX-Code |
| 511 |
RUN st.default_self; |
| 512 |
\end_layout |
| 513 |
|
| 514 |
\begin_layout LyX-Code |
| 515 |
st.s1.L0 := 0.2{m}; (* make st more interesting *) |
| 516 |
\end_layout |
| 517 |
|
| 518 |
\begin_layout LyX-Code |
| 519 |
RUN Plot_X.default_self; |
| 520 |
\end_layout |
| 521 |
|
| 522 |
\begin_layout LyX-Code |
| 523 |
RUN X_curve.default_self; |
| 524 |
\end_layout |
| 525 |
|
| 526 |
\begin_layout LyX-Code |
| 527 |
FOR i IN Xset DO |
| 528 |
\end_layout |
| 529 |
|
| 530 |
\begin_layout LyX-Code |
| 531 |
y_data[i] := i; |
| 532 |
\end_layout |
| 533 |
|
| 534 |
\begin_layout LyX-Code |
| 535 |
END FOR; |
| 536 |
\end_layout |
| 537 |
|
| 538 |
\begin_layout LyX-Code |
| 539 |
X_curve.legend := 'meter'; |
| 540 |
\end_layout |
| 541 |
|
| 542 |
\begin_layout LyX-Code |
| 543 |
Plot_X.title := 'Hook locations'; |
| 544 |
\end_layout |
| 545 |
|
| 546 |
\begin_layout LyX-Code |
| 547 |
Plot_X.XLabel := 'location'; |
| 548 |
\end_layout |
| 549 |
|
| 550 |
\begin_layout LyX-Code |
| 551 |
Plot_X.YLabel := 'hook #'; |
| 552 |
\end_layout |
| 553 |
|
| 554 |
\begin_layout LyX-Code |
| 555 |
END default_self; |
| 556 |
\end_layout |
| 557 |
|
| 558 |
\begin_layout LyX-Code |
| 559 |
END plot_spring_test; |
| 560 |
\end_layout |
| 561 |
|
| 562 |
\begin_layout Section |
| 563 |
Resulting position plot |
| 564 |
\end_layout |
| 565 |
|
| 566 |
\begin_layout Standard |
| 567 |
We can compile the plot model and obtain the graph in with the following |
| 568 |
short script. |
| 569 |
\end_layout |
| 570 |
|
| 571 |
\begin_layout LyX-Code |
| 572 |
READ FILE force1d.a4c; |
| 573 |
\end_layout |
| 574 |
|
| 575 |
\begin_layout LyX-Code |
| 576 |
COMPILE pst OF plot_spring_test; |
| 577 |
\end_layout |
| 578 |
|
| 579 |
\begin_layout LyX-Code |
| 580 |
BROWSE {pst}; |
| 581 |
\end_layout |
| 582 |
|
| 583 |
\begin_layout LyX-Code |
| 584 |
RUN {pst.st.reset}; |
| 585 |
\end_layout |
| 586 |
|
| 587 |
\begin_layout LyX-Code |
| 588 |
SOLVE {pst.st} WITH QRSlv; |
| 589 |
\end_layout |
| 590 |
|
| 591 |
\begin_layout LyX-Code |
| 592 |
PLOT {pst.Plot_X} ; |
| 593 |
\end_layout |
| 594 |
|
| 595 |
\begin_layout LyX-Code |
| 596 |
SHOW LAST; |
| 597 |
\end_layout |
| 598 |
|
| 599 |
\begin_layout Standard |
| 600 |
We can also obtain the plot by moving to |
| 601 |
\family typewriter |
| 602 |
pst.Plot_X |
| 603 |
\family default |
| 604 |
in the Browser window and then pushing the Display |
| 605 |
\begin_inset Formula $\rightarrow$ |
| 606 |
\end_inset |
| 607 |
|
| 608 |
Plot button or then typing "Alt-d p". |
| 609 |
We see the hooks are positioned near 0, 230, and 370 mm. |
| 610 |
We also see that xgraph |
| 611 |
\begin_inset LatexCommand \index{xgraph} |
| 612 |
|
| 613 |
\end_inset |
| 614 |
|
| 615 |
sometimes makes less than pretty graphs (Figure |
| 616 |
\begin_inset LatexCommand \ref{fig:plot.plotXforSpring} |
| 617 |
|
| 618 |
\end_inset |
| 619 |
|
| 620 |
). |
| 621 |
\end_layout |
| 622 |
|
| 623 |
\begin_layout Standard |
| 624 |
\begin_inset Float figure |
| 625 |
wide false |
| 626 |
sideways false |
| 627 |
status open |
| 628 |
|
| 629 |
\begin_layout Standard |
| 630 |
\begin_inset Graphics |
| 631 |
filename howto-plotFig2.eps |
| 632 |
BoundingBox 30bp 0bp 480bp 460bp |
| 633 |
|
| 634 |
\end_inset |
| 635 |
|
| 636 |
|
| 637 |
\end_layout |
| 638 |
|
| 639 |
\begin_layout Caption |
| 640 |
\begin_inset LatexCommand \label{fig:plot.plotXforSpring} |
| 641 |
|
| 642 |
\end_inset |
| 643 |
|
| 644 |
Plot_X in plot_spring_test |
| 645 |
\end_layout |
| 646 |
|
| 647 |
\end_inset |
| 648 |
|
| 649 |
|
| 650 |
\end_layout |
| 651 |
|
| 652 |
\begin_layout Section |
| 653 |
1-D mechanical hook, spring, mass, anchor, and finger models |
| 654 |
\end_layout |
| 655 |
|
| 656 |
\begin_layout Standard |
| 657 |
The models used in this chapter are very simple versions of masses and springs |
| 658 |
horizontally at rest, but possibly under tension, stretched between an |
| 659 |
anchor and a finger. |
| 660 |
Only the code absolutely necessary for this example is given here; the |
| 661 |
full code with methods and additional comments is given in |
| 662 |
\family typewriter |
| 663 |
force1d.a4c |
| 664 |
\family default |
| 665 |
, an ASCEND modeling example in the library. |
| 666 |
|
| 667 |
\end_layout |
| 668 |
|
| 669 |
\begin_layout Standard |
| 670 |
These models could easily be extended to include mass, momentum, and acceleratio |
| 671 |
n in two or three dimensions. |
| 672 |
Most of the methods in the |
| 673 |
\family typewriter |
| 674 |
force1d.a4c |
| 675 |
\family default |
| 676 |
models are unedited from the code generated by the ASCEND Library button |
| 677 |
Edit |
| 678 |
\begin_inset Formula $\rightarrow$ |
| 679 |
\end_inset |
| 680 |
|
| 681 |
Suggest method |
| 682 |
\begin_inset LatexCommand \index{method, Suggest method} |
| 683 |
|
| 684 |
\end_inset |
| 685 |
|
| 686 |
|
| 687 |
\begin_inset LatexCommand \index{Suggest method tool} |
| 688 |
|
| 689 |
\end_inset |
| 690 |
|
| 691 |
. |
| 692 |
If you improve on these models, please share them with us and the rest |
| 693 |
of the ASCEND community. |
| 694 |
\end_layout |
| 695 |
|
| 696 |
\begin_layout LyX-Code |
| 697 |
REQUIRE "atoms.a4l"; |
| 698 |
\end_layout |
| 699 |
|
| 700 |
\begin_layout LyX-Code |
| 701 |
CONSTANT spring_constant REFINES real_constant DIMENSION M/T^2; |
| 702 |
\end_layout |
| 703 |
|
| 704 |
\begin_layout LyX-Code |
| 705 |
CONSTANT position_constant REFINES real_constant DIMENSION L; |
| 706 |
\end_layout |
| 707 |
|
| 708 |
\begin_layout LyX-Code |
| 709 |
ATOM position REFINES distance DEFAULT 0{m}; |
| 710 |
\end_layout |
| 711 |
|
| 712 |
\begin_layout LyX-Code |
| 713 |
END position; |
| 714 |
\end_layout |
| 715 |
|
| 716 |
\begin_layout LyX-Code |
| 717 |
|
| 718 |
\end_layout |
| 719 |
|
| 720 |
\begin_layout LyX-Code |
| 721 |
MODEL hook; |
| 722 |
\end_layout |
| 723 |
|
| 724 |
\begin_layout LyX-Code |
| 725 |
F_left, F_right IS_A force; |
| 726 |
\end_layout |
| 727 |
|
| 728 |
\begin_layout LyX-Code |
| 729 |
F_left = F_right; |
| 730 |
\end_layout |
| 731 |
|
| 732 |
\begin_layout LyX-Code |
| 733 |
X IS_A position; |
| 734 |
\end_layout |
| 735 |
|
| 736 |
\begin_layout LyX-Code |
| 737 |
METHODS |
| 738 |
\end_layout |
| 739 |
|
| 740 |
\begin_layout LyX-Code |
| 741 |
METHOD default_self; |
| 742 |
\end_layout |
| 743 |
|
| 744 |
\begin_layout LyX-Code |
| 745 |
(* ATOM defaults are fine *) |
| 746 |
\end_layout |
| 747 |
|
| 748 |
\begin_layout LyX-Code |
| 749 |
END default_self; |
| 750 |
\end_layout |
| 751 |
|
| 752 |
\begin_layout LyX-Code |
| 753 |
METHOD specify; |
| 754 |
\end_layout |
| 755 |
|
| 756 |
\begin_layout LyX-Code |
| 757 |
F_right.fixed := TRUE; |
| 758 |
\end_layout |
| 759 |
|
| 760 |
\begin_layout LyX-Code |
| 761 |
END specify; |
| 762 |
\end_layout |
| 763 |
|
| 764 |
\begin_layout LyX-Code |
| 765 |
METHOD specify_float; |
| 766 |
\end_layout |
| 767 |
|
| 768 |
\begin_layout LyX-Code |
| 769 |
END specify_float; |
| 770 |
\end_layout |
| 771 |
|
| 772 |
\begin_layout LyX-Code |
| 773 |
END hook; |
| 774 |
\end_layout |
| 775 |
|
| 776 |
\begin_layout LyX-Code |
| 777 |
|
| 778 |
\end_layout |
| 779 |
|
| 780 |
\begin_layout LyX-Code |
| 781 |
MODEL massless_spring( |
| 782 |
\end_layout |
| 783 |
|
| 784 |
\begin_layout LyX-Code |
| 785 |
k IS_A spring_constant; |
| 786 |
\end_layout |
| 787 |
|
| 788 |
\begin_layout LyX-Code |
| 789 |
h_left WILL_BE hook; |
| 790 |
\end_layout |
| 791 |
|
| 792 |
\begin_layout LyX-Code |
| 793 |
h_right WILL_BE hook; |
| 794 |
\end_layout |
| 795 |
|
| 796 |
\begin_layout LyX-Code |
| 797 |
) WHERE ( |
| 798 |
\end_layout |
| 799 |
|
| 800 |
\begin_layout LyX-Code |
| 801 |
h_left, h_right WILL_NOT_BE_THE_SAME; |
| 802 |
\end_layout |
| 803 |
|
| 804 |
\begin_layout LyX-Code |
| 805 |
); |
| 806 |
\end_layout |
| 807 |
|
| 808 |
\begin_layout LyX-Code |
| 809 |
L0, dx IS_A distance; |
| 810 |
\end_layout |
| 811 |
|
| 812 |
\begin_layout LyX-Code |
| 813 |
h_right.X = h_left.X + L0 + dx; |
| 814 |
\end_layout |
| 815 |
|
| 816 |
\begin_layout LyX-Code |
| 817 |
F = k * dx; |
| 818 |
\end_layout |
| 819 |
|
| 820 |
\begin_layout LyX-Code |
| 821 |
h_left.F_right = F; |
| 822 |
\end_layout |
| 823 |
|
| 824 |
\begin_layout LyX-Code |
| 825 |
h_right.F_left = F; |
| 826 |
\end_layout |
| 827 |
|
| 828 |
\begin_layout LyX-Code |
| 829 |
F IS_A force; |
| 830 |
\end_layout |
| 831 |
|
| 832 |
\begin_layout LyX-Code |
| 833 |
METHODS |
| 834 |
\end_layout |
| 835 |
|
| 836 |
\begin_layout LyX-Code |
| 837 |
METHOD default_self; |
| 838 |
\end_layout |
| 839 |
|
| 840 |
\begin_layout LyX-Code |
| 841 |
dx := 1{cm}; |
| 842 |
\end_layout |
| 843 |
|
| 844 |
\begin_layout LyX-Code |
| 845 |
L0 := 10{cm}; |
| 846 |
\end_layout |
| 847 |
|
| 848 |
\begin_layout LyX-Code |
| 849 |
END default_self; |
| 850 |
\end_layout |
| 851 |
|
| 852 |
\begin_layout LyX-Code |
| 853 |
METHOD specify; |
| 854 |
\end_layout |
| 855 |
|
| 856 |
\begin_layout LyX-Code |
| 857 |
L0.fixed := TRUE; |
| 858 |
\end_layout |
| 859 |
|
| 860 |
\begin_layout LyX-Code |
| 861 |
RUN h_left.reset; |
| 862 |
\end_layout |
| 863 |
|
| 864 |
\begin_layout LyX-Code |
| 865 |
RUN h_right.reset; |
| 866 |
\end_layout |
| 867 |
|
| 868 |
\begin_layout LyX-Code |
| 869 |
h_left.F_right.fixed := FALSE; |
| 870 |
\end_layout |
| 871 |
|
| 872 |
\begin_layout LyX-Code |
| 873 |
h_left.X.fixed := TRUE; |
| 874 |
\end_layout |
| 875 |
|
| 876 |
\begin_layout LyX-Code |
| 877 |
END specify; |
| 878 |
\end_layout |
| 879 |
|
| 880 |
\begin_layout LyX-Code |
| 881 |
METHOD specify_float; |
| 882 |
\end_layout |
| 883 |
|
| 884 |
\begin_layout LyX-Code |
| 885 |
L0.fixed := TRUE; |
| 886 |
\end_layout |
| 887 |
|
| 888 |
\begin_layout LyX-Code |
| 889 |
RUN h_left.specify_float; |
| 890 |
\end_layout |
| 891 |
|
| 892 |
\begin_layout LyX-Code |
| 893 |
RUN h_right.specify_float; |
| 894 |
\end_layout |
| 895 |
|
| 896 |
\begin_layout LyX-Code |
| 897 |
END specify_float; |
| 898 |
\end_layout |
| 899 |
|
| 900 |
\begin_layout LyX-Code |
| 901 |
END massless_spring; |
| 902 |
\end_layout |
| 903 |
|
| 904 |
\begin_layout LyX-Code |
| 905 |
|
| 906 |
\end_layout |
| 907 |
|
| 908 |
\begin_layout LyX-Code |
| 909 |
MODEL massless_block( |
| 910 |
\end_layout |
| 911 |
|
| 912 |
\begin_layout LyX-Code |
| 913 |
h_left WILL_BE hook; |
| 914 |
\end_layout |
| 915 |
|
| 916 |
\begin_layout LyX-Code |
| 917 |
h_right WILL_BE hook; |
| 918 |
\end_layout |
| 919 |
|
| 920 |
\begin_layout LyX-Code |
| 921 |
) WHERE ( |
| 922 |
\end_layout |
| 923 |
|
| 924 |
\begin_layout LyX-Code |
| 925 |
h_left, h_right WILL_NOT_BE_THE_SAME; |
| 926 |
\end_layout |
| 927 |
|
| 928 |
\begin_layout LyX-Code |
| 929 |
); |
| 930 |
\end_layout |
| 931 |
|
| 932 |
\begin_layout LyX-Code |
| 933 |
width IS_A distance; |
| 934 |
\end_layout |
| 935 |
|
| 936 |
\begin_layout LyX-Code |
| 937 |
h_left.F_right = h_right.F_left; |
| 938 |
\end_layout |
| 939 |
|
| 940 |
\begin_layout LyX-Code |
| 941 |
h_right.X = h_left.X + width; |
| 942 |
\end_layout |
| 943 |
|
| 944 |
\begin_layout LyX-Code |
| 945 |
X "center of the block" IS_A position; |
| 946 |
\end_layout |
| 947 |
|
| 948 |
\begin_layout LyX-Code |
| 949 |
X = width/2 + h_left.X; |
| 950 |
\end_layout |
| 951 |
|
| 952 |
\begin_layout LyX-Code |
| 953 |
METHODS |
| 954 |
\end_layout |
| 955 |
|
| 956 |
\begin_layout LyX-Code |
| 957 |
METHOD default_self; |
| 958 |
\end_layout |
| 959 |
|
| 960 |
\begin_layout LyX-Code |
| 961 |
width := 3{cm}; |
| 962 |
\end_layout |
| 963 |
|
| 964 |
\begin_layout LyX-Code |
| 965 |
END default_self; |
| 966 |
\end_layout |
| 967 |
|
| 968 |
\begin_layout LyX-Code |
| 969 |
METHOD specify; |
| 970 |
\end_layout |
| 971 |
|
| 972 |
\begin_layout LyX-Code |
| 973 |
width.fixed := TRUE; |
| 974 |
\end_layout |
| 975 |
|
| 976 |
\begin_layout LyX-Code |
| 977 |
RUN h_left.reset; |
| 978 |
\end_layout |
| 979 |
|
| 980 |
\begin_layout LyX-Code |
| 981 |
h_left.F_right.fixed := FALSE; |
| 982 |
\end_layout |
| 983 |
|
| 984 |
\begin_layout LyX-Code |
| 985 |
h_left.X.fixed := TRUE; |
| 986 |
\end_layout |
| 987 |
|
| 988 |
\begin_layout LyX-Code |
| 989 |
RUN h_right.reset; |
| 990 |
\end_layout |
| 991 |
|
| 992 |
\begin_layout LyX-Code |
| 993 |
END specify; |
| 994 |
\end_layout |
| 995 |
|
| 996 |
\begin_layout LyX-Code |
| 997 |
METHOD specify_float; |
| 998 |
\end_layout |
| 999 |
|
| 1000 |
\begin_layout LyX-Code |
| 1001 |
width.fixed := TRUE; |
| 1002 |
\end_layout |
| 1003 |
|
| 1004 |
\begin_layout LyX-Code |
| 1005 |
RUN h_left.specify_float; |
| 1006 |
\end_layout |
| 1007 |
|
| 1008 |
\begin_layout LyX-Code |
| 1009 |
RUN h_right.specify_float; |
| 1010 |
\end_layout |
| 1011 |
|
| 1012 |
\begin_layout LyX-Code |
| 1013 |
END specify_float; |
| 1014 |
\end_layout |
| 1015 |
|
| 1016 |
\begin_layout LyX-Code |
| 1017 |
END massless_block; |
| 1018 |
\end_layout |
| 1019 |
|
| 1020 |
\begin_layout LyX-Code |
| 1021 |
|
| 1022 |
\end_layout |
| 1023 |
|
| 1024 |
\begin_layout LyX-Code |
| 1025 |
MODEL anchor( |
| 1026 |
\end_layout |
| 1027 |
|
| 1028 |
\begin_layout LyX-Code |
| 1029 |
x IS_A position_constant; |
| 1030 |
\end_layout |
| 1031 |
|
| 1032 |
\begin_layout LyX-Code |
| 1033 |
h_right WILL_BE hook; |
| 1034 |
\end_layout |
| 1035 |
|
| 1036 |
\begin_layout LyX-Code |
| 1037 |
); |
| 1038 |
\end_layout |
| 1039 |
|
| 1040 |
\begin_layout LyX-Code |
| 1041 |
h_right.X = x; |
| 1042 |
\end_layout |
| 1043 |
|
| 1044 |
\begin_layout LyX-Code |
| 1045 |
F = h_right.F_left; |
| 1046 |
\end_layout |
| 1047 |
|
| 1048 |
\begin_layout LyX-Code |
| 1049 |
F IS_A force; |
| 1050 |
\end_layout |
| 1051 |
|
| 1052 |
\begin_layout LyX-Code |
| 1053 |
METHODS |
| 1054 |
\end_layout |
| 1055 |
|
| 1056 |
\begin_layout LyX-Code |
| 1057 |
METHOD default_self; |
| 1058 |
\end_layout |
| 1059 |
|
| 1060 |
\begin_layout LyX-Code |
| 1061 |
END default_self; |
| 1062 |
\end_layout |
| 1063 |
|
| 1064 |
\begin_layout LyX-Code |
| 1065 |
METHOD specify; |
| 1066 |
\end_layout |
| 1067 |
|
| 1068 |
\begin_layout LyX-Code |
| 1069 |
RUN h_right.reset; |
| 1070 |
\end_layout |
| 1071 |
|
| 1072 |
\begin_layout LyX-Code |
| 1073 |
END specify; |
| 1074 |
\end_layout |
| 1075 |
|
| 1076 |
\begin_layout LyX-Code |
| 1077 |
METHOD specify_float; |
| 1078 |
\end_layout |
| 1079 |
|
| 1080 |
\begin_layout LyX-Code |
| 1081 |
END specify_float; |
| 1082 |
\end_layout |
| 1083 |
|
| 1084 |
\begin_layout LyX-Code |
| 1085 |
END anchor; |
| 1086 |
\end_layout |
| 1087 |
|
| 1088 |
\begin_layout LyX-Code |
| 1089 |
|
| 1090 |
\end_layout |
| 1091 |
|
| 1092 |
\begin_layout LyX-Code |
| 1093 |
MODEL finger( |
| 1094 |
\end_layout |
| 1095 |
|
| 1096 |
\begin_layout LyX-Code |
| 1097 |
h1 WILL_BE hook; |
| 1098 |
\end_layout |
| 1099 |
|
| 1100 |
\begin_layout LyX-Code |
| 1101 |
); |
| 1102 |
\end_layout |
| 1103 |
|
| 1104 |
\begin_layout LyX-Code |
| 1105 |
pull IS_A force; |
| 1106 |
\end_layout |
| 1107 |
|
| 1108 |
\begin_layout LyX-Code |
| 1109 |
h1.F_right = pull; |
| 1110 |
\end_layout |
| 1111 |
|
| 1112 |
\begin_layout LyX-Code |
| 1113 |
METHODS |
| 1114 |
\end_layout |
| 1115 |
|
| 1116 |
\begin_layout LyX-Code |
| 1117 |
METHOD default_self; |
| 1118 |
\end_layout |
| 1119 |
|
| 1120 |
\begin_layout LyX-Code |
| 1121 |
pull := 3{N}; |
| 1122 |
\end_layout |
| 1123 |
|
| 1124 |
\begin_layout LyX-Code |
| 1125 |
END default_self; |
| 1126 |
\end_layout |
| 1127 |
|
| 1128 |
\begin_layout LyX-Code |
| 1129 |
END finger; |
| 1130 |
\end_layout |
| 1131 |
|
| 1132 |
\begin_layout LyX-Code |
| 1133 |
|
| 1134 |
\end_layout |
| 1135 |
|
| 1136 |
\begin_layout LyX-Code |
| 1137 |
MODEL finger_test; |
| 1138 |
\end_layout |
| 1139 |
|
| 1140 |
\begin_layout LyX-Code |
| 1141 |
NOTES 'ascii-picture' SELF { |
| 1142 |
\end_layout |
| 1143 |
|
| 1144 |
\begin_layout LyX-Code |
| 1145 |
___ __ |
| 1146 |
\end_layout |
| 1147 |
|
| 1148 |
\begin_layout LyX-Code |
| 1149 |
|
| 1150 |
\backslash |
| 1151 |
|
| 1152 |
\backslash |
| 1153 |
--O--/ |
| 1154 |
\backslash |
| 1155 |
/ |
| 1156 |
\backslash |
| 1157 |
/ |
| 1158 |
\backslash |
| 1159 |
/ |
| 1160 |
\backslash |
| 1161 |
/ |
| 1162 |
\backslash |
| 1163 |
/--O--| |--O(_ |
| 1164 |
\backslash |
| 1165 |
|
| 1166 |
\end_layout |
| 1167 |
|
| 1168 |
\begin_layout LyX-Code |
| 1169 |
|___| |
| 1170 |
\backslash |
| 1171 |
|
| 1172 |
\backslash |
| 1173 |
|
| 1174 |
\end_layout |
| 1175 |
|
| 1176 |
\begin_layout LyX-Code |
| 1177 |
(reference)-h1-(s1)-h2-(m1)-h3-(pinky) |
| 1178 |
\end_layout |
| 1179 |
|
| 1180 |
\begin_layout LyX-Code |
| 1181 |
} |
| 1182 |
\end_layout |
| 1183 |
|
| 1184 |
\begin_layout LyX-Code |
| 1185 |
END NOTES; |
| 1186 |
\end_layout |
| 1187 |
|
| 1188 |
\begin_layout LyX-Code |
| 1189 |
h1 IS_A hook; |
| 1190 |
\end_layout |
| 1191 |
|
| 1192 |
\begin_layout LyX-Code |
| 1193 |
s1 IS_A massless_spring(100{kg/s^2},h1,h2); |
| 1194 |
\end_layout |
| 1195 |
|
| 1196 |
\begin_layout LyX-Code |
| 1197 |
h2 IS_A hook; |
| 1198 |
\end_layout |
| 1199 |
|
| 1200 |
\begin_layout LyX-Code |
| 1201 |
m1 IS_A massless_block(h2,h3); |
| 1202 |
\end_layout |
| 1203 |
|
| 1204 |
\begin_layout LyX-Code |
| 1205 |
h3 IS_A hook; |
| 1206 |
\end_layout |
| 1207 |
|
| 1208 |
\begin_layout LyX-Code |
| 1209 |
pinky IS_A finger(h3); |
| 1210 |
\end_layout |
| 1211 |
|
| 1212 |
\begin_layout LyX-Code |
| 1213 |
METHODS |
| 1214 |
\end_layout |
| 1215 |
|
| 1216 |
\begin_layout LyX-Code |
| 1217 |
METHOD default_self; |
| 1218 |
\end_layout |
| 1219 |
|
| 1220 |
\begin_layout LyX-Code |
| 1221 |
RUN h1.default_self; |
| 1222 |
\end_layout |
| 1223 |
|
| 1224 |
\begin_layout LyX-Code |
| 1225 |
RUN h2.default_self; |
| 1226 |
\end_layout |
| 1227 |
|
| 1228 |
\begin_layout LyX-Code |
| 1229 |
RUN h3.default_self; |
| 1230 |
\end_layout |
| 1231 |
|
| 1232 |
\begin_layout LyX-Code |
| 1233 |
RUN m1.default_self; |
| 1234 |
\end_layout |
| 1235 |
|
| 1236 |
\begin_layout LyX-Code |
| 1237 |
RUN pinky.default_self; |
| 1238 |
\end_layout |
| 1239 |
|
| 1240 |
\begin_layout LyX-Code |
| 1241 |
RUN reference.default_self; |
| 1242 |
\end_layout |
| 1243 |
|
| 1244 |
\begin_layout LyX-Code |
| 1245 |
RUN s1.default_self; |
| 1246 |
\end_layout |
| 1247 |
|
| 1248 |
\begin_layout LyX-Code |
| 1249 |
END default_self; |
| 1250 |
\end_layout |
| 1251 |
|
| 1252 |
\begin_layout LyX-Code |
| 1253 |
METHOD specify; |
| 1254 |
\end_layout |
| 1255 |
|
| 1256 |
\begin_layout LyX-Code |
| 1257 |
RUN m1.specify_float; |
| 1258 |
\end_layout |
| 1259 |
|
| 1260 |
\begin_layout LyX-Code |
| 1261 |
RUN pinky.reset; |
| 1262 |
\end_layout |
| 1263 |
|
| 1264 |
\begin_layout LyX-Code |
| 1265 |
RUN reference.specify_float; |
| 1266 |
\end_layout |
| 1267 |
|
| 1268 |
\begin_layout LyX-Code |
| 1269 |
RUN s1.specify_float; |
| 1270 |
\end_layout |
| 1271 |
|
| 1272 |
\begin_layout LyX-Code |
| 1273 |
END specify; |
| 1274 |
\end_layout |
| 1275 |
|
| 1276 |
\begin_layout LyX-Code |
| 1277 |
END finger_test; |
| 1278 |
\end_layout |
| 1279 |
|
| 1280 |
\begin_layout LyX-Code |
| 1281 |
|
| 1282 |
\end_layout |
| 1283 |
|
| 1284 |
\begin_layout LyX-Code |
| 1285 |
MODEL spring_test; |
| 1286 |
\end_layout |
| 1287 |
|
| 1288 |
\begin_layout LyX-Code |
| 1289 |
NOTES 'ascii-picture' SELF { |
| 1290 |
\end_layout |
| 1291 |
|
| 1292 |
\begin_layout LyX-Code |
| 1293 |
|
| 1294 |
\backslash |
| 1295 |
|
| 1296 |
\backslash |
| 1297 |
--O--/ |
| 1298 |
\backslash |
| 1299 |
/ |
| 1300 |
\backslash |
| 1301 |
/ |
| 1302 |
\backslash |
| 1303 |
/ |
| 1304 |
\backslash |
| 1305 |
/ |
| 1306 |
\backslash |
| 1307 |
/--O-- |
| 1308 |
\backslash |
| 1309 |
/ |
| 1310 |
\backslash |
| 1311 |
/ |
| 1312 |
\backslash |
| 1313 |
--O( |
| 1314 |
\backslash |
| 1315 |
|
| 1316 |
\end_layout |
| 1317 |
|
| 1318 |
\begin_layout LyX-Code |
| 1319 |
(reference)-h1-(s1)-h2-(s2)-h3-(pinky) |
| 1320 |
\end_layout |
| 1321 |
|
| 1322 |
\begin_layout LyX-Code |
| 1323 |
} |
| 1324 |
\end_layout |
| 1325 |
|
| 1326 |
\begin_layout LyX-Code |
| 1327 |
END NOTES; |
| 1328 |
\end_layout |
| 1329 |
|
| 1330 |
\begin_layout LyX-Code |
| 1331 |
reference IS_A anchor(0.0{m},h1); |
| 1332 |
\end_layout |
| 1333 |
|
| 1334 |
\begin_layout LyX-Code |
| 1335 |
h1 IS_A hook; |
| 1336 |
\end_layout |
| 1337 |
|
| 1338 |
\begin_layout LyX-Code |
| 1339 |
s1 IS_A massless_spring(100{kg/s^2},h1,h2); |
| 1340 |
\end_layout |
| 1341 |
|
| 1342 |
\begin_layout LyX-Code |
| 1343 |
h2 IS_A hook; |
| 1344 |
\end_layout |
| 1345 |
|
| 1346 |
\begin_layout LyX-Code |
| 1347 |
s2 IS_A massless_spring(75{kg/s^2},h2,h3); |
| 1348 |
\end_layout |
| 1349 |
|
| 1350 |
\begin_layout LyX-Code |
| 1351 |
h3 IS_A hook; |
| 1352 |
\end_layout |
| 1353 |
|
| 1354 |
\begin_layout LyX-Code |
| 1355 |
pinky IS_A finger(h3); |
| 1356 |
\end_layout |
| 1357 |
|
| 1358 |
\begin_layout LyX-Code |
| 1359 |
METHODS |
| 1360 |
\end_layout |
| 1361 |
|
| 1362 |
\begin_layout LyX-Code |
| 1363 |
METHOD default_self; |
| 1364 |
\end_layout |
| 1365 |
|
| 1366 |
\begin_layout LyX-Code |
| 1367 |
RUN h1.default_self; |
| 1368 |
\end_layout |
| 1369 |
|
| 1370 |
\begin_layout LyX-Code |
| 1371 |
RUN h2.default_self; |
| 1372 |
\end_layout |
| 1373 |
|
| 1374 |
\begin_layout LyX-Code |
| 1375 |
RUN h3.default_self; |
| 1376 |
\end_layout |
| 1377 |
|
| 1378 |
\begin_layout LyX-Code |
| 1379 |
RUN s2.default_self; |
| 1380 |
\end_layout |
| 1381 |
|
| 1382 |
\begin_layout LyX-Code |
| 1383 |
RUN pinky.default_self; |
| 1384 |
\end_layout |
| 1385 |
|
| 1386 |
\begin_layout LyX-Code |
| 1387 |
RUN reference.default_self; |
| 1388 |
\end_layout |
| 1389 |
|
| 1390 |
\begin_layout LyX-Code |
| 1391 |
RUN s1.default_self; |
| 1392 |
\end_layout |
| 1393 |
|
| 1394 |
\begin_layout LyX-Code |
| 1395 |
END default_self; |
| 1396 |
\end_layout |
| 1397 |
|
| 1398 |
\begin_layout LyX-Code |
| 1399 |
METHOD specify; |
| 1400 |
\end_layout |
| 1401 |
|
| 1402 |
\begin_layout LyX-Code |
| 1403 |
RUN pinky.reset; |
| 1404 |
\end_layout |
| 1405 |
|
| 1406 |
\begin_layout LyX-Code |
| 1407 |
RUN reference.specify_float; |
| 1408 |
\end_layout |
| 1409 |
|
| 1410 |
\begin_layout LyX-Code |
| 1411 |
RUN s1.specify_float; |
| 1412 |
\end_layout |
| 1413 |
|
| 1414 |
\begin_layout LyX-Code |
| 1415 |
RUN s2.specify_float; |
| 1416 |
\end_layout |
| 1417 |
|
| 1418 |
\begin_layout LyX-Code |
| 1419 |
END specify; |
| 1420 |
\end_layout |
| 1421 |
|
| 1422 |
\begin_layout LyX-Code |
| 1423 |
END spring_test; |
| 1424 |
\end_layout |
| 1425 |
|
| 1426 |
\begin_layout LyX-Code |
| 1427 |
|
| 1428 |
\end_layout |
| 1429 |
|
| 1430 |
\begin_layout LyX-Code |
| 1431 |
REQUIRE "plot.a4l"; |
| 1432 |
\end_layout |
| 1433 |
|
| 1434 |
\begin_layout LyX-Code |
| 1435 |
MODEL plot_spring_test; |
| 1436 |
\end_layout |
| 1437 |
|
| 1438 |
\begin_layout LyX-Code |
| 1439 |
|
| 1440 |
\end_layout |
| 1441 |
|
| 1442 |
\begin_layout LyX-Code |
| 1443 |
(* create our model *) |
| 1444 |
\end_layout |
| 1445 |
|
| 1446 |
\begin_layout LyX-Code |
| 1447 |
st IS_A spring_test; |
| 1448 |
\end_layout |
| 1449 |
|
| 1450 |
\begin_layout LyX-Code |
| 1451 |
|
| 1452 |
\end_layout |
| 1453 |
|
| 1454 |
\begin_layout LyX-Code |
| 1455 |
(* Now gather the sampled data into an array for plotting *) |
| 1456 |
\end_layout |
| 1457 |
|
| 1458 |
\begin_layout LyX-Code |
| 1459 |
x_data[Xset] ALIASES (st.h1.X,st.h2.X,st.h3.X) |
| 1460 |
\end_layout |
| 1461 |
|
| 1462 |
\begin_layout LyX-Code |
| 1463 |
WHERE Xset IS_A set OF integer_constant; |
| 1464 |
\end_layout |
| 1465 |
|
| 1466 |
\begin_layout LyX-Code |
| 1467 |
|
| 1468 |
\end_layout |
| 1469 |
|
| 1470 |
\begin_layout LyX-Code |
| 1471 |
(* Now create the Y coordinates of the plot since there is no |
| 1472 |
\end_layout |
| 1473 |
|
| 1474 |
\begin_layout LyX-Code |
| 1475 |
* natural Y coordinate in our MODEL. |
| 1476 |
\end_layout |
| 1477 |
|
| 1478 |
\begin_layout LyX-Code |
| 1479 |
*) |
| 1480 |
\end_layout |
| 1481 |
|
| 1482 |
\begin_layout LyX-Code |
| 1483 |
y_data[Xset] IS_A real; (* all will be assigned to 1.0 *) |
| 1484 |
\end_layout |
| 1485 |
|
| 1486 |
\begin_layout LyX-Code |
| 1487 |
|
| 1488 |
\end_layout |
| 1489 |
|
| 1490 |
\begin_layout LyX-Code |
| 1491 |
X_curve IS_A plt_curve(Xset,y_data,x_data); |
| 1492 |
\end_layout |
| 1493 |
|
| 1494 |
\begin_layout LyX-Code |
| 1495 |
|
| 1496 |
\end_layout |
| 1497 |
|
| 1498 |
\begin_layout LyX-Code |
| 1499 |
(* Make X_curve into the expected array for plt_plot *) |
| 1500 |
\end_layout |
| 1501 |
|
| 1502 |
\begin_layout LyX-Code |
| 1503 |
curves[curve_set] ALIASES (X_curve) WHERE |
| 1504 |
\end_layout |
| 1505 |
|
| 1506 |
\begin_layout LyX-Code |
| 1507 |
curve_set IS_A set OF integer_constant; |
| 1508 |
\end_layout |
| 1509 |
|
| 1510 |
\begin_layout LyX-Code |
| 1511 |
|
| 1512 |
\end_layout |
| 1513 |
|
| 1514 |
\begin_layout LyX-Code |
| 1515 |
Plot_X IS_A plt_plot_integer(curve_set,curves); |
| 1516 |
\end_layout |
| 1517 |
|
| 1518 |
\begin_layout LyX-Code |
| 1519 |
METHODS |
| 1520 |
\end_layout |
| 1521 |
|
| 1522 |
\begin_layout LyX-Code |
| 1523 |
METHOD default_self; |
| 1524 |
\end_layout |
| 1525 |
|
| 1526 |
\begin_layout LyX-Code |
| 1527 |
RUN st.default_self; |
| 1528 |
\end_layout |
| 1529 |
|
| 1530 |
\begin_layout LyX-Code |
| 1531 |
st.s1.L0 := 0.2{m}; |
| 1532 |
\end_layout |
| 1533 |
|
| 1534 |
\begin_layout LyX-Code |
| 1535 |
RUN X_curve.default_self; |
| 1536 |
\end_layout |
| 1537 |
|
| 1538 |
\begin_layout LyX-Code |
| 1539 |
RUN Plot_X.default_self; |
| 1540 |
\end_layout |
| 1541 |
|
| 1542 |
\begin_layout LyX-Code |
| 1543 |
FOR i IN Xset DO |
| 1544 |
\end_layout |
| 1545 |
|
| 1546 |
\begin_layout LyX-Code |
| 1547 |
y_data[i] := i; |
| 1548 |
\end_layout |
| 1549 |
|
| 1550 |
\begin_layout LyX-Code |
| 1551 |
END FOR; |
| 1552 |
\end_layout |
| 1553 |
|
| 1554 |
\begin_layout LyX-Code |
| 1555 |
X_curve.legend := 'meter'; |
| 1556 |
\end_layout |
| 1557 |
|
| 1558 |
\begin_layout LyX-Code |
| 1559 |
Plot_X.title := 'Hook locations'; |
| 1560 |
\end_layout |
| 1561 |
|
| 1562 |
\begin_layout LyX-Code |
| 1563 |
Plot_X.XLabel := 'location {m}'; |
| 1564 |
\end_layout |
| 1565 |
|
| 1566 |
\begin_layout LyX-Code |
| 1567 |
Plot_X.YLabel := 'hook #'; |
| 1568 |
\end_layout |
| 1569 |
|
| 1570 |
\begin_layout LyX-Code |
| 1571 |
END default_self; |
| 1572 |
\end_layout |
| 1573 |
|
| 1574 |
\begin_layout LyX-Code |
| 1575 |
END plot_spring_test; |
| 1576 |
\end_layout |
| 1577 |
|
| 1578 |
\begin_layout Standard |
| 1579 |
|
| 1580 |
\end_layout |
| 1581 |
|
| 1582 |
\end_body |
| 1583 |
\end_document |