<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ascend4.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=UploadBot</id>
	<title>ASCEND - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://ascend4.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=UploadBot"/>
	<link rel="alternate" type="text/html" href="https://ascend4.org/Special:Contributions/UploadBot"/>
	<updated>2026-04-28T23:02:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://ascend4.org/index.php?title=Binary_installer_for_Boost_on_MinGW&amp;diff=195</id>
		<title>Binary installer for Boost on MinGW</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Binary_installer_for_Boost_on_MinGW&amp;diff=195"/>
		<updated>2010-05-13T14:06:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is an installer for [http://www.boost.org/ Boost] version 1.34.1 on MinGW using NSIS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-top:8px;padding-bottom:12px&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;border:solid 2pt gray;background-color:#ffff88;margin-top:0px;margin-bottom:5px;padding:3px;width:35em&amp;quot;&amp;gt;&lt;br /&gt;
* &amp;lt;a href=&amp;quot;/images/6/60/Boost-1.41.0-mingw.exe&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Boost-1.41.0-mingw.exe&amp;quot;&amp;gt;boost-1.41.0-mingw.exe&amp;lt;/a&amp;gt; (binary installer, static libraries, 5.0 MB)&lt;br /&gt;
* &amp;lt;a href=&amp;quot;/images/0/0a/Boost-1.34.1-mingw.exe&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Boost-1.34.1-mingw.exe&amp;quot;&amp;gt;boost-1.34.1-mingw.exe&amp;lt;/a&amp;gt; (binary installer, shared libraries, 3.4 MB)&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I have been able to build a couple of different projects against these Boost libraries, specifically ones that use the Boost Serialization components, but I couldn&#039;t consider it to have been extensively tested. Please [[User:Jpye|let me know]] if you have any problems.&lt;br /&gt;
&lt;br /&gt;
[[Image:boost-installer.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Instructions for building Boost-1.41.0 on MinGW ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This page is currently being updated below...&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* make sure you have ~3G of spare space on your machine before starting this process -- building Boost takes &#039;&#039;&#039;lots&#039;&#039;&#039; of space.&lt;br /&gt;
* download the 3.1.17-ntx86 version of bjam from [http://sourceforge.net/projects/boost/files/boost-jam/3.1.17 here]&lt;br /&gt;
* unpack that zip file and, using MSYS, &amp;lt;tt&amp;gt;cp bjam.exe /mingw/bin&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* download and unpack the .tar.bz2 version of the 1.41.0 release of boost from [http://sourceforge.net/projects/boost/files/boost/1.41.0 here]&lt;br /&gt;
* enter the boost_1_41_0 directory via MSYS&lt;br /&gt;
* &amp;lt;tt&amp;gt;bjam --build-dir=boost-build --toolset=gcc --build-type=complete stage release&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Go and make yourself several cups of tea&lt;br /&gt;
* &amp;lt;tt&amp;gt;bjam --build-dir=boost-build --toolset=gcc install&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create the binary package, unpack &amp;lt;a href=&amp;quot;/images/5/50/Boost-mingw-scripts.tar.bz2&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Boost-mingw-scripts.tar.bz2&amp;quot;&amp;gt;boost-mingw-scripts.tar.bz2&amp;lt;/a&amp;gt;, enter the boost-mingw-scripts directory, and run &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt;. You will need to have SCons, Python and NSIS installed on your system. You may need to make some minor changes at the top of the SConstruct file first. Packaging takes a few minutes, owing to the ~5000 header files present in Boost.&lt;br /&gt;
&lt;br /&gt;
The resulting binary installation of Boost will contain only the static libraries for Boost, enabling you to easily distribute any binaries that you link against it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; this page has been protected from non-admin edits, to prevent other people uploading files. You can make comments via the &#039;discussion&#039; page if you wish, though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Miscellany]]&lt;br /&gt;
[[Category:MinGW]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Faxing_via_Google_Voice&amp;diff=194</id>
		<title>Faxing via Google Voice</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Faxing_via_Google_Voice&amp;diff=194"/>
		<updated>2010-05-13T14:06:04Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== My goal ==&lt;br /&gt;
&lt;br /&gt;
My goal was to configure Google Voice and my fax machine (an HP C6150 All In One (printer, fax, scanner, copier)) so I could fax via Google Voice.  If that would work, then I could fax at very low cost virtually anywhere in the world.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What is Google Voice ==&lt;br /&gt;
&lt;br /&gt;
I just signed up for Google Voice (one has to be invited, but one can sign up to be invited, which I did some time ago and got invited a few days ago).  With this service, Google gives someone in the USA a single phone number that, when called, will ring any or all of the phones that person owns.  One can choose to answer a call, send it directly to voice mail, listen in to the voice mail and possible accept it then, or answer and record it.  There are many other very interesting and useful features you can find by going to the [http://www.google.com/googlevoice/about.html * Google Voice homepage].  One can also place calls from any of these phones by calling the Google Voice number.  Google then calls one back.  After answering, dialing 2 allows one to dial another phone anywhere in the world.  For calls originating in the US, one can call many places around the world for about the same costs as using SKYPE.  DO NOT USE THIS CAPABILITY OUTSIDE THE USA, HOWEVER.  The callback from Google to you incurs roaming charges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The needed insights ==&lt;br /&gt;
&lt;br /&gt;
Here are the two bits of information that one needs to make this happen.  &lt;br /&gt;
&lt;br /&gt;
(1) The C6150 allows one to enter a telephone number containing one second long dialing delays.  One has to search to find how, but including a dash (-) inserts a one second delay in dialing.  The dash is hidden under the asterisk (*) button, which one reaches by pressing * twice.  &lt;br /&gt;
&lt;br /&gt;
(2) One can set up a phone under Settings on one&#039;s &amp;lt;a href=&amp;quot;https://www.google.com/voice/&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://www.google.com/voice/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;* Google Voice account&amp;lt;/a&amp;gt; to go directly to voicemail without one having to answer the return call from Google Voice.  That is the default setting for mobile phones but not for a home phone (and, of course, my fax is tied through my home phone).  And further, one is given the option when going into voicemail to dial a phone number by entering a 2 and then the number.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to make it work ==&lt;br /&gt;
&lt;br /&gt;
So here is the way to make it all work ---&lt;br /&gt;
&lt;br /&gt;
1. Go to your Google Voice account, select Settings, Phones and then the Edit option for the phone on which you have your fax machine residing.  Open the &amp;quot;Show Advanced Settings.&amp;quot;  &lt;br /&gt;
Then select &amp;quot;Yes&amp;quot; and &amp;quot;PIN not required (for added convenience)&amp;quot; for the &amp;quot;Direct access to voicemail when calling your Google number from this phone?&amp;quot;  You could of course have the PIN required, but then you need to add that to the phone number you construct below.  I figured my home phone is safe from someone misusing it.&lt;br /&gt;
&lt;br /&gt;
2. Send your fax but construct the fax recipient&#039;s number as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; YourGoogleVoiceNumber--2--NumberOfFaxReceivingMachine (those are dashes in this number to insert 2 two second pauses).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if your Google Voice number is 515-555-5565 and the fax machine is at +44-55-56-57-58-59, then set up the number to be &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;15155555565--2--011445556575859&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note this would send a fax overseas and that the 011 replaces the plus sign (I think using a plus sign would also work but did not try it).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Miscellany]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Porting_to_Mac/gtk-mac-bundler&amp;diff=193</id>
		<title>Porting to Mac/gtk-mac-bundler</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Porting_to_Mac/gtk-mac-bundler&amp;diff=193"/>
		<updated>2010-05-13T14:05:55Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Porting_to_Mac|&amp;amp;larr;&amp;amp;nbsp;Porting to Mac]]&lt;br /&gt;
&lt;br /&gt;
This page contains some notes on how [http://sourceforge.net/apps/trac/gtk-osx/wiki/Bundle ige-mac-bundler] (and maybe other tools) do the job of making portable, self-contained GTK+ applications work on Mac. The notes were prepared during the course of porting [[ASCEND_overview|ASCEND]] to Mac. Please feel free to set me straight on any wrong observations, missing information, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following observations come from bundling up GtkDemo using ige-mac-bundler.&lt;br /&gt;
&lt;br /&gt;
== GTK libraries ==&lt;br /&gt;
GTK libraries are copied into the Contents/Resources/lib directory in the application bundle. Their &#039;install names&#039; are changed so that they look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ otool -L libgtk-quartz-2.0.0.dylib &lt;br /&gt;
libgtk-quartz-2.0.0.dylib:&lt;br /&gt;
	/Users/john/gtk/inst/lib/libgtk-quartz-2.0.0.dylib (compatibility version 1801.0.0, current version 1801.2.0)&lt;br /&gt;
	@executable_path/../Resources/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 1801.0.0, current version 1801.2.0)&lt;br /&gt;
	@executable_path/../Resources/lib/libgdk-quartz-2.0.0.dylib (compatibility version 1801.0.0, current version 1801.2.0)&lt;br /&gt;
	@executable_path/../Resources/lib/libpangocairo-1.0.0.dylib (compatibility version 2401.0.0, current version 2401.5.0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the GtkDemo app, the following libraries are copied:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ls&lt;br /&gt;
charset.alias			libfreetype.6.dylib		libgobject-2.0.0.dylib		libpangoft2-1.0.0.dylib&lt;br /&gt;
gtk-2.0				libgdk-quartz-2.0.0.dylib	libgtk-quartz-2.0.0.dylib	libpixman-1.0.dylib&lt;br /&gt;
libatk-1.0.0.dylib		libgdk_pixbuf-2.0.0.dylib	libintl.8.dylib			libpng12.0.dylib&lt;br /&gt;
libcairo.2.dylib		libgio-2.0.0.dylib		libjpeg.7.dylib			libtiff.3.dylib&lt;br /&gt;
libexpat.1.dylib		libglib-2.0.0.dylib		libpango-1.0.0.dylib&lt;br /&gt;
libfontconfig.1.dylib		libgmodule-2.0.0.dylib		libpangocairo-1.0.0.dylib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pixbuf loaders ==&lt;br /&gt;
&lt;br /&gt;
The environment variable GDK_PIXBUF_MODULE_FILE is used to specify the path to a file usually named &amp;lt;tt&amp;gt;gdk-pixbuf.loaders&amp;lt;/tt&amp;gt;. This file contains a list of shared libraries that perform the task of loading various kinds of images into GTK+.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;tt&amp;gt;gdk-pixbuf.loaders&amp;lt;/tt&amp;gt; file can be automatically generated by the script &amp;lt;tt&amp;gt;~/gtk/inst/bin/gdk-pixbuf-query-loaders&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This contents of &amp;lt;tt&amp;gt;gdk-pixbuf.loaders&amp;lt;/tt&amp;gt; are automatically edited by &amp;lt;tt&amp;gt;ige-mac-bundler&amp;lt;/tt&amp;gt; to replace the absolute file paths with paths like &amp;lt;tt&amp;gt;@executable_path/../Resources/lib/gtk-2.0/loaders/libpixbufloader-png.so&amp;lt;/tt&amp;gt;, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The pixbuf loaders are copied into the locally-consistent location &amp;lt;tt&amp;gt;Contents/Resources/lib/gtk-2.0/2.xx.xx/loaders&amp;lt;/tt&amp;gt;, where xx.xx is the particular GTK+ version being used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Icons and themes ==&lt;br /&gt;
&lt;br /&gt;
Icons and themes are copied into &amp;lt;tt&amp;gt;Contents/Resources/share&amp;lt;/tt&amp;gt;. I got the following files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ls -R&lt;br /&gt;
icons	themes&lt;br /&gt;
&lt;br /&gt;
./icons:&lt;br /&gt;
hicolor&lt;br /&gt;
&lt;br /&gt;
./icons/hicolor:&lt;br /&gt;
index.theme&lt;br /&gt;
&lt;br /&gt;
./themes:&lt;br /&gt;
Default	Emacs	Raleigh&lt;br /&gt;
&lt;br /&gt;
./themes/Default:&lt;br /&gt;
gtk-2.0-key&lt;br /&gt;
&lt;br /&gt;
./themes/Default/gtk-2.0-key:&lt;br /&gt;
gtkrc&lt;br /&gt;
&lt;br /&gt;
./themes/Emacs:&lt;br /&gt;
gtk-2.0-key&lt;br /&gt;
&lt;br /&gt;
./themes/Emacs/gtk-2.0-key:&lt;br /&gt;
gtkrc&lt;br /&gt;
&lt;br /&gt;
./themes/Raleigh:&lt;br /&gt;
gtk-2.0&lt;br /&gt;
&lt;br /&gt;
./themes/Raleigh/gtk-2.0:&lt;br /&gt;
gtkrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Didn&#039;t see any sign of actual image or icon files anywhere... perhaps the default ones are embedded in the shared library somehow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pango configuration files ==&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;tt&amp;gt;Contents/Resources/etc/pango/pangorc&amp;lt;/tt&amp;gt; the following text was found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat pangorc&lt;br /&gt;
[Pango]&lt;br /&gt;
ModuleFiles=./pango.modules&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;pango.modules&amp;lt;/tt&amp;gt; is present in the same directory, but is empty.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GTK configuration files ==&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;tt&amp;gt;Contents/Resources/etc/gtk-2.0/gtkrc&amp;lt;/tt&amp;gt; the following text was found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat gtkrc&lt;br /&gt;
gtk-icon-theme-name = &amp;amp;quot;Tango&amp;amp;quot;&lt;br /&gt;
gtk-enable-mnemonics = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In same directory, there is another empty file called &amp;lt;tt&amp;gt;gtk.immodules&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use of install_name_tool ==&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;tt&amp;gt;ige-mac-bundler&amp;lt;/tt&amp;gt;, all DYLD paths have been set relative to the @executable_path. The executable is kept inside the bundle as &amp;lt;tt&amp;gt;Contents/MacOS/GtkDemo-bin&amp;lt;/tt&amp;gt;. This means, for example, that &amp;lt;tt&amp;gt;@executable_path/../Resources/lib&amp;lt;/tt&amp;gt; takes the loader to folder containing all the GTK shared libraries.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: for the case of PyGTK bundles, assuming Apple Python or MacPython are being used but not being included in the bundle, we can&#039;t pull this trick, because the @executable_path would then be outside the application bundle, and no help for locating GTK libraries. An alternative approach might be possible using @rpath set on the PyGTK shared libraries, and this needs to be tried out.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Environment variables ==&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;tt&amp;gt;Contents/MacOS/GtkDemo&amp;lt;/tt&amp;gt; is the entry-point for the application (as directed by &amp;lt;tt&amp;gt;Info.plist&amp;lt;/tt&amp;gt;) and is a shell-script that sets various required environment variables so that GTK can find all its stuff:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: in the following, the &amp;quot;`pwd`/$0&amp;quot; causes problems if you invoke the &amp;lt;tt&amp;gt;ige-mac-bundler&amp;lt;/tt&amp;gt;-bundled from the command line from any directory other than &amp;lt;tt&amp;gt;Contents/MacOS&amp;lt;/tt&amp;gt;. I think that this is a bug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;name=&amp;amp;quot;`basename $0`&amp;amp;quot;&lt;br /&gt;
tmp=&amp;amp;quot;`pwd`/$0&amp;amp;quot;&lt;br /&gt;
&lt;br /&gt;
tmp=`dirname &amp;amp;quot;$tmp&amp;amp;quot;`&lt;br /&gt;
tmp=`dirname &amp;amp;quot;$tmp&amp;amp;quot;`&lt;br /&gt;
bundle=`dirname &amp;amp;quot;$tmp&amp;amp;quot;`&lt;br /&gt;
&lt;br /&gt;
bundle_contents=&amp;amp;quot;$bundle&amp;amp;quot;/Contents&lt;br /&gt;
bundle_res=&amp;amp;quot;$bundle_contents&amp;amp;quot;/Resources&lt;br /&gt;
bundle_lib=&amp;amp;quot;$bundle_res&amp;amp;quot;/lib&lt;br /&gt;
bundle_bin=&amp;amp;quot;$bundle_res&amp;amp;quot;/bin&lt;br /&gt;
bundle_data=&amp;amp;quot;$bundle_res&amp;amp;quot;/share&lt;br /&gt;
bundle_etc=&amp;amp;quot;$bundle_res&amp;amp;quot;/etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
export DYLD_LIBRARY_PATH=&amp;amp;quot;$bundle_lib&amp;amp;quot;&lt;br /&gt;
export XDG_CONFIG_DIRS=&amp;amp;quot;$bundle_etc&amp;amp;quot;/xdg&lt;br /&gt;
export XDG_DATA_DIRS=&amp;amp;quot;$bundle_data&amp;amp;quot;&lt;br /&gt;
&lt;br /&gt;
export GTK_DATA_PREFIX=&amp;amp;quot;$bundle_res&amp;amp;quot;&lt;br /&gt;
export GTK_EXE_PREFIX=&amp;amp;quot;$bundle_res&amp;amp;quot;&lt;br /&gt;
export GTK_PATH=&amp;amp;quot;$bundle_res&amp;amp;quot;&lt;br /&gt;
&lt;br /&gt;
export GTK2_RC_FILES=&amp;amp;quot;$bundle_etc/gtk-2.0/gtkrc&amp;amp;quot;&lt;br /&gt;
export GTK_IM_MODULE_FILE=&amp;amp;quot;$bundle_etc/gtk-2.0/gtk.immodules&amp;amp;quot;&lt;br /&gt;
export GDK_PIXBUF_MODULE_FILE=&amp;amp;quot;$bundle_etc/gtk-2.0/gdk-pixbuf.loaders&amp;amp;quot;&lt;br /&gt;
&lt;br /&gt;
export PANGO_RC_FILE=&amp;amp;quot;$bundle_etc/pango/pangorc&amp;amp;quot;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the above, there is some locale-related stuff (see [http://github.com/jralls/ige-mac-bundler/blob/master/bundler/launcher.sh launcher.sh] for the details.&lt;br /&gt;
&lt;br /&gt;
Next the script does something with charset alias (&#039;&#039;&#039;FIXME&#039;&#039;&#039; what&#039;s this doing?):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if test -f &amp;amp;quot;$bundle_lib/charset.alias&amp;amp;quot;; then&lt;br /&gt;
export CHARSETALIASDIR=&amp;amp;quot;$bundle_lib&amp;amp;quot;&lt;br /&gt;
&lt;br /&gt;
fi&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, a variable EXTRA_ARGS is initialised empty and an optional &amp;lt;tt&amp;gt;environment.sh&amp;lt;/tt&amp;gt; is run, allowing command-line arguments to be appended to EXTRA_ARGS, or just to set additional application-specific or user-specific environment variables.&lt;br /&gt;
&lt;br /&gt;
Then, the script throws out some Mac-related command-line parameters that are useless to GTK:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;# Strip out the argument added by the OS.&lt;br /&gt;
if [ x`echo &amp;amp;quot;x$1&amp;amp;quot; | sed -e &amp;amp;quot;s/^x-psn_.*//&amp;amp;quot;` == x ]; then&lt;br /&gt;
&lt;br /&gt;
shift 1&lt;br /&gt;
fi&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the script launches the executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;$EXEC &amp;amp;quot;$bundle_contents/MacOS/$name-bin&amp;amp;quot; $* $EXTRA_ARGS&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=PyGTK_Screenshots&amp;diff=192</id>
		<title>PyGTK Screenshots</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=PyGTK_Screenshots&amp;diff=192"/>
		<updated>2010-05-13T14:05:45Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are two user interfaces for ASCEND. The older, more mature user interface (and the only one offered in the &#039;stable&#039; 2000 release) is the [[TcltkScreenshots|Tcl/Tk GUI]], for which [[TcltkScreenshots|screenshots]] are not shown here. This page shows the newer Python/PyGTK GUI that has been under development more recently by [[User:Jpye|John Pye]] For instructions on getting it running, see the [[PythonWrapper]] page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Browser ==&lt;br /&gt;
&lt;br /&gt;
This is the main instance browser in the PyGTK ASCEND GUI. Fixed &amp;lt;tt&amp;gt;solver_var&amp;lt;/tt&amp;gt;s are shown in green, free ones are shown in blue, all other instances/variables are shown in black. Values of all of these can be edited directly in-place. Errors and messages are shown in the lower pane, methods can be run from the combobox at the top.&lt;br /&gt;
&lt;br /&gt;
[[Image:ascend-browser.png]]&lt;br /&gt;
&lt;br /&gt;
The ASCEND GUI is different from the [[TcltkScreenshots|Tcl/Tk GUI]] in that it concentrates the user interface into a single window as far as possible, to make ASCEND more &#039;approachable&#039; for new users. Solver selection and parameter control is the via menus. The &#039;Library&#039; concept is mostly bypassed, as models loaded from the shell (for example by typing &amp;lt;tt&amp;gt;ascend mymodel.a4c&amp;lt;/tt&amp;gt;) are immediately opened, and, if they contain a &#039;self-titled&#039; &amp;lt;tt&amp;gt;MODEL&amp;lt;/tt&amp;gt; declaration (eg &amp;lt;tt&amp;gt;MODEL mymodel REFINES mybasetype&amp;lt;/tt&amp;gt;), then that model is instantiated and its &amp;lt;tt&amp;gt;on_load&amp;lt;/tt&amp;gt; method is run. The &#039;Modules&#039; allows types to be selected from any of the loaded modules, but often now it is not needed. It is also automatically emptied when the user requests to instantiate load a new module; there is no way of having multiple models at a time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: the above is running on Linux (Fedora Core 4) but being viewed on Windows 2000 via [http://wiki.freedesktop.org/wiki/Xming Xming].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Plotting with PyGTK GUI ==&lt;br /&gt;
&lt;br /&gt;
To plot from the PyGTK GUI, you must set up your model according to Chapter 4 of the &amp;lt;a href=&amp;quot;/images/6/61/Book.pdf&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Book.pdf&amp;quot;&amp;gt;User&#039;s Manual (1 MB .pdf)&amp;lt;/a&amp;gt;. Then, you can right-click on an instance of &amp;lt;tt&amp;gt;plt_plot_integer&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;plt_plot_symbol&amp;lt;/tt&amp;gt; and click &#039;Plot&#039; and your plot should appear in a new window. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:plot-right-click.png]]&lt;br /&gt;
&lt;br /&gt;
Plotting under PyGTK is done with the [http://matplotlib.sourceforge.net/ matplotlib] library, which gives the additional benefit of allowing plots to be easily exported in a variety of formats including SVG and EPS, PNG and JPEG, etc.&lt;br /&gt;
&lt;br /&gt;
You can also produce thiese plots programmatically using the [[PythonWrapper]] as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;instance.getPlot().show()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the functionality that extracts the plot data from the ASCEND instance hierarchy in provided through the SWIG interface, allowing other scripting languages to access the raw plot data.&lt;br /&gt;
&lt;br /&gt;
Here is a screenshot of a the &#039;plotbvp&#039; demo from the ASCEND standard models:&lt;br /&gt;
&lt;br /&gt;
[[Image:ascend-pygtk-plot.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Editing solver parameters ==&lt;br /&gt;
&lt;br /&gt;
Recently we&#039;ve added support for editing solver parameters through the PyGTK GUI. Any parameter that you&#039;ve changed shows in yellow until you click &#039;apply&#039;. Note that your parameters aren&#039;t saved: if you reload your model they will be reset to their default values. Unfortunately.&lt;br /&gt;
&lt;br /&gt;
[[Image:solver-params-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Viewing an incidence matrix ==&lt;br /&gt;
&lt;br /&gt;
This is a simple overall view of the sparsity matrix for a system, either before or after you&#039;ve solved it. It permits zooming and exporting of the image to various output formats, which should be useful in some case. Mouse-ing over the matrix will show you the variable and relation you&#039;re looking at, via the text in the bottom-right of the window (see also the &#039;Diagnose&#039; feature below). Fixed variables are shown in green, solved free variables are shown in black. We haven&#039;t checked out how this stuff works for conditional modelling cases just yet.&lt;br /&gt;
&lt;br /&gt;
[[Image:ascend-sparsity.png]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:302px;&amp;quot;&amp;gt;[[Image:Sparsity-4bar.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Sparsity-4bar.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;A smaller incidence matrix showing mouse-over variable info in bottom right&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Observers ==&lt;br /&gt;
&lt;br /&gt;
Here is a screenshot of the [[Observers|observer]] functionality, which is roughly equivalent to the &#039;PROBE&#039; in the [[TcltkScreenshots|Tcl/Tk GUI]]. In the &#039;simulation&#039; window you can set which solver variables you want to observe (right click, select &#039;Observe&#039;) and they will appear in your Observer tab.&lt;br /&gt;
&lt;br /&gt;
[[Image:ascend-observer2.png]]&lt;br /&gt;
&lt;br /&gt;
Each time you have solved a scenario that you want to keep, press ctrl-K to &#039;&#039;&#039;keep&#039;&#039;&#039; the current observed values in the observer data window. &lt;br /&gt;
&lt;br /&gt;
Note that the bold row in the table is &#039;live&#039;; its values will &#039;&#039;follow&#039;&#039; your current simulation, and it is &#039;&#039;&#039;is editable&#039;&#039;&#039;. Edit any bold entry in the table, and so long as it corresponds to a FIXED variable, the results will show up immediately in the other columns (assuming you have set &#039;Auto&#039; on).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When you have run all the scenarios you want, hit &#039;ctrl-C&#039; and you can copy your scenario data to another application. You can see here that the results paste into OpenOffice spreadsheets in an immediately useful form:&lt;br /&gt;
&lt;br /&gt;
[[Image:ascend-paste.png]]&lt;br /&gt;
&lt;br /&gt;
The Observer tab is also used, in slighly adapted form, as the method in which integration results (time series) are viewed.&lt;br /&gt;
&lt;br /&gt;
You can also plot from the [[Observers|observer tab]]. Just click the &#039;plot&#039; button and the second column will be plotted against the first column.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Observer-plots.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Observer-plots.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Manipulating variable properties ==&lt;br /&gt;
&lt;br /&gt;
You can set upper and lower bounds and scaling values for variables via the Properties command. Effort has been made to ensure it can be very easily navigated using the keyboard: F4 opens the variable properties windows, Tab between fields, Enter to confirm, Escape to cancel. If you omit to enter any units, the &#039;preferred&#039; units will be assumed. If you enter a value in incompatible units, the edit box will show red and you will have to correct it or else click &#039;cancel&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Image:variable-properties.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Viewing Relations and residuals ==&lt;br /&gt;
&lt;br /&gt;
The same &#039;F4&#039; shortcut can be used to review the definitions of relation instances:&lt;br /&gt;
&lt;br /&gt;
[[Image:relation-properties.png]]&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: the above is running on FC4 but being viewed on Windows 2000 via [http://wiki.freedesktop.org/wiki/Xming Xming].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &#039;Block Diagnose&#039; feature ==&lt;br /&gt;
&lt;br /&gt;
This is a new idea for examining the non-converging block or blocks in your model. After you have attempted to solve your model, this screen can be used to look at the structure of the block which is causing trouble, and directly examine the equations and variables that are involved. Below is a preview of this feature:&lt;br /&gt;
&lt;br /&gt;
[[Image:block-diagnose-4.png]]&lt;br /&gt;
&lt;br /&gt;
In the above, it is intended that &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* values at or near their bounds should be red&lt;br /&gt;
* large-valued variables should be coloured in bright pink,&lt;br /&gt;
* largish values in orange&lt;br /&gt;
* values near nominal in green&lt;br /&gt;
* smallish values in pale blue&lt;br /&gt;
* very small values in bright blue&lt;br /&gt;
&lt;br /&gt;
Probably we&#039;ll find that different colouring schemes are suitable for different occasions. For example, finding equations with large residuals would use colouring by residual magnitude. Perhaps colouring by magnitude of elements in the jacobian would be useful as well. Would appreciate comments on this.&lt;br /&gt;
&lt;br /&gt;
We plan to add a &#039;&#039;&#039;graph&#039;&#039;&#039; view to this window as well, which would show the actual connection between variables and relations, so that the evaluation &#039;loops&#039; would be more clearly identifiable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solver status popup ==&lt;br /&gt;
&lt;br /&gt;
You can follow the solver&#039;s progress using the &#039;Solver Status&#039; popup, It reports the number of variables that have been solved, the size of the current block, the current RMS residuals, elapsed time, total iterations and iterations in the current block.&lt;br /&gt;
&lt;br /&gt;
[[Image:solverstatus.png]]&lt;br /&gt;
&lt;br /&gt;
The popup can also be used to interrupt the solver. It can be set to close automatically once the solver has completed (via the Tools menu). We plan to add similar functionality to the &#039;Diagnose&#039; window so that step-by-step solving can be performed from there as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running under Windows ==&lt;br /&gt;
&lt;br /&gt;
The PyGTK GUI for ASCEND runs under Windows as well. This version was compiled using MinGW and run using Python 2.5 for Windows plus the Windows port of GTK+, and a couple of other python-related libraries.&lt;br /&gt;
&lt;br /&gt;
[[Image:windows-ascend.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Editing with TextPad on Windows ==&lt;br /&gt;
&lt;br /&gt;
[http://www.textpad.com/ TextPad] is a popular text editor for Windows. You can use our {{src|tools/textpad/ascend.syn}} file to give you syntax-highlighting of code when using that editor.&lt;br /&gt;
&lt;br /&gt;
[[Image:textpad-ascend.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Integrator (dynamic simulation) ==&lt;br /&gt;
&lt;br /&gt;
Here is the new Integrator window in the PyGTK GUI. It supports the LSODE and IDA integrators, although the latter is still being developed. Support for setting the solution tolerance needs to be added, as well as possibly alternative methods for specifying the integration timesteps. Timesteps aren&#039;t currently &#039;units aware&#039;, either.&lt;br /&gt;
&lt;br /&gt;
[[Image:integrator-gui.png]]&lt;br /&gt;
&lt;br /&gt;
Here is the progress dialog:&lt;br /&gt;
&lt;br /&gt;
[[Image:integrator-progress.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Launching ASCEND from Gedit ==&lt;br /&gt;
&lt;br /&gt;
We provide syntax highlighting to for the &#039;&#039;gedit&#039;&#039; edit on GNOME (Ubuntu, Fedora, etc). Note also the [[PyGTK GUI command-line parameters]], which can be of use when integrating with gedit. In current versions of Fedora and Ubuntu, the {{srcdir|tools/gtksourceview-2.0/}} of our gedit syntax highlighting must be used. Otherwise, use the {{srcdir|tools/gedit/}}.&lt;br /&gt;
&lt;br /&gt;
[[Image:ascend-from-gedit.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Plotting from external Python methods ==&lt;br /&gt;
&lt;br /&gt;
The [[ExtPy]] module allows general scripts to be run from inside ASCEND &amp;lt;tt&amp;gt;METHODS&amp;lt;/tt&amp;gt;. Using the [[PythonWrapper]] you can then do anything you like with the ASCEND engine, such as running a model with a range of parameters and plotting the output, as with this simple four-bar linkage example (See [http://ascendserver.cheme.cmu.edu/svn/ascend/code/trunk/models/johnpye/fourbar.a4c fourbar.a4c] and [http://ascendserver.cheme.cmu.edu/svn/ascend/code/trunk/models/johnpye/fourbarplot.py fourbarplot.py]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Fourbar.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Fourbar.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;A four-bar linkage. The angle of the left member was swept through a range of values and the position of the mechanism plotted for each.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another example is using a [[ExtPy]] script to perform a plot of the roots of a dynamic system&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Rootsplot.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Rootsplot.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Roots of a system of differential-algebraic equations&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== IPython console ==&lt;br /&gt;
&lt;br /&gt;
See [[Python console support]] for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Ipython-embed.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Ipython-embed.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;A short IPython console session within the PyGTK GUI&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units of measurement ==&lt;br /&gt;
&lt;br /&gt;
You can set the preferred [[Units of measurement]] for a variable using a popup window:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Preferred-units.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Preferred-units.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Setting preferred units for &#039;volume&#039;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Incidence graph ==&lt;br /&gt;
&lt;br /&gt;
One you have &#039;built&#039; a system, you can use ASCEND to view an incidence graph that shows the sequence of calculation in a convenient form. This functionality is not currently available on Windows, only Linux at the moment. See [[Incidence Graph]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Incidence-graph-reynolds.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Incidence-graph-reynolds.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;An incidence matrix for calculation of mass flow rate at specified Reynolds number&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Integrator_API&amp;diff=191</id>
		<title>Integrator API</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Integrator_API&amp;diff=191"/>
		<updated>2010-05-13T14:05:36Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Integrator API is the interface through which DAE and ODE solvers for [[dynamic modelling]] must communicate with ASCEND.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Process flow ==&lt;br /&gt;
&lt;br /&gt;
This section describes the process by which an Integrator is instantiated and used in ASCEND, including some detail about the associate GUI actions, outputs, and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Registration ===&lt;br /&gt;
&lt;br /&gt;
An integrator is built as an [[External_libraries|&#039;&#039;&#039;external&#039;&#039;&#039; library]] that can be either loaded automatically by ASCEND, or manually using an [[IMPORT]] statement in the user&#039;s model code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These &#039;&#039;&#039;external&#039;&#039;&#039; libraries are loaded using &#039;dlopen&#039; and then a register function is called. This function should return a data structure containing a set of function pointers, an integrator ID number, and a string integrator name, as shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;static const IntegratorInternals integrator_lsode_internals = {&lt;br /&gt;
	integrator_lsode_create&lt;br /&gt;
	,integrator_lsode_params_default&lt;br /&gt;
	,integrator_analyse_ode&lt;br /&gt;
	,integrator_lsode_solve&lt;br /&gt;
	,integrator_lsode_write_matrix&lt;br /&gt;
	,NULL /* debugfn */&lt;br /&gt;
&lt;br /&gt;
	,integrator_lsode_free&lt;br /&gt;
	,INTEG_LSODE&lt;br /&gt;
	,&amp;amp;quot;LSODE&amp;amp;quot;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
extern ASC_EXPORT int lsode_register(void){&lt;br /&gt;
&lt;br /&gt;
	CONSOLE_DEBUG(&amp;amp;quot;Registering LSODE...&amp;amp;quot;);&lt;br /&gt;
	return integrator_register(&amp;amp;amp;integrator_lsode_internals);&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The integrator ID number is bit of a fossil; we aim to remove this ID number eventually. The integrator_register function checks that no integrator with the same name or ID has already been registered. If that&#039;s OK, the integrator is added to the list of available integrators.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Build ===&lt;br /&gt;
&lt;br /&gt;
When the PyGTK GUI user clicks the integrate button, the system object (&amp;lt;tt&amp;gt;slv_system_t&amp;lt;/tt&amp;gt;) is built if it hasn&#039;t already been built. This means that the &amp;lt;tt&amp;gt;system_build&amp;lt;/tt&amp;gt; function (common with all problems, eg [[NLA|NLAs]]) is called, which in turn results in calls to &amp;lt;tt&amp;gt;analyze_make_problem&amp;lt;/tt&amp;gt;. This last &amp;lt;tt&amp;gt;analyze_make_problem&amp;lt;/tt&amp;gt; includes calls to &amp;lt;tt&amp;gt;analyze_make_master_lists&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;system_generate_diffvars&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;tt&amp;gt;analyze_make_master_lists&amp;lt;/tt&amp;gt; there is a &#039;visit&#039; process that uses the function &amp;lt;tt&amp;gt;classify_instance&amp;lt;/tt&amp;gt; to identify the following types of variables, and add them to some intermediate lists in the &amp;lt;tt&amp;gt;problem_t&amp;lt;/tt&amp;gt; structure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* variables that need to be &#039;observed&#039; when integrator output is reported&lt;br /&gt;
* independent variables (hopefully only one, ode_type == -1)&lt;br /&gt;
* differential/derivative variables (ode_type &amp;amp;gt;= 1)&lt;br /&gt;
* algebraic variables (ode_type == 0)&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;tt&amp;gt;system_generate_diffvars&amp;lt;/tt&amp;gt; is also called during &amp;lt;tt&amp;gt;analyze_make_problem&amp;lt;/tt&amp;gt; uses a tricky sorting algorithm to arrange the diffvars into a suitable order, so that &#039;chains&#039; of derivatives can be identified. These chains are split into separate ones for each variable set (eg {y, dydt, d2ydt2}), and stored in a big &amp;lt;tt&amp;gt;SolverDiffVarCollection&amp;lt;/tt&amp;gt; object, which is ultimately stored in the system object (as the &amp;lt;tt&amp;gt;diffvars&amp;lt;/tt&amp;gt; element).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Selection ===&lt;br /&gt;
&lt;br /&gt;
The user must select which integrator engine they want to use to solve a problem (although a GUI can of course offer a default choice).&lt;br /&gt;
&lt;br /&gt;
A list of all available (loaded) integrator enginers can be obtained with the function &amp;lt;tt&amp;gt;integrator_get_engines&amp;lt;/tt&amp;gt;, which returns a list of IntegratorInternals from which all the details of the loaded integrators can be determined, including the names.&lt;br /&gt;
&lt;br /&gt;
An integrator engine is selected by the user with the function &amp;lt;tt&amp;gt;integrator_set_engine&amp;lt;/tt&amp;gt;, which uses the short string name for the engine as a parameter. If the integrator name exists in the engine list, integrator_free_engine is called on the previously-selected engine if necessary, then the &amp;lt;tt&amp;gt;internals&amp;lt;/tt&amp;gt; field value is updated with the new IntegratorInternals pointer, and then integrator_create_engine function is called to allocate space as required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parameter and timestep input ===&lt;br /&gt;
&lt;br /&gt;
Currently, integrators need some additional parameters that are not stored within the model itself. These include number of time-steps, duration of integration, etc.&lt;br /&gt;
&lt;br /&gt;
During this stage, the PyGTK GUI makes a call to the function &#039;&#039;integrator_find_indep_var&#039;&#039;, to determine the current value of the independent variable, so that its value can be inserted into the parameter dialog box.&lt;br /&gt;
&lt;br /&gt;
The user inputs number of timesteps and the spacing of the timesteps (linear, logarithmic,...), which is used to create a suitable SampleList (see {{src|ascend/integrator/samplelist.h}}) containing the values of the independent variable for which solution values are to be output/recorded. Actually, the stuff that assigns the SampleList contents is C++ code from {{src|pygtk/integrator.h}}.&lt;br /&gt;
&lt;br /&gt;
Associated with the integrator is an IntegratorParamsDefaultFn, which will create the list of parameters that configures the integration engine. The integration engine provides the initial list; the GUI is then used by the user to make any adjustments to the predefined defaults.&lt;br /&gt;
&lt;br /&gt;
We would like to migrate towards a solution that allows default values for these parameters to be specified within the model file, for easier model re-usability.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
&lt;br /&gt;
When all the timestep (SampleList) information is specified and the integrator parameters are set, the &#039;&#039;integrator_analyse&#039;&#039; function is called. This function allows the integrator engine to do any necessary preparatory analysis of the model. This may include re-ordering the equations and variables for optimal solving, or creating internal data structures relating derviatives and their base variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A default analysis function, &amp;lt;tt&amp;gt;integrator_analyse_ode&amp;lt;/tt&amp;gt; is provided ({{src|ascend/integrator/integrator.c}}) that is used by the [[LSODE]] and [[DOPRI5]] integrators, but other integrators such as [[IDA]] can provide their own function (see &amp;lt;tt&amp;gt;integrator_ida_analyse&amp;lt;/tt&amp;gt; in {{src|solvers/ida/idaanalyse.c}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;tt&amp;gt;integrator_analyse_ode&amp;lt;/tt&amp;gt;, the call &amp;lt;tt&amp;gt;integrator_visit_system_vars(sys,&amp;amp;amp;integrator_ode_classify_var)&amp;lt;/tt&amp;gt; is used to visit all of the variables in the system and classify any that are derivatives or variables for which derivatives are present. The function &amp;lt;tt&amp;gt;DynamicVarInfo&amp;lt;/tt&amp;gt; works out the type of each variable (state/derivative/algebraic/independent) and its &#039;ode_id&#039;, then &amp;lt;tt&amp;gt;integrator_ode_classify_var&amp;lt;/tt&amp;gt; does the job of building up suitable lists of each kind of variable for later use in the analysis process.&lt;br /&gt;
&lt;br /&gt;
If analysis returns an error of any kind, that typically means that the user has configured their problem incorrectly. In this case, the PyGTK GUI opens a dialog and fills it with the output of the function &amp;lt;tt&amp;gt;integrator_debug&amp;lt;/tt&amp;gt;. This function can be used to give suggestions to the user about what may need to be fixed (although the usual error reported mechanism can also be used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== IDA ====&lt;br /&gt;
&lt;br /&gt;
The IDA integrator works a bit differently. Currently it looks like overkill, and we&#039;re hoping that a re-think will help to streamline this code.&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;tt&amp;gt;integrator_ida_analyse&amp;lt;/tt&amp;gt;, we carefully deal with the case where a variable is declared as differential even when a deriv&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;reanalyze_solver_lists&amp;lt;/tt&amp;gt;, to update the rels/vars in the system system according to the WHENs&lt;br /&gt;
* &amp;lt;tt&amp;gt;integrator_ida_check_vars&amp;lt;/tt&amp;gt;, to check for differential variables that are not incident, downgrading &#039;differential&#039; variables to algebraic variables if no derivative is present, and marking any&lt;br /&gt;
* run &amp;lt;tt&amp;gt;integrator_ida_flag_rels&amp;lt;/tt&amp;gt;, then&lt;br /&gt;
* &amp;lt;tt&amp;gt;integrator_ida_sort_rels_and_vars&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* &amp;lt;tt&amp;gt;integrator_ida_create_lists&amp;lt;/tt&amp;gt; and&lt;br /&gt;
* &amp;lt;tt&amp;gt;integrator_ida_check_diffindex&amp;lt;/tt&amp;gt;. Then&lt;br /&gt;
* &amp;lt;tt&amp;gt;integrator_ida_check_index&amp;lt;/tt&amp;gt; checks the index of the DAE system, then&lt;br /&gt;
* work out the list of observed variables and store them in &amp;lt;tt&amp;gt;sys-&amp;amp;gt;obs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TODO complete this section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Solution ===&lt;br /&gt;
&lt;br /&gt;
Once the analysis has been completed, the PyGTK GUI creates an &amp;lt;tt&amp;gt;IntegratorReporterPython&amp;lt;/tt&amp;gt; dialog that graphically shows the progress of timesteps as they proceed. The IntegratorReporterPython dialog makes a call to &amp;lt;tt&amp;gt;integrator_solve&amp;lt;/tt&amp;gt;, after first setting up hook functions using &amp;lt;tt&amp;gt;integrator_set_reporter&amp;lt;/tt&amp;gt; that allow intermediate results to be recorded.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;integrator_solve&amp;lt;/tt&amp;gt; makes a call to the specific integration routine provided by the selected integration engine. It is the job of this function to integrate up to each timestep listed in the SampleList and to make calls to the IntegrationReporter at each such point. Some integration libraries will have difficulty providing results for all requested timesteps; in this case, so don&#039;t assume that the observer output matches the SampleList in all cases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the PyGTK GUI, IntegrationReporterPython looks at the model at records any &#039;observed&#039; variables (those with &amp;lt;tt&amp;gt;varname.obs_id&amp;lt;/tt&amp;gt; set) into a data array in memory in Python. In the Tcl/Tk GUI, the &#039;observed&#039; values are recorded to a text file that is later loaded into the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Results output ===&lt;br /&gt;
&lt;br /&gt;
When integration has completed, the GUI receives an error message if any problem has occurred.&lt;br /&gt;
&lt;br /&gt;
If all went well, the value of the data array is used (in the PyGTK GUI) to fill the contents of an Observer data table, which is then displayed to the user. This array will contain the timesteps that were requested, together with the values of any variables that had their &#039;obs_id&#039; value set.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Data structures ==&lt;br /&gt;
&lt;br /&gt;
This section outlines the key data structures used in communication between ASCEND and the integrator engines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== IntegratorInternals ===&lt;br /&gt;
&lt;br /&gt;
This structure contains the bare-bones description of an integrator engine, including the hook functions that are used to &#039;drive&#039; it, as well as a string and integer identifier for the engine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== IntegratorSystem ===&lt;br /&gt;
&lt;br /&gt;
This structure contains the data common to all integrator engines. These include&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* pointer to the &amp;lt;tt&amp;gt;slv_system_t&amp;lt;/tt&amp;gt; that is to be integrated (contains variable lists, etc).&lt;br /&gt;
* pointer to the IntegratorInternals&lt;br /&gt;
* pointer to an IntegratorReporter&lt;br /&gt;
* pointer to a SampleList&lt;br /&gt;
* pointer to internal data owned by the selected integrator engine&lt;br /&gt;
* pointer to interface data owned by the GUI or other controlling process.&lt;br /&gt;
* solver parameters data structure&lt;br /&gt;
* independent variable&lt;br /&gt;
* list of &#039;state&#039; variables &#039;&#039;y&#039;&#039;.&lt;br /&gt;
* list of &#039;derivative&#039; variables &#039;&#039;ydot&#039;&#039;.&lt;br /&gt;
* list of observed variables &#039;&#039;obs&#039;&#039;&lt;br /&gt;
* other stuff&lt;br /&gt;
&lt;br /&gt;
=== IntegratorReporter ===&lt;br /&gt;
&lt;br /&gt;
This structure provides functions that will communicate integration results back to the GUI or other controlling process.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;init&amp;lt;/tt&amp;gt;, a function that will initialise the reporter, perhaps opening up a window or allocating some memory.&lt;br /&gt;
* &amp;lt;tt&amp;gt;write&amp;lt;/tt&amp;gt;, a function that should provide a quick status report, perhaps just telling the user the current value of the independent variable.&lt;br /&gt;
* &amp;lt;tt&amp;gt;write_obs&amp;lt;/tt&amp;gt;, a function that should examine the system and extract the value of any variables that need to be kept. This function is called each time the integrator reaches one of its designated timesteps as specified in the SampleList.&lt;br /&gt;
* &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt;, a function that can be used to finalise the reporting of results back to the user, deallocating memory, etc.&lt;br /&gt;
&lt;br /&gt;
=== SampleList ===&lt;br /&gt;
&lt;br /&gt;
This structure contains a list of timesteps (values of the independent variable, to be precise) for which output data is to be returned by the integrator. This list must be prepared ahead of time, before the integrator_solve function is called. In contains&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;ns&amp;lt;/tt&amp;gt;, the number of sample values in the list&lt;br /&gt;
* &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt;, an array of double-precision values&lt;br /&gt;
* &amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt;, a dim_type containing the [[DIMENSION]] of the provided sample values (for cross-checking with the dimensionality of the [[INDEPENDENT]] variable. The idea is that the GUI user can provide values of incorrect units (eg time = 10 cm) and we want to be able to catch that before it causes a problem).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[External Integrators]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Thin-walled_tank/Parameterized_models&amp;diff=190</id>
		<title>Thin-walled tank/Parameterized models</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Thin-walled_tank/Parameterized_models&amp;diff=190"/>
		<updated>2010-05-13T14:05:24Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float:right;width:33ex;padding-left:3px;margin-left:10px;margin-bottom:10px;border:solid 2pt grey;background-color: #eee&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;Thin-walled&#039;&#039;&#039; tank tutorial&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;small&amp;gt;[[Thin-walled_tank|&amp;amp;larr;Return to start]]&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Thin-walled_tank/Introduction|Introduction]]&lt;br /&gt;
* [[Thin-walled_tank/Adding_methods_to_a_model|Adding methods to a model]]&lt;br /&gt;
* [[Thin-walled_tank/Arrays|Arrays]]&lt;br /&gt;
* [[Thin-walled_tank/Building_complex_models|Building complex models]]&lt;br /&gt;
* &amp;lt;strong class=&amp;quot;selflink&amp;quot;&amp;gt;Parameterised models&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Category:Tutorials|Other tutorials]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&#039;&#039;This article is incomplete or needs expanding. Please help out by adding your comments.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
As noted earlier in [[Thin-walled_tank/Building_complex_models| Building complex models]], ASCEND modeling supports a part/whole paradigm.  Models contain parts that themselves are instances of other models, ad infinitum.  For example, we typically build a process using parts that are reactors, separators, pumps, tanks, and the pipes that connect them.  We just built a tank out of sides and ends.  One can see and connect to any variable inside a part (e.g., tank.D reaches inside a tank to &amp;quot;see&amp;quot; the tank diameter).  By making any two variables in a model be the same variable (ARE_THE_SAME), we can connect up very complex structures.  But, and it is a very big &amp;quot;but,&amp;quot; constructing models using only these concepts proves to be very difficult unless we just wrote and fully understand the part models.&lt;br /&gt;
&lt;br /&gt;
Modelers must be able to use part definitions that others have written.  To do so they should only need to know what the model does and how to interface to it.  They should not need to know in gory detail how it does what it does - though, when it does not work as expected, this lack of knowledge could be their undoing.&lt;br /&gt;
&lt;br /&gt;
We can provide the requisite interface to allow easier model reuse in at least two ways: (1) by providing a document or header that tells us exactly how to wire into the model and/or (2) by elevating the variables we need to wire to a special status within the model, e.g., as parameters for the model.  ASCEND uses parameterized models.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A parametric interface for a tank model==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL tank_end(&lt;br /&gt;
    D   WILL_BE distance;&lt;br /&gt;
&lt;br /&gt;
    A   WILL_BE area;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
    (* equation *)&lt;br /&gt;
    A=3.1416*D^2/4;&lt;br /&gt;
&lt;br /&gt;
END tank_end;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL tank_side;&lt;br /&gt;
    D   WILL_BE distance;&lt;br /&gt;
&lt;br /&gt;
    H   WILL_BE distance;&lt;br /&gt;
    A   WILL_BE area;&lt;br /&gt;
) WHERE (&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
    (* equation *)&lt;br /&gt;
    A=3.1416*D*H;&lt;br /&gt;
&lt;br /&gt;
END tank_side;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL partitioned_thin_walled_tank;&lt;br /&gt;
    (* variables *)&lt;br /&gt;
&lt;br /&gt;
    wall_thickness  IS_A distance;&lt;br /&gt;
    wall_area       IS_A area;&lt;br /&gt;
    wall_vol        IS_A volume;&lt;br /&gt;
&lt;br /&gt;
    metal_density   IS_A mass_density;&lt;br /&gt;
    metal_mass      IS_A mass;&lt;br /&gt;
    D, H            IS_A distance;&lt;br /&gt;
&lt;br /&gt;
    topend_area, bottomend_area, side_area       IS_A area;&lt;br /&gt;
&lt;br /&gt;
    (* parts *)&lt;br /&gt;
&lt;br /&gt;
    top             IS_A tank_end(D, topend_area);&lt;br /&gt;
    bottom          IS_A tank_end(D, bottomend_area);&lt;br /&gt;
&lt;br /&gt;
    side            IS_A tank_side(D, H, side_area);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    (* equations *)&lt;br /&gt;
    wall_area  = topend_area + bottomend_area + side_area;&lt;br /&gt;
    wall_vol   = wall_thickness*wall_area;&lt;br /&gt;
&lt;br /&gt;
    metal_mass = metal_density*wall_vol;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
    METHOD specify;&lt;br /&gt;
&lt;br /&gt;
        RUN top.specify;     (* fixes diameter *)&lt;br /&gt;
        RUN bottom.specify;  (* fixes diameter *)&lt;br /&gt;
&lt;br /&gt;
        RUN side.specify;    (* fixes diameter and height *)&lt;br /&gt;
        FIX metal_thickness;&lt;br /&gt;
        FIX metal_density;&lt;br /&gt;
&lt;br /&gt;
    END specify;&lt;br /&gt;
    METHOD values;&lt;br /&gt;
        D              := 20.0 {cm};&lt;br /&gt;
&lt;br /&gt;
        H              := D/10.0;&lt;br /&gt;
        wall_thickness := 0.15 {cm};&lt;br /&gt;
&lt;br /&gt;
        metal_density  := 7.85 {g/cm^3};&lt;br /&gt;
    END values;&lt;br /&gt;
END partitioned_thin_walled_tank;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Incomplete]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Spreadsheet_interface&amp;diff=189</id>
		<title>Spreadsheet interface</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Spreadsheet_interface&amp;diff=189"/>
		<updated>2010-05-13T14:05:17Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{task}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Proposal&#039;&#039;: create a spreadsheet-like GUI for ASCEND. &lt;br /&gt;
&lt;br /&gt;
This is not the same as integrating ASCEND with existing Spreadsheets. The idea would be to allow models to be created on a free-form grid of some sort, similar to Excel, but really a whole new program using the existing ASCEND back-end to do the calculations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
People are adept at creating models using spreadsheets.  It seems to be a natural way to program.  I suspect the reasons are twofold:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;People are spatially oriented.&#039;&#039;&#039; They remember where they put something much more easily than they remember what they called it.&lt;br /&gt;
* With every new element in a spreadsheet, they see a new result and can quickly decide if it is correct.  &#039;&#039;&#039;Programming is incremental.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Spreadsheets do not handle arrays well, especially when a model has an array whose size is dictated by a parameter passed from the &amp;quot;outer&amp;quot; model that has it as a part of it.&lt;br /&gt;
* Spreadsheets lead to strange &#039;labels&#039; like &#039;A5&#039; or &#039;C24&#039; to refer to cell names; using a language-based model definition, the user is deciding what these labels should be and can give them more memorable names.&lt;br /&gt;
&lt;br /&gt;
=== Thoughts ===&lt;br /&gt;
&lt;br /&gt;
* Perhaps this type of GUI will be suitable only for the construction of one-off models, done quickly, as people often do when programming in Excel.  I would like it to be useful for larger models, however, so I do not want it being useful only for small models to be the only outcome.&lt;br /&gt;
* Can we imagine using Excel itself as a basis for such a GUI? Or do we have to write our own spreadsheet from scratch? (Twenty years ago there were spreadsheet packages available that one could adopt and modify. Do these still exist?)&lt;br /&gt;
&lt;br /&gt;
=== A thought experiment ===&lt;br /&gt;
&lt;br /&gt;
In ASCEND we create type definitions.  Is this something that we can envision doing using a spreadsheet front end?  Could we create an instance of a model that we could convert to a parameterized type definition, for example? In an attempt to recover thoughts that we had on this type of front end from over 20 years ago, I will play with creating a model using a spreadsheet like approach. Let&#039;s build a model constructed of parts whose type we previously define.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Example model building ====&lt;br /&gt;
&lt;br /&gt;
Let’s create a model of a flash unit.  I am used to the equations for such a model, it contains parts, and it uses arrays of arbitrary size in its type definitions.  We will use the simpleflowsheet01.a4c code as a basis for this modeling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== mixture =====&lt;br /&gt;
&lt;br /&gt;
We first must define a mixture.  If we were in Excel, we could create an example mixture model by creating a column of y values, one for each component.  We would then form their sum by adding up the column.  Now, &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* can we convert that to a type definition?&lt;br /&gt;
* How do we tell Excel that each of the cells corresponding to a y value is of type fraction? Further,&lt;br /&gt;
* how do we tell Excel that we want one such cell for each member of a set we call “components?”  And&lt;br /&gt;
* how do we put the names into “components?”&lt;br /&gt;
&lt;br /&gt;
Note that we would be unable to enforce that the sum of the mole fractions add up to one in Excel without using the “goal seeker” or the “solver” under the tools menu.  This, of course, is not how we would envision ASCEND to work.  It should be solver for the spreadsheet.  We must encode the equations we want enforced in the model.  We could do this by putting errors into cells and noting that we want them to be zero at a solution.  Other cells could simply be there as intermediate computations.  Having said this, how would ASCEND extract equations from a spreadsheet?&lt;br /&gt;
&lt;br /&gt;
Thinking out loud here, let’s see what might be an approach. We should really be trying to discover the wealth of options, but we will start with trying to discover just one that could work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How do we create an &#039;&#039;array&#039;&#039; in a model?&#039;&#039;&#039;  One possibility would be to select a cell and declare its type to be an array.  That would open a new sheet that will contain the array.  We need three items (at least) for an array (let’s assume an array is one dimensional so a matrix will be an array of arrays).  We need an index set over which the array exists, the base type for the array elements, and the array elements, one for each member of the index set.  When the sheet for an array opens, we see these three parts.  (Question: should it be a new sheet or should it open as a block inside the current model?)  We select the base-type cell, and a list appears that gives us legal base-types.  We select one, and its name fills into the base-type cell.  Until we give values to the index set, we do not know how many array elements we need, so it appears these should be represented by an icon until we select the index set.  We click on the index set and fill in some values - [1..10] or [‘a’,’b’,’c’], for example.  As we create these values, ASCEND dynamically creates the cells for the array.  We could also fill in the index set by searching for it elsewhere in the parent models containing this array.  Or we could leave it unset for the moment – with the cell for the array in the parent model showing in red as it is not yet fully instanced.&lt;br /&gt;
&lt;br /&gt;
We start at the lowest level and create an &#039;&#039;&#039;atom definition&#039;&#039;&#039; for “fraction.”  We do this by opening a new sheet based on the template “atom.”  The sheet opens with labeled cells in it for the various parts of an atom.   We put values into the lower and upper bounds of 0.0 and 1.0 respectively.   There are flags in this sheet (e.g., a fixed flag).  We fill in the dimensions for this atom (where? how?).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We are not dealing yet with a lot of issues, but the idea that we could program in this style of interface should be apparent.  And, it seems it is in the style of programming in a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
Okay, we have some rudimentary thoughts on the building blocks.  We now create the mixture model.  We open a new sheet and call it “mixture.”  We pick a cell and declare it to be an index set.  If we click on it, a template for a set opens which we fill in with element lists, should we want to do that now.  We fill in ‘a’, ‘b’, ‘c’, etc.&lt;br /&gt;
&lt;br /&gt;
We pick another cell and select it to be an array with the name ‘y.’  Opening the array sheet, we set the base type to be “fraction.”  We select the index set, indicate this set is equal to another, and search through the parent model to find the index set.  The next time we open this array within this mixture model, we will see three elements – one for each of the species ‘a’, ‘b’, and ‘c’.&lt;br /&gt;
&lt;br /&gt;
We select a cell in the mixture model and construct a term that is the sum of the elements in the array y less unity.  We flag this cell as an equation.&lt;br /&gt;
&lt;br /&gt;
We need yet to think about how to set up methods.  We leave that for the time being.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== molar_stream ====&lt;br /&gt;
&lt;br /&gt;
We next create the model “molar_stream.”  New to this model is the FOR/CREATE loop.  We also have an included part called a state that is a “mixture.”  Some of the other bits are similar to elements in the mixture model.&lt;br /&gt;
&lt;br /&gt;
We pick a cell and label it “state.”  We click on it, select “IS_A” as the type cell, and a sheet opens.  The sheet has a spot for us to select its type: mixture.  When we do, ASCEND fills in what it knows about a mixture from our previous instance.  We select “components” at the parent level, select “ARE_THE_SAME,” and search for and equate it to “components” inside the sheet we just called “state.” &lt;br /&gt;
&lt;br /&gt;
How might we construct a FOR/WHILE loop?  We want a one-to-one mapping with this statement.  We select a cell and declare it to be a FOR/CREATE loop.  At this level – i.e., inside this sheet rather than in a new sheet - ASCEND inserts a template of cells (with a box around them, perhaps) that corresponds to this loop.  It has an index variable (we label it “i”) along with an index set from which it is to be drawn – i.e., “components.”  We tie this index set to the set “components” we created earlier in this sheet. We pick another cell, indicate it is an equation (obviously it will be indexed), and construct the equation.  How do we select f[i]?  We need not only to pick f but also the general index calculation over which f is indexed, here simply “i”.  But this index expression could be of the form 2*i-1.  We pick f first.  ASCEND sees it is an array of variables.  It opens another cell associated with this pick of f into which we construct the index calculation.  We select the minus operator, select Ftot (not indexed so no subindex calculation), and then y inside state (indexed and we equate this index with that for f or we construct the index expression over again) that ASCEND provides space for as we construct this equation.&lt;br /&gt;
&lt;br /&gt;
The above FOR/WHILE loop construction makes it clear that programming is by location and not by name – as when we program a spreadsheet.  Nice.  It also makes it clear that we need to develop an approach for each type of statement we have in ASCEND. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== It should be fun ===&lt;br /&gt;
&lt;br /&gt;
Since we already know the statement types, this design activity should be fun and not too difficult.  Programming the support interface will be the hard part??  At least it would be for me.&lt;br /&gt;
&lt;br /&gt;
-- [[Art Westerberg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Another thought experiment ==&lt;br /&gt;
&lt;br /&gt;
Here&#039;s another take on how this stuff could work. The key idea is that this special new spreadsheet would allow relations to be entered into cells, such as &amp;quot;&amp;lt;tt&amp;gt;C5 == B4&amp;lt;/tt&amp;gt;&amp;quot;. Then, cells like that would provide a visual clue about the convergence status of the relations they contain.&lt;br /&gt;
&lt;br /&gt;
Cells with fixed values would have to be tagged in some way. Same as the [[FIX]]/[[FREE]] functionality we use at the moment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Arrays would be handled as sequences of cells. FOR loops would be done using relative indexing, the same as for standard spreadsheets. Stuff like [[SWITCH]] statements could be handled using something similar to the current &#039;IF&#039; function of spreadsheets. This might require some changes to the way that conditionals and handled in libascend.&lt;br /&gt;
&lt;br /&gt;
Models could be declared by drawing a box around a number of cells and declaring a name for the component. Parameters would need to be defined by tagging the necessary cells. Then, this set of cells could be called in the same way as an equation, eg &amp;quot;&amp;lt;tt&amp;gt;mymodel(A4, B5)&amp;lt;/tt&amp;gt;&amp;quot;. When the submodel was entirely converged, it might show the cell in green. If not, the cell could be double-clicked and an instance of the originally declared model would open, showing all the internal variables.&lt;br /&gt;
&lt;br /&gt;
In additional to all this, there would be a need to specify the [[REQUIRE|REQUIREd]] outside sheets, for model reuse. This could be done using something similar to the Excel add-in loader interface; it would be a list of files loaded to support the current sheet.&lt;br /&gt;
&lt;br /&gt;
Documentation comments could easily be added throughout the sheet, perhaps with a simple &#039; prefix in such cells.&lt;br /&gt;
&lt;br /&gt;
Units of measurement could be handled as a suffix entered into cells. Cells could have their units of measurement changed, and values would be automatically converted. A (fixed) cell would simply remember the units entered by the user.&lt;br /&gt;
&lt;br /&gt;
Minimum and maximum values for cells would be configurable by right-clicking. Variable types would not be present in this system, but dimensional checking would still be possible and could be helpful in alerting users to input errors in realtime.&lt;br /&gt;
&lt;br /&gt;
With the above approach, it would be fairly simple to build up complex object-oriented conditional models, including model re-use, in a free-form way not currently possible in ASCEND. IT wouldn&#039;t be hard to set up the spreadsheet GUI to export the necessary variables and equations to the solver.&lt;br /&gt;
&lt;br /&gt;
Dynamic modelling might even be possible in this scenario, although how dynamic modelling data could be represented to the user would be more difficult to work out.&lt;br /&gt;
&lt;br /&gt;
I think that a METHODS system could be worked out, using a Javascript-style dynamic object model. A scripting layer, similar to Visual Basic in Excel, would be allowed to augment MODEL definitions with methods, and these methods would be able to access and set internal variables of the models. Then, these methods would be callable from other places in the sheet. A special method could be run whenever a model sheet was instantiated and/or a file loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
-- [[John Pye]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Proposed]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Initial-value_modelling&amp;diff=188</id>
		<title>Initial-value modelling</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Initial-value_modelling&amp;diff=188"/>
		<updated>2010-05-13T14:05:06Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;outdated&amp;quot; style=&amp;quot;border:solid 2pt orange; width:70ex; background-color:#FFEEDD;padding:4px;margin-bottom:6px&amp;quot;&amp;gt;&#039;&#039;This article is &#039;&#039;&#039;outdated&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Initial-value_modelling&amp;amp;action=edit updating it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&#039;&#039;See also [[Dynamic modelling]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This task is to extend ASCEND&#039;s ability to solve initial value differential-algebraic problems.  Such problems comprise a mixture of ordinary differential and algebraic equations.  The &amp;quot;twist&amp;quot; to this extension is to convert the integration equations for stepping the ODEs into ASCEND models and, initially, to use methods and a Tcl script to do the stepping.  In this manner, we do not need to add any new solver code to ASCEND.&lt;br /&gt;
&lt;br /&gt;
Attached (&amp;lt;a href=&amp;quot;/images/9/98/DifferentialAlgebraicEqn.pdf&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;DifferentialAlgebraicEqn.pdf&amp;quot;&amp;gt;Media:DifferentialAlgebraicEqn.pdf&amp;lt;/a&amp;gt;: HOWTO chapter for solving DAE initial value models) is a .pdf file documenting the effort to date.  It is in the form of a HOWTO in the ASCEND documentation.  The code (in its current state) will be added here soon.&lt;br /&gt;
&lt;br /&gt;
See also [http://www.cs.cmu.edu/~ascendFTP/pdffiles/AscendIVP.pdf]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current System ==&lt;br /&gt;
&lt;br /&gt;
The following describes the current system - which is NOT that described in the above .pdf file.  It corresponds to the solving of the following DAE models and scripts: dyn_flash.a4l, dyn_column.a4l, dyn_separation_demos.a4s, dyn_tank.a4c and a4s.&lt;br /&gt;
&lt;br /&gt;
To understand the current system, the following 10,000 ft view of the ODE solving process and its history may be useful. The IVP integrators for strict ODEs exist at a level completely separate from the details of solving nonlinear square algebraic systems. All an integrator needs in most cases is ydot=f(y) (FEX) and dydot/dy (JAC). JAC can be produced by a simple trick of linear algebra (this is seen in tcltk/interface/Sensitivity.c). &lt;br /&gt;
The solution of the time-marching equations (find new y given ydots) is handled in LSODE; the computation of ydot given a fixed state-variable set y is done using the conventional nonlinear solver. If the nonlinear solver has a structural singularity with the states y fixed, either the model is ill-posed or the DAE index of the related DAE problem is greater than 1.&lt;br /&gt;
&lt;br /&gt;
[[Image:integ_data_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The required math is easy. The required analysis of the model instance DAG to produce flat representations takes place in two stages. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* stage 1: fix the state variables y to form a well-posed problem, free the derivative ydot, and solve the nonlinear algebraic problem for a consistent initial condition. This is the role of the slv_system_t in the diagram.&lt;br /&gt;
* stage 2: collect the y and ydot pairs from the instance tree in a format useful for ODE solvers and begin the time-marching iteration. The integrator is allowed to change the values of the y variables in the instance tree as time is moved forward. This is the role of the Integ_system. The NLA solver is used to compute the needed ydot values at each t and test y. The linear sensitivity analysis is used to compute JAC as needed. JAC may be dense or sparse in reality, but for ascend purposes it is always stored as dense though it may be sparse in most PDE/chem-mech-eng problems. This is a potential subject of optimization, but a better use of limited resources would be in making the DAE solving approach that Art is suggesting above more user-friendly.&lt;br /&gt;
&lt;br /&gt;
The user interface (how hierarchical, reusable dynamic models get connected to IVP solvers) is described in &amp;lt;a href=&amp;quot;https://pse.cheme.cmu.edu/ascend/ftp/pdfHowto/howto-ivp.pdf&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://pse.cheme.cmu.edu/ascend/ftp/pdfHowto/howto-ivp.pdf&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;howto-ivp.pdf&amp;lt;/a&amp;gt;. The approach taken to pairing y with ydot variables is by assigning a matching integer index value to each using METHODs. This was a &amp;quot;no language changes required&amp;quot; prototype. It can be used to handle DAEs or ODEs. It is slightly cumbersome (and definitely &amp;quot;busy work&amp;quot;) to require the user-written state identification and pairing methods; additional syntax has been desired for a long time.&lt;br /&gt;
&lt;br /&gt;
-- [[Main.BenAllan]] - 01 Jun 2006&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Syntax extensions require in all but the most trivial cases substantial community negotiation and an eye for where ASCEND is going and has been. The big picture for differential syntax is that we want:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* to be able to handle the declaration of PDEs as well as ODEs (eventually).&lt;br /&gt;
* to avoid making a special case of time in the language (though in specific models it&#039;s fine).&lt;br /&gt;
* to make sure the syntax is compatible with WHEN statements being used to model dynamic discontinuities of all sorts.&lt;br /&gt;
* to have an integrator version that handles root-finding and DOF changes so discontinuities are converged properly.&lt;br /&gt;
&lt;br /&gt;
It should be noted that boundary descriptions are already part of the language per the conditional modeling work of Rico-Ramirez.&lt;br /&gt;
&lt;br /&gt;
Some of the basic concepts that have been already devised, but not implemented are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Declaring an IVP independent variable of any name and dimensionality, and doing it more than once in the same model as (e.g. time) one variable is not necessarily the only variable that might be useful in ivp modeling as the independent variable.&lt;br /&gt;
* Declaring a differential state of any solver_var type.&lt;br /&gt;
* Declaring a derivative wrt a state and an independent variable using regular atom types in order to get bounds and scaling correct (yes, derivatives do need bounds and scaling in most physical systems). A tricky case that must be handled in a principled way is the definition of an array of derivatives given an array of states, bearing in mind that ascend sets are unordered sets. In the compiler, sets are really documented as, &amp;quot;arbitrarily and consistently ordered&amp;quot;, such that if two set instances contain the same elements, any FOR operation which is executed over one set will process the matching elements in the same order for the other set.&lt;br /&gt;
* Defining the domain of an independent variable for IVP or PDE. This likely is different from the &#039;&#039;&#039;bounds&#039;&#039;&#039; on the same variable, because the domain affects the dependent variables in a PDE.&lt;br /&gt;
* Leaving a declared state OUT of the set of states to be solved for with the IVP solver.&lt;br /&gt;
* Leaving a derivative OUT of the set of variables to be solved for with the NLA solver.&lt;br /&gt;
* Defining an &amp;quot;espilon after&amp;quot; (t+) for making statements about discontinuities; the implications (is it an entire shadow model lurking?) are tricky.&lt;br /&gt;
&lt;br /&gt;
-- [[Main.BenAllan]] - 02 Jun 2006&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ben has outlined some very important thoughts we need to discuss in his list above.&lt;br /&gt;
&lt;br /&gt;
I believe there are (at least) two major issues for creating a new DAE solver in ASCEND - if that were our only short term goal.  One involves getting the math right.  This I hope I have done in writing the .pdf document above and in writing and testing the approach in the models in the folder trunk/models/westerberg/ivpNondimensional in the subversion repository.  (Note that these models do not install when creating and installing ASCEND so look for them only in a code checkout.)  The second issue is to add to the language the ability to identify the independent variable (e.g., time or distance) and to associate each state with its derivative with respect to the independent variable.  This latter could be by adding statements of the type: &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INDEPENDENT VARIABLE t;&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;&#039;STATE ppp HAS DERIVATIVE dpppdt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
where t, ppp and dpppdt are user names.&lt;br /&gt;
&lt;br /&gt;
Issues that arise when making this type of declaration are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* several models may declare the independent variable.  It has to be the same variable for all models, requiring that it be aliased or a passed parameter from on high or some such thing.&lt;br /&gt;
* IF we want the integration equations (e.g., the bdf equations) to be ASCEND models, there has to be a way to associate these equations to the states and their derivatives.  My approach in the .pdf document requires me to put these into vectors - not a nice thing to have to do as it requires me to identify in my modeling all the states and their derivatives and map them into these vectors.  The strength to my approach is that I can have a variety of integration equations (e.g., bdf or RK4 or whatever) that I write and add to the system strictly as models and not as C code.  &#039;&#039;&#039;This will be a sticky issue we need to discuss.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To restate this last point, if we have the DAE solver (which will be an SLV solver in C) collect the states and their derivatives by finding all declaraions and then associate integration equations with each of them, then how are these equations added to the ASCEND model so the compiler creates its solve system for the model plus these equations (and where these equations are my choice as I have written them as an ASCEND model)?  Maybe all this just requires some clever ASCEND modeling that I have not yet thought enough about how to do??&lt;br /&gt;
&lt;br /&gt;
-- [[Main.ArthurWesterberg]] - 08 Jun 2006&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I&#039;m anti the &amp;quot;x HAS DERIVATIVE y&amp;quot; syntax. I think it&#039;s wordy and &amp;quot;y = diff(x)&amp;quot; or &amp;quot;y=der(x)&amp;quot; would be better (it eliminates the need for extra lines in the model declaration). Multiple-word syntax tokens considered harmful: we need to make the ASCEND language more compact (as evidenced by the fact that you felt it necessary to write a macro package for typing models in Emacs).&lt;br /&gt;
&lt;br /&gt;
We have a key problem here: should ASCEND display an instance hierarchy that corresponds to the model that was declared by the user, or should it show its &#039;&#039;&#039;internal&#039;&#039;&#039; instance hierarchy? This latter, in the case of Art&#039;s approach will involve lots of addition curve-fit variables and derivatives, etc. I am in favour of showing only what the user has declared: What ASCEND displays should fit with the user&#039;s mental model, rather than the other way around.&lt;br /&gt;
&lt;br /&gt;
-- [[[[Main.JohnPye]]|[[Main.JohnPye]]]] - 13 Jun 2006&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I am not for a more compact language.  We were deliberately wordy, and I have never regreted it.  ASCEND is nice because one can guess meaning from the words used.  I like self documenting languages.  APL (a long time ago) was so compact an expert in it would always misunderstand any program longer than a couple of lines, even if he had only written it a day before.  One line of code could about jump through hoops.  It did matrix operations with very compact syntax.&lt;br /&gt;
&lt;br /&gt;
Are you suggesting using der(x) (for example) as the derivative of x with respect to the independent variable?  y = der(x) only make y equal to der(x); it is NOT defined as der(x) using an equals statement - unless you overload the equal sign (I am against that).&lt;br /&gt;
&lt;br /&gt;
I would have to think of the implications of using der(x) as the derivative of x.  How would I give an initial condition to der(x) (which looks a lot like a function and not a variable in the model)?  For steady-state, I would like to fix der(x) to be zero, for example.  Ben also noted above that der(x) needs bounds, etc.  If der(x) is to be looked at as a variable, then it has a different format from other variables (not good).  When I think of DAE models, I really do think of the derivative of x wrt the independent variable as another variable in the model.  So I do want it to be a variable that I can use in an equation (for example, to square it), bound it, give it nominal values to, give it initial guesses for, etc.  My conclusion from this: der(x) has to be a variable, and der(x) is not a good syntax for it.&lt;br /&gt;
&lt;br /&gt;
-- [[Main.ArthurWesterberg]] - 13 Jun 2006&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I have an idea that may do all the things for which we all have been asking to model and solve IVP DAEs.  It is motivated by John insisting we use a form like y=diff(x) to relate the derivative of x wrt time to the variable y and Ben and I arguing that we do not use this form.  This idea would NOT require us to modify the compiler, it would also allow one to use whatever model -- as an ASCEND model -- one wishes to do the integration, and it would NOT require one to run around the model manually to find all the derivatives and map them into a vector to pass to the integration routine.  It should only require us to write a solver in C, as with our other solvers.  It looks a lot like the statement that Ben has suggested and that John has suggested - yes, both.&lt;br /&gt;
&lt;br /&gt;
Use statements of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; dxdt IS_A speed;&lt;br /&gt;
 x IS_A length;&lt;br /&gt;
 t IS_A time;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; derivx IS_A derivModel(dxdt, x, t);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I can use IS_REFINED_TO to upgrade any base derivModel to whatever form I wish it to have, where the refinement would bring in the actual polynomial equation to use - e.g., BDF or RK4.  The solver would simply have to find all the instances of derivModel in a model to discover what are state variables when it is time stepping, integration error controlling, next poly order predicting and &amp;quot;stopping condition&amp;quot; checking.  I could in principle have a different derivModel refinement for every state variable - a nice twist.  So I could use different kinds of polynomials for different variables.  &lt;br /&gt;
&lt;br /&gt;
One issue: I wonder how we could enforce that all independent variables are the same one variable in the entire problem - the UNIVERSAL statement (seldom used of late in ASCEND) might help.&lt;br /&gt;
&lt;br /&gt;
We can get away with this approach because integration polynomials only ever involve the state, it derivatives and the independent variable.  There are no references to the values for other variables in these polynomials.  I suspect this would also let us handle PDEs in a similar way.&lt;br /&gt;
&lt;br /&gt;
The derivModel will set aside the space needed for past values of derivatives and states.  The user&#039;s model, which includes this statement for each state, will define the physical relationship among the states and derivatives.  derivModel will only supply the numerical integration equations.&lt;br /&gt;
&lt;br /&gt;
To handle predicted variables that are not state variables (such as an algebraic variable whose value I wish to predict to aid converging at each time step or that I wish to use as a stopping condition), use a statement of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; algegm IS_A algebModel(m, t);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the system can collect these and use a different polynomial model to use for predicting.&lt;br /&gt;
&lt;br /&gt;
I cannot see any obvious holes in this - yet.  If I am not kidding myself on it, then it is actually a demonstration that the ASCEND language is doing a nice job in extending to this new type of problem with the features it already has.&lt;br /&gt;
&lt;br /&gt;
-- [[Main.ArthurWesterberg]] - 16 Jun 2006&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I decided to see just how difficult it would be to create the models&lt;br /&gt;
required for the approach I just suggested.  I committed a new model&lt;br /&gt;
into models/westerberg/ivpNondimensional/ivp[[NonNew]] that you may wish&lt;br /&gt;
to examine.&lt;br /&gt;
&lt;br /&gt;
Basically, for every state variable (i.e., variable y for which one&lt;br /&gt;
writes an ODE to define dydt for it), include the following statement&lt;br /&gt;
in one&#039;s ASCEND model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;defineState_Velocity: stateVel IS_A diff(accel, vel, t);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There can be a variety of diff models in one&#039;s library, and one would&lt;br /&gt;
use REQUIRE at the top of the model file to select which one wants at&lt;br /&gt;
this moment.&lt;br /&gt;
&lt;br /&gt;
This is really all there is to it.&lt;br /&gt;
&lt;br /&gt;
The diff model adds polynomials of order 12 to the ASCEND model, for&lt;br /&gt;
the current point and each of twelve past points, for both relating y&lt;br /&gt;
to a polynomial in t and relating dydt to a different polynomial in t.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;These are the only equations one needs to add to provide the&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numerical integration equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The solver will control which of these equations to include at the&lt;br /&gt;
current time step by setting equation include flags and variable fixed&lt;br /&gt;
flags appropriately.  Mimicing how Lsode steps (as we would implement&lt;br /&gt;
it), the solver has to choose the order polynomial to use for the next&lt;br /&gt;
step.  Let us suppose it chooses order 3.  This means one will use&lt;br /&gt;
third order polynomials.  Only coefficients a[0] to a[4] would be&lt;br /&gt;
nonzero.  The solver would set the remaining, a[4] to a[12], to zero&lt;br /&gt;
and fix them.  Based on whether it is integrating a stiff problem or a&lt;br /&gt;
nonstiff problem, the solver has to choose whether to include y =&lt;br /&gt;
poly(t) or dydt = poly(t) equations for the current and up to three&lt;br /&gt;
past points.     Both kinds of polynomials are in the model for all&lt;br /&gt;
twelve past points.  The solver would uninclude all those not wanted.&lt;br /&gt;
&lt;br /&gt;
That is the essence of getting the integration equations into the DAE&lt;br /&gt;
model directly for solving them with the user&#039;s DAE model equations.&lt;br /&gt;
&lt;br /&gt;
The solver (written in C) would have code that corresponds to the&lt;br /&gt;
methods I wrote to do the error checking, to decide the order to use&lt;br /&gt;
next, to predict the next point, to check for stopping conditions,&lt;br /&gt;
etc.&lt;br /&gt;
&lt;br /&gt;
All in all it looks pretty straight forward and a lot simpler than my&lt;br /&gt;
previous code.  Adding the diff model for each state variable made the&lt;br /&gt;
models a lot less complex.  Also always adding 12th order polynomials&lt;br /&gt;
and killing the higher order terms by setting coefficients to zero and&lt;br /&gt;
fixing them made what had to be added easier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The current view ==&lt;br /&gt;
&lt;br /&gt;
The current view is that the integrator API as currently shared by IDA and LSODE will more-or-less stand, but there will be more changes to the way in which integration systems are analysed. We currently propose to use syntax something like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DERIV(dx_dt,x);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will add a &#039;LINK&#039; of a specific type (&#039;time-derivative&#039;, perhaps) between these two variables, which the analysis routines will be able to find and use when preparing the model for solution by the integrator [[IDA]] or [[LSODE]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Blocking in dynamics models ==&lt;br /&gt;
&lt;br /&gt;
The following diagram is helpful in understanding the different types of variables and relations that are present within a dynamic model&lt;br /&gt;
&lt;br /&gt;
[[Image:DAE-incidence.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Outdated]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ATOM&amp;diff=187</id>
		<title>ATOM</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ATOM&amp;diff=187"/>
		<updated>2010-05-13T14:04:54Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div&amp;gt;&#039;&#039;This article is incomplete or needs expanding. Please help out by adding your comments.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;ATOM&#039;&#039;&#039; statement is used to declare new variable types in ASCEND. These can be symbol, boolean, integer, or real-valued. The capabilities of ASCEND in solving models with these types of atoms depends on what solver is used. The ATOM statement is used to refine the definition of base variable types. You can add additional parameters such as upper and lower bounds, and scaling parameters, as well as defining the [[Dimensions]] for the variable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Atom types may declare attribute fields with types real, integer, boolean, symbol, and set. These attributes are not independent objects and therefore cannot be refined, merged, or put in a refinement clique ([[ARE ALIKE]]).&lt;br /&gt;
&lt;br /&gt;
The syntax for declaring a new atom type is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;ATOM atom_type_name REFINES variable_type&lt;br /&gt;
    «DIMENSION dimension_expression»&lt;br /&gt;
    «DEFAULT value»; (* note the semicolon *)&lt;br /&gt;
&lt;br /&gt;
    «initial attribute assignments;»&lt;br /&gt;
END atom_type_name;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example is the declaration of the [[solver_var]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;ATOM solver_var REFINES real DEFAULT 0.5 {?};&lt;br /&gt;
&lt;br /&gt;
   lower_bound IS_A real;&lt;br /&gt;
   upper_bound IS_A real;&lt;br /&gt;
   nominal IS_A real;&lt;br /&gt;
&lt;br /&gt;
   fixed IS_A boolean;&lt;br /&gt;
   fixed := FALSE;&lt;br /&gt;
   lower_bound := -1e20 {?};&lt;br /&gt;
&lt;br /&gt;
   upper_bound := 1e20 {?};&lt;br /&gt;
   nominal := 0.5 {?};&lt;br /&gt;
&lt;br /&gt;
END solver_var;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in the above the wildcard dimension, {?}.&lt;br /&gt;
&lt;br /&gt;
For more detail, see the [[Category:Documentation|user&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
See also [[Units of measurement]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Incomplete]]&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Remote_Virtual_Windows&amp;diff=186</id>
		<title>Remote Virtual Windows</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Remote_Virtual_Windows&amp;diff=186"/>
		<updated>2010-05-13T14:04:45Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is some information on setting up Windows XP as a &#039;&#039;&#039;virtual&#039;&#039;&#039; operating system on your Ubuntu system at &#039;work&#039; so that it can be accessed remotely via VNC from &#039;home&#039;.&lt;br /&gt;
&lt;br /&gt;
Why would you want to do that? (1) you only have one licensed copy of Windows and (2) you normally run Linux for whatever reason, you only have one work machine, and you don&#039;t want to have to shutdown your work machine just so that you can access Windows from home via [http://www.tightvnc.com VNC] or RDP. It might also be that you want to run a [[Installing_a_Buildbot_service_on_Windows|Buildbot]] for Windows, but you don&#039;t have spare machine available, as was my case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What do you need? Your &#039;work&#039; system needs to be a fairly recent and fairly fast machine with probably at least 1GB but more likely 2GB+ of RAM. In order to run [http://sourceforge.net/projects/kvm KVM] on it, you will need a recent &#039;Core Duo 2&#039; or &#039;Xeon&#039; processor or the AMD equivalent.&lt;br /&gt;
&lt;br /&gt;
How well does it work? With Core Duo 2 2.1 GHz 2 GB RAM system at &#039;work&#039; and a tired old P4 2.4 GHz running Fedora 7 via a fairly slow ADSL connection at &#039;home&#039;, it worked very well, provided you can make use of TightVNC to provide compression of the transmitted Windows session. This method doesn&#039;t tie up the machine at work, either: it doesn&#039;t need to be booted into windows, and it can be used by other users for other things, serving up files or a website, etc. The virtual Windows system can be started and stopped remotely, and can stay running even if your home connection is a flakey.&lt;br /&gt;
&lt;br /&gt;
If you do try this stuff out, please [[User:Jpye|let me know]] with an email or some edits on this page!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Set up virtual Windows on your server ==&lt;br /&gt;
&lt;br /&gt;
At work (or whereever your server is) we assume you are running Ubuntu. Follow the instructions there for setting up Windows XP as a Kernel Virtual Machine (KVM). Instructions for this part are &amp;lt;a href=&amp;quot;https://help.ubuntu.com/community/KVM&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://help.ubuntu.com/community/KVM&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;here&amp;lt;/a&amp;gt;. This step takes a while, and will whirr your CD drive for a while, but is fairly straight forward provided you note the thing about pressing &#039;F5&#039; at the appropriate moment.&lt;br /&gt;
&lt;br /&gt;
While Windows is installing, make sure your Ubuntu machine has got &amp;lt;tt&amp;gt;sshd&amp;lt;/tt&amp;gt; installed and make sure that port 22 is open on your firewall (eg Firestarter) if you are using one. Make sure you can access your machine from outside the office. You may need to set up  a Dynamic DNS name if you don&#039;t have a static IP address on your work machine (information &amp;lt;a href=&amp;quot;https://help.ubuntu.com/community/DynamicDNS&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://help.ubuntu.com/community/DynamicDNS&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;here&amp;lt;/a&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Once Windows is installed via KVM, launch it localling using the &#039;kvm&#039; command as outlined in the above instructions. Install [http://www.tightvnc.com TightVNC] and set it up as a service (you will be asked for a password). Set TightVNC to accept connections to port 5900. You can turn off the HTTP feature.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In your virtual Windows system, open up the Windows firewall on port 5900 to allow VNC connections.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Starting up your virtual Windows system ==&lt;br /&gt;
&lt;br /&gt;
You need to run your virtual Windows system from within the utility program called &#039;screen&#039;. This allows you to start it remotely, and for it to keep running, even if you connection goes down.&lt;br /&gt;
&lt;br /&gt;
From your home system, open an SSH connection to your work system and type &#039;screen&#039;.&lt;br /&gt;
&lt;br /&gt;
Once &amp;lt;tt&amp;gt;screen&amp;lt;/tt&amp;gt; has loaded (it will show you some basic information before giving you a new shell prompt), type &amp;lt;tt&amp;gt;kvm -redir tcp:5909::5900 -smp 2 -vnc&amp;amp;nbsp;:8 -k en-us -usbdevice tablet -no-acpi -m 512 -cdrom /dev/cdrom .kvm/winxp0.img&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This will start your virtual Windows system, although you won&#039;t see anything yet, and the command won&#039;t complete. You have now got an (invisible) windows session running on your server. To access it, we are not going to use the VNC server provided by KVM/QEMU but instead we are going to connect to the *virtual* TightVNC server that we installed on the virtual machine.&lt;br /&gt;
&lt;br /&gt;
Close the SSH connection you your work system by closing the terminal window. Because you ran &#039;kvm&#039; from inside &#039;screen&#039; it will continue running even after your SSH session has been closed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Connect to your server with correct port forwarding ==&lt;br /&gt;
&lt;br /&gt;
We&#039;ll assume your &#039;&#039;&#039;home&#039;&#039;&#039; system is Fedora 7. If it&#039;s Ubuntu or Windows or something else, you&#039;ll need to work out your own approach.&lt;br /&gt;
&lt;br /&gt;
First, install TightVNC on your &#039;&#039;&#039;home&#039;&#039;&#039; system. On Fedora, you can just use the .rpm package from [http://www.tightvnc.com].&lt;br /&gt;
&lt;br /&gt;
Next, set up TightVNC on your home system so that it uses the right compression methods by default, and set it so that it uses full-screen display. Assuming you are on Linux, you can set up your TightVNC settings for fullscreen use by editing/creating the file &amp;lt;tt&amp;gt;~/.Xresources&amp;lt;/tt&amp;gt; so that it contains:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;! vncviewer&lt;br /&gt;
Vncviewer*encodings: copyrect tight hextile zlib corre rre raw&lt;br /&gt;
Vncviewer*fullScreen: True&lt;br /&gt;
Vncviewer*grabKeyboard: True&lt;br /&gt;
Vncviewer*compressLevel: 7&lt;br /&gt;
&lt;br /&gt;
Vncviewer*qualityLevel: 3&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may need to load these settings explicitly by typing &#039;xrdb ~/.Xresources&#039;.&lt;br /&gt;
&lt;br /&gt;
Next, optionally, check that your home system has an SSH Private Key, and add you SSH Public Key to your office server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# On your home system, type &#039;cat ~/.ssh/id_rsa.pub&#039;.&lt;br /&gt;
# Then, copy that text to the end of the file &#039;~/.ssh/authorized keys&#039; on your office server.&lt;br /&gt;
&lt;br /&gt;
Next, add a &#039;custom launcher&#039; to your GNOME panel on your home system. Set the command to &#039;vncviewer -via yourname@yourserver.example.com&amp;amp;nbsp;:9&#039;. This will use an SSH tunnel to connect to your office machine on port 5909, which is the port that forwards through to your virtual Windows system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TightVNC should now ask you for your VNC password. This is the password you set when installing TightVNC on your virtual Windows system.&lt;br /&gt;
&lt;br /&gt;
After you have entered the password, Windows should show up in a full-screen view of your remote virtual Windows system. To exit from viewing the remote session, enter &#039;F8&#039; then click &#039;Quit viewer&#039;. You can re-launch vncviewer to get your virtual Windows system back again, as long as your SSH tunnel connection to the server is still open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Shutting down virtual Windows ==&lt;br /&gt;
&lt;br /&gt;
To shut down your virtual Windows system, just connect to it as above and shut it down as you would a &#039;real&#039; Windows system. Then, open an SSH connection to your office system and type &#039;screen -r&#039;. This should show up either (a) the still-running &#039;kvm&#039; process or (b) some output, possibly saying &#039;Aborted (core dumped), along with a new command prompt. If KVM is still running, press ctrl-C. Virtual Windows is no longer running&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Restarting your virtual Windows system ==&lt;br /&gt;
&lt;br /&gt;
As for shutting down Virtual windows, open up your &#039;screen&#039; session by typing &#039;screen -r&#039; then re-run &#039;kvm&#039; using the same command as last type (&amp;lt;tt&amp;gt;kvm -redir ...&amp;lt;/tt&amp;gt;). As before, you can close the SSH session once you have started kvm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
The only security issue here is that you have opened up your &#039;work&#039; machine to SSH connections. SSH connections are always encrypted and are secure providing your passwords are secure. If you want to improve security, consider setting your firewall to only accept SSH connection from certain IP addresses or a range of IP addresses.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Miscellany]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=EnzymeKinetics&amp;diff=185</id>
		<title>EnzymeKinetics</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=EnzymeKinetics&amp;diff=185"/>
		<updated>2010-05-13T14:04:37Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Enzyme Kinetics. (work in progress, feel free to add/edit/correct!)&lt;br /&gt;
&lt;br /&gt;
Consider the following enzymatic reaction (E is the enzyme, S the substrate,&lt;br /&gt;
ES an enzyme substrate complex and P the product).  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;{\mathrm{E}} + {\mathrm{S}} {{{\mathrm{k_1}}\atop{\longrightarrow}} \atop{{\longleftarrow}\atop{{\mathrm{k_{-1}}}}}} {\mathrm{ES}} \stackrel{k_2}{\longrightarrow} \mathrm{E} + \mathrm{P} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Michaelis Menten equation&lt;br /&gt;
is often used to calculate the rate of enzymatic reactions and is arrived at using either&lt;br /&gt;
the pseudo steady state (the rate of change of ES with time is small, almost zero)&lt;br /&gt;
or the equilibrium assumption (that ES is always in equilibrium with E and S, the first&lt;br /&gt;
step in the reaction).  We show how this is arrived at and how to solve the equation.&lt;br /&gt;
&lt;br /&gt;
The elementary reactions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d[S]}{dt} = -k_1 [S][E] + k_{-1}[ES]&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d[ES]}{dt} = k_1[S][E] - k_{-1}[ES] - k_2[ES]&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d[E]}{dt} = -k_1 [S][E] + k_{-1}[ES] + k_2[ES]&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d[P]}{dt} = \mathrm{rate} = k_2 [ES] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are two ways to solve for &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;[&#039;&#039;E&#039;&#039;&#039;&#039;S&#039;&#039;]&amp;lt;/span&amp;gt; so we can get a&lt;br /&gt;
rate expression that includes the substrate concentration and parameters&lt;br /&gt;
that can characterize the nature of the enzyme.&lt;br /&gt;
&lt;br /&gt;
The pseudo steady state (PSS) approximation states that we can assume that &lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d[ES]}{dt}&amp;lt;/math&amp;gt; is zero, while the equilibrium &lt;br /&gt;
assumption states that &amp;lt;math&amp;gt;{\mathrm{E}} + {\mathrm{S}} {{{\mathrm{k_1}}\atop{\longrightarrow}} \atop{{\longleftarrow}\atop{{\mathrm{k_{-1}}}}}} {\mathrm{ES}} &amp;lt;/math&amp;gt; is at equilibrium.  Either of these assumptions/approximations will lead you to the&lt;br /&gt;
Michaelis Menten form of the rate expression, written as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;rate = -\frac{dS}{dt} = \frac{dP}{dt} = \frac{V_m S}{K_m + S}&amp;lt;/math&amp;gt; where&lt;br /&gt;
&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;V&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;m&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; can be shown to equal &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;k&#039;&#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&#039;&#039;E&#039;&#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;E&#039;&#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; is the initial concentration of the enzyme &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;K&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;m&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
is &amp;lt;math&amp;gt;\frac{k_{-1}+k_2}{k_1}&amp;lt;/math&amp;gt;. (If you use the equilibrium assumption, &lt;br /&gt;
you get a very similar expression, where the &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;K&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;m&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; is &lt;br /&gt;
&amp;lt;math&amp;gt;\frac{k_{-1}}{k_1}&amp;lt;/math&amp;gt; (PSS is considered a better approximation to use)&lt;br /&gt;
&lt;br /&gt;
The PSS approximation is a good one to make, as long as the substrate&lt;br /&gt;
concentration is much larger than that of the enzyme (you can check this&lt;br /&gt;
by manipulating these concentrations in the model below that includes&lt;br /&gt;
the four differential equations, see what happens if substrate is NOT much &lt;br /&gt;
larger than Enzyme concentration, the PSS assumption breaks down)&lt;br /&gt;
&lt;br /&gt;
In the PyGTK GUI, you can plot any of the dependent variable (Substrate (S), Enzyme (E),&lt;br /&gt;
EnzymeSubstrate Complex (ES) or product (P)) as a function of the independent variable (time)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Michaelis Menten Equation (Simplified Form) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;REQUIRE &amp;amp;quot;ivpsystem.a4l&amp;amp;quot;;&lt;br /&gt;
REQUIRE &amp;amp;quot;atoms.a4l&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL lowKm;&lt;br /&gt;
    dS_dt IS_A rate;&lt;br /&gt;
    Vm IS_A rate;&lt;br /&gt;
&lt;br /&gt;
    Km, S IS_A factor;&lt;br /&gt;
    dS_dt = -Vm*S/(Km + S);&lt;br /&gt;
&lt;br /&gt;
    t IS_A time;&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
    RUN default_self;&lt;br /&gt;
&lt;br /&gt;
    RUN reset; RUN values;&lt;br /&gt;
    RUN set_obs;&lt;br /&gt;
&lt;br /&gt;
    RUN set_ode;&lt;br /&gt;
END on_load;&lt;br /&gt;
&lt;br /&gt;
METHOD default_self;&lt;br /&gt;
&lt;br /&gt;
END default_self;&lt;br /&gt;
METHOD specify;&lt;br /&gt;
    FIX Km, Vm, S;&lt;br /&gt;
&lt;br /&gt;
END specify;&lt;br /&gt;
METHOD values;&lt;br /&gt;
    S := 10.0;&lt;br /&gt;
&lt;br /&gt;
    dS_dt := 0 {Hz};&lt;br /&gt;
    Vm  := 1.0 {1/s};&lt;br /&gt;
&lt;br /&gt;
    Km := 20.0;&lt;br /&gt;
    t   := 0{s};&lt;br /&gt;
END values;&lt;br /&gt;
&lt;br /&gt;
METHOD set_obs;&lt;br /&gt;
    S.obs_id :=1;&lt;br /&gt;
END set_obs;&lt;br /&gt;
&lt;br /&gt;
METHOD setup;&lt;br /&gt;
RUN specify;&lt;br /&gt;
RUN values;&lt;br /&gt;
END setup;&lt;br /&gt;
&lt;br /&gt;
METHOD set_ode;&lt;br /&gt;
    FREE dS_dt;&lt;br /&gt;
    S.ode_id := 1;   dS_dt.ode_id := 1;&lt;br /&gt;
&lt;br /&gt;
    dS_dt.ode_type := 2;&lt;br /&gt;
    S.ode_type := 1;&lt;br /&gt;
&lt;br /&gt;
    t.ode_type :=-1;&lt;br /&gt;
&lt;br /&gt;
END set_ode;&lt;br /&gt;
END lowKm;&lt;br /&gt;
&lt;br /&gt;
MODEL highKm;&lt;br /&gt;
&lt;br /&gt;
    dS_dt IS_A rate;&lt;br /&gt;
    Vm IS_A rate;&lt;br /&gt;
&lt;br /&gt;
    Km, S IS_A factor;&lt;br /&gt;
    dS_dt = -Vm*S/(Km + S);&lt;br /&gt;
&lt;br /&gt;
    t IS_A time;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
&lt;br /&gt;
    RUN default_self;&lt;br /&gt;
    RUN reset; RUN values;&lt;br /&gt;
&lt;br /&gt;
    RUN set_obs;&lt;br /&gt;
    RUN set_ode;&lt;br /&gt;
END on_load;&lt;br /&gt;
&lt;br /&gt;
METHOD default_self;&lt;br /&gt;
END default_self;&lt;br /&gt;
&lt;br /&gt;
METHOD specify;&lt;br /&gt;
&lt;br /&gt;
    FIX Km, Vm, S;&lt;br /&gt;
END specify;&lt;br /&gt;
&lt;br /&gt;
METHOD values;&lt;br /&gt;
    S := 10.0;&lt;br /&gt;
    dS_dt := 0 {Hz};&lt;br /&gt;
&lt;br /&gt;
    Vm  := 1.0 {1/s};&lt;br /&gt;
    Km := 200.0;&lt;br /&gt;
    t   := 0{s};&lt;br /&gt;
&lt;br /&gt;
END values;&lt;br /&gt;
METHOD set_obs;&lt;br /&gt;
    S.obs_id :=1;&lt;br /&gt;
&lt;br /&gt;
END set_obs;&lt;br /&gt;
&lt;br /&gt;
METHOD setup;&lt;br /&gt;
RUN specify;&lt;br /&gt;
RUN values;&lt;br /&gt;
&lt;br /&gt;
END setup;&lt;br /&gt;
&lt;br /&gt;
METHOD set_ode;&lt;br /&gt;
    FREE dS_dt;&lt;br /&gt;
&lt;br /&gt;
    S.ode_id := 1;   dS_dt.ode_id := 1;&lt;br /&gt;
&lt;br /&gt;
    dS_dt.ode_type := 2;&lt;br /&gt;
    S.ode_type := 1;&lt;br /&gt;
&lt;br /&gt;
    t.ode_type :=-1;&lt;br /&gt;
&lt;br /&gt;
END set_ode;&lt;br /&gt;
&lt;br /&gt;
END highKm;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving the Set of Ordinary Differential Equations ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;REQUIRE &amp;amp;quot;ivpsystem.a4l&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
REQUIRE &amp;amp;quot;atoms.a4l&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MODEL simple;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
dES_dt IS_A rate;&lt;br /&gt;
dS_dt IS_A rate;&lt;br /&gt;
&lt;br /&gt;
dP_dt IS_A rate;&lt;br /&gt;
dE_dt IS_A rate;&lt;br /&gt;
k1, k2, km1 IS_A rate;&lt;br /&gt;
&lt;br /&gt;
P, E, S, ES IS_A positive_factor;&lt;br /&gt;
&lt;br /&gt;
eq1: dES_dt = k1*E*S - km1*ES - k2*ES;&lt;br /&gt;
&lt;br /&gt;
eq2: dS_dt = -k1*E*S + km1*ES;&lt;br /&gt;
&lt;br /&gt;
eq3: dP_dt = k2*ES;&lt;br /&gt;
eq4: dE_dt = -k1*E*S + km1*ES + k2*ES;&lt;br /&gt;
&lt;br /&gt;
t IS_A time;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
&lt;br /&gt;
    RUN default_self;&lt;br /&gt;
    RUN specify;&lt;br /&gt;
&lt;br /&gt;
    RUN values;&lt;br /&gt;
&lt;br /&gt;
    RUN set_obs;&lt;br /&gt;
&lt;br /&gt;
    RUN set_ode;&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
&lt;br /&gt;
METHOD default_self;&lt;br /&gt;
END default_self;&lt;br /&gt;
&lt;br /&gt;
METHOD specify;&lt;br /&gt;
&lt;br /&gt;
FIX k1, km1, k2;&lt;br /&gt;
FREE dS_dt, dP_dt, dE_dt, dES_dt;&lt;br /&gt;
&lt;br /&gt;
FREE S, E, P, ES;&lt;br /&gt;
FIX E, S, P, ES;&lt;br /&gt;
&lt;br /&gt;
END specify;&lt;br /&gt;
&lt;br /&gt;
METHOD values;&lt;br /&gt;
    ES := 0;&lt;br /&gt;
&lt;br /&gt;
    P := 0;&lt;br /&gt;
    S := 1.0;&lt;br /&gt;
    E := 0.1;&lt;br /&gt;
&lt;br /&gt;
    dS_dt := 0 {Hz};&lt;br /&gt;
    dES_dt := 0 {Hz};&lt;br /&gt;
&lt;br /&gt;
    dP_dt := 0 {Hz};&lt;br /&gt;
    dE_dt := 0 {Hz};&lt;br /&gt;
&lt;br /&gt;
    k1 := 1.0 {1/s};&lt;br /&gt;
    km1 := 0.02 {1/s};&lt;br /&gt;
&lt;br /&gt;
    k2 := 0.02 {1/s};&lt;br /&gt;
    t   := 0 {s};&lt;br /&gt;
&lt;br /&gt;
END values;&lt;br /&gt;
&lt;br /&gt;
METHOD set_obs;&lt;br /&gt;
    ES.obs_id :=1;&lt;br /&gt;
&lt;br /&gt;
    E.obs_id := 4;&lt;br /&gt;
    S.obs_id := 2;&lt;br /&gt;
&lt;br /&gt;
    P.obs_id := 3;&lt;br /&gt;
END set_obs;&lt;br /&gt;
&lt;br /&gt;
METHOD set_ode;&lt;br /&gt;
&lt;br /&gt;
    S.ode_id := 1;   dS_dt.ode_id := 1;&lt;br /&gt;
&lt;br /&gt;
    ES.ode_id := 2; dES_dt.ode_id := 2;&lt;br /&gt;
&lt;br /&gt;
    E.ode_id := 3; dE_dt.ode_id := 3;&lt;br /&gt;
&lt;br /&gt;
    P.ode_id := 4; dP_dt.ode_id := 4;&lt;br /&gt;
&lt;br /&gt;
    dS_dt.ode_type := 2; dES_dt.ode_type := 2; dP_dt.ode_type := 2; dE_dt.ode_type := 2;&lt;br /&gt;
&lt;br /&gt;
    S.ode_type := 1; E.ode_type := 1; ES.ode_type := 1; P.ode_type := 1;&lt;br /&gt;
&lt;br /&gt;
    t.ode_type :=-1;&lt;br /&gt;
&lt;br /&gt;
END set_ode;&lt;br /&gt;
END simple;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Next-generation_ASCEND_syntax&amp;diff=184</id>
		<title>Next-generation ASCEND syntax</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Next-generation_ASCEND_syntax&amp;diff=184"/>
		<updated>2010-05-13T14:04:26Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{task}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;See [[New Compiler]] for motivation, but this page is about nitty details.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A number of problems with the current system (and its ancient mishmash of Pascal and smalltalk ideas) suggest that a saner way forward than incremental cleanup is to reinvent the language front end and stick with a small language. The ultimate &amp;quot;big language&amp;quot; approach ends with modelica/xml, which we do not care for.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
&lt;br /&gt;
Aiming toward &#039;small-project&#039; and &#039;portability&#039; and &#039;easy to learn&#039; and &#039;integrability&#039;  leads to the following design criteria for a new front-end (input language):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* respell the pedantic keyword style of ascend to something which is ergonomic and still clear.&lt;br /&gt;
* redesign the use of delimiters for concepts not part of normal procedural languages (equations, set notation, annotations, tables) .&lt;br /&gt;
* not expose the user to explicit memory management of the model, unless they are very ambitious.&lt;br /&gt;
* provide for methods which may be written in the full syntax and semantics of a standard ISO language without tortuous usage to refer to the ascend model parts.&lt;br /&gt;
* eliminate the bulk of the hand-coded compiler/interpreter routines-- leave this work to real compilers like C and interpreters like python. Get rid of everything after compiler Pass1.&lt;br /&gt;
&lt;br /&gt;
== One approach: sitting on top of a &#039;base&#039; language ==&lt;br /&gt;
&lt;br /&gt;
Derive from some language which is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* easy to learn.&lt;br /&gt;
* already well known with a large, lightweight (and/or else highly ubiquitous and stable) open-source tool base for developers.&lt;br /&gt;
* capable of being processed with an open-source, easily modified AST-based engine so that a class in the language can be verified for conformance with ascend modeling restrictions/practices.&lt;br /&gt;
* capable of being compiled to binary, to avoid our maintenance of an interpreter.&lt;br /&gt;
* capable of supporting multithreaded use, for performance on all modern systems.&lt;br /&gt;
* capable of preserving ascend&#039;s dynamic typing and glassbox modeling approaches.&lt;br /&gt;
&lt;br /&gt;
Ben has given up on this approach, because C can&#039;t support it and everything better than C is worse at meeting the big picture requirements.&lt;br /&gt;
Also, what we really want is easy interoperabilty (or embedding) in many languages, not just one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Possible base languages ===&lt;br /&gt;
&lt;br /&gt;
* C++ is the most obvious choice to meet the above criteria, but critically fails the AST-based engine criterion.&lt;br /&gt;
* (Abbot went this route) Java is a possibility, but is slow and the common editing environments for it are anything but lightweight.&lt;br /&gt;
* Ruby/Python are persistently tempting but so persistently inconsistent that portability is an big issue.&lt;br /&gt;
* Fortran 20xx is a possibility, since it has an open-source parser, but then it adds a lot of baggage if we want to apply autodifferentiation.&lt;br /&gt;
* C and objective-c, unlike c++, is very parseable and otherwise has the large array of tools needed. The base language compiler error messages are nearly useless, but with an appropriate ASCEND frontend, this could be much improved. In particular, if our dialect of C explicitly bans end-user use of the C preprocessor, much becomes simpler.&lt;br /&gt;
&lt;br /&gt;
Prototyping with several of these, however, show that grafting introspection on to any of the binary-oriented languages ultimately leads to madness. So the alternative is to consider designing a very small language with no imperative statements but eliminate the bulk of the instance structure management by targeting a base language the routine user does not see. The methods section becomes a plain text block that, with perhaps minor automated edits, is then valid code passed to the base language compiler.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* An alternative approach would be to use one of ML, Haskell (or a strict version thereof), or Scheme as a base language. These have the advantages that parsing, analysis, automatic type inference (the used kind for a static type system to as to minimize user type annotations), and generally everything related to programming and reasonable compilation become much easier. Also, if say a miniature strict version of haskell were used, the monad abstraction would be useful for tracking dependencies of what needed to be reevaluated etc when parameters of a model are reset.  Additionally with either of these functional languages as substrate, it&#039;d be relatively simple to add some sort of notion of having units for values that can be checked statically/dynamically. (eg m^2, ft, etc). They are also good languages for metaprogramming etc, though very very different approaches are taken in each of the three.&lt;br /&gt;
&lt;br /&gt;
== Eliminate the instantiator bulkiness and thinking about instance memory management issues ==&lt;br /&gt;
&lt;br /&gt;
The maintenance nightmare which is the compiler could be substantially reduced by having a grammar which is simpler and turning the compiler into a family of code generators. Instantiating a model is then just passing processed models through an output phase and running python or gcc or ... on them. &#039;&#039;&#039;In this approach, memory management of the instantiation becomes the responsibility of the target language-- ascend is no longer creating a canonical instance tree (beyond Pass1 of the current compiler which is essentially an AST expansion) on which external languages act through limited APIs.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &#039;Designing out&#039; maintenance errors ==&lt;br /&gt;
&lt;br /&gt;
Simple naming error introduced in maintenance are typically caught by the parser or instantiation. Block nesting errors, on the other hand, are very easy to introduce and often hard to find (or correct if not introduced by the same coder). Syntax can eliminate most such errors by eliminating ambiguity in block end matching. ASCEND4 has the feature. Some people would try to improve it. [[BetterBlockSyntax]] alternatives are discussed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Eliminate redundant typing ==&lt;br /&gt;
&lt;br /&gt;
Type declaration in ascend is currently clunky, due to its pascal-ish nature and its long, underscored keywords. Going with any of the mainstream languages is equally clunky. Consider the alternate example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;// assume any ascend4 feature you don&#039;t see revised here will pretty much carry over unmodified (except perhaps lowercase).&lt;br /&gt;
// note that if we can get the sections defined properly, we may be able to use &#039;=&#039; a lot of places unambiguously with one&lt;br /&gt;
// meaning of &#039;=&#039; defined in each section.&lt;br /&gt;
model b&lt;br /&gt;
 ...&lt;br /&gt;
ledom&lt;br /&gt;
atom pressure extends real&lt;br /&gt;
  ...&lt;br /&gt;
mota&lt;br /&gt;
model c&lt;br /&gt;
  x1, x2, q: real;&lt;br /&gt;
ledom&lt;br /&gt;
model a (somename&amp;amp;nbsp;: symbol_constant) extends c&lt;br /&gt;
  // sections are with keywords changes, submodels, variables, equations boundaries, methods, etc.&lt;br /&gt;
  // everything is declared with a (label: type;) where label may be one or more names. type may be parameterized.&lt;br /&gt;
 interface-&lt;br /&gt;
   // stuff so we can have more than one parameterization of a type.&lt;br /&gt;
   // semantics to be determined. Does an &#039;a&#039; with multiple interfaces yield multiple (implicit) type definitions?&lt;br /&gt;
   // Is the member list of a type the union of all defined interfaces?&lt;br /&gt;
   // Can a name be willbe in one interface and isa in another?&lt;br /&gt;
   // When is an instance created by one interface going to be mergeable with one created by another interface?&lt;br /&gt;
 changes-&lt;br /&gt;
   q: pressure; // IRT&lt;br /&gt;
   x1, x2: merged; // ats&lt;br /&gt;
   q, x1: alike; // AA (with refinement side effects).&lt;br /&gt;
   x2: findtype(somename); // dynamic kind irt. currently requires passing a prototype instance.&lt;br /&gt;
 submodels-&lt;br /&gt;
   bpart: b;    &lt;br /&gt;
 constants-&lt;br /&gt;
   s: string; // symbol&lt;br /&gt;
   order: int; // integer&lt;br /&gt;
 variables-&lt;br /&gt;
   b1: real;&lt;br /&gt;
   b: pressure;&lt;br /&gt;
   y; // implicit double var named y, or error. design choice &lt;br /&gt;
 equations-&lt;br /&gt;
   e1: 2*y = z;&lt;br /&gt;
 boundaries-&lt;br /&gt;
   bnd1: y &amp;amp;gt; b;  &lt;br /&gt;
 invariant:&lt;br /&gt;
   // statements about structure that downstream refinements must not violate at any time&lt;br /&gt;
 analyzers-&lt;br /&gt;
   // Definition of OODB-style queries and manipulation of results, eg for building dynamic solver-oriented structures.&lt;br /&gt;
   // Any item defined in analysis may be referred to in another analysis, but not in model-declarative sections.&lt;br /&gt;
   // An analysis is not part of the implicit, dynamic typing of ascend instances.&lt;br /&gt;
   // numeric operators on lists for gradients, blocking, hessians, residuals, etc.&lt;br /&gt;
   // multi-d arrays of dimensionless numbers with C indexing or ranging ala fortran. slicing ala fortran?&lt;br /&gt;
   // border-issue: where do we leave off and have matlab/octave begin?&lt;br /&gt;
   // call() for standard numeric libraries or gate it out to procedural code receiving operator objects? &lt;br /&gt;
   //// Arguably, all this is doable from any of the tri-semicolon languages, but why not canonicalize the&lt;br /&gt;
   //// query operations in a form reusable and composable from all target languages?&lt;br /&gt;
   analysis newton(self)&lt;br /&gt;
     rlist = collect(basetype=relation);&lt;br /&gt;
     eqlist = filter(rlist, .included==true, .token[0] == EQ);&lt;br /&gt;
   done&lt;br /&gt;
 methods-&lt;br /&gt;
&amp;amp;nbsp;;;;c;;;&lt;br /&gt;
   //  c-ish code here.  basically, pasted into output of conversion to C of the declarative code.&lt;br /&gt;
&amp;amp;nbsp;;;;;;;&lt;br /&gt;
&amp;amp;nbsp;;;;python;;;&lt;br /&gt;
   // pythonic code here.&lt;br /&gt;
&amp;amp;nbsp;;;;;;;&lt;br /&gt;
 method x // old style methods deprecated maybe? They got overloaded with a lot of poorly C-ish crap once extended past simple assignments.&lt;br /&gt;
 dohtem // impossible to get right, on purpose. stop using ascend4-style methods.&lt;br /&gt;
 assignments-&lt;br /&gt;
 procedure y (arglist named, typed numeric values and willbe objects only )&lt;br /&gt;
   &#039;&#039;&#039;list&#039;&#039;&#039; = value-expression; // strictly assignments only in this section.&lt;br /&gt;
 end;&lt;br /&gt;
ledom&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we see that the labeling ( colon usage) for equations from ascend 4 as consistently applied to all parts. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* This format is pretty simple to parse: except for eqns, bounds, and optional assigments in the constants section and changes sections,  it is all lists of names, of which the last must be a type. loops and switches are minor extensions on this.&lt;br /&gt;
* no shift key required anywhere, until you get in {} for table and annotation structures.&lt;br /&gt;
* The use of &#039;&#039;&#039;:&#039;&#039;&#039; &#039;&#039;&#039;,&#039;&#039;&#039; and (on section names)&#039;&#039;&#039;-&#039;&#039;&#039; is entirely syntactic sugar and could be omitted.&lt;br /&gt;
&lt;br /&gt;
== Scaling to DAEs, PDEs, and all that ==&lt;br /&gt;
&lt;br /&gt;
The notion of analyzers is powerful, but it cannot capture semantics which are not there in the ascend model. We can add semantics via deriving from specific types, but past attempts in this direction with ascend have not proved highly usable or reusable or extensible-- all the semantics gets buried in C analysis implementations.&lt;br /&gt;
&lt;br /&gt;
The lexing and AST analysis of antlr makes defining and maintaining fancy line-oriented syntaxes for operators, domains, domain surfaces and time limits much easier to prototype and play with. It does nothing, on the other hand, to deal with the underlying discretization data for problems on irregular grids.&lt;br /&gt;
&lt;br /&gt;
[http://chapel.cray.com/ Chapel] is an HPC oriented language with a very interesting history and currently under development by DOE/Cray. It has a lot of constructs intended directly for PDE-related algorithms.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== METHODS ==&lt;br /&gt;
&lt;br /&gt;
=== Using C ===&lt;br /&gt;
&lt;br /&gt;
So C-ish code here is interesting. In particular, there&#039;s the tremendous problem of the end user addressing (correctly every time) some piece of an ascend model from C. To that end, I propose the following simple filtering rule (it might work for python very similarly):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Any complete dot-qualified name appearing in the c-ish code will be checked for existence.&lt;br /&gt;
** If it does not, it will then checked in the model hierarchy (and if found) converted to the proper C reference form.&lt;br /&gt;
** If not found, a warning will come from the ascend C code generator and (invariably) an error will come from the C compiler if the user proceeds.&lt;br /&gt;
** If it does not, it will then checked in the model hierarchy (and if found) converted to the proper C reference form.&lt;br /&gt;
** If not found, a warning will come from the ascend C code generator and (invariably) an error will come from the C compiler if the user proceeds.&lt;br /&gt;
* If it does not, it will then checked in the model hierarchy (and if found) converted to the proper C reference form.&lt;br /&gt;
* If not found, a warning will come from the ascend C code generator and (invariably) an error will come from the C compiler if the user proceeds.&lt;br /&gt;
&lt;br /&gt;
Why? ASCEND model structures are dynamic (though this need not be so for the output C, it probably will be to accommodate using the C-instantiated instance under the current GUIs which may request refinement), so they cannot be converted to nested C structs; they must be converted to structs containing pointers to the child instances. Thus in ascend notation a real named a.b.c would probably end up in C as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;((struct Var *)(self-&amp;amp;gt;childlist[2]-&amp;amp;gt;childlist[3]-&amp;amp;gt;childlist[1]))-&amp;amp;gt;value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a nondynamic c generation, it would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;a.b.c.value&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using Python ===&lt;br /&gt;
&lt;br /&gt;
Not enough thought here yet. Imagine the power, though, if combined with analyzers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Using a native ASCEND language for METHODS ===&lt;br /&gt;
&lt;br /&gt;
Today&#039;s current methods could keep their syntax and be simply converted (on a fully instantiable model) to equivalent native method in any request language for which there is a filter. Otherwise, we have to keep hauling around an interpreter and debugger for our methods. I would prefer to deprecate them and much of the cruft going along that can be better done directly with new &#039;native&#039; tri-semicolon methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &#039;procedures&#039; ===&lt;br /&gt;
&lt;br /&gt;
Get back to the ASCEND3 simple assignments only scheme. Anything else leads to madness best resolved in tri-semicolon code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Proofs of concept ==&lt;br /&gt;
&lt;br /&gt;
Yacc/Lex are completely out of gas when it comes to parser maintainability and extensibility and AST management. Extensibility is a key feature for ASCEND. The only other alternatives going are GLR and ANTLR and boost-spirit. C++ errors are still hopelessly cryptic. ANTLR has an astounding tool stack used heavily in the commercial and scientific computing worlds, including grammar IDE, grammars for C, fortran, Java and C preprocessor. GLR we don&#039;t know enough about.&lt;br /&gt;
&lt;br /&gt;
Thus, two grammars and a set of tree-walkers are required for a satisfying language prototype.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* antlr parser of ascend4.&lt;br /&gt;
* antlr parser of ascend5.&lt;br /&gt;
* tree walker that takes ascend4 parse tree in and puts out equivalent ascend5 tree for all legal ascend4.&lt;br /&gt;
* tree walker that takes ascend5 parse tree in and puts out equivalent libascend (C or python?) object for any instantiable type.&lt;br /&gt;
&lt;br /&gt;
The key to understanding the approach advocated here is that antlr parsers generate (for free) an abstract syntax tree (AST) which is essentially our current &#039;TypeDescription&#039; machinery. Lots (if not all) of the manual goop going on in our yacc &#039;actions&#039; disappears. The AST can then be passed to a series of ANTLR-described filters for type/symbol resolution and semantic validation. The end result of a validation can then be passed to a tree walker (another antlr filter) which follows the type tree to generate an instance tree equivalent to current ascend4 compiler Pass1 where all MODEL, set, and scalar/array instance structures are known. This &#039;partial&#039; instance tree is sufficient to discover the implicit types of all the models and generate non-redundant code in C, python, etc. The model thus becomes exactly equivalent to any other traditionally compiled language in performance, including access to GPUs, GUIs, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample parser ===&lt;br /&gt;
&lt;br /&gt;
John Pye (JP) has done a little bit of a first cut on a possible new ASCEND grammar, [http://ascendcode.cheme.cmu.edu/viewvc.cgi/sandboxes/trunk/antlr/mygrammar.g?view=markup sandboxes/trunk/antlr/mygrammar.g] (open it with ANTLRWorks). The idea was to parse as much as possible, including statements that are given in the wrong place, and to then use suitable error messages to advise the user if the context of their statement is disallowed. Lower-case keywords are used, and operators were simplified a bit. This idea still implements a METHODS language, and has opted for a nice IF..ELSE syntax for conditionals (eliminating [[WHEN]] and [[CONDITIONAL]]) but otherwise, doesn&#039;t bring very much that&#039;s new.&lt;br /&gt;
&lt;br /&gt;
An example of a file that&#039;s supposed to parse using the above grammar is [http://ascendcode.cheme.cmu.edu/viewvc.cgi/sandboxes/trunk/antlr/testmodel.a5c?view=markup sandboxes/trunk/antlr/testmodel.a5c]&lt;br /&gt;
&lt;br /&gt;
JP worked out a framework for relations, expressions, function evaluations (my take on external relations), METHODs (yes, still thinking of keeping those around), declarations, model, and importing of other models and code.&lt;br /&gt;
&lt;br /&gt;
Some ideas that seemed to make sense:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* namespace implementation for imported stuff, as per Python. &amp;quot;import as&amp;quot;...?&lt;br /&gt;
* &#039;import&#039; could replace both REQUIRE and IMPORT.&lt;br /&gt;
* external relations should be replaced by external functions that can be poked into any expression or conditional.&lt;br /&gt;
* relations, assignments, and comparisons should all use the same &#039;=&#039; operator.&lt;br /&gt;
* boolean comparison could be forced using &#039;bool(...)&#039; casting.&lt;br /&gt;
* IF..ELSE statements&lt;br /&gt;
&lt;br /&gt;
Things that will need more thought:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* when external functions return multiple variables, how to do the syntax... thinking that &amp;lt;tt&amp;gt;[var, var,...]&amp;lt;/tt&amp;gt; lists would be appropriate.&lt;br /&gt;
* haven&#039;t given any thought to dealing with arrays yet&lt;br /&gt;
* was trying to think about METHOD declarations that could require parameters as inputs, for use from other methods. Am too naive to know how much work would be involved in permitting declaration of local variables within METHODs&lt;br /&gt;
* haven&#039;t yet attempted FOR-loops.&lt;br /&gt;
* parametric MODELs need lots more thought as well&lt;br /&gt;
* what do to with constants?&lt;br /&gt;
* what do about meta-model data like [[NOTES]], icon info, solve directives, etc?&lt;br /&gt;
&lt;br /&gt;
We would hope to replace the current compiler with a sequence of AST tree-walkers: checking the context of things, checking and assigning identifiers, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== First cut at ASCEND4 parser using ANTLR ===&lt;br /&gt;
&lt;br /&gt;
Here&#039;s my first cut at this. No actions, just a grammar. No syntax errors, but not tested/debugged on real model files yet -- [[User:Jpye]]&lt;br /&gt;
&lt;br /&gt;
* [http://ascendcode.cheme.cmu.edu/viewvc.cgi/sandboxes/trunk/antlr/ascend4.g?view=markup sandboxes/trunk/antlr/ascend4.g]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Proposed]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Category:Tutorials&amp;diff=183</id>
		<title>Category:Tutorials</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Category:Tutorials&amp;diff=183"/>
		<updated>2010-05-13T14:04:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div id=&amp;quot;mw-pages&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Pages in category &amp;quot;Tutorials&amp;quot;&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following 8 pages are in this category, out of 8 total.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;H&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[How to begin modelling with ASCEND]]&lt;br /&gt;
&amp;lt;h3&amp;gt;T&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[TclTk Quick Guide]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;T cont.&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Thin-walled tank]]&lt;br /&gt;
* [[Thin-walled tank/Adding methods to a model]]&lt;br /&gt;
* [[Thin-walled tank/Arrays]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;T cont.&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Thin-walled tank/Building complex models]]&lt;br /&gt;
* [[Thin-walled tank/Introduction]]&lt;br /&gt;
* [[Thin-walled tank/Parameterized models]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 [[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Object-oriented_modelling&amp;diff=182</id>
		<title>Object-oriented modelling</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Object-oriented_modelling&amp;diff=182"/>
		<updated>2010-05-13T14:04:04Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;stub&amp;quot;&amp;gt;&#039;&#039;This article is a &#039;&#039;&#039;stub&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Object-oriented_modelling&amp;amp;action=edit expanding it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
This page overviews the object-oriented capabilities of ASCEND.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;tt&amp;gt;MODEL&amp;lt;/tt&amp;gt;s built from &amp;lt;tt&amp;gt;MODEL&amp;lt;/tt&amp;gt;s ==&lt;br /&gt;
The simplest object-oriented capability of ASCEND is to create models as aggregates of smaller models:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL tank;&lt;br /&gt;
    V IS_A volume;&lt;br /&gt;
    rho IS_A density;&lt;br /&gt;
&lt;br /&gt;
    mdot IS_A mass_rate;&lt;br /&gt;
    Vdot IS_A volume_rate;&lt;br /&gt;
    Vdot = mdot * rho;&lt;br /&gt;
&lt;br /&gt;
END tank;&lt;br /&gt;
&lt;br /&gt;
MODEL pipe;&lt;br /&gt;
    mdot IS_A mass_rate;&lt;br /&gt;
&lt;br /&gt;
    rho IS_A density;&lt;br /&gt;
END pipe;&lt;br /&gt;
&lt;br /&gt;
MODEL tank_and_pipe;&lt;br /&gt;
&lt;br /&gt;
    T IS_A tank;&lt;br /&gt;
    P IS_A pipe;&lt;br /&gt;
    T.rho, P.rho ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
    P.mdot, T.mdot ARE_THE_SAME;&lt;br /&gt;
END tank_and_pipe;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Model refinement ==&lt;br /&gt;
&lt;br /&gt;
As well as aggregating models to producing models from smaller parts, one can refine a model of one type to make something more specialised, using the [[REFINES]] keyword.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL vessel REFINES tank;&lt;br /&gt;
&lt;br /&gt;
    p IS_A pressure;&lt;br /&gt;
    R IS_A gas_constant;&lt;br /&gt;
    n IS_A factor;&lt;br /&gt;
&lt;br /&gt;
    T IS_A temperature;&lt;br /&gt;
    p*V = n * R * T;&lt;br /&gt;
&lt;br /&gt;
    T_amb IS_A temperature;&lt;br /&gt;
    T = T_amb + 20 {K};&lt;br /&gt;
&lt;br /&gt;
END vessel;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, both new variables and new relations were added. Note that it is possible only to add new relations;  relations in base models can not be removed in refinements of the base model (although using the &amp;lt;tt&amp;gt;included&amp;lt;/tt&amp;gt; property of a relations, one can gain something like that ability).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameterised models ==&lt;br /&gt;
&lt;br /&gt;
Models can be set up so that they require certain externally-defined parameters at the time when they are instantiated. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL pump(&lt;br /&gt;
    in WILL_BE pressurepipe;&lt;br /&gt;
    out WILL_BE pressurepipe;&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
    dp IS_A pressure;&lt;br /&gt;
    out.p = in.p + dp;&lt;br /&gt;
&lt;br /&gt;
END pump;&lt;br /&gt;
&lt;br /&gt;
MODEL pumped_thing;&lt;br /&gt;
    L1, L2 IS_A pressurepipe;&lt;br /&gt;
&lt;br /&gt;
    P IS_A pump(L1,L2);&lt;br /&gt;
END pumped_thing;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These models show that for parameterised (ie parametric) models, you must first declare the sub-models using &amp;lt;tt&amp;gt;IS_A&amp;lt;/tt&amp;gt; declarations, then you can place them into your parameterised declaration as &amp;lt;tt&amp;gt;pump(L1,L2)&amp;lt;/tt&amp;gt;, which is the name of the &#039;&#039;type&#039;&#039; of model, followed by the specific &#039;&#039;instances&#039;&#039; of the parameters you want.&lt;br /&gt;
&lt;br /&gt;
Further refinement of parametric models is possible using a [[WHERE]] clause following the [[REFINES]] clause.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Refinements after declaration ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;IS_REFINED_TO&amp;lt;/tt&amp;gt; declaration allows one to start off by declaring a part to be a base-type and then refine that part to be a more specialised type with a subsequent call. This allows for example arrays of hetergeneous objects to be created.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL flow_sequence;&lt;br /&gt;
&lt;br /&gt;
    E[1..3] IS_A flow_equipment;&lt;br /&gt;
    E[1].out, E[2].in ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
    E[2].out, E[3].in ARE_THE_SAME;&lt;br /&gt;
    E[2] IS_REFINED_TO flow_meter;&lt;br /&gt;
&lt;br /&gt;
    E[1] IS_REFINED_TO flow_pump;&lt;br /&gt;
    E[3] IS_REFINED_TO flow_tank;&lt;br /&gt;
&lt;br /&gt;
END flow_sequence;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The more specialised types (here flow_meter, flow_pump and flow_tank) must be refinements of flow_equipment - e.g., &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL flow_meter REFINES flow_equipment;&lt;br /&gt;
&lt;br /&gt;
    ....;&lt;br /&gt;
END flow_meter;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Refinements and merges after instantiation ==&lt;br /&gt;
&lt;br /&gt;
ASCEND model instances are dynamically typed. While using a compiled model instance, and using the Tcl/Tk GUI for ASCEND, any instance part can be interactively merged with another compatible part or refined to a derived type to debug the model. This allows interactive exploration of the mathematics without requiring a rewrite of the input files at every step. This practice is not universally endorsed, but the Script logging capability guarantees that all such changes can be captured by the careful modeler and the final set reintegrated in the model source files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Stubs]]&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Steam_properties&amp;diff=181</id>
		<title>Steam properties</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Steam_properties&amp;diff=181"/>
		<updated>2010-05-13T14:03:54Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Background ==&lt;br /&gt;
&lt;br /&gt;
In order to accurately model large-scale power systems such as boilers and steam turbines, accurate correlations for steam properties are required. The [http://www.iapws.org International Association for the Properties of Water and Steam] has industry-standard correlations for water and steam properties at pressures up to 10MPa and temperatures up to 1073 K. Higher temperatures are possible too, but not at the full range of pressures. These correlations are in many cases stipulated requirements when consulting engineers are contracted to perform analysis - in order that competing proposals are competing on a fair basis. In large-scale design, even quite small variations in steam properties can result in large differences in overall cost estimates.&lt;br /&gt;
&lt;br /&gt;
The current {{src|models/thermodynamics.a4l}} library in ASCEND does not allow for compressibility of liquids and is therefore too simplistic for use at the elevated pressures seen in large-scale power systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Connection to freesteam ==&lt;br /&gt;
&lt;br /&gt;
[http://freesteam.sourceforge.net Freesteam] provides a free open-source implementation of the standard IAPWS IF-97 steam properties correlations for use with ASCEND via the [[external relation]] mechanism. Example models using these property correlations include those in {{src|models/johnpye/rankine.a4c}}, which demonstrate a range of steam power cycle calculations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== IAPWS-95 Implementation ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;outdated&amp;quot; style=&amp;quot;border:solid 2pt #FDB; width:70ex; background-color:#FFF8F4;padding:4px;margin-bottom:6px&amp;quot;&amp;gt;&#039;&#039;This section is &#039;&#039;&#039;outdated&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Steam_properties&amp;amp;action=edit updating it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [http://www.iapws.org/relguide/IAPWS95.pdf IAPWS-95 (pdf)] steam properties correlations have been implemented and can currently be used to obtain properties of single-phase steam. We are working on getting a stable two-phase model that is able to correctly accomodate the saturated region using a separate IAPWS correlation for the [http://www.iapws.org/relguide/supsat.pdf saturation curves (pdf)].&lt;br /&gt;
&lt;br /&gt;
This work in ASCEND is to facilitate modelling of solar thermal and conventional power station systems. &lt;br /&gt;
&lt;br /&gt;
For further information about IAPWS correlations and a list of some other IAPWS-savvy software, see [http://freesteam.sourceforge.net Freesteam].&lt;br /&gt;
&lt;br /&gt;
To see the current state of the steam tables work, go over to John Pye&#039;s ASCEND models at {{srcdir|models/johnpye}}.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other implementations ==&lt;br /&gt;
&lt;br /&gt;
There is some interesting information to be gleaned from the Modelica ThermoFluid library, [http://sourceforge.net/projects/thermofluid]. This set of Modelica/Dymola models includes IAPWS-IF97 as well as some interesting although very complex approaches to the problems of modelling thermodynamic processes involving water and steam.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Thermodynamics with ASCEND]]&lt;br /&gt;
* [http://freesteam.sourceforge.net freesteam]&lt;br /&gt;
* [http://cantera.sourceforge.net/documentation.html Cantera] (a C++/Python chemical reactions toolkit)&lt;br /&gt;
* Sublimation curve from IAPWS: {{src|models/johnpye/sublimation.a4c}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Outdated]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Regression_Testing&amp;diff=180</id>
		<title>Regression Testing</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Regression_Testing&amp;diff=180"/>
		<updated>2010-05-13T14:03:44Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;outdated&amp;quot; style=&amp;quot;border:solid 2pt orange; width:70ex; background-color:#FFEEDD;padding:4px;margin-bottom:6px&amp;quot;&amp;gt;&#039;&#039;This article is &#039;&#039;&#039;outdated&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Regression_Testing&amp;amp;action=edit updating it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Historically, ASCEND was developed by a small group of tightly-coordinated members of the [[Art Westerberg]] research group.  Individualized &#039;&#039;ad hoc&#039;&#039; testing of modules and successful running of test models was adequate under this development model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As the ASCEND project grows, we anticipate that more of our developers will be unfamiliar with parts of the code, and for this reason we want to move towards providing a regression/unit testing suite for ASCEND. This is aim to prevent bugs from re-emerging by testing for expected behaviour following an applied fix (regression tests) and thoroughly testing the behaviour of a component currently under development (unit testing, test-driven development).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preliminary test suite ==&lt;br /&gt;
&lt;br /&gt;
Jerry has implemented testing of parts of the ASCEND codebase. To run the tests, read about [[BuildingAscend]] then try the following commands:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/src/ascend/trunk;&lt;br /&gt;
scons WITH_CUNIT_TESTS=1&lt;br /&gt;
./base/generic/test/test&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following tests are currently implemented:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;[root@cruncher2 generic]# ls &#039;&#039;&#039;/test/test_&#039;&#039;&#039;.c&lt;br /&gt;
general/test/test_dstring.c                       utilities/test/test_asc[[DynaLoad]].c&lt;br /&gt;
general/test/test_hashpjw.c                       utilities/test/test_asc[[DynaLoad]]_shlib.c&lt;br /&gt;
general/test/test_list.c                                  utilities/test/test_asc[[EnvVar]].c&lt;br /&gt;
general/test/test_listio.c                              utilities/test/test_ascMalloc.c&lt;br /&gt;
general/test/test_pool.c                                  utilities/test/test_ascPanic.c&lt;br /&gt;
general/test/test_pretty.c                              utilities/test/test_ascPrint.c&lt;br /&gt;
general/test/test_register_general.c  utilities/test/test_ascSignal.c&lt;br /&gt;
general/test/test_stack.c                                utilities/test/test_mem.c&lt;br /&gt;
general/test/test_table.c                                utilities/test/test_readln.c&lt;br /&gt;
general/test/test_tm_time.c                       utilities/test/test_register_utilities.c&lt;br /&gt;
solver/test/test_register_solver.c       utilities/test/test_set.c&lt;br /&gt;
solver/test/test_slv_common.c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;re looking at how best to integrate tests like this into an automatic testing process. The C-based tests don&#039;t provide easy cross-system reporting as Python-based tests suites do.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Strategy for Regression/Unit Testing ==&lt;br /&gt;
&lt;br /&gt;
Unfortunately, the size and complexity of ASCEND makes manually retrofitting a test suite an enormous task.  That&#039;s not to say that it isn&#039;t worth doing, just that it will consume considerable resources.  The availability of an automated testing tool would help a lot, but may not be easily available.&lt;br /&gt;
&lt;br /&gt;
A possible approach to implementing a test suite would be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# identify the best testing protocol(s) to use for ASCEND&lt;br /&gt;
# prototype the protocol(s) for a limited subset of ASCEND&lt;br /&gt;
# implement test-driven development of new code&lt;br /&gt;
# implement tests for legacy code&lt;br /&gt;
&lt;br /&gt;
Here are some general testing approaches that could be used.  Please add to the list and edit the topics to discuss ideas, preferences, experiences, etc. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[StaticCodeAnalysis]]&lt;br /&gt;
* [[ManualTestingFrameworks]]&lt;br /&gt;
* Automated Testing Tools: we currently have [[BuildBot]] installed.&lt;br /&gt;
&lt;br /&gt;
== ASCEND Model Self-Testing ==&lt;br /&gt;
&lt;br /&gt;
Some work is also underway to implement a tool which will find models containing their own &#039;self-testing&#039; methods, and run those tests. This will be a higher-level complement to the low-level tests offered here, and will be used to verify the language features are working correctly.&lt;br /&gt;
&lt;br /&gt;
See [[ModelSelfTesting]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Python Test Suite ==&lt;br /&gt;
&lt;br /&gt;
A python test suite is being developed using the &amp;lt;tt&amp;gt;unittest&amp;lt;/tt&amp;gt; framework, and is growing quickly to cover parts of the code not currently covered by the CUnit tests. The Python test suite will ultimately sweep in the above [[ModelSelfTesting]] as well.&lt;br /&gt;
&lt;br /&gt;
To run the Python test suite, build the Python bindings for ASCEND (type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt;) then run &amp;lt;tt&amp;gt;python pygtk/test.py&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Buildbot ==&lt;br /&gt;
&lt;br /&gt;
A buildbot has been set up which automatically compiles ASCEND and runs the CUnit and Python test suites each time changes are committed to the Subversion repository. See [[BuildBot]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;a href=&amp;quot;/images/b/b1/Pycunit-0.2-1.src.rpm&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Pycunit-0.2-1.src.rpm&amp;quot;&amp;gt;Media:pycunit-0.2-1.src.rpm&amp;lt;/a&amp;gt;&lt;br /&gt;
* &amp;amp;nbsp;%META:FILEATTACHMENT{name=&amp;quot;pycunit-0.2.tar.gz&amp;quot; attr=&amp;quot;&amp;quot; comment=&amp;quot;Source tarball&amp;quot; date=&amp;quot;1167471650&amp;quot; path=&amp;quot;pycunit-0.2.tar.gz&amp;quot; size=&amp;quot;18916&amp;quot; user=&amp;quot;johnpye&amp;quot; version=&amp;quot;1.1&amp;quot;}%&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Outdated]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=WILL_BE_THE_SAME&amp;diff=179</id>
		<title>WILL BE THE SAME</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=WILL_BE_THE_SAME&amp;diff=179"/>
		<updated>2010-05-13T14:03:34Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WILL_BE_THE_SAME&#039;&#039;&#039; is used in [[object-oriented modelling]] to force equality of parameter instances within the [[WHERE]] list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL constant_flow_rate(&lt;br /&gt;
    inlet IS_A steam_stream;&lt;br /&gt;
    outlet IS_A mass_rate;&lt;br /&gt;
&lt;br /&gt;
) REFINES steam_equipment(inlet, outlet)&lt;br /&gt;
WHERE(&lt;br /&gt;
    inlet.mdot, outlet.mdot WILL_BE_THE_SAME&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
    mdot ALIASES inlet.mdot;&lt;br /&gt;
&lt;br /&gt;
    (* ... *)&lt;br /&gt;
END constant_flow_rate;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[WILL_BE]], [[ARE_THE_SAME]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Real-time_ASCEND/Solver&amp;diff=178</id>
		<title>Real-time ASCEND/Solver</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Real-time_ASCEND/Solver&amp;diff=178"/>
		<updated>2010-05-13T14:03:24Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;amp;larr;back to [[Real-time ASCEND]].&lt;br /&gt;
&lt;br /&gt;
Contributed by: [[Dipak Chirmade]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Real-time solver ==&lt;br /&gt;
&lt;br /&gt;
=== Runge Kutta based single step solver ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039; Work in progress! &#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Real-time solver using Runge Kutta method is currently implemented as an extern method for initial testing purpose. &lt;br /&gt;
Building a stand alone real-time solver is already in progress.&lt;br /&gt;
&lt;br /&gt;
Using real-time data reader, one can calculate dCoffee/dt for cooling of coffee example. From initial test, I have collected following logs&lt;br /&gt;
Source:[http://ascendcode.cheme.cmu.edu/viewvc.cgi/code/branches/dipak/models/dipak/Workspace_Broken/sensorreadings.logs &amp;lt;font color=&amp;quot;orange&amp;quot;&amp;gt;dipak&amp;lt;/font&amp;gt;:models/dipak/Workspace_Broken/sensorreadings.logs]&lt;br /&gt;
&lt;br /&gt;
If we calculate dCoffee/dt we can get a graph as shown in following diagram &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:602px;&amp;quot;&amp;gt;[[Image:DTCoffee.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:DTCoffee.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Rate of change of coffee temperature with reference to environment temperature.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Todo: Application: Once we have dCoffee/dt, we can solve &#039;&#039;&#039;model&#039;&#039;&#039; like following &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;Qdot = h A (T_coffee - T_amb)&lt;br /&gt;
&lt;br /&gt;
Qdot = - m_coffee * cp_coffee * dT_coffee / dt&lt;br /&gt;
&lt;br /&gt;
where Qdot is the heat transfer rate&lt;br /&gt;
  h is the convection coefficient&lt;br /&gt;
  A is the heat transfer surface area&lt;br /&gt;
  T_coffee and T_amb are the coffee (+ cup) and ambient air temperatures, respectively.&lt;br /&gt;
&lt;br /&gt;
  m_coffee is the mass of the coffee + cup&lt;br /&gt;
  cp_coffee is the average specific heat capacity of the cup + coffee etc&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Following graph shows simulated results from real-time solver Vs real-reading over 10 mins of time slot. &lt;br /&gt;
&lt;br /&gt;
Source can be found at: Source:[http://ascendcode.cheme.cmu.edu/viewvc.cgi/code/branches/dipak/models/dipak/RealtimeSolver &amp;lt;font color=&amp;quot;orange&amp;quot;&amp;gt;dipak&amp;lt;/font&amp;gt;:models/dipak/RealtimeSolver]&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:602px;&amp;quot;&amp;gt;[[Image:RK_Solver.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:RK_Solver.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Simulated results after 1*10 steps vs real reading&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, prediction after 1st step starts differing than actual measured reading meaning we needed to tune the step to get accurate simulated results.&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Main_Page&amp;diff=177</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Main_Page&amp;diff=177"/>
		<updated>2010-05-13T14:03:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;thumb tright&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:307px;&amp;quot;&amp;gt;[[Image:Main-screenshot.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Main-screenshot.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;The main window of the [[PyGTK GUI]] for ASCEND. There are [[PyGTK_Screenshots|more screenshots]].&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ASCEND is an free open-source software program for solving small to very large mathematical models. ASCEND can solve systems of non-linear equations, linear and nonlinear optimisation problems, and dynamic systems expressed in the form of differential/algebraic equations.&lt;br /&gt;
&lt;br /&gt;
There is an &#039;&#039;&#039;[[ASCEND_overview|ASCEND Overview]]&#039;&#039;&#039; with more information about ASCEND capabilities. Alternatively, you can look at some [[PyGTK_Screenshots|screenshots]] or some [[Worked_examples|example problems]] solved using ASCEND.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width: 36em; padding-top:8px;padding-bottom:12px; border:solid 2pt gray;background-color:#ffff88;margin-top:5px;margin-bottom:5px;padding:8px&amp;quot;&amp;gt;&#039;&#039;&#039;Current version 0.9.7&#039;&#039;&#039;: [http://sourceforge.net/project/platformdownload.php?group_id=167528 Download] (Windows, Linux, Mac)&amp;lt;br /&amp;gt;&amp;lt;small&amp;gt;Please read the [[Quick_Start|Installation notes]]!&amp;lt;/small&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&#039;&#039;&#039;News flash:&#039;&#039;&#039;&amp;lt;/font&amp;gt; ASCEND has been accepted into [http://socghop.appspot.com/ Google Summer of Code 2010]! Students who have applied should &#039;watch&#039; [[GSOC2010|our GSOC2010 page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== In this wiki... ==&lt;br /&gt;
&lt;br /&gt;
* some new [[Category:Documentation|user&#039;s documentation]] (in progress)&lt;br /&gt;
* some information on the various ASCEND [[solvers]].&lt;br /&gt;
* the [[Worked examples]] and the [[ModelLibrary]] for some examples of what you can do with ASCEND.&lt;br /&gt;
* information on [[Building ASCEND]] from the source code&lt;br /&gt;
* information about extending ASCEND using [[external libraries]].&lt;br /&gt;
* read about current [[Development activities]].&lt;br /&gt;
* the [[Developer%27s_Manual|Developer&#039;s Manual]] in progress.&lt;br /&gt;
* some ideas for [[Student Projects]] working on ASCEND.&lt;br /&gt;
* please &#039;&#039;&#039;[[Debugging_ASCEND|report a bug]]&#039;&#039;&#039; if you find one.&lt;br /&gt;
&lt;br /&gt;
This [http://en.wikipedia.org/wiki/Wiki wiki] is open to contributions from anyone. All we ask is that you [[Special:UserLogin|register]] with your email address. Note that there is some earlier content from our [http://ascend.cheme.cmu.edu/ascend_about.htm previous website] gradually being migrated to this wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Get the source code ==&lt;br /&gt;
&lt;br /&gt;
Source code (as well as binary) releases are available from our [http://sourceforge.net/projects/ascend-sim/files/ download page] on SourceForge.&lt;br /&gt;
&lt;br /&gt;
Open access to our [[VersionManagement|subversion repository]] is available, or you can [http://ascendcode.cheme.cmu.edu/ browse our code online].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Send us your ASCEND models ==&lt;br /&gt;
&lt;br /&gt;
We are working on expanding our [[ASCEND Model Library]]. If you have used ASCEND to solve a relatively common problem, your model will probably be of use to other users. Please contact [[Art Westerberg]] or one of the other developers if you are interested in sharing any models that you might have developed.&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Thin-walled_tank/Arrays&amp;diff=176</id>
		<title>Thin-walled tank/Arrays</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Thin-walled_tank/Arrays&amp;diff=176"/>
		<updated>2010-05-13T14:03:05Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float:right;width:33ex;padding-left:3px;margin-left:10px;margin-bottom:10px;border:solid 2pt grey;background-color: #eee&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Thin-walled tank tutorial&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;small&amp;gt;[[Thin-walled_tank|&amp;amp;larr;Return to start]]&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Thin-walled_tank/Introduction|Introduction]]&lt;br /&gt;
* [[Thin-walled_tank/Adding_methods_to_a_model|Adding methods to a model]]&lt;br /&gt;
* &amp;lt;strong class=&amp;quot;selflink&amp;quot;&amp;gt;Arrays&amp;lt;/strong&amp;gt;&lt;br /&gt;
* [[Thin-walled_tank/Building_complex_models|Building complex models]]&lt;br /&gt;
* [[Thin-walled_tank/Parameterized_models|Parameterised models]]&lt;br /&gt;
&lt;br /&gt;
See also [[Category:Tutorials|Other tutorials]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
See also [[Arrays and sets]].&lt;br /&gt;
&lt;br /&gt;
Often we want to write a model containing the same type of part repeatedly.  We introduce arrays along with the ability to write loops to allow us to write the model code one time, where we index the code over the elements.&lt;br /&gt;
&lt;br /&gt;
Also we often wish to characterize an entity built out of an arbitrary number of repeating units.  For example, a hotel chain might wish to design a type of hotel building whose number of floors and number of units on each floor is arbitrary - within limits - but whose guest rooms are the same for all instances of this type of building.  The model would be an array of rooms over an array of floors.  When using arrays in such a hotel model, we can reference the bottom floor, the top floor, or any floor whose index we can relate to bottom and top - such as the floor at or near the middle - floor (N+1)/2 - without knowing a priori the actual number of floors.  The modeler&#039;s intention could be to code the model, debug that code with different test values for the number of floors and rooms, and then make this model available for others to use.&lt;br /&gt;
&lt;br /&gt;
In ASCEND, we can have arrays of variables and, as with this hotel example, we can have arrays of instances of complex things.  We can have an array of arrays of arrays (of arrays of arrays).&lt;br /&gt;
&lt;br /&gt;
It should be noted that a spreadsheet program is fine for handling arrays with known fixed dimension.  However, a spreadsheet program is not well suited to handle arrays of arbitrary dimension.  We would have to write macros to generate the actual arrays within the spreadsheet once we have decided on the size of the array - something most of us would not be skilled at doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A collection of thin-walled tank farms ==&lt;br /&gt;
&lt;br /&gt;
Okay, we have to stretch a bit to come up with a model based on our thin-walled tank, but modeling a collection of thin-walled tank farms might be one way to have such a need.  We are a company that intends to build tank farms in several key locations throughout the country.  Each farm will have several tanks located at it, and we wish to compute the total metal mass in each location as well as the total overall metal mass.&lt;br /&gt;
&lt;br /&gt;
We shall create our model using the thin_walled_tank model of the previous section.  We first model a tank farm.  Following our earlier approach, we shall write and debug this model before using it as a part of our larger model.  Thus we include a method that can set up a test case for it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL tank_farm;&lt;br /&gt;
&lt;br /&gt;
    NT                  IS_A integer_constant;&lt;br /&gt;
&lt;br /&gt;
    metal_density       IS_A mass_density;&lt;br /&gt;
    metal_mass_farm     IS_A mass;&lt;br /&gt;
&lt;br /&gt;
    tank[1..NT]         IS_A partitioned_thin_walled_tank;&lt;br /&gt;
&lt;br /&gt;
    metal_density, tank[1..NT].metal_density ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
    (* an alternate way to write the above two lines of code would be&lt;br /&gt;
&lt;br /&gt;
        FOR i IN [1..NT] CREATE&lt;br /&gt;
           tank[i]      IS_A partitioned_thin_walled_tank;&lt;br /&gt;
           metal_density, tank[i].metal_density ARE_THE_SAME;&lt;br /&gt;
        END FOR;&lt;br /&gt;
    *)&lt;br /&gt;
&lt;br /&gt;
    massFarm: metal_mass_farm = SUM[tank[1..NT].metal_mass];&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
&lt;br /&gt;
    METHOD specify;&lt;br /&gt;
        FOR i IN [1..NT] DO&lt;br /&gt;
&lt;br /&gt;
            RUN tank[i].specify;&lt;br /&gt;
        END FOR;&lt;br /&gt;
    END specify;&lt;br /&gt;
&lt;br /&gt;
END tank_farm;&lt;br /&gt;
&lt;br /&gt;
MODEL test_tank_farm;&lt;br /&gt;
    tankFarm    IS_A tank_farm;&lt;br /&gt;
&lt;br /&gt;
    tankFarm.NT :==  3;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
&lt;br /&gt;
    METHOD values;&lt;br /&gt;
&lt;br /&gt;
        tankFarm.metal_density              := 7.85 {g/cm^3};&lt;br /&gt;
        tankFarm.tank[1].side.D             := 5 {m};&lt;br /&gt;
&lt;br /&gt;
        tankFarm.tank[2].side.D             := 6 {m};&lt;br /&gt;
&lt;br /&gt;
        tankFarm.tank[3].side.D             := 7 {m};&lt;br /&gt;
&lt;br /&gt;
        tankFarm.tank[1..3].side.H          := 6 {m};&lt;br /&gt;
&lt;br /&gt;
        tankFarm.tank[1..3].wall_thickness  := 1.5 {cm};&lt;br /&gt;
&lt;br /&gt;
    END values;&lt;br /&gt;
    METHOD specify;&lt;br /&gt;
        RUN tankFarm.tank[1..3].specify;&lt;br /&gt;
&lt;br /&gt;
    END specify;&lt;br /&gt;
&lt;br /&gt;
END test_tank_farm;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now model the collection of tank farms specific to our company.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL our_tank_farms;&lt;br /&gt;
&lt;br /&gt;
    locations             IS_A set OF symbol_constant;&lt;br /&gt;
&lt;br /&gt;
    locations             :== [&#039;SanFrancisco&#039;,&#039;St Louis&#039;,&#039;Pittsburgh&#039;];&lt;br /&gt;
&lt;br /&gt;
    total_mass_all_farms  IS_A mass;&lt;br /&gt;
&lt;br /&gt;
    (* set up tank farms *)&lt;br /&gt;
    tankfarm[locations]   IS_A tank_farm;&lt;br /&gt;
    tankfarm[&#039;SanFrancisco&#039;].NT    :== 2;&lt;br /&gt;
&lt;br /&gt;
    tankfarm[&#039;St Louis&#039;].NT        :== 4;&lt;br /&gt;
    tankfarm[&#039;Pittsburgh&#039;].NT      :== 1;&lt;br /&gt;
&lt;br /&gt;
    (* equations *)&lt;br /&gt;
&lt;br /&gt;
    massAllFarms: total_mass_all_farms = SUM[tankfarm[locations].metal_mass_farm];&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
&lt;br /&gt;
    METHOD specify;&lt;br /&gt;
        FOR i IN [locations] DO&lt;br /&gt;
&lt;br /&gt;
            RUN tankfarm[i].specify;&lt;br /&gt;
        END FOR;&lt;br /&gt;
    END specify;&lt;br /&gt;
&lt;br /&gt;
    METHOD valuesSF;&lt;br /&gt;
        tankfarm[&#039;SanFrancisco&#039;].metal_density := 7.85 {g/cm^3};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;SanFrancisco&#039;].tank[1].side.D             := 4.5 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;SanFrancisco&#039;].tank[2].side.D             := 3 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;SanFrancisco&#039;].tank[1..2].side.H         := 6 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;SanFrancisco&#039;].tank[1..2].wall_thickness := 1.5 {cm};&lt;br /&gt;
&lt;br /&gt;
    END valuesSF;&lt;br /&gt;
&lt;br /&gt;
    METHOD valuesSTL;&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].metal_density             := 7.85 {g/cm^3};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[1].side.D            := 4 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[2].side.D            := 4 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[3].side.D            := 5 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[4].side.D            := 5 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[1..2].side.H         := 6 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[3..4].side.H         := 7 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;St Louis&#039;].tank[1..4].wall_thickness := 1.7 {cm};&lt;br /&gt;
&lt;br /&gt;
    END valuesSTL;&lt;br /&gt;
&lt;br /&gt;
    METHOD valuesPIT;&lt;br /&gt;
        tankfarm[&#039;Pittsburgh&#039;].metal_density          := 7.85 {g/cm^3};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;Pittsburgh&#039;].tank[1].side.D         := 8 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;Pittsburgh&#039;].tank[1].side.H         := 10 {m};&lt;br /&gt;
&lt;br /&gt;
        tankfarm[&#039;Pittsburgh&#039;].tank[1].wall_thickness := 1.85 {cm};&lt;br /&gt;
&lt;br /&gt;
    END valuesPIT;&lt;br /&gt;
&lt;br /&gt;
    METHOD values;&lt;br /&gt;
        RUN valuesSF;&lt;br /&gt;
&lt;br /&gt;
        RUN valuesSTL;&lt;br /&gt;
        RUN valuesPIT;&lt;br /&gt;
    END values;&lt;br /&gt;
&lt;br /&gt;
    METHOD setup;&lt;br /&gt;
        RUN specify;&lt;br /&gt;
        RUN values;&lt;br /&gt;
&lt;br /&gt;
    END setup;&lt;br /&gt;
&lt;br /&gt;
END our_tank_farms;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have put these two models together in a file called twt0420.a4c,  Adding in the appropriate INCLUDE statements completes the tank farm model file, which you can test using ASCEND.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Things to observe from this example==&lt;br /&gt;
&lt;br /&gt;
There are a few things we should observe about this example.  For more details on all this, see the [http://ascend.cheme.cmu.edu/ftp/pdfSyntax/new_syntax_body.pdf syntax document for ASCEND] and the wiki page on [[Arrays_and_sets| arrays and sets]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# We indexed the tanks within each farm using integer constants (i.e., of type integer_constant).  We indexed our tank farms using symbol constants.  Both are legal as indices for arrays.&lt;br /&gt;
# We can indicate indices as constants (e.g., 1 or &#039;Pittsburgh&#039;) or for integer constants as ranges (e.g., 1..NT).  Not illustrated is that one can select among array elements with a list, too (e.g., 1..2, 4)&lt;br /&gt;
# We actually set up an interesting two dimensional array in this example.  The first (think of it as being the rows of the array) index is for the tank farms; the second (think of this as being the columns) is over the tanks in each farm.  The number of tanks varies from farm to farm so the array is not rectangular.&lt;br /&gt;
# We reference a row/column element as tank_farm[&#039;St Louis&#039;].tank[2].  Note how clear this reference is; we do not need to wonder what the first index in an array is over - it is over tank farms.&lt;br /&gt;
&lt;br /&gt;
==And other things to know about set handling in ASCEND==&lt;br /&gt;
&lt;br /&gt;
# ASCEND lets you also do some pretty fancy set manipulation, such as forming the UNION, INTERSECTION and DIFFERENCE to form sets as combinations of other sets.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Continue with [[Thin-walled_tank/Parameterized_models|the last section, Parameterised models]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Examples]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=History_of_ASCEND&amp;diff=175</id>
		<title>History of ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=History_of_ASCEND&amp;diff=175"/>
		<updated>2010-05-13T14:02:56Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ASCEND is an acronym which stands for Advanced System for Computations in ENgineering Design.  The name ASCEND first appeared in print in 1978.  The ASCEND programs are a series of modeling systems that Arthur Westerberg and his graduate students at Carnegie Mellon University have developed since that time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ASCEND I===&lt;br /&gt;
&lt;br /&gt;
Dean Benjamin developed the first ASCEND system.  It was an interactive system in Fortran.   Chemical engineering students at Carnegie Mellon University used this system from about 1978 to 1982 to carry out multicomponent flash calculations.  It supported the senior design project.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ASCEND II===&lt;br /&gt;
&lt;br /&gt;
Almost in parallel, Michael Locke developed the ASCEND II simulation system for his PhD thesis [1981].  ASCEND II allowed users to create models by configuring them using predefined types of parts.  System maintainers defined the library of types, each in the form of seven handcrafted Fortran subroutines.  These routines computed the space needed for the data when instancing a part, generated numerical values for the partial derivatives and the residuals of the equations that the part instance provided to the overall model, generated proper variable and equation scaling and the like.  Michael Locke used this system to create models involving a few thousand equations to test variants of the Sequential Quadratic Programming algorithm. Tom Berna and he developed for optimizing structured engineering systems.  Selahattin Kuru also used ASCEND II to generate and test solution algorithms for dynamic simulation that he subsequently developed for his PhD.  Two companies used the software architectural design of ASCEND II to create their own internal equation-based modeling systems.  &lt;br /&gt;
Experience at this time demonstrated that models involving several thousands of equations were solvable and could even be efficiently optimized.  The question of interest moved from how to solve large equation-based models to how to aid an engineer to pose them, debug them and get them to solve.&lt;br /&gt;
&lt;br /&gt;
In 1983 Dean Benjamin proposed the first version of a modeling language for posing complex models.  Larry Gaydos and Art Westerberg further developed this language in the spring of 1984.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ASCEND III===&lt;br /&gt;
&lt;br /&gt;
In 1984 Peter Piela undertook a PhD project with Art Westerberg to “reduce the time needed to create and solve a complex model by one order of magnitude.”  He developed what became ASCEND III.  He had the help of two Carnegie Mellon University undergraduate students, Tom Epperly and Karl Westerberg, and of Roy McKelvey, a member of the faculty in the Design Department in Fine Arts.  This team developed this system on the Apollo workstation and in Pascal.  It comprised three parts: a modeling language and compiler, an interactive user interface and a suite of solvers.  The language used object-oriented principles, with the exception of hiding of information.  Modelers define types to create model definitions.  A type (called a model in ASCEND) is a collection of variables and complex parts whose types are previously defined and the definition of the equations that model is to supply.  A model can also be the refinement of a previously defined type.  The language fully supported associative arrays and sets.  For example, a distillation column is an array of trays.  It also supported deferred binding by allowing one to reach inside a part and alter one of its parts to be a more refined type.  The language and its compiler obviated the need to have a system programmer write the seven subroutines needed in ASCEND II.&lt;br /&gt;
The interactive user interface supplied the user with  organized access to the many tools in the ASCEND III system.  There were tools to load model definitions, to compile them, to browse them, to solve them, to probe them, to manipulate the display units (e.g., ft/s) for reporting variable values, to create reports and to run methods on them. One could even point at a part and ask that it be made into a more refined type (triggering the compiler to restart).  As previously solved values were not overwritten, they became the starting point for the more complex model.  Thus one could creep up on the solution by solving more and more complex versions of a model.  Many of the tools were there specifically to aid the user in debugging their models as they tried to solve them.  A tool could tell a user that the model appeared to be singular and why.  Another set of tools aided in picking a consistent set of variables to fix before solving.  Browsing allowed the user to look at all parts of the model.  It was easy to check the configuration of a model.  One could ask that parts of a model be solved one at a time.&lt;br /&gt;
&lt;br /&gt;
Experience by Peter Piela, Oliver Smith, Neil Carlberg and Art Westerberg with ASCEND III demonstrated very clearly that  skilled modelers could develop, debug and solve very complex models much more rapidly than they could with previously available tools, easily meeting the original target of a order of magnitude reduction in time required. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ASCEND IIIc===&lt;br /&gt;
&lt;br /&gt;
In the fall of 1992, Kirk Abbott and Ben Allan approached Art Westerberg and said they wanted to convert the ASCEND III system from Pascal into C.  They would also use Tcl/Tk for the interface.  With these changes, the system would then run on most Unix workstations.  Tom Epperly and Karl Westerberg had already created a C version for the compiler and solver.  Abbott and Allan wanted to do this conversion even after they were warned that converting the system would take time that they could be using to do more apparently relevant work to complete their PhD theses.  They insisted.  They were aided by Tom Epperly who, although located remotely, worked with them on the compiler.  In eight months and putting in excessively long hours, they had a working system that could could mimic most of the capabilities of the ASCEND III system.&lt;br /&gt;
&lt;br /&gt;
Several students and a few people outside CMU could now use the system for modeling.  Bob Huss and Boyd Safrit performed the hardest testing when they used ASCEND IIIc  to model nonideal distillation processes.  They developed and solved models involving up to 15,000 equations.  Using a rudimentary capability for solving initial value problems, Safrit also solved dynamic models.  With use came the recognition of a need for improvements.&lt;br /&gt;
&lt;br /&gt;
Attempts to teach ASCEND to others showed that it was a great system to speed up the modeling process for experts.  Nonexperts found it nearly impossible to reuse models contained in the ASCEND libraries.  The library for computing the thermodynamic properties of mixtures was particularly elegant but almost impossible to reuse.  Modelers would reinvent their own properties models quickly, unable to use the library models.&lt;br /&gt;
&lt;br /&gt;
Models larger than about 17,000 equations took more space than our largest workstation could provide.  The models by Huss and Safrit were pushing the limits.  Abbott and Allan established the goal  to increase the size possible by a factor of at least ten, i.e.,  to about a quarter of a million equations.  ASCEND needed to solve models more quickly.  Without counting the increases coming from faster and larger hardware, the goal here too was a factor of ten.  If solving were to be that fast, then compiling would stand out as unacceptably slow.  The goal: ten times faster.&lt;br /&gt;
&lt;br /&gt;
Abbott, with Allan, exposed a new style for modeling in ASCEND.  He created prototypes of the various repeating types that occur in a model.  The compiled equations and other data structures to define these prototypes then became available for all subsequent instances of parts that were of the same type as the prototype.  Only the instance data needed to be developed separately.  Demonstrated impact on compile times was dramatic.&lt;br /&gt;
&lt;br /&gt;
Abbott, with Allan, looked at how to speed up the solving times.  The new twist was to use the model structure as defined by the model definition to expose a global reordering for the model equations before presenting them for solution.  The time to solve the linear Newton equations as the inner loop of solving nonlinear equations dropped by factors of 5 to 10.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ASCEND IV===&lt;br /&gt;
&lt;br /&gt;
Ben Allan took a lead role and worked with Mark Thomas, Vicente Rico-Ramirez and Ken Tyner to produce the next version of ASCEND, ASCEND IV.  Playing the role of tester, an undergraduate, Jennifer Perry, demonstrated that Allan’s introduction of parameterized types dramatically increased the reusability of the model libraries, converting it into an almost automatable exercise.  Adding language constructs to permit the modeler to state what constitutes misuse of a model leads to the system generating diagnostics the model itself defines.  Allan also completely revised the data structures and the interface between ASCEND and its solvers so that adding new solvers is much less work and so the solvers in ASCEND themselves become separable from ASCEND and usable by others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Allan also defined the addition of NOTES to ASCEND, which are like methods except they are not understood by the ASCEND system itself.  Rather they can be passed to programs outside ASCEND.  An example includes documentation notes which a documentation manager can use to compose answers to queries about what is in an ASCEND model.  Another is a note that contains a bitmap description of a part that an external package could use to draw a symbol of that part. &lt;br /&gt;
&lt;br /&gt;
ASCEND IV can now handle discrete variables and constants (logical, binary, symbolic, and integer).  It supports the solver directing that parts of the model be excluded when solving such as when solving using implicit enumeration (dynamic model modification).  CONOPT is now attached for optimization.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ASCEND IV, post 2004===&lt;br /&gt;
&lt;br /&gt;
Art Westerberg retired from Carnegie Mellon University in 2004.  While still leading this project, he is also in charge of maintaining the ASCEND server that resides at CMU.  This server hosts this wiki and our subversion repository, as well as our web pages.  He also continues in his role as resident expert in the design and use of ASCEND.&lt;br /&gt;
&lt;br /&gt;
Our work is less formal now as it no longer involves active research projects at CMU.  However, we now have an active set of volunteers participating in the project.&lt;br /&gt;
&lt;br /&gt;
John Pye is a Research Fellow at the Australian National University. He has submitted a PhD on the topic of system modeling of a solar thermal energy system and continues to work in modeling and optimisation of solar energy systems. He has contributed a new ASCEND GUI and Python bindings as well as several new solvers.&lt;br /&gt;
&lt;br /&gt;
Benjamin Allan now resides in California and continues to be reponsible for the code and the current TclTk API of ASCEND.&lt;br /&gt;
&lt;br /&gt;
Krishnan Chittur is a professor at the University of Alamaba in Hunstville with wide-ranging interests in the field of chemical engineering, bioengineering and biomaterials. He uses ASCEND in his undergraduate teaching programs and believes that it has great value in exposing students to numerical modeling issues enabling solution of complex systems, while at the same time permitting detailed understand of the way that such tools work.  He contributes to the examples in ASCEND.&lt;br /&gt;
&lt;br /&gt;
The active project participants tap several of those mentioned above who continue to have an interest in ASCEND and to participate when requested as resident experts to the code and modeling examples.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=SELECT&amp;diff=174</id>
		<title>SELECT</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=SELECT&amp;diff=174"/>
		<updated>2010-05-13T14:02:44Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;SELECT&#039;&#039;&#039; statement is used to selectively compile equations according to the value of constants in the model. This similar to the [[WHEN]] statement used in [[Conditional modelling]], except that it allows no possibility of equations being switched on or off after the model is instantiated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be careful when naming your equations inside a SELECT statement: A name cannot be defined two different ways inside the SELECT statement, but it may be defined outside the case statement and then &#039;&#039;refined&#039;&#039; in different ways in separate cases, using [[IS_REFINED_TO]].&lt;br /&gt;
&lt;br /&gt;
This statement is declarative. Order of the CASEs does not matter. All matching cases are executed. The OTHERWISE is executed if present and no other CASEs match. SELECT is not&lt;br /&gt;
allowed inside [[FOR]], but writing [[FOR]] statements inside SELECT is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL eos_constants (&lt;br /&gt;
&lt;br /&gt;
    component_name WILL_BE symbol_constant;&lt;br /&gt;
);&lt;br /&gt;
    T_c IS_A temperature_constant;&lt;br /&gt;
    p_c IS_A pressure_constant;&lt;br /&gt;
&lt;br /&gt;
    (* depending on the value of the &#039;component_name&#039; parameter, set the&lt;br /&gt;
    critical temperature and pressure to the appropriate value. *)&lt;br /&gt;
    SELECT(component_name)&lt;br /&gt;
        CASE &#039;hydrogen&#039;:&lt;br /&gt;
&lt;br /&gt;
            T_c :== 33 {K};&lt;br /&gt;
            p_c :== 12.9 {bar};&lt;br /&gt;
&lt;br /&gt;
        CASE &#039;water&#039;:&lt;br /&gt;
            T_c :== 647.3 {K};&lt;br /&gt;
            p_c :== 221.2 {bar};&lt;br /&gt;
&lt;br /&gt;
        CASE &#039;oxygen&#039;:&lt;br /&gt;
            T_c :== 154.6 {K};&lt;br /&gt;
            p_c :== 50.4 {bar};&lt;br /&gt;
&lt;br /&gt;
        OTHERWISE:&lt;br /&gt;
            T_c :== -1 {K};&lt;br /&gt;
            p_c :== -1 {Pa};&lt;br /&gt;
&lt;br /&gt;
    END SELECT;&lt;br /&gt;
END eos_constants;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In fact, this is the technique used in the current {{src|models/components.a4l}} model in our [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[Conditional modelling]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Syntax]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Category:Syntax&amp;diff=173</id>
		<title>Category:Syntax</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Category:Syntax&amp;diff=173"/>
		<updated>2010-05-13T14:02:34Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This category contains pages that describe the ASCEND modelling language syntax. [[Category:Documentation|More general documentation]] is also available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;mw-pages&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Pages in category &amp;quot;Syntax&amp;quot;&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following 55 pages are in this category, out of 55 total.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;A&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[ALIASES]]&lt;br /&gt;
* [[ARE ALIKE]]&lt;br /&gt;
* [[ARE THE SAME]]&lt;br /&gt;
* [[ATOM]]&lt;br /&gt;
* [[Abs]]&lt;br /&gt;
* [[Arrays and sets]]&lt;br /&gt;
&amp;lt;h3&amp;gt;C&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[CALL]]&lt;br /&gt;
* [[CASE]]&lt;br /&gt;
* [[CONDITIONAL]]&lt;br /&gt;
* [[Conditional modelling]]&lt;br /&gt;
&amp;lt;h3&amp;gt;D&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[DATA]]&lt;br /&gt;
* [[DECREASING]]&lt;br /&gt;
* [[Dynamic modelling]]&lt;br /&gt;
&amp;lt;h3&amp;gt;E&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[EXTERNAL]]&lt;br /&gt;
&amp;lt;h3&amp;gt;F&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[FALSE]]&lt;br /&gt;
* [[FIX]]&lt;br /&gt;
* [[FOR]]&lt;br /&gt;
* [[FREE]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;I&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IF]]&lt;br /&gt;
* [[IMPORT]]&lt;br /&gt;
* [[IS A]]&lt;br /&gt;
* [[IS REFINED TO]]&lt;br /&gt;
&amp;lt;h3&amp;gt;L&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Ln]]&lt;br /&gt;
* [[Log10]]&lt;br /&gt;
* [[Lower bound]]&lt;br /&gt;
&amp;lt;h3&amp;gt;M&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[MAX]]&lt;br /&gt;
* [[MAXIMIZE]]&lt;br /&gt;
* [[METHODS]]&lt;br /&gt;
* [[MIN]]&lt;br /&gt;
* [[MINIMIZE]]&lt;br /&gt;
* [[MODEL]]&lt;br /&gt;
&amp;lt;h3&amp;gt;N&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[NOTES]]&lt;br /&gt;
&amp;lt;h3&amp;gt;O&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[OTHERWISE]]&lt;br /&gt;
* [[Object-oriented modelling]]&lt;br /&gt;
* [[Optimisation]]&lt;br /&gt;
&amp;lt;h3&amp;gt;P&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[PROVIDE]]&lt;br /&gt;
* [[PROVIDES]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;R&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[REFINES]]&lt;br /&gt;
* [[REQUIRE]]&lt;br /&gt;
* [[RUN]]&lt;br /&gt;
&amp;lt;h3&amp;gt;S&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[SATISFIED]]&lt;br /&gt;
* [[SELECT]]&lt;br /&gt;
* [[SUM]]&lt;br /&gt;
* [[SWITCH]]&lt;br /&gt;
* [[Solver var]]&lt;br /&gt;
&amp;lt;h3&amp;gt;T&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[TRUE]]&lt;br /&gt;
&amp;lt;h3&amp;gt;U&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[USE]]&lt;br /&gt;
* [[Upper bound]]&lt;br /&gt;
&amp;lt;h3&amp;gt;W&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[WHEN]]&lt;br /&gt;
* [[WHERE]]&lt;br /&gt;
* [[WHILE]]&lt;br /&gt;
* [[WILL BE]]&lt;br /&gt;
* [[WILL BE THE SAME]]&lt;br /&gt;
* [[WILL NOT BE THE SAME]]&lt;br /&gt;
* [[WITH VALUE]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 [[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=User:DanteStroe&amp;diff=172</id>
		<title>User:DanteStroe</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:DanteStroe&amp;diff=172"/>
		<updated>2010-05-13T14:02:26Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Dante Stroe&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Proposal: [http://socghop.appspot.com/student_project/show/google/gsoc2009/ascend/t124021684017]&lt;br /&gt;
&lt;br /&gt;
Mentor: [[Ben Allan]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Subversion branch: [http://ascendcode.cheme.cmu.edu/viewvc.cgi/code/branches/dante/ &amp;lt;font color=&amp;quot;orange&amp;quot;&amp;gt;dante&amp;lt;/font&amp;gt;:]&lt;br /&gt;
&lt;br /&gt;
== Detailed plan ==&lt;br /&gt;
===By mid-term review:===&lt;br /&gt;
* 18/06/2009&lt;br /&gt;
* Completed the parser modifications s.t. ASCEND now understands &amp;quot;LINK(&#039;key&#039;,a,b)&amp;quot; syntax, where &#039;key&#039; is the key that links identifies the set of instances &amp;quot;a&amp;quot; and &amp;quot;b&amp;quot; inside the the link table. The test model z-link.a4l has also been modified.&lt;br /&gt;
* Added a Link table object (struct link_table_t) to the model instance type that will store the aforementioned links. The link table is in fact a &amp;quot;gl_list&amp;quot; where each entry in the list represents a pointer to a &amp;quot;LINK&amp;quot; entry that is currently defined in the following way:&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;/**&lt;br /&gt;
  * DS: Entry in the Link table (which is in fact a list) associated with each model&lt;br /&gt;
&lt;br /&gt;
  * instantiator.&lt;br /&gt;
  */&lt;br /&gt;
  struct link_entry_t {&lt;br /&gt;
&lt;br /&gt;
    union {&lt;br /&gt;
&lt;br /&gt;
      struct Statement * statptr; /* pointer to the declarative statement */&lt;br /&gt;
      struct VariableList * vl; /* used if the we use the GUI to LINK, otherwise NULL */&lt;br /&gt;
&lt;br /&gt;
    } u;&lt;br /&gt;
    struct gl_list_t *instances_cache;    /**&amp;amp;lt; (cache) pointer to the list of instances that are linked*/&lt;br /&gt;
&lt;br /&gt;
    symchar* key_cache;                   /**&amp;amp;lt; key that defines the linked instances */&lt;br /&gt;
    unsigned long length;   /**&amp;amp;lt; Number of instances in the linked_instances list. */&lt;br /&gt;
&lt;br /&gt;
    unsigned long capacity; /**&amp;amp;lt; Capacity of the link entry, in terms of the number of the instances that can be linked. */&lt;br /&gt;
    unsigned int flags;     /**&amp;amp;lt; Status flags.used to differentiate between LINK statements in the declarative part(FIXED) and the ones in the methods (not fied). */&lt;br /&gt;
&lt;br /&gt;
  }&amp;lt;/source&amp;gt;&lt;br /&gt;
* This is defined as part of the TypeDescription class. where the &amp;quot;link_table&amp;quot; is declared as an attribute as part of the ModelArgs union element of the TypeDescription:&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;struct ModelArgs {&lt;br /&gt;
   struct gl_list_t *link_table; /**&amp;amp;lt; pointer to the table of &amp;amp;quot;LINK&amp;amp;quot; relationships of the model*/&lt;br /&gt;
&lt;br /&gt;
 ....&amp;lt;/source&amp;gt;&lt;br /&gt;
===Instantiation and LINK statements===&lt;br /&gt;
* Additions to the &amp;quot;instantiate&amp;quot; class can be followed at [http://ascendcode.cheme.cmu.edu/viewvc.cgi/code/branches/dante/ascend/compiler/instantiate.c?sortby=date&amp;amp;r1=2394&amp;amp;r2=2296&amp;amp;pathrev=2394 this rev diff]&lt;br /&gt;
* In order for LINK statements to have consistent instances in the ENTRIES, they have to be instantiate only after all the models, relations, logical statements and &amp;quot;when&amp;quot; statements have been instantiated. (Otherwise we run the risk of having the Link statements invalid after the instantiation a re-instantiation procedures are carried on).&lt;br /&gt;
** Compiler initially had 5 instantiation/re-instantiation phases, and now it has 6&amp;amp;nbsp;:&lt;br /&gt;
*** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
*** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
*** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
*** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
*** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
*** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
*** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
*** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
*** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
*** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
*** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
*** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
** Compiler initially had 5 instantiation/re-instantiation phases, and now it has 6&amp;amp;nbsp;:&lt;br /&gt;
*** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
*** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
*** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
*** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
*** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
*** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
*** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
*** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
*** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
*** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
*** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
*** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
* Compiler initially had 5 instantiation/re-instantiation phases, and now it has 6&amp;amp;nbsp;:&lt;br /&gt;
** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
** 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
** 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
** 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
** 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
** 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
** 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
* 1. Models (instantiate models and disregard any other type of statements)&lt;br /&gt;
* 2. Relations (instantiate &amp;quot;relations&amp;quot; and disregard any other type of statements)&lt;br /&gt;
* 3. Logical Statements (instantiate logicals and disregard any other type of statements)&lt;br /&gt;
* 4. When Statements (instantiate &amp;quot;when&amp;quot;s and disregard any other type of statements)&lt;br /&gt;
* 5. LINK Statements (instantiate LINKS and disregard any other type of statements) - Added&lt;br /&gt;
* 6. default (visit instance tree once more and if it is the case warn about any un-executed statements).&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
For the purpose of adding this new &amp;quot;LINK&amp;quot; phase in the instantiation procedure the following functions were added. They were implemented and documented in a similar fashion (if the case) with respect to the other instantiation functions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* These functions set the bits such that the following functions only execute the LINK statements, as well as the FORs and select(re-evaluate) statements that contain LINKs.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;void Pass5SetLinkBits(struct Instance *inst)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;struct Instance *Pass5InstantiateModel(struct Instance *result, unsigned long *pcount)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* By now the  pass5pendings was already set by silent visit to the instance tree. (which means we updated the pending instances from the last phase)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;void Pass5ProcessPendingInstances(void)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Try to execute all the LINK statements in instance work. It assumes that work is the top of the pending instance list. Will skip all non-LINK statements. (Note: Only models get here)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;static void Pass5ExecuteLinkStatements(struct BitList *blist, struct Instance *work, int *changed)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Statement processing. We are processing just the LINK statements that are stand-alone as well as the ones inside FORs (That&#039;s what we should be left with anyway, since this is the last phase of instantiation). This Executes each LINK with &amp;quot;ExecuteLNK(instance,statement)&amp;quot; function and each FOR that contains a LINK with &amp;quot;Pass5ExecuteFOR(instance,statement)&amp;quot; (this only executes the LINKs inside the FOR)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;static int Pass5ExecuteStatement(struct Instance *inst,struct Statement *statement)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This is where all the sanity checks are done for the LINK statement and parameters correctness aw well as the addLinkEntry function is called for the given model.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;int ExecuteLNK(struct Instance *inst, struct Statement *statement)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Near future tasks:&lt;br /&gt;
** Implement the rest of functions present at [http://ascendwiki.cheme.cmu.edu/LINK_semantics]&lt;br /&gt;
** Unit testing of the all the functions implemented&lt;br /&gt;
** At this point ascend should be able compile models with &amp;quot;LINK&amp;quot; syntax and store it&lt;br /&gt;
** Regression testing and making sure committed code is properly documented&lt;br /&gt;
** Implement the rest of functions present at [http://ascendwiki.cheme.cmu.edu/LINK_semantics]&lt;br /&gt;
** Unit testing of the all the functions implemented&lt;br /&gt;
** At this point ascend should be able compile models with &amp;quot;LINK&amp;quot; syntax and store it&lt;br /&gt;
** Regression testing and making sure committed code is properly documented&lt;br /&gt;
* Implement the rest of functions present at [http://ascendwiki.cheme.cmu.edu/LINK_semantics]&lt;br /&gt;
* Unit testing of the all the functions implemented&lt;br /&gt;
* At this point ascend should be able compile models with &amp;quot;LINK&amp;quot; syntax and store it&lt;br /&gt;
* Regression testing and making sure committed code is properly documented&lt;br /&gt;
&lt;br /&gt;
===By final review:===&lt;br /&gt;
&lt;br /&gt;
* Initial value modeling&lt;br /&gt;
** Modify the DAE solver implementation to make use of the newly implemented &amp;quot;LINK&amp;quot; relationship, however in the form of DERIV(dx_dt,x) .  (Note: this implies that &amp;quot;t&amp;quot; is declared as the independent variable in use beforehand, and the compiler should know this until instructed otherwise). This relation would inherit/extend the LINK relationship. See [[Improved DAE syntax]].&lt;br /&gt;
** Add functionality to relation classes, to make use of the Link information present for given instances in the case of derivatives. Need&lt;br /&gt;
** Testing and documentation&lt;br /&gt;
** Modify the DAE solver implementation to make use of the newly implemented &amp;quot;LINK&amp;quot; relationship, however in the form of DERIV(dx_dt,x) .  (Note: this implies that &amp;quot;t&amp;quot; is declared as the independent variable in use beforehand, and the compiler should know this until instructed otherwise). This relation would inherit/extend the LINK relationship. See [[Improved DAE syntax]].&lt;br /&gt;
** Add functionality to relation classes, to make use of the Link information present for given instances in the case of derivatives. Need&lt;br /&gt;
** Testing and documentation&lt;br /&gt;
* Modify the DAE solver implementation to make use of the newly implemented &amp;quot;LINK&amp;quot; relationship, however in the form of DERIV(dx_dt,x) .  (Note: this implies that &amp;quot;t&amp;quot; is declared as the independent variable in use beforehand, and the compiler should know this until instructed otherwise). This relation would inherit/extend the LINK relationship. See [[Improved DAE syntax]].&lt;br /&gt;
* Add functionality to relation classes, to make use of the Link information present for given instances in the case of derivatives. Need&lt;br /&gt;
* Testing and documentation&lt;br /&gt;
&lt;br /&gt;
* Update on completed tasks:&lt;br /&gt;
** Finished and corrected implementation of testing suite for the LINK syntax (in general)&amp;amp;nbsp;: {{srcbranch|dante|models/test/z-link.a4c}}. The file also contains some fail cases and a special LINK type with key &#039;testSuite&#039; that runs a procedure to test the functions described in [http://ascendwiki.cheme.cmu.edu/LINK_semantics LINK]&lt;br /&gt;
** Created &#039;ode&#039; type LINKS that are defined by the &#039;ode&#039; key and a list of instances out of which, currently, the last one is the independent variable, whereas the rest are the differential variable in decreasing order. Ex:&lt;br /&gt;
** Finished and corrected implementation of testing suite for the LINK syntax (in general)&amp;amp;nbsp;: {{srcbranch|dante|models/test/z-link.a4c}}. The file also contains some fail cases and a special LINK type with key &#039;testSuite&#039; that runs a procedure to test the functions described in [http://ascendwiki.cheme.cmu.edu/LINK_semantics LINK]&lt;br /&gt;
** Created &#039;ode&#039; type LINKS that are defined by the &#039;ode&#039; key and a list of instances out of which, currently, the last one is the independent variable, whereas the rest are the differential variable in decreasing order. Ex:&lt;br /&gt;
* Finished and corrected implementation of testing suite for the LINK syntax (in general)&amp;amp;nbsp;: {{srcbranch|dante|models/test/z-link.a4c}}. The file also contains some fail cases and a special LINK type with key &#039;testSuite&#039; that runs a procedure to test the functions described in [http://ascendwiki.cheme.cmu.edu/LINK_semantics LINK]&lt;br /&gt;
* Created &#039;ode&#039; type LINKS that are defined by the &#039;ode&#039; key and a list of instances out of which, currently, the last one is the independent variable, whereas the rest are the differential variable in decreasing order. Ex:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LINK(&#039;ode&#039;,dx_dt,x,t);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** The derivative chains declared in LINK can be arbitrarily long, however the solver does not handle more than 2nd order derivatives&lt;br /&gt;
** The &amp;quot;ode&amp;quot; LINKS can be declared in both the declarative and procedural part of the model.&lt;br /&gt;
** If multiple derivative chains are declared, they must all have the same independent variable, otherwise the user is prompted with an error message.&lt;br /&gt;
** The LINKs don&#039;t make use of the .ode_type/ode_id attributes of the instances, but rather, the LINK structure. This implies that if one variable is present in two or more derivative chains, there is no longer the need to declare additional variables.&lt;br /&gt;
*** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
*** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
** The derivative chains declared in LINK can be arbitrarily long, however the solver does not handle more than 2nd order derivatives&lt;br /&gt;
** The &amp;quot;ode&amp;quot; LINKS can be declared in both the declarative and procedural part of the model.&lt;br /&gt;
** If multiple derivative chains are declared, they must all have the same independent variable, otherwise the user is prompted with an error message.&lt;br /&gt;
** The LINKs don&#039;t make use of the .ode_type/ode_id attributes of the instances, but rather, the LINK structure. This implies that if one variable is present in two or more derivative chains, there is no longer the need to declare additional variables.&lt;br /&gt;
*** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
*** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
* The derivative chains declared in LINK can be arbitrarily long, however the solver does not handle more than 2nd order derivatives&lt;br /&gt;
* The &amp;quot;ode&amp;quot; LINKS can be declared in both the declarative and procedural part of the model.&lt;br /&gt;
* If multiple derivative chains are declared, they must all have the same independent variable, otherwise the user is prompted with an error message.&lt;br /&gt;
* The LINKs don&#039;t make use of the .ode_type/ode_id attributes of the instances, but rather, the LINK structure. This implies that if one variable is present in two or more derivative chains, there is no longer the need to declare additional variables.&lt;br /&gt;
** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
** The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
* The implementation was done in &amp;quot;ascend/ascend/system/analyze.c&amp;quot; for the solver and &amp;quot;ascend/ascend/integrator/integrator.c&amp;quot; for the integrator. For this purpose the follwing external functions were implemented in &amp;quot;\ascend\ascend\compiler\link.c&amp;quot;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;extern int getOdeId(struct Instance *model,struct Instance *inst);&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;extern int getOdeType(struct Instance *model,struct Instance *inst);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functions return the ode_type and ode_id (as in prev syntax) of a given variable in a model from the LINK table structures, if the variable pertains to any derivative chains.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* In order to test this syntax the following models were added to the repository (modified from previous models with derivative chains):&lt;br /&gt;
** {{srcbranch|dante|models/test/ida/singlederiv_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/test/ida/twoderiv_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/dyn_tank_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/johnpye/pendulum_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/test/dopri5/dopri5test_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/test/ida/singlederiv_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/test/ida/twoderiv_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/dyn_tank_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/johnpye/pendulum_wLINK.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/test/dopri5/dopri5test_wLINK.a4c}}&lt;br /&gt;
* {{srcbranch|dante|models/test/ida/singlederiv_wLINK.a4c}}&lt;br /&gt;
* {{srcbranch|dante|models/test/ida/twoderiv_wLINK.a4c}}&lt;br /&gt;
* {{srcbranch|dante|models/dyn_tank_wLINK.a4c}}&lt;br /&gt;
* {{srcbranch|dante|models/johnpye/pendulum_wLINK.a4c}}&lt;br /&gt;
* {{srcbranch|dante|models/test/dopri5/dopri5test_wLINK.a4c}}&lt;br /&gt;
&lt;br /&gt;
* The following model is not yet functional, due to the fact that the instances that are vector elements inside LINKs, which are inside a &amp;quot;FOR&amp;quot;, are not properly evaluated. (currently working on that):&lt;br /&gt;
** {{srcbranch|dante|models/test/dopri5/aren.a4c}}&lt;br /&gt;
** {{srcbranch|dante|models/test/dopri5/aren.a4c}}&lt;br /&gt;
* {{srcbranch|dante|models/test/dopri5/aren.a4c}}&lt;br /&gt;
&lt;br /&gt;
* Other feasible targets this week:&lt;br /&gt;
** Implement &amp;quot;INDEPENDENT t&amp;quot; type syntax for the independent variable of the derivative chains, with the restriction of having only a single declaration of this type in a model. This implies that the independent variable will no longer have to be declared inside the &#039;ode&#039;-type LINKs. This would be implemented by using the LINK structure as well.&lt;br /&gt;
** Replace the &amp;quot;LINK(&#039;ode&#039;,dx_dt,x)&amp;quot; type of syntax, with DER(dx_dt,x).(To be agreed if this is smth desirable or LINK is enough for now)&lt;br /&gt;
** update: since the [http://ascendcode.cheme.cmu.edu/viewvc.cgi?view=rev&amp;amp;revision=2570 latest commit] the following block of code:&lt;br /&gt;
** Implement &amp;quot;INDEPENDENT t&amp;quot; type syntax for the independent variable of the derivative chains, with the restriction of having only a single declaration of this type in a model. This implies that the independent variable will no longer have to be declared inside the &#039;ode&#039;-type LINKs. This would be implemented by using the LINK structure as well.&lt;br /&gt;
** Replace the &amp;quot;LINK(&#039;ode&#039;,dx_dt,x)&amp;quot; type of syntax, with DER(dx_dt,x).(To be agreed if this is smth desirable or LINK is enough for now)&lt;br /&gt;
** update: since the [http://ascendcode.cheme.cmu.edu/viewvc.cgi?view=rev&amp;amp;revision=2570 latest commit] the following block of code:&lt;br /&gt;
* Implement &amp;quot;INDEPENDENT t&amp;quot; type syntax for the independent variable of the derivative chains, with the restriction of having only a single declaration of this type in a model. This implies that the independent variable will no longer have to be declared inside the &#039;ode&#039;-type LINKs. This would be implemented by using the LINK structure as well.&lt;br /&gt;
* Replace the &amp;quot;LINK(&#039;ode&#039;,dx_dt,x)&amp;quot; type of syntax, with DER(dx_dt,x).(To be agreed if this is smth desirable or LINK is enough for now)&lt;br /&gt;
* update: since the [http://ascendcode.cheme.cmu.edu/viewvc.cgi?view=rev&amp;amp;revision=2570 latest commit] the following block of code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LINK(&#039;ode&#039;,dx_dt,x,t);&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;DER(dx_dt,x);&lt;br /&gt;
INDEPENDENT t;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* either of the two new statements can be declared in any order and in any part of the model as with LINK; The example models have also been updated with the new syntax.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:GSOC2009]]&lt;br /&gt;
[[Category:ASCEND_Contributors]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Category:Outdated&amp;diff=171</id>
		<title>Category:Outdated</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Category:Outdated&amp;diff=171"/>
		<updated>2010-05-13T14:02:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Articles in need of an update...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;mw-pages&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Pages in category &amp;quot;Outdated&amp;quot;&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following 18 pages are in this category, out of 18 total.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;A&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[ASCEND capabilities]]&lt;br /&gt;
&amp;lt;h3&amp;gt;B&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
&amp;lt;h3&amp;gt;C&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[ComponentizingAscend]]&lt;br /&gt;
&amp;lt;h3&amp;gt;D&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Debugging ASCEND]]&lt;br /&gt;
&amp;lt;h3&amp;gt;I&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IPOPT]]&lt;br /&gt;
* [[Initial-value modelling]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;I cont.&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Installing LyX]]&lt;br /&gt;
&amp;lt;h3&amp;gt;N&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[New Compiler]]&lt;br /&gt;
* [[Notes Ubuntu 7.04 Install]]&lt;br /&gt;
* [[Notes Ubuntu 7.10 Install]]&lt;br /&gt;
&amp;lt;h3&amp;gt;P&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Prerequisites for Windows]]&lt;br /&gt;
* [[PythonWrapper]]&lt;br /&gt;
&amp;lt;h3&amp;gt;R&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Regression Testing]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;R cont.&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Running the Python/PyGTK GUI on Windows]]&lt;br /&gt;
&amp;lt;h3&amp;gt;S&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Sensitivity study]]&lt;br /&gt;
* [[Steam properties]]&lt;br /&gt;
* [[Supporting RPMs]]&lt;br /&gt;
&amp;lt;h3&amp;gt;T&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[TclTk Quick Guide]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Saving_and_restoring_model_state&amp;diff=170</id>
		<title>Saving and restoring model state</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Saving_and_restoring_model_state&amp;diff=170"/>
		<updated>2010-05-13T14:02:05Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{task}}&lt;br /&gt;
&lt;br /&gt;
This task is related to the task of creating a [[canvas-based modeller for ASCEND]], because we would like for canvas-based models to be saved including their current solved state. This will make them more useful for review by other users, and for referring back to the solution of a previous study-case.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The current status of this work&#039;&#039;&#039; is that Arijit implemented a [[Saving_and_restoring_model_state#Current_method_of_implementation|Python-based way]] of saving the model state; we would like to think about other more portable approaches though.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements for saving and restoring model state:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* must store all non-constant values defined in the model&lt;br /&gt;
* this include booleans, integers, symbols and reals.&lt;br /&gt;
* includes not just solver_var&#039;s but also attributes of variables, such as lower_bound and upper_bound&lt;br /&gt;
* note that attributes are not hard-wired into ASCEND but are defined on the fly in .a4c and .a4l files.&lt;br /&gt;
* should not make use of solvers_var_list etc, because we want our saved state to be solver-agnostic.&lt;br /&gt;
* should be possible to save state of a whole model or any sub-tree (starting from a certain instance and working down)&lt;br /&gt;
* must be able to deal with arrays, whens, conditionals, etc.&lt;br /&gt;
* need to identify what should be done in the case of &#039;sets&#039;.&lt;br /&gt;
* need to avoid storing multiple copies of &#039;cliqued&#039; variables (ARE_THE_SAME, ALIASES).&lt;br /&gt;
&lt;br /&gt;
Suggestions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* should be implemented at the libascend C level, so that it can be readily be used by across all GUIs if desired&lt;br /&gt;
* would replace the current hybrid Tcl+C apporach (producing .a4v files)&lt;br /&gt;
* needs to be interfaced with Python in a way that the resulting return value can be pickled and unpickled efficiently.&lt;br /&gt;
* suggested Python datatype is the &#039;dict&#039;&lt;br /&gt;
* some care required when dealing with type conversions between Python and C and vice versa.&lt;br /&gt;
* suggest a new SWIG object being the &#039;CachedValue&#039; or similar, able to hold bool, int, real, string (and set?) values.&lt;br /&gt;
&lt;br /&gt;
More detailed design should be discussed and more specific design worked out here.&lt;br /&gt;
&lt;br /&gt;
Note current partial functionality implemented in {{src|ascend/compiler/instance_io.c}} (a &#039;restore&#039; function was never implemented).&lt;br /&gt;
&lt;br /&gt;
Note current Tcl/Tk GUI functionality implemented in {{src|tcltk/interface/BrowserProc.c}} and {{src|tcltk/tk/BrowserProc.tcl}}. This approach generates the stored file using C code, then utilised the Tcl interpreter to act as a parser for the stored file when reading it back (see Brow_parse_values).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Possible solutions ==&lt;br /&gt;
&lt;br /&gt;
=== Opaque object ===&lt;br /&gt;
&lt;br /&gt;
Functions could be written that would create an opaque object via SWIG that would do the job of serialising and unserialising values from the instance hierarchy. The opaque object could be interfaced with the &#039;copy_reg&#039; module or augmented with __setstate__ and __getstate__ functions to allow the object model state object to be saved in a pickle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Python-to-C flat data conversion ===&lt;br /&gt;
&lt;br /&gt;
This approach would serialise an instance sub-tree into a set of key-value pairs which could then be exchanged easily both to and from Python. A problem might be the &#039;heaviness&#039; of the storage format (a lot of space consumed storing strings like &#039;lower_bound&#039;, &#039;upper_bound&#039;, and perhaps a lot more processor-intensive. Some care required with data types -- eg converting from PyObject to string/int/real/bool as required for the Instance type. But relatively easy to implement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Python-to-C tree conversion ===&lt;br /&gt;
&lt;br /&gt;
As above, but return a hierarchical dict.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Pure Python implementation ===&lt;br /&gt;
&lt;br /&gt;
Is it possible to iterate through the tree in Python and produce something workable that&#039;s reasonably fast?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Wrapping the old Tcl functionality ===&lt;br /&gt;
&lt;br /&gt;
The old Tcl/C code uses C code to traverse the model tree and output a text file containing essentially a Tcl script that, when run, does the job of reinserting values into the instance tree by looking up identifiers one-by-one using the &#039;qlfdid&#039; routines. This approach to restoring model values is possibly not particular efficient, but does currently work. The hazards of using the Tcl interpreter from within Python are a bit scary, however, and it would be nicer to keep language &#039;cleanness&#039; in the Python code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Per-solver solutions? ==&lt;br /&gt;
&lt;br /&gt;
Different solvers work in different ways. All ASCEND solvers work off the &#039;solver lists&#039; that contain the &#039;flat&#039; form of an ASCEND model including real-valued variables and real-valued relations, boolean-valued vars and rels, WHENs, etc. Instead of solving values from the instance tree, an alternative approach would be to save the contents of the solver lists.&lt;br /&gt;
&lt;br /&gt;
One problem with this approach is that it could make it harder to restore model state for modified models -- what would happen if a variable had been added to or removed from the model?&lt;br /&gt;
&lt;br /&gt;
This approach would however make saving and loading quite a bit easier: all the problems of cliques are eliminated, and there is no need to recursively descend into a tree structure -- everything&#039;s flat.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Current method of implementation ==&lt;br /&gt;
&lt;br /&gt;
Currently, the Canvas Modeler employs Python based way of saving canvas data. When the canvasmodel is solved, it stores the values of all the variables present in the canvasmodel, supplied by the &amp;amp;lt;simulation&amp;amp;gt;.getallVariables() function, into a dictionary named &#039;saved_data&#039; belonging to the BlockCanvas class. The code which does this in present in the method &#039;run_canvas&#039; of &#039;blocklist.py&#039;. It is where the &#039;saved_data&#039; dictionary gets populated. This is then pickled upon saving of the canvasmodel. Thats how the data gets stored. &lt;br /&gt;
&lt;br /&gt;
Next, comes the retrieval of data upon loading of canvas pickle files, which is carried out in the following manner. First of all, loading of canvas pickle files is performed by the &#039;fileopen&#039; method of &#039;blocklist.py&#039;, which upon successful retrieval of pickled data, calls another method &#039;load_presaved_canvas&#039;, again belonging to &#039;blocklist.py&#039;. This method &#039;load_presaved_canvas&#039; then instantiates the canvasmodel. It then retrieves the values from the &#039;saved_data&#039; dictionary and assigns them to the variables of instantiated canvasmodel. That is how data is retrieved back from the canvas pickle file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Proposed]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ASCEND_overview&amp;diff=169</id>
		<title>ASCEND overview</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ASCEND_overview&amp;diff=169"/>
		<updated>2010-05-13T14:01:55Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ASCEND is a system for &#039;&#039;&#039;solving systems of equations&#039;&#039;&#039;, aimed at engineers and scientists. It allows you to &#039;&#039;&#039;build up complex models&#039;&#039;&#039; as as systems constructed from simpler &#039;&#039;&#039;sub-models&#039;&#039;&#039;. Using ASCEND it is simple to &#039;&#039;&#039;play around&#039;&#039;&#039; with your model, examine its behaviour, and work out how it can best be solved. You can &#039;&#039;&#039;easily change which variables are fixed&#039;&#039;&#039; and which are to be solved, and you can examine the way in which the model is being solved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After looking through this brief introduction to what ASCEND is all about, you might want to look at the [[ASCEND history]], a more detailed list of [[ASCEND capabilities]], see some [[worked examples]], find out about [[ASCEND_Users_and_Friends|the developers]] or look at more detailed [[Category:Documentation|documentation]].&lt;br /&gt;
&lt;br /&gt;
== Example of a simple model in ASCEND ==&lt;br /&gt;
&lt;br /&gt;
In ASCEND, models are written in a special-purpose modelling language that combines declarative &#039;&#039;variables&#039;&#039; and &#039;&#039;equations&#039;&#039; with procedural &#039;&#039;methods&#039;&#039;. The following simple method calculates the mass of water in a tank:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;REQUIRE &amp;amp;quot;atoms.a4l&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL tank;&lt;br /&gt;
	V IS_A volume;&lt;br /&gt;
	A IS_A area;&lt;br /&gt;
&lt;br /&gt;
	h IS_A distance;&lt;br /&gt;
	d IS_A distance;&lt;br /&gt;
	area_eqn: A = 1{PI} * d^2 / 4.;&lt;br /&gt;
&lt;br /&gt;
	vol_eqn: V = A * h;&lt;br /&gt;
	rho IS_A mass_density;&lt;br /&gt;
&lt;br /&gt;
	m IS_A mass;&lt;br /&gt;
	mass_eqn: m = rho*V;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	FIX d, h, rho;&lt;br /&gt;
&lt;br /&gt;
	d := 50 {cm};&lt;br /&gt;
	h := 90 {cm};&lt;br /&gt;
&lt;br /&gt;
	rho := 1000 {kg/m^3};&lt;br /&gt;
END on_load;&lt;br /&gt;
END tank;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This model declares variables and equations in the &#039;main&#039; part of the model. Then, in a method called &#039;on_load&#039;, the model specifies that the variables &amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;h&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;rho&amp;lt;/tt&amp;gt; will be &#039;fixed&#039;, and provides their values.&lt;br /&gt;
&lt;br /&gt;
This model can be loaded into ASCEND, usually just by double-clicking the file, then solved by hitting the &#039;solve&#039; button, with the following result:&lt;br /&gt;
&lt;br /&gt;
[[Image:simple-tank-example.png]]&lt;br /&gt;
&lt;br /&gt;
This is a very simple model: there is much more that ASCEND can do. For example, &#039;&#039;&#039;without editing the above model file&#039;&#039;&#039;, one can use the GUI to &#039;fix&#039; the volume and diameter of the tank and solve instead for the height, with just a couple of clicks, then resolve for a new tank volume of 200 L:&lt;br /&gt;
&lt;br /&gt;
[[Image:simple-tank2.png]]&lt;br /&gt;
&lt;br /&gt;
For models like this, ASCEND can quickly show you how it&#039;s solving the equation, using a simple graph representation:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:solve-order.png]]&lt;br /&gt;
&lt;br /&gt;
Simple models like this can be useful and quite efficient ways to inspect the behaviour of simple systems of equations. They can also be useful as quick &#039;calculators&#039;: they can be loaded, the known variables typed in, and the solved results quickly seen.&lt;br /&gt;
&lt;br /&gt;
ASCEND provides a way to keep tables of &#039;observed&#039; values and plot relationships between variables:&lt;br /&gt;
&lt;br /&gt;
[[Image:observer.png]][[Image:observer-plot.png]]&lt;br /&gt;
&lt;br /&gt;
Note that ASCEND is dealing with [[units of measurement]] clearly and transparently. In ASCEND you never have to worry about &#039;getting the units right&#039; because it understands how to convert between different units like in, ft, cm, m, km for length and L, m³ etc for volume.&lt;br /&gt;
&lt;br /&gt;
To learn more about the ASCEND modelling language and how it can be used to build up models, see the [[Thin Walled Tank]] tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== More complex models ==&lt;br /&gt;
&lt;br /&gt;
Simple models like this are useful, but serious problems, especially in process engineering and mechanical engineering often involve more complex interactions, often with multiple subsystems, interconnected parts, and so on. In this case, ASCEND provides a number of [[object-oriented modelling]] capabilities, allowing more complicated models to be declared, such as this simple steam power station (Rankine cycle) simulation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;REQUIRE &amp;amp;quot;johnpye/rankine.a4c&amp;amp;quot;;&lt;br /&gt;
MODEL power_station;&lt;br /&gt;
&lt;br /&gt;
	(* sub-models *)&lt;br /&gt;
	BO IS_A boiler_simple;&lt;br /&gt;
	TU IS_A turbine_simple;&lt;br /&gt;
&lt;br /&gt;
	CO IS_A condenser_simple;&lt;br /&gt;
	PU IS_A pump_simple;&lt;br /&gt;
&lt;br /&gt;
	(* variable &#039;alias&#039; for convenience *)&lt;br /&gt;
&lt;br /&gt;
	mdot ALIASES TU.mdot;&lt;br /&gt;
&lt;br /&gt;
	(* connections *)&lt;br /&gt;
	BO.outlet, TU.inlet ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
	TU.outlet, CO.inlet ARE_THE_SAME;&lt;br /&gt;
	CO.outlet, PU.inlet ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
	PU.outlet, BO.inlet ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
	(* overall cycle efficiency *)&lt;br /&gt;
	eta IS_A fraction;&lt;br /&gt;
&lt;br /&gt;
	eta * (BO.Qdot_fuel - PU.Wdot) = TU.Wdot;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD specify;&lt;br /&gt;
	RUN ClearAll;&lt;br /&gt;
	FIX PU.outlet.p, BO.outlet.T, PU.inlet.p, PU.inlet.h, TU.eta, PU.eta, BO.eta, mdot;&lt;br /&gt;
&lt;br /&gt;
END specify;&lt;br /&gt;
METHOD values;&lt;br /&gt;
	mdot := 900 {t/d};&lt;br /&gt;
&lt;br /&gt;
	PU.outlet.p := 2000 {psi};&lt;br /&gt;
	BO.outlet.T := 1460 {R};   BO.outlet.h := 3400 {kJ/kg};&lt;br /&gt;
&lt;br /&gt;
	PU.inlet.p := 1 {psi};     PU.inlet.h := 69.73 {btu/lbm};&lt;br /&gt;
&lt;br /&gt;
	TU.eta := 1.0;             PU.eta := 1.0;             BO.eta := 1.0;&lt;br /&gt;
&lt;br /&gt;
END values;&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	RUN specify;&lt;br /&gt;
	RUN values;&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
END power_station;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This model makes use of several sub-parts such as &#039;pump_simple&#039; and so on, which are defined in another file called &#039;rankine.a4c&#039; pointed to via the [[REQUIRE]] statement. More documentation [[Category:Syntax|about the syntax]] is available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using this style of modular model, it is possible to build and test simple component models, then &#039;wire them up&#039; into more complex models. This is something that is very difficult to do with standard spreadsheet models as commonly used by engineers. With a library of standard component models at your disposal, you can get working sooner on the complex problems which you have before you.&lt;br /&gt;
&lt;br /&gt;
See [[Object-oriented modelling]] for a summary of language features that help in writing more complex models. You might also be interested in our thoughts about [[Modelling with Spreadsheets]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solvers and integrators ==&lt;br /&gt;
&lt;br /&gt;
The basic engineering calculation being represented in the above examples is a simple &amp;quot;solve for &#039;x&#039;&amp;quot; type of problem, for which ASCEND uses its [[QRSlv]] solver. For these problems ASCEND orders the equations, then uses [http://en.wikipedia.org/wiki/Newton%27s_method Newton&#039;s method] to iteratively solve any sets of simultaneous equations present in the system. However not all engineering problems are like this. Other types of problems can also be solved using ASCEND:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Optimisation|Optimisation problems]], where an objective value must be minimised by varying a set of input variables (see [[CONOPT]], [[IPOPT]])&lt;br /&gt;
* [[ODE]] and [[DAE]] problems, where the behaviour of a time-varying system is to be studied (see [[LSODE]], [[IDA]])&lt;br /&gt;
* [[Conditional_modelling|Conditional models]], where the applicable equations depend on the value or values of other variables in the model (see [[CMSlv]])&lt;br /&gt;
&lt;br /&gt;
The ASCEND GUI allows you to load a model then select a suitable &#039;solver&#039; or &#039;integrator&#039; according to the type of problem that you have. Several solvers are already included with ASCEND, and the API allows you to write new solvers without having to dig into the innards of ASCEND.&lt;br /&gt;
&lt;br /&gt;
ASCEND can show you the model structure as &#039;viewed&#039; by the solver. For example, using [[QRSlv]], the simple Rankine-cycle model has the following lower-triangular [[incidence matrix]] structure, which indicates that no iterative solving is needed:&lt;br /&gt;
&lt;br /&gt;
[[Image:rankine-incidence.png]]&lt;br /&gt;
&lt;br /&gt;
See [[Solvers]] and [[Dynamic modelling]] for more information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Thermodynamics ==&lt;br /&gt;
&lt;br /&gt;
An area where process engineers often run into difficulty with modelling is in incorporating the thermodynamic properties of fluids in their models. ASCEND provides some simple thermodynamics capabilities, which have proven sufficient for modelling distillation and flash problems in chemical engineering, and also integrates with high-accuracy IAPWS-IF97 steam tables for use in power engineering applications.&lt;br /&gt;
&lt;br /&gt;
See [[Thermodynamics with ASCEND]], [[FPROPS]] and [[Steam properties]] for more information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Extending ASCEND ==&lt;br /&gt;
&lt;br /&gt;
ASCEND can be extended in a number of ways, using [[external libraries]]. These are pieces of code that ASCEND loads on request. They can be:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[External Methods]], doing procedural stuff to models&lt;br /&gt;
* [[external relations]], adding new equations to the model, such as complex thermodynamic property relationships&lt;br /&gt;
* [[External Solvers]], that solve a model, according to the programmer&#039;s definition of &#039;solve&#039;&amp;amp;nbsp;:-)&lt;br /&gt;
* [[external Integrators]], that integrate a model (ie solve for the dynamic response of a system; solve an inital value problem)&lt;br /&gt;
&lt;br /&gt;
External libraries are normally written in C/C++, but we have implemented support for also writing external methods using Python.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scripting and automation ==&lt;br /&gt;
&lt;br /&gt;
ASCEND exposes its user interface at several different levels: C, C++ and Python. Usefully, this means that if you have a more complicated modelling problem than can be solved with the ASCEND GUI, you can write a Python script that loads your model and solves it in various ways: effectively you can &#039;drive&#039; ASCEND however you want, automatically.&lt;br /&gt;
&lt;br /&gt;
See [[Scripting ASCEND using Python]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Development of ASCEND ==&lt;br /&gt;
&lt;br /&gt;
ASCEND does enough things to be genuinely useful for engineers, students and scientists, and has an active user group. It was first written around 1978, and has been through several re-writes over that time. Its &#039;compiler&#039; (which converts the input file into a tree structure containing variables, submodels, and equations) as well as its solvers have been the subject of several PhDs and many features in ASCEND have since been incorporated into commercial simulation programs. Development of ASCEND continues in exciting new directions however. We are working on adding new solvers as well as improving ASCEND&#039;s support for solving ODEs and DAEs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are interested in contributing to ASCEND, please see our [[Development Activities]] page and also our list of [[Student Projects]]. We have been accepted to participate in the the 2009Google Summer of Code, so you might even be able to get paid!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Category:Documentation&amp;diff=168</id>
		<title>Category:Documentation</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Category:Documentation&amp;diff=168"/>
		<updated>2010-05-13T14:01:46Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you are new to ASCEND, &#039;&#039;&#039;it is recommended that you start with the [[ASCEND overview]]&#039;&#039;&#039;, then try working through the new &#039;&#039;&#039;[[Intro_to_ASCEND_-_thin_walled_tank|tutorial]]&#039;&#039;&#039;, which introduces the ASCEND modelling language. &lt;br /&gt;
&lt;br /&gt;
More detailed documentation is available from the &#039;&#039;&#039;&amp;lt;a href=&amp;quot;/images/6/61/Book.pdf&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Book.pdf&amp;quot;&amp;gt;ASCEND Manual (1.3 MB .pdf)&amp;lt;/a&amp;gt;&#039;&#039;&#039;, but note that it largely refers to the older Tcl/Tk-based GUI, and the recommended GUI is the newer PyGTK-based GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need help getting ASCEND running on your machine, please check the &#039;&#039;&#039;[[Quick Start]] guide&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Category:Development|Developer documentation]]&#039;&#039;&#039; exists under a separate top-level category heading.&lt;br /&gt;
&lt;br /&gt;
See also&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://ascend.cheme.cmu.edu/pdfhelp.htm Older versions] of the documentation&lt;br /&gt;
* [http://ascend.cheme.cmu.edu/ascend_bibliography.htm ASCEND bibliography]&lt;br /&gt;
* [[History of ASCEND]]&lt;br /&gt;
&amp;lt;div id=&amp;quot;mw-subcategories&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Subcategories&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This category has the following 6 subcategories, out of 6 total.&lt;br /&gt;
&amp;lt;h3&amp;gt;E&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Category:Examples|Examples]]&lt;br /&gt;
* [[Category:Experimental|Experimental]]&lt;br /&gt;
* [[Category:Extending_ASCEND|Extending ASCEND]]&amp;lt;h3&amp;gt;S&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Category:Solvers|Solvers]]&lt;br /&gt;
* [[Category:Syntax|Syntax]]&amp;lt;h3&amp;gt;T&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Category:Tutorials|Tutorials]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;div id=&amp;quot;mw-pages&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Pages in category &amp;quot;Documentation&amp;quot;&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following 92 pages are in this category, out of 92 total.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;A&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[ALIASES]]&lt;br /&gt;
* [[ARE ALIKE]]&lt;br /&gt;
* [[ARE THE SAME]]&lt;br /&gt;
* [[ASCEND Model Library]]&lt;br /&gt;
* [[ASCEND capabilities]]&lt;br /&gt;
* [[ASCEND overview]]&lt;br /&gt;
* [[Arrays and sets]]&lt;br /&gt;
&amp;lt;h3&amp;gt;B&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Boundary detection]]&lt;br /&gt;
* [[Building ASCEND]]&lt;br /&gt;
&amp;lt;h3&amp;gt;C&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Calculation of sun position]]&lt;br /&gt;
* [[Checking models]]&lt;br /&gt;
* [[Conditional modelling]]&lt;br /&gt;
* [[Create with understanding]]&lt;br /&gt;
&amp;lt;h3&amp;gt;D&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[DATA]]&lt;br /&gt;
* [[Damped response]]&lt;br /&gt;
* [[Diagnose tool]]&lt;br /&gt;
* [[Documentation systems]]&lt;br /&gt;
* [[Dynamic modelling]]&lt;br /&gt;
&amp;lt;h3&amp;gt;E&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[EXTERNAL]]&lt;br /&gt;
* [[Environment variables for ASCEND]]&lt;br /&gt;
* [[EnzymeKinetics]]&lt;br /&gt;
* [[Equation]]&lt;br /&gt;
* [[External libraries]]&lt;br /&gt;
* [[External relations]]&lt;br /&gt;
&amp;lt;h3&amp;gt;F&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[FIX]]&lt;br /&gt;
* [[FOR]]&lt;br /&gt;
* [[FPROPS]]&lt;br /&gt;
* [[FREE]]&lt;br /&gt;
* [[Freesteam]]&lt;br /&gt;
&amp;lt;h3&amp;gt;G&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Goal seeking solver]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;H&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[History of ASCEND]]&lt;br /&gt;
* [[How do I fix my model]]&lt;br /&gt;
* [[HydroSim]]&lt;br /&gt;
&amp;lt;h3&amp;gt;I&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IDA]]&lt;br /&gt;
* [[IMPORT]]&lt;br /&gt;
* [[IPOPT]]&lt;br /&gt;
* [[IS A]]&lt;br /&gt;
* [[IS REFINED TO]]&lt;br /&gt;
* [[Incidence Graph]]&lt;br /&gt;
* [[Incidence matrix]]&lt;br /&gt;
* [[Instance hierarchy]]&lt;br /&gt;
&amp;lt;h3&amp;gt;M&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[MAXIMIZE]]&lt;br /&gt;
* [[METHODS]]&lt;br /&gt;
* [[MINIMIZE]]&lt;br /&gt;
* [[MODEL]]&lt;br /&gt;
* [[Model self-testing]]&lt;br /&gt;
* [[ModellingTechniques]]&lt;br /&gt;
* [[More documentation]]&lt;br /&gt;
&amp;lt;h3&amp;gt;N&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[NOTES]]&lt;br /&gt;
&amp;lt;h3&amp;gt;O&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Object-oriented modelling]]&lt;br /&gt;
* [[Observers]]&lt;br /&gt;
* [[Optimisation]]&lt;br /&gt;
* [[Other modelling tools]]&lt;br /&gt;
&amp;lt;h3&amp;gt;P&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[PROVIDE]]&lt;br /&gt;
* [[Parametric studies]]&lt;br /&gt;
* [[Plotting in ASCEND]]&lt;br /&gt;
* [[Prerequisites for Linux]]&lt;br /&gt;
* [[Prerequisites for Windows]]&lt;br /&gt;
* [[PyGTK GUI command-line parameters]]&lt;br /&gt;
* [[PyGTK Quick Guide]]&lt;br /&gt;
* [[PyGTK Screenshots]]&lt;br /&gt;
| &lt;br /&gt;
&amp;lt;h3&amp;gt;P cont.&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[PythonWrapper]]&lt;br /&gt;
&amp;lt;h3&amp;gt;Q&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Quick Start]]&lt;br /&gt;
&amp;lt;h3&amp;gt;R&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[REQUIRE]]&lt;br /&gt;
* [[Referenced examples]]&lt;br /&gt;
* [[Running the Python/PyGTK GUI on Windows]]&lt;br /&gt;
&amp;lt;h3&amp;gt;S&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[SELECT]]&lt;br /&gt;
* [[Scaling]]&lt;br /&gt;
* [[Scripting ASCEND using Python]]&lt;br /&gt;
* [[Sensitivity study]]&lt;br /&gt;
* [[Solver NOTES]]&lt;br /&gt;
* [[Structured models]]&lt;br /&gt;
* [[Supporting RPMs]]&lt;br /&gt;
* [[Syntax highlighting]]&lt;br /&gt;
&amp;lt;h3&amp;gt;T&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[TclTk screenshots]]&lt;br /&gt;
* [[Thermodynamics with ASCEND]]&lt;br /&gt;
&amp;lt;h3&amp;gt;U&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[UNIFAC model]]&lt;br /&gt;
* [[Units of measurement]]&lt;br /&gt;
* [[Useful resources]]&lt;br /&gt;
&amp;lt;h3&amp;gt;V&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[VLEWhy]]&lt;br /&gt;
* [[Vapor-liquid equilibrium]]&lt;br /&gt;
* [[Variable]]&lt;br /&gt;
* [[Vleexample]]&lt;br /&gt;
&amp;lt;h3&amp;gt;W&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[WHEN]]&lt;br /&gt;
* [[WHERE]]&lt;br /&gt;
* [[WHILE]]&lt;br /&gt;
* [[WILL BE]]&lt;br /&gt;
* [[WILL BE THE SAME]]&lt;br /&gt;
* [[What if I do not have CONOPT]]&lt;br /&gt;
* [[Worked examples]]&lt;br /&gt;
* [[Writing ASCEND external relations in C]]&lt;br /&gt;
&amp;lt;h3&amp;gt;X&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Xgraph]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;div id=&amp;quot;mw-category-media&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Media in category &amp;quot;Documentation&amp;quot;&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following 3 files are in this category, out of 3 total.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;div class=&amp;quot;gallerybox&amp;quot; style=&amp;quot;width: 155px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb&amp;quot; style=&amp;quot;padding: 13px 0; width: 150px;&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;margin-left: auto; margin-right: auto; width: 120px;&amp;quot;&amp;gt;[[Image:Book.pdf]]&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;gallerytext&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Book.pdf|Book.pdf]]&amp;lt;br /&amp;gt;&lt;br /&gt;
1,344,205 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;| &amp;lt;div class=&amp;quot;gallerybox&amp;quot; style=&amp;quot;width: 155px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb&amp;quot; style=&amp;quot;padding: 13px 0; width: 150px;&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;margin-left: auto; margin-right: auto; width: 120px;&amp;quot;&amp;gt;[[Image:DifferentialAlgebraicEqn.pdf]]&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;gallerytext&amp;quot;&amp;gt;&lt;br /&gt;
[[File:DifferentialAlgebraicEqn.pdf|DifferentialAlgebrai...]]&amp;lt;br /&amp;gt;&lt;br /&gt;
50,241 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;| &amp;lt;div class=&amp;quot;gallerybox&amp;quot; style=&amp;quot;width: 155px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb&amp;quot; style=&amp;quot;padding: 13px 0; width: 150px;&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;margin-left: auto; margin-right: auto; width: 120px;&amp;quot;&amp;gt;[[Image:Howto_thermo.pdf]]&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;gallerytext&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Howto_thermo.pdf|Howto thermo.pdf]]&amp;lt;br /&amp;gt;&lt;br /&gt;
197,576 bytes&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Thermodynamics_with_ASCEND&amp;diff=167</id>
		<title>Thermodynamics with ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Thermodynamics_with_ASCEND&amp;diff=167"/>
		<updated>2010-05-13T14:01:37Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ASCEND [[ModelLibrary]] includes a range of models for dealing with chemical and physical properties of materials, phase equilibrium, and reaction kinetics.&lt;br /&gt;
&lt;br /&gt;
We have a brief &#039;HOW TO&#039; guide for doing thermodynamics calculations with ASCEND, thanks for [http://pedro.valelima.com/phd/ Pedro Vale Lima], here: &amp;lt;a href=&amp;quot;/images/9/97/Howto_thermo.pdf&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Howto thermo.pdf&amp;quot;&amp;gt;Media:howto_thermo.pdf&amp;lt;/a&amp;gt;. The following text is our partial (ongoing) transcription of that document into wikitext.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In addition to the methods described in this page, there are other ways of calculating thermodynamic properties using ASCEND. See [[FPROPS]] and [[freesteam]] for example.&lt;br /&gt;
&lt;br /&gt;
You can access the models from the HOW TO in the [[ModelLibrary]] as {{src|models/thermodynamics_example.a4c}}.&lt;br /&gt;
&lt;br /&gt;
== Physical property data ==&lt;br /&gt;
Physical property data from the book Reid, Prausnitz &amp;amp;amp; Polling, &#039;&#039;The Properties of Gases and Liquids&#039;&#039;, 4th Ed.,McGraw-Hill, 1987, are included in the ASCEND model file {{src|models/components.a4l}}.&lt;br /&gt;
&lt;br /&gt;
To add support for a new fluid component, it is suggested that you create your own copy of that file, and add some new code. First add your component to the &amp;lt;tt&amp;gt;supported_components&amp;lt;/tt&amp;gt; list:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;supported_components :== [&lt;br /&gt;
   &#039;hydrogen&#039;&lt;br /&gt;
   ,&#039;carbon_dioxide&#039;&lt;br /&gt;
   ,(* add another one here *)&lt;br /&gt;
];&amp;lt;/source&amp;gt;&lt;br /&gt;
Then, add a CASE in the [[SWITCH]] statement to define the constants for your particular substance:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;CASE &#039;my_new_substance&#039;:&lt;br /&gt;
   rpp_index :== 111;&lt;br /&gt;
&lt;br /&gt;
   (* add your data here... *)&amp;lt;/source&amp;gt;&lt;br /&gt;
Here is the meaning of the constants that are used in the components models:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  constant !  meaning&lt;br /&gt;
|-&lt;br /&gt;
|  rpp_index |  Index in the Reid et al book&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  formula |  Chemical formula (optional, informational only)&lt;br /&gt;
|-&lt;br /&gt;
|  subgroups |  Component subgroups for the [[UNIFAC model]].&lt;br /&gt;
|-&lt;br /&gt;
|  wilson_set |  Wilson groups for the [[Wilson liquid model]].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  mw |  Molecular weight&lt;br /&gt;
|-&lt;br /&gt;
|  Tb |  Boiling-point temperature (at what pressure??)&lt;br /&gt;
|-&lt;br /&gt;
|  Tc |  Temperature at critical point&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  Pc |  Pressure at critical point&lt;br /&gt;
|-&lt;br /&gt;
|  Vc |  (Molar?) volume at critical point&lt;br /&gt;
|-&lt;br /&gt;
|  Zc |  Compressibility factor at critical point.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  omega |  Pitzer acentric factor&lt;br /&gt;
|-&lt;br /&gt;
|  cpvap&#039;&#039;a..d&#039;&#039; |  Constants for vapour-phase &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;c&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; calculation.&amp;lt;br /&amp;gt;&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;c&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/sub&amp;gt; = &#039;&#039;a&#039;&#039; + &#039;&#039;b&#039;&#039;&#039;&#039;T&#039;&#039; + &#039;&#039;c&#039;&#039;&#039;&#039;T&#039;&#039;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + &#039;&#039;d&#039;&#039;&#039;&#039;T&#039;&#039;&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  Hf |  Enthalpy of formation&lt;br /&gt;
|-&lt;br /&gt;
|  Gf |  Gibbs free energy of formation&lt;br /&gt;
|-&lt;br /&gt;
|  vp&#039;&#039;a..d&#039;&#039; |  Constants for vapour pressure calculation (three equations can be used)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  vp_correlation |  Number that represents which correlation is used for calculation of vapour pressure&lt;br /&gt;
|-&lt;br /&gt;
|  Hv |  Enthalpy of vapourisation&lt;br /&gt;
|-&lt;br /&gt;
|  lden |  Liquid density&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  Tliq |  Temperature at which the liquid density (lden) is specified.&lt;br /&gt;
|}&lt;br /&gt;
Finally, add the name of your new component in the check list of &amp;lt;tt&amp;gt;components&amp;lt;/tt&amp;gt; model:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;FOR i IN components DO&lt;br /&gt;
&lt;br /&gt;
   ASSERT (i IN [&#039;hydrogen&#039;, &#039;carbon_dioxide&#039; (* others here *)) == TRUE;&lt;br /&gt;
&lt;br /&gt;
END FOR;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating properties for a single component ==&lt;br /&gt;
&lt;br /&gt;
The simples state to model is the one that represents a single component in a single phase. To elaborate this model, one needs an [http://en.wikipedia.org/wiki/Equation_of_state equation of state] (EOS). As there is no universal equation of state, the thermodynamic libraries in ASCEND contain several models, and leave the decision about which one to use up to the user.&lt;br /&gt;
&lt;br /&gt;
The ASCEND thermodynamics library has two models for vapour components (&#039;&#039;&#039;&amp;lt;tt&amp;gt;ideal_vapour_component&amp;lt;/tt&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;tt&amp;gt;Pitzer_vapor_component&amp;lt;/tt&amp;gt;&#039;&#039;&#039;) and one model for liquid components (&#039;&#039;&#039;&amp;lt;tt&amp;gt;Rackett_liquid_component&amp;lt;/tt&amp;gt;&#039;&#039;&#039;). All these models are similar in concept; only the EOS changes. We&#039;ll use the ideal vapour model to illustrate the main concepts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The model defines the equations needed to calculate the molar volume &amp;lt;math&amp;gt;{\bar v}&amp;lt;/math&amp;gt;, enthalpy &amp;lt;math&amp;gt;{\bar h}&amp;lt;/math&amp;gt; and Gibbs free energy &amp;lt;math&amp;gt;{\bar g}&amp;lt;/math&amp;gt;, based on the temperature &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt;, pressure &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; and component properties.&lt;br /&gt;
&lt;br /&gt;
The first equation needed by the ideal gas model is the well known equation of state,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;p{\bar v}={\bar R}T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;{\bar R}&amp;lt;/math&amp;gt; is the ideal gas constant. To define &amp;lt;math&amp;gt;{\bar h}&amp;lt;/math&amp;gt;, one can use the constant-pressure molar heat capacity, &amp;lt;math&amp;gt;{\bar c}_p&amp;lt;/math&amp;gt;. The heat capacity is define implicitly as a polynomial function of temperature:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar c}_p = a + b T + c T^2 + d T^3&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &#039;&#039;a&#039;&#039;, &#039;&#039;b&#039;&#039;, &#039;&#039;c&#039;&#039;, and &#039;&#039;d&#039;&#039; are defined (as &amp;lt;tt&amp;gt;cpvap&#039;&#039;a..d&#039;&#039;&amp;lt;/tt&amp;gt;) in the components data file. Remembering that, for an ideal gas, &amp;lt;math&amp;gt;{\bar h}&amp;lt;/math&amp;gt; is defined as&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar h} - {\bar h}_0 = \int_{T_0}^{T} {\bar c}_p dT&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
results in the following explicit equation for &amp;lt;math&amp;gt;{\bar h}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar h} = {\bar h}_0 + a (T-T_0) + \frac{1}{2}{b (T^2 - T_0^2)} + \frac{1}{3}c (T^3 - T_0^3) + \frac{1}{4}d (T^4 - T_0^4)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that, if it were &#039;&#039;not&#039;&#039; an ideal gas, &amp;lt;math&amp;gt;{\bar h}&amp;lt;/math&amp;gt; would also depend on &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt;. Looking back again to your old thermodynamics textbook, it can then be proven that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d ( \frac{\bar g}{{\bar R}T} ) = \frac{\bar v}{{\bar R}T} dp - \frac{\bar h}{{\bar R}T^2}dT&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Substitution of equations 1 and 4 on equation 5 followed by equation yields an equation for &amp;lt;math&amp;gt;{\bar g}&amp;lt;/math&amp;gt; with the form&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar g = {\bar g}(p,T)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As a summary, this model has three equations (eqs 1, 4, 6), and five variables (&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt;, &#039;&#039;T&#039;&#039;, &amp;lt;math&amp;gt;\bar g&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\bar h&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\bar v&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ASCEND implementation ===&lt;br /&gt;
&lt;br /&gt;
In the thermodynamics library, we see the above code defined as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL ideal_vapor_component(&lt;br /&gt;
    P WILL_BE pressure;&lt;br /&gt;
&lt;br /&gt;
    T WILL_BE temperature;&lt;br /&gt;
    data WILL_BE td_component_constants;&lt;br /&gt;
) REFINES pure_component;&lt;br /&gt;
&lt;br /&gt;
    (*... *)&lt;br /&gt;
END ideal_vapor_component;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the ASCEND single-component model ===&lt;br /&gt;
&lt;br /&gt;
The [[Object-oriented_modelling|parametric model declaration]] above tells you that if you want to instantiate an &#039;ideal_vapor_component&#039;, then you need to first declare variables for pressure &#039;P&#039; and temperature &#039;T&#039;, as well as the thermodynamic data &#039;data&#039;. Hence, we can create out little model for evaluating these properties as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* Simple example for vapour properties of water from ideal gas equation *)&lt;br /&gt;
REQUIRE &amp;amp;quot;thermodynamics.a4l&amp;amp;quot;;&lt;br /&gt;
REQUIRE &amp;amp;quot;johnpye/thermo_types.a4c&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL my_props;&lt;br /&gt;
    p IS_A pressure;&lt;br /&gt;
    T IS_A temperature;&lt;br /&gt;
&lt;br /&gt;
    cd IS_A components_data([&#039;water&#039;],&#039;water&#039;);&lt;br /&gt;
    props IS_A ideal_vapor_component(p,T,cd.data[&#039;water&#039;]);&lt;br /&gt;
&lt;br /&gt;
    v_m ALIASES props.v;&lt;br /&gt;
    v IS_A specific_volume;&lt;br /&gt;
    v = Vm / props.data.mw;&lt;br /&gt;
&lt;br /&gt;
    rho IS_A mass_density;&lt;br /&gt;
    rho = 1./v;&lt;br /&gt;
    h_m ALIASES props.h;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
    RUN props.default_all;&lt;br /&gt;
    RUN props.specify;&lt;br /&gt;
&lt;br /&gt;
    p := 1 {atm};&lt;br /&gt;
    T := 400 {K};&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
END my_props;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this model, ASCEND returns a calculated value of the mass-density of steam at 400 K and 1 bar as 0.54892 kg/m³. Calculation using the IAPWS-IF97 steam correlations (using [[freesteam]] via Python, specifically) gives me 0.54758 kg/m³, so the difference between the ideal gas calculation and the more rigorous correlation is not that great in this case.&lt;br /&gt;
&lt;br /&gt;
Note that this model also calculates the molar Gibbs free energy and molar enthalpy for the single component.&lt;br /&gt;
&lt;br /&gt;
We can now use this model to solve a simple example problem:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 1 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Find the change in enthalpy for water that is heated from 125 °C to 225 °C at constant pressure of 1 bar.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A model that performs this calculation is shown here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* model to calculate change in enthalpy from 125°C to 225 °C at 1 bar. *)&lt;br /&gt;
MODEL example_1;&lt;br /&gt;
&lt;br /&gt;
	A, B IS_A my_props;&lt;br /&gt;
	A.p, B.p ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
	dh_m IS_A molar_energy;&lt;br /&gt;
	dh_m = B.h_m - A.h_m;&lt;br /&gt;
&lt;br /&gt;
	dh IS_A specific_enthalpy;&lt;br /&gt;
	dh = dh_m / A.props.data.mw;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	RUN A.on_load;&lt;br /&gt;
	RUN B.on_load;&lt;br /&gt;
&lt;br /&gt;
	A.T := 273.15 {K} + 125 {K};&lt;br /&gt;
&lt;br /&gt;
	B.T := 273.15 {K} + 225 {K};&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
END example_1;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This model gives the result that the change in molar enthalpy &amp;lt;math&amp;gt;\Delta {\bar h}&amp;lt;/math&amp;gt; (which in the model we call &#039;dh_m&#039;) is equal to 3.4902 kJ/kmol. And we calculate the change in specific enthalpy &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;Delta;&#039;&#039;h&#039;&#039;&amp;lt;/span&amp;gt; to be 193.74 kJ/kg. This value compares fairly well with values from steam tables: for this process, Heywood gives &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;Delta;&#039;&#039;h&#039;&#039;&amp;lt;/span&amp;gt; = 199 kJ/kg, so the error is ~3%.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The standard model for liquid components in ASCEND (&#039;&#039;&#039;&amp;lt;tt&amp;gt;Rackett_liquid_component&amp;lt;/tt&amp;gt;&#039;&#039;&#039;) has one slight difference from the vapour model present. As the enthalpy and free energy depend on knowledge of the vapor pressure, there is an additional equation with the correlation to calculate this value. You still have two degrees of freedom, but now you have six variables and four equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 2 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calculate the temperature at which the vapour pressure for water is 1 atm.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To solve this problem, we start with the first model that was used here, but modify it to use the Rackett liquid component model instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* model to calculate temperature at which vapour pressure of water is 1 atm *)&lt;br /&gt;
MODEL example_2;&lt;br /&gt;
&lt;br /&gt;
    p IS_A pressure;&lt;br /&gt;
    T IS_A temperature;&lt;br /&gt;
    cd IS_A components_data([&#039;water&#039;],&#039;water&#039;);&lt;br /&gt;
&lt;br /&gt;
    props IS_A Rackett_liquid_component(p,T,cd.data[&#039;water&#039;]);&lt;br /&gt;
&lt;br /&gt;
	v_m ALIASES props.v;&lt;br /&gt;
	v IS_A specific_volume;&lt;br /&gt;
&lt;br /&gt;
	v = v_m / props.data.mw;&lt;br /&gt;
	rho IS_A mass_density;&lt;br /&gt;
&lt;br /&gt;
	rho = 1./v;&lt;br /&gt;
&lt;br /&gt;
	p_vap ALIASES props.VP;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
    RUN props.default_all;&lt;br /&gt;
	RUN props.specify;&lt;br /&gt;
&lt;br /&gt;
	p := 1 {atm};&lt;br /&gt;
&lt;br /&gt;
	(* reconfigure the program to solve with fixed VP and free T... *)&lt;br /&gt;
	FREE T;&lt;br /&gt;
&lt;br /&gt;
	FIX p_vap;&lt;br /&gt;
	p_vap := 1 {atm};&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
&lt;br /&gt;
END example_2;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solving this model gives the result that &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; = 373.14 K, which is close enough (0.014 K) to the expected value of 100 °C or 273.15 K.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mixtures ==&lt;br /&gt;
&lt;br /&gt;
As with the model for single components, the model for mixtures attempts to represent the mixture molar volume, enthalpy, and Gibbs free energy.&lt;br /&gt;
&lt;br /&gt;
To understand this model, we present an example. Suppose you have a mixture of two components and want to calculate the molar volume. For each component you first calculate the molar volume for each pure species &amp;lt;math&amp;gt;{\bar v}_i^p&amp;lt;/math&amp;gt;, where &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;i&#039;&#039;&amp;lt;/span&amp;gt; is the index for the component, and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; signifies &#039;pure&#039;), using the models from the previous section. Then you calculate the molar volume for the species &#039;&#039;in the mixture&#039;&#039;, &amp;lt;math&amp;gt;{\bar v}_i&amp;lt;/math&amp;gt;, assuming some model for the mixing. At last, the molar volume is the sum of all species contributions weighted by the molar fraction of the species in the mixture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, for an ideal gas mixture, we would have the following:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;p {\bar v}_i^p = {\bar R} T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar v}_i = {\bar v}_i^p&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar v} = \sum_i {y_i {\bar v}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first equation comes from the &amp;lt;tt&amp;gt;ideal_vapor_component&amp;lt;/tt&amp;gt; model (and there is one such equation for each component in the mixture). The second equation comes from the &amp;lt;tt&amp;gt;ideal_vapor_mixture&amp;lt;/tt&amp;gt; model (again, one for each component). The last one is generic for all mixture models (and is part of the &amp;lt;tt&amp;gt;phase_partials&amp;lt;/tt&amp;gt; model from which all mixture models are inherited).&lt;br /&gt;
&lt;br /&gt;
The same concepts apply to enthalpy and Gibbs free energy. The equations for ideal vapour mixing and mixture calculation are the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;p {\bar h}_i^p = {\bar h}_i^p&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar h} = \sum_i {y_i {\bar h}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar g}_i = {\bar g}_i^p + {\bar R} T \ln(y_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar g} = \sum_i {y_i {\bar g}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This model has one extra special equation whose meaning will be easier to understand after talking about phase equilibria:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span style=&amp;quot;font-size: x-large; font-family: serif;&amp;quot;&amp;gt;&amp;amp;sum;&amp;lt;/span&amp;gt;| &#039;&#039;y&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;i&#039;&#039;&amp;lt;/sub&amp;gt; + &#039;&#039;s&#039;&#039; = 1|-&lt;br /&gt;
| &#039;&#039;i&#039;&#039;| |}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This equation introduces a new variable &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;/span&amp;gt; called &amp;lt;tt&amp;gt;slack_PhaseDisappearance&amp;lt;/tt&amp;gt;. With this formulation of the molar fraction sum, when &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;/span&amp;gt; is fixed at 0, normal calculations are performed; when &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;/span&amp;gt; is free, if the phase ceases to exist, &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;/span&amp;gt; will be different from zero but simulation can continue. It&#039;s a clever and important trick for multi-phase equilibria. We will return to this issue later.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To review the variables and equations present in an idea gas mixture, note that for &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039;&amp;lt;/span&amp;gt; components, we have &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;3&#039;&#039;n&#039;&#039;&amp;lt;/span&amp;gt; ideal vapour component equations, and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;3&#039;&#039;n&#039;&#039; + 4&amp;lt;/span&amp;gt; mixture equations. As far as variables, we have these values for the overall mixture: p, T, h, v, g,s&amp;amp;nbsp;; then we have these values for each component:  (FIXME).&lt;br /&gt;
&lt;br /&gt;
Just a minor warning: when using models where &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039; &amp;amp;minus; 1&amp;lt;/span&amp;gt; components are fixed, usually the un-fixed one is the &#039;reference component&#039;. But be sure to check this and save yourself some trouble later. Let&#039;s see this mixture code in action now.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 3 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calculate the change of enthalpy for a mixture of 60% water and 40% enthanol going from 400 to 500 K.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First look at the declaration of the &#039;&#039;&#039;&amp;lt;tt&amp;gt;ideal_vapor_mixture&amp;lt;/tt&amp;gt;&#039;&#039;&#039; model to work out the necessary structure. Using that, we declare our model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL water_and_ethanol;&lt;br /&gt;
&lt;br /&gt;
	cd IS_A components_data([&#039;water&#039;,&#039;ethanol&#039;], &#039;water&#039;);&lt;br /&gt;
	props IS_A ideal_vapor_mixture(cd);&lt;br /&gt;
&lt;br /&gt;
	p ALIASES props.P;&lt;br /&gt;
	T ALIASES props.T;&lt;br /&gt;
&lt;br /&gt;
	h_m ALIASES props.h_y;&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	RUN props.default_self;&lt;br /&gt;
&lt;br /&gt;
	RUN props.specify;&lt;br /&gt;
	RUN props.values;&lt;br /&gt;
	p := 1 {atm};&lt;br /&gt;
&lt;br /&gt;
	T := 400 {K};&lt;br /&gt;
	props.y[&#039;ethanol&#039;]&amp;amp;nbsp;:= 0.4;&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
END water_and_ethanol;&lt;br /&gt;
&lt;br /&gt;
MODEL example_3;&lt;br /&gt;
	A, B IS_A water_and_ethanol;&lt;br /&gt;
&lt;br /&gt;
	dh_m IS_A molar_energy;&lt;br /&gt;
	dh_m = B.h_m - A.h_m;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	RUN A.on_load;&lt;br /&gt;
	RUN B.on_load;&lt;br /&gt;
&lt;br /&gt;
	A.T := 400 {K};&lt;br /&gt;
	B.T := 500 {K};&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
END example_3;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This model gives us the result that &amp;lt;math&amp;gt;\Delta {\bar h}&amp;lt;/math&amp;gt; is equal to 5.632 kJ/mol over that temperature increase.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL water_and_ethanol;&lt;br /&gt;
	cd IS_A components_data([&#039;water&#039;,&#039;ethanol&#039;], &#039;water&#039;);&lt;br /&gt;
&lt;br /&gt;
	props IS_A Pitzer_vapor_mixture(cd);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This gives us the slightly different result of &amp;lt;math&amp;gt;\Delta {\bar h}&amp;lt;/math&amp;gt; = 5.724 kJ/mol. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Liquid mixtures ===&lt;br /&gt;
&lt;br /&gt;
For mixtures involving liquids, ASCEND provides the [http://en.wikipedia.org/wiki/UNIFAC UNIFAC] mixture model, which is used together with the Rackett model for liquid properties. The number of equations in the UNIFAC model depends on the number of &#039;UNIFAC groups&#039;, &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;l&#039;&#039;&amp;lt;/span&amp;gt;. For a mixture of &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039;&amp;lt;/span&amp;gt; components, we end up with &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;9&#039;&#039;n&#039;&#039; + 2&#039;&#039;l&#039;&#039; + 4&amp;lt;/span&amp;gt; equations and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;10&#039;&#039;n&#039;&#039; + 2&#039;&#039;l&#039;&#039; + 6&amp;lt;/span&amp;gt; variables, requiring us to fix &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039; + 2&amp;lt;/span&amp;gt; of those variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Phase Equilibria ==&lt;br /&gt;
&lt;br /&gt;
Phase equilibrium is provided by the final set of models in the ASCEND thermodynamics library. These types of models are the base for all sorts of chemical process models, starting from simple streams and working up to complex reaction and separation systems.&lt;br /&gt;
&lt;br /&gt;
To model phase equilibria, one uses the &#039;&#039;&#039;&amp;lt;tt&amp;gt;thermodynamics&amp;lt;/tt&amp;gt;&#039;&#039;&#039; model in the library. This model is the generic model for thermodynamics calculations, in that it can be used both for phase equilibria as well as for just single component properties or multi-phase mixtures. Of course, if you do choose to use the &amp;lt;tt&amp;gt;thermodynamics&amp;lt;/tt&amp;gt; model for these simpler cases then you will be carrying around some unnecessary and redundant equations, but that&#039;s a price you might choose to pay for flexibility. The model has a generic interface and equilibrium relations that are only used for systems with at least two phases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Generic interface ===&lt;br /&gt;
&lt;br /&gt;
As mixtures are models that group simple components, phase equilibria groups the same mixture at different phases. By defining &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;gamma;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt; to be the molar fraction of phase &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/span&amp;gt; we have the usual fraction relation:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^n{\gamma^j} =  1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you must have another three equations to account for the phases:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar v}^p = \sum_i{\gamma^i {\bar v}^i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar h}^p = \sum_i{\gamma^i {\bar h}^i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar g}^p = \sum_i{\gamma^i {\bar g}^i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;{\bar v}^p&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;{\bar h}^p&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;{\bar g}^p&amp;lt;/math&amp;gt; are the mixture properties defined by equations 8, 11 and 13 for each phase.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another group of equations (one for each component) are needed to define a global fraction for a component.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_i = \sum_p {\gamma^p y_i^p}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Relative volatility model ===&lt;br /&gt;
&lt;br /&gt;
This model has extra equations for multi-phase systems in equilibrium. The first group just equates pressures and temperature on all phases to the ones in the reference phase.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt; = &#039;&#039;p&#039;&#039;&amp;lt;sup&amp;gt;ref&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt; = &#039;&#039;T&#039;&#039;&amp;lt;sup&amp;gt;ref&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This accounts for &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;m&#039;&#039; &amp;amp;minus; 1&amp;lt;/span&amp;gt; equations where &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;m&#039;&#039;&amp;lt;/span&amp;gt; is the number of phases (the reference phase is excluded).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, recall the variable &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;/span&amp;gt;, a.k.a. &amp;lt;tt&amp;gt;slack_PhaseDisappearance&amp;lt;/tt&amp;gt;. There is one of these for each mixture. One problem with multiphase models is that models are written thinking of the existence of a phase, and if by some thermodynamics change the phase ceases to exist the equations become invalid. By using the following equation for each phase&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt;&amp;amp;gamma;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt; = 0&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible for a phase to &#039;&#039;disappear&#039;&#039;. If &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;gamma;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt; is not null, which means the phase exists, then &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt; must be zero and by the already-presented relation &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span style=&amp;quot;font-size: x-large; font-family: serif;&amp;quot;&amp;gt;&amp;amp;sum;&amp;lt;/span&amp;gt;| &#039;&#039;y&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;i&#039;&#039;&amp;lt;/sub&amp;gt; + &#039;&#039;s&#039;&#039; = 1|-&lt;br /&gt;
| &#039;&#039;i&#039;&#039;| |}&lt;br /&gt;
&lt;br /&gt;
 the mixture properties must be properly calculated. On the other hand, if &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;gamma;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt; becomes zero then &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;s&#039;&#039;&amp;lt;sup&amp;gt;&#039;&#039;j&#039;&#039;&amp;lt;/sup&amp;gt;&amp;lt;/span&amp;gt; can be relaxed and the model continues to bee solved without regard for that mixture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The library can be used to perform just &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; equilibrium and fractions are computed by specification of relative volatilities. This kind of equilibrium is easier to compute and can be used as a first guess to solve the full equilibrium.&lt;br /&gt;
&lt;br /&gt;
The following set of equations is a special representation of relative volatilities&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar \alpha}^j y_i^j = {\bar \alpha}_i^j y_i^{\mathrm{ref}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;j&#039;&#039; = 1,..&#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;phases&amp;lt;/sub&amp;gt; &amp;amp;minus; 1&amp;lt;/span&amp;gt;, and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;i&#039;&#039; = 1,..&#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;components&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt;. To make it easier to understand the goal of this representation let&#039;s see what these equations represent for a two phase system (V,L) of the two components (A,B).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar \alpha} y_A^V = \alpha_A^V y_A^L&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar \alpha} y_B^V = \alpha_B^V y_B^L&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
in the relative volatility model you fix the &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;alpha;&amp;lt;/span&amp;gt; values and compute the &amp;amp;lt;math{\bar \alpha}&amp;amp;lt;/math&amp;amp;gt;. Note that &amp;lt;math&amp;gt;\alpha_A^V / {\bar \alpha}&amp;lt;/math&amp;gt; will be a K-value. Before seeing the model in action let&#039;s do some accounting. To simplify, we suppose a two-phase system, since ASCEND is not yet able to compute liquid-liquid models.&lt;br /&gt;
&lt;br /&gt;
FIXME: add the equation-counting table here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Chemical potential equilibrium ===&lt;br /&gt;
&lt;br /&gt;
In the full equilibrium model, the Gibbs free energy for each phase is equated. To choose full equilibrium, you should set the variable &#039;&#039;&#039;&amp;lt;tt&amp;gt;equilibrated&amp;lt;/tt&amp;gt;&#039;&#039;&#039; to &amp;lt;tt&amp;gt;TRUE&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;{\bar g}_i^j = {\bar g}_i^{\mathrm{ref}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for each partial component and each phase except the reference one.&lt;br /&gt;
&lt;br /&gt;
When using this model &amp;lt;math&amp;gt;\bar \alpha&amp;lt;/math&amp;gt; is fixed and equal to one and the &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;alpha;&amp;lt;/span&amp;gt;&#039;s are released and computed by equation 23. This equation becomes a computation of K-values. Now let&#039;s see the infamous accounting table for this model.&lt;br /&gt;
&lt;br /&gt;
FIXME equation-counting for VL-equilibrium G-model.&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s look at some more examples.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 4 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calculate the change of enthalpy for a 50% water, 50% ethanol being heated from 300 K to 400 K at constant atmospheric pressure.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a simple problem but it&#039;s useful for introducing the correct way to use the &amp;lt;tt&amp;gt;thermodynamics&amp;lt;/tt&amp;gt; model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL howto_thermo_ex8 REFINES cmumodel;&lt;br /&gt;
&lt;br /&gt;
   cd IS_A components_data([&#039;water&#039;,&#039;ethanol&#039;], &#039;water&#039;);&lt;br /&gt;
   pd IS_A phases_data(&#039;VL&#039;, &#039;ideal_vapor_mixture&#039;, &#039;UNIFAC_liquid_mixture&#039;,&lt;br /&gt;
&lt;br /&gt;
                       &#039;none&#039;);&lt;br /&gt;
   equilibrated IS_A boolean;&lt;br /&gt;
   phases ALIASES pd.phases;&lt;br /&gt;
&lt;br /&gt;
   FOR j IN phases CREATE&lt;br /&gt;
      smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]);&lt;br /&gt;
&lt;br /&gt;
   END FOR;&lt;br /&gt;
   FOR j IN phases CREATE&lt;br /&gt;
      phase[j] ALIASES smt[j].phase;&lt;br /&gt;
&lt;br /&gt;
   END FOR;&lt;br /&gt;
&lt;br /&gt;
   state IS_A thermodynamics(cd, pd,phase, equilibrated);&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
(* ... *)&lt;br /&gt;
   METHOD values;&lt;br /&gt;
      state.P := 1 {atm};&lt;br /&gt;
&lt;br /&gt;
      state.T := 300 {K};&lt;br /&gt;
      state.y[&#039;ethanol&#039;]&amp;amp;nbsp;:= 0.5;&lt;br /&gt;
&lt;br /&gt;
      equilibrated := TRUE;&lt;br /&gt;
   END values;&lt;br /&gt;
(* ... *)&lt;br /&gt;
END howto_thermo_ex8;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use of the thermodynamics model is slightly more complex. First, you should define the components data, then you choose the models for the phases with the &amp;lt;tt&amp;gt;phases_data&amp;lt;/tt&amp;gt; model. This model&#039;s first parameter is a phase definition (it can be &amp;lt;tt&amp;gt;V&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;L&amp;lt;/tt&amp;gt;&amp;amp;lt; or &amp;lt;tt&amp;gt;VL&amp;lt;/tt&amp;gt;), then the name for the vapour model (or &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; if there&#039;s not vapour phase), and then the liquid model name. The last parameter is for a second liquid phase model when &amp;lt;tt&amp;gt;LL&amp;lt;/tt&amp;gt; equilibrium is implemented; for now, you should just use &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;select_mixture_type&amp;lt;/tt&amp;gt; model builds the chosen models so that they can be sent to the main thermodynamic model as a parameter. This may seem complicated at first, but as you probable will never need to change that piece of code, you don&#039;t need to worry about it too much. Just peek at the library code when you feel brave enough.&lt;br /&gt;
&lt;br /&gt;
The value definitions are very simple; just notice the newly introduced &amp;lt;tt&amp;gt;equilibrated&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
&lt;br /&gt;
When solving multi-phase models you should always check &amp;lt;tt&amp;gt;state.slack_PhaseDisappearance&amp;lt;/tt&amp;gt;. Only if it&#039;s zero the phase exists. Sometimes you can get strange results if you&#039;re looking at properties of a non-existent phase.&lt;br /&gt;
&lt;br /&gt;
If you run the model, you&#039;ll get only a liquid phase and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;H&#039;&#039;&amp;lt;/span&amp;gt; = -282.351 kJ/mol. With &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; = 400 K, you&#039;ll get &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;H&#039;&#039;&amp;lt;/span&amp;gt; = -233.022 kJ/mol, and so &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&amp;amp;Delta;&#039;&#039;H&#039;&#039;&amp;lt;/span&amp;gt; = 49.329 kJ/mol.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 5 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Build the VL equilibrium chart for water-ethanol at atmospheric pressure.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The model presented in the last example specifies &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt;. To build an equilibrium chart, it&#039;s better to specify &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; and a mole fraction, and to free &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt;. That way, we can be sure to have an equilibrium. The following method, added to the last example model, uses that trick. We&#039;ll also use the Pitzer vapour model, in the hope of improving accuracy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL howto_thermo_ex9 REFINES cmumodel;&lt;br /&gt;
   cd IS_A components_data([&#039;water&#039;,&#039;ethanol&#039;], &#039;water&#039;);&lt;br /&gt;
&lt;br /&gt;
   pd IS_A phases_data(&#039;VL&#039;, &#039;Pitzer_vapor_mixture&#039;, &#039;UNIFAC_liquid_mixture&#039;,&lt;br /&gt;
                       &#039;none&#039;);&lt;br /&gt;
&lt;br /&gt;
   equilibrated IS_A boolean;&lt;br /&gt;
   phases ALIASES pd.phases;&lt;br /&gt;
(*...*)&lt;br /&gt;
&lt;br /&gt;
   METHOD reset_Px;&lt;br /&gt;
      equilibrated := TRUE;&lt;br /&gt;
      RUN state.specify;&lt;br /&gt;
&lt;br /&gt;
      state.T.fixed := FALSE;&lt;br /&gt;
      state.phase[&#039;liquid1&#039;].y[&#039;water&#039;].fixed := TRUE;&lt;br /&gt;
&lt;br /&gt;
      state.P := 1 {atm};&lt;br /&gt;
      state.y[&#039;ethanol&#039;]&amp;amp;nbsp;:= 0.5;&lt;br /&gt;
&lt;br /&gt;
      state.phase[&#039;liquid1&#039;].y[&#039;water&#039;]&amp;amp;nbsp;:= 0.6;&lt;br /&gt;
   END reset_Px;&lt;br /&gt;
&lt;br /&gt;
END howto_thermo_ex9;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, instead of calling &amp;lt;tt&amp;gt;reset&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;values&amp;lt;/tt&amp;gt; just run &amp;lt;tt&amp;gt;reset_Px&amp;lt;/tt&amp;gt;. We&#039;ll run the model several times and build a table like the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  &amp;lt;math&amp;gt;y_w^L&amp;lt;/math&amp;gt;&lt;br /&gt;
!  &amp;lt;math&amp;gt;y_w^V&amp;lt;/math&amp;gt;&lt;br /&gt;
!  &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039; / [&#039;&#039;K&#039;&#039;]&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  0.99&lt;br /&gt;
&lt;br /&gt;
|  0.8786&lt;br /&gt;
|  369.764&lt;br /&gt;
|-&lt;br /&gt;
|  0.95&lt;br /&gt;
|  0.652&lt;br /&gt;
|  362.471&lt;br /&gt;
|-&lt;br /&gt;
|  0.9&lt;br /&gt;
|  0.5517&lt;br /&gt;
&lt;br /&gt;
|  358.80&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;nbsp;:&lt;br /&gt;
| &amp;amp;nbsp;:&lt;br /&gt;
| &amp;amp;nbsp;:&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When building the table, you must take some care for a phase not to disappear. You can do that by changing the variable &amp;lt;tt&amp;gt;state.phase[&#039;liquid1&#039;].y[&#039;water&#039;]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Boundary_detection&amp;diff=166</id>
		<title>Boundary detection</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Boundary_detection&amp;diff=166"/>
		<updated>2010-05-13T14:01:24Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;pageexperimental&amp;quot;&amp;gt;&#039;&#039;This page documents an &#039;&#039;&#039;experimental&#039;&#039;&#039; feature. You can help out by &#039;&#039;&#039;testing it&#039;&#039;&#039; and &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Boundary_detection&amp;amp;action=edit recording]&amp;lt;/span&amp;gt; your experiences.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Boundary detection works under [[IDA]] to detect when, as moving forward in time, a point comes when a conditional expression changes value.&lt;br /&gt;
&lt;br /&gt;
Possible boundaries include &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* real-valued relations, such as &amp;lt;tt&amp;gt;t &amp;amp;lt; t_1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;T &amp;amp;gt; T_sat&amp;lt;/tt&amp;gt;&lt;br /&gt;
* boolean-valued relations, such as &amp;lt;tt&amp;gt;motor_running = (have_power AND motor_switch_on)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As integration time progresses, logic-valued relations can only change value when somehow triggered by changes in real-valued relations. Boolean-valued relations at that point then be re-evaluated using [[LRSlv]] to precedence-order the logical relations from the current model state. &lt;br /&gt;
&lt;br /&gt;
Boolean-valued relations case use the truth-value of real-valued relations using the &amp;lt;tt&amp;gt;SATISFIED(relname,tolerance)&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
See also [[Conditional modelling]] and [[Integration of Conditional Models]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Experimental]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ASCEND_source_code_repository&amp;diff=165</id>
		<title>ASCEND source code repository</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ASCEND_source_code_repository&amp;diff=165"/>
		<updated>2010-05-13T14:01:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ASCEND source code and documentation files are maintained in a &#039;&#039;&#039;Subversion&#039;&#039;&#039; repository hosted by CMU.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Checking out a copy of the code ==&lt;br /&gt;
&lt;br /&gt;
To check out a local copy of the ASCEND source code, use your subversion client (see &#039;&#039;About Subversion&#039;&#039; below) to checkout from the repository URL &amp;lt;tt&amp;gt;[http://ascendsvn.cheme.cmu.edu/ascend/code/trunk]&amp;lt;/tt&amp;gt;. To do this with the command-line client, you would typically use the following commands:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;cd ~/src&lt;br /&gt;
svn co svn://ascend.cheme.cmu.edu/ascend/code/trunk ascend&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that if you are behind a proxy, you may not be able to access our Subversion repository. Some proxies prevent access via the &#039;svn:&#039; protocol. You may find some useful information in the [http://subversion.apache.org/faq.html Subversion FAQ].&lt;br /&gt;
&lt;br /&gt;
You can also &#039;&#039;&#039;[http://ascendcode.cheme.cmu.edu/ browse the repository]&#039;&#039;&#039; online via ViewVC.&lt;br /&gt;
&lt;br /&gt;
See [[BuildingAscend]] for information on how to build ASCEND from the source code you have checked out.&lt;br /&gt;
&lt;br /&gt;
Please try to read our [[coding style]] guidelines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:110ex;padding-top:8px;padding-bottom:12px;border:solid 2pt gray;background-color:#ffff88;margin-top:5px;margin-bottom:5px;padding:8px&amp;quot;&amp;gt;Our repository URL was changed (&#039;svn:&#039; instead of &#039;http:&#039;) on 2 Jun 2009. If you have a working copy that was checked out before this date, you will need to use &#039;svn switch --relocate&#039; to update your working copy to the new server URL. The suggested command is:&amp;lt;br /&amp;gt;&amp;lt;tt&amp;gt;svn switch --relocate http://ascendsvn.cheme.cmu.edu/ascend svn://ascend.cheme.cmu.edu/ascend&amp;lt;/tt&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Working on the documentation and website ==&lt;br /&gt;
&lt;br /&gt;
The documentation is available as part of the source distribution above. We do this so that we can link in sample code directly when compiling the documentation.&lt;br /&gt;
&lt;br /&gt;
The source material for the [http://ascend.cheme.cmu.edu public website] (as opposed to this wiki) hosted is a separate part of the Subversion repository however. You can check out the website files using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;svn co svn://ascend.cheme.cmu.edu/ascend/web/trunk ascend-web&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We don&#039;t currently have an automated publishing script; you will need to manually update the webserver if you make changes there in the repository.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Some Subversion automation ==&lt;br /&gt;
&lt;br /&gt;
When making a commit to Subversion, you should be able to enter special strings like &amp;quot;fixes bug NNN&amp;quot;, and those messages will be processed by the [http://ascendbugs.cheme.cmu.edu/ ASCEND Bug Tracker] and used to modify the status of a bug which is relevant to your changes. (Need confirmation that this is still operating correctly).&lt;br /&gt;
&lt;br /&gt;
If you use the the [http://ascendbugs.cheme.cmu.edu/ ASCEND Bug Tracker], then anytime you write comments containing text like &amp;quot;changeset 345&amp;quot;, the text will be converted into a hyperlink that will allow you to click through to review the relevant code changes on ViewVC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Branches ==&lt;br /&gt;
&lt;br /&gt;
We have a number of active branches in our repository. Mostly  these are related to our recent participation in [[Category:GSOC2009|GSOC 2009]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  About Subversion ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Subversion&#039;&#039;&#039; is the version management software we are using. &lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;Linux&#039;&#039;&#039;, most distributions come with command-line subversion (command &amp;lt;tt&amp;gt;svn&amp;lt;/tt&amp;gt;) already installed. &lt;br /&gt;
GUI clients are also available.  See the links on [http://subversion.tigris.org/]. There is also now a useful Nautilus extension called [http://www.rabbitvcs.org/ RabbitVCS]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;Windows&#039;&#039;&#039;, you will need to download and install a Subversion client. A recommended GUI client for Windows is [http://tortoisesvn.tigris.org/ TortoiseSVN]. The command-line client can also be run conveniently via [http://www.cygwin.com cygwin].&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;MacOS X&#039;&#039;&#039;, a recommended GUI client is [http://scplugin.tigris.org/ scplugin]. It allows you to access Subversion functionality for the context menu in the Finder. Alternatively, there is also a command-line version available for use from the Terminal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=DATA&amp;diff=164</id>
		<title>DATA</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=DATA&amp;diff=164"/>
		<updated>2010-05-13T14:01:04Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;DATA&#039;&#039;&#039; instances are used to pass &#039;additional parameters&#039; to [[External_relation|external relations]]. This can be used for example to define constants that are required for calculation of the external relation, but which do not vary over the duration of a simulation.&lt;br /&gt;
&lt;br /&gt;
DATA instances are used for example in [[FPROPS]] to specify the fluid being used:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL ammoniadata;&lt;br /&gt;
	component IS_A symbol_constant;&lt;br /&gt;
	component :== &#039;ammonia&#039;;&lt;br /&gt;
&lt;br /&gt;
END ammoniadata;&lt;br /&gt;
&lt;br /&gt;
MODEL example;&lt;br /&gt;
&lt;br /&gt;
	(* variables that will be calculated (or specified, in some cases *)&lt;br /&gt;
	p IS_A pressure;&lt;br /&gt;
&lt;br /&gt;
	T IS_A temperature;&lt;br /&gt;
	rho IS_A mass_density;&lt;br /&gt;
	h IS_A specific_enthalpy;&lt;br /&gt;
&lt;br /&gt;
	(* this is the &#039;DATA&#039; instance that will be passed to the external relation *)&lt;br /&gt;
	propsdata IS_A ammoniadata;&lt;br /&gt;
&lt;br /&gt;
	(* declare the external relation, together with the variables and DATA that it uses *)&lt;br /&gt;
	props1: helmholtz_p(&lt;br /&gt;
&lt;br /&gt;
		T, rho : INPUT;&lt;br /&gt;
		p : OUTPUT;&lt;br /&gt;
&lt;br /&gt;
		propsdata : DATA&lt;br /&gt;
	);&lt;br /&gt;
END example;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[External_libraries#DATA_instance]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Syntax]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Sensitivity_study&amp;diff=163</id>
		<title>Sensitivity study</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Sensitivity_study&amp;diff=163"/>
		<updated>2010-05-13T14:00:54Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;outdated&amp;quot; style=&amp;quot;border:solid 2pt orange; width:70ex; background-color:#FFEEDD;padding:4px;margin-bottom:6px&amp;quot;&amp;gt;&#039;&#039;This article is &#039;&#039;&#039;outdated&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Sensitivity_study&amp;amp;action=edit updating it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&#039;&#039;This was tested Jun 2009 and an error was returned (&amp;lt;a href=&amp;quot;https://ascendbugs.cheme.cmu.edu/view.php?id=409&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://ascendbugs.cheme.cmu.edu/view.php?id=409&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;bug 409&amp;lt;/a&amp;gt;). Needs more testing.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ASCEND provides the ability to perform sensitivity studies on your model. The approach currently implemented requires you to make some minor changes to your model, and then utilises and [[external method]] to perform the calculation. The implementation is in {{src|models/sensitivity/sensitivity.c}}.&lt;br /&gt;
&lt;br /&gt;
To perform a sensitivity analysis on your model, add the following lines in your MODEL:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* add at the start: *)&lt;br /&gt;
IMPORT &amp;amp;quot;sensitivity/sensitivity&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
(* add the following into your MODEL declaration: *)&lt;br /&gt;
m, n IS_A integer_constant;&lt;br /&gt;
m := (* number of output parameters you want to study *)&lt;br /&gt;
&lt;br /&gt;
n := (* number of input parameters you want to study *)&lt;br /&gt;
X[1..m] IS_A solver_var; (* outputs *)&lt;br /&gt;
&lt;br /&gt;
U[1..n] IS_A solver_var; (* inputs *)&lt;br /&gt;
dX_dU[1..m][1..n] IS_A solver_var; (* data space *)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, you must [[ARE_THE_SAME]] the input parameters X[1], X[2], etc with variables already present in your model. Do the same with the output parameters, also.&lt;br /&gt;
&lt;br /&gt;
Finally, add the following [[METHOD]] to your model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;METHOD sensitivity;&lt;br /&gt;
&lt;br /&gt;
    EXTERNAL do_sensitivity(SELF,U[1..n],X[1..m],dx_du[1..m][1..n]);&lt;br /&gt;
&lt;br /&gt;
END sensitivity;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, once you have loaded your model and solved it, you can run the &#039;sensitivity&#039; method on your model. You will then be able to inspect the sensitivities of your &#039;output&#039; variables to your &#039;input&#039; variables, by examining the values in the calculated matrix dX_dU.&lt;br /&gt;
&lt;br /&gt;
Proposed parametric model to help with the above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;IMPORT &amp;amp;quot;sensitivity/sensitivity&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL sensitivity_study(&lt;br /&gt;
	n_in WILL_BE integer_constant;&lt;br /&gt;
	n_out WILL_BE integer_constant;&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
	out[1..n_out] IS_A solver_var; (* outputs *)&lt;br /&gt;
&lt;br /&gt;
	in[1..n_in] IS_A solver_var; (* inputs *)&lt;br /&gt;
	deriv[1..n_out][1..n_in] IS_A solver_var; (* data space *)&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD sensitivity;&lt;br /&gt;
    EXTERNAL do_sensitivity(SELF,in[1..n_in],out[1..n_out],deriv[1..n_out][1..n_in]);&lt;br /&gt;
&lt;br /&gt;
END sensitivity;&lt;br /&gt;
END sensitivity_study;&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Problem:&#039;&#039;&#039; inputs for a sensitivity study are often [[FIX|FIXed]], causing problems with this functionality in its present form.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Outdated]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Non-proprietary_Optimization&amp;diff=162</id>
		<title>Non-proprietary Optimization</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Non-proprietary_Optimization&amp;diff=162"/>
		<updated>2010-05-13T14:00:45Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{task}}&lt;br /&gt;
&lt;br /&gt;
We are trying to locate a suitable non-commercial optimizer to build into ASCEND. This would alleviate the current dependence on the proprietary [[CONOPT]] optimizer.&lt;br /&gt;
&lt;br /&gt;
This task is currently being worked on by a [http://socghop.appspot.com/org/home/google/gsoc2009/ascend Google Summer of Code student].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for New Optimizer ==&lt;br /&gt;
&lt;br /&gt;
Mathematical/algorithm requirements:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Must be able to handle &#039;box constraints&#039;, eg &amp;lt;math&amp;gt;a \le x \le b&amp;lt;/math&amp;gt; for each variable.&lt;br /&gt;
* Must be able to handle equality constrains, eg &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;g&#039;&#039;(&#039;&#039;x&#039;&#039;,&#039;&#039;y&#039;&#039;,&#039;&#039;z&#039;&#039;) = 0&amp;lt;/span&amp;gt; and &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;x&#039;&#039; = &#039;&#039;f&#039;&#039;(&#039;&#039;y&#039;&#039;,&#039;&#039;z&#039;&#039;,&#039;&#039;a&#039;&#039;,&#039;&#039;b&#039;&#039;)&amp;lt;/span&amp;gt;&lt;br /&gt;
* Must be able to handle non-linear problems&lt;br /&gt;
* If matrix algebra is required, should use sparse methods rather than dense&lt;br /&gt;
* Should be able to make use of derivatives&lt;br /&gt;
&lt;br /&gt;
Open questions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Should be able to handle general inequality constraints, eg &amp;lt;math&amp;gt;g(x,y,z) \le 0&amp;lt;/math&amp;gt;&amp;amp;nbsp;?&lt;br /&gt;
* Should &#039;&#039;not&#039;&#039; assume convex problem?&lt;br /&gt;
* Should &#039;&#039;not&#039;&#039; require second derivatives/Hessian matrix?&lt;br /&gt;
* Should be able to handle non-linear constraints?&lt;br /&gt;
&lt;br /&gt;
Supporting information requirements:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Should be known to solve a range of comparable problems to those which we expect to encounter&lt;br /&gt;
* Must be accompanied by a set of solvable problems for which exact solutions are known, for testing purposes.&lt;br /&gt;
* Should have a published algorithm&lt;br /&gt;
* Must have a user&#039;s manual&lt;br /&gt;
* Should have a freely-available user&#039;s manual&lt;br /&gt;
&lt;br /&gt;
Pedantic legal stuff:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Must be freely available to academics&lt;br /&gt;
* All requirement dependencies must be freely available to academics&lt;br /&gt;
* Should be freely available to everybody&lt;br /&gt;
* Should be redistributable in unmodified source form&lt;br /&gt;
* Should be redistributable in modified source form&lt;br /&gt;
* Should be redistributable in binary (compiled) form&lt;br /&gt;
* Documentation should be redistributable in original form&lt;br /&gt;
* Documentation should be redistributable in modified/repackaged form&lt;br /&gt;
&lt;br /&gt;
== Background info ==&lt;br /&gt;
&lt;br /&gt;
Related stuff:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Hessian_matrix Hessian matrix]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Karush-Kuhn-Tucker_conditions Karush-Kuhn-Tucker conditions]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Interior_point_method Interior point method]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Sequential_quadratic_programming Sequential quadratic programming]&lt;br /&gt;
* A [http://en.wikipedia.org/wiki/Category:Optimization_algorithms list of optimisation algorithms].&lt;br /&gt;
* A [http://orion.uwaterloo.ca/~hwolkowi/mirror.d/glossary/index.php glossary of Mathematical Programming (i.e. optimisation) terms].&lt;br /&gt;
&lt;br /&gt;
We have done our own cursory [[survey of optimisation software]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TRON ==&lt;br /&gt;
&lt;br /&gt;
Some work was done to investigate possible adding support for [[TRON]] in ASCEND. TRON can only solve the limited optimisation problem:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\min f(\mathbf{x}) \\&lt;br /&gt;
\mathbf{x}_{lower} \le \mathbf{x} \le \mathbf{x}_{upper}&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following are observations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* TRON requires that you write your own iteration loop &#039;&#039;outside&#039;&#039; TRON itself.&lt;br /&gt;
* TRON requires that you evaluate the function value and Hessian matrix (in a special compressed form that involves a vector of diagonal values then compressed column form for the off diagonal values, which being symmetric only need to cover half the matrix (so compressed column == compressed row?).&lt;br /&gt;
* TRON updates the variable vector and tells you when an optimum has been found.&lt;br /&gt;
* It&#039;s up to you to count iterations and terminate if it&#039;s taking too long etc.&lt;br /&gt;
* It seems fairly conceivable that solving more general systems with TRON might be possible by performing a separate NLA problem solution each iteration. But we&#039;re hesitant about trying that, because we&#039;re not completely comfortable with the maths involved in doing that at this stage, and not sure if it will mess up considerations of feasibility/optimality from TRON&#039;s PoV.&lt;br /&gt;
&lt;br /&gt;
== IPOPT ==&lt;br /&gt;
&lt;br /&gt;
IPOPT solves a more useful type of problem that includes equality constraints:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
\min f(\mathbf{x}) \\&lt;br /&gt;
\mathbf{c}_L \le \mathbf{c}(\mathbf{x}) \le \mathbf{c}_U \\&lt;br /&gt;
\mathbf{x}_L \le \mathbf{x} \le \mathbf{x}_U&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is emphasised that solving equality constraints is done just by setting elements of &amp;lt;math&amp;gt;\mathbf{c}_L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{c}_U&amp;lt;/math&amp;gt; equal to each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IPOPT supports a number of linear solvers including the HSL routine MA27, but also MUMPS, which is a free open source solver. So it is now possible to distribute a full working copy of IPOPT with ASCEND. It is also possible to have &#039;drop-in&#039; support for HSL, because IPOPT can detect and dlopen HSL at runtime, if present.&lt;br /&gt;
&lt;br /&gt;
Download/build instructions are here:&lt;br /&gt;
[http://www.coin-or.org/Ipopt/documentation/node18.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== MOOCHO / rSQP++ ==&lt;br /&gt;
&lt;br /&gt;
The way that MOOCHO is packaged for download is as part of the big &#039;&#039;&#039;Trilinos&#039;&#039;&#039; bundle. This is a huge download that takes more than an hour to build on my system.&lt;br /&gt;
&lt;br /&gt;
An RPM has been built for the Trilinos bundle, including MOOCHO. Get it from:&lt;br /&gt;
[http://software.opensuse.org/download/home:/jdpipe/]&lt;br /&gt;
&lt;br /&gt;
The support for generic linear algebra routines is also now deprecated, and they are going for all-out integration with the other Trilinos packages. That means there&#039;s quite a lot to learn about. It&#039;s a bit daunting -- if anyone else fancies helping out, by all means, please do.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Proposed]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Canvas-based_modeller_for_ASCEND&amp;diff=161</id>
		<title>Canvas-based modeller for ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Canvas-based_modeller_for_ASCEND&amp;diff=161"/>
		<updated>2010-05-13T14:00:36Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{task}}&amp;lt;div class=&amp;quot;thumb tright&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:307px;&amp;quot;&amp;gt;[[Image:Freeda-screenshot.jpg]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Freeda-screenshot.jpg|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;The canvas-based model of [http://www.freeda.org/ fREEDA], an electrical circuit simulator. This canvas is based on [http://trolltech.com/downloads/opensource Qt].&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;thumb tright&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:307px;&amp;quot;&amp;gt;[[Image:Gaphor-screenshot.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Gaphor-screenshot.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Screenshot from [http://gaphor.sourceforge.net/ Gaphor] a [http://en.wikipedia.org/wiki/Unified_Modeling_Language UML] tool. This canvas is pure Python on top of Cairo.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Many other modelling environments provide a graphical flowsheet modeller, or &#039;canvas&#039; onto which unit operations are arranged to create a process flow diagram (PFD). &#039;&#039;&#039;We would like to be able to do this in ASCEND too.&#039;&#039;&#039; Currently this is being worked on by [[User:Arijit]] as a GSOC project. The goals are&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;create a new empty flowsheet&amp;lt;/strike&amp;gt; &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(done)&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;plop &#039;blocks&#039; onto a canvas to represent various &#039;unit operations&#039; such as tank, turbine, pump, column, resistor, capacity, actuator, motor, etc.&amp;lt;/strike&amp;gt; &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(done)&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;wire up the &#039;ports&#039; on these blocks using &#039;connectors&#039; that would correspond to &#039;streams&#039; with multiple variables and parameters within them, such as a steam flow, or single variables such as a voltage signal.&amp;lt;/strike&amp;gt; &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(done)&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;view and edit parameters for the blocks in order to make adjustments to the system design.&amp;lt;/strike&amp;gt;&lt;br /&gt;
* view and edit constants and sets for the model (eg name of the fluid in a stream).&lt;br /&gt;
* solve the model: &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;export to solver&amp;lt;/strike&amp;gt;, give error message feedback, create linkage between blocks and solver vars. &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(partially done)&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;see graphically the parts of the model which have not converged or which are out-of-bounds.&amp;lt;/strike&amp;gt; &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(done)&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;view the values of variables within the blocks once it has solved&amp;lt;/strike&amp;gt; &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(done)&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;strike style=&amp;quot;color:green&amp;quot;&amp;gt;save the flowsheet in such a way that when reloaded, it can again be solved afresh.&amp;lt;/strike&amp;gt; &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;(done)&amp;lt;/span&amp;gt;&lt;br /&gt;
== Progress report ==&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Canvas-based modeller is currently out of action due to recent API changes in Gaphas, the canvas toolkit that we&#039;re using. You can follow the &amp;lt;a href=&amp;quot;https://ascendbugs.cheme.cmu.edu/view.php?id=424&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://ascendbugs.cheme.cmu.edu/view.php?id=424&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;bug report&amp;lt;/a&amp;gt; for details.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tright&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:307px;&amp;quot;&amp;gt;[[Image:Gaphas-blocks.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Gaphas-blocks.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Screenshot of the prototype Gaphas-based canvas for ASCEND&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;We have got a basically-functional &#039;canvas&#039; widget now based on [[Gaphas]], with &#039;blocks&#039;, &#039;ports&#039; and connector lines (see figure). A &#039;palette&#039; is created based on markup of ASCEND models in the model library with NOTES as specified below. Blocks can be created by clicking in the palette then clicking in the canvas. And connector lines are created by draging from one &#039;port&#039; to another. Blocks can be saved and restored, using Python Pickle functionality.&lt;br /&gt;
&lt;br /&gt;
Canvas models can now be exported to the solver and ASCEND can attempt to solve them. However, there is currently no means for setting the parameters of Blocks, so there is no simple way of using a canvas model to solve specific problems. There is also not yet any way of viewing the resulting solution!&lt;br /&gt;
&lt;br /&gt;
We &#039;mark up&#039; MODELs as being blocks suitable for canvas-based modelling, using the [[NOTES]] framework. We can mark blocks, and also mark variables within them as being inputs or outputs, as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL pump_simple;&lt;br /&gt;
    ADD NOTES&lt;br /&gt;
        &#039;block&#039; SELF {Simple model of a pump}&lt;br /&gt;
&lt;br /&gt;
    END NOTES;&lt;br /&gt;
    inlet &amp;amp;quot;in:&amp;amp;quot; IS_A stream;&lt;br /&gt;
    outlet &amp;amp;quot;out:&amp;amp;quot; IS_A stream;&lt;br /&gt;
&lt;br /&gt;
    inlet.mdot, outlet.mdot ARE_THE_SAME;&lt;br /&gt;
    dp IS_A delta_pressure;&lt;br /&gt;
&lt;br /&gt;
    outlet.p = inlet.p + dp;&lt;br /&gt;
END pump_simple;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Metadata currently implemented is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* name for the block (via NOTE of lang &#039;block&#039;, also is used to tell ASCEND that the object is indeed a block)&lt;br /&gt;
* what variables are the &#039;inputs&#039; (via inline NOTES starting with &#039;in:&#039;)&lt;br /&gt;
* what variables are the &#039;outputs&#039; (via inline NOTES starting with &#039;out:&#039;)&lt;br /&gt;
* what variables are parameters for a particular block (via inline NOTES starting with &#039;param:&#039;)&lt;br /&gt;
* icon used to display the block in the block palette (via NOTE with lang &#039;icon&#039;)&lt;br /&gt;
&lt;br /&gt;
=== Two possible approaches to canvas-based models ===&lt;br /&gt;
&lt;br /&gt;
There were two choices of ways that canvas-based &#039;blocks&#039; could be declared using the ASCEND modelling language: parametric models or non-parametric models, which are shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* parametric model *)&lt;br /&gt;
MODEL pipesegment(&lt;br /&gt;
    inlet &amp;amp;quot;in:&amp;amp;quot; WILL_BE stream;&lt;br /&gt;
&lt;br /&gt;
    output &amp;amp;quot;out:&amp;amp;quot; WILL_BE stream;&lt;br /&gt;
    dp WILL_BE delta_pressure;&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
    inlet.h = outlet.h;&lt;br /&gt;
    inlet.p + dp = outlet.p;&lt;br /&gt;
&lt;br /&gt;
END pipesegment;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* non-parametric model *)&lt;br /&gt;
MODEL pipesegment;&lt;br /&gt;
&lt;br /&gt;
    inlet &amp;amp;quot;in:&amp;amp;quot; IS_A stream;&lt;br /&gt;
    output &amp;amp;quot;out:&amp;amp;quot; IS_A stream;&lt;br /&gt;
&lt;br /&gt;
    dp &amp;amp;quot;param:&amp;amp;quot; IS_A delta_pressure;&lt;br /&gt;
    inlet.h = outlet.h;&lt;br /&gt;
&lt;br /&gt;
    inlet.p + dp = outlet.p;&lt;br /&gt;
END pipesegment;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the first case, the pipesegment model does not contain all the necessary variables, and it is not possible to create the pipesegment object without first creating the necessary parameter models &#039;inlet&#039; and &#039;outlet&#039;. On the other hand, this type of model is clearer in some ways because it effectively makes a distinction between &#039;private&#039; (internal) variables and &#039;interface&#039; variables (the ones that define its relationship with other models).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problem with &#039;ARE_THE_SAME&#039; in parametric models ===&lt;br /&gt;
&lt;br /&gt;
In order to make models smaller, sometimes it&#039;s desirable to use [[ARE_THE_SAME]] to wire up variables that will always be the same, for example the mass flowrate into a unit and the mass flow rate out of the unit, in the case where there is no mass holdup. There are cases where it is mathematically preferable to use &#039;=&#039; instead of merging two variables, but it&#039;s nice to have the flexibility to choose between these.&lt;br /&gt;
&lt;br /&gt;
The problem with using parametric models, though, is that it&#039;s not possible to merge parameter variables inside a parametric model, because this is not implemented or supported in the ASCEND compiler.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problem with &#039;equality loops&#039; ===&lt;br /&gt;
&lt;br /&gt;
When wiring up loops of variables, such as constant flow rate through a loop, one cannot use &#039;=&#039; relations, because the system ends up overspecified. We would need a special solver to eliminate the unnecessary constraint, eg when three items are wired up in a constant-flow-rate loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;mdot1 = mdot2;&lt;br /&gt;
mdot2 = mdot3;&lt;br /&gt;
mdot3 = mdot1; (* this equation is a redundant *)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, using ARE_THE_SAME eliminates this problem, and rather than an overconstrained system, we just end up with one free variable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;mdot1, mdot2 ARE_THE_SAME;&lt;br /&gt;
mdot2, mdot3 ARE_THE_SAME;&lt;br /&gt;
&lt;br /&gt;
mdot3, mdot1 ARE_THE_SAME; (* ASCEND ignores this one, because the variables are already the same *)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although it is possible to design a solver such that the redundant equations are ignored, it was considered (by John) to perhaps be &#039;safer&#039; modelling practise to require the user to specify a &#039;square&#039; system without the solver having to ignore particular equations. So the ARE_THE_SAME system of wiring up models is currently preferred, but perhaps in future we will want to revisit this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Parameters for blocks ===&lt;br /&gt;
&lt;br /&gt;
In creating a canvas-based model, it is certainly not enough just to &#039;wire up&#039; blocks are then expect the resulting model to do something useful. Most blocks will need to have some parameters set. For example, a pump may need to have its flow-rate or output pressure specified; a boiler will need to have its fuel supply rate and efficiency specified. Some blocks will require many parameters. It is also possible that blocks may need to be able to be used in multiple &#039;modes&#039;, for example a pump may have its efficiency and speed specified, or perhaps its efficiency and volumetric flow rate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Currently, the parameters that a block provides can be marked up with NOTES as shown&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL pump;&lt;br /&gt;
    eta &amp;amp;quot;param:isentropic efficiency&amp;amp;quot; IS_A fraction;&lt;br /&gt;
&lt;br /&gt;
    f &amp;amp;quot;param:rotational speed&amp;amp;quot; IS_A inverse_time;&lt;br /&gt;
    (* ... *)&lt;br /&gt;
END pump;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In these cases, the canvas GUI can then specify (FIX and set) these variables in the resulting auto-generated MODEL. We still need to provide a GUI to allow the user to set and adjust these variables. It remains to determine what should happen in the case of multiple parameter &#039;modes&#039; for a model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Pickling to load/save canvasses ===&lt;br /&gt;
&lt;br /&gt;
We are using the Python &#039;pickle&#039; module to save and load canvas data. The models are loaded and saved divorced from and corresponding ASCEND instance data, in other words, they are a recipe for how to build up the ASCEND model, rather than a saved copy of the model itself. When the canvas is loaded, each block is &#039;reconnected&#039; to the appropriate ASCEND objects, such as TypeDescription objects for the MODEL which each Block represents.&lt;br /&gt;
&lt;br /&gt;
When we get further along, the pickles will also need to include the values of user-set parameters, and perhaps optionally the current solved value of the model, so that different canvases can be saved with different scenarios recorded therein.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What do do about connections? ===&lt;br /&gt;
&lt;br /&gt;
When connecting two blocks together, up to now we have simply been providing ARE_THE_SAME statements to merge the two connector port sub-models. This approach is not fully general, and still leaves the possibility of equality loops in the model, for the case where, &#039;&#039;within the blocks&#039;&#039;&#039;, &amp;quot;=&amp;quot; statements are used to express equality between, for example, input and output flowrates in a block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To allow dynamic models to be represented on the canvas, we can&#039;t expect to use ARE_THE_SAME statements within blocks, because that would eliminate the possibility of modelling mass holdups. So, we need to think about using another kind of model generation that fixes this problem relating to the degrees of freedom in models generated from the canvas GUI. We&#039;re still discussing a solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Zoom and Pan ===&lt;br /&gt;
&lt;br /&gt;
The canvas currently supports some mouse-friendly zoom and pan manipulations:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Zoom using ctrl+wheel&lt;br /&gt;
* Pan using middle-button drag&lt;br /&gt;
* Zoom using ctrl+middle-button drag (up and down) (this option is provided for easier use on laptops with trackpads)&lt;br /&gt;
* Pan up and down using mouse wheel.&lt;br /&gt;
&lt;br /&gt;
We still need to implement support for zoom-to-fit in the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Next steps ==&lt;br /&gt;
&lt;br /&gt;
It remains to implement:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* what do do where there is are multiple &#039;parameter modes&#039; for the model.&lt;br /&gt;
* what to do about &#039;constants&#039; in the model, eg when specifying a fluid, what fluid is to be used? when specifying a [[data reader]] block, what is the input file?&lt;br /&gt;
* customisable appearance of the block (perhaps via a NOTE of lang &#039;graphic&#039;, which might point to an SVG file, for example?)&lt;br /&gt;
* an alternative way of specifying inputs and outputs that doesn&#039;t use inline NOTES (eg a NOTE lang named &#039;in&#039;, perhaps? Would allow inputs to be declared elsewhere from the model itself.&lt;br /&gt;
* type-checking to ensure that only compatible ports are connected (this is not straightforward, could be done by exporting to the compiler and checking for error messages?)&lt;br /&gt;
&lt;br /&gt;
== Loading, saving and solving canvas-based models ==&lt;br /&gt;
&lt;br /&gt;
The above contains the minimal data required for the [[Library]] to be parsed and a &#039;palette&#039; of available model &#039;blocks&#039; presented to the user. The next question is: how should the resulting model be loaded, saved, and solved?&lt;br /&gt;
&lt;br /&gt;
For the canvas-based model the essential data structures would contain&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:solid 1pt #DDDDDD; width:40em&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* list of modules used in the canvas&lt;br /&gt;
* list of blocks&lt;br /&gt;
** type of each block&lt;br /&gt;
** size and position of the block on the canvas&lt;br /&gt;
** name of the block&lt;br /&gt;
** block styling: colour, style?&lt;br /&gt;
** type of each block&lt;br /&gt;
** size and position of the block on the canvas&lt;br /&gt;
** name of the block&lt;br /&gt;
** block styling: colour, style?&lt;br /&gt;
* type of each block&lt;br /&gt;
* size and position of the block on the canvas&lt;br /&gt;
* name of the block&lt;br /&gt;
* block styling: colour, style?&lt;br /&gt;
* list of connections&lt;br /&gt;
** starting block and port (as blockname.portname)&lt;br /&gt;
** ending block and port&lt;br /&gt;
** line routing (a series of x,y points)&lt;br /&gt;
** line styling: colour, width, etc?&lt;br /&gt;
** starting block and port (as blockname.portname)&lt;br /&gt;
** ending block and port&lt;br /&gt;
** line routing (a series of x,y points)&lt;br /&gt;
** line styling: colour, width, etc?&lt;br /&gt;
* starting block and port (as blockname.portname)&lt;br /&gt;
* ending block and port&lt;br /&gt;
* line routing (a series of x,y points)&lt;br /&gt;
* line styling: colour, width, etc?&lt;br /&gt;
* list of other canvas objects&lt;br /&gt;
** text labels, headings etc&lt;br /&gt;
** possible &#039;output cells&#039; that report current values of variables in the model&lt;br /&gt;
** possible &#039;method buttons&#039; that run methods on the model.&lt;br /&gt;
** possible &#039;input cells&#039; that allow variable values to be specified&lt;br /&gt;
** text labels, headings etc&lt;br /&gt;
** possible &#039;output cells&#039; that report current values of variables in the model&lt;br /&gt;
** possible &#039;method buttons&#039; that run methods on the model.&lt;br /&gt;
** possible &#039;input cells&#039; that allow variable values to be specified&lt;br /&gt;
* text labels, headings etc&lt;br /&gt;
* possible &#039;output cells&#039; that report current values of variables in the model&lt;br /&gt;
* possible &#039;method buttons&#039; that run methods on the model.&lt;br /&gt;
* possible &#039;input cells&#039; that allow variable values to be specified&lt;br /&gt;
* list of parameter values&lt;br /&gt;
** block to which the parameter blocks (maybe recursive).&lt;br /&gt;
** value of the parameter.&lt;br /&gt;
** units in which parameter has been specified.&lt;br /&gt;
** block to which the parameter blocks (maybe recursive).&lt;br /&gt;
** value of the parameter.&lt;br /&gt;
** units in which parameter has been specified.&lt;br /&gt;
* block to which the parameter blocks (maybe recursive).&lt;br /&gt;
* value of the parameter.&lt;br /&gt;
* units in which parameter has been specified.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the above information it would be possible to save and reload a canvas-based model without loss of information, but note that the model would still have to be solved; it would not be saving the full state. It would have to be assumed that the model library upon which the canvas was based had not changed; certain debugging would be required to ensure that such a situation didn&#039;t result in a corrupted canvas-model. The above data might possibly be stored in a new file format &#039;.a4g&#039; specific to canvas-based modelling. (We could see the &#039;.a4g&#039; format as a sub-type of the &#039;.a4c&#039; format (in which case the above metadata might be embedded in NOTES, or similar?)&lt;br /&gt;
&lt;br /&gt;
To solve a model with the above information, the approach would depend on whether the parametric or non-parametric modelling style is chosen. &lt;br /&gt;
&lt;br /&gt;
For the parametric style, we would need to create definitions of the different streams &#039;&#039;before&#039;&#039; the blocks could be declared. This could lead to some ambiguity in the way that different streams are initialised, possible.&lt;br /&gt;
&lt;br /&gt;
For the non-parametric style, we would only need to declare the blocks using [[IS_A]], then declare the connections using [[ARE_THE_SAME]]. We would want to have some sort of hierarchical system of [[METHODS]] to ensure that the necessary variables were FIXed and initialised for each block in the model (similar to the proposed &#039;default_self&#039; recursion that is currently a bit broken).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There need to be some protocols about how the model would be intialised, in any case.&lt;br /&gt;
&lt;br /&gt;
It should be possible to re-solve the model after the user changes a value of a parameter. This would mean that canvas-gui would have exported the model to the solver, and would then know how its blocks corresponded to variables in the model, and would call var_fixed or similar routines via the &#039;libascend&#039; API.&lt;br /&gt;
&lt;br /&gt;
It appears that the right approach would be for the canvas-based GUI to generate a string or file-based representation of the model it has in member, using the above hierarchy of objects (modules, blocks, connectors, but &#039;&#039;not&#039;&#039; parameter values), then to instruct ASCEND to load that model, then to [[FIX]] and set the values of the parameters, then attempt to &#039;solve&#039; the model. This might be done in cooperation with the existing PyGTK GUI, or might be done directly with calls to the libascend engine. the canvas-based GUI would have no awareness of the variables it contained other than that provided by the connector end-point names and the parameter names. Using those names it would be able to get/set values in the simulation.&lt;br /&gt;
&lt;br /&gt;
It would be possible to avoid the need for the canvas GUI to be able to [[FIX]] or [[FREE]] variables in the model. When a &#039;source&#039; block was required, it could be set up as a new &#039;block&#039; and the necessary un-FIXed variables left as parameters to the model. Changing the source block to another type would allow other parameters to be fixed. When greater flexibility was required, the user could switch to the non-canvas GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design considerations ==&lt;br /&gt;
&lt;br /&gt;
Do connections have properties and variables that need to be accessible, or is it always OK to access those variables/values via the connected blocks at either end?&lt;br /&gt;
&lt;br /&gt;
What to do with the standard [[METHODS]] like  [[Specify]], [[Default self]], [[Values]]?&lt;br /&gt;
&lt;br /&gt;
How can we store the current state of the model? Should we try to do that?&lt;br /&gt;
&lt;br /&gt;
How do we keep track of the fixed/free variables? Do we need to?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What about clashes between the [[Values]] methods in different submodels setting values on their &#039;connection&#039; members. Is this the corner-case that makes the parametric approach more desirable? Or does that not actually solve the problem?&lt;br /&gt;
&lt;br /&gt;
How can the canvas modeller determine when a model is &#039;complete&#039;?&lt;br /&gt;
&lt;br /&gt;
Is it OK to leave dangling lines?&lt;br /&gt;
&lt;br /&gt;
Is it OK to leave unconnected &#039;ports&#039; on the sub-models?&lt;br /&gt;
&lt;br /&gt;
Is it better to use &#039;=&#039; relationships instead of ARE_THE_SAME? It seems that in some cases this leads to models that solve more reliably.&lt;br /&gt;
&lt;br /&gt;
Line routing is tricky and something that is not often done well. Could use some cool [http://immi.inesc-id.pt/cali/applications.html calligraphic code] to make this work better&lt;br /&gt;
&lt;br /&gt;
Could it be possible to highlight parts of the flowsheet corresponding to solved and un-solved portions of the model?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
&lt;br /&gt;
Programs that implement these types of GUIs include&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://gaphor.sourceforge.net/ Gaphor], written in pure python, uses [[Gaphas]] on top of [http://www.cairographics.org/ Cairo].&lt;br /&gt;
* [http://www.freeda.org/ fREEDA] ([http://www.freeda.org/screenshots.html screenshot]) (FOSS, Windows-based, uses a [http://en.wikipedia.org/wiki/Qt_(toolkit) Qt] canvas widget)&lt;br /&gt;
* [http://www.geda.seul.org/ gEDA]&#039;s schematic editor, [http://www.geda.seul.org/tools/gschem/ gschem] is a GPLed GTK+ application that appears to use its own bespoke canvas implementation ([http://www.geda.seul.org/screenshots/ screenshots]). In a very quick and superficial test-drive, it appeared to be a little clumsy to use -- hard to identify when a connection has successfully been made, and fairly dated bitmap-style graphics.&lt;br /&gt;
* [http://www.lis.inpg.fr/realise_au_lis/kicad/ kicad] is another free electronic circuit schematic editor.&lt;br /&gt;
* [http://opencircuitdesign.com/xcircuit/index.html XCircuit] is a Tcl/Tk-based circuit editor.&lt;br /&gt;
* TRNSYS, Simulink, Visio, Dia, OOo Draw&lt;br /&gt;
* [http://kepler-project.org/ Kepler] (nice multi-domain canvas-based simulation, in Java)&lt;br /&gt;
* [http://www.cocosimulator.org/index.html COCO simulator] (windows, closed-source freeward)&lt;br /&gt;
* [http://www.conduit-project.org/wiki/Screenshots Conduit] (uses goocanvas)&lt;br /&gt;
* [http://www.gnome.org/projects/dia/ Dia] (seems to use GnomeCanvas?)&lt;br /&gt;
* [http://gstreamer.freedesktop.org/modules/gst-editor.html GStreamer Editor] (uses GnomeCanvas)&lt;br /&gt;
* [http://dwsim.inforside.com.br/ DWSIM] (sequential-modular simulator implemented in VB.net)&lt;br /&gt;
* Dunnart (testbed for libavoid)&lt;br /&gt;
* Inkscape (apparently includes support for libavoid, for automatic connector routing)&lt;br /&gt;
* [http://jmcad.sourceforge.net/ JMCAD] (java-based tool, seems to focus on nonlinear control)&lt;br /&gt;
&lt;br /&gt;
Software libraries that could be used for this functionality (most are discuss [http://live.gnome.org/ProjectRidley/CanvasOverview here]):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Gaphas]] (uses only Cairo, via pure Python)&lt;br /&gt;
* [http://live.gnome.org/ProjectRidley/CanvasOverview/Canvases/#goocanvas GooCanvas] (uses Cairo inside)&lt;br /&gt;
* [http://developer.gnome.org/doc/books/WGA/gnome-canvas.html GnomeCanvas] (not sure if it&#039;s deprecated yet or not, uses libart inside)&lt;br /&gt;
* [http://live.gnome.org/Criawips/CriaCanvas libccc/CriaCanvas] (uses Cairo inside)&lt;br /&gt;
* [http://www.cairographics.org/ Cairo] (directly)&lt;br /&gt;
* [http://www-eleves-isia.cma.fr/documentation/OpenInventorDoc/SoGtk/classSoGtk.html SoGTK] (use the OpenInventor 3D scenegraph for 2D work here?)&lt;br /&gt;
* Papyrus&lt;br /&gt;
* [http://adaptagrams.sourceforge.net/libavoid/ libavoid] (automatic connector-line routing including obstacle avoidance)&lt;br /&gt;
&lt;br /&gt;
... it needs to be something that works within GTK and perhaps also PyGTK.&lt;br /&gt;
... we want to choose something that will be around for a while. The only canvas widgets from the above that is in Ubuntu and linked against are GooCanvas and GnomeCanvas, with GnomeCanvas being much more used than GooCanvas. libccc is available in Ubuntu but noone is linking against it yet (as of Hardy release)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Proposed]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Arrays_and_sets&amp;diff=160</id>
		<title>Arrays and sets</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Arrays_and_sets&amp;diff=160"/>
		<updated>2010-05-13T14:00:24Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div&amp;gt;&#039;&#039;This article is incomplete or needs expanding. Please help out by adding your comments.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
This page will be expanded to include use of SETs and arrays in ASCEND. For the moment here are some quick examples:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;REQUIRE &amp;amp;quot;atoms.a4l&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL mymodel;&lt;br /&gt;
   (* declare a new set -- but note that its members could be declared in a sub-model if desired *)&lt;br /&gt;
   myset IS_A set OF symbol_constant;&lt;br /&gt;
&lt;br /&gt;
   (* declare the members of the set -- note, this is done in the declarative section because the set is constant-valued *)&lt;br /&gt;
   myset :== [&#039;A&#039;,&#039;B&#039;,&#039;D&#039;];&lt;br /&gt;
&lt;br /&gt;
   (* declare an array that contains elements indexed by the members of the myset *)&lt;br /&gt;
&lt;br /&gt;
   myarray[myset] IS_A distance;&lt;br /&gt;
&lt;br /&gt;
   (* write a relationship between the values of this array *)&lt;br /&gt;
   myarray[&#039;A&#039;] = myarray[&#039;B&#039;] + 1;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
   (* fix all members in myarray *)&lt;br /&gt;
   FIX myarray[myset];&lt;br /&gt;
&lt;br /&gt;
   (* free just one member *)&lt;br /&gt;
   FREE myarray[&#039;A&#039;];&lt;br /&gt;
END on_load;&lt;br /&gt;
END mymodel;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Thin-walled tank/Arrays]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [[FOR]] loops ==&lt;br /&gt;
&lt;br /&gt;
ASCEND provides looping syntax. The syntax used depends on whether you are in the declarative (main) part of your model (FOR..CREATE), or in the procedural part of the model (FOR..DO).&lt;br /&gt;
&lt;br /&gt;
See the [[FOR]] for more information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Counting elements in sets using &amp;lt;tt&amp;gt;CARD&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In ASCEND, the function &#039;&#039;&#039;&amp;lt;tt&amp;gt;CARD[set]&amp;lt;/tt&amp;gt;&#039;&#039;&#039; can be used to count the number of elements in a set. A typical use is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;A IS_A set OF symbol_constant;&lt;br /&gt;
&lt;br /&gt;
A :== [&#039;A&#039;,&#039;B&#039;,&#039;C&#039;,&#039;D&#039;];&lt;br /&gt;
n_A IS_A integer_constant;&lt;br /&gt;
&lt;br /&gt;
n_A :== CARD[A];&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the value of n_A will be set to 4.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: you can&#039;t use the &amp;lt;tt&amp;gt;CARD&amp;lt;/tt&amp;gt; function in equations; it is only able to be used when assigning values to constants.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Adding and subtracting sets ==&lt;br /&gt;
&lt;br /&gt;
Sets can be useful for slicing up arrays in different ways, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;REQUIRE &amp;amp;quot;atoms.a4l&amp;amp;quot;;&lt;br /&gt;
MODEL mymodel;&lt;br /&gt;
  A, B, C IS_A set OF integer_constant;&lt;br /&gt;
&lt;br /&gt;
  A :== [1..10];&lt;br /&gt;
  B :== [1,2,9,10];&lt;br /&gt;
&lt;br /&gt;
  C :== A - B; (* set difference, will contain 3,4,..8. *)&lt;br /&gt;
&lt;br /&gt;
  a[A] IS_A temperature;&lt;br /&gt;
&lt;br /&gt;
  n_C IS_A integer_constant;&lt;br /&gt;
  n_C :== CARD[C];&lt;br /&gt;
&lt;br /&gt;
  T_avg_C IS_A temperature;&lt;br /&gt;
  T_avg_C * n_C = SUM[a[i] | i IN C];&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
  (* fix elements 1, 2, 9 and 10 *)&lt;br /&gt;
  FIX a[B];&lt;br /&gt;
&lt;br /&gt;
  (* initialise those same elements to 290 K *)&lt;br /&gt;
  FOR i IN B DO&lt;br /&gt;
    a[i]&amp;amp;nbsp;:= 290 {K};&lt;br /&gt;
&lt;br /&gt;
  END FOR;&lt;br /&gt;
  (* initialise the remaining elements to 320 K *)&lt;br /&gt;
  a[C]&amp;amp;nbsp;:= 320 {K};&lt;br /&gt;
&lt;br /&gt;
END on_load;&lt;br /&gt;
END mymodel;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the use of the [[SUM]] statement for looping through elements of a set and adding up the resulting expressions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Incomplete]]&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Worked_examples&amp;diff=159</id>
		<title>Worked examples</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Worked_examples&amp;diff=159"/>
		<updated>2010-05-13T14:00:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a list of worked example models that were written in the spirit of experimentation while working on the functionality of ASCEND.&lt;br /&gt;
&lt;br /&gt;
See also [[Category:Tutorials]] and [[Category:Examples]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Four bar linkage ==&lt;br /&gt;
&lt;br /&gt;
{{src|models/johnpye/fourbar.a4c}}&lt;br /&gt;
&lt;br /&gt;
This example shows a (static) system with simple geometric constraints. It is solved for a range of angles for one member, and the position of the other members is determined. Then a nice plot is built up by repeated running the ASCEND model and accumulating the results using [[ExtPy]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Fourbar.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Fourbar.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;both&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Thermal equilibrium ==&lt;br /&gt;
&lt;br /&gt;
{{src|models/johnpye/thermalequilibrium2.a4c}}&lt;br /&gt;
&lt;br /&gt;
This is a simple model of thermal equilibrium between two masses of steam with a simple constant heat transfer coefficient between them. The model uses external [[freesteam]] IAPWS-IF97 steam tables and the [[IDA]] integrator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Thermalequilibrium.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Thermalequilibrium.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Graph of the temperatures of the two masses over time. The transition through the saturation region is visible.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Simple advection equation ==&lt;br /&gt;
&lt;br /&gt;
{{src|models/johnpye/advection.a4c}}&lt;br /&gt;
&lt;br /&gt;
This model is a study of the simple advection equation, following [http://dx.doi.org/10.1177/003754977803100205 a discussion] published by Carver and Hinds in &#039;&#039;Simulation&#039;&#039; (1978). Just as with the explicit integration method discussed in that paper, we also see instability when using the [[IDA]] implicit BDF integrator  here. The output in each case was generated by copying the contents of the Integrator tab and pasting into OpenOffice and plotting there.&lt;br /&gt;
&lt;br /&gt;
[[Image:2p-upwind.png]][[Image:3p-upwind.png]]&lt;br /&gt;
[[Image:4p-biased.png]][[Image:Central-diff.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== More examples ==&lt;br /&gt;
&lt;br /&gt;
For some more detailed examples, see the page [[Category:Examples]], which includes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Vapor-liquid equilibrium]]&lt;br /&gt;
* [[Calculation of sun position]]&lt;br /&gt;
* [[Damped response]]&lt;br /&gt;
* [[Conditional modelling]] (examples of models with IF/ELSE-style behaviour in their equations)&lt;br /&gt;
* [[Optimisation of frame geometry]]&lt;br /&gt;
* [http://www.che.uah.edu/courseware/toolbox/ascend/ Chemical thermodynamics, mass/energy balance] and more, from [[User:Kchittur|Krishnan Chittur]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ANTLR_exercise&amp;diff=158</id>
		<title>ANTLR exercise</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ANTLR_exercise&amp;diff=158"/>
		<updated>2010-05-13T14:00:04Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ANTLR is a candidate for replacing yacc/lex as the parser in ascend. This is needed for many reasons, of which a key one is generating C-code versions of models that are thread safe so we don&#039;t have to clean up the current model interpreter. There are several other very good reasons for ANTLR:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* We want to do source-to-source translation of ascend models to other languages that give us optimization access (GAMS, AMPL, OSxL, Matlab).&lt;br /&gt;
* Similarly, we want to be able to dump a canned C or Fortran version of a model for standalone (non-ascend) use.&lt;br /&gt;
&lt;br /&gt;
The exercise is to demonstrate just the parsing with antlr of the current ascend language, with particular attention to the portions of the language defined in compiler/scanner.l (the lex/flex input file).&lt;br /&gt;
&lt;br /&gt;
The current parser/scanner are in compiler/ascParse.y and compiler/scanner.l.&lt;br /&gt;
&lt;br /&gt;
Notable differences between ascend and other languages are the NOTES feature of ascend and the fact that comments in ascend nest, unlike C/Java.&lt;br /&gt;
&lt;br /&gt;
Building ascend and installing Antlrworks is probably a good place to start.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:GSOC2010]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Supporting_RPMs&amp;diff=157</id>
		<title>Supporting RPMs</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Supporting_RPMs&amp;diff=157"/>
		<updated>2010-05-13T13:59:54Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;RPM packages (.rpm files) can be used on Red Hat and Fedora systems, SUSE and some other linux distributions. Any open-source RPMs that we generate in our efforts to getting ASCEND running, we will upload here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SUNDIALS ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;outdated&amp;quot; style=&amp;quot;border:solid 2pt orange; width:70ex; background-color:#FFEEDD;padding:4px;margin-bottom:6px&amp;quot;&amp;gt;&#039;&#039;This article is &#039;&#039;&#039;outdated&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Supporting_RPMs&amp;amp;action=edit updating it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of quite recently, SUNDIALS is available in the Fedora 7 and Fedora 8 repositories, so you shouldn&#039;t need to use our home-baked version unless you are on Fedora Core 6 or earlier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Fedora Core 6: &amp;lt;a href=&amp;quot;/images/b/bc/Sundials-2.3.0-0.i386.fc6.rpm&amp;quot; class=&amp;quot;internal&amp;quot; title=&amp;quot;Sundials-2.3.0-0.i386.fc6.rpm&amp;quot;&amp;gt;sundials-2.3.0-0.i386.fc6.rpm&amp;lt;/a&amp;gt;&lt;br /&gt;
* Source RPM for Fedora: [http://ascend.cheme.cmu.edu/ftp/jpye]&lt;br /&gt;
* Experimental RPMs for other platforms: [http://download.opensuse.org/repositories/home:/jdpipe/]&lt;br /&gt;
* We are currently in the process of submitting SUNDIALS for inclusion in Fedora.&lt;br /&gt;
&lt;br /&gt;
== CONOPT ==&lt;br /&gt;
&lt;br /&gt;
We have a CONOPT RPM that can be supplied to registered users of [[CONOPT]] only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== IPOPT ==&lt;br /&gt;
&lt;br /&gt;
* Experimental RPMs for Fedora, SUSE and others: [http://download.opensuse.org/repositories/home:/jdpipe/]&lt;br /&gt;
* When SUNDIALS has been accepted for inclusion into Fedora, we will start working on submitting IPOPT for inclusion.&lt;br /&gt;
&lt;br /&gt;
== CUnit ==&lt;br /&gt;
&lt;br /&gt;
* Experimental RPMs for Fedora, SUSE and others: [http://download.opensuse.org/repositories/home:/jdpipe/]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Outdated]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Prerequisites_for_Linux&amp;diff=156</id>
		<title>Prerequisites for Linux</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Prerequisites_for_Linux&amp;diff=156"/>
		<updated>2010-05-13T13:59:44Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;stub&amp;quot;&amp;gt;&#039;&#039;This article is a &#039;&#039;&#039;stub&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Prerequisites_for_Linux&amp;amp;action=edit expanding it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== To Build ASCEND ==&lt;br /&gt;
&lt;br /&gt;
You can usually just use the default versions of these that come with current versions of Linux. But just check them, anyway:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* gcc and g++ (3.x or 4.x)&lt;br /&gt;
* gfortran or g77 (we are recommending gfortran, because a FORTRAN-90 compiler is required if you want to build [[CONOPT]])&lt;br /&gt;
* flex&lt;br /&gt;
* bison&lt;br /&gt;
* python 2.4 or newer, including &#039;dev&#039; package or similar&lt;br /&gt;
* [http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 scons] (1.x or 0.98.x)&lt;br /&gt;
* [http://sourceforge.net/project/showfiles.php?group_id=1645&amp;amp;package_id=1608 swig] (&amp;amp;gt;=1.3.24). Some probs reported with 1.3.39.&lt;br /&gt;
* [http://www.llnl.gov/CASC/sundials/ sundials] (&amp;amp;gt;=2.2.0) or note that [[Supporting_RPMs|we have an RPM]]&lt;br /&gt;
* Tcl/Tk 8.3 or newer&lt;br /&gt;
* Tktable 2.8 or newer&lt;br /&gt;
* graphviz (optional)&lt;br /&gt;
* blas (optional, for use by LSODE solver; ASCEND also can build its own)&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
OpenSUSE is very out of date with SCons. You will not be able to use their version (as of May 2007).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To Run ASCEND ==&lt;br /&gt;
&lt;br /&gt;
The PyGTK GUI:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* gtk+&lt;br /&gt;
* pygtk&lt;br /&gt;
* matplotlib&lt;br /&gt;
* numpy&lt;br /&gt;
* libsundials (see [[Building ASCEND]] for note regarding Ubuntu Edgy)&lt;br /&gt;
* IPython (optional)&lt;br /&gt;
* graphviz (optional)&lt;br /&gt;
&lt;br /&gt;
To run the Tcl/Tk GUI:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Tcl/Tk 8.3.x or 8.4.x (whichever was used for the build)&lt;br /&gt;
* TkTable 2.8 or 2.9&lt;br /&gt;
* xgraph&lt;br /&gt;
&lt;br /&gt;
See also [[Prerequisites for Windows]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Stubs]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Library&amp;diff=155</id>
		<title>Library</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Library&amp;diff=155"/>
		<updated>2010-05-13T13:59:34Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;stub&amp;quot;&amp;gt;&#039;&#039;This article is a &#039;&#039;&#039;stub&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Library&amp;amp;action=edit expanding it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In ASCEND, the &#039;&#039;&#039;Library&#039;&#039;&#039; is the place where loaded modules are stored in memory. It is effectively a collection of &#039;type_description&#039; objects, which can be instantiated into &#039;&#039;&#039;model&#039;&#039;&#039; trees then sent to the solver.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[MODEL|&#039;&#039;&#039;MODEL&#039;&#039;&#039;]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Stubs]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=REFINES&amp;diff=154</id>
		<title>REFINES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=REFINES&amp;diff=154"/>
		<updated>2010-05-13T13:59:24Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;REFINES&#039;&#039;&#039; keyword is used to declare models as specialisations of more general &#039;base&#039; models.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL vehicle;&lt;br /&gt;
   n_wheels IS_A integer_constant;&lt;br /&gt;
END vehicle;&lt;br /&gt;
&lt;br /&gt;
MODEL bicycle REFINES vehicle;&lt;br /&gt;
   n_wheels :== 2;&lt;br /&gt;
END bicycle;&lt;br /&gt;
&lt;br /&gt;
MODEL car REFINES vehicle;&lt;br /&gt;
   n_wheels :== 4;&lt;br /&gt;
END car;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Object-oriented modelling]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Thin-walled_tank/Adding_methods_to_a_model&amp;diff=153</id>
		<title>Thin-walled tank/Adding methods to a model</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Thin-walled_tank/Adding_methods_to_a_model&amp;diff=153"/>
		<updated>2010-05-13T13:59:15Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float:right;width:33ex;padding-left:3px;margin-left:10px;margin-bottom:10px;border:solid 2pt grey;background-color: #eee&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;&#039;Thin-walled&#039;&#039;&#039; tank tutorial&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;small&amp;gt;[[Thin-walled_tank|&amp;amp;larr;Return to start]]&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Thin-walled_tank/Introduction|Introduction]]&lt;br /&gt;
* &amp;lt;strong class=&amp;quot;selflink&amp;quot;&amp;gt;Adding methods to a model&amp;lt;/strong&amp;gt;&lt;br /&gt;
* [[Thin-walled_tank/Arrays|Arrays]]&lt;br /&gt;
* [[Thin-walled_tank/Building_complex_models|Building complex models]]&lt;br /&gt;
* [[Thin-walled_tank/Parameterized_models|Parameterised models]]&lt;br /&gt;
&lt;br /&gt;
See also [[Category:Tutorials|Other tutorials]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
In this part, we continue the example we introduced in Part 1.  Our goal is to provide an introductory tutorial into using the ASCEND modeling environment.  We shall show how to add METHODS to models to make them more useful for sharing with others and/or with oneself at a later time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction: making a model sharable==&lt;br /&gt;
&lt;br /&gt;
We shall say a model is sharable if one can use and understand it without being its developer.  Being able to solve a model at least one time without first understanding it can aid significantly in learning about the model, especially in a modeling environment such as ASCEND that allows one to explore a solved model instance in detail.&lt;br /&gt;
&lt;br /&gt;
In Part 1, our ASCEND model was a nonprocedural listing of the variables and equations that must be true at the model solution.  There were no statements as to how to solve the model.  We know that solving large nonlinear models can be very difficult numerically and can require the modeler to provide a lot of special knowledge to coerce the model to a solution.  We want to add this knowledge to the code defining the model without forcing a modeler to use that knowledge when using the same model in a different manner - such as to solve for a different set of fixed variables or when embedding the model as a part of a larger model.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our approach in ASCEND is to allow modelers to add any number of methods to a model.  Methods are executable procedures that can alter the values of the variables and flags within a model instance and that can trigger the execution of other methods.  One writes them within within a [[METHODS]] section for the model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Adding methods to the &#039;&#039;&#039;thin-walled&#039;&#039;&#039; tank model ==&lt;br /&gt;
&lt;br /&gt;
The following is our &#039;&#039;&#039;thin walled&#039;&#039;&#039; tank example with an added [[METHODS]] section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* this is file twt0210.a4c *)&lt;br /&gt;
REQUIRE &amp;amp;quot;atoms.a4l&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL thin_walled_tank;&lt;br /&gt;
&lt;br /&gt;
    (* fixed variables *)&lt;br /&gt;
    D,&lt;br /&gt;
    H,&lt;br /&gt;
    wall_thickness  IS_A distance;&lt;br /&gt;
&lt;br /&gt;
    metal_density   IS_A mass_density;&lt;br /&gt;
&lt;br /&gt;
    (* computed variables *)&lt;br /&gt;
    end_area,&lt;br /&gt;
    side_area       IS_A area;&lt;br /&gt;
&lt;br /&gt;
    wall_vol        IS_A volume;&lt;br /&gt;
    metal_mass      IS_A mass;&lt;br /&gt;
&lt;br /&gt;
    (* equations *)&lt;br /&gt;
&lt;br /&gt;
    end_area=3.1416*D^2/4;&lt;br /&gt;
    side_area=3.1416*D*H;&lt;br /&gt;
&lt;br /&gt;
    wall_vol=(side_area+2*end_area)*wall_thickness;&lt;br /&gt;
    metal_mass=metal_density*wall_vol;&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
&lt;br /&gt;
   METHOD specify;&lt;br /&gt;
      FIX D;&lt;br /&gt;
      FIX H;&lt;br /&gt;
&lt;br /&gt;
      FIX wall_thickness;&lt;br /&gt;
      FIX metal_density;&lt;br /&gt;
   END specify;&lt;br /&gt;
&lt;br /&gt;
   METHOD values;&lt;br /&gt;
      D              := 20.0 {cm};&lt;br /&gt;
      H              := D/10.0;&lt;br /&gt;
&lt;br /&gt;
      wall_thickness := 0.15 {cm};&lt;br /&gt;
      metal_density  := 7.85 {g/cm^3};&lt;br /&gt;
&lt;br /&gt;
   END values;&lt;br /&gt;
&lt;br /&gt;
   METHOD setup;&lt;br /&gt;
      RUN specify;&lt;br /&gt;
&lt;br /&gt;
      RUN values;&lt;br /&gt;
   END setup;&lt;br /&gt;
&lt;br /&gt;
END thin_walled_tank;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We include three methods: specify - to set the fixed flags for the fixed variables, values - to provide values for these four fixed variables and setup - to trigger the running of the other two methods.  A user of this model within the TclTK interface would load it, compile it, and export it to the solver.  With a tool within the solver, he would trigger the method &amp;quot;setup&amp;quot; to run.  Finally he would solve the well-posed model.  Note that he could do all these steps without understanding anything about the model.  When done, he would have a solved model instance that he could then examine in detail using many of the available tools.&lt;br /&gt;
&lt;br /&gt;
A method is a procedure.  Thus statements that set values for the variables are of the general form &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LHS variable := RHS expression;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This statement states that ASCEND is to replace the value of the LHS variable with the current value of the RHS expression.  The replacement equals (:=) is not the equation equals (=) that we used in the nonprocedural part of our model.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
&lt;br /&gt;
Note that the METHODS section provides procedures a model user can invoke only when he wishes.  Running &amp;quot;setup&amp;quot; blindly sets up his model for solving.  As the original modeler will have tested this model before making it available, he would know that running &amp;quot;setup&amp;quot; creates a model instance that will solve.  He has thus passed this information along to the subsequent user, making the model more sharable than before.&lt;br /&gt;
&lt;br /&gt;
Also note that the second user of this model does not need to use any of these methods.  It is still a model he could play with interactively in many other ways.  It has just provided him with one way to get a first solution to examine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Standardized set of methods==&lt;br /&gt;
&lt;br /&gt;
We advise modelers using ASCEND to develop a number of different methods for a model.  That these methods exist and are useful is supported by our experiences with using ASCEND.  Note that no method has to be there.  We give several of these methods standard names, and both the TclTk and PyGTK interfaces discover and trigger some of these methods automatically when compiling and solving a model.  A significant difference between the two interfaces is the number of methods each expects and triggers automatically, with the PyGTK using methods as a means to make one&#039;s first experience with a model appear to be very simple.  We describe here the methods these interfaces anticipate being in a model.&lt;br /&gt;
&lt;br /&gt;
See also [[METHODS]].&lt;br /&gt;
&lt;br /&gt;
Continue with [[Thin-walled_tank/Building_complex_models|the next section, Building complex models]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Examples]]&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Obtaining_CONOPT_for_ASCEND&amp;diff=152</id>
		<title>Obtaining CONOPT for ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Obtaining_CONOPT_for_ASCEND&amp;diff=152"/>
		<updated>2010-05-13T13:59:04Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[CONOPT]] is an advanced optimisation ([[NLP]]) solver available that is supported by ASCEND. CONOPT is commercial software, and as such can not be distributed with ASCEND&#039;s GPL-licensed code.&lt;br /&gt;
&lt;br /&gt;
A paid license for CONOPT costs 640 USD for an academic single-user license, or 3200 USD for a non-academic license. These are the same prices as for the GAMS version of the CONOPT solver. To be elegible to use the academic license, CONOPT must used for teaching and/or non-commercial research, i.e. not for consulting. &lt;br /&gt;
&lt;br /&gt;
The ASCEND project receives a fixed percentage of the CONOPT license fee, so this is a good way to support our project as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: CONOPT has been tested with ASCEND on Linux (Fedora 9, Ubuntu 9.04) as well as Windows (XP). It is likely to be OK on other platforms, but may need some testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Trial copy ==&lt;br /&gt;
&lt;br /&gt;
A two-month trial of CONOPT is available for users of ASCEND.&lt;br /&gt;
&lt;br /&gt;
If you would like to obtain a trial copy of CONOPT please send us your details and whether you will be using it for academic or non-academic purposes. We will send you a suitable version of CONOPT (Linux RPM, Windows .EXE, or Linux .so file), and will also pass on your details to Arne Drud, who may wish to contact you to follow up on your experience with CONOPT.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can obtain a trial copy yourself from the &amp;lt;tt&amp;gt;libconsub3.so&amp;lt;/tt&amp;gt; file that is distributed with the [http://download.gams-software.com/ GAMS download]. Drop the file in &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt; and ASCEND should detect it. If you can&#039;t put it there, set the &amp;lt;tt&amp;gt;CONOPT_PATH&amp;lt;/tt&amp;gt; environment variable to the correct directory before launching ASCEND. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When CONOPT is correctly installed, it will appear in the &#039;Tools&amp;amp;rarr;Solver Engine&#039; menu in the PyGTK GUI for ASCEND.&lt;br /&gt;
&lt;br /&gt;
Arne Drud ([http://www.conopt.com]) has very generously permitted this two-month trial usage of CONOPT. We would ask that you respect his request that you only use the trial version for 2 months, after which time please remove it from your machine, or pay for a license.&lt;br /&gt;
&lt;br /&gt;
See also [[CONOPT]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Solvers]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Prerequisites_for_Windows&amp;diff=151</id>
		<title>Prerequisites for Windows</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Prerequisites_for_Windows&amp;diff=151"/>
		<updated>2010-05-13T13:58:54Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== For ASCEND 0.9.7 with the Python GUI ==&lt;br /&gt;
&lt;br /&gt;
To be installed in this order:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.python.org/ftp/python/2.6/python-2.6.msi Python 2.6] (be sure to install the 32-bit version)&lt;br /&gt;
* [http://ftp.gnome.org/pub/GNOME/binaries/win32/glade3/3.6/glade3-3.6.7-with-GTK+.exe Glade with GTK+ 3.6.7]&lt;br /&gt;
* [http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.14/pygobject-2.14.2-2.win32-py2.6.exe PyGObject 2.14.2 py2.6]&lt;br /&gt;
* [http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.4/pycairo-1.4.12-2.win32-py2.6.exe PyCairo 1.4.12-2 py2.6]&lt;br /&gt;
* [http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.16/pygtk-2.16.0.win32-py2.6.exe PyGTK 2.12.1-3 py2.6]&lt;br /&gt;
&lt;br /&gt;
Optional components:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://ipython.scipy.org/dist/0.10/ipython-0.10.win32-setup.exe IPython 0.10] (for console support)&lt;br /&gt;
* [http://sourceforge.net/projects/numpy/files/NumPy/1.3.0/numpy-1.3.0-win32-superpack-python2.6.exe/download NumPy 1.3.0] (to support Matplotlib)&lt;br /&gt;
* [http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/matplotlib-0.99.1.win-amd64-py2.6.exe Matplotlib 0.99.1] (for plotting and incidence matrices)&lt;br /&gt;
&lt;br /&gt;
Backup copies of many of the above files are available from [http://www.eng.uah.edu/~kchittur/files4windows this site].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== For ASCEND 0.9.7 with the Tcl/Tk GUI ==&lt;br /&gt;
&lt;br /&gt;
The ActiveState site has recently removed the Tcl/Tk installer that was required by ASCEND during installation. A copy of the original file is available from here:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.eng.uah.edu/~kchittur/files4windows/ActiveTcl8.4.15.0.280619-win32-ix86-threaded.exe]&lt;br /&gt;
&lt;br /&gt;
We also believe that the following release will work, but have not yet tested it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://downloads.activestate.com/ActiveTcl/releases/8.4.19.3/ActiveTcl8.4.19.3.291941-win32-ix86-threaded.exe]&lt;br /&gt;
&lt;br /&gt;
== For ASCEND 0.9.6 with the PyGTK GUI ==&lt;br /&gt;
&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;outdated&amp;quot; style=&amp;quot;border:solid 2pt #FDB; width:70ex; background-color:#FFF8F4;padding:4px;margin-bottom:6px&amp;quot;&amp;gt;&#039;&#039;This section is &#039;&#039;&#039;outdated&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Prerequisites_for_Windows&amp;amp;action=edit updating it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:solid 2pt blue;padding:5px&amp;quot;&amp;gt;ASCEND now supports Python 2.5. (See link to sourceforge.net download page below). If installing ASCEND with Python 2.5, be sure to get the &amp;lt;tt&amp;gt;-py2.5&amp;lt;/tt&amp;gt; versions of the dependencies listed below. We have tested ASCEND with more up-to-date versions (than those listed here) of the GTK and PyGTK and related packages and that seems to work OK as well.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First install Python [http://www.python.org/download/releases/2.4.4/ version &#039;&#039;&#039;2.4&#039;&#039;&#039;]. We are not yet supporting Python 2.5 on Windows (although it is tested on Linux and should work).&lt;br /&gt;
&lt;br /&gt;
Next install GTK+. Download the [http://downloads.sourceforge.net/gladewin32/gtk-win32-devel-2.6.10-rc1.exe gtk-win32-devel-2.6.10-rc1.exe] file from the [http://sourceforge.net/project/showfiles.php?group_id=98754&amp;amp;package_id=111411 gladewin32] project.&lt;br /&gt;
&lt;br /&gt;
Next, install the following additional reqired python-related packages on your machine (easily located with Google):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://ftp.gnome.org/pub/gnome/binaries/win32/pycairo/1.0/pycairo-1.0.2-1.win32-py2.4.exe pycairo-1.0.2-1.win32-py2.4.exe]&lt;br /&gt;
* [http://ftp.acc.umu.se/pub/gnome/binaries/win32/pygtk/2.6/pygtk-2.6.3-1.win32-py2.4.exe pygtk-2.6.3-1.win32-py2.4.exe]&lt;br /&gt;
&lt;br /&gt;
You will require the following (for versions up to ASCEND 0.9.5.109, or they are optional for 0.9.5.110) for graphics support:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://downloads.sourceforge.net/matplotlib/matplotlib-0.90.0.win32-py2.4.exe matplotlib-0.90.0.win32-py2.4.exe]&lt;br /&gt;
* [http://prdownloads.sourceforge.net/numpy/numpy-1.0.2.win32-py2.4.exe numpy-1.0.2.win32-py2.4.exe]&lt;br /&gt;
&lt;br /&gt;
The remaining packages are optional. If you want to enable [[Python console support]] for scripting/debugging:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://ipython.scipy.org/dist/ipython-0.8.0.win32.exe ipython-0.8.0.win32.exe]&lt;br /&gt;
* (another python extension module), which in turn requires&lt;br /&gt;
** [http://downloads.sourceforge.net/ctypes/ctypes-1.0.1.win32-py2.4.exe ctypes-1.0.1.win32-py2.4.exe] (note: this dep will drop off with Python 2.5 -- built-in)&lt;br /&gt;
** [http://ipython.scipy.org/dist/pyreadline-1.4.2.win32.exe pyreadline-1.4.2.win32.exe]&lt;br /&gt;
** [http://downloads.sourceforge.net/ctypes/ctypes-1.0.1.win32-py2.4.exe ctypes-1.0.1.win32-py2.4.exe] (note: this dep will drop off with Python 2.5 -- built-in)&lt;br /&gt;
** [http://ipython.scipy.org/dist/pyreadline-1.4.2.win32.exe pyreadline-1.4.2.win32.exe]&lt;br /&gt;
* [http://downloads.sourceforge.net/ctypes/ctypes-1.0.1.win32-py2.4.exe ctypes-1.0.1.win32-py2.4.exe] (note: this dep will drop off with Python 2.5 -- built-in)&lt;br /&gt;
* [http://ipython.scipy.org/dist/pyreadline-1.4.2.win32.exe pyreadline-1.4.2.win32.exe]&lt;br /&gt;
&lt;br /&gt;
== For ASCEND 0.9.6 with the Tcl/Tk GUI ==&lt;br /&gt;
&lt;br /&gt;
* Tcl/Tk 8.3 or [http://downloads.activestate.com/ActiveTcl/Windows/8.4.15/ActiveTcl8.4.15.0.280619-win32-ix86-threaded.exe 8.4 (ActiveState distribution)]&lt;br /&gt;
* TkTable 2.8 or 2.9 (link required here?)&lt;br /&gt;
* xgraph (optional)&lt;br /&gt;
&lt;br /&gt;
== CONOPT ==&lt;br /&gt;
&lt;br /&gt;
Optionally, if you want to use the [[CONOPT]] or [[CMSlv]] solvers, you will need CONOPT. We have a .exe installer that we can provide to registered users of CONOPT.&lt;br /&gt;
&lt;br /&gt;
See also [[Prerequisites for Linux]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Outdated]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Environment_variables_for_ASCEND&amp;diff=150</id>
		<title>Environment variables for ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Environment_variables_for_ASCEND&amp;diff=150"/>
		<updated>2010-05-13T13:58:44Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;notice metadata&amp;quot; id=&amp;quot;stub&amp;quot;&amp;gt;&#039;&#039;This article is a &#039;&#039;&#039;stub&#039;&#039;&#039;. You can help out by &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://ascendwiki.cheme.cmu.edu/index.php?title=Environment_variables_for_ASCEND&amp;amp;action=edit expanding it]&amp;lt;/span&amp;gt;. &#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following environment variables affect how ASCEND runs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ASCENDLIBRARY ==&lt;br /&gt;
&lt;br /&gt;
This variable defines the search path that is used when attempting to load files named on the command line or named in [[REQUIRE]] statements.&lt;br /&gt;
&lt;br /&gt;
This variable a PATH-style variable, which means that on Windows it is semicolon-delimited, whereas on Linux it is colon-delimited. If you are using MSYS/MinGW then be aware that there is no magical transformation; you still need to us semicolons.&lt;br /&gt;
&lt;br /&gt;
When ASCEND loads, the following methods are used in order of decreasing priority:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* the ASCENDLIBRARY environment variable, if present&lt;br /&gt;
* the value of &amp;lt;tt&amp;gt;librarypath&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;~/.ascend.ini&amp;lt;/tt&amp;gt;, if defined.&lt;br /&gt;
* (Windows only) the value of the registry variable &amp;lt;tt&amp;gt;HKLM\SOFTWARE\ASCEND\ASCENDLIBRARY&amp;lt;/tt&amp;gt;, if defined&lt;br /&gt;
* the default value defined at compile-time.&lt;br /&gt;
&#039;&#039;&#039;The following is possibly subject to revision:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;exception&#039;&#039;&#039; to this is that &#039;&#039;if&#039;&#039; the ASCENDLIBRARY variable is defined, but it &#039;&#039;does not&#039;&#039; contain the standard [[ASCEND Model Library]] folder (probably &amp;lt;tt&amp;gt;/usr/share/ascend/models&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;c:\Program Files\ASCEND\models&amp;lt;/tt&amp;gt;), then it will be added to the &#039;&#039;&#039;end&#039;&#039;&#039; of the ASCENDLIBRARY path. This is to ensure that the model library will always be available for use with [[REQUIRE]] statements, and to make setting of non-standard paths a little more convenient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[REQUIRE]], [[IMPORT]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ASCENDSOLVERS ==&lt;br /&gt;
&lt;br /&gt;
This variable is used in the &amp;lt;tt&amp;gt;package_load&amp;lt;/tt&amp;gt; function that ASCEND uses in [[IMPORT]] statements, when loading external libraries, including solvers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCEND defines a value for ASCENDSOLVERS when ASCEND is first launched. The value used is, in order of decreasing priority:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The ASCENDSOLVERS environment variable if available (appending standard folder to end if it is missing),&lt;br /&gt;
* (Windows only) the registry key &amp;lt;tt&amp;gt;HKLM\SOFTWARE\ASCEND\ASCENDSOLVERS&amp;lt;/tt&amp;gt;, if present, or&lt;br /&gt;
* a default value defined at compile time.&lt;br /&gt;
&lt;br /&gt;
If ASCENDSOLVERS is not defined, ASCEND next looks for external libraries in the other locations indicated by the ASCENDLIBRARY environment variable, which means that you can store your external libraries as well as your model files in the same directory structure if you wish to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The following is possibly subject to revision:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the ASCENDSOLVERS environment variable is defined, and if it &#039;&#039;does not&#039;&#039; contain the standard &amp;lt;tt&amp;gt;solvers&amp;lt;/tt&amp;gt; folder (probably &amp;lt;tt&amp;gt;/usr/share/ascend/solvers&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;c:\Program Files\ASCEND\solvers&amp;lt;/tt&amp;gt;) then this folder will be added to the &#039;&#039;&#039;end&#039;&#039;&#039;  of the ASCENDSOLVERS path. This is to ensure that the basic minimal set of ASCEND solvers is always available, to avoid confusion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[IMPORT]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ASCENDTK ==&lt;br /&gt;
&lt;br /&gt;
This environment variable is used to define the location of the Tcl/Tk support files used by the ASCEND Tcl/Tk GUI. It defaults to &amp;lt;tt&amp;gt;$ASCENDDIST/TK&amp;lt;/tt&amp;gt;. It has no effect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ASCENDBITMAPS ==&lt;br /&gt;
&lt;br /&gt;
Defines the location of bitmap files used in the Tcl/Tk GUI. Defaults to &amp;lt;tt&amp;gt;$ASCENDDIST/bitmaps&amp;lt;/tt&amp;gt;. It has no affect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ASCENDDIST ==&lt;br /&gt;
&lt;br /&gt;
This environment variable is used by the ASCEND Tcl/Tk GUI to define the location of its common files. It can also be used to create &#039;off root&#039; installations, by allowing ASCEND to locate its files using relative paths. Depending on compile-time settings (specifically the value of &amp;lt;tt&amp;gt;@ASC_ABSOLUTE_PATHS@&amp;lt;/tt&amp;gt;), ASCENDDIST defaults to either &amp;lt;tt&amp;gt;$PROGDIR/@ASC_DATADIR_REL_BIN@&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;@ASC_DATADIR@&amp;lt;/tt&amp;gt; (where the &#039;&amp;lt;tt&amp;gt;@...@&amp;lt;/tt&amp;gt;&#039; variables are defined at compile time, and $PROGDIR is the directory containing the &amp;lt;tt&amp;gt;ascend4&amp;lt;/tt&amp;gt; binary).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ASC_GDB ==&lt;br /&gt;
&lt;br /&gt;
If present and non-zero, causes the ASCEND PyGTK GUI to run via the &amp;lt;tt&amp;gt;gdb&amp;lt;/tt&amp;gt; debugger (part of GNU GCC). This is made available because, since ASCEND PyGTK is essentially a Python program, it can be a little difficult/inconvenient to run it through a debugger.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== LD_LIBRARY_PATH ==&lt;br /&gt;
&lt;br /&gt;
When launching ASCEND PyGTK, this environment variable is examined to ensure that it contains the location of &amp;lt;tt&amp;gt;libascend&amp;lt;/tt&amp;gt; if necessary. If libascend is installed anywhere except /usr/lib, then its location is added to the end of LD_LIBRARY_PATH before continuing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When using the [[IPOPT]] solver, it may also be necessary to use this env var to point to external solvers such as /usr/local/lib/libhsl.so.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Stubs]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=External_libraries&amp;diff=149</id>
		<title>External libraries</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=External_libraries&amp;diff=149"/>
		<updated>2010-05-13T13:58:36Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ASCEND supports external libraries (you might call them &#039;plugins&#039;) of a number of different kinds. Specifically,&lt;br /&gt;
&lt;br /&gt;
* external solvers (for solving [[NLA]] and possibly other types of problems such as MILP or MINLP)&lt;br /&gt;
* external integrators (for solving ODE/DAE problems)&lt;br /&gt;
* external methods (that can be called from inside [[METHODS]] using the [[EXTERNAL]] command)&lt;br /&gt;
* external relations (in other words, equations that are calculated using code outside ASCEND)&lt;br /&gt;
* external import handlers (more on this later)&lt;br /&gt;
Currently all solvers and integrators for ASCEND are implemented as external libraries, as well as a number of external methods including a wrapper for [[QRSlv]] and a Brent solver for &#039;homing in&#039; on a solution to a single variable in otherwise hard-to-solve cases. There are also external libraries for calculation of steam properties (see [http://freesteam.sf.net]), properties of other fluids (see [[FPROPS]]) and for modelling of heat transfer in long-pipe flow boiling (ask [[User:Jpye|John Pye]]).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some other external libraries are under development including one for interpolating time-series data for use in simulations with forcing data.&lt;br /&gt;
&lt;br /&gt;
For large array-based simulations, external libraries may permit faster solution by eliminating unnecessary iteration by ASCEND and instead performing the iteration inside lower-level code.&lt;br /&gt;
&lt;br /&gt;
== External methods ==&lt;br /&gt;
External methods can be used to implement procedural-style changes to your model via the [[EXTERNAL]] statement. This technique is used internally by ASCEND to implement the &amp;lt;tt&amp;gt;ClearAll&amp;lt;/tt&amp;gt; method (see &amp;lt;a href=&amp;quot;https://ascendcode.cheme.cmu.edu/viewvc.cgi/code/trunk/models/basemodel.a4l?view=markup&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://ascendcode.cheme.cmu.edu/viewvc.cgi/code/trunk/models/basemodel.a4l?view=markup&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;basemodel.a4l&amp;lt;/a&amp;gt;. Here is the syntax to call an load and call an external method in a simple model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;IMPORT &amp;amp;quot;mylibrary&amp;amp;quot;; (* load libmylibrary.so or mylibrary.dll *)&lt;br /&gt;
&lt;br /&gt;
MODEL mymodel;&lt;br /&gt;
        ...&lt;br /&gt;
METHODS&lt;br /&gt;
    METHOD dosomething;&lt;br /&gt;
        ...&lt;br /&gt;
&lt;br /&gt;
        (* run a method from mylibrary... *)&lt;br /&gt;
        EXTERNAL myexternalmethod(SELF);&lt;br /&gt;
        RUN values; (* combine the EXTERNAL call with other statements as you wish *)&lt;br /&gt;
&lt;br /&gt;
    END dosomething;&lt;br /&gt;
    METHOD values;&lt;br /&gt;
        ...&lt;br /&gt;
    END values;&lt;br /&gt;
&lt;br /&gt;
END mymodel;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[IMPORT]] statement is used to specify how to load your external library; it is required that your external library contains a registration function that will tell ASCEND what external methods your library is providing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External relations (aka &#039;black box&#039; relations) ==&lt;br /&gt;
&lt;br /&gt;
External relations are implemented as &#039;&#039;&#039;blocks&#039;&#039;&#039; of equations that are evaluated in external code. This means that you pass a set of &#039;input&#039; variables, and the external code evaluates the resulting values of the &#039;output&#039; variables. In addition, there is a provision for a &#039;data&#039; object to be passed to the code. This data object should be constant-valued, so it can contain values that the external code won&#039;t be changing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To make use of an external relation (for example &amp;lt;tt&amp;gt;myextrel&amp;lt;/tt&amp;gt; ) as declared in your library &amp;lt;tt&amp;gt;mylibrary&amp;lt;/tt&amp;gt;, you use syntax like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;IMPORT &amp;amp;quot;mylibrary&amp;amp;quot;; (* ASCEND will try to load libmylibrary.so or mylibrary.dll depending your platform *)&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
x IS_A real;&lt;br /&gt;
A IS_A real; (* etc *)&lt;br /&gt;
eta IS_A real_constant;&lt;br /&gt;
&lt;br /&gt;
data IS_A mymodel_data;&lt;br /&gt;
&lt;br /&gt;
(* use a &#039;black box relation&#039; from mylibrary... *)&lt;br /&gt;
my_external_relation: myextrel(&lt;br /&gt;
         x, y, z : INPUT;&lt;br /&gt;
&lt;br /&gt;
         A, B : OUTPUT;&lt;br /&gt;
         eta : DATA&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
...&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How external relations are used by ASCEND ===&lt;br /&gt;
&lt;br /&gt;
External relations are solved to completion in the external code. When implementing your external relation, you should select your &amp;lt;tt&amp;gt;OUTPUT&amp;lt;/tt&amp;gt; variables such that they can be calculated with certainty in terms of the &amp;lt;tt&amp;gt;INPUT&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; variables. You can design your code to include its own internal iteration or solver procedure if necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a black box is added your model, it creates a &#039;relation&#039; object for each of your &amp;lt;tt&amp;gt;OUTPUT&amp;lt;/tt&amp;gt; variables, and makes this relation incident with its output variable as well as with &#039;&#039;all&#039;&#039; of the &amp;lt;tt&amp;gt;INPUT&amp;lt;/tt&amp;gt; variables for the black box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:402px;&amp;quot;&amp;gt;[[Image:Blackbox-incidence.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Blackbox-incidence.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Incidence matrix for a model containing a single &#039;black box&#039; external relation containing 3 outputs and 9 inputs.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When ASCEND reaches a block that contains external relations, it may find that all the INPUT variables are already known, in which case a single call the the external relation will be sufficient to determine the values of the OUTPUT variables. On the other hand, it may be that the values for some of the OUTPUT variables are already known (having been solved earlier in the solver process) and some of the INPUT variables are yet to be determined. In this case, ASCEND will use its standard Newton solver algorithm to home in on a solution for those variables. The external relation API provides the means for you to give a Jacobian matrix for the output variables relative to the input variables, which can then be used to improve the accuracy of the Newton solver. If you don&#039;t provide these derivatives, however, ASCEND will compute finite difference approximations by perturbing the values of the INPUT variables to estimate the Jacobian. Obviously this can result in many excess calls your your external relation evaluation function, so you will need to work out whether or not it is worth providing the derivative evaluation functions as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DATA instance ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;&amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;&#039;&#039;&#039; instance (see above example) is a mechanism whereby an arbitrary set of configuration data can be passed to the external relation when it is first set up.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; parameters are intended to convey fixed, constant values to the external relation. The best way to use these is to set up a &amp;lt;tt&amp;gt;MODEL&amp;lt;/tt&amp;gt; containing various &amp;lt;tt&amp;gt;constant&amp;lt;/tt&amp;gt; values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;MODEL myext_data;&lt;br /&gt;
&lt;br /&gt;
    myvalue IS_A constant;&lt;br /&gt;
    myvalue :== 3.45 {m};&lt;br /&gt;
END myext_data;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values can then be obtained in the external library code using (here C++) the following. The &#039;data&#039; variable is passed in to the BBoxInitFn.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;symchar *myvalue_sym = AddSymbol(&amp;amp;quot;myvalue&amp;amp;quot;);&lt;br /&gt;
struct Instance *myvalue_inst = ChildByChar(data,myvalue_sym);&lt;br /&gt;
&lt;br /&gt;
if(!myvalue_inst)throw runtime_error(&amp;amp;quot;Instance &#039;myvalue&#039; is required in DATA&amp;amp;quot;);&lt;br /&gt;
double myvalue = RealAtomValue(myvalue_inst);&amp;lt;/source&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that this is intended to be a &#039;&#039;&#039;read-only&#039;&#039;&#039; mechanism; there is no guarantee, if you attempt to &#039;hold on&#039; to pointers into this DATA instance, that those instances will still be there later on.&lt;br /&gt;
&lt;br /&gt;
See also [[Writing_ASCEND_external_relations_in_C|a more detailed example]] about external relations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External solvers ==&lt;br /&gt;
&lt;br /&gt;
All ASCEND solvers are implemented as external libraries. This includes [[QRSlv]] as the default NLA solver, [[CONOPT]] as the standard optimisation solver, plus [[CMSlv]] as the conditional solver. See [[Solvers]] for more information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Default solvers are loaded when ASCEND starts. To use other solvers, you must add an [[IMPORT]] statement at the start of your model file to trigger loading of the necessary shared library. Note the [[ASCENDSOLVERS]] environment variable can be used to located where these shared libraries are located, if necessary.&lt;br /&gt;
&lt;br /&gt;
Somewhat related: we have implemented an experimental [[Goal seeking solver]] using the EXTERNAL method mechanism. This is suitable for implementing a &#039;shooting method&#039; with an ASCEND model, for cases where a complicated model (for example one with some difficult feedback) doesn&#039;t converge when using the standard [[QRSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
See also [[External Solvers]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External integrators ==&lt;br /&gt;
&lt;br /&gt;
Support for external &#039;&#039;integrators&#039;&#039; has also been implemented. This means that any new integrator your create can be loaded dynamically with the [[IMPORT]] statement. For example we provide [[DOPRI5]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;IMPORT &amp;amp;quot;dopri5&amp;amp;quot;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For non-standard integrators, this additional IMPORT statement is required in order to for ASCEND to load the integrate. Standard integrators [[IDA]] and [[LSODE]] are always loaded, by default.&lt;br /&gt;
The integrator will then be available in the list when you open the &#039;Integrate&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
See also [[External Integrators]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External import handlers ==&lt;br /&gt;
&lt;br /&gt;
In a pleasing &#039;&#039;coup de récursion&#039;&#039;, one can implement &#039;handlers&#039; for importing other types of external libraries using the external library mechanism itself. For example, we have the [[ExtPy]] shared library, which, if [[IMPORT|IMPORTed]], allows one to then subsequently IMPORT external libraries defined by Python scripts. This mechanism is still somewhat hackish but has nevertheless proven useful in automating some modelling tasks, particularly when using the [[PyGTK GUI]].&lt;br /&gt;
&lt;br /&gt;
See also [[Import Handlers]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External CALLs ==&lt;br /&gt;
&lt;br /&gt;
This seems to be a fossil in the code. There is some provision for &#039;CALL&#039; statements that do something with external code. Not sure still what that does. This might be the start of a system for performing calls to functions &#039;&#039;&#039;with arguments&#039;&#039;&#039; from ASCEND METHODs, which is currently not implemented in general.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Writing an external library ==&lt;br /&gt;
&lt;br /&gt;
We will assume you are implementing a &#039;native&#039; external library, in other words one that loads from a shared library (.so or DLL file depending on your platform).&lt;br /&gt;
&lt;br /&gt;
You will create a source code files &amp;lt;tt&amp;gt;extfn.c&amp;lt;/tt&amp;gt; that will be complied into a shared library &amp;lt;tt&amp;gt;libextfn.so&amp;lt;/tt&amp;gt; or a DLL &amp;lt;tt&amp;gt;extfn.dll&amp;lt;/tt&amp;gt; depending on your platform.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your source code needs file to contain a registration function named with the stem of the library name (&amp;lt;tt&amp;gt;extfn&amp;lt;/tt&amp;gt;) with the added text &amp;lt;tt&amp;gt;_register&amp;lt;/tt&amp;gt; added at the end. This will enable ASCEND to automatically discover the registration function for your external library.&lt;br /&gt;
&lt;br /&gt;
Your &amp;lt;tt&amp;gt;*_register&amp;lt;/tt&amp;gt; function will in turn contain one or more calls to the ASCEND &amp;lt;tt&amp;gt;CreateUserFunction&amp;lt;/tt&amp;gt; function. These calls will register your external methods and functions, allowing them to be called from your &amp;lt;tt&amp;gt;.a4c&amp;lt;/tt&amp;gt; file. Here is an example of a registration function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;extern int&lt;br /&gt;
DLEXPORT mylibrary_register(struct Slv_Interp *dummy1, struct Instance *root&lt;br /&gt;
                ,struct gl_list_t *arglist, unsigned long dummy4&lt;br /&gt;
&lt;br /&gt;
){&lt;br /&gt;
    const char *addone_help = &amp;amp;quot;This function will return one-plus-its-input-argument&amp;amp;quot;;&lt;br /&gt;
    int result;&lt;br /&gt;
&lt;br /&gt;
    result = CreateUserFunction(&amp;amp;quot;add_one&amp;amp;quot;&lt;br /&gt;
            ,(ExtEvalFunc *)addone_prepare&lt;br /&gt;
            ,(ExtEvalFunc **)addone_calc&lt;br /&gt;
            ,(ExtEvalFunc **)NULL&lt;br /&gt;
            ,(ExtEvalFunc **)NULL&lt;br /&gt;
            ,1, 1, addone_help&lt;br /&gt;
    );&lt;br /&gt;
&lt;br /&gt;
    return result;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each call to &amp;lt;tt&amp;gt;CreateUserFunction&amp;lt;/tt&amp;gt; can offer a &#039;preparation&#039; function (which can be used to pre-calculate&lt;br /&gt;
fixed data tables and so on), an &#039;evalation&#039; function (which will return your function value, plus&lt;br /&gt;
first and second derivative functions.&lt;br /&gt;
&lt;br /&gt;
In order to compile your source code, you should use a SCons build file based on the example one given in &amp;lt;tt&amp;gt;models/johnpye/extfn&amp;lt;/tt&amp;gt;. Note the useful &amp;lt;tt&amp;gt;ascend-config&amp;lt;/tt&amp;gt; script that can help in determing your linker and compiler flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your sourcecode must contain (one or more functions like) the &amp;lt;tt&amp;gt;mylibrary_register&amp;lt;/tt&amp;gt; that you referenced in your IMPORT statement. This function must contain one or more calls to &amp;lt;tt&amp;gt;CreateUserFunction&amp;lt;/tt&amp;gt; which will tell ASCEND about the functions you are offering in your shared library.&lt;br /&gt;
&lt;br /&gt;
There are examples of such code in {{srcdir|models/johnpye/extfn}} in our [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
An important concept is the [[ImportHandler]]. This is a mechanism whereby you can define new types of external functionality to your model, to be accessed by the &amp;lt;tt&amp;gt;IMPORT&amp;lt;/tt&amp;gt; statement. This means that the &amp;lt;tt&amp;gt;IMPORT&amp;lt;/tt&amp;gt; statement is overloaded and can be set up to import anything you like, so long as ASCEND has been told how to deal with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[Writing ASCEND external relations in C]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Freesteam ==&lt;br /&gt;
&lt;br /&gt;
The open source steam properties library &#039;&#039;&#039;freesteam&#039;&#039;&#039; ([http://freesteam.sf.net]) includes bindings to ASCEND via the external &#039;black box&#039; system. There is a windows installer. Once installed, you need to edit you &amp;lt;tt&amp;gt;.ascend.ini&amp;lt;/tt&amp;gt; file so that the directory &amp;lt;tt&amp;gt;c:\Program Files\freesteam\ascend&amp;lt;/tt&amp;gt; is included in your &amp;lt;tt&amp;gt;librarypath&amp;lt;/tt&amp;gt;. Freesteam works equally well under Linux, although there are no binary packages at this stage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:502px;&amp;quot;&amp;gt;[[Image:Thermalequilibrium.png]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:Thermalequilibrium.png|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;A transient simulation of the equilibrium of two masses of water, showing phase change. The steam properties are calculated using [http://freesteam.sf.net/ freesteam]. The integration was performed using [[IDA]].&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Documentation]]&lt;br /&gt;
[[Category:Extending_ASCEND]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Talk:Data_reader&amp;diff=148</id>
		<title>Talk:Data reader</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Talk:Data_reader&amp;diff=148"/>
		<updated>2010-05-13T13:58:24Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Data Reader Talk Page==&lt;br /&gt;
&lt;br /&gt;
Please capture here thoughts and ideas that might not be appropriate in the main page. Experimental features, corrections, toDO&#039;s, wishes, etc. The idea is to keep the page itself as documentation and let the talk page be the discussion/developement forum. [[User:JoseZapata|Jose Zapata]] 23:30, 26 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: TODO (high priority, very easy): Other file formats: we should add support for the Australian BoM&#039;s new RMY (prev TMY) file format. It&#039;s the same as ACDB format, but with three extra digits added to the end. &amp;lt;a href=&amp;quot;/User:Jpye&amp;quot; title=&amp;quot;User:Jpye&amp;quot;&amp;gt;Jpye&amp;lt;/a&amp;gt; 07:41, 27 July 2009 (UTC)&lt;br /&gt;
&amp;lt;dl&amp;gt;&amp;lt;dd&amp;gt; Agree, would you like this done within GSOC? &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&amp;lt;/dd&amp;gt;&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Agree, would you like this done within GSOC? &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
: TODO (high priority, moderate difficulty): Add support for CSV files. Bear in mind that Excel outputs files with quoting of (some/all?) values and some escape characters (eg \&amp;quot;, not sure); a fully general implementation could be difficult. &amp;lt;a href=&amp;quot;/User:Jpye&amp;quot; title=&amp;quot;User:Jpye&amp;quot;&amp;gt;Jpye&amp;lt;/a&amp;gt; 07:53, 27 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dl&amp;gt;&amp;lt;dd&amp;gt; I dont think is worth the effort to code for a &amp;quot;MS proof&amp;quot; csv file AFAICT most software produce good quality CSV files (including Excel). If the data file is not properly formated, (as in values sepparated by commas and nothing else) the data reader should reject it. &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&amp;lt;/dd&amp;gt;&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: I dont think is worth the effort to code for a &amp;quot;MS proof&amp;quot; csv file AFAICT most software produce good quality CSV files (including Excel). If the data file is not properly formated, (as in values sepparated by commas and nothing else) the data reader should reject it. &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: TODO (medium priority, moderately difficult): Support for lookup tables with two independent variables. For example, we could use it to code up Jeff&#039;s results on the efficiency of a dish field for different sun angles. Examples of independent variables would be altitude and azimuth angles. I believe that TRNSYS implements this kind of thing. This would require a generalised spline implementation. &amp;lt;a href=&amp;quot;/User:Jpye&amp;quot; title=&amp;quot;User:Jpye&amp;quot;&amp;gt;Jpye&amp;lt;/a&amp;gt; 07:41, 27 July 2009 (UTC)&lt;br /&gt;
&amp;lt;dl&amp;gt;&amp;lt;dd&amp;gt; I thought a single independent variable was part of the scope definition for the data reader. I suppose it makes sense, specially for situations like dish efficiency fields where tabulation of data is faster than coding the efficiency algorithm like other extfunctions&amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/dd&amp;gt;&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: I thought a single independent variable was part of the scope definition for the data reader. I suppose it makes sense, specially for situations like dish efficiency fields where tabulation of data is faster than coding the efficiency algorithm like other extfunctions&amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: TODO (low priority, fiendishly difficult): Support for integer/boolean input data. There will be cases when input data could contain on-off stuff that we would like to feed into a simulation. Currently very difficult to implement, because the &#039;&#039;&#039;external&#039;&#039;&#039; relation interface only provides for rels, not logrels. &amp;lt;a href=&amp;quot;/User:Jpye&amp;quot; title=&amp;quot;User:Jpye&amp;quot;&amp;gt;Jpye&amp;lt;/a&amp;gt; 07:41, 27 July 2009 (UTC)&lt;br /&gt;
&amp;lt;dl&amp;gt;&amp;lt;dd&amp;gt; I dont see how boolean data should be imported different from real data. The trick is in the interpolation. If a signal changes from 0 to 1 , what is the value in between? &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&amp;lt;/dd&amp;gt;&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: I dont see how boolean data should be imported different from real data. The trick is in the interpolation. If a signal changes from 0 to 1 , what is the value in between? &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 05:55, 12 August 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: TODO (medium priority, very easy): Add a link to a complete working example, preferable including a sample (CSV?) data file. &amp;lt;a href=&amp;quot;/User:Jpye&amp;quot; title=&amp;quot;User:Jpye&amp;quot;&amp;gt;Jpye&amp;lt;/a&amp;gt; 07:53, 27 July 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
: TODO check monotonic increase of independent variable &amp;lt;a href=&amp;quot;/User:JoseZapata&amp;quot; title=&amp;quot;User:JoseZapata&amp;quot;&amp;gt;Jose Zapata&amp;lt;/a&amp;gt; 04:08, 24 August 2009 (UTC)&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Real-time_ASCEND&amp;diff=147</id>
		<title>Real-time ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Real-time_ASCEND&amp;diff=147"/>
		<updated>2010-05-13T13:58:14Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{task}}&lt;br /&gt;
&lt;br /&gt;
We propose developing a system that allows realtime data to be incorporated into ASCEND simulations, both for computing the performance of realtime systems, as well as for performing realtime parameter estimation. This is a huge area, and work is just beginning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;      &lt;br /&gt;
Contributed by: [[Dipak Chirmade]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Integration of live data streams into ASCEND simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Detailed procedure ===&lt;br /&gt;
&lt;br /&gt;
Please scroll down through the page to understand the overall work-flow diagram of current work.  &lt;br /&gt;
&lt;br /&gt;
Sub-pages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Real-time_ASCEND/Data_acquisition_hardware|Data acquisition (DA) hardware]]&lt;br /&gt;
* [[Real-time_ASCEND/Data_reader|Real-time Data reader]]&lt;br /&gt;
* [[Real-time_ASCEND/Solver|Real-time solver]]&lt;br /&gt;
&lt;br /&gt;
=== Quick example ===&lt;br /&gt;
&lt;br /&gt;
Following video demonstrate calculation of average of two live real-time temperature feeds. Please visit detailed procedure to learn more about real-time data reader and prototype of real-time solver. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;object width=&amp;quot;400&amp;quot; height=&amp;quot;329&amp;quot;&amp;gt;&amp;lt;param name=&amp;quot;movie&amp;quot; value=&amp;quot;http://www.youtube.com/v/cxF2u_-KVE4&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&amp;lt;param name=&amp;quot;wmode&amp;quot; value=&amp;quot;transparent&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&amp;lt;embed src=&amp;quot;http://www.youtube.com/v/cxF2u_-KVE4&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; wmode=&amp;quot;transparent&amp;quot; width=&amp;quot;400&amp;quot; height=&amp;quot;329&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&amp;lt;/object&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source:  [http://ascendcode.cheme.cmu.edu/viewvc.cgi/code/branches/dipak/models/dipak/Examples &amp;lt;font color=&amp;quot;orange&amp;quot;&amp;gt;dipak&amp;lt;/font&amp;gt;:models/dipak/Examples]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sequence diagram or work-flow of real-time ascend ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(With only major actions)&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:802px;&amp;quot;&amp;gt;[[Image:DA_Sequence.jpg]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:DA_Sequence.jpg|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Sequence of operations at DA-Hardware side.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:802px;&amp;quot;&amp;gt;[[Image:DR_Sequence.jpg]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:DR_Sequence.jpg|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Sequence of operations at real-time data-reader side.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;thumb tnone&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:802px;&amp;quot;&amp;gt;[[Image:RS_Sequence.jpg]] &amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[File:RS_Sequence.jpg|&amp;lt;img src=&amp;quot;/skins/common/images/magnify-clip.png&amp;quot; width=&amp;quot;15&amp;quot; height=&amp;quot;11&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;]]&amp;lt;/div&amp;gt;Sequence of operations at real-time solver side using Runge-Kutta method.&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Proposed]]&lt;br /&gt;
[[Category:Miscellany]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Survey_of_optimisation_software&amp;diff=146</id>
		<title>Survey of optimisation software</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Survey_of_optimisation_software&amp;diff=146"/>
		<updated>2010-05-13T13:58:04Z</updated>

		<summary type="html">&lt;p&gt;UploadBot: Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a survey of optimisation software that was performed as a part of our effort to identify options for a [[Non-proprietary Optimisation]] solver for ASCEND. Feel free to add any that we&#039;ve missed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== List of Lists ==&lt;br /&gt;
&lt;br /&gt;
* List of NLP solvers: [http://www.ici.ro/camo/hnp.htm]&lt;br /&gt;
* List of unconstrained optimisation solvers: [http://www.ici.ro/camo/huo.htm]&lt;br /&gt;
* There &#039;&#039;was&#039;&#039; a nice list at [http://www.scicomp.uni-erlangen.de/SW/opt.html] but the link seems to be broken at the moment.&lt;br /&gt;
* &#039;Decision tree&#039; for optimization software [http://plato.asu.edu/sub/nlores.html]&lt;br /&gt;
* Description of different types of optimisation problems: [http://coool.mines.edu/report/node3.html]&lt;br /&gt;
&lt;br /&gt;
== Free Open Source Software options ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;a href=&amp;quot;https://projects.coin-or.org/Ipopt&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://projects.coin-or.org/Ipopt&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;IPOPT&amp;lt;/a&amp;gt; (LGPL) &#039;Interior-Point Filter Line-Search Algorithm&#039;. Possibly some problems with scaling of variables (according to RPS). can use a number of free and non-free matrix solvers; the free matrix solver in version 3.3.1 is MUMPS. See also [[IPOPT]] in this wiki.&lt;br /&gt;
* [http://trilinos.sandia.gov/packages/moocho/ MOOCHO] (GPL?) reduced sequential quadratic programming (SQP); allows the user to supply their own linear solver.&lt;br /&gt;
* [http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html GSL &#039;multimin&#039;] (GPL) several multidimensional dense-matrix unconstrained optimisation methods including conjugate gradient methods, quasi-newton methods, steepest descent and Nelder-Mead simplex method.&lt;br /&gt;
* [http://acts.nersc.gov/opt++/index.html OPT++] (free, includes &#039;&#039;optional&#039;&#039; wrapping of non-free NPSOL). Good but dense matrices only (RPS). Superceded by MOOCHO?&lt;br /&gt;
* [http://software.sandia.gov/appspack/version5.0/index.html APPSPACK] (GPL?) &#039;asynchronous parallel generating set search&#039;, derivative-free.&lt;br /&gt;
* [http://www.eng.buffalo.edu/Research/MODEL/mdo.test.orig/CONMIN/ CONMIN] (&#039;free&#039; but where from?) &#039;two-step limited memory quasi Newton like Conjugate Gradient method with Beale restarts&#039;.&lt;br /&gt;
* [http://www.cs.sandia.gov/SGOPT/ SGOPT] (LGPL) Evolutionary and pattern-search algorithms&lt;br /&gt;
* [http://www.math.ufl.edu/~hager/ OPTPACK] (PD) &#039;a dual algorithm for constrained optimization&#039;&lt;br /&gt;
* [http://www.netlib.org/minpack/ MINPACK] (BSD-like) unconstrained&lt;br /&gt;
* [http://www.coin-or.org/Bonmin/ BonMin] (CPL) Part of the COIN-OR suite; a solver for convect MINLP problems.&lt;br /&gt;
* &amp;lt;a href=&amp;quot;https://projects.coin-or.org/Couenne&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://projects.coin-or.org/Couenne&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Couenne&amp;lt;/a&amp;gt; (CPL) Part of the COIN-OR suite; a solver for non-convex MINLP problems.&lt;br /&gt;
* [http://www.ime.usp.br/~egbirgin/tango/ ALGENCAN] (GPL) Augmented Lagrangian plus an embedded smooth function box-constraint solver called &#039;GENCAN&#039;&lt;br /&gt;
* [http://www.ime.usp.br/~egbirgin/tango/ SPG] (GPL) for smooth function with convex constraint&lt;br /&gt;
* [http://www.gerad.ca/~couturgi/NOMAD/ NOMAD] (GPL) Generalized Pattern Search (GPS) algorithms to solve nonlinear optimization problems&lt;br /&gt;
* [http://www-fp.mcs.anl.gov/otc/Tools/LBFGS-B/ LBFGS-B] (PD?) limited-memory quasi-Newton code&lt;br /&gt;
* [http://ab-initio.mit.edu/wiki/index.php/NLopt NLopt] (LGPL) wrapper for a few other FOSS codes, but also reportedly has some new implementations of certain algorithms&lt;br /&gt;
* [http://www.uni-graz.at/imawww/kuntsevich/solvopt/ SolvOpt] (PD) &#039;method of exact penalisation&#039;, based on N.Z. Shor r-algorithm&lt;br /&gt;
* [http://openopt.org/ralg ralg] (BSD) - an implementation of N.Z. Shor r-algorithm; nonlinear/nonsmooth constrained/unconstrained problems&lt;br /&gt;
&lt;br /&gt;
Wrappers &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.coin-or.org/NLPAPI/index.html NLPAPI] (GPL?) a generalised wrapper for NLP solvers, including support for LANCELOT.&lt;br /&gt;
* &amp;lt;a href=&amp;quot;https://projects.coin-or.org/GAMSlinks/&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://projects.coin-or.org/GAMSlinks/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;GAMSlinks&amp;lt;/a&amp;gt; (GPL?) a wrapper for &amp;lt;a href=&amp;quot;https://projects.coin-or.org/&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://projects.coin-or.org/&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;COIN-OR&amp;lt;/a&amp;gt; solvers that allows them to be called from GAMS. This is interesting as it shows how we could implement set up ASCEND so that it can use GAMS solvers, which adapting FOSS solvers that run under GAMS much easier to adapt for use with ASCEND.&lt;br /&gt;
* [http://www.netlib.org/ampl/solvers/lancelot/ AMPL/LANCELOT] a wrapper for running LANCELOT from AMPL. Again, this provides a way for seeing how solvers that have been adapted for use in AMPL might be also be connected to from ASCEND.&lt;br /&gt;
* [http://cuter.rl.ac.uk/cuter-www/interfaces.html CUTEr] (GPL-like license) is a wrapper for a wide range of optimisation solvers, and also a testing framework.&lt;br /&gt;
* &amp;lt;a href=&amp;quot;https://projects.coin-or.org/Osi&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://projects.coin-or.org/Osi&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;OSI&amp;lt;/a&amp;gt; (CPL?) wrapper for quite a wide range of LP solvers, from COIN-OR.&lt;br /&gt;
* &amp;lt;a href=&amp;quot;https://projects.coin-or.org/OS&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;https://projects.coin-or.org/OS&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;OS&amp;lt;/a&amp;gt; (CPL?) Optimisation Services, a number of interface languages and APIs for communicating between problem &#039;servers&#039; and solver &#039;clients&#039;, with support for a range of COIN-OR solvers and converters for GAMS/AMPL input files.&lt;br /&gt;
* [http://wiki.services.openoffice.org/wiki/Optimization_Solver OpenOffice.org&#039;s Solver]&lt;br /&gt;
* [http://openopt.org OpenOpt] (BSD) a general purpose optimization framework written in Python and NumPy, capable of automatic differentiation.&lt;br /&gt;
&lt;br /&gt;
Unknown:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://coool.mines.edu/ COOOL]&lt;br /&gt;
&lt;br /&gt;
Another free list: [http://software.sandia.gov/Acro/html/Main/AcroPackages.html]&lt;br /&gt;
&lt;br /&gt;
There are some more listed in the &amp;lt;a href=&amp;quot;ftp://rtfm.mit.edu/pub/usenet/sci.answers/nonlinear-programming-faq&amp;quot; class=&amp;quot;external text&amp;quot; title=&amp;quot;ftp://rtfm.mit.edu/pub/usenet/sci.answers/nonlinear-programming-faq&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;nonlinear-programming-faq&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Free for non-commercial use ==&lt;br /&gt;
&lt;br /&gt;
Trust region&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.numerical.rl.ac.uk/lancelot/blurb.html LANCELOT] (no redistribution or resale) Trust region method, adapt for bound constraints&lt;br /&gt;
&lt;br /&gt;
Active set&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www-unix.mcs.anl.gov/~more/tron/ TRON] (permission to copy and modify, but only to be used for &#039;internal research&#039; ([http://plato.asu.edu/ftp/other_software/tron_f90.tar.gz download]) active set method that uses a combination of gradient projections and a preconditioned conjugate gradient method to minimize an objective function. TRON only provides for &#039;box&#039; constraints and has no support for equality constraints, although it may be possible to add support for that by wrapping TRON around an NLA solver?&lt;br /&gt;
&lt;br /&gt;
Sequential quadratic programming&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://plato.la.asu.edu/donlp2.html DONLP2] (dense; free for non-commercial purposes)&lt;br /&gt;
&lt;br /&gt;
== Some proprietary alternatives ==&lt;br /&gt;
&lt;br /&gt;
Generalised reduced gradient method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.conopt.com/ CONOPT] (plus others in certain cases)&lt;br /&gt;
* [http://www.sbsi-sol-optimize.com/asp/sol_product_minos.htm MINOS] (uses GRG for linear constraints, else &#039;sparse SLC algorithm (a projected Lagrangian method, related to Robinson&#039;s method)&#039; for nonlinear constraints. Used when gradient evaluation is cheap.&lt;br /&gt;
* MS Excel [http://support.microsoft.com/kb/q214115/ Solver].&lt;br /&gt;
* GRG2&lt;br /&gt;
* LSGRG2&lt;br /&gt;
* [http://www.pinterconsulting.com/ LGO] &#039;Lipschitz Global Optimizer&#039;&lt;br /&gt;
&lt;br /&gt;
Sequential quadratic programming:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.sbsi-sol-optimize.com/asp/sol_products_snopt_desc.htm SNOPT] (sparse) Used when gradient evaluation is expensive. &#039;SNOPT employs a sparse SQP algorithm with limited-memory quasi-Newton approximations to the Hessian of Lagrangian. An augmented Lagrangian merit function promotes convergence from an arbitrary point.&#039;&lt;br /&gt;
* [http://www.uni-bayreuth.de/departments/math/~kschittkowski/nlpqlp22.htm NLPQLP]&lt;br /&gt;
* [http://www.sbsi-sol-optimize.com/asp/sol_product_npsol.htm NPSOL]&lt;br /&gt;
* [http://www.sbsi-sol-optimize.com/asp/sol_lssol105description.htm LSSOL] (dense, &#039;two-phase (primal) quadratic programming&#039;)&lt;br /&gt;
* [http://www.princeton.edu/~rvdb/ LOQO] (free 30-day trial) &#039;LOQO is based on an infeasible, primal-dual, interior-point method applied to a sequence of quadratic approximations to the given problem&#039;&lt;br /&gt;
* [http://www.mcs.anl.gov/~leyffer/solvers.html FilterSQP]&lt;br /&gt;
&lt;br /&gt;
Active set method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.sbsi-sol-optimize.com/asp/sol_product_qpopt.htm QPOPT] (dense)&lt;br /&gt;
&lt;br /&gt;
Other methods:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.ziena.com/knitro.htm KNITRO] (three methods: interior point direct, interior point conjugate gradient, &#039;active set&#039;)&lt;br /&gt;
* [http://www.gams.com/dd/docs/solvers/pathnlp.pdf PATHNLP]. &#039;PATHNLP solves an NLP by internally constructing the Karush-Kuhn-Tucker (KKT) system of first-order optimality conditions associated with the NLP and solving this system using the PATH solver for complementarity problems&#039;. Supposedly good for convex problems.&lt;br /&gt;
* [http://www.mosek.com/products.html MOSEK] (limited version available for download, or free student license) Interior point method plus simplex method.&lt;br /&gt;
* [http://www2.am.uni-erlangen.de/~kocvara/pennon/ PENNON] &#039;penalty method&#039;, &#039;PBM method of Ben-Tal and Zibulevsky&#039;&lt;br /&gt;
&lt;br /&gt;
Global optimisation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.andrew.cmu.edu/user/ns1b/baron/baron.html BARON]&lt;br /&gt;
* [http://www.ganso.com.au/index.php GANSO]&lt;br /&gt;
&lt;br /&gt;
Methods not yet checked:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* IMSL and NAG software libraries&lt;br /&gt;
&#039;&#039;More to come&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Mixed integer/nonlinear programs:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://www.gams.com/solvers/solvers.htm#DICOPT DICOPT]: MINLP&lt;br /&gt;
&lt;br /&gt;
See also [[Survey of sparse matrix software]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:Development]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
</feed>