Observers: Difference between revisions

From ASCEND
Jump to navigation Jump to search
Restored page from Google Cache, uploaded by John Pye
 
No edit summary
Line 1: Line 1:
<div class="notice metadata" id="stub">''This article is a '''stub'''. You can help out by <span class="plainlinks">[http://ascendwiki.cheme.cmu.edu/index.php?title=Observers&action=edit expanding it]</span>. ''</div>
{{stub}}
<div class="pageexperimental">''This page documents an '''experimental''' feature. You can help out by '''testing it''' and <span class="plainlinks">[http://ascendwiki.cheme.cmu.edu/index.php?title=Observers&action=edit recording]</span> your experiences.''</div>
{{experimental}}


The Observer tab in PyGTK GUI of ASCEND lets you capture results of 'scenario' simulations. The idea is that you set ASCEND to 'observe' various variables from your model. You do whatever you need to do to solve the model (hopefully that just means you click 'Solve'). Then when you have some numbers that you want to keep, you click 'Keep', or ctrl-K. This adds a new row in your observer table.
The Observer tab in PyGTK GUI of ASCEND lets you capture results of 'scenario' simulations. The idea is that you set ASCEND to 'observe' various variables from your model. You do whatever you need to do to solve the model (hopefully that just means you click 'Solve'). Then when you have some numbers that you want to keep, you click 'Keep', or ctrl-K. This adds a new row in your observer table.


Once you've built up a few rows, you can copy the output to the clipboard (and then directly paste it into a spreadsheet) or you can create a plot.
Once you've built up a few rows, you can copy the output to the clipboard (and then directly paste it into a spreadsheet) or you can create a plot.


== Plotting commands ==
== Plotting commands ==
Line 13: Line 12:
If you want to do anything more, you need to use the Console. Here are some example of what you can do (this was with the {{src|models/johnpye/shm.a4c}} model from the [[Model Library]]. The resulting plots are generated using [http://matplotlib.sourceforge.net/ matplotlib], so you can use matplotlib/pylab commands to add labels, legends, etc to the plots.
If you want to do anything more, you need to use the Console. Here are some example of what you can do (this was with the {{src|models/johnpye/shm.a4c}} model from the [[Model Library]]. The resulting plots are generated using [http://matplotlib.sourceforge.net/ matplotlib], so you can use matplotlib/pylab commands to add labels, legends, etc to the plots.


<source lang="a4c">O=browser.observers[0]
<source lang="py">O=browser.observers[0]
O.plot() # default: plot second col vs first col
O.plot() # default: plot second col vs first col


Line 21: Line 20:
O.plot(y2=2) # default + additionally plot the third col
O.plot(y2=2) # default + additionally plot the third col
import pylab
import pylab
pylab.title(&quot;a title for the graph&quot;)
pylab.title("a title for the graph")
 
pylab.xlabel("a new x-axis label")</source>
pylab.xlabel(&quot;a new x-axis label&quot;)</source>


Note that the <tt>x</tt>, <tt>y</tt>, <tt>y2</tt> arguments are indexed from zero.
Note that the <tt>x</tt>, <tt>y</tt>, <tt>y2</tt> arguments are indexed from zero.


<div class="thumb tnone"><div class="thumbinner" style="width:402px;">[[Image:Observer-plots.png]] <div class="thumbcaption"><div class="magnify">[[File:Observer-plots.png|<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />]]</div></div></div></div>
[[Image:Observer-plots.png|thumb|400px|none|Plots created from the 'observer' tab, using the commands given above]]
 
 


[[Category:Stubs]]
[[Category:Experimental]]
[[Category:Documentation]]
[[Category:Documentation]]

Revision as of 23:33, 2 August 2010

This page documents an experimental feature. Please tell us if you experience any problems.

The Observer tab in PyGTK GUI of ASCEND lets you capture results of 'scenario' simulations. The idea is that you set ASCEND to 'observe' various variables from your model. You do whatever you need to do to solve the model (hopefully that just means you click 'Solve'). Then when you have some numbers that you want to keep, you click 'Keep', or ctrl-K. This adds a new row in your observer table.

Once you've built up a few rows, you can copy the output to the clipboard (and then directly paste it into a spreadsheet) or you can create a plot.

Plotting commands

If you click the 'plot' button, you will get a quick plot of the second column versus the first column.

If you want to do anything more, you need to use the Console. Here are some example of what you can do (this was with the models/johnpye/shm.a4c model from the Model Library. The resulting plots are generated using matplotlib, so you can use matplotlib/pylab commands to add labels, legends, etc to the plots.

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

a4c, abap, abc, abnf, actionscript, ada, agda, alan, algol, ampl, amtrix, applescript, arc, arm, as400cl, ascend, asciidoc, asp, aspect, assembler, ats, autohotkey, autoit, avenue, awk, ballerina, bat, bbcode, bcpl, bibtex, biferno, bison, blitzbasic, bms, bnf, boo, c, carbon, ceylon, charmm, chill, chpl, clean, clearbasic, clipper, clojure, clp, cmake, cobol, coffeescript, coldfusion, conf, cpp2, critic, crk, crystal, cs_block_regex, csharp, css, d, dart, delphi, diff, dockerfile, dts, dylan, ebnf, ebnf2, eiffel, elixir, elm, email, erb, erlang, euphoria, exapunks, excel, express, factor, fame, fasm, felix, fish, fortran77, fortran90, frink, fsharp, fstab, fx, gambas, gdb, gdscript, go, graphviz, haml, hare, haskell, haxe, hcl, html, httpd, hugo, icon, idl, idlang, inc_luatex, informix, ini, innosetup, interlis, io, jam, jasmin, java, javascript, js_regex, json, jsp, jsx, julia, kotlin, ldif, less, lhs, lilypond, limbo, lindenscript, lisp, logtalk, lotos, lotus, lua, luban, makefile, maple, markdown, matlab, maya, mercury, meson, miranda, mod2, mod3, modelica, moon, ms, msl, mssql, mxml, n3, nasal, nbc, nemerle, netrexx, nginx, nice, nim, nix, nsis, nxc, oberon, objc, ocaml, octave, oorexx, org, os, oz, paradox, pas, pdf, perl, php, pike, pl1, plperl, plpython, pltcl, po, polygen, pony, pov, powershell, pro, progress, ps, psl, pure, purebasic, purescript, pyrex, python, q, qmake, qml, qu, r, rebol, rego, rexx, rnc, rpg, rpl, rst, ruby, rust, s, sam, sas, scad, scala, scilab, scss, shellscript, slim, small, smalltalk, sml, snmp, snobol, solidity, spec, spn, sql, squirrel, styl, svg, swift, sybase, tcl, tcsh, terraform, tex, toml, tsql, tsx, ttcn3, txt, typescript, upc, vala, vb, verilog, vhd, vimscript, vue, wat, whiley, wren, xml, xpp, yaiff, yaml, yaml_ansible, yang, zig, znn

Note that the x, y, y2 arguments are indexed from zero.

Error creating thumbnail: File missing
Plots created from the 'observer' tab, using the commands given above