<?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=Jpye</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=Jpye"/>
	<link rel="alternate" type="text/html" href="https://ascend4.org/Special:Contributions/Jpye"/>
	<updated>2026-06-12T23:33:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://ascend4.org/index.php?title=ExtPy&amp;diff=6406</id>
		<title>ExtPy</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ExtPy&amp;diff=6406"/>
		<updated>2026-05-11T03:11:41Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{experimental}}&lt;br /&gt;
&lt;br /&gt;
ExtPy is a special ASCEND external library that adds an [[Import_handlers|import handler]] that allows python scripts to be called from the &amp;lt;tt&amp;gt;METHODS&amp;lt;/tt&amp;gt; section of your model. You can write any script you like inside your external python script, and launch it from the &#039;Methods&#039; drop-down in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
An example is {{src|models/johnpye/fourbar.a4c}} which makes reference to {{src|models/johnpye/fourbarplot.py}}&lt;br /&gt;
&lt;br /&gt;
== ExtPy modules ==&lt;br /&gt;
&lt;br /&gt;
ExtPy modules have been written that &lt;br /&gt;
&lt;br /&gt;
* solve the model repeatedly and create a composite plot of the results&lt;br /&gt;
* produce specialised plots that could not be produced using the old &#039;plot.a4l&#039; approach.&lt;br /&gt;
* perform stability analysis on the DAE system&lt;br /&gt;
* [[Solver_NOTES|set parameters in the solver]] based on the contents of &amp;lt;tt&amp;gt;NOTES&amp;lt;/tt&amp;gt; in the model&lt;br /&gt;
* run the solver (useful during &amp;lt;tt&amp;gt;&#039;on_load&#039;&amp;lt;/tt&amp;gt; methods on models where initialisation is a bit trickier.)&lt;br /&gt;
* perform [[Parametric studies]]&lt;br /&gt;
* create 3D visualisations using OpenGL (see [[Optimisation of frame geometry]])&lt;br /&gt;
&lt;br /&gt;
An advantage of using ExtPy methods instead of writing an entire &#039;driver&#039; script is that you method can be called from the PyGTK GUI and can be more easily reused from multiple model files.&lt;br /&gt;
&lt;br /&gt;
ExtPy methods can be used from the Tcl/Tk GUI, although obviously they can&#039;t make PyGTK GUI output in that case.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
If you want to implement your own &#039;ExtPy&#039; module, you should note the following basic structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# import the &#039;extpy&#039; module for basic access to the ASCEND API&lt;br /&gt;
import extpy&lt;br /&gt;
&lt;br /&gt;
# any stuff that might cause errors should be imported like this:&lt;br /&gt;
try:&lt;br /&gt;
	from pylab import *&lt;br /&gt;
&lt;br /&gt;
except:&lt;br /&gt;
	pass&lt;br /&gt;
&lt;br /&gt;
# you can import standard ASCEND components, for example:&lt;br /&gt;
from solverreporter import *&lt;br /&gt;
&lt;br /&gt;
# this is where you define your external method&lt;br /&gt;
def fourbarplot(self):&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;Document the method with a docstring; this text will appear in the ASCEND GUI&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# use the following if your method uses matplotlib; this will ensure&lt;br /&gt;
	# that visible error messages are thrown if matplotlib is not installed.&lt;br /&gt;
&lt;br /&gt;
	import loading&lt;br /&gt;
	loading.load_matplotlib(throw=True)&lt;br /&gt;
&lt;br /&gt;
	# to gain access to the main PyGTK GUI window, use the following:&lt;br /&gt;
	browser = extpy.getbrowser()&lt;br /&gt;
&lt;br /&gt;
	browser.do_solve()&lt;br /&gt;
&lt;br /&gt;
	# rest of your method here&lt;br /&gt;
&lt;br /&gt;
# finally, tell ASCEND about the method you have just defined:&lt;br /&gt;
extpy.registermethod(fourbarplot)&lt;br /&gt;
&lt;br /&gt;
# the above method can be called using &amp;quot;EXTERNAL fourbarplot(SELF)&amp;quot; in ASCEND.&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Extending_ASCEND]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6405</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6405"/>
		<updated>2026-04-05T12:53:17Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Ubuntu 24.04 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Apr 2026, the ASCEND compile and run with Ubuntu 24.04 is as follows:&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our revised version of CUnit (which we&#039;re now hosting and releasing via https://github.com/ascend4/cunit).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool git&lt;br /&gt;
git clone https://github.com/ascend4/cunit.git&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j7&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, clone the main &#039;python3&#039; branch of the ASCEND repo from Github into &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
git clone https://github.com/ascend4/ascend4.git&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a newer generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6404</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6404"/>
		<updated>2026-04-05T11:20:03Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a newer generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=History_of_ASCEND&amp;diff=6403</id>
		<title>History of ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=History_of_ASCEND&amp;diff=6403"/>
		<updated>2026-04-01T11:33:11Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* ASCEND IV, post 2004 */&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;
===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;
===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;
===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;
===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;
===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;
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;
===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;
[[Ben 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;
===ASCEND4, 2026 ===&lt;br /&gt;
&lt;br /&gt;
Recent work in ASCEND has been focussed on new applications in decarbonised industrial processes, including hydrogen direct reduction ironmaking. [[John Pye]] has been expanding ASCEND with improved support for differential-algebraic equation (DAE) models, expanding the thermodynamics libraries to better handling chemical equilibrium, and many other changes, not least being a massively expanded CUnit test suite with &amp;gt;50% test coverage already achieved. [[Ben Allan]] has been working on adapting ASCEND to run in the browser via WASM. &lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6402</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6402"/>
		<updated>2026-03-15T00:02:52Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Using MSYS2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a newer generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6401</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6401"/>
		<updated>2026-03-15T00:02:23Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Raspbian (Raspberry Pi) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6400</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6400"/>
		<updated>2026-03-15T00:02:09Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Raspbian (Raspberry Pi) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6399</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6399"/>
		<updated>2026-03-15T00:01:59Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Fedora 11 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6398</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6398"/>
		<updated>2026-03-15T00:01:51Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* CentOS 5.6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6397</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6397"/>
		<updated>2026-03-15T00:01:39Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* CentOS 5.6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6396</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6396"/>
		<updated>2026-03-15T00:01:29Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* CentOS 5.6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6395</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6395"/>
		<updated>2026-03-15T00:01:11Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Ubuntu 11.04 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6394</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6394"/>
		<updated>2026-03-15T00:00:56Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Ubuntu 11.10 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6393</id>
		<title>Building ASCEND</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Building_ASCEND&amp;diff=6393"/>
		<updated>2026-03-15T00:00:43Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Ubuntu 12.04 LTS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains specific instructions for building ASCEND on systems that we know about. First you should read about our [[version management]] for information on how to get hold of the source code.&lt;br /&gt;
&lt;br /&gt;
Building ASCEND requires the [http://www.scons.org/ SCons] build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you&#039;re not familiar with it. If you are interested in the implementation details of our build scripts, please see our [[developer&#039;s manual#Build system|developer&#039;s manual]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you are having trouble building ASCEND, it might be worth checking out the [[BuildBot]] (link [http://build.ascend4.org/waterfall here]) to see if the latest sources have compiled correctly on our test server.&lt;br /&gt;
&lt;br /&gt;
== General instructions ==&lt;br /&gt;
&lt;br /&gt;
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get info on the [[SCons_options_for_building_ASCEND|current build options]] by typing &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt;. To clean up after your build, type &amp;lt;tt&amp;gt;scons -c&amp;lt;/tt&amp;gt;. To include any building options, type &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; followed by options. For instance, type &amp;lt;tt&amp;gt;scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Any build option that you see in &amp;lt;tt&amp;gt;scons -Qh&amp;lt;/tt&amp;gt; can be entered into a file &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; that you can create in the root source directory (ie &amp;lt;tt&amp;gt;~/src/ascend/trunk&amp;lt;/tt&amp;gt;). For example, you might create a config.py file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;WITH_LOCAL_HELP = /usr/local/share/ascend/manual&lt;br /&gt;
DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, if you want to set configuration options so that they always get applied, edit your &amp;lt;tt&amp;gt;config.py&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
On top of that, you should also be aware that the SCons build will cache your build options in a file called &amp;lt;tt&amp;gt;options.cache&amp;lt;/tt&amp;gt;. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.&lt;br /&gt;
&lt;br /&gt;
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add &amp;lt;tt&amp;gt;/c/Python25/Scripts:/c/Python25&amp;lt;/tt&amp;gt; to your path, so that the &#039;scons&#039; script is discovered.&lt;br /&gt;
&lt;br /&gt;
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.&lt;br /&gt;
&lt;br /&gt;
For instructions on building with Autotools, see the old versions of this page. We&#039;re not actively supporting the Autotools build any more.&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; will create a locally-executable version of ASCEND that can be run from the source tree (&amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;tcltk/generic/interface/ascend4&amp;lt;/tt&amp;gt;, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;scons install INSTALL_PREFIX=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;~&amp;lt;/tt&amp;gt;, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don&#039;t have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type &amp;lt;tt&amp;gt;scons -qH&amp;lt;/tt&amp;gt; to see them. Also note the importance of the &amp;lt;tt&amp;gt;ABSOLUTE_PATHS&amp;lt;/tt&amp;gt; option for our build script. Note then when you run &#039;&amp;lt;tt&amp;gt;scons install&amp;lt;/tt&amp;gt;&#039; you don&#039;t get all the files in the model library, you only get a filter set according to the [[PACKAGE metafiles]] contained in the [[ModelLibrary]].&lt;br /&gt;
&lt;br /&gt;
Some more details on the implementation of the ASCEND build process via SCons is given in [[Developer&#039;s_Manual#Build_system]].&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk GUI ===&lt;br /&gt;
&lt;br /&gt;
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:&lt;br /&gt;
&lt;br /&gt;
http://www.activestate.com/activetcl&lt;br /&gt;
&lt;br /&gt;
At present, detection of Tcl/Tk is not particularly sophisticated. &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; just looks for &amp;lt;tt&amp;gt;tcl.h&amp;lt;/tt&amp;gt; in your standard include path. So you might need to tweak. Check the &amp;lt;tt&amp;gt;scons -h&amp;lt;/tt&amp;gt; list of configuration options for more. On Debian-based systems, try something like &amp;lt;tt&amp;gt;scons TCL_CPPPATH=/usr/include/tcl8.4&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PyGTK GUI ===&lt;br /&gt;
&lt;br /&gt;
You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.&lt;br /&gt;
&lt;br /&gt;
To run the PyGTK interface requires more dependencies, see the [[PythonWrapper]] page for full details.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Linux ==&lt;br /&gt;
&lt;br /&gt;
In general, see [[Prerequisites for Linux]]. You will be using &amp;lt;tt&amp;gt;scons&amp;lt;/tt&amp;gt; to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it&#039;s possible that if you&#039;re using an old distro, you may need to go back and use an old version of the code.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 24.04 =====&lt;br /&gt;
&lt;br /&gt;
As of Jul 2025, ASCEND will compile and run with Ubuntu 24.04.&lt;br /&gt;
&lt;br /&gt;
If you want to run the (optional) CUnit test suite, first build and install (in &amp;lt;tt&amp;gt;~/.local&amp;lt;/tt&amp;gt;; no root required) our patched version of CUnit:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install build-essential automake autoconf libtool subversion&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, once you&#039;ve [[SvnInfo|downloaded the ASCEND source code from Github]] to &amp;lt;tt&amp;gt;~/ascend&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install build-essential gfortran flex bison scons swig doxygen tcl8.6-dev tk8.6-dev tk-table graphviz libgraphviz-dev python3-dev libgtk-3-dev libgtksourceview-3.0-dev python3-gi python3-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev python3-packaging python3-matplotlib python3-ipython pkgconf&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j7&lt;br /&gt;
./a4 open models/johnpye/fprops/brayton_fprops.a4c -m brayton_regen&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then see the GUI pop up and be able to click &#039;solve&#039; and then run the method &#039;cycle_plot&#039; to get a T-s diagram of the process via Matplotlib (Note: the plot appears, but currently has a rendering issue that we&#039;re working to resolve, something to do with recent versions of Matplotlib and the &#039;constrained layout&#039; feature.) Also note that the embedded IPython console is currently not working.&lt;br /&gt;
&lt;br /&gt;
To run the CUnit test suite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons -j7 test MALLOC_DEBUG=1&lt;br /&gt;
./a4 script test/test_expect_mallocdebug&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In that case you should see all of the selected cases in {{src|test/test_expectpass_mallocdebug}} showing as passed, with zero memory leaks.&lt;br /&gt;
&lt;br /&gt;
See also [[Valgrind]] for information on how to test with Valgrind, alternatively. In that case, compile with &amp;lt;tt&amp;gt;MALLOC_DEBUG=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 22.04 =====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds on 22.04, please see the encoded build steps as recorded in {{src|.github/workflows/ubuntu.yml}}.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 20.04 =====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update required. ASCEND does build on 20.04. The &amp;lt;tt&amp;gt;python3&amp;lt;/tt&amp;gt; branch has been established and we&#039;ve moved to Github now for the source code. The code now links to Python3 and GTK3, overcoming the issues with the disappearance of python-gtk2 bindings. The following instructions are outdated. Please refer to Ubuntu 22.04 for guidance if needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Big issues! Ubuntu 20.04 no longer supplies python-gtk2 or python-matplotlib, so the time is upon us to migrate to Python3 and GTK3...&lt;br /&gt;
&lt;br /&gt;
Work in progress...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt install automake autoconf libtool&lt;br /&gt;
svn co https://svn.code.sf.net/p/cunit/code/branches/mingw64 cunit&lt;br /&gt;
cd cunit&lt;br /&gt;
./bootstrap&lt;br /&gt;
./configure --prefix=$HOME/.local --enable-examples --enable-debug&lt;br /&gt;
make -j8&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
sudo apt install subversion gcc g++ gfortran flex bison scons swig doxygen  tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev tk-table graphviz libgraphviz-dev  python2.7 python2.7-dev libgtk2.0-0 python-gobject python-numpy liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev  libmumps-seq-dev libpcre3-dev ccache&lt;br /&gt;
&lt;br /&gt;
# build and run the libascend tests (at least the ones that normally pass)&lt;br /&gt;
python2 /usr/bin/scons test CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
LD_LIBRARY_PATH=~/.local/lib test/test_expectpass&lt;br /&gt;
&lt;br /&gt;
# build the C++ library and SWIG wrapper for python2&lt;br /&gt;
python2 /usr/bin/scons CUNIT_PREFIX=~/.local MALLOC_DEBUG=1&lt;br /&gt;
# run some bits of the C++ layer&lt;br /&gt;
cd ascxx&lt;br /&gt;
LD_LIBRARY_PATH=.. ASCENDLIBRARY=../models ASCENDSOLVERS=../solvers/qrslv ./testslvreq &lt;br /&gt;
&lt;br /&gt;
# todo: run via python&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 18.04 =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2 libpcre3-dev ccache&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUNDIALS support (for the [[IDA]]) solver is currently broken since a too-new version of SUNDIALS is provided with 18.04. We will need to try to update our IDA wrapper.&lt;br /&gt;
&lt;br /&gt;
Currently working on getting CUnit tests to pass (test/test_expectpass_leaky group): need to build CONOPT and avoid the segfault with the [[CMSlv]] solver.&lt;br /&gt;
&lt;br /&gt;
There were issues with the version of &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; provided in Ubuntu 18.04 -- it no longer comes with support for the GTK2 GUI toolkit which ASCEND uses. We have developed a patched version of Matplotlib, see [https://launchpad.net/~jdpipe/+archive/ubuntu/ppa here], and it is now able to show plots, but the program hangs after showing a plot and the plots are not interactive. There seems to be a problem still! Ultimately the solution will be to move to the Gtk3 port which is already partly completed.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 17.04 =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3206}}, ASCEND compiles fine on Ubuntu 17.04 (in the &amp;lt;tt&amp;gt;relerrorlist&amp;lt;/tt&amp;gt; branch), using the below instruction for 16.04.&lt;br /&gt;
&lt;br /&gt;
===== Ubuntu 16.04 LTS =====&lt;br /&gt;
&lt;br /&gt;
As of {{changeset|3106}}, ASCEND builds with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libmumps-seq-dev python-gtksourceview2&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons -j4&lt;br /&gt;
pygtk/ascdev models/johnpye/fprops/rankine_fprops.a4c -m rankine_water&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted below, currently an earlier version of SUNDIALS is needed if you want to be able to run the [[IDA]] solver. Alternatively, you can use the {{srcbranchdir|ksenija2||}} branch, which has support for SUNDIALS 2.5.0 already ([[User:Ksenija|Ksenija]] can tell you more).&lt;br /&gt;
&lt;br /&gt;
As noted below, ASCEND may have difficulties if your computer is in a locale where your decimal separate is not &amp;quot;.&amp;quot;. See below for locale setting changes that can be made in that case, to work around this issue. As noted below, use [[Developer%27s_Manual#CUnit_test_suites|these instructions]] if you want to run the CUnit-based test suite.&lt;br /&gt;
&lt;br /&gt;
If you wish to install ASCEND properly on your system, use &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and our [[dtar]] tool to create .deb packages.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 14.04.4 LTS ====&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for setting up Ascend:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen \&lt;br /&gt;
 tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev \&lt;br /&gt;
 python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython \&lt;br /&gt;
 liblapack-dev libblas-dev libsundials-serial-dev coinor-libipopt-dev \&lt;br /&gt;
 libcunit1-dev libmumps-seq-dev&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use SUNDIALS you have to download version 2.4.0 from the SUNDIALS webpage: http://computation.llnl.gov/casc/sundials/download/download.php&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
tar xzf sundials-2.4.0.tar.gz&lt;br /&gt;
cd sundials-2.4.0&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The installation process for Ascend looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co https://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command gives the following output:&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
{&#039;DISTRIB_CODENAME&#039;: &#039;trusty&#039;, &#039;DISTRIB_RELEASE&#039;: &#039;14.04&#039;, &#039;DISTRIB_ID&#039;: &#039;Ubuntu&#039;, &#039;DISTRIB_DESCRIPTION&#039;: &#039;&amp;quot;Ubuntu 14.04.4 LTS&amp;quot;&#039;}&lt;br /&gt;
GRAPHVIZ_LIBS = [&#039;gvc&#039;, &#039;cgraph&#039;, &#039;cdt&#039;]&lt;br /&gt;
GRAPHVIZ_LIBPATH = None&lt;br /&gt;
GRAPHVIZ_CPPPATH = [&#039;/usr/include/graphviz&#039;]&lt;br /&gt;
CHECKING SUNDIALS&lt;br /&gt;
SUNDIALS_LIBS = [&#039;sundials_ida&#039;, &#039;sundials_nvecserial&#039;, &#039;m&#039;]&lt;br /&gt;
SUNDIALS_LIBPATH = [&#039;/usr/local/lib&#039;]&lt;br /&gt;
SUNDIALS_CPPPATH = [&#039;/usr/local/include&#039;]&lt;br /&gt;
IPOPT_LIBS = [&#039;ipopt&#039;, &#039;lapack&#039;, &#039;dmumps&#039;, &#039;mpi&#039;, &#039;gfortran&#039;, &#039;gcc_s&#039;, &#039;quadmath&#039;, &#039;blas&#039;, &#039;m&#039;, &#039;dl&#039;]&lt;br /&gt;
IPOPT_LIBPATH = [&#039;/usr/lib/gcc/x86_64-linux-gnu/4.8&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib&#039;, &#039;/lib/../lib&#039;, &#039;/usr/lib/../lib&#039;, &#039;/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..&#039;]&lt;br /&gt;
IPOPT_CPPPATH = [&#039;/usr/include/coin&#039;]&lt;br /&gt;
Checking C compiler (&#039;gcc&#039;)... (cached) yes&lt;br /&gt;
Checking C++ compiler (&#039;g++&#039;)... (cached) yes&lt;br /&gt;
Checking for AddressSanitizer... (cached) no&lt;br /&gt;
Checking for C header file stdio.h... (cached) yes&lt;br /&gt;
Checking size of unsigned long long ... (cached) yes&lt;br /&gt;
Checking size of unsigned long ... (cached) yes&lt;br /&gt;
Checking size of int ... (cached) yes&lt;br /&gt;
Checking size of void * ... (cached) yes&lt;br /&gt;
Checking size of long ... (cached) yes&lt;br /&gt;
Checking size of unsigned int ... (cached) yes&lt;br /&gt;
Checking size of long long ... (cached) yes&lt;br /&gt;
Checking for C function sprintf()... (cached) yes&lt;br /&gt;
Checking for erf... (cached) yes&lt;br /&gt;
Checking for C function strdup()... (cached) yes&lt;br /&gt;
Checking for C function snprintf()... (cached) yes&lt;br /&gt;
Checking for C function cpow()... (cached) yes&lt;br /&gt;
Checking for IEEE math library... (cached) yes&lt;br /&gt;
Checking for malloc...(cached) yes&lt;br /&gt;
Checking for C function isnan()... (cached) yes&lt;br /&gt;
Checking for GCC... (cached) yes&lt;br /&gt;
Checking for GCC &#039;visibility&#039; capability... (cached) yes&lt;br /&gt;
Checking SIGINT is catchable... (cached) yes&lt;br /&gt;
Checking C99 FPE behaviour... (cached) yes&lt;br /&gt;
Checking signal handler reset... (cached) not required&lt;br /&gt;
Checking for Yacc (&#039;bison&#039;)... (cached) yes&lt;br /&gt;
Checking for Lex (&#039;flex&#039;)... (cached) yes&lt;br /&gt;
Checking for yylex_destroy... (cached) yes&lt;br /&gt;
Checking for tcl... (cached) yes&lt;br /&gt;
Checking Tcl version... (cached) 8.4.20, good&lt;br /&gt;
Checking for tk... (cached) yes&lt;br /&gt;
Checking Tk version... (cached) 8.4.20 (good)&lt;br /&gt;
Checking for libpython... (cached) yes&lt;br /&gt;
Checking version of SWIG... (cached) ok, 2.0.11&lt;br /&gt;
Checking for cunit... (cached) yes&lt;br /&gt;
Checking for graphviz cgraph... (cached) yes&lt;br /&gt;
Checking for graphviz &#039;boolean&#039; definition... (cached) yes&lt;br /&gt;
Checking for cxsparse... (cached) no&lt;br /&gt;
Checking for SUNDIALS... 2.4.0, good&lt;br /&gt;
Checking for IDA... no&lt;br /&gt;
Checking for CONOPT... no&lt;br /&gt;
Checking for IPOPT... yes&lt;br /&gt;
Checking for C library blas... yes&lt;br /&gt;
Checking Fortran compiler (&#039;gfortran&#039;)...yes&lt;br /&gt;
DYNAMIC TCL/TK PROGRAM LINKAGE&lt;br /&gt;
ASC4DEV&lt;br /&gt;
PYTHON_CPPPATH = [&#039;/usr/include/python2.7&#039;]&lt;br /&gt;
OBJS = [&#039;integrator.os&#039;, &#039;samplelist.os&#039;]&lt;br /&gt;
Skipping... BLAS won&#039;t be built: Found BLAS installed on system&lt;br /&gt;
Skipping... IDA won&#039;t be built: Unable to compile/link against SUNDIALS/IDA&lt;br /&gt;
FOUND &#039;PACKAGE&#039; file in ....&lt;br /&gt;
Skipping... Windows installer isn&#039;t being built: NSIS not found&lt;br /&gt;
Skipping... Documentation isn&#039;t being built: disabled by with_doc&lt;br /&gt;
Building targets: /usr/lib/graphviz&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
scons: `/usr/lib/graphviz&#039; is up to date.&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AddressSanitizer and cxsparse were experimental tools that could probably well be removed from ASCEND. The former was an attempt to track down some really tricky crashes when ASCEND was ported to 64-bit Windows. The latter was used to export matrices from the solver, for example for sparsity plotting and validation. CXSparse would actually be quite a useful basis for writing a new solver for ASCEND.&lt;br /&gt;
&lt;br /&gt;
As mentioned above running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4; possibly subject to some environment variable settings).&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&lt;br /&gt;
pygtk/ascdev PATHtoMODEL.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to change the locale setting (e.g. en_US.UTF-8) which uses a point as a decimal separator when running Ascend otherwise you will get an error message which states that your system uses a comma character as a decimal separator. Restart your shell after changing your locale settings.&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can install ASCEND and run it from a &#039;proper&#039; location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install INSTALL_PREFIX=/usr/local&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Read the General instructions paragraph for more information.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 13.10 ====&lt;br /&gt;
&lt;br /&gt;
At changeset 4605, ASCEND builds fine with the instructions for Ubuntu 12.04 LTS below. The modification to &amp;lt;tt&amp;gt;ipopt.pc&amp;lt;/tt&amp;gt; is still required. This was tested on a 64-bit Ubuntu 13.10 system (in VirtualBox) and there is a still a 64-bit issue present in ASCEND at the current revision. We presume this is still some form of {{bug|564}}.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 12.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|4077}} on Ubuntu 12.04 LTS Precise (beta 2, 32-bit, VirtualBox), 11 Apr 2012.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
svn co http://svn.ascend4.org/trunk/ ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[IDA]] works correctly using the packaged versions from Ubuntu. To get support for [[IPOPT]], you need to manually edit /usr/lib/pkgconfig/ipopt.pc and replace &amp;lt;tt&amp;gt;-ldmumps&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;-ldmumps_seq&amp;lt;/tt&amp;gt;. See [https://bugs.launchpad.net/ubuntu/+source/coinor-ipopt/+bug/978196 launchpad bug 978196]. If you use &amp;lt;tt&amp;gt;libmumps-dev&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;libmumps-seq-dev&amp;lt;/tt&amp;gt; you will get a crash, because ASCEND doesn&#039;t attempt to set up an MPI instance around IPOPT. CUnit works correctly following [[Developer&#039;s Manual#CUnit_test_suites|these instructions]].&lt;br /&gt;
&lt;br /&gt;
To enable building of the documentation (PDF from LyX sources) you also should install &amp;lt;tt&amp;gt;lyx&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lmodern&amp;lt;/tt&amp;gt;. Currently the documentation requires LyX 2.1, so in the case of Ubuntu 12.04, you will need to install this more recent version of LyX from [https://launchpad.net/~lyx-devel/+archive/ubuntu/release?field.series_filter=precise ppa:lyx-devel/release].&lt;br /&gt;
&lt;br /&gt;
We are still testing [[CONOPT]] and [[CMSlv]].&lt;br /&gt;
&lt;br /&gt;
Yet to test: [[dtar]]. Some new package dependencies (libmumps-seq-dev, and the changes to ipopt.pc) could make this difficult.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.10 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3840}} on Ubuntu Oneiric 11.10 32-bit in a VirtualBox machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython \&lt;br /&gt;
 python-matplotlib&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
pygtk/ascdev models/johnpye/testlog10.a4c&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are some warnings &#039;Unable to locate theme engine in module_path: &amp;quot;pixmap&amp;quot;&#039; if gtk-engines-pixbuf is not installed, but basically seems to be working fine. If you want to create a binary package suitable for this release,see [[dtar]], but note that currently (Oct 2011) we haven&#039;t yet made the necessary changes to related {{srcdir|debian}} file(s). Note that Oneiric comes with SWIG 1.3.40, so no problems with {{bug|517}} at this stage.&lt;br /&gt;
&lt;br /&gt;
Note yet tested: [[IDA]], [[IPOPT]], [[CONOPT]], [[dtar]].&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 11.04 ====&lt;br /&gt;
&lt;br /&gt;
Tested with trunk {{changeset|3618}} on Ubuntu Natty 11.04 32-bit. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison \&lt;br /&gt;
 graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev \&lt;br /&gt;
 libtktable2.9 libblas-dev ipython python-matplotlib&lt;br /&gt;
scons -j2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not yet tested: [[CONOPT]], [[IPOPT]], [[IDA]], [[dtar]]. Otherwise all appears fine when running with &amp;lt;tt&amp;gt;pygtk/ascdev&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To install, try &amp;lt;tt&amp;gt;sudo scons install INSTALL_PREFIX=/usr/local&amp;lt;/tt&amp;gt;. After that, you may need to &amp;lt;tt&amp;gt;export LD_LIBRARY_PATH=/usr/local/lib&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;lib64&amp;lt;/tt&amp;gt;) before it runs (with the command &amp;lt;tt&amp;gt;ascend&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
An ASCEND package can be created using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; and [[dtar]]. This package seems to work fine, except for some missing integration into the new Unity GUI shell.&lt;br /&gt;
 &lt;br /&gt;
If IPOPT 3.9.x is also installed (see instructions for 10.04 below) then ASCEND will fail to load external libraries unless the correct LD_LIBRARY_PATH has bee set for IPOPT (/usr/lib/coin:/usr/lib/coin/ThirdParty). It is expected that testing with IPOPT 3.10 will resolve this problem.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.10 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the &#039;trunk&#039; of our [[VersionManagement|subversion repo]]. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all &#039;optional&#039; packages are installed at the time of building ASCEND.&lt;br /&gt;
&lt;br /&gt;
For IPOPT, which is an optional component of ASCEND, you should see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
It appears that in Ubuntu 10.10, GraphViz has been upgraded and is not longer compatible with ASCEND. ASCEND should build fine without it, although you will be missing the [[incidence graph]] feature as a result (see {{bug|443}}).&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 10.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
For [[IPOPT]], which is an optional solver that can be used by ASCEND, you should additionally see the build instructions [[IPOPT|here]].&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install subversion swig g++ gfortran python-dev scons flex bison&lt;br /&gt;
&lt;br /&gt;
The following are optional but recommended:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install graphviz-dev libsundials-serial-dev liblapack-dev tcl8.5-dev tk8.5-dev libtktable2.9 libblas-dev&lt;br /&gt;
&lt;br /&gt;
Build ASCEND using&lt;br /&gt;
 scons -j2&lt;br /&gt;
&lt;br /&gt;
At runtime, the following packages will add capability to ASCEND:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install ipython python-matplotlib&lt;br /&gt;
&lt;br /&gt;
==== Kubuntu 10.04 ====&lt;br /&gt;
&lt;br /&gt;
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in [[FPROPS]] which need to be removed/made optional.&lt;br /&gt;
&lt;br /&gt;
==== Ubuntu 8.04 LTS ====&lt;br /&gt;
&lt;br /&gt;
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven&#039;t yet tested with CONOPT, so conditional modelling has not yet been checked.&lt;br /&gt;
&lt;br /&gt;
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).&lt;br /&gt;
&lt;br /&gt;
Building of a .deb package can be performed using the [[dtar]] tool included in the source distribution. Usage: scons dist &amp;amp;amp;&amp;amp;amp; ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.&lt;br /&gt;
&lt;br /&gt;
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different &amp;lt;tt&amp;gt;.lang&amp;lt;/tt&amp;gt; file. We have written a new version of this file, see the page on [[syntax highlighting]] for more info.&lt;br /&gt;
&lt;br /&gt;
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use &amp;lt;tt&amp;gt;scons WITH_DOC_BUILD=0&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.&lt;br /&gt;
&lt;br /&gt;
=== Fedora / RHEL / CentOS ===&lt;br /&gt;
&lt;br /&gt;
==== Fedora 20 ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: ASCEND is now included in the standard Fedora respositories! Thanks to Antonio Trande for his help with this! (Packaging details are [http://pkgs.fedoraproject.org/cgit/ascend.git/tree/ascend.spec here]).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(We tested with 64-bit Fedora 20 in a VirtualBox VM).&lt;br /&gt;
The following steps are required to build a local working copy of ASCEND:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview lyx \&lt;br /&gt;
  texlive-epstopdf coin-or-Ipopt-devel MUMPS-devel&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
Currently, the [[IPOPT]] and [[IDA]] solvers are not being built correctly. The former because IPOPT in Fedora 20 is parallel-only; no serial version provided. The latter because ASCEND (trunk code) is still requiring SUNDIALS 2.4.0, but Fedora 20 provides SUNDIALS 2.5.0. [[User:Ksenija]] did some work with SUNDIALS 2.5.0, which we need to integrate into trunk before this solver can be used again in this distro (or you can manually install the older SUNDIALS)&lt;br /&gt;
&lt;br /&gt;
==== Fedora 18 ====&lt;br /&gt;
&lt;br /&gt;
(We tested with the 64-bit version with our trunk code at changeset 4424). First you need to build SUNDIALS &#039;&#039;&#039;2.4.0&#039;&#039;&#039;. Follow the instructions at [[Building a SUNDIALS RPM for Fedora]] or download our RPMs which we have uploaded [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
Next you need [[IPOPT]]. Follow that link for build instructions, or see if there are suitable RPMs for your platform [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here].&lt;br /&gt;
&lt;br /&gt;
The following steps will download and compile the ASCEND stuff:&lt;br /&gt;
 sudo yum install @development-tools fedora-packager scons subversion tk-devel \&lt;br /&gt;
  flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel \&lt;br /&gt;
  swig python-matplotlib ipython blas-devel pygtksourceview&lt;br /&gt;
 svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
 cd ascend&lt;br /&gt;
 scons -j2&lt;br /&gt;
 pygtk/ascdev models/testlog10.a4c&lt;br /&gt;
&lt;br /&gt;
You can install ASCEND as an RPM with the following extra steps:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lyx texlive-collection-fontsrecommended texlive-epstopdf textlive-ulem texlive-lm-math&lt;br /&gt;
 scons dist&lt;br /&gt;
&lt;br /&gt;
That should build a tarball including documentation PDF (that PDF is included in our tarballs, but this process builds the tarball from our SVN repository, which does not include the PDF). Then,&lt;br /&gt;
&lt;br /&gt;
 cd ~/rpmbuild/SOURCES&lt;br /&gt;
 ln -s ~/ascend/dist/ascend-*.bz2&lt;br /&gt;
 cd ~/rpmbuild/SPECS&lt;br /&gt;
 ln -s ~/ascend/ascend.spec&lt;br /&gt;
 rpmbuild -ba ascend.spec&lt;br /&gt;
 sudo yum install ~/rpmbuild/RPMS/x86_64/ascend*.rpm&lt;br /&gt;
&lt;br /&gt;
At this stage (changeset 4424), the ascend-tcltk package is not installing because of wrong permissions on libascendtcl.so (we think). But the PyGTK GUI (package &#039;ascend&#039;) is working fine.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 17 ====&lt;br /&gt;
&lt;br /&gt;
Our recent ASCEND solver [[IDA]] depends on SUNDIALS 2.4+ which is not yet available in the Fedora repositories. If we&#039;ve built the right version for your architecture, you can possibly get the needed RPMs from [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here]. Otherwise you need to build a SUNDIALS RPM as detailed here [[Building a SUNDIALS RPM for Fedora]].&lt;br /&gt;
&lt;br /&gt;
One that is done, follow instructions as for Fedora 16 (below).&lt;br /&gt;
&lt;br /&gt;
Tktable appears not to be available by default in the Fedora repositories. A binary package may be available here: http://koji.fedoraproject.org/koji/packageinfo?packageID=3995. Not yet carefully tested.&lt;br /&gt;
&lt;br /&gt;
IPOPT RPMs for Fedora 17 are [http://sourceforge.net/projects/ascend-sim/files/thirdparty/ here] or see [[IPOPT]] to build your own.&lt;br /&gt;
&lt;br /&gt;
==== Fedora 16 ====&lt;br /&gt;
&lt;br /&gt;
Tested with {{changeset|4018}} on Fedora 16 64-bit in a VirtualBox VM. Builds and runs without problems. We recently put in place a workaround for {{bug|494}} so that the current SWIG 2.0.4 with Fedora works.&lt;br /&gt;
&lt;br /&gt;
First install needed packages:&lt;br /&gt;
 yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
&lt;br /&gt;
Next build the code:&lt;br /&gt;
 scons -j4&lt;br /&gt;
&lt;br /&gt;
You might also want to install &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;python-matplotlib&amp;lt;/tt&amp;gt; to get some extra features in the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
The version of SUNDIALS in Fedora is still 2.3.0, which at {{changeset|4108}} is too old now for ASCEND, since addition of [[IDA]] boundary detection that relies on SUNDIALS 2.4+. Also, [[IPOPT]] is not provided in the Fedora repositories, but 3.10.2 can be compiled manually and works with Fedora 16 without issues. Both of these issues make it difficult to release a nice package for ASCEND for this platform.&lt;br /&gt;
&lt;br /&gt;
==== CentOS 5.6 ====&lt;br /&gt;
&lt;br /&gt;
The following steps have been tested using a clean virtual machine created using the CentOS 5.6 net installer for x86_64.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
# log in as root...&lt;br /&gt;
su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel &lt;br /&gt;
wget http://pkgs.repoforge.org/scons/scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
rpm -i scons-1.2.0-1.el5.rf.noarch.rpm&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back as &#039;normal&#039; user, obtain a copy of the ASCEND source code from our [[VersionManagement|svn info]] as folder &#039;ascend&#039; (we tried with trunk revision 3601), then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
# ascend now runs via &#039;pygtk/ascdev&#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to use Matplotlib for plotting in ASCEND with CentOS, try using http://repoforge.org/use/ and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
install python-matplotlib python-numpy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 11 ====&lt;br /&gt;
&lt;br /&gt;
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;su&lt;br /&gt;
yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig&lt;br /&gt;
scons&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;s&amp;gt;Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See {{bug|403}}. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem.&amp;lt;/s&amp;gt; &#039;&#039;This bug is fixed in the pre-0.9.8 code from our SVN server.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Fedora 9 ====&lt;br /&gt;
&lt;br /&gt;
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.&lt;br /&gt;
&lt;br /&gt;
You can build an RPM version of ASCEND using &amp;lt;tt&amp;gt;scons dist&amp;lt;/tt&amp;gt; followed by &amp;lt;tt&amp;gt;rpm -ta ascend-0.9.5.116.tar.bz2&amp;lt;/tt&amp;gt;, providing you have RPM correctly set up. See also [[Building an RPM Package for ASCEND]].&lt;br /&gt;
&lt;br /&gt;
=== Raspbian (Raspberry Pi) ===&lt;br /&gt;
&lt;br /&gt;
ASCEND works great on Raspberry Pi! We used the Ubuntu 12.04 instructions above, and everything basically just worked. We haven&#039;t yet succeeded in creating .deb packages, but the GUI and command-line tools all seem to work well (Mar 2015).&lt;br /&gt;
&lt;br /&gt;
The following packages are needed for running Ascend under Raspbian:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
sudo apt-get install subversion gcc g++ gfortran flex bison scons swig doxygen&lt;br /&gt;
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev tk-table graphviz graphviz-dev&lt;br /&gt;
sudo apt-get install python2.7 python2.7-dev libgtk2.0-0 python-gtk2 python-matplotlib python-numpy ipython&lt;br /&gt;
sudo apt-get install liblapack-dev libblas-dev&lt;br /&gt;
sudo apt-get install libsundials-serial-dev coinor-libipopt-dev&lt;br /&gt;
sudo apt-get install libcunit1-dev libmumps-seq-dev lyx&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can skip installing lyx and turn off installing the documentation for Ascend. This is recommended for new users as the whole latex+lyx toolchain is huge and shouldn&#039;t be necessary for starting with ascend. There are also version issues with LyX.&lt;br /&gt;
&lt;br /&gt;
The installation process looks as follows (go to your home folder /home/USERNAME/):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
svn co http://svn.ascend4.org/trunk ascend&lt;br /&gt;
&lt;br /&gt;
cd ascend/&lt;br /&gt;
&lt;br /&gt;
scons $WITH_GRAPHVIZ = /usr/lib/graphviz WITH_DOC=0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=sh&amp;gt;&lt;br /&gt;
scons install&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSUSE ===&lt;br /&gt;
&lt;br /&gt;
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) ([http://sourceforge.net/project/showfiles.php?group_id=30337&amp;amp;package_id=22359 from SF.net].&lt;br /&gt;
Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Update (Mar 2010)&#039;&#039; it is suggested that you try latest SCons 1.x if possible, and report your experiences here.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
To build ASCEND on Arch Linux, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download and build sundials manually (see [[Prerequisites for Linux]]).&lt;br /&gt;
&lt;br /&gt;
Then follow the [[Building_ASCEND#General_instructions|General instructions]] (running scons and scons install).&lt;br /&gt;
&lt;br /&gt;
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of [http://www.swig.org SWIG](1.3.38 worked for me, 1.3.24 didn&#039;t) and build it manually (./configure, make, make install). Then re-run swig with parameter &amp;lt;tt&amp;gt;SWIG=/usr/local/bin/swig&amp;lt;/tt&amp;gt; (or different location where you installed SWIG).&lt;br /&gt;
&lt;br /&gt;
When running ascend script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
TypeError: can only concatenate list (not &amp;amp;quot;NoneType&amp;amp;quot;) to list&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;if GTKLIBPATH:&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH&lt;br /&gt;
else:&lt;br /&gt;
&lt;br /&gt;
	LDPATH = [INSTALL_LIB] + LDPATH&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(found [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00089.html here]).&lt;br /&gt;
&lt;br /&gt;
=== Gentoo ===&lt;br /&gt;
&lt;br /&gt;
Some details for build ASCEND on Gentoo Linux are on a sub-page at [[Building ASCEND/Gentoo]].&lt;br /&gt;
&lt;br /&gt;
== Instructions for Windows ==&lt;br /&gt;
&lt;br /&gt;
=== 64-bit executable for 64-bit Windows, using MinGW-w64/MSYS ===&lt;br /&gt;
&lt;br /&gt;
* [[setting up a MinGW-w64 build environment|set up a MinGW-w64 build environment]]&lt;br /&gt;
* [[building ASCEND for 64-bit Windows|build the dependencies and ASCEND itself]] (includes instructions for creating a redistributable installer packager).&lt;br /&gt;
&lt;br /&gt;
=== 32-bit executable for 64-bit or 32-bit Windows, using MinGW/MSYS ===&lt;br /&gt;
&lt;br /&gt;
ASCEND will also build using the standard MinGW 32-bit toolset. This is quite a bit easier than setting up the MinGW-w64 build environment because you can get your compiler and most of the needed tools using &amp;lt;tt&amp;gt;mingw-get&amp;lt;/tt&amp;gt;. However, until we can update our instructions, it is suggested that you follow [[setting up a MinGW-w64 build environment|our instructions for the MinGW-w64]], and just substitute 32-bit stuff wherever you see 64-bit stuff mentioned.&lt;br /&gt;
&lt;br /&gt;
=== Using MSYS2 ===&lt;br /&gt;
&lt;br /&gt;
[http://www.msys2.org/ MSYS2] is a new generation of MSYS that works with the &amp;lt;tt&amp;gt;[https://wiki.archlinux.org/index.php/pacman pacman]&amp;lt;/tt&amp;gt; package manager. &#039;&#039;This is new, and we&#039;re still experimenting!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This project is currently being worked on during Google Summer of Code 2016. &lt;br /&gt;
&lt;br /&gt;
For details please see &amp;lt;tt&amp;gt;[http://ascend4.org/User:Georgy Implement MSYS2 based build process and improve packaging for Mac]&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;&lt;br /&gt;
pacman -Syu&lt;br /&gt;
pacman -S vim&lt;br /&gt;
pacman -S mingw-w64-x86_64-gtk2 mingw-w64-x86_64-gcc \ &lt;br /&gt;
 mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-python2-numpy \ &lt;br /&gt;
 mingw-w64-x86_64-python2-pygtk subversion swig \ &lt;br /&gt;
 flex bison python2 scons pkgconfig \ &lt;br /&gt;
 mingw-w64-i686-python2&lt;br /&gt;
svn co svn://ascend4.org/code/trunk ascend&lt;br /&gt;
cd ascend&lt;br /&gt;
scons&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A challenge with this approach looks to be that it uses versions of Python and GTK2 that are not standard Windows system packages, so creating a distributable version of ASCEND will require rather a different set-up to the current approach (we will need to bundle all dependent packages). And if we do that, the resulting packages will not be compatible or interoperable with another Python installed on the user&#039;s system. But it still may be useful as a development tool/environment? Or maybe we should not recommend the &#039;standard&#039; Python installer any more..?&lt;br /&gt;
&lt;br /&gt;
Another challenge is that when installing &#039;scons&#039; as above, it is tied to the MSYS version of Python, which is not the same as the MinGW64 version of Python for which the developer libraries are installed. So it&#039;s very problematic to build Python extensions using SWIG. However it may be a current area of development in MSYS2; we will have to wait and see.&lt;br /&gt;
&lt;br /&gt;
Still to be resolved: the following packages don&#039;t yet exist in MSYS2, and would have to be built manually: graphviz-dev libsundials-serial-dev liblapack-dev libblas-dev ipython python-matplotlib coinor-libipopt-dev libmumps-seq-dev&lt;br /&gt;
&lt;br /&gt;
=== MSVS and other compilers ===&lt;br /&gt;
&lt;br /&gt;
Although &#039;libascend&#039; has been built with Microsoft tools in the past, it&#039;s been a long time since we tested this, and so we don&#039;t currently support these compilers. They probably can be made to work, so if you make any progress with this please let us know.&lt;br /&gt;
&lt;br /&gt;
Some very early efforts were made to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done. With MinGW now pretty complete and reliable, there&#039;s not much reason to bother with this.&lt;br /&gt;
&lt;br /&gt;
We would be interested to know about efforts to build ASCEND with any other Windows-based compilers, especially anything that works well in a unified package management environment or an IDE.&lt;br /&gt;
&lt;br /&gt;
== Instructions for Mac ==&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X 10.5 ===&lt;br /&gt;
&lt;br /&gt;
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven&#039;t completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See [[Porting to Mac]] for details.&lt;br /&gt;
&lt;br /&gt;
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Building a Debian package]]&lt;br /&gt;
* [[Building an RPM Package for ASCEND]]&lt;br /&gt;
* [[Windows Miscellany]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ASCEND_overview&amp;diff=6392</id>
		<title>ASCEND overview</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ASCEND_overview&amp;diff=6392"/>
		<updated>2026-03-14T09:06:30Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Example of a simple model in ASCEND */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&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 play around 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;
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 model calculates the mass of water in a tank:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ascend&amp;quot;&amp;gt;REQUIRE &amp;quot;atoms.a4l&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-example1.png|thumb|400px|none|The simple &amp;lt;tt&amp;gt;tank&amp;lt;/tt&amp;gt; model, loaded and solved in ASCEND.]]&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-tank21.png|thumb|400px|none|You can easily &#039;free&#039; and &#039;fix&#039; variables to solve the same model for a different set of unknowns.]]&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;
[[Image:solve-order1.png|thumb|400px|none|For small models, ASCEND can generate a graphical representation of the solution process, useful when debugging.]]&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:observer1.png|thumb|700px|none|The &#039;observer&#039; tab allows results for a set of scenarios to be calculated and stored, and then plotted.]]&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;
== 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;quot;johnpye/rankine.a4c&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 (see {{src|models/johnpye/rankine.a4c}} for the full code). More documentation [[:Category:Syntax|about the syntax]] is available, or you can look at our other models in this area of [[energy system modelling]].&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;
== 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;
* [[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;
* [[LP Solvers]] (including MIP solvers), where equations are linear, possibly with some variables required to be boolean/integer (see [[HiGHS]])&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-incidence1.png|thumb|400px|none]]&lt;br /&gt;
&lt;br /&gt;
See [[Solvers]] and [[Dynamic modelling]] for more information.&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;
== 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;
* [[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;
== 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;
== 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;
If you are interested in contributing to ASCEND, please see our [[Development Activities]] page and also our list of [[Student Projects]] for [[GSOC]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=STUDY&amp;diff=6391</id>
		<title>STUDY</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=STUDY&amp;diff=6391"/>
		<updated>2026-03-10T00:58:53Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; is a METHOD-language statement for preparing or executing a parametric study from inside a model method such as &amp;lt;code&amp;gt;on_load&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;syntax&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;ascend&amp;quot;&amp;gt;STUDY observed_var_list&lt;br /&gt;
    [VARY var FROM lower TO upper (STEPS n [LINEAR|LOG] | STEP delta | RATIO r)]&lt;br /&gt;
    [RUN method_name]&lt;br /&gt;
    [NOW]&lt;br /&gt;
    [FILE &amp;amp;quot;path&amp;amp;quot;];&amp;lt;/pre&amp;gt;&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;ascend&amp;quot;&amp;gt;STUDY accel_required, time_run;&lt;br /&gt;
&lt;br /&gt;
STUDY accel_required, time_run&lt;br /&gt;
    VARY time_run FROM 2 {s} TO 6 {s} STEPS 4&lt;br /&gt;
    NOW&lt;br /&gt;
    FILE &amp;amp;quot;study.tsv&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
STUDY y, x VARY x FROM 1 TO 10 STEP 0.1;&lt;br /&gt;
STUDY y, x VARY x FROM 1 TO 10 RATIO 1.1;&lt;br /&gt;
STUDY y, x VARY x FROM 1 TO 10 STEPS 8 LOG RUN reset;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more examples in {{srcdir|models/test/slvreq}}.&lt;br /&gt;
&lt;br /&gt;
== Semantics ==&lt;br /&gt;
&lt;br /&gt;
* The observed variable list is required.&lt;br /&gt;
* &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
* &amp;lt;code&amp;gt;RUN method_name&amp;lt;/code&amp;gt; is optional and is executed before each study point.&lt;br /&gt;
* &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
* &amp;lt;code&amp;gt;NOW&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
* The varied variable may also appear in the observed variable list.&lt;br /&gt;
* When &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present, the varied variable is always included first in the Observer and in CLI tabular output, without duplication.&lt;br /&gt;
* The current solver and options are taken from the existing GUI state and/or earlier METHOD &amp;lt;code&amp;gt;SOLVER&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;OPTION&amp;lt;/code&amp;gt; statements. They are not restated inside &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Stepping modes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;STEPS n&amp;lt;/code&amp;gt; means &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; intervals with both endpoints included.&lt;br /&gt;
* &amp;lt;code&amp;gt;STEP delta&amp;lt;/code&amp;gt; uses a linear increment.&lt;br /&gt;
* &amp;lt;code&amp;gt;RATIO r&amp;lt;/code&amp;gt; uses a logarithmic/geometric progression.&lt;br /&gt;
* &amp;lt;code&amp;gt;STEPS n LOG&amp;lt;/code&amp;gt; requests logarithmic spacing.&lt;br /&gt;
* &amp;lt;code&amp;gt;STEPS n&amp;lt;/code&amp;gt; without &amp;lt;code&amp;gt;LOG&amp;lt;/code&amp;gt; uses linear spacing.&lt;br /&gt;
&lt;br /&gt;
Validation rules:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;STEP&amp;lt;/code&amp;gt; must be non-zero and must move from the lower bound toward the upper bound.&lt;br /&gt;
* &amp;lt;code&amp;gt;RATIO&amp;lt;/code&amp;gt; must be positive, not equal to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, and must move from the lower bound toward the upper bound.&lt;br /&gt;
* Logarithmic studies require both bounds to be positive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;a4-run&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== &amp;lt;code&amp;gt;./a4 run&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;ascxx&amp;lt;/code&amp;gt; / CLI path, &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; is interpreted in two different ways depending on whether &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present.&lt;br /&gt;
&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present, the requested cases are solved in sequence.&lt;br /&gt;
* If &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; is present, the named method is run before each study point.&lt;br /&gt;
* &amp;lt;code&amp;gt;NOW&amp;lt;/code&amp;gt; is accepted but has no additional effect in the CLI path; varying studies already execute immediately.&lt;br /&gt;
* Output is tabular.&lt;br /&gt;
* The first column is always the varied variable.&lt;br /&gt;
* Column headers include units of measurement.&lt;br /&gt;
* If &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is present, the table is written there and a note is emitted telling the user where it went.&lt;br /&gt;
* If &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is omitted, the table is written to standard output.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is omitted, the observed variables are stored as the model’s default post-solve print list. &amp;lt;code&amp;gt;a4 run&amp;lt;/code&amp;gt; then prints them after the main solve using &amp;lt;code&amp;gt;name = value&amp;lt;/code&amp;gt; formatting, but only when no explicit &amp;lt;code&amp;gt;-p/--print&amp;lt;/code&amp;gt; arguments were supplied. Explicit &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt; arguments take precedence over this model-defined list.&lt;br /&gt;
* If any &amp;lt;code&amp;gt;STUDY ... VARY ...&amp;lt;/code&amp;gt; request is encountered during the run, the deferred no-&amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; print action is suppressed for that run.&lt;br /&gt;
&lt;br /&gt;
Current output format is TSV.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gtk-browser&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== GTK Browser ==&lt;br /&gt;
&lt;br /&gt;
In the GTK browser, &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; uses the existing Observer and Study dialog workflow.&lt;br /&gt;
&lt;br /&gt;
* If no Observer exists yet, one is created.&lt;br /&gt;
* The observed variables are added to the active Observer.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present, the varied variable is added first if it is not already present.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is omitted, the Observer is populated and no Study dialog is opened.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present, the Study dialog is opened with the variable, bounds, stepping mode, distribution, and optional &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; method pre-populated.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present and &amp;lt;code&amp;gt;NOW&amp;lt;/code&amp;gt; is supplied, the pre-populated study is executed immediately without waiting for the user to press &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Solving then proceeds through the existing interactive Study dialog behavior.&lt;br /&gt;
&lt;br /&gt;
Current GTK limitation:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is not yet implemented as an export path in the GTK browser. The GUI currently reports this and keeps the results in the Observer.&lt;br /&gt;
&lt;br /&gt;
Not yet implemented:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;ON_ERROR STOP | SKIP | CONTINUE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;tcltk&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Tcl/Tk ==&lt;br /&gt;
&lt;br /&gt;
The METHOD &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; statement is currently not implemented in the Tcl/Tk GUI.&lt;br /&gt;
&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=STUDY&amp;diff=6390</id>
		<title>STUDY</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=STUDY&amp;diff=6390"/>
		<updated>2026-03-09T13:11:44Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; is a METHOD-language statement for preparing or executing a parametric study from inside a model method such as &amp;lt;code&amp;gt;on_load&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;syntax&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;ascend&amp;quot;&amp;gt;STUDY observed_var_list&lt;br /&gt;
    [VARY var FROM lower TO upper (STEPS n [LINEAR|LOG] | STEP delta | RATIO r)]&lt;br /&gt;
    [RUN method_name]&lt;br /&gt;
    [NOW]&lt;br /&gt;
    [FILE &amp;amp;quot;path&amp;amp;quot;];&amp;lt;/pre&amp;gt;&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;ascend&amp;quot;&amp;gt;STUDY accel_required, time_run;&lt;br /&gt;
&lt;br /&gt;
STUDY accel_required, time_run&lt;br /&gt;
    VARY time_run FROM 2 {s} TO 6 {s} STEPS 4&lt;br /&gt;
    NOW&lt;br /&gt;
    FILE &amp;amp;quot;study.tsv&amp;amp;quot;;&lt;br /&gt;
&lt;br /&gt;
STUDY y, x VARY x FROM 1 TO 10 STEP 0.1;&lt;br /&gt;
STUDY y, x VARY x FROM 1 TO 10 RATIO 1.1;&lt;br /&gt;
STUDY y, x VARY x FROM 1 TO 10 STEPS 8 LOG RUN reset;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more examples in {{srcdir|models/test/slvreq}}.&lt;br /&gt;
&lt;br /&gt;
== Semantics ==&lt;br /&gt;
&lt;br /&gt;
* The observed variable list is required.&lt;br /&gt;
* &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
* &amp;lt;code&amp;gt;RUN method_name&amp;lt;/code&amp;gt; is optional and is executed before each study point.&lt;br /&gt;
* &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
* &amp;lt;code&amp;gt;NOW&amp;lt;/code&amp;gt; is optional.&lt;br /&gt;
* The varied variable may also appear in the observed variable list.&lt;br /&gt;
* The current solver and options are taken from the existing GUI state and/or earlier METHOD &amp;lt;code&amp;gt;SOLVER&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;OPTION&amp;lt;/code&amp;gt; statements. They are not restated inside &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Stepping modes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;STEPS n&amp;lt;/code&amp;gt; means &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; intervals with both endpoints included.&lt;br /&gt;
* &amp;lt;code&amp;gt;STEP delta&amp;lt;/code&amp;gt; uses a linear increment.&lt;br /&gt;
* &amp;lt;code&amp;gt;RATIO r&amp;lt;/code&amp;gt; uses a logarithmic/geometric progression.&lt;br /&gt;
* &amp;lt;code&amp;gt;STEPS n LOG&amp;lt;/code&amp;gt; requests logarithmic spacing.&lt;br /&gt;
* &amp;lt;code&amp;gt;STEPS n&amp;lt;/code&amp;gt; without &amp;lt;code&amp;gt;LOG&amp;lt;/code&amp;gt; uses linear spacing.&lt;br /&gt;
&lt;br /&gt;
Validation rules:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;STEP&amp;lt;/code&amp;gt; must be non-zero and must move from the lower bound toward the upper bound.&lt;br /&gt;
* &amp;lt;code&amp;gt;RATIO&amp;lt;/code&amp;gt; must be positive, not equal to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, and must move from the lower bound toward the upper bound.&lt;br /&gt;
* Logarithmic studies require both bounds to be positive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;a4-run&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== &amp;lt;code&amp;gt;./a4 run&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
In the &amp;lt;code&amp;gt;ascxx&amp;lt;/code&amp;gt; / CLI path, &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; is interpreted in two different ways depending on whether &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present.&lt;br /&gt;
&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present, the requested cases are solved in sequence.&lt;br /&gt;
* If &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; is present, the named method is run before each study point.&lt;br /&gt;
* &amp;lt;code&amp;gt;NOW&amp;lt;/code&amp;gt; is accepted but has no additional effect in the CLI path; varying studies already execute immediately.&lt;br /&gt;
* Output is tabular.&lt;br /&gt;
* Column headers include units of measurement.&lt;br /&gt;
* If &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is present, the table is written there and a note is emitted telling the user where it went.&lt;br /&gt;
* If &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is omitted, the table is written to standard output.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is omitted, the observed variables are stored as the model’s default post-solve print list. &amp;lt;code&amp;gt;a4 run&amp;lt;/code&amp;gt; then prints them after the main solve using &amp;lt;code&amp;gt;name = value&amp;lt;/code&amp;gt; formatting, but only when no explicit &amp;lt;code&amp;gt;-p/--print&amp;lt;/code&amp;gt; arguments were supplied. Explicit &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt; arguments take precedence over this model-defined list.&lt;br /&gt;
* If any &amp;lt;code&amp;gt;STUDY ... VARY ...&amp;lt;/code&amp;gt; request is encountered during the run, the deferred no-&amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; print action is suppressed for that run.&lt;br /&gt;
&lt;br /&gt;
Current output format is TSV.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;gtk-browser&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== GTK Browser ==&lt;br /&gt;
&lt;br /&gt;
In the GTK browser, &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; uses the existing Observer and Study dialog workflow.&lt;br /&gt;
&lt;br /&gt;
* If no Observer exists yet, one is created.&lt;br /&gt;
* The observed variables are added to the active Observer.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is omitted, the Observer is populated and no Study dialog is opened.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present, the Study dialog is opened with the variable, bounds, stepping mode, distribution, and optional &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; method pre-populated.&lt;br /&gt;
* If &amp;lt;code&amp;gt;VARY&amp;lt;/code&amp;gt; is present and &amp;lt;code&amp;gt;NOW&amp;lt;/code&amp;gt; is supplied, the pre-populated study is executed immediately without waiting for the user to press &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Solving then proceeds through the existing interactive Study dialog behavior.&lt;br /&gt;
&lt;br /&gt;
Current GTK limitation:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;FILE&amp;lt;/code&amp;gt; is not yet implemented as an export path in the GTK browser. The GUI currently reports this and keeps the results in the Observer.&lt;br /&gt;
&lt;br /&gt;
Not yet implemented:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;ON_ERROR STOP | SKIP | CONTINUE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;tcltk&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Tcl/Tk ==&lt;br /&gt;
&lt;br /&gt;
The METHOD &amp;lt;code&amp;gt;STUDY&amp;lt;/code&amp;gt; statement is currently not implemented in the Tcl/Tk GUI.&lt;br /&gt;
&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=IPOPT&amp;diff=6389</id>
		<title>IPOPT</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=IPOPT&amp;diff=6389"/>
		<updated>2026-03-09T09:04:34Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Ubuntu 10.04 LTS Lucid */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{solvers}}{{experimental}}&lt;br /&gt;
[https://projects.coin-or.org/Ipopt IPOPT] (also, [http://www.coin-or.org/Ipopt/documentation/ documentation]) is the &#039;Interior Point Optimizer&#039;, part of the the [http://www.coin-or.org/ COIN-OR] open-source effort for the development of solvers for problems in the field of operations research.&lt;br /&gt;
&lt;br /&gt;
We have almost completed integration of the IPOPT solver into ASCEND, as part of a GSOC 2009 project by [[User:Mnm87|Mahesh Narayanamurthi]]. This implementation includes efficient methods for calculating hessian matrices directly using automatic differentiation code developed specifically for our core engine. We&#039;re looking for people to try it out and [[Support|report any problems]].&lt;br /&gt;
&lt;br /&gt;
The remaining feature requiring implemention is to connect support for [[external relations]] to the IPOPT solver. Currently this kind of function is not supported in the reverse-AD code, and so models with external relations can not be solved with IPOPT (unless possibly using estimated second derivatives... need to check).&lt;br /&gt;
&lt;br /&gt;
ASCEND links to IPOPT via its plain C API, [http://www.coin-or.org/Doxygen/Ipopt/_ip_std_c_interface_8h.html IpStdCInterface.h].&lt;br /&gt;
== Sample problems ==&lt;br /&gt;
&lt;br /&gt;
A selection of sample problems that solve using IPOPT can be viewed at {{srcdir|models/test/ipopt}}. Mostly the samples are problems taken from the Hock-Schittkowsky [http://www.math.uni-bayreuth.de/~kschittkowski/tp_coll1.htm Test Examples for Nonlinear Programming Codes] test suite and were compuiled by [[User:Mnm87|Mahesh]].&lt;br /&gt;
&lt;br /&gt;
== Installing IPOPT ==&lt;br /&gt;
&lt;br /&gt;
To test the state of the IPOPT solver, you must first install the base IPOPT software on your machine. The following instructions complement the [http://www.coin-or.org/Ipopt/documentation/ IPOPT installation guide].&lt;br /&gt;
&lt;br /&gt;
=== Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
Use the RPM spec file {{src|tools/ipopt/ipopt.spec}} to guide the build process for IPOPT. See [[Building ASCEND]] for related instructions on building a SUNDIALS RPM, and once that is completed, install the ipopt.spec file in ~/rpmbuild/SPECS and download the files listed in that spec file, saving them in ~/rpmbuild/SOURCES. Also download {{src|tools/ipopt/ipopt-addlibs.patch}} to ~/rpmbuild/SOURCES. Then:&lt;br /&gt;
&lt;br /&gt;
 sudo yum install lapack-devel blas-devel&lt;br /&gt;
 rpmbuild -ba ipopt.spec&lt;br /&gt;
&lt;br /&gt;
Hopefully the resulting RPMs will appear in ~/rpmbuilds/RPMS/arch.&lt;br /&gt;
 &lt;br /&gt;
=== Ubuntu 11.04 Natty ===&lt;br /&gt;
&lt;br /&gt;
Using [[dtar]] you can build your own IPOPT deb packages for Ipopt 3.10.0 and [[File:Ipopt-debian-3.10.0-natty.tar.gz]] (some details at {{srcdir|tools/ipopt}}). You need an internet connection while building this, as the build script goes and downloads MUMPS during the process. Alternatively, you can go ahead and use the following that we built already. These are 32-bit packages; we&#039;d be interested to know if the same process works OK for 64-bit.&lt;br /&gt;
&lt;br /&gt;
* [[Media:libipopt0_3.10.0_i386.deb|libipopt0_3.10.0_i386.deb]] (1.5M Ubuntu 11.04 package - runtime use)&lt;br /&gt;
* [[Media:libipopt-dev_3.10.0_i386.deb|libipopt-dev_3.10.0_i386.deb]] (2.5M Ubuntu 11.04 package - compiletime use)&lt;br /&gt;
* [[Media:libipopt-dbg_3.10.0_i386.deb|libipopt-dbg_3.10.0_i386.deb]] (7.3M Ubuntu 11.04 package - debugger symbols)&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu 10.04 LTS Lucid ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Problems with the standard Ubuntu-repository IPOPT 3.8.1 and MUMPS packages seem to persist in 10.04.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following packages will work successfully with ASCEND on Ubuntu 10.04 LTS Lucid (intel 32 bit). You&#039;ll need to install them both.&lt;br /&gt;
&lt;br /&gt;
* [[Media:libipopt0_3.9.1_i386.deb|libipopt0_3.9.1_i386.deb]] (1.5 MB Ubuntu 10.04 package)&lt;br /&gt;
* [[Media:libipopt-dev_3.9.1_i386.deb|libipopt-dev_3.9.1_i386.deb]] (2.4 MB Ubuntu 10.04 developer package)&lt;br /&gt;
&lt;br /&gt;
On this platform, we have successfully built IPOPT 3.9.1, so you can again build your own package. For Lucid, you need to download [http://www.coin-or.org/download/source/Ipopt/Ipopt-3.9.1.tgz Ipopt-3.9.1.tgz] and [[Media:Ipopt-debian-3.9.1-lucid.tar.bz2|Ipopt-debian-3.9.1-lucid.tar.bz2]] then use [[dtar]] to run &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
dtar Ipopt-3.9.1.tgz Ipopt-debian-3.9.1-lucid.tar.gz&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update: the above method now also produces debug packages, to allow debugging of issues arising in the use of IPOPT.&lt;br /&gt;
&lt;br /&gt;
Note that as of 3.9.0, IPOPT makes use of the COIN &#039;BuildTools&#039; system, and many things have changed. The above package installs shared libraries in the rather annoying location /usr/lib/coin and /usr/lib/coin/ThirdParty, which makes dlopening libraries that reference IPOPT rather annoying, because these locations must now be added to LD_LIBRARY_PATH. Bah! We will try to work out a way to create an IPOPT package that installs to /usr/lib.&lt;br /&gt;
&lt;br /&gt;
If you happen to be repeated attempting to build the IPOPT package, the build process will attempt to download MUMPS every time you run [[dtar]]. To avoid downloading a new copy everytime, download a copy of the file, then in the same directory as the file, run &amp;lt;tt&amp;gt;sudo twistd -n web --path . -p 80&amp;lt;/tt&amp;gt;. Edit your &amp;lt;tt&amp;gt;/etc/hosts&amp;lt;/tt&amp;gt; to contain the following on a line of its own: &amp;lt;tt&amp;gt;127.0.0.1	mumps.enseeiht.fr&amp;lt;/tt&amp;gt;. This will allow you to &#039;fool&#039; your computer into fetching the file locally instead of over the network.&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu 9.10 Karmic ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;As of Ubuntu 9.10, MUMPS is now available in the standard package repositories. However the Ubuntu version of IPOPT doesn&#039;t seem to be correctly linked with the Ubuntu version of MUMPS, so the we propose that you make use of the following packages instead, which download their own copy of MUMPS source code during the build process.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is recommended that you follow the same process as for Ubuntu 10.04 to build your own IPOPT 3.9.1 packages for this platform.&lt;br /&gt;
&lt;br /&gt;
Packages that we built for IPOPT 3.8.1 on Ubuntu 9.10 are available from [{{download-stem}}/0.9.7/ our download page on SourceForge]. You will need to install both of the libipopt*.deb packages. You can also build these 3.8.1 packages yourself using the file [[Media:Ipopt-debian.tar.bz2|Ipopt-debian.tar.bz2]] and [[dtar]] with the command &amp;lt;tt&amp;gt;dtar Ipopt-3.8.1.tgz Ipopt-debian.tar.bz2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
On Windows, because we only use the C interface for IPOPT, it should be possible to make use of the [http://www.coin-or.org/download/binary/Ipopt/ binary builds] of IPOPT. This has not recently been tested, however, so please let us know if you experience any problems.&lt;br /&gt;
&lt;br /&gt;
=== Other systems ===&lt;br /&gt;
&lt;br /&gt;
On other systems you will need to install your own copy of IPOPT from source. Instructions are at the IPOPT website and documented below for quick setup.&lt;br /&gt;
&lt;br /&gt;
Some outdated binaries for IPOPT (&amp;lt;tt&amp;gt;ipopt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ipopt-devel&amp;lt;/tt&amp;gt; RPMs) were available for Fedora and openSUSE via [http://download.opensuse.org/repositories/home:/jdpipe/ OpenSUSE build service repository].&lt;br /&gt;
&lt;br /&gt;
==Building IPOPT==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: changes in IPOPT as of version 3.9.0 will make the following guide outdated. Several new parameters on the ./configure command appear to now be required.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use IPOPT with ASCEND, a source tar-ball of IPOPT can be downloaded from [http://www.coin-or.org/download/source/Ipopt/ the IPOPT download page] (Version 3.6 is the latest stable distribution as on date of writing the following install guide). This tarball is a &#039;partial&#039; tarball, in that it expected certain extra third-party code to be downloaded before you start the process of building the code. For a minimal free open-source installation of IPOPT, you should first use your Linux package manage to install BLAS and LAPACK developer&#039;s packages (libblas-dev and liblapack-dev on Ubuntu).&lt;br /&gt;
&lt;br /&gt;
Unpack the source into a directory (we will refer to this directory as $IPOPTTOPDIR here on).&lt;br /&gt;
&lt;br /&gt;
Next, enter the corresponding ThirdParty subdirectories of $IPOPTTOPDIR and run the &amp;lt;tt&amp;gt;./get.PackageName&amp;lt;/tt&amp;gt; scripts for &lt;br /&gt;
&lt;br /&gt;
* MUMPS&lt;br /&gt;
* METIS&lt;br /&gt;
&lt;br /&gt;
Optionally, you can also follow the IPOPT instructions for downloading the code for&lt;br /&gt;
&lt;br /&gt;
* HSL (optionally, just MA27 and MC19. Note that this is not free-&#039;&#039;libre&#039;&#039; code though)&lt;br /&gt;
&lt;br /&gt;
Note that ASL is not required, because we are not building an AMPL interface for IPOPT here. BLAS can be installed on Linux from your package repositories (see Atlas, GSL C-BLAS, and others). HSL routines are also not essential, you will need to register on the corresponding websites and you would get an e-mail confirmation giving you instructions on how to obtain them and install them. So give sufficient time for this and plan your installation accordingly (we are interested in using open source code here). LAPACK can be installed on Linux from your package repositories (on Ubuntu, the package is liblapack-dev).&lt;br /&gt;
&lt;br /&gt;
If your wget is properly configured, you should be able to use these &amp;lt;tt&amp;gt;get.PackageName&amp;lt;/tt&amp;gt; shell scripts in each of the third-party folders under &#039;&#039;$IPOPTTOPDIR/ThirdParty&#039;&#039; to download and extract the corresponding package, without any problems.&lt;br /&gt;
&lt;br /&gt;
Note that the download scripts &#039;get.PackageName&#039; contain some hand-written version numbers, which you may wish to update if you want to use a newer third-party package versions.&lt;br /&gt;
&lt;br /&gt;
Once all the third-party packages have been obtained, you are ready to build and install IPOPT. It is recommended that you install IPOPT to /usr/local if possible.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;$IPOPTTOPDIR&#039;&#039;, note any [https://projects.coin-or.org/BuildTools/wiki/current-issues platform-specific issues], then enter &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;./configure --prefix=/usr/local&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If configuration is successful, a message&lt;br /&gt;
&lt;br /&gt;
 configure: Main configuration of Ipopt successful&lt;br /&gt;
&lt;br /&gt;
will be observed on the command line. You should also check the output during configuration of each package: if package configuration was successful, you should see a message, for each package, like: &lt;br /&gt;
&lt;br /&gt;
 configure: Configuration of ThirdPartyMumps successful&lt;br /&gt;
&lt;br /&gt;
Now, proceed by issuing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;make&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
followed by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;sudo make install&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that IPOPT is still experimental and development is ongoing. Implementation of support for this solver is not yet completed (see [[Development activities]]).&lt;br /&gt;
&lt;br /&gt;
== Building ASCEND with support for IPOPT ==&lt;br /&gt;
&lt;br /&gt;
On Windows, you will need to provide configuration options via scons, eg IPOPT_PREFX, IPOPT_LIBS, etc, in order to compile against IPOPT. If you have compiled your own copy of IPOPT using MinGW (&amp;quot;&amp;lt;tt&amp;gt;./configure --prefix=/mingw &amp;amp;&amp;amp; make -j4 install&amp;lt;/tt&amp;gt;&amp;quot;, for example), then you may have success with something like: &lt;br /&gt;
 scons IPOPT_PREFIX=/mingw IPOPT_LIBS=ipopt,stdc++,coinmumps,coinlapack,coinblas,gfortran,pthread IPOPT_LIBPATH=/mingw/lib&lt;br /&gt;
&lt;br /&gt;
On Linux, providing that &amp;lt;tt&amp;gt;pkgconfig ipopt --libs&amp;lt;/tt&amp;gt; gives you some output, everything should just work. ASCEND should detect IPOPT successfully and build your IPOPT solver (check your WITH_SOLVERS option for scons too, to make sure).&lt;br /&gt;
&lt;br /&gt;
Either way, you should end up with a DLL or SO file in the subdirectory &amp;lt;tt&amp;gt;solvers/ipopt&amp;lt;/tt&amp;gt; at the end of the ASCEND build process.&lt;br /&gt;
&lt;br /&gt;
There is a little test program &amp;lt;tt&amp;gt;testipopt&amp;lt;/tt&amp;gt; in the &amp;lt;tt&amp;gt;ascxx&amp;lt;/tt&amp;gt; directory that you may be able to use to test your wrapped IPOPT solver is working correctly.&lt;br /&gt;
&lt;br /&gt;
== HSL ==&lt;br /&gt;
&lt;br /&gt;
To use IPOPT with the HSL linear solver routines (MA27, MA57, MC19), you can compile a shared library libhsl.so using the IPOPT ThirdParty/HSL/configure script. In that case, use the LD_LIBRARY_PATH environment variable if necessary to tell IPOPT where that shared library will be found.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Non-proprietary Optimization]]&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
[[Category:Experimental]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:NLP Solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6388</id>
		<title>Writing ASCEND external relations in C</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6388"/>
		<updated>2026-03-06T11:15:02Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Create an ASCEND wrapper library */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will guide you through the steps required to access [[External_relations|external relation]] code for ASCEND from the [http://en.wikipedia.org/wiki/C_(programming_language) C language]. As an example, we will walk through the implementation of an external thermodynamic properties correlation using the modified Benedict-Webb-Rubin correlation, with the added benefit of a useful and reasonably well-documented piece of code. For a little more background on these so-called &#039;black box&#039; external relations, see the PhD thesis of Kirk Abbott (in [[Publications]]).&lt;br /&gt;
&lt;br /&gt;
All the code associated with this HOWTO (and possibly a bit more, over time) is available from {{srcdir|models/johnpye/fprops/}} in the [[ModelLibrary]],&lt;br /&gt;
&lt;br /&gt;
== Decide on the C functions that you want to access ==&lt;br /&gt;
Firstly, you need to provide the C code for the functions that you want to be able to access from ASCEND. In this HOWTO, we&#039;re interested in &#039;&#039;&#039;external relations&#039;&#039;&#039;, which means equations or functions that we want to be able to use from within an ASCEND model. The most typical application of external relations is probably thermodynamic property correlations, but other examples include pressure-drop correlations (e.g. pipe friction), and perhaps getting data from lookup tables, etc.&lt;br /&gt;
&lt;br /&gt;
In this case, we want to access the Modified Benedict-Webb-Rubin (MBWR) thermodynamic property correlation for the refrigerant &#039;&#039;&#039;R123&#039;&#039;&#039;. The MBWR correlation data for this refrigerant was published in 1994 by Younglove, and McLinden&amp;lt;ref&amp;gt;B A Younglove and M O McLinden, 1994, An International Standard Equation of State for the Thermodynamic Properties of Refrigerant 123 (2,2‐Dichloro‐1,1,1‐Trifluoroethane), J. Phys. Chem. Ref. Data &#039;&#039;&#039;23&#039;&#039;&#039; p.731, {{doi|10.1063/1.555950}}&amp;lt;/ref&amp;gt;. We have implemented a function which provides the general form of an MBWR correlation as follows, with the intention that our fluid-specific correlation data would also be passed in to the function as a pointer to a &amp;lt;tt&amp;gt;MbwrData&amp;lt;/tt&amp;gt; struct:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* from mbwr.h: */&lt;br /&gt;
typedef struct MbwrData_struct{&lt;br /&gt;
&lt;br /&gt;
	double rhob_c; /**&amp;lt; critical molar density in mol/L */&lt;br /&gt;
	double beta[32]; /**&amp;lt; constants in MBWR for the fluid in question */&lt;br /&gt;
&lt;br /&gt;
} MbwrData;&lt;br /&gt;
&lt;br /&gt;
/* from mbwr.c: */&lt;br /&gt;
double mbwr_p(double T, double rhob, MbwrData *data){&lt;br /&gt;
&lt;br /&gt;
    double p;&lt;br /&gt;
    /* lots of code here... */&lt;br /&gt;
    return p;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
We can use this code to calculate pressure &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; as an output, with temperature &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; and molar density &amp;lt;math&amp;gt;\bar \rho&amp;lt;/math&amp;gt; (&amp;lt;tt&amp;gt;rhob&amp;lt;/tt&amp;gt;) as inputs.&lt;br /&gt;
&lt;br /&gt;
The full code for this function is available in {{src|models/johnpye/fprops/mbwr.c}}.&lt;br /&gt;
&lt;br /&gt;
This code can be compiled to a &#039;shared object file&#039; using a C compiler, or you can write a little [http://en.wikipedia.org/wiki/Main_function_(programming) &#039;main&#039; function] to drive this function and make some output, just for testing. The following test program includes the data for R123, because we haven&#039;t yet implemented a tidy general-purpose system for loading these data from a file or a database etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;#include &amp;quot;mbwr.h&amp;quot;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(int argc, char **argv){&lt;br /&gt;
&lt;br /&gt;
    if(argc&amp;lt;3)return 1;&lt;br /&gt;
    double T = atof(argv[1]); /* K */&lt;br /&gt;
&lt;br /&gt;
    double rhog = atof(argv[2]); /* mol/L? */&lt;br /&gt;
    double p;&lt;br /&gt;
&lt;br /&gt;
    /* property data for R123, from J. Phys. Chem. Ref. Data, 23:731-779, 1994. */&lt;br /&gt;
    const MbwrData propdata = {&lt;br /&gt;
        13.2117771543124 /* rho_c */&lt;br /&gt;
        ,{ /* beta[32] */&lt;br /&gt;
&lt;br /&gt;
            -0.657453133659E-02,     0.293479845842E+01,   -0.989140469845E+02&lt;br /&gt;
            , 0.201029776013E+05,   -0.383566527886E+07,    0.227587641969E-02&lt;br /&gt;
&lt;br /&gt;
            ,-0.908726819450E+01,    0.434181417995E+04,    0.354116464954E+07&lt;br /&gt;
            ,-0.635394849670E-03,    0.320786715274E+01,   -0.131276484299E+04&lt;br /&gt;
&lt;br /&gt;
            ,-0.116360713718E+00,   -0.113354409016E+02,   -0.537543457327E+04&lt;br /&gt;
            , 0.258112416120E+01,   -0.106148632128E+00,    0.500026133667E+02&lt;br /&gt;
&lt;br /&gt;
            ,-0.204326706346E+01,   -0.249438345685E+07,   -0.463962781113E+09&lt;br /&gt;
            ,-0.284903429588E+06,    0.974392239902E+10,   -0.637314379308E+04&lt;br /&gt;
&lt;br /&gt;
            , 0.314121189813E+06,   -0.145747968225E+03,   -0.843830261449E+07&lt;br /&gt;
            ,-0.241138441593E+01,    0.108508031257E+04,   -0.106653193965E-01&lt;br /&gt;
&lt;br /&gt;
            ,-0.121343571084E+02,   -0.257510383240E+03&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    p = mbwr_p(T,rhog, propdata);&lt;br /&gt;
&lt;br /&gt;
    fprintf(stderr,&amp;quot;T = %f, rhob = %f --&amp;gt; p = %f&amp;quot;, T, rhob, p);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
Once you&#039;re happy that your function is working as expected (and be sure you know what&#039;s happening with the units of measurement) then you can get on with the job of wrapping it from ASCEND.&lt;br /&gt;
&lt;br /&gt;
== Create an ASCEND wrapper library ==&lt;br /&gt;
&lt;br /&gt;
To create a wrapper for your function, you will essentially need to create a [http://en.wikipedia.org/wiki/Library_(computing) shared library] (.DLL on Windows, or .SO file on Linux) of a specific kind that can be [http://en.wikipedia.org/wiki/Dynamic_loading &#039;dynamically loaded&#039;] at runtime by ASCEND, when ASCEND sees an [[IMPORT]] statement in your model code. Using tools like [http://www.scons.org SCons] isn&#039;t too hard, and if you do it carefully, you will be able to use the same technique to build your shared library on Windows, Linux and Mac.&lt;br /&gt;
&lt;br /&gt;
The first important feature of the shared library that you will be creating is that it will have a &#039;registration function&#039;. This function is the entry point for the shared library you are creating, and this function will do the job of telling ASCEND what external relations you are going to be providing to it. Note that it is possible to embed external methods, external relations, and external anything else you fancy in a &#039;&#039;single&#039;&#039; shared library in ASCEND; there is no requirement that you have a single shared library for each single external relation you are creating.&lt;br /&gt;
&lt;br /&gt;
The registration function will look something like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&lt;br /&gt;
&lt;br /&gt;
/* registration function for the MBWR shared library */&lt;br /&gt;
extern&lt;br /&gt;
ASC_EXPORT int mbwr_register(){&lt;br /&gt;
	const char *mbwr_help = &amp;quot;Modified Benedict-Webb-Rubin correlation for thermodynamic properties&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	int result = 0;&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;Initialising MBWR...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	result += CreateUserFunctionBlackBox(&amp;quot;mbwr_p&amp;quot;&lt;br /&gt;
		, mbwr_p_prepare&lt;br /&gt;
		, mbwr_p_calc /* value */&lt;br /&gt;
&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* derivatives not provided yet*/&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* hessian not provided yet */&lt;br /&gt;
		, (ExtBBoxFinalFunc*)NULL /* finalisation not implemented */&lt;br /&gt;
&lt;br /&gt;
		, 2,1 /* inputs, outputs */&lt;br /&gt;
		, mbwr_help&lt;br /&gt;
		, 0.0&lt;br /&gt;
&lt;br /&gt;
	); /* returns 0 on success */&lt;br /&gt;
&lt;br /&gt;
	if(result){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_PROG_ERR,&amp;quot;CreateUserFunction result = %d\n&amp;quot;,result);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	return result;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
The key part of that function is that it contains a call to the function &#039;&#039;&#039;CreateUserFunctionBlackBox&#039;&#039;&#039;, and this function tells ASCEND about two functions, &#039;&#039;&#039;mbwr_p_prepare&#039;&#039;&#039; and &#039;&#039;&#039;mbwr_p_calc&#039;&#039;&#039; that we are yet to write. It tells ASCEND that we are providing a &#039;black box&#039; user function, which is another way of saying &#039;external relation&#039;. It says that this external relation will have 2 inputs and 1 output. It gives some &#039;help text&#039; to ASCEND to allow the user to identify what it is that they have loaded. It also gives the name of the provided external relation as &#039;mbwr_p&#039;; this is the name that you will be able to use to access this function when writing an ASCEND model from within the ASCEND modelling language.&lt;br /&gt;
&lt;br /&gt;
You note that we add the output of CreateUserFunctionBlackBox to the variable &#039;result&#039;. This is done because typically we would have multiple functions being registered in a single external library, and each registration could potentially return a non-zero error code. So we add all the result codes together and if we get a non-zero total, then we output a message.&lt;br /&gt;
&lt;br /&gt;
Note also that we are using the ERROR_REPORTER_HERE function (from compiler/error.h in libascend) to convey output back to ASCEND. This is much better than outputting to the console, as output via this function will be visible in the GUI, and it has &#039;status&#039; associated with it too (e.g. ASC_PROG_NOTE is a &#039;note&#039; for the user, and ASC_PROG_ERR is an error being reported, which would normally be shown in red).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;solid 1pt blue&amp;quot;&amp;gt;&lt;br /&gt;
=== Note on “inputs” and “outputs” in CreateUserFunctionBlackBox ===&lt;br /&gt;
&lt;br /&gt;
The n_inputs and n_outputs values passed to CreateUserFunctionBlackBox(...) are the number of formal argument groups in the ASCEND statement, not necessarily the number of scalar&lt;br /&gt;
real values that will be presented to the C evaluator.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
myrel: somefunc(&lt;br /&gt;
    T, P, n[1..10] : INPUT;&lt;br /&gt;
    H : OUTPUT;&lt;br /&gt;
    cfg : DATA&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
has 3 formal inputs (T, P, n[1..10]) and 1 formal output (H), so the function should be registered with 3,1.&lt;br /&gt;
&lt;br /&gt;
During instantiation, ASCEND expands any array arguments into their scalar members and computes the actual flattened input/output vector lengths from that expanded argument list.&lt;br /&gt;
Your prepare function can inspect this using the arglist, and your calc function will then receive the flattened scalar vectors.&lt;br /&gt;
&lt;br /&gt;
This distinction is important when designing external relations that accept array inputs: registration fixes the number of top-level argument groups, while instantiation determines&lt;br /&gt;
the final scalar vector length actually passed to the blackbox.&lt;br /&gt;
&lt;br /&gt;
In practice, this means that array-valued inputs are already supported by the blackbox mechanism, provided ASCEND can expand them deterministically at instantiation time.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Preparation and Calculation wrapper functions ==&lt;br /&gt;
In the previous section, we had [http://en.wikipedia.org/wiki/Forward_declaration forward declarations] for two functions that we haven&#039;t written yet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These functions are where we really get into passing information to and from our external code.&lt;br /&gt;
&lt;br /&gt;
=== &#039;Prepare&#039; function ===&lt;br /&gt;
&lt;br /&gt;
This function is the first of the two that we&#039;ll implement. We should first highlight the difference between the &#039;registration&#039; and the &#039;preparation&#039; function. The registration function is called when ASCEND sees the [[IMPORT]] statement for our shared library, for example &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt;. We can, if we want, do some preparation of specific stuff at that time, but we don&#039;t yet know anything about which functions are going to be used, and how often, and with what values.&lt;br /&gt;
&lt;br /&gt;
On the other hand, the preparation function is called when the external relation is first seen in your code, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;myprops: mbwr_p(&lt;br /&gt;
    T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
    p : OUTPUT;&lt;br /&gt;
    mydata : DATA&lt;br /&gt;
);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, ASCEND will know that the &#039;mbwr_p&#039; function is going to be used in this model, so it&#039;s appropriate that if there is any data that needs to be preloaded or precalculated, that we should do it now, inside the &#039;prepare&#039; function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;prepare&#039; function has the following structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
   /* implementation here... */&lt;br /&gt;
   return statuscode;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, we are passed a pointer to a [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp] structure, as well as a &#039;data&#039; instance (more later), and an &#039;arglist&#039;. The arglist is a list with &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;inputs&amp;lt;/sub&amp;gt; + &#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;outputs&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; elements, each of which itself is a list of instances (allowing either single values or arrays to be passed to your external relation). You can use the arglist to check that your input arguments have the correct data type, units, etc, although in common practise we don&#039;t both to do that.&lt;br /&gt;
&lt;br /&gt;
The &#039;data&#039; instance is important, as it allows you to pass data to your external relation that specifies how the relation should work, but in the form of &#039;&#039;&#039;constants&#039;&#039;&#039; or &#039;&#039;&#039;parameters&#039;&#039;&#039;, as opposed to variables that will actually vary during the modelling calculations. This is typically used to pass a filename for a data file, or a name of a substance, so that the external relation will load that file or substance data before the calculation commences.&lt;br /&gt;
&lt;br /&gt;
In our particular example, we plan to implement a general-purpose property calculation system here based on the MBWR correlation, so we will make use of the data instance as a place where the name of the substance can be passed into ASCEND.&lt;br /&gt;
&lt;br /&gt;
Our &#039;mbwr_p_prepare&#039; function therefore contains the following code, which looks for a member called &#039;component&#039; inside the DATA instance, and asserts that its value be equal to &amp;quot;R123&amp;quot;, because we&#039;ve only implemented support for this one fluid so far.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
	struct Instance *compinst;&lt;br /&gt;
	const char *comp;&lt;br /&gt;
&lt;br /&gt;
	mbwr_symbols[0] = AddSymbol(&amp;quot;component&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	/* get the data file name (we will look for this file in the ASCENDLIBRARY path) */&lt;br /&gt;
	compinst = ChildByChar(data,COMPONENT_SYM);&lt;br /&gt;
&lt;br /&gt;
	if(!compinst){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR&lt;br /&gt;
			,&amp;quot;Couldn&#039;t locate &#039;component&#039; in DATA, please check usage of MBWR.&amp;quot;&lt;br /&gt;
		);&lt;br /&gt;
		return 1;&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	if(InstanceKind(compinst)!=SYMBOL_CONSTANT_INST){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;DATA member &#039;component&#039; must be a symbol_constant&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
	comp = SCP(SYMC_INST(compinst)-&amp;gt;value);&lt;br /&gt;
&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;COMPONENT: %s&amp;quot;,comp);&lt;br /&gt;
	if(comp==NULL || strlen(comp)==0){&lt;br /&gt;
&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;&#039;component&#039; is NULL or empty&amp;quot;);&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if(strcmp(comp,&amp;quot;R123&amp;quot;)!=0){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;Component must be &#039;R123&#039; at this stage (only one component supported)&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;PREPARING MBWR_P...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	bbox-&amp;gt;user_data = (void*)&amp;amp;mbwr_r123;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &#039;Calculate&#039; function ===&lt;br /&gt;
&lt;br /&gt;
The &#039;calculate&#039; function is where ASCEND instructs our external relation to actually be evaluated. This is the part that gets called over and over again during ASCEND&#039;s solver iterations, so it&#039;s written for efficient access to the values that need to be used. The structure of the &#039;calculate&#039; function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In actual fact, the external relation API in ASCEND has been designed in such a way that the same function can be used both for function evaluation as well as calculation of partial derivatives (Jacobian matrix). If you want to use the API in this way, they your &#039;calculate&#039; function needs to look in the &#039;bbox&#039; struct to see the value of &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt; as noted in the declaration of [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp]. In our case we&#039;re only suing our function for simple evaluation, so we don&#039;t need to check &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt;, and we will also ignore the &amp;lt;tt&amp;gt;jacobian&amp;lt;/tt&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Our resulting wrapper function contains a few simple checks then then makes the call to our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function (the one that we&#039;re wrapping) using the appropriate values from the &amp;lt;tt&amp;gt;inputs&amp;lt;/tt&amp;gt; array, and places the result in the correct position in the &amp;lt;tt&amp;gt;outputs&amp;lt;/tt&amp;gt; array. Note that this function doesn&#039;t include any arguments for the DATA parameter; it is assumed that you&#039;ve already dojne what you needed with the DATA parameters, and they won&#039;t have changed since then. Also note that we make use of the &amp;lt;tt&amp;gt;bbox-&amp;gt;user_data&amp;lt;/tt&amp;gt; general-purpose pointer to indicate where our fluid-specific property data is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&lt;br /&gt;
	/* a few checks about the input requirements */&lt;br /&gt;
	if(ninputs != 2)return -1;&lt;br /&gt;
&lt;br /&gt;
	if(noutputs != 1)return -2;&lt;br /&gt;
	if(inputs==NULL)return -3;&lt;br /&gt;
&lt;br /&gt;
	if(outputs==NULL)return -4;&lt;br /&gt;
	if(bbox==NULL)return -5;&lt;br /&gt;
&lt;br /&gt;
	/* the &#039;user_data&#039; in the black box object will contain the coefficients&lt;br /&gt;
	required for this fluid; cast it to the required form: */&lt;br /&gt;
	MbwrData *mbwr_data = (MbwrData *)bbox-&amp;gt;user_data;&lt;br /&gt;
&lt;br /&gt;
	/* first input is temperature, second is molar density */&lt;br /&gt;
	outputs[0] = mbwr_p(inputs[0], inputs[1], mbwr_data);&lt;br /&gt;
&lt;br /&gt;
	/* no need to worry about error states etc, so always return &#039;success&#039;: */&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in your &#039;calculate&#039; function you will typically need to convert from the units of measurement used in external code to the &#039;base units&#039; used by ASCEND. In most cases this means giving values in SI base units, such as kg, m, s, K or A, or combinations of those, such as m³/s.&lt;br /&gt;
&lt;br /&gt;
If it is possible that your external function may return error codes, you have the opportunity of passing those errors back to ASCEND, or alternatively you can choose to ignore the errors. In many cases Newton iteration will work best if you can evaluate smooth curves even outside their &#039;acceptable range&#039;, and not return errors when values are outside those ranges.&lt;br /&gt;
&lt;br /&gt;
== Building and linking the code ==&lt;br /&gt;
&lt;br /&gt;
At this point, we have all the main parts of the wrapper code for accessing our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function from ASCEND. You can see the resulting file {{src|models/johnpye/fprops/asc_mbwr.c}}. It now remains to get the code compiled and linked to ASCEND. Because we have been using some code from within libascend, we need to link our dynamically library back to libascend, so this is an opportunity to make use of a standardised approach that ASCEND provides for creating derivative software.&lt;br /&gt;
&lt;br /&gt;
At this point we have two files, &amp;lt;tt&amp;gt;mbwr.c&amp;lt;/tt&amp;gt; (containing the code-to-be-wrapped) and &amp;lt;tt&amp;gt;asc_mbwr.c&amp;lt;/tt&amp;gt; (the ASCEND wrapper code for our function). To build the shared library, we add the following &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; file that will make use of [http://www.scons.org SCons] to generate a shared library for ASCEND on our system. The only requirement is that the program &#039;ascend-config&#039; should already be on our PATH, which might require some tweaking in the case of Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;env = Environment()&lt;br /&gt;
&lt;br /&gt;
# get compiler and linker flags for libascend&lt;br /&gt;
env.ParseConfig([&#039;ascend-config&#039;,&#039;--libs&#039;,&#039;--cppflags&#039;])&lt;br /&gt;
&lt;br /&gt;
# our list of files&lt;br /&gt;
srcs = [&#039;mbwr.c&#039;,&#039;asc_mbwr.c&#039;]&lt;br /&gt;
&lt;br /&gt;
# note that we suffix the IMPORT name with &#039;_ascend&#039;:&lt;br /&gt;
env.SharedLibrary(&#039;mbwr_ascend&#039;,srcs)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Providing ASCEND has been installed on your system (Note: including &#039;devel&#039; files, if you&#039;re installing from an RPM package or Windows installer), you should now be able to just run SCons to build the shared library, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;john@thunder:~/ascend/models/johnpye/fprops$ scons&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
gcc -o asc_mbwr.os -c -fPIC -I/usr/local/include asc_mbwr.c&lt;br /&gt;
gcc -o mbwr.os -c -fPIC -I/usr/local/include mbwr.c&lt;br /&gt;
gcc -o libmbwr_ascend.so -shared mbwr.os asc_mbwr.os -L/usr/local/lib -lascend&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
john@thunder:~/ascend/models/johnpye/fprops$&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting file, &#039;libmbwr_ascend.so&#039; (on Linux) is the file that will be loaded when ASCEND sees an &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt; statement in your model file.&lt;br /&gt;
&lt;br /&gt;
Obviously if you want, you can just type these compiler and linker commands manually, without using a build script. Or you can use GNU Make or CMake as you wish.&lt;br /&gt;
&lt;br /&gt;
== Using it ==&lt;br /&gt;
&lt;br /&gt;
To make use of the external relation that we&#039;ve now created, we can create a simple model file that makes a single evaluation of the external relation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* test of the fluid properties routines currently implemented in asc_mbwr.c *)&lt;br /&gt;
REQUIRE &amp;quot;atoms.a4l&amp;quot;;&lt;br /&gt;
IMPORT &amp;quot;johnpye/fprops/mbwr&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL mbwrconf;&lt;br /&gt;
	component IS_A symbol_constant;&lt;br /&gt;
	component :== &#039;R123&#039;;&lt;br /&gt;
&lt;br /&gt;
END mbwrconf;&lt;br /&gt;
&lt;br /&gt;
MODEL fprops_test;&lt;br /&gt;
&lt;br /&gt;
	p IS_A pressure;&lt;br /&gt;
&lt;br /&gt;
	T IS_A temperature;&lt;br /&gt;
	rhob IS_A molar_density;&lt;br /&gt;
&lt;br /&gt;
	propsdata IS_A mbwrconf;&lt;br /&gt;
&lt;br /&gt;
	props: mbwr_p(&lt;br /&gt;
		T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
		p : OUTPUT;&lt;br /&gt;
		propsdata : DATA&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	FIX rhob, T;&lt;br /&gt;
	rhob := 1 {mol/m^3};&lt;br /&gt;
&lt;br /&gt;
	T := 400 {K};&lt;br /&gt;
END on_load;&lt;br /&gt;
END fprops_test;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in particular here the way in which we&#039;ve set up the &#039;mbwrconf&#039; model containing the details of the fluid that we&#039;re using, and way that the &#039;DATA&#039; parameter is set in the external relation call.&lt;br /&gt;
&lt;br /&gt;
Note that the syntax for external relations is somewhat limited; you can&#039;t include any other terms in these &#039;equations&#039;: the whole inputs-to-outputs relation is defined &#039;external&#039; to the ASCEND model.&lt;br /&gt;
&lt;br /&gt;
The other issue here is the [[IMPORT]] statement. This statement uses the ASCENDLIBRARY environment variable to hunt for your shared library before it attempts to import it. In this case, the &#039;mbwr&#039; model has been created inside the standard ASCEND [[ModelLibrary]], so I didn&#039;t need to change the value of ASCENDLIBRARY. But sometimes you will need to do that before running ASCEND, eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;export ASCENDLIBRARY=~/freesteam/ascend&lt;br /&gt;
ascend testfreesteam.a4c&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ASCEND window, you should see some debug output from the &#039;prepare&#039; function, so you will know that your library was successfully loaded. Then you can solve the model and check that your model is giving results that actually make sense.&lt;br /&gt;
&lt;br /&gt;
It is worth thinking about setting up [[Model Self-testing]] when you create new external libraries, so that you have a quick way of checking that subsequent changes to your code or other ASCEND code haven&#039;t broken your output or changed any values from what is expected.&lt;br /&gt;
&lt;br /&gt;
== Adding derivatives ==&lt;br /&gt;
&lt;br /&gt;
At this point it needs to be explained that the Newton-based solver algorithm that is being used here by ASCEND to solve more complex models will often fail with an implementation like this. This is a result of the Newton algorithm, which requires &#039;&#039;partial derivatives&#039;&#039; of the &#039;&#039;residual&#039;&#039; for each equation in the system of equations &#039;&#039;with respect to each variable&#039;&#039; in the system. When an external relation is provided, ASCEND&#039;s usual system of automatic symbolic differentiation of equations can&#039;t be used. Instead, ASCEND calculates a rather crude finite-difference derivative, and this derivative can often be sufficiently inaccurate that it affects ASCEND&#039;s ability to converge to a solution.&lt;br /&gt;
&lt;br /&gt;
For this reason, when you declare an external relation to ASCEND, you have the opportunity to provide a function which can calculate exact values of these partial derivatives (which end up as elements in the system&#039;s Jacobian matrix).&lt;br /&gt;
&lt;br /&gt;
To set an element within the jacobian (derivative) matrix, use the following &#039;row-major&#039; syntax (see {{src|ascend/compiler/extfunc.h}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;for(i = 0; i&amp;lt; noutputs; ++i){&lt;br /&gt;
&lt;br /&gt;
  for(j = 0; j&amp;lt; ninputs; ++j){&lt;br /&gt;
    jacobian[i*ninputs + j] = /* insert value of ∂F_i/∂x_j here */&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[FPROPS]] (documentation of the &#039;completed&#039; library)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Extending_ASCEND]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6387</id>
		<title>Writing ASCEND external relations in C</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6387"/>
		<updated>2026-03-06T11:11:27Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Using it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will guide you through the steps required to access [[External_relations|external relation]] code for ASCEND from the [http://en.wikipedia.org/wiki/C_(programming_language) C language]. As an example, we will walk through the implementation of an external thermodynamic properties correlation using the modified Benedict-Webb-Rubin correlation, with the added benefit of a useful and reasonably well-documented piece of code. For a little more background on these so-called &#039;black box&#039; external relations, see the PhD thesis of Kirk Abbott (in [[Publications]]).&lt;br /&gt;
&lt;br /&gt;
All the code associated with this HOWTO (and possibly a bit more, over time) is available from {{srcdir|models/johnpye/fprops/}} in the [[ModelLibrary]],&lt;br /&gt;
&lt;br /&gt;
== Decide on the C functions that you want to access ==&lt;br /&gt;
Firstly, you need to provide the C code for the functions that you want to be able to access from ASCEND. In this HOWTO, we&#039;re interested in &#039;&#039;&#039;external relations&#039;&#039;&#039;, which means equations or functions that we want to be able to use from within an ASCEND model. The most typical application of external relations is probably thermodynamic property correlations, but other examples include pressure-drop correlations (e.g. pipe friction), and perhaps getting data from lookup tables, etc.&lt;br /&gt;
&lt;br /&gt;
In this case, we want to access the Modified Benedict-Webb-Rubin (MBWR) thermodynamic property correlation for the refrigerant &#039;&#039;&#039;R123&#039;&#039;&#039;. The MBWR correlation data for this refrigerant was published in 1994 by Younglove, and McLinden&amp;lt;ref&amp;gt;B A Younglove and M O McLinden, 1994, An International Standard Equation of State for the Thermodynamic Properties of Refrigerant 123 (2,2‐Dichloro‐1,1,1‐Trifluoroethane), J. Phys. Chem. Ref. Data &#039;&#039;&#039;23&#039;&#039;&#039; p.731, {{doi|10.1063/1.555950}}&amp;lt;/ref&amp;gt;. We have implemented a function which provides the general form of an MBWR correlation as follows, with the intention that our fluid-specific correlation data would also be passed in to the function as a pointer to a &amp;lt;tt&amp;gt;MbwrData&amp;lt;/tt&amp;gt; struct:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* from mbwr.h: */&lt;br /&gt;
typedef struct MbwrData_struct{&lt;br /&gt;
&lt;br /&gt;
	double rhob_c; /**&amp;lt; critical molar density in mol/L */&lt;br /&gt;
	double beta[32]; /**&amp;lt; constants in MBWR for the fluid in question */&lt;br /&gt;
&lt;br /&gt;
} MbwrData;&lt;br /&gt;
&lt;br /&gt;
/* from mbwr.c: */&lt;br /&gt;
double mbwr_p(double T, double rhob, MbwrData *data){&lt;br /&gt;
&lt;br /&gt;
    double p;&lt;br /&gt;
    /* lots of code here... */&lt;br /&gt;
    return p;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
We can use this code to calculate pressure &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; as an output, with temperature &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; and molar density &amp;lt;math&amp;gt;\bar \rho&amp;lt;/math&amp;gt; (&amp;lt;tt&amp;gt;rhob&amp;lt;/tt&amp;gt;) as inputs.&lt;br /&gt;
&lt;br /&gt;
The full code for this function is available in {{src|models/johnpye/fprops/mbwr.c}}.&lt;br /&gt;
&lt;br /&gt;
This code can be compiled to a &#039;shared object file&#039; using a C compiler, or you can write a little [http://en.wikipedia.org/wiki/Main_function_(programming) &#039;main&#039; function] to drive this function and make some output, just for testing. The following test program includes the data for R123, because we haven&#039;t yet implemented a tidy general-purpose system for loading these data from a file or a database etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;#include &amp;quot;mbwr.h&amp;quot;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(int argc, char **argv){&lt;br /&gt;
&lt;br /&gt;
    if(argc&amp;lt;3)return 1;&lt;br /&gt;
    double T = atof(argv[1]); /* K */&lt;br /&gt;
&lt;br /&gt;
    double rhog = atof(argv[2]); /* mol/L? */&lt;br /&gt;
    double p;&lt;br /&gt;
&lt;br /&gt;
    /* property data for R123, from J. Phys. Chem. Ref. Data, 23:731-779, 1994. */&lt;br /&gt;
    const MbwrData propdata = {&lt;br /&gt;
        13.2117771543124 /* rho_c */&lt;br /&gt;
        ,{ /* beta[32] */&lt;br /&gt;
&lt;br /&gt;
            -0.657453133659E-02,     0.293479845842E+01,   -0.989140469845E+02&lt;br /&gt;
            , 0.201029776013E+05,   -0.383566527886E+07,    0.227587641969E-02&lt;br /&gt;
&lt;br /&gt;
            ,-0.908726819450E+01,    0.434181417995E+04,    0.354116464954E+07&lt;br /&gt;
            ,-0.635394849670E-03,    0.320786715274E+01,   -0.131276484299E+04&lt;br /&gt;
&lt;br /&gt;
            ,-0.116360713718E+00,   -0.113354409016E+02,   -0.537543457327E+04&lt;br /&gt;
            , 0.258112416120E+01,   -0.106148632128E+00,    0.500026133667E+02&lt;br /&gt;
&lt;br /&gt;
            ,-0.204326706346E+01,   -0.249438345685E+07,   -0.463962781113E+09&lt;br /&gt;
            ,-0.284903429588E+06,    0.974392239902E+10,   -0.637314379308E+04&lt;br /&gt;
&lt;br /&gt;
            , 0.314121189813E+06,   -0.145747968225E+03,   -0.843830261449E+07&lt;br /&gt;
            ,-0.241138441593E+01,    0.108508031257E+04,   -0.106653193965E-01&lt;br /&gt;
&lt;br /&gt;
            ,-0.121343571084E+02,   -0.257510383240E+03&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    p = mbwr_p(T,rhog, propdata);&lt;br /&gt;
&lt;br /&gt;
    fprintf(stderr,&amp;quot;T = %f, rhob = %f --&amp;gt; p = %f&amp;quot;, T, rhob, p);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
Once you&#039;re happy that your function is working as expected (and be sure you know what&#039;s happening with the units of measurement) then you can get on with the job of wrapping it from ASCEND.&lt;br /&gt;
&lt;br /&gt;
== Create an ASCEND wrapper library ==&lt;br /&gt;
&lt;br /&gt;
To create a wrapper for your function, you will essentially need to create a [http://en.wikipedia.org/wiki/Library_(computing) shared library] (.DLL on Windows, or .SO file on Linux) of a specific kind that can be [http://en.wikipedia.org/wiki/Dynamic_loading &#039;dynamically loaded&#039;] at runtime by ASCEND, when ASCEND sees an [[IMPORT]] statement in your model code. Using tools like [http://www.scons.org SCons] isn&#039;t too hard, and if you do it carefully, you will be able to use the same technique to build your shared library on Windows, Linux and Mac.&lt;br /&gt;
&lt;br /&gt;
The first important feature of the shared library that you will be creating is that it will have a &#039;registration function&#039;. This function is the entry point for the shared library you are creating, and this function will do the job of telling ASCEND what external relations you are going to be providing to it. Note that it is possible to embed external methods, external relations, and external anything else you fancy in a &#039;&#039;single&#039;&#039; shared library in ASCEND; there is no requirement that you have a single shared library for each single external relation you are creating.&lt;br /&gt;
&lt;br /&gt;
The registration function will look something like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&lt;br /&gt;
&lt;br /&gt;
/* registration function for the MBWR shared library */&lt;br /&gt;
extern&lt;br /&gt;
ASC_EXPORT int mbwr_register(){&lt;br /&gt;
	const char *mbwr_help = &amp;quot;Modified Benedict-Webb-Rubin correlation for thermodynamic properties&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	int result = 0;&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;Initialising MBWR...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	result += CreateUserFunctionBlackBox(&amp;quot;mbwr_p&amp;quot;&lt;br /&gt;
		, mbwr_p_prepare&lt;br /&gt;
		, mbwr_p_calc /* value */&lt;br /&gt;
&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* derivatives not provided yet*/&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* hessian not provided yet */&lt;br /&gt;
		, (ExtBBoxFinalFunc*)NULL /* finalisation not implemented */&lt;br /&gt;
&lt;br /&gt;
		, 2,1 /* inputs, outputs */&lt;br /&gt;
		, mbwr_help&lt;br /&gt;
		, 0.0&lt;br /&gt;
&lt;br /&gt;
	); /* returns 0 on success */&lt;br /&gt;
&lt;br /&gt;
	if(result){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_PROG_ERR,&amp;quot;CreateUserFunction result = %d\n&amp;quot;,result);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	return result;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
The key part of that function is that it contains a call to the function &#039;&#039;&#039;CreateUserFunctionBlackBox&#039;&#039;&#039;, and this function tells ASCEND about two functions, &#039;&#039;&#039;mbwr_p_prepare&#039;&#039;&#039; and &#039;&#039;&#039;mbwr_p_calc&#039;&#039;&#039; that we are yet to write. It tells ASCEND that we are providing a &#039;black box&#039; user function, which is another way of saying &#039;external relation&#039;. It says that this external relation will have 2 inputs and 1 output. It gives some &#039;help text&#039; to ASCEND to allow the user to identify what it is that they have loaded. It also gives the name of the provided external relation as &#039;mbwr_p&#039;; this is the name that you will be able to use to access this function when writing an ASCEND model from within the ASCEND modelling language.&lt;br /&gt;
&lt;br /&gt;
You note that we add the output of CreateUserFunctionBlackBox to the variable &#039;result&#039;. This is done because typically we would have multiple functions being registered in a single external library, and each registration could potentially return a non-zero error code. So we add all the result codes together and if we get a non-zero total, then we output a message.&lt;br /&gt;
&lt;br /&gt;
Note also that we are using the ERROR_REPORTER_HERE function (from compiler/error.h in libascend) to convey output back to ASCEND. This is much better than outputting to the console, as output via this function will be visible in the GUI, and it has &#039;status&#039; associated with it too (e.g. ASC_PROG_NOTE is a &#039;note&#039; for the user, and ASC_PROG_ERR is an error being reported, which would normally be shown in red).&lt;br /&gt;
&lt;br /&gt;
== Preparation and Calculation wrapper functions ==&lt;br /&gt;
In the previous section, we had [http://en.wikipedia.org/wiki/Forward_declaration forward declarations] for two functions that we haven&#039;t written yet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These functions are where we really get into passing information to and from our external code.&lt;br /&gt;
&lt;br /&gt;
=== &#039;Prepare&#039; function ===&lt;br /&gt;
&lt;br /&gt;
This function is the first of the two that we&#039;ll implement. We should first highlight the difference between the &#039;registration&#039; and the &#039;preparation&#039; function. The registration function is called when ASCEND sees the [[IMPORT]] statement for our shared library, for example &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt;. We can, if we want, do some preparation of specific stuff at that time, but we don&#039;t yet know anything about which functions are going to be used, and how often, and with what values.&lt;br /&gt;
&lt;br /&gt;
On the other hand, the preparation function is called when the external relation is first seen in your code, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;myprops: mbwr_p(&lt;br /&gt;
    T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
    p : OUTPUT;&lt;br /&gt;
    mydata : DATA&lt;br /&gt;
);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, ASCEND will know that the &#039;mbwr_p&#039; function is going to be used in this model, so it&#039;s appropriate that if there is any data that needs to be preloaded or precalculated, that we should do it now, inside the &#039;prepare&#039; function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;prepare&#039; function has the following structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
   /* implementation here... */&lt;br /&gt;
   return statuscode;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, we are passed a pointer to a [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp] structure, as well as a &#039;data&#039; instance (more later), and an &#039;arglist&#039;. The arglist is a list with &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;inputs&amp;lt;/sub&amp;gt; + &#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;outputs&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; elements, each of which itself is a list of instances (allowing either single values or arrays to be passed to your external relation). You can use the arglist to check that your input arguments have the correct data type, units, etc, although in common practise we don&#039;t both to do that.&lt;br /&gt;
&lt;br /&gt;
The &#039;data&#039; instance is important, as it allows you to pass data to your external relation that specifies how the relation should work, but in the form of &#039;&#039;&#039;constants&#039;&#039;&#039; or &#039;&#039;&#039;parameters&#039;&#039;&#039;, as opposed to variables that will actually vary during the modelling calculations. This is typically used to pass a filename for a data file, or a name of a substance, so that the external relation will load that file or substance data before the calculation commences.&lt;br /&gt;
&lt;br /&gt;
In our particular example, we plan to implement a general-purpose property calculation system here based on the MBWR correlation, so we will make use of the data instance as a place where the name of the substance can be passed into ASCEND.&lt;br /&gt;
&lt;br /&gt;
Our &#039;mbwr_p_prepare&#039; function therefore contains the following code, which looks for a member called &#039;component&#039; inside the DATA instance, and asserts that its value be equal to &amp;quot;R123&amp;quot;, because we&#039;ve only implemented support for this one fluid so far.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
	struct Instance *compinst;&lt;br /&gt;
	const char *comp;&lt;br /&gt;
&lt;br /&gt;
	mbwr_symbols[0] = AddSymbol(&amp;quot;component&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	/* get the data file name (we will look for this file in the ASCENDLIBRARY path) */&lt;br /&gt;
	compinst = ChildByChar(data,COMPONENT_SYM);&lt;br /&gt;
&lt;br /&gt;
	if(!compinst){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR&lt;br /&gt;
			,&amp;quot;Couldn&#039;t locate &#039;component&#039; in DATA, please check usage of MBWR.&amp;quot;&lt;br /&gt;
		);&lt;br /&gt;
		return 1;&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	if(InstanceKind(compinst)!=SYMBOL_CONSTANT_INST){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;DATA member &#039;component&#039; must be a symbol_constant&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
	comp = SCP(SYMC_INST(compinst)-&amp;gt;value);&lt;br /&gt;
&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;COMPONENT: %s&amp;quot;,comp);&lt;br /&gt;
	if(comp==NULL || strlen(comp)==0){&lt;br /&gt;
&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;&#039;component&#039; is NULL or empty&amp;quot;);&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if(strcmp(comp,&amp;quot;R123&amp;quot;)!=0){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;Component must be &#039;R123&#039; at this stage (only one component supported)&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;PREPARING MBWR_P...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	bbox-&amp;gt;user_data = (void*)&amp;amp;mbwr_r123;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &#039;Calculate&#039; function ===&lt;br /&gt;
&lt;br /&gt;
The &#039;calculate&#039; function is where ASCEND instructs our external relation to actually be evaluated. This is the part that gets called over and over again during ASCEND&#039;s solver iterations, so it&#039;s written for efficient access to the values that need to be used. The structure of the &#039;calculate&#039; function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In actual fact, the external relation API in ASCEND has been designed in such a way that the same function can be used both for function evaluation as well as calculation of partial derivatives (Jacobian matrix). If you want to use the API in this way, they your &#039;calculate&#039; function needs to look in the &#039;bbox&#039; struct to see the value of &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt; as noted in the declaration of [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp]. In our case we&#039;re only suing our function for simple evaluation, so we don&#039;t need to check &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt;, and we will also ignore the &amp;lt;tt&amp;gt;jacobian&amp;lt;/tt&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Our resulting wrapper function contains a few simple checks then then makes the call to our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function (the one that we&#039;re wrapping) using the appropriate values from the &amp;lt;tt&amp;gt;inputs&amp;lt;/tt&amp;gt; array, and places the result in the correct position in the &amp;lt;tt&amp;gt;outputs&amp;lt;/tt&amp;gt; array. Note that this function doesn&#039;t include any arguments for the DATA parameter; it is assumed that you&#039;ve already dojne what you needed with the DATA parameters, and they won&#039;t have changed since then. Also note that we make use of the &amp;lt;tt&amp;gt;bbox-&amp;gt;user_data&amp;lt;/tt&amp;gt; general-purpose pointer to indicate where our fluid-specific property data is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&lt;br /&gt;
	/* a few checks about the input requirements */&lt;br /&gt;
	if(ninputs != 2)return -1;&lt;br /&gt;
&lt;br /&gt;
	if(noutputs != 1)return -2;&lt;br /&gt;
	if(inputs==NULL)return -3;&lt;br /&gt;
&lt;br /&gt;
	if(outputs==NULL)return -4;&lt;br /&gt;
	if(bbox==NULL)return -5;&lt;br /&gt;
&lt;br /&gt;
	/* the &#039;user_data&#039; in the black box object will contain the coefficients&lt;br /&gt;
	required for this fluid; cast it to the required form: */&lt;br /&gt;
	MbwrData *mbwr_data = (MbwrData *)bbox-&amp;gt;user_data;&lt;br /&gt;
&lt;br /&gt;
	/* first input is temperature, second is molar density */&lt;br /&gt;
	outputs[0] = mbwr_p(inputs[0], inputs[1], mbwr_data);&lt;br /&gt;
&lt;br /&gt;
	/* no need to worry about error states etc, so always return &#039;success&#039;: */&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in your &#039;calculate&#039; function you will typically need to convert from the units of measurement used in external code to the &#039;base units&#039; used by ASCEND. In most cases this means giving values in SI base units, such as kg, m, s, K or A, or combinations of those, such as m³/s.&lt;br /&gt;
&lt;br /&gt;
If it is possible that your external function may return error codes, you have the opportunity of passing those errors back to ASCEND, or alternatively you can choose to ignore the errors. In many cases Newton iteration will work best if you can evaluate smooth curves even outside their &#039;acceptable range&#039;, and not return errors when values are outside those ranges.&lt;br /&gt;
&lt;br /&gt;
== Building and linking the code ==&lt;br /&gt;
&lt;br /&gt;
At this point, we have all the main parts of the wrapper code for accessing our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function from ASCEND. You can see the resulting file {{src|models/johnpye/fprops/asc_mbwr.c}}. It now remains to get the code compiled and linked to ASCEND. Because we have been using some code from within libascend, we need to link our dynamically library back to libascend, so this is an opportunity to make use of a standardised approach that ASCEND provides for creating derivative software.&lt;br /&gt;
&lt;br /&gt;
At this point we have two files, &amp;lt;tt&amp;gt;mbwr.c&amp;lt;/tt&amp;gt; (containing the code-to-be-wrapped) and &amp;lt;tt&amp;gt;asc_mbwr.c&amp;lt;/tt&amp;gt; (the ASCEND wrapper code for our function). To build the shared library, we add the following &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; file that will make use of [http://www.scons.org SCons] to generate a shared library for ASCEND on our system. The only requirement is that the program &#039;ascend-config&#039; should already be on our PATH, which might require some tweaking in the case of Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;env = Environment()&lt;br /&gt;
&lt;br /&gt;
# get compiler and linker flags for libascend&lt;br /&gt;
env.ParseConfig([&#039;ascend-config&#039;,&#039;--libs&#039;,&#039;--cppflags&#039;])&lt;br /&gt;
&lt;br /&gt;
# our list of files&lt;br /&gt;
srcs = [&#039;mbwr.c&#039;,&#039;asc_mbwr.c&#039;]&lt;br /&gt;
&lt;br /&gt;
# note that we suffix the IMPORT name with &#039;_ascend&#039;:&lt;br /&gt;
env.SharedLibrary(&#039;mbwr_ascend&#039;,srcs)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Providing ASCEND has been installed on your system (Note: including &#039;devel&#039; files, if you&#039;re installing from an RPM package or Windows installer), you should now be able to just run SCons to build the shared library, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;john@thunder:~/ascend/models/johnpye/fprops$ scons&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
gcc -o asc_mbwr.os -c -fPIC -I/usr/local/include asc_mbwr.c&lt;br /&gt;
gcc -o mbwr.os -c -fPIC -I/usr/local/include mbwr.c&lt;br /&gt;
gcc -o libmbwr_ascend.so -shared mbwr.os asc_mbwr.os -L/usr/local/lib -lascend&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
john@thunder:~/ascend/models/johnpye/fprops$&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting file, &#039;libmbwr_ascend.so&#039; (on Linux) is the file that will be loaded when ASCEND sees an &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt; statement in your model file.&lt;br /&gt;
&lt;br /&gt;
Obviously if you want, you can just type these compiler and linker commands manually, without using a build script. Or you can use GNU Make or CMake as you wish.&lt;br /&gt;
&lt;br /&gt;
== Using it ==&lt;br /&gt;
&lt;br /&gt;
To make use of the external relation that we&#039;ve now created, we can create a simple model file that makes a single evaluation of the external relation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* test of the fluid properties routines currently implemented in asc_mbwr.c *)&lt;br /&gt;
REQUIRE &amp;quot;atoms.a4l&amp;quot;;&lt;br /&gt;
IMPORT &amp;quot;johnpye/fprops/mbwr&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL mbwrconf;&lt;br /&gt;
	component IS_A symbol_constant;&lt;br /&gt;
	component :== &#039;R123&#039;;&lt;br /&gt;
&lt;br /&gt;
END mbwrconf;&lt;br /&gt;
&lt;br /&gt;
MODEL fprops_test;&lt;br /&gt;
&lt;br /&gt;
	p IS_A pressure;&lt;br /&gt;
&lt;br /&gt;
	T IS_A temperature;&lt;br /&gt;
	rhob IS_A molar_density;&lt;br /&gt;
&lt;br /&gt;
	propsdata IS_A mbwrconf;&lt;br /&gt;
&lt;br /&gt;
	props: mbwr_p(&lt;br /&gt;
		T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
		p : OUTPUT;&lt;br /&gt;
		propsdata : DATA&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	FIX rhob, T;&lt;br /&gt;
	rhob := 1 {mol/m^3};&lt;br /&gt;
&lt;br /&gt;
	T := 400 {K};&lt;br /&gt;
END on_load;&lt;br /&gt;
END fprops_test;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in particular here the way in which we&#039;ve set up the &#039;mbwrconf&#039; model containing the details of the fluid that we&#039;re using, and way that the &#039;DATA&#039; parameter is set in the external relation call.&lt;br /&gt;
&lt;br /&gt;
Note that the syntax for external relations is somewhat limited; you can&#039;t include any other terms in these &#039;equations&#039;: the whole inputs-to-outputs relation is defined &#039;external&#039; to the ASCEND model.&lt;br /&gt;
&lt;br /&gt;
The other issue here is the [[IMPORT]] statement. This statement uses the ASCENDLIBRARY environment variable to hunt for your shared library before it attempts to import it. In this case, the &#039;mbwr&#039; model has been created inside the standard ASCEND [[ModelLibrary]], so I didn&#039;t need to change the value of ASCENDLIBRARY. But sometimes you will need to do that before running ASCEND, eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;export ASCENDLIBRARY=~/freesteam/ascend&lt;br /&gt;
ascend testfreesteam.a4c&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ASCEND window, you should see some debug output from the &#039;prepare&#039; function, so you will know that your library was successfully loaded. Then you can solve the model and check that your model is giving results that actually make sense.&lt;br /&gt;
&lt;br /&gt;
It is worth thinking about setting up [[Model Self-testing]] when you create new external libraries, so that you have a quick way of checking that subsequent changes to your code or other ASCEND code haven&#039;t broken your output or changed any values from what is expected.&lt;br /&gt;
&lt;br /&gt;
== Adding derivatives ==&lt;br /&gt;
&lt;br /&gt;
At this point it needs to be explained that the Newton-based solver algorithm that is being used here by ASCEND to solve more complex models will often fail with an implementation like this. This is a result of the Newton algorithm, which requires &#039;&#039;partial derivatives&#039;&#039; of the &#039;&#039;residual&#039;&#039; for each equation in the system of equations &#039;&#039;with respect to each variable&#039;&#039; in the system. When an external relation is provided, ASCEND&#039;s usual system of automatic symbolic differentiation of equations can&#039;t be used. Instead, ASCEND calculates a rather crude finite-difference derivative, and this derivative can often be sufficiently inaccurate that it affects ASCEND&#039;s ability to converge to a solution.&lt;br /&gt;
&lt;br /&gt;
For this reason, when you declare an external relation to ASCEND, you have the opportunity to provide a function which can calculate exact values of these partial derivatives (which end up as elements in the system&#039;s Jacobian matrix).&lt;br /&gt;
&lt;br /&gt;
To set an element within the jacobian (derivative) matrix, use the following &#039;row-major&#039; syntax (see {{src|ascend/compiler/extfunc.h}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;for(i = 0; i&amp;lt; noutputs; ++i){&lt;br /&gt;
&lt;br /&gt;
  for(j = 0; j&amp;lt; ninputs; ++j){&lt;br /&gt;
    jacobian[i*ninputs + j] = /* insert value of ∂F_i/∂x_j here */&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[FPROPS]] (documentation of the &#039;completed&#039; library)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Extending_ASCEND]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6386</id>
		<title>Writing ASCEND external relations in C</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6386"/>
		<updated>2026-03-06T11:11:10Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Building and linking the code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will guide you through the steps required to access [[External_relations|external relation]] code for ASCEND from the [http://en.wikipedia.org/wiki/C_(programming_language) C language]. As an example, we will walk through the implementation of an external thermodynamic properties correlation using the modified Benedict-Webb-Rubin correlation, with the added benefit of a useful and reasonably well-documented piece of code. For a little more background on these so-called &#039;black box&#039; external relations, see the PhD thesis of Kirk Abbott (in [[Publications]]).&lt;br /&gt;
&lt;br /&gt;
All the code associated with this HOWTO (and possibly a bit more, over time) is available from {{srcdir|models/johnpye/fprops/}} in the [[ModelLibrary]],&lt;br /&gt;
&lt;br /&gt;
== Decide on the C functions that you want to access ==&lt;br /&gt;
Firstly, you need to provide the C code for the functions that you want to be able to access from ASCEND. In this HOWTO, we&#039;re interested in &#039;&#039;&#039;external relations&#039;&#039;&#039;, which means equations or functions that we want to be able to use from within an ASCEND model. The most typical application of external relations is probably thermodynamic property correlations, but other examples include pressure-drop correlations (e.g. pipe friction), and perhaps getting data from lookup tables, etc.&lt;br /&gt;
&lt;br /&gt;
In this case, we want to access the Modified Benedict-Webb-Rubin (MBWR) thermodynamic property correlation for the refrigerant &#039;&#039;&#039;R123&#039;&#039;&#039;. The MBWR correlation data for this refrigerant was published in 1994 by Younglove, and McLinden&amp;lt;ref&amp;gt;B A Younglove and M O McLinden, 1994, An International Standard Equation of State for the Thermodynamic Properties of Refrigerant 123 (2,2‐Dichloro‐1,1,1‐Trifluoroethane), J. Phys. Chem. Ref. Data &#039;&#039;&#039;23&#039;&#039;&#039; p.731, {{doi|10.1063/1.555950}}&amp;lt;/ref&amp;gt;. We have implemented a function which provides the general form of an MBWR correlation as follows, with the intention that our fluid-specific correlation data would also be passed in to the function as a pointer to a &amp;lt;tt&amp;gt;MbwrData&amp;lt;/tt&amp;gt; struct:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* from mbwr.h: */&lt;br /&gt;
typedef struct MbwrData_struct{&lt;br /&gt;
&lt;br /&gt;
	double rhob_c; /**&amp;lt; critical molar density in mol/L */&lt;br /&gt;
	double beta[32]; /**&amp;lt; constants in MBWR for the fluid in question */&lt;br /&gt;
&lt;br /&gt;
} MbwrData;&lt;br /&gt;
&lt;br /&gt;
/* from mbwr.c: */&lt;br /&gt;
double mbwr_p(double T, double rhob, MbwrData *data){&lt;br /&gt;
&lt;br /&gt;
    double p;&lt;br /&gt;
    /* lots of code here... */&lt;br /&gt;
    return p;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
We can use this code to calculate pressure &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; as an output, with temperature &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; and molar density &amp;lt;math&amp;gt;\bar \rho&amp;lt;/math&amp;gt; (&amp;lt;tt&amp;gt;rhob&amp;lt;/tt&amp;gt;) as inputs.&lt;br /&gt;
&lt;br /&gt;
The full code for this function is available in {{src|models/johnpye/fprops/mbwr.c}}.&lt;br /&gt;
&lt;br /&gt;
This code can be compiled to a &#039;shared object file&#039; using a C compiler, or you can write a little [http://en.wikipedia.org/wiki/Main_function_(programming) &#039;main&#039; function] to drive this function and make some output, just for testing. The following test program includes the data for R123, because we haven&#039;t yet implemented a tidy general-purpose system for loading these data from a file or a database etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;#include &amp;quot;mbwr.h&amp;quot;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(int argc, char **argv){&lt;br /&gt;
&lt;br /&gt;
    if(argc&amp;lt;3)return 1;&lt;br /&gt;
    double T = atof(argv[1]); /* K */&lt;br /&gt;
&lt;br /&gt;
    double rhog = atof(argv[2]); /* mol/L? */&lt;br /&gt;
    double p;&lt;br /&gt;
&lt;br /&gt;
    /* property data for R123, from J. Phys. Chem. Ref. Data, 23:731-779, 1994. */&lt;br /&gt;
    const MbwrData propdata = {&lt;br /&gt;
        13.2117771543124 /* rho_c */&lt;br /&gt;
        ,{ /* beta[32] */&lt;br /&gt;
&lt;br /&gt;
            -0.657453133659E-02,     0.293479845842E+01,   -0.989140469845E+02&lt;br /&gt;
            , 0.201029776013E+05,   -0.383566527886E+07,    0.227587641969E-02&lt;br /&gt;
&lt;br /&gt;
            ,-0.908726819450E+01,    0.434181417995E+04,    0.354116464954E+07&lt;br /&gt;
            ,-0.635394849670E-03,    0.320786715274E+01,   -0.131276484299E+04&lt;br /&gt;
&lt;br /&gt;
            ,-0.116360713718E+00,   -0.113354409016E+02,   -0.537543457327E+04&lt;br /&gt;
            , 0.258112416120E+01,   -0.106148632128E+00,    0.500026133667E+02&lt;br /&gt;
&lt;br /&gt;
            ,-0.204326706346E+01,   -0.249438345685E+07,   -0.463962781113E+09&lt;br /&gt;
            ,-0.284903429588E+06,    0.974392239902E+10,   -0.637314379308E+04&lt;br /&gt;
&lt;br /&gt;
            , 0.314121189813E+06,   -0.145747968225E+03,   -0.843830261449E+07&lt;br /&gt;
            ,-0.241138441593E+01,    0.108508031257E+04,   -0.106653193965E-01&lt;br /&gt;
&lt;br /&gt;
            ,-0.121343571084E+02,   -0.257510383240E+03&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    p = mbwr_p(T,rhog, propdata);&lt;br /&gt;
&lt;br /&gt;
    fprintf(stderr,&amp;quot;T = %f, rhob = %f --&amp;gt; p = %f&amp;quot;, T, rhob, p);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
Once you&#039;re happy that your function is working as expected (and be sure you know what&#039;s happening with the units of measurement) then you can get on with the job of wrapping it from ASCEND.&lt;br /&gt;
&lt;br /&gt;
== Create an ASCEND wrapper library ==&lt;br /&gt;
&lt;br /&gt;
To create a wrapper for your function, you will essentially need to create a [http://en.wikipedia.org/wiki/Library_(computing) shared library] (.DLL on Windows, or .SO file on Linux) of a specific kind that can be [http://en.wikipedia.org/wiki/Dynamic_loading &#039;dynamically loaded&#039;] at runtime by ASCEND, when ASCEND sees an [[IMPORT]] statement in your model code. Using tools like [http://www.scons.org SCons] isn&#039;t too hard, and if you do it carefully, you will be able to use the same technique to build your shared library on Windows, Linux and Mac.&lt;br /&gt;
&lt;br /&gt;
The first important feature of the shared library that you will be creating is that it will have a &#039;registration function&#039;. This function is the entry point for the shared library you are creating, and this function will do the job of telling ASCEND what external relations you are going to be providing to it. Note that it is possible to embed external methods, external relations, and external anything else you fancy in a &#039;&#039;single&#039;&#039; shared library in ASCEND; there is no requirement that you have a single shared library for each single external relation you are creating.&lt;br /&gt;
&lt;br /&gt;
The registration function will look something like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&lt;br /&gt;
&lt;br /&gt;
/* registration function for the MBWR shared library */&lt;br /&gt;
extern&lt;br /&gt;
ASC_EXPORT int mbwr_register(){&lt;br /&gt;
	const char *mbwr_help = &amp;quot;Modified Benedict-Webb-Rubin correlation for thermodynamic properties&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	int result = 0;&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;Initialising MBWR...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	result += CreateUserFunctionBlackBox(&amp;quot;mbwr_p&amp;quot;&lt;br /&gt;
		, mbwr_p_prepare&lt;br /&gt;
		, mbwr_p_calc /* value */&lt;br /&gt;
&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* derivatives not provided yet*/&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* hessian not provided yet */&lt;br /&gt;
		, (ExtBBoxFinalFunc*)NULL /* finalisation not implemented */&lt;br /&gt;
&lt;br /&gt;
		, 2,1 /* inputs, outputs */&lt;br /&gt;
		, mbwr_help&lt;br /&gt;
		, 0.0&lt;br /&gt;
&lt;br /&gt;
	); /* returns 0 on success */&lt;br /&gt;
&lt;br /&gt;
	if(result){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_PROG_ERR,&amp;quot;CreateUserFunction result = %d\n&amp;quot;,result);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	return result;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
The key part of that function is that it contains a call to the function &#039;&#039;&#039;CreateUserFunctionBlackBox&#039;&#039;&#039;, and this function tells ASCEND about two functions, &#039;&#039;&#039;mbwr_p_prepare&#039;&#039;&#039; and &#039;&#039;&#039;mbwr_p_calc&#039;&#039;&#039; that we are yet to write. It tells ASCEND that we are providing a &#039;black box&#039; user function, which is another way of saying &#039;external relation&#039;. It says that this external relation will have 2 inputs and 1 output. It gives some &#039;help text&#039; to ASCEND to allow the user to identify what it is that they have loaded. It also gives the name of the provided external relation as &#039;mbwr_p&#039;; this is the name that you will be able to use to access this function when writing an ASCEND model from within the ASCEND modelling language.&lt;br /&gt;
&lt;br /&gt;
You note that we add the output of CreateUserFunctionBlackBox to the variable &#039;result&#039;. This is done because typically we would have multiple functions being registered in a single external library, and each registration could potentially return a non-zero error code. So we add all the result codes together and if we get a non-zero total, then we output a message.&lt;br /&gt;
&lt;br /&gt;
Note also that we are using the ERROR_REPORTER_HERE function (from compiler/error.h in libascend) to convey output back to ASCEND. This is much better than outputting to the console, as output via this function will be visible in the GUI, and it has &#039;status&#039; associated with it too (e.g. ASC_PROG_NOTE is a &#039;note&#039; for the user, and ASC_PROG_ERR is an error being reported, which would normally be shown in red).&lt;br /&gt;
&lt;br /&gt;
== Preparation and Calculation wrapper functions ==&lt;br /&gt;
In the previous section, we had [http://en.wikipedia.org/wiki/Forward_declaration forward declarations] for two functions that we haven&#039;t written yet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These functions are where we really get into passing information to and from our external code.&lt;br /&gt;
&lt;br /&gt;
=== &#039;Prepare&#039; function ===&lt;br /&gt;
&lt;br /&gt;
This function is the first of the two that we&#039;ll implement. We should first highlight the difference between the &#039;registration&#039; and the &#039;preparation&#039; function. The registration function is called when ASCEND sees the [[IMPORT]] statement for our shared library, for example &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt;. We can, if we want, do some preparation of specific stuff at that time, but we don&#039;t yet know anything about which functions are going to be used, and how often, and with what values.&lt;br /&gt;
&lt;br /&gt;
On the other hand, the preparation function is called when the external relation is first seen in your code, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;myprops: mbwr_p(&lt;br /&gt;
    T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
    p : OUTPUT;&lt;br /&gt;
    mydata : DATA&lt;br /&gt;
);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, ASCEND will know that the &#039;mbwr_p&#039; function is going to be used in this model, so it&#039;s appropriate that if there is any data that needs to be preloaded or precalculated, that we should do it now, inside the &#039;prepare&#039; function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;prepare&#039; function has the following structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
   /* implementation here... */&lt;br /&gt;
   return statuscode;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, we are passed a pointer to a [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp] structure, as well as a &#039;data&#039; instance (more later), and an &#039;arglist&#039;. The arglist is a list with &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;inputs&amp;lt;/sub&amp;gt; + &#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;outputs&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; elements, each of which itself is a list of instances (allowing either single values or arrays to be passed to your external relation). You can use the arglist to check that your input arguments have the correct data type, units, etc, although in common practise we don&#039;t both to do that.&lt;br /&gt;
&lt;br /&gt;
The &#039;data&#039; instance is important, as it allows you to pass data to your external relation that specifies how the relation should work, but in the form of &#039;&#039;&#039;constants&#039;&#039;&#039; or &#039;&#039;&#039;parameters&#039;&#039;&#039;, as opposed to variables that will actually vary during the modelling calculations. This is typically used to pass a filename for a data file, or a name of a substance, so that the external relation will load that file or substance data before the calculation commences.&lt;br /&gt;
&lt;br /&gt;
In our particular example, we plan to implement a general-purpose property calculation system here based on the MBWR correlation, so we will make use of the data instance as a place where the name of the substance can be passed into ASCEND.&lt;br /&gt;
&lt;br /&gt;
Our &#039;mbwr_p_prepare&#039; function therefore contains the following code, which looks for a member called &#039;component&#039; inside the DATA instance, and asserts that its value be equal to &amp;quot;R123&amp;quot;, because we&#039;ve only implemented support for this one fluid so far.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
	struct Instance *compinst;&lt;br /&gt;
	const char *comp;&lt;br /&gt;
&lt;br /&gt;
	mbwr_symbols[0] = AddSymbol(&amp;quot;component&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	/* get the data file name (we will look for this file in the ASCENDLIBRARY path) */&lt;br /&gt;
	compinst = ChildByChar(data,COMPONENT_SYM);&lt;br /&gt;
&lt;br /&gt;
	if(!compinst){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR&lt;br /&gt;
			,&amp;quot;Couldn&#039;t locate &#039;component&#039; in DATA, please check usage of MBWR.&amp;quot;&lt;br /&gt;
		);&lt;br /&gt;
		return 1;&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	if(InstanceKind(compinst)!=SYMBOL_CONSTANT_INST){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;DATA member &#039;component&#039; must be a symbol_constant&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
	comp = SCP(SYMC_INST(compinst)-&amp;gt;value);&lt;br /&gt;
&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;COMPONENT: %s&amp;quot;,comp);&lt;br /&gt;
	if(comp==NULL || strlen(comp)==0){&lt;br /&gt;
&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;&#039;component&#039; is NULL or empty&amp;quot;);&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if(strcmp(comp,&amp;quot;R123&amp;quot;)!=0){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;Component must be &#039;R123&#039; at this stage (only one component supported)&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;PREPARING MBWR_P...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	bbox-&amp;gt;user_data = (void*)&amp;amp;mbwr_r123;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &#039;Calculate&#039; function ===&lt;br /&gt;
&lt;br /&gt;
The &#039;calculate&#039; function is where ASCEND instructs our external relation to actually be evaluated. This is the part that gets called over and over again during ASCEND&#039;s solver iterations, so it&#039;s written for efficient access to the values that need to be used. The structure of the &#039;calculate&#039; function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In actual fact, the external relation API in ASCEND has been designed in such a way that the same function can be used both for function evaluation as well as calculation of partial derivatives (Jacobian matrix). If you want to use the API in this way, they your &#039;calculate&#039; function needs to look in the &#039;bbox&#039; struct to see the value of &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt; as noted in the declaration of [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp]. In our case we&#039;re only suing our function for simple evaluation, so we don&#039;t need to check &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt;, and we will also ignore the &amp;lt;tt&amp;gt;jacobian&amp;lt;/tt&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Our resulting wrapper function contains a few simple checks then then makes the call to our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function (the one that we&#039;re wrapping) using the appropriate values from the &amp;lt;tt&amp;gt;inputs&amp;lt;/tt&amp;gt; array, and places the result in the correct position in the &amp;lt;tt&amp;gt;outputs&amp;lt;/tt&amp;gt; array. Note that this function doesn&#039;t include any arguments for the DATA parameter; it is assumed that you&#039;ve already dojne what you needed with the DATA parameters, and they won&#039;t have changed since then. Also note that we make use of the &amp;lt;tt&amp;gt;bbox-&amp;gt;user_data&amp;lt;/tt&amp;gt; general-purpose pointer to indicate where our fluid-specific property data is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&lt;br /&gt;
	/* a few checks about the input requirements */&lt;br /&gt;
	if(ninputs != 2)return -1;&lt;br /&gt;
&lt;br /&gt;
	if(noutputs != 1)return -2;&lt;br /&gt;
	if(inputs==NULL)return -3;&lt;br /&gt;
&lt;br /&gt;
	if(outputs==NULL)return -4;&lt;br /&gt;
	if(bbox==NULL)return -5;&lt;br /&gt;
&lt;br /&gt;
	/* the &#039;user_data&#039; in the black box object will contain the coefficients&lt;br /&gt;
	required for this fluid; cast it to the required form: */&lt;br /&gt;
	MbwrData *mbwr_data = (MbwrData *)bbox-&amp;gt;user_data;&lt;br /&gt;
&lt;br /&gt;
	/* first input is temperature, second is molar density */&lt;br /&gt;
	outputs[0] = mbwr_p(inputs[0], inputs[1], mbwr_data);&lt;br /&gt;
&lt;br /&gt;
	/* no need to worry about error states etc, so always return &#039;success&#039;: */&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in your &#039;calculate&#039; function you will typically need to convert from the units of measurement used in external code to the &#039;base units&#039; used by ASCEND. In most cases this means giving values in SI base units, such as kg, m, s, K or A, or combinations of those, such as m³/s.&lt;br /&gt;
&lt;br /&gt;
If it is possible that your external function may return error codes, you have the opportunity of passing those errors back to ASCEND, or alternatively you can choose to ignore the errors. In many cases Newton iteration will work best if you can evaluate smooth curves even outside their &#039;acceptable range&#039;, and not return errors when values are outside those ranges.&lt;br /&gt;
&lt;br /&gt;
== Building and linking the code ==&lt;br /&gt;
&lt;br /&gt;
At this point, we have all the main parts of the wrapper code for accessing our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function from ASCEND. You can see the resulting file {{src|models/johnpye/fprops/asc_mbwr.c}}. It now remains to get the code compiled and linked to ASCEND. Because we have been using some code from within libascend, we need to link our dynamically library back to libascend, so this is an opportunity to make use of a standardised approach that ASCEND provides for creating derivative software.&lt;br /&gt;
&lt;br /&gt;
At this point we have two files, &amp;lt;tt&amp;gt;mbwr.c&amp;lt;/tt&amp;gt; (containing the code-to-be-wrapped) and &amp;lt;tt&amp;gt;asc_mbwr.c&amp;lt;/tt&amp;gt; (the ASCEND wrapper code for our function). To build the shared library, we add the following &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; file that will make use of [http://www.scons.org SCons] to generate a shared library for ASCEND on our system. The only requirement is that the program &#039;ascend-config&#039; should already be on our PATH, which might require some tweaking in the case of Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;env = Environment()&lt;br /&gt;
&lt;br /&gt;
# get compiler and linker flags for libascend&lt;br /&gt;
env.ParseConfig([&#039;ascend-config&#039;,&#039;--libs&#039;,&#039;--cppflags&#039;])&lt;br /&gt;
&lt;br /&gt;
# our list of files&lt;br /&gt;
srcs = [&#039;mbwr.c&#039;,&#039;asc_mbwr.c&#039;]&lt;br /&gt;
&lt;br /&gt;
# note that we suffix the IMPORT name with &#039;_ascend&#039;:&lt;br /&gt;
env.SharedLibrary(&#039;mbwr_ascend&#039;,srcs)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Providing ASCEND has been installed on your system (Note: including &#039;devel&#039; files, if you&#039;re installing from an RPM package or Windows installer), you should now be able to just run SCons to build the shared library, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shellscript&amp;quot;&amp;gt;john@thunder:~/ascend/models/johnpye/fprops$ scons&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
gcc -o asc_mbwr.os -c -fPIC -I/usr/local/include asc_mbwr.c&lt;br /&gt;
gcc -o mbwr.os -c -fPIC -I/usr/local/include mbwr.c&lt;br /&gt;
gcc -o libmbwr_ascend.so -shared mbwr.os asc_mbwr.os -L/usr/local/lib -lascend&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
john@thunder:~/ascend/models/johnpye/fprops$&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting file, &#039;libmbwr_ascend.so&#039; (on Linux) is the file that will be loaded when ASCEND sees an &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt; statement in your model file.&lt;br /&gt;
&lt;br /&gt;
Obviously if you want, you can just type these compiler and linker commands manually, without using a build script. Or you can use GNU Make or CMake as you wish.&lt;br /&gt;
&lt;br /&gt;
== Using it ==&lt;br /&gt;
&lt;br /&gt;
To make use of the external relation that we&#039;ve now created, we can create a simple model file that makes a single evaluation of the external relation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* test of the fluid properties routines currently implemented in asc_mbwr.c *)&lt;br /&gt;
REQUIRE &amp;quot;atoms.a4l&amp;quot;;&lt;br /&gt;
IMPORT &amp;quot;johnpye/fprops/mbwr&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL mbwrconf;&lt;br /&gt;
	component IS_A symbol_constant;&lt;br /&gt;
	component :== &#039;R123&#039;;&lt;br /&gt;
&lt;br /&gt;
END mbwrconf;&lt;br /&gt;
&lt;br /&gt;
MODEL fprops_test;&lt;br /&gt;
&lt;br /&gt;
	p IS_A pressure;&lt;br /&gt;
&lt;br /&gt;
	T IS_A temperature;&lt;br /&gt;
	rhob IS_A molar_density;&lt;br /&gt;
&lt;br /&gt;
	propsdata IS_A mbwrconf;&lt;br /&gt;
&lt;br /&gt;
	props: mbwr_p(&lt;br /&gt;
		T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
		p : OUTPUT;&lt;br /&gt;
		propsdata : DATA&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	FIX rhob, T;&lt;br /&gt;
	rhob := 1 {mol/m^3};&lt;br /&gt;
&lt;br /&gt;
	T := 400 {K};&lt;br /&gt;
END on_load;&lt;br /&gt;
END fprops_test;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in particular here the way in which we&#039;ve set up the &#039;mbwrconf&#039; model containing the details of the fluid that we&#039;re using, and way that the &#039;DATA&#039; parameter is set in the external relation call.&lt;br /&gt;
&lt;br /&gt;
Note that the syntax for external relations is somewhat limited; you can&#039;t include any other terms in these &#039;equations&#039;: the whole inputs-to-outputs relation is defined &#039;external&#039; to the ASCEND model.&lt;br /&gt;
&lt;br /&gt;
The other issue here is the [[IMPORT]] statement. This statement uses the ASCENDLIBRARY environment variable to hunt for your shared library before it attempts to import it. In this case, the &#039;mbwr&#039; model has been created inside the standard ASCEND [[ModelLibrary]], so I didn&#039;t need to change the value of ASCENDLIBRARY. But sometimes you will need to do that before running ASCEND, eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;export ASCENDLIBRARY=~/freesteam/ascend&lt;br /&gt;
ascend testfreesteam.a4c&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ASCEND window, you should see some debug output from the &#039;prepare&#039; function, so you will know that your library was successfully loaded. Then you can solve the model and check that your model is giving results that actually make sense.&lt;br /&gt;
&lt;br /&gt;
It is worth thinking about setting up [[Model Self-testing]] when you create new external libraries, so that you have a quick way of checking that subsequent changes to your code or other ASCEND code haven&#039;t broken your output or changed any values from what is expected.&lt;br /&gt;
&lt;br /&gt;
== Adding derivatives ==&lt;br /&gt;
&lt;br /&gt;
At this point it needs to be explained that the Newton-based solver algorithm that is being used here by ASCEND to solve more complex models will often fail with an implementation like this. This is a result of the Newton algorithm, which requires &#039;&#039;partial derivatives&#039;&#039; of the &#039;&#039;residual&#039;&#039; for each equation in the system of equations &#039;&#039;with respect to each variable&#039;&#039; in the system. When an external relation is provided, ASCEND&#039;s usual system of automatic symbolic differentiation of equations can&#039;t be used. Instead, ASCEND calculates a rather crude finite-difference derivative, and this derivative can often be sufficiently inaccurate that it affects ASCEND&#039;s ability to converge to a solution.&lt;br /&gt;
&lt;br /&gt;
For this reason, when you declare an external relation to ASCEND, you have the opportunity to provide a function which can calculate exact values of these partial derivatives (which end up as elements in the system&#039;s Jacobian matrix).&lt;br /&gt;
&lt;br /&gt;
To set an element within the jacobian (derivative) matrix, use the following &#039;row-major&#039; syntax (see {{src|ascend/compiler/extfunc.h}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;for(i = 0; i&amp;lt; noutputs; ++i){&lt;br /&gt;
&lt;br /&gt;
  for(j = 0; j&amp;lt; ninputs; ++j){&lt;br /&gt;
    jacobian[i*ninputs + j] = /* insert value of ∂F_i/∂x_j here */&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[FPROPS]] (documentation of the &#039;completed&#039; library)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Extending_ASCEND]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6385</id>
		<title>Writing ASCEND external relations in C</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Writing_ASCEND_external_relations_in_C&amp;diff=6385"/>
		<updated>2026-03-06T11:10:57Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Building and linking the code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will guide you through the steps required to access [[External_relations|external relation]] code for ASCEND from the [http://en.wikipedia.org/wiki/C_(programming_language) C language]. As an example, we will walk through the implementation of an external thermodynamic properties correlation using the modified Benedict-Webb-Rubin correlation, with the added benefit of a useful and reasonably well-documented piece of code. For a little more background on these so-called &#039;black box&#039; external relations, see the PhD thesis of Kirk Abbott (in [[Publications]]).&lt;br /&gt;
&lt;br /&gt;
All the code associated with this HOWTO (and possibly a bit more, over time) is available from {{srcdir|models/johnpye/fprops/}} in the [[ModelLibrary]],&lt;br /&gt;
&lt;br /&gt;
== Decide on the C functions that you want to access ==&lt;br /&gt;
Firstly, you need to provide the C code for the functions that you want to be able to access from ASCEND. In this HOWTO, we&#039;re interested in &#039;&#039;&#039;external relations&#039;&#039;&#039;, which means equations or functions that we want to be able to use from within an ASCEND model. The most typical application of external relations is probably thermodynamic property correlations, but other examples include pressure-drop correlations (e.g. pipe friction), and perhaps getting data from lookup tables, etc.&lt;br /&gt;
&lt;br /&gt;
In this case, we want to access the Modified Benedict-Webb-Rubin (MBWR) thermodynamic property correlation for the refrigerant &#039;&#039;&#039;R123&#039;&#039;&#039;. The MBWR correlation data for this refrigerant was published in 1994 by Younglove, and McLinden&amp;lt;ref&amp;gt;B A Younglove and M O McLinden, 1994, An International Standard Equation of State for the Thermodynamic Properties of Refrigerant 123 (2,2‐Dichloro‐1,1,1‐Trifluoroethane), J. Phys. Chem. Ref. Data &#039;&#039;&#039;23&#039;&#039;&#039; p.731, {{doi|10.1063/1.555950}}&amp;lt;/ref&amp;gt;. We have implemented a function which provides the general form of an MBWR correlation as follows, with the intention that our fluid-specific correlation data would also be passed in to the function as a pointer to a &amp;lt;tt&amp;gt;MbwrData&amp;lt;/tt&amp;gt; struct:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* from mbwr.h: */&lt;br /&gt;
typedef struct MbwrData_struct{&lt;br /&gt;
&lt;br /&gt;
	double rhob_c; /**&amp;lt; critical molar density in mol/L */&lt;br /&gt;
	double beta[32]; /**&amp;lt; constants in MBWR for the fluid in question */&lt;br /&gt;
&lt;br /&gt;
} MbwrData;&lt;br /&gt;
&lt;br /&gt;
/* from mbwr.c: */&lt;br /&gt;
double mbwr_p(double T, double rhob, MbwrData *data){&lt;br /&gt;
&lt;br /&gt;
    double p;&lt;br /&gt;
    /* lots of code here... */&lt;br /&gt;
    return p;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
We can use this code to calculate pressure &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;p&#039;&#039;&amp;lt;/span&amp;gt; as an output, with temperature &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;T&#039;&#039;&amp;lt;/span&amp;gt; and molar density &amp;lt;math&amp;gt;\bar \rho&amp;lt;/math&amp;gt; (&amp;lt;tt&amp;gt;rhob&amp;lt;/tt&amp;gt;) as inputs.&lt;br /&gt;
&lt;br /&gt;
The full code for this function is available in {{src|models/johnpye/fprops/mbwr.c}}.&lt;br /&gt;
&lt;br /&gt;
This code can be compiled to a &#039;shared object file&#039; using a C compiler, or you can write a little [http://en.wikipedia.org/wiki/Main_function_(programming) &#039;main&#039; function] to drive this function and make some output, just for testing. The following test program includes the data for R123, because we haven&#039;t yet implemented a tidy general-purpose system for loading these data from a file or a database etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;#include &amp;quot;mbwr.h&amp;quot;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(int argc, char **argv){&lt;br /&gt;
&lt;br /&gt;
    if(argc&amp;lt;3)return 1;&lt;br /&gt;
    double T = atof(argv[1]); /* K */&lt;br /&gt;
&lt;br /&gt;
    double rhog = atof(argv[2]); /* mol/L? */&lt;br /&gt;
    double p;&lt;br /&gt;
&lt;br /&gt;
    /* property data for R123, from J. Phys. Chem. Ref. Data, 23:731-779, 1994. */&lt;br /&gt;
    const MbwrData propdata = {&lt;br /&gt;
        13.2117771543124 /* rho_c */&lt;br /&gt;
        ,{ /* beta[32] */&lt;br /&gt;
&lt;br /&gt;
            -0.657453133659E-02,     0.293479845842E+01,   -0.989140469845E+02&lt;br /&gt;
            , 0.201029776013E+05,   -0.383566527886E+07,    0.227587641969E-02&lt;br /&gt;
&lt;br /&gt;
            ,-0.908726819450E+01,    0.434181417995E+04,    0.354116464954E+07&lt;br /&gt;
            ,-0.635394849670E-03,    0.320786715274E+01,   -0.131276484299E+04&lt;br /&gt;
&lt;br /&gt;
            ,-0.116360713718E+00,   -0.113354409016E+02,   -0.537543457327E+04&lt;br /&gt;
            , 0.258112416120E+01,   -0.106148632128E+00,    0.500026133667E+02&lt;br /&gt;
&lt;br /&gt;
            ,-0.204326706346E+01,   -0.249438345685E+07,   -0.463962781113E+09&lt;br /&gt;
            ,-0.284903429588E+06,    0.974392239902E+10,   -0.637314379308E+04&lt;br /&gt;
&lt;br /&gt;
            , 0.314121189813E+06,   -0.145747968225E+03,   -0.843830261449E+07&lt;br /&gt;
            ,-0.241138441593E+01,    0.108508031257E+04,   -0.106653193965E-01&lt;br /&gt;
&lt;br /&gt;
            ,-0.121343571084E+02,   -0.257510383240E+03&lt;br /&gt;
        }&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    p = mbwr_p(T,rhog, propdata);&lt;br /&gt;
&lt;br /&gt;
    fprintf(stderr,&amp;quot;T = %f, rhob = %f --&amp;gt; p = %f&amp;quot;, T, rhob, p);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
Once you&#039;re happy that your function is working as expected (and be sure you know what&#039;s happening with the units of measurement) then you can get on with the job of wrapping it from ASCEND.&lt;br /&gt;
&lt;br /&gt;
== Create an ASCEND wrapper library ==&lt;br /&gt;
&lt;br /&gt;
To create a wrapper for your function, you will essentially need to create a [http://en.wikipedia.org/wiki/Library_(computing) shared library] (.DLL on Windows, or .SO file on Linux) of a specific kind that can be [http://en.wikipedia.org/wiki/Dynamic_loading &#039;dynamically loaded&#039;] at runtime by ASCEND, when ASCEND sees an [[IMPORT]] statement in your model code. Using tools like [http://www.scons.org SCons] isn&#039;t too hard, and if you do it carefully, you will be able to use the same technique to build your shared library on Windows, Linux and Mac.&lt;br /&gt;
&lt;br /&gt;
The first important feature of the shared library that you will be creating is that it will have a &#039;registration function&#039;. This function is the entry point for the shared library you are creating, and this function will do the job of telling ASCEND what external relations you are going to be providing to it. Note that it is possible to embed external methods, external relations, and external anything else you fancy in a &#039;&#039;single&#039;&#039; shared library in ASCEND; there is no requirement that you have a single shared library for each single external relation you are creating.&lt;br /&gt;
&lt;br /&gt;
The registration function will look something like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&lt;br /&gt;
&lt;br /&gt;
/* registration function for the MBWR shared library */&lt;br /&gt;
extern&lt;br /&gt;
ASC_EXPORT int mbwr_register(){&lt;br /&gt;
	const char *mbwr_help = &amp;quot;Modified Benedict-Webb-Rubin correlation for thermodynamic properties&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	int result = 0;&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;Initialising MBWR...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	result += CreateUserFunctionBlackBox(&amp;quot;mbwr_p&amp;quot;&lt;br /&gt;
		, mbwr_p_prepare&lt;br /&gt;
		, mbwr_p_calc /* value */&lt;br /&gt;
&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* derivatives not provided yet*/&lt;br /&gt;
		, (ExtBBoxFunc*)NULL /* hessian not provided yet */&lt;br /&gt;
		, (ExtBBoxFinalFunc*)NULL /* finalisation not implemented */&lt;br /&gt;
&lt;br /&gt;
		, 2,1 /* inputs, outputs */&lt;br /&gt;
		, mbwr_help&lt;br /&gt;
		, 0.0&lt;br /&gt;
&lt;br /&gt;
	); /* returns 0 on success */&lt;br /&gt;
&lt;br /&gt;
	if(result){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_PROG_ERR,&amp;quot;CreateUserFunction result = %d\n&amp;quot;,result);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	return result;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
The key part of that function is that it contains a call to the function &#039;&#039;&#039;CreateUserFunctionBlackBox&#039;&#039;&#039;, and this function tells ASCEND about two functions, &#039;&#039;&#039;mbwr_p_prepare&#039;&#039;&#039; and &#039;&#039;&#039;mbwr_p_calc&#039;&#039;&#039; that we are yet to write. It tells ASCEND that we are providing a &#039;black box&#039; user function, which is another way of saying &#039;external relation&#039;. It says that this external relation will have 2 inputs and 1 output. It gives some &#039;help text&#039; to ASCEND to allow the user to identify what it is that they have loaded. It also gives the name of the provided external relation as &#039;mbwr_p&#039;; this is the name that you will be able to use to access this function when writing an ASCEND model from within the ASCEND modelling language.&lt;br /&gt;
&lt;br /&gt;
You note that we add the output of CreateUserFunctionBlackBox to the variable &#039;result&#039;. This is done because typically we would have multiple functions being registered in a single external library, and each registration could potentially return a non-zero error code. So we add all the result codes together and if we get a non-zero total, then we output a message.&lt;br /&gt;
&lt;br /&gt;
Note also that we are using the ERROR_REPORTER_HERE function (from compiler/error.h in libascend) to convey output back to ASCEND. This is much better than outputting to the console, as output via this function will be visible in the GUI, and it has &#039;status&#039; associated with it too (e.g. ASC_PROG_NOTE is a &#039;note&#039; for the user, and ASC_PROG_ERR is an error being reported, which would normally be shown in red).&lt;br /&gt;
&lt;br /&gt;
== Preparation and Calculation wrapper functions ==&lt;br /&gt;
In the previous section, we had [http://en.wikipedia.org/wiki/Forward_declaration forward declarations] for two functions that we haven&#039;t written yet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;/* forward declarations */&lt;br /&gt;
ExtBBoxInitFunc mbwr_p_prepare;&lt;br /&gt;
&lt;br /&gt;
ExtBBoxFunc mbwr_p_calc;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These functions are where we really get into passing information to and from our external code.&lt;br /&gt;
&lt;br /&gt;
=== &#039;Prepare&#039; function ===&lt;br /&gt;
&lt;br /&gt;
This function is the first of the two that we&#039;ll implement. We should first highlight the difference between the &#039;registration&#039; and the &#039;preparation&#039; function. The registration function is called when ASCEND sees the [[IMPORT]] statement for our shared library, for example &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt;. We can, if we want, do some preparation of specific stuff at that time, but we don&#039;t yet know anything about which functions are going to be used, and how often, and with what values.&lt;br /&gt;
&lt;br /&gt;
On the other hand, the preparation function is called when the external relation is first seen in your code, for example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;myprops: mbwr_p(&lt;br /&gt;
    T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
    p : OUTPUT;&lt;br /&gt;
    mydata : DATA&lt;br /&gt;
);&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, ASCEND will know that the &#039;mbwr_p&#039; function is going to be used in this model, so it&#039;s appropriate that if there is any data that needs to be preloaded or precalculated, that we should do it now, inside the &#039;prepare&#039; function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;prepare&#039; function has the following structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
   /* implementation here... */&lt;br /&gt;
   return statuscode;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In particular, we are passed a pointer to a [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp] structure, as well as a &#039;data&#039; instance (more later), and an &#039;arglist&#039;. The arglist is a list with &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;inputs&amp;lt;/sub&amp;gt; + &#039;&#039;n&#039;&#039;&amp;lt;sub&amp;gt;outputs&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; elements, each of which itself is a list of instances (allowing either single values or arrays to be passed to your external relation). You can use the arglist to check that your input arguments have the correct data type, units, etc, although in common practise we don&#039;t both to do that.&lt;br /&gt;
&lt;br /&gt;
The &#039;data&#039; instance is important, as it allows you to pass data to your external relation that specifies how the relation should work, but in the form of &#039;&#039;&#039;constants&#039;&#039;&#039; or &#039;&#039;&#039;parameters&#039;&#039;&#039;, as opposed to variables that will actually vary during the modelling calculations. This is typically used to pass a filename for a data file, or a name of a substance, so that the external relation will load that file or substance data before the calculation commences.&lt;br /&gt;
&lt;br /&gt;
In our particular example, we plan to implement a general-purpose property calculation system here based on the MBWR correlation, so we will make use of the data instance as a place where the name of the substance can be passed into ASCEND.&lt;br /&gt;
&lt;br /&gt;
Our &#039;mbwr_p_prepare&#039; function therefore contains the following code, which looks for a member called &#039;component&#039; inside the DATA instance, and asserts that its value be equal to &amp;quot;R123&amp;quot;, because we&#039;ve only implemented support for this one fluid so far.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_prepare(struct BBoxInterp *bbox,&lt;br /&gt;
	   struct Instance *data,&lt;br /&gt;
&lt;br /&gt;
	   struct gl_list_t *arglist&lt;br /&gt;
){&lt;br /&gt;
	struct Instance *compinst;&lt;br /&gt;
	const char *comp;&lt;br /&gt;
&lt;br /&gt;
	mbwr_symbols[0] = AddSymbol(&amp;quot;component&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	/* get the data file name (we will look for this file in the ASCENDLIBRARY path) */&lt;br /&gt;
	compinst = ChildByChar(data,COMPONENT_SYM);&lt;br /&gt;
&lt;br /&gt;
	if(!compinst){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR&lt;br /&gt;
			,&amp;quot;Couldn&#039;t locate &#039;component&#039; in DATA, please check usage of MBWR.&amp;quot;&lt;br /&gt;
		);&lt;br /&gt;
		return 1;&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	if(InstanceKind(compinst)!=SYMBOL_CONSTANT_INST){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;DATA member &#039;component&#039; must be a symbol_constant&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
	comp = SCP(SYMC_INST(compinst)-&amp;gt;value);&lt;br /&gt;
&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;COMPONENT: %s&amp;quot;,comp);&lt;br /&gt;
	if(comp==NULL || strlen(comp)==0){&lt;br /&gt;
&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;&#039;component&#039; is NULL or empty&amp;quot;);&lt;br /&gt;
		return 1;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if(strcmp(comp,&amp;quot;R123&amp;quot;)!=0){&lt;br /&gt;
		ERROR_REPORTER_HERE(ASC_USER_ERROR,&amp;quot;Component must be &#039;R123&#039; at this stage (only one component supported)&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	ERROR_REPORTER_HERE(ASC_PROG_NOTE,&amp;quot;PREPARING MBWR_P...\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	bbox-&amp;gt;user_data = (void*)&amp;amp;mbwr_r123;&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &#039;Calculate&#039; function ===&lt;br /&gt;
&lt;br /&gt;
The &#039;calculate&#039; function is where ASCEND instructs our external relation to actually be evaluated. This is the part that gets called over and over again during ASCEND&#039;s solver iterations, so it&#039;s written for efficient access to the values that need to be used. The structure of the &#039;calculate&#039; function is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In actual fact, the external relation API in ASCEND has been designed in such a way that the same function can be used both for function evaluation as well as calculation of partial derivatives (Jacobian matrix). If you want to use the API in this way, they your &#039;calculate&#039; function needs to look in the &#039;bbox&#039; struct to see the value of &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt; as noted in the declaration of [http://ascend.cheme.cmu.edu/dox/structBBoxInterp.html BBoxInterp]. In our case we&#039;re only suing our function for simple evaluation, so we don&#039;t need to check &amp;lt;tt&amp;gt;bbox-&amp;gt;task&amp;lt;/tt&amp;gt;, and we will also ignore the &amp;lt;tt&amp;gt;jacobian&amp;lt;/tt&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Our resulting wrapper function contains a few simple checks then then makes the call to our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function (the one that we&#039;re wrapping) using the appropriate values from the &amp;lt;tt&amp;gt;inputs&amp;lt;/tt&amp;gt; array, and places the result in the correct position in the &amp;lt;tt&amp;gt;outputs&amp;lt;/tt&amp;gt; array. Note that this function doesn&#039;t include any arguments for the DATA parameter; it is assumed that you&#039;ve already dojne what you needed with the DATA parameters, and they won&#039;t have changed since then. Also note that we make use of the &amp;lt;tt&amp;gt;bbox-&amp;gt;user_data&amp;lt;/tt&amp;gt; general-purpose pointer to indicate where our fluid-specific property data is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;int mbwr_p_calc(struct BBoxInterp *bbox,&lt;br /&gt;
		int ninputs, int noutputs,&lt;br /&gt;
&lt;br /&gt;
		double *inputs, double *outputs,&lt;br /&gt;
		double *jacobian&lt;br /&gt;
&lt;br /&gt;
){&lt;br /&gt;
	/* a few checks about the input requirements */&lt;br /&gt;
	if(ninputs != 2)return -1;&lt;br /&gt;
&lt;br /&gt;
	if(noutputs != 1)return -2;&lt;br /&gt;
	if(inputs==NULL)return -3;&lt;br /&gt;
&lt;br /&gt;
	if(outputs==NULL)return -4;&lt;br /&gt;
	if(bbox==NULL)return -5;&lt;br /&gt;
&lt;br /&gt;
	/* the &#039;user_data&#039; in the black box object will contain the coefficients&lt;br /&gt;
	required for this fluid; cast it to the required form: */&lt;br /&gt;
	MbwrData *mbwr_data = (MbwrData *)bbox-&amp;gt;user_data;&lt;br /&gt;
&lt;br /&gt;
	/* first input is temperature, second is molar density */&lt;br /&gt;
	outputs[0] = mbwr_p(inputs[0], inputs[1], mbwr_data);&lt;br /&gt;
&lt;br /&gt;
	/* no need to worry about error states etc, so always return &#039;success&#039;: */&lt;br /&gt;
	return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in your &#039;calculate&#039; function you will typically need to convert from the units of measurement used in external code to the &#039;base units&#039; used by ASCEND. In most cases this means giving values in SI base units, such as kg, m, s, K or A, or combinations of those, such as m³/s.&lt;br /&gt;
&lt;br /&gt;
If it is possible that your external function may return error codes, you have the opportunity of passing those errors back to ASCEND, or alternatively you can choose to ignore the errors. In many cases Newton iteration will work best if you can evaluate smooth curves even outside their &#039;acceptable range&#039;, and not return errors when values are outside those ranges.&lt;br /&gt;
&lt;br /&gt;
== Building and linking the code ==&lt;br /&gt;
&lt;br /&gt;
At this point, we have all the main parts of the wrapper code for accessing our &amp;lt;tt&amp;gt;mbwr_p&amp;lt;/tt&amp;gt; function from ASCEND. You can see the resulting file {{src|models/johnpye/fprops/asc_mbwr.c}}. It now remains to get the code compiled and linked to ASCEND. Because we have been using some code from within libascend, we need to link our dynamically library back to libascend, so this is an opportunity to make use of a standardised approach that ASCEND provides for creating derivative software.&lt;br /&gt;
&lt;br /&gt;
At this point we have two files, &amp;lt;tt&amp;gt;mbwr.c&amp;lt;/tt&amp;gt; (containing the code-to-be-wrapped) and &amp;lt;tt&amp;gt;asc_mbwr.c&amp;lt;/tt&amp;gt; (the ASCEND wrapper code for our function). To build the shared library, we add the following &amp;lt;tt&amp;gt;SConstruct&amp;lt;/tt&amp;gt; file that will make use of [http://www.scons.org SCons] to generate a shared library for ASCEND on our system. The only requirement is that the program &#039;ascend-config&#039; should already be on our PATH, which might require some tweaking in the case of Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;env = Environment()&lt;br /&gt;
&lt;br /&gt;
# get compiler and linker flags for libascend&lt;br /&gt;
env.ParseConfig([&#039;ascend-config&#039;,&#039;--libs&#039;,&#039;--cppflags&#039;])&lt;br /&gt;
&lt;br /&gt;
# our list of files&lt;br /&gt;
srcs = [&#039;mbwr.c&#039;,&#039;asc_mbwr.c&#039;]&lt;br /&gt;
&lt;br /&gt;
# note that we suffix the IMPORT name with &#039;_ascend&#039;:&lt;br /&gt;
env.SharedLibrary(&#039;mbwr_ascend&#039;,srcs)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Providing ASCEND has been installed on your system (Note: including &#039;devel&#039; files, if you&#039;re installing from an RPM package or Windows installer), you should now be able to just run SCons to build the shared library, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;john@thunder:~/ascend/models/johnpye/fprops$ scons&lt;br /&gt;
scons: Reading SConscript files ...&lt;br /&gt;
scons: done reading SConscript files.&lt;br /&gt;
scons: Building targets ...&lt;br /&gt;
gcc -o asc_mbwr.os -c -fPIC -I/usr/local/include asc_mbwr.c&lt;br /&gt;
gcc -o mbwr.os -c -fPIC -I/usr/local/include mbwr.c&lt;br /&gt;
gcc -o libmbwr_ascend.so -shared mbwr.os asc_mbwr.os -L/usr/local/lib -lascend&lt;br /&gt;
scons: done building targets.&lt;br /&gt;
john@thunder:~/ascend/models/johnpye/fprops$&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting file, &#039;libmbwr_ascend.so&#039; (on Linux) is the file that will be loaded when ASCEND sees an &amp;lt;tt&amp;gt;IMPORT &amp;quot;mbwr&amp;quot;;&amp;lt;/tt&amp;gt; statement in your model file.&lt;br /&gt;
&lt;br /&gt;
Obviously if you want, you can just type these compiler and linker commands manually, without using a build script. Or you can use GNU Make or CMake as you wish.&lt;br /&gt;
&lt;br /&gt;
== Using it ==&lt;br /&gt;
&lt;br /&gt;
To make use of the external relation that we&#039;ve now created, we can create a simple model file that makes a single evaluation of the external relation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;a4c&amp;quot;&amp;gt;(* test of the fluid properties routines currently implemented in asc_mbwr.c *)&lt;br /&gt;
REQUIRE &amp;quot;atoms.a4l&amp;quot;;&lt;br /&gt;
IMPORT &amp;quot;johnpye/fprops/mbwr&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
MODEL mbwrconf;&lt;br /&gt;
	component IS_A symbol_constant;&lt;br /&gt;
	component :== &#039;R123&#039;;&lt;br /&gt;
&lt;br /&gt;
END mbwrconf;&lt;br /&gt;
&lt;br /&gt;
MODEL fprops_test;&lt;br /&gt;
&lt;br /&gt;
	p IS_A pressure;&lt;br /&gt;
&lt;br /&gt;
	T IS_A temperature;&lt;br /&gt;
	rhob IS_A molar_density;&lt;br /&gt;
&lt;br /&gt;
	propsdata IS_A mbwrconf;&lt;br /&gt;
&lt;br /&gt;
	props: mbwr_p(&lt;br /&gt;
		T, rhob : INPUT;&lt;br /&gt;
&lt;br /&gt;
		p : OUTPUT;&lt;br /&gt;
		propsdata : DATA&lt;br /&gt;
	);&lt;br /&gt;
&lt;br /&gt;
METHODS&lt;br /&gt;
METHOD on_load;&lt;br /&gt;
	FIX rhob, T;&lt;br /&gt;
	rhob := 1 {mol/m^3};&lt;br /&gt;
&lt;br /&gt;
	T := 400 {K};&lt;br /&gt;
END on_load;&lt;br /&gt;
END fprops_test;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in particular here the way in which we&#039;ve set up the &#039;mbwrconf&#039; model containing the details of the fluid that we&#039;re using, and way that the &#039;DATA&#039; parameter is set in the external relation call.&lt;br /&gt;
&lt;br /&gt;
Note that the syntax for external relations is somewhat limited; you can&#039;t include any other terms in these &#039;equations&#039;: the whole inputs-to-outputs relation is defined &#039;external&#039; to the ASCEND model.&lt;br /&gt;
&lt;br /&gt;
The other issue here is the [[IMPORT]] statement. This statement uses the ASCENDLIBRARY environment variable to hunt for your shared library before it attempts to import it. In this case, the &#039;mbwr&#039; model has been created inside the standard ASCEND [[ModelLibrary]], so I didn&#039;t need to change the value of ASCENDLIBRARY. But sometimes you will need to do that before running ASCEND, eg:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sh&amp;quot;&amp;gt;export ASCENDLIBRARY=~/freesteam/ascend&lt;br /&gt;
ascend testfreesteam.a4c&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ASCEND window, you should see some debug output from the &#039;prepare&#039; function, so you will know that your library was successfully loaded. Then you can solve the model and check that your model is giving results that actually make sense.&lt;br /&gt;
&lt;br /&gt;
It is worth thinking about setting up [[Model Self-testing]] when you create new external libraries, so that you have a quick way of checking that subsequent changes to your code or other ASCEND code haven&#039;t broken your output or changed any values from what is expected.&lt;br /&gt;
&lt;br /&gt;
== Adding derivatives ==&lt;br /&gt;
&lt;br /&gt;
At this point it needs to be explained that the Newton-based solver algorithm that is being used here by ASCEND to solve more complex models will often fail with an implementation like this. This is a result of the Newton algorithm, which requires &#039;&#039;partial derivatives&#039;&#039; of the &#039;&#039;residual&#039;&#039; for each equation in the system of equations &#039;&#039;with respect to each variable&#039;&#039; in the system. When an external relation is provided, ASCEND&#039;s usual system of automatic symbolic differentiation of equations can&#039;t be used. Instead, ASCEND calculates a rather crude finite-difference derivative, and this derivative can often be sufficiently inaccurate that it affects ASCEND&#039;s ability to converge to a solution.&lt;br /&gt;
&lt;br /&gt;
For this reason, when you declare an external relation to ASCEND, you have the opportunity to provide a function which can calculate exact values of these partial derivatives (which end up as elements in the system&#039;s Jacobian matrix).&lt;br /&gt;
&lt;br /&gt;
To set an element within the jacobian (derivative) matrix, use the following &#039;row-major&#039; syntax (see {{src|ascend/compiler/extfunc.h}}):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;for(i = 0; i&amp;lt; noutputs; ++i){&lt;br /&gt;
&lt;br /&gt;
  for(j = 0; j&amp;lt; ninputs; ++j){&lt;br /&gt;
    jacobian[i*ninputs + j] = /* insert value of ∂F_i/∂x_j here */&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[FPROPS]] (documentation of the &#039;completed&#039; library)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Extending_ASCEND]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=DATASET&amp;diff=6384</id>
		<title>DATASET</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=DATASET&amp;diff=6384"/>
		<updated>2026-03-04T11:03:10Z</updated>

		<summary type="html">&lt;p&gt;Jpye: Redirected page to TABLES&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[TABLES]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ASCEND_capabilities&amp;diff=6383</id>
		<title>ASCEND capabilities</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ASCEND_capabilities&amp;diff=6383"/>
		<updated>2026-03-04T11:02:55Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a summary of current ASCEND capabilities. It is intended to be a complete list. If you want a more general/introductory overview, see the [[ASCEND overview]]. The main page for accessing greater detail on these topics is our [[:Category:Documentation|documentation]] index. This page emphasises the newer PyGTK-based GUI for ASCEND. An overview of the features of the older Tcl/Tk GUI is can be obtained from the [[TclTk screenshots]].&lt;br /&gt;
&lt;br /&gt;
== Language features ==&lt;br /&gt;
&lt;br /&gt;
* Equation-based language, see &#039;&#039;[http://ascend.cheme.cmu.edu/ftp/pdfPapersRptsSlides/processModeling.pdf Equation-based Process Modeling]&#039;&#039; for an overview.&lt;br /&gt;
* Full support for [[units of measurement]]; user never needs to worry about conversion factors.&lt;br /&gt;
* Hierarchical [[MODEL]]s allowing modular system models built from reused components&lt;br /&gt;
* Procedural initialisation of models and solver parameters using [[METHOD]]s&lt;br /&gt;
* [[WHEN]] syntax for [[conditional modelling]] also known as &#039;variable-structure modelling&#039;.&lt;br /&gt;
* [[DATASET]] allows loading of CSV/TSV tabular data. Also [[Data reader]] which is used for interpolation/time-series datasets (for [[DAE]] problems, say).&lt;br /&gt;
* Differential as well as algebraic equations can be expressed&lt;br /&gt;
* Constants are declared separately from variables&lt;br /&gt;
* Multi-modal models with [[SWITCH]] statement (switching based on values assigned to constants).&lt;br /&gt;
* Externally-defined equations (&#039;[[external relations]]&#039;) can be added to models via shared libries and the [[IMPORT]] statement&lt;br /&gt;
* Can run arbitrary Python code in [[METHOD]]s via [[ExtPy]] linkage, useful for custom plotting, reporting, and model initialisation.&lt;br /&gt;
&lt;br /&gt;
== Solver features ==&lt;br /&gt;
&lt;br /&gt;
* Detection of singular and non-square equation systems; user is advised on what modifications would help to make system square.&lt;br /&gt;
* Steady-state [[QRSlv]] non-linear algebraic (NLA) solver with block decomposition.&lt;br /&gt;
* Non-linear programming (NLP)/optimisation solvers [[IPOPT]] (open source) and [[CONOPT]] (commercial).&lt;br /&gt;
* Mixed-integer programming solver [[HiGHS]].&lt;br /&gt;
* ODE and DAE solvers for [[dynamic modelling]]: [[IDA]], [[RADAU5]], [[LSODE]]&lt;br /&gt;
* Some preliminary support for dynamic switching models with boundaries, see [[integration of conditional models]].&lt;br /&gt;
* Solver parameters can be set from within the model code (see [[SOLVER]] and [[OPTION]] statements). Model language allows solving of whole models or just a sub-model.&lt;br /&gt;
* New solvers can easily be added, implemented as [[external libraries]] that access our Solver API.&lt;br /&gt;
&lt;br /&gt;
== GUI features ==&lt;br /&gt;
&lt;br /&gt;
* View all aspects of a model in a hierarchical tree view&lt;br /&gt;
* [[FIX]] and [[FREE]] variables interactively, set their values, and quickly re-solve the model. &lt;br /&gt;
* Interactive exploration of the numerical/convergence behaviour of the model&lt;br /&gt;
* Capture the state of selected variables for export/plotting via [[Observer]] functionality&lt;br /&gt;
* View [[incidence matrix]] showing block-decomposed structure of steady-state systems&lt;br /&gt;
* Diagnose blocks in the model which have been giving numerical problems&lt;br /&gt;
* Observer/study feature: sweep variables and solve each time, to generate tabular/plot outputs from a flowsheet.&lt;br /&gt;
* View [[incidence graph]] (aka dependency graph) for solution process&lt;br /&gt;
* Plot the time-varying values from the solution of dynamic problems&lt;br /&gt;
* Alpha-quality [[canvas-based modeller for ASCEND]] allows &#039;wiring up&#039; of graphical &#039;blocks&#039; to construct complex flowsheets&lt;br /&gt;
&lt;br /&gt;
== Thermodynamics and Engineering features ==&lt;br /&gt;
&lt;br /&gt;
* {{src|models/thermodynamics.a4l}} code for basic-level accuracy of pure species as well as mixtures&lt;br /&gt;
* [[FPROPS]] code for accurate calculation of pure species properties&lt;br /&gt;
* linkage to [[freesteam]] library for calculation of steam properties by official IAPWS-IF97 correlations.&lt;br /&gt;
* A range of models for [[Energy system modelling with ASCEND|energy system modelling], including [[Brayton cycle]], [[Rankine cycle]] and several solar thermal energy component models.&lt;br /&gt;
* Models of mixers, separators and reactors for chemical process modelling (eg {{src|models/flash.a4l}})&lt;br /&gt;
* A growing [[model library]] with a wide range of examples and reusable models.&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HiGHS&amp;diff=6382</id>
		<title>HiGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HiGHS&amp;diff=6382"/>
		<updated>2026-03-03T09:21:59Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new (2026) solver interface to the [https://highs.dev/ HiGHS] linear (LP) and mixed-integer program (MIP) solver has recently been added to ASCEND. We welcome any feedback!&lt;br /&gt;
&lt;br /&gt;
This solver successfully solves the following example problems (see {{src|ascend/solver/test/test_highs.c}}, models in {{srcdir|models/test/mip}} {{src|models/test/highs}}):&lt;br /&gt;
&lt;br /&gt;
* a simple single-[[MODEL]] trivial linear program {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a hierarchical model that yields an LP {{src|models/test/ipopt/lp_structured.a4c}}&lt;br /&gt;
* a simple MIP {{src|models/test/mip/mip_mixed.a4c}}&lt;br /&gt;
* a simplified &#039;capacitated facility-location problem&#039; {{src|models/test/mip/facility_location.a4c}}&lt;br /&gt;
* a classic travellling salesman (TSP) problem {{src|models/test/mip/tsp_mtz8.a4c}}&lt;br /&gt;
* the &#039;whiskas&#039; blending problem {{src|models/test/highs/blend_whiskas2.a4c}}&lt;br /&gt;
* the Netlib &#039;AFIRO&#039; benchmark problem {{src|models/test/highs/afiro.a4c}}&lt;br /&gt;
* a quite costly orienteering problem {{src|models/johnpye/orienteer.a4c}} &lt;br /&gt;
&lt;br /&gt;
== Building HiGHS for use with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
Tested on Ubuntu 24.04:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~&lt;br /&gt;
git clone https://github.com/ERGO-Code/HiGHS.git highs&lt;br /&gt;
cd highs&lt;br /&gt;
cmake -S . -B build \&lt;br /&gt;
  -DCMAKE_BUILD_TYPE=Release \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=$HOME/.local \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DCMAKE_INSTALL_RPATH=$HOME/.local/lib&lt;br /&gt;
cmake --build build -j&lt;br /&gt;
cmake --install build&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing HiGHS with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
To run the [[CUnit]] test suite for HiGHS, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j4 test&lt;br /&gt;
./a4 cutest solver_highs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please make sure your ASCEND code is up to date, and note that you will need the latest patched version of [[CUnit]]. We&#039;re working on getting this version released and distributed, but for now it needs to be compiled from source.&lt;br /&gt;
&lt;br /&gt;
== Reference ==&lt;br /&gt;
* [https://github.com/ERGO-Code/HiGHS HiGHS Github page]&lt;br /&gt;
&lt;br /&gt;
[[Category:LP solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HiGHS&amp;diff=6381</id>
		<title>HiGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HiGHS&amp;diff=6381"/>
		<updated>2026-03-03T09:21:48Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new (2026) solver interface to the [https://highs.dev/ HiGHS] linear (LP) and mixed-integer program (MIP) solver has recently been added to ASCEND. We welcome any feedback!&lt;br /&gt;
&lt;br /&gt;
This solver successfully solves the following example problems (see {{src|ascend/solver/test/test_highs.c}}, models in {{srcdir|models/test/mip}} {{src|models/test/highs}}):&lt;br /&gt;
&lt;br /&gt;
* a simple single-[[MODEL]] trivial linear program {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a hierarchical model that yields an LP {{src|models/test/ipopt/lp_structured.a4c}}&lt;br /&gt;
* a simple MIP {{src|models/test/mip/mip_mixed.a4c}}&lt;br /&gt;
* a simplified &#039;capacitated facility-location problem&#039; {{src|models/test/mip/facility_location.a4c}}&lt;br /&gt;
* a classic travellling salesman (TSP) problem {{src|models/test/mip/tsp_mtz8.a4c}}&lt;br /&gt;
* the &#039;whiskas&#039; blending problem {{src|models/test/highs/blend_whiskas2.a4c}}&lt;br /&gt;
* the Netlib &#039;AFIRO&#039; benchmark problem {{src|models/test/highs/afiro.a4c}}&lt;br /&gt;
* a quite costly orienteering problem {{src|models/johnpye/orienteer.a4c}} from &lt;br /&gt;
&lt;br /&gt;
== Building HiGHS for use with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
Tested on Ubuntu 24.04:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~&lt;br /&gt;
git clone https://github.com/ERGO-Code/HiGHS.git highs&lt;br /&gt;
cd highs&lt;br /&gt;
cmake -S . -B build \&lt;br /&gt;
  -DCMAKE_BUILD_TYPE=Release \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=$HOME/.local \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DCMAKE_INSTALL_RPATH=$HOME/.local/lib&lt;br /&gt;
cmake --build build -j&lt;br /&gt;
cmake --install build&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing HiGHS with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
To run the [[CUnit]] test suite for HiGHS, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j4 test&lt;br /&gt;
./a4 cutest solver_highs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please make sure your ASCEND code is up to date, and note that you will need the latest patched version of [[CUnit]]. We&#039;re working on getting this version released and distributed, but for now it needs to be compiled from source.&lt;br /&gt;
&lt;br /&gt;
== Reference ==&lt;br /&gt;
* [https://github.com/ERGO-Code/HiGHS HiGHS Github page]&lt;br /&gt;
&lt;br /&gt;
[[Category:LP solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=UNITS&amp;diff=6380</id>
		<title>UNITS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=UNITS&amp;diff=6380"/>
		<updated>2026-03-03T09:14:39Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;UNITS&#039;&#039;&#039; statement is used to declare new [[units of measurement]] derived from the other units, or from the base units that are predefined and associated with each of the physcial [[dimensions]] supported in ASCEND.&lt;br /&gt;
&lt;br /&gt;
ASCEND will recognize conversion factors when it sees them as {units}. These units are built up from the basic units,&lt;br /&gt;
and new units can be defined by the user. Note that the assignment &amp;lt;tt&amp;gt;x:= 0.5 {100}&amp;lt;/tt&amp;gt; yields an &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; value of &amp;lt;tt&amp;gt;50&amp;lt;/tt&amp;gt;, and that there is no support in ASCEND for &#039;offset conversions&#039;, such as conversions between Fahrenheit and Celsius (F=9/5*C+32). Please keep unit names to 20 characters or less, as this makes life pretty for other users.&lt;br /&gt;
&lt;br /&gt;
One or more unit conversion factors can be defined with the UNITS keyword. A unit of measure, once defined, stays in the system until the system is shut&lt;br /&gt;
down. A measuring unit cannot be defined differently without first shutting down the system, but duplicate or equivalent definitions are quietly ignored.&lt;br /&gt;
&lt;br /&gt;
A UNITS declaration can occur in a file by itself, inside a model or inside an atom. UNITS definitions are parsed immediately, they will be processed&lt;br /&gt;
even if a surrounding MODEL or ATOM definition is rejected. Because units and dimensionality are designed into the deepest levels of the system, a unit&lt;br /&gt;
definition must be parsed before any atoms or relations use that definition. It is good design practice to keep customized unit definitions in separate files&lt;br /&gt;
and REQUIRE those files at the beginning of any file that uses them. Unit definitions are made in the form, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
UNITS&lt;br /&gt;
   (* several unit definitions are allow here. *)&lt;br /&gt;
&lt;br /&gt;
   (* derived SI units) *)&lt;br /&gt;
   ohm = {kg*m^2/s^3/ampere^2};&lt;br /&gt;
&lt;br /&gt;
   (* alternative names *)&lt;br /&gt;
   kilogram = {kg}&lt;br /&gt;
&lt;br /&gt;
   (* conversions and non-SI units *)&lt;br /&gt;
   MW = {1e6*watt};&lt;br /&gt;
   foot = {12*inch};&lt;br /&gt;
END UNITS;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be careful to check the permitted units of measurement by search through the file {{src|models/measures.a4l}}.&lt;br /&gt;
&lt;br /&gt;
== Constants defined as UNITS ==&lt;br /&gt;
&lt;br /&gt;
ASCEND uses its units of measurement system to declare a number of commonly-used mathematical and physical constants, too. These are also declared in {{src|models/measures.a4l}}. Examples are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
PI= {3.1415926535897932385};         (* Circumference/Diameter ratio *)&lt;br /&gt;
LIGHT_C = {2.99793e8 * m/s};         (* Speed of light in vacuum *)&lt;br /&gt;
GAS_C = {BOLTZMAN_C*AVOGADRO_C};     (* Gas constant *)&lt;br /&gt;
SIGMA_C = {5.670e-8 * W/m^2/K^4 };   (* Stefan-Boltzmann constant for blackbody radiation *)&lt;br /&gt;
EARTH_G = {9.80665 * m/s/s};         (* Earth&#039;s gravitational field, somewhere *)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The benefit of having these as units rather than as special constants is that you don&#039;t need to pollute your variable namespace with these things, and you can also conveniently write values such as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
theta IS_A angle;&lt;br /&gt;
theta = 0.75{PI*rad};&lt;br /&gt;
&lt;br /&gt;
Q IS_A energy_rate;&lt;br /&gt;
Q = 1{SIGMA_C} * A * T^4; (* radiant emissive power *)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;tt&amp;gt;UNITS LADDER&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
A new feature added (Feb 2026) is the &amp;lt;tt&amp;gt;UNITS LADDER&amp;lt;/tt&amp;gt; statement. This allows new units to be defined while at the same time expressing a relationship between units in the same &#039;family&#039; or &#039;ladder&#039;, like meters, kilometers, millimeters. This supports a new GTK GUI feature for &#039;auto-ranging units of measurement: a value like 0.1 MPa can be automatically re-scaled and displayed as 100 kPa instead. The GTK GUI provides new options to allow overrides for MODELs where a specific unit is desired for output.&lt;br /&gt;
&lt;br /&gt;
From {{src|models/measures.a4l}}:&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
UNITS LADDER&lt;br /&gt;
	nJ = {J*1.0e-9};&lt;br /&gt;
	uJ = {J*1.0e-6};&lt;br /&gt;
	mJ = {J*1.0e-3};&lt;br /&gt;
	J = {kg*m^2/s^2};&lt;br /&gt;
	kJ = {J*1000};&lt;br /&gt;
	MJ = {J*1e6};&lt;br /&gt;
	GJ = {J*1e9};&lt;br /&gt;
	TJ = {J*1e12};&lt;br /&gt;
	PJ = {J*1e15};&lt;br /&gt;
END UNITS LADDER;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Units of measurement]]&lt;br /&gt;
* [[Dimensions]]&lt;br /&gt;
* [[DIMENSION]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=UNITS&amp;diff=6379</id>
		<title>UNITS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=UNITS&amp;diff=6379"/>
		<updated>2026-03-03T09:13:27Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;UNITS&#039;&#039;&#039; statement is used to declare new [[units of measurement]] derived from the other units, or from the base units that are predefined and associated with each of the physcial [[dimensions]] supported in ASCEND.&lt;br /&gt;
&lt;br /&gt;
ASCEND will recognize conversion factors when it sees them as {units}. These units are built up from the basic units,&lt;br /&gt;
and new units can be defined by the user. Note that the assignment &amp;lt;tt&amp;gt;x:= 0.5 {100}&amp;lt;/tt&amp;gt; yields an &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; value of &amp;lt;tt&amp;gt;50&amp;lt;/tt&amp;gt;, and that there is no support in ASCEND for &#039;offset conversions&#039;, such as conversions between Fahrenheit and Celsius (F=9/5*C+32). Please keep unit names to 20 characters or less, as this makes life pretty for other users.&lt;br /&gt;
&lt;br /&gt;
One or more unit conversion factors can be defined with the UNITS keyword. A unit of measure, once defined, stays in the system until the system is shut&lt;br /&gt;
down. A measuring unit cannot be defined differently without first shutting down the system, but duplicate or equivalent definitions are quietly ignored.&lt;br /&gt;
&lt;br /&gt;
A UNITS declaration can occur in a file by itself, inside a model or inside an atom. UNITS definitions are parsed immediately, they will be processed&lt;br /&gt;
even if a surrounding MODEL or ATOM definition is rejected. Because units and dimensionality are designed into the deepest levels of the system, a unit&lt;br /&gt;
definition must be parsed before any atoms or relations use that definition. It is good design practice to keep customized unit definitions in separate files&lt;br /&gt;
and REQUIRE those files at the beginning of any file that uses them. Unit definitions are made in the form, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
UNITS&lt;br /&gt;
   (* several unit definitions are allow here. *)&lt;br /&gt;
&lt;br /&gt;
   (* derived SI units) *)&lt;br /&gt;
   ohm = {kg*m^2/s^3/ampere^2};&lt;br /&gt;
&lt;br /&gt;
   (* alternative names *)&lt;br /&gt;
   kilogram = {kg}&lt;br /&gt;
&lt;br /&gt;
   (* conversions and non-SI units *)&lt;br /&gt;
   MW = {1e6*watt};&lt;br /&gt;
   foot = {12*inch};&lt;br /&gt;
END UNITS;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be careful to check the permitted units of measurement by search through the file {{src|models/measures.a4l}}.&lt;br /&gt;
&lt;br /&gt;
== Constants defined as UNITS ==&lt;br /&gt;
&lt;br /&gt;
ASCEND uses its units of measurement system to declare a number of commonly-used mathematical and physical constants, too. These are also declared in {{src|models/measures.a4l}}. Examples are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
PI= {3.1415926535897932385};         (* Circumference/Diameter ratio *)&lt;br /&gt;
LIGHT_C = {2.99793e8 * m/s};         (* Speed of light in vacuum *)&lt;br /&gt;
GAS_C = {BOLTZMAN_C*AVOGADRO_C};     (* Gas constant *)&lt;br /&gt;
SIGMA_C = {5.670e-8 * W/m^2/K^4 };   (* Stefan-Boltzmann constant for blackbody radiation *)&lt;br /&gt;
EARTH_G = {9.80665 * m/s/s};         (* Earth&#039;s gravitational field, somewhere *)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The benefit of having these as units rather than as special constants is that you don&#039;t need to pollute your variable namespace with these things, and you can also conveniently write values such as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=a4c&amp;gt;&lt;br /&gt;
theta IS_A angle;&lt;br /&gt;
theta = 0.75{PI*rad};&lt;br /&gt;
&lt;br /&gt;
Q IS_A energy_rate;&lt;br /&gt;
Q = 1{SIGMA_C} * A * T^4; (* radiant emissive power *)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;tt&amp;gt;UNITS LADDER&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A new feature added (Feb 2026) is the &amp;lt;tt&amp;gt;UNITS LADDER&amp;lt;/tt&amp;gt; statement. This allows new units to be defined while at the same time expressing a relationship between units in the same &#039;family&#039; or &#039;ladder&#039;, like meters, kilometers, millimeters. This supports a new GTK GUI feature for &#039;auto-ranging units of measurement: a value like 0.1 MPa can be automatically re-scaled and displayed as 100 kPa instead. The GTK GUI provides new options to allow overrides for MODELs where a specific unit is desired for output.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Units of measurement]]&lt;br /&gt;
* [[Dimensions]]&lt;br /&gt;
* [[DIMENSION]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Syntax]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Extract_data_from_scanned_plots&amp;diff=6378</id>
		<title>Extract data from scanned plots</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Extract_data_from_scanned_plots&amp;diff=6378"/>
		<updated>2026-03-02T06:56:28Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Free, open source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following are lists of tools for digitizing, or extracting data from, scanned plots, for example from journal publications, etc., where original numerical data is not provided.&lt;br /&gt;
&lt;br /&gt;
Please feel free to add other items to these lists.&lt;br /&gt;
&lt;br /&gt;
== Free, open source ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/jdpipe/g3data2 g3data2] an updated version of G3Data for GTK3. Use &amp;quot;git clone https://github.com/jdpipe/g3data2.git&amp;quot; then compile using &#039;scons&#039;. Tested with Ubuntu 24.04. Supports sub-pixel point positioning, and convenient zoom.&lt;br /&gt;
* [http://plotdigitizer.sourceforge.net/ Plot Digitizer], written in Java, tested with Ubuntu 9.10. A simple and basic tool, but works well. FOSS.&lt;br /&gt;
* [http://www.frantz.fi/software/g3data.php G3Data], written in C/GTK+, included in Ubuntu repositories, tested in the past, works OK and includes a &#039;magnifying glass&#039; feature. FOSS.&lt;br /&gt;
* [http://digitizer.sourceforge.net/index.php?c=2 Engauge], written in C++/Qt, included in Ubuntu repositories, includes support for automatic curve tracing. FOSS.&lt;br /&gt;
* [https://automeris.io/WebPlotDigitizer/ WebPlotDigitizer], written in HTML5/Javascript, web based, runs on Firefox or Chrome, includes support for automatic curve tracing. FOSS.&lt;br /&gt;
&lt;br /&gt;
== Closed source ==&lt;br /&gt;
&lt;br /&gt;
There are also some non-FOSS tools that were not investigated:&lt;br /&gt;
&lt;br /&gt;
* [http://www.digitizeit.de/ DigitizeIt]&lt;br /&gt;
* [http://www.silkscientific.com/graph/ Un-Scan-It]&lt;br /&gt;
* [http://www.uniphiz.com/findgraph.htm FindGraph]&lt;br /&gt;
* [http://www.angelfire.com/rnb/labfit/index_xyExtract.htm xyExtract]&lt;br /&gt;
* [https://www.quintessa.org/software/downloads-and-demos/graph-grabber-2.0.2 Graph Grabber] - looks like it has a nice tool for automatically grabbing points from a coloured-in region of interest.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* Wikipedia: [http://en.wikipedia.org/wiki/Converting_scanned_graphs_to_data Converting scanned graphs to data]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellany]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Extract_data_from_scanned_plots&amp;diff=6377</id>
		<title>Extract data from scanned plots</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Extract_data_from_scanned_plots&amp;diff=6377"/>
		<updated>2026-03-02T06:54:22Z</updated>

		<summary type="html">&lt;p&gt;Jpye: updated g3data2 instructions for our recent fork&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following are lists of tools for digitizing, or extracting data from, scanned plots, for example from journal publications, etc., where original numerical data is not provided.&lt;br /&gt;
&lt;br /&gt;
Please feel free to add other items to these lists.&lt;br /&gt;
&lt;br /&gt;
== Free, open source ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/jdpipe/g3data2 g3data2] an updated version of G3Data for GTK3. Use &amp;quot;git clone https://github.com/jdpipe/g3data2.git&amp;quot; then compile using &#039;scons&#039;. Tested with Ubuntu 24.04.&lt;br /&gt;
* [http://plotdigitizer.sourceforge.net/ Plot Digitizer], written in Java, tested with Ubuntu 9.10. A simple and basic tool, but works well. FOSS.&lt;br /&gt;
* [http://www.frantz.fi/software/g3data.php G3Data], written in C/GTK+, included in Ubuntu repositories, tested in the past, works OK and includes a &#039;magnifying glass&#039; feature. FOSS.&lt;br /&gt;
* [http://digitizer.sourceforge.net/index.php?c=2 Engauge], written in C++/Qt, included in Ubuntu repositories, includes support for automatic curve tracing. FOSS.&lt;br /&gt;
* [https://automeris.io/WebPlotDigitizer/ WebPlotDigitizer], written in HTML5/Javascript, web based, runs on Firefox or Chrome, includes support for automatic curve tracing. FOSS.&lt;br /&gt;
&lt;br /&gt;
== Closed source ==&lt;br /&gt;
&lt;br /&gt;
There are also some non-FOSS tools that were not investigated:&lt;br /&gt;
&lt;br /&gt;
* [http://www.digitizeit.de/ DigitizeIt]&lt;br /&gt;
* [http://www.silkscientific.com/graph/ Un-Scan-It]&lt;br /&gt;
* [http://www.uniphiz.com/findgraph.htm FindGraph]&lt;br /&gt;
* [http://www.angelfire.com/rnb/labfit/index_xyExtract.htm xyExtract]&lt;br /&gt;
* [https://www.quintessa.org/software/downloads-and-demos/graph-grabber-2.0.2 Graph Grabber] - looks like it has a nice tool for automatically grabbing points from a coloured-in region of interest.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* Wikipedia: [http://en.wikipedia.org/wiki/Converting_scanned_graphs_to_data Converting scanned graphs to data]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellany]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6376</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6376"/>
		<updated>2026-02-24T05:49:46Z</updated>

		<summary type="html">&lt;p&gt;Jpye: added DATASET details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the TABLE/VALUES/DATASET syntax and behavior that is actually implemented in ASCEND at present.&lt;br /&gt;
&lt;br /&gt;
= Status Summary =&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt;: implemented.&lt;br /&gt;
* &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt;: parsed only (no statement object/lowering yet).&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt;: implemented.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; statement =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;target_name&amp;gt; [IS_A &amp;lt;type_name&amp;gt;[(&amp;lt;type_args&amp;gt;)] [OF &amp;lt;set_type&amp;gt;]] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
    ...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;&amp;amp;lt;target_name&amp;amp;gt;&amp;lt;/code&amp;gt; is an indexed array reference such as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
cost[r,c]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
cost[r][c]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Inline declaration is supported, eg &amp;lt;code&amp;gt;TABLE cost[r,c] IS_A factor_constant;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* When inline declaration is used, ASCEND injects an equivalent &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; declaration statement before the TABLE statement during parsing.&lt;br /&gt;
* &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DEFAULT&amp;lt;/code&amp;gt; may both be written.&lt;br /&gt;
* Body rows are newline-based.&lt;br /&gt;
* Tokens accepted in TABLE body include identifiers, quoted symbols, integers, reals, &amp;lt;code&amp;gt;{...}&amp;lt;/code&amp;gt;, and punctuation &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== POSITIONAL table ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant POSITIONAL;&lt;br /&gt;
    11 12 13&lt;br /&gt;
    21 22 23&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented behavior:&lt;br /&gt;
&lt;br /&gt;
* Supports 1-D and 2-D targets.&lt;br /&gt;
* Values must be numeric.&lt;br /&gt;
* Signs &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; are supported.&lt;br /&gt;
* Comma can be used as a value separator.&lt;br /&gt;
* A sequence containing at least one semicolon and/or newline ends the current row.&lt;br /&gt;
* Enforces row/column/value counts against index cardinality.&lt;br /&gt;
* Sparse punctuation (&amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;) is rejected in POSITIONAL mode.&lt;br /&gt;
&lt;br /&gt;
== Dense non-POSITIONAL table ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant;&lt;br /&gt;
	    3 1 2&lt;br /&gt;
	    2 23 21 22&lt;br /&gt;
	    1 13 11 12&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented behavior:&lt;br /&gt;
&lt;br /&gt;
* Dense non-POSITIONAL mode currently requires exactly 2 indices.&lt;br /&gt;
* First non-empty row is the column-label header.&lt;br /&gt;
* Header may optionally start with &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Each data row begins with a row label; &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Cell values are numeric only.&lt;br /&gt;
* Row/column labels can be integer or symbol-valued.&lt;br /&gt;
* Duplicate row labels and duplicate column labels are rejected.&lt;br /&gt;
* Label membership is checked against index sets when those sets are already defined.&lt;br /&gt;
* Row/column counts must match first/second index set cardinality.&lt;br /&gt;
* Comma-separated rows (CSV-like) are accepted.&lt;br /&gt;
* A sequence containing at least one semicolon and/or newline ends the current row.&lt;br /&gt;
&lt;br /&gt;
== Label Rules ==&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c];&lt;br /&gt;
	    x y&lt;br /&gt;
	    north 11 12&lt;br /&gt;
	    south 21 22&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant;&lt;br /&gt;
	    c3,c1,c2;&lt;br /&gt;
	    alan,23,21,22;&lt;br /&gt;
	    bernhard,13,11,12;&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Current label handling:&lt;br /&gt;
&lt;br /&gt;
* Integer labels: parsed as integers and matched to integer sets.&lt;br /&gt;
* Symbol labels: unquoted identifiers or quoted symbols (e.g. &amp;lt;code&amp;gt;&#039;New York&#039;&amp;lt;/code&amp;gt;) are matched to symbol sets.&lt;br /&gt;
&lt;br /&gt;
== Implicit Set Inference (Implemented for Dense TABLE) ==&lt;br /&gt;
&lt;br /&gt;
If an index set expression cannot yet be evaluated and it is a simple named set, dense TABLE can infer and assign that set from labels.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
r IS_A set OF integer_constant;&lt;br /&gt;
c IS_A set OF symbol_constant;&lt;br /&gt;
&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant;&lt;br /&gt;
        a  b&lt;br /&gt;
    2: 21 22&lt;br /&gt;
    1: 11 12&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Behavior:&lt;br /&gt;
&lt;br /&gt;
* If all labels are unquoted integers, infer integer set.&lt;br /&gt;
* Otherwise infer symbol set.&lt;br /&gt;
* Duplicate inferred labels are rejected.&lt;br /&gt;
&lt;br /&gt;
== Current Limitations ==&lt;br /&gt;
&lt;br /&gt;
* Sparse non-POSITIONAL TABLE assignment (e.g. &amp;lt;code&amp;gt;row: col=value ...&amp;lt;/code&amp;gt;) is not implemented.&lt;br /&gt;
* &amp;lt;code&amp;gt;DEFAULT &amp;amp;lt;expr&amp;amp;gt;&amp;lt;/code&amp;gt; is parsed and stored but not yet used in TABLE lowering.&lt;br /&gt;
* Non-numeric TABLE cell values are not yet supported.&lt;br /&gt;
* TABLE index ranges written directly in index expressions are not currently supported by dense lowering.&lt;br /&gt;
* &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; are parse-only at this stage.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; statement (not yet implemented) =&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; statement =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET met FROM &amp;quot;weather.csv&amp;quot;;&lt;br /&gt;
    ghi[t] FROM &#039;GHI&#039;;&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With no &amp;lt;code&amp;gt;INDEX&amp;lt;/code&amp;gt; items, &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; is interpreted as the row index&lt;br /&gt;
(1..N rows). If &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; is undeclared, parser lowering injects:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
t IS_A set OF integer_constant;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Extended syntax form ==&lt;br /&gt;
&lt;br /&gt;
Includes explicit &amp;lt;code&amp;gt;INDEX&amp;lt;/code&amp;gt; and typed maps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX customer FROM COLUMN customer_id IS_A integer_constant;&lt;br /&gt;
    load[customer] IS_A factor_constant FROM &#039;load_MW&#039; {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Supported map statement forms:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;target&amp;amp;gt; FROM [COLUMN] &amp;amp;lt;column_ref&amp;amp;gt; [units] [IS_A type]&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;target&amp;amp;gt; IS_A type FROM [COLUMN] &amp;amp;lt;column_ref&amp;amp;gt; [units]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;column_ref&amp;amp;gt;&amp;lt;/code&amp;gt; is an identifier or quoted symbol.&lt;br /&gt;
* &amp;lt;code&amp;gt;COLUMN&amp;lt;/code&amp;gt; is optional for map items.&lt;br /&gt;
* &amp;lt;code&amp;gt;COLUMN&amp;lt;/code&amp;gt; is required for &amp;lt;code&amp;gt;INDEX&amp;lt;/code&amp;gt; items.&lt;br /&gt;
&lt;br /&gt;
== Example: Melbourne DNI/GHI ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
MODEL melbourne_dni_ghi_dataset4;&lt;br /&gt;
    DATASET melbourne FROM &amp;quot;johnpye/datareader/086282TMY_60min_dni_ghi.csv&amp;quot;;&lt;br /&gt;
        dni[timestep] IS_A real_constant FROM &#039;DNI&#039;;&lt;br /&gt;
        ghi[timestep] IS_A real_constant FROM &#039;GHI&#039;;&lt;br /&gt;
    END DATASET;&lt;br /&gt;
&lt;br /&gt;
    annual_dni_sum = SUM[dni[t] | t IN timestep];&lt;br /&gt;
    annual_ghi_sum = SUM[ghi[t] | t IN timestep];&lt;br /&gt;
END melbourne_dni_ghi_dataset4;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* No explicit &amp;lt;code&amp;gt;INDEX&amp;lt;/code&amp;gt; statement is required in this form.&lt;br /&gt;
* &amp;lt;code&amp;gt;timestep&amp;lt;/code&amp;gt; is populated as 1..N (N = number of data rows).&lt;br /&gt;
* Quoted column names are used for direct header matching.&lt;br /&gt;
&lt;br /&gt;
== DATASET Compilation Behavior ==&lt;br /&gt;
&lt;br /&gt;
=== File loading ===&lt;br /&gt;
&lt;br /&gt;
* Reads CSV-like input with a required header row.&lt;br /&gt;
* Delimiters accepted: comma and semicolon.&lt;br /&gt;
* Quoted fields (single/double quote) are accepted; outer quotes are stripped.&lt;br /&gt;
* Blank lines and comment lines beginning with &amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt; are ignored.&lt;br /&gt;
* Supported file types: plain, &amp;lt;code&amp;gt;.gz&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.xz&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Compression support is conditional at build time:&lt;br /&gt;
** &amp;lt;code&amp;gt;.gz&amp;lt;/code&amp;gt; requires zlib.&lt;br /&gt;
** &amp;lt;code&amp;gt;.xz&amp;lt;/code&amp;gt; requires liblzma.&lt;br /&gt;
&lt;br /&gt;
=== Column names and units ===&lt;br /&gt;
&lt;br /&gt;
Column units are parsed from header suffixes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;Name{unit}&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Name / {unit}&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Name[unit]&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Name / [unit]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(whitespace tolerant)&lt;br /&gt;
&lt;br /&gt;
Optional units-row behavior:&lt;br /&gt;
&lt;br /&gt;
* If the first data row parses as units-only tokens, it is consumed as column units.&lt;br /&gt;
* Units-row tokens accepted include bracket/brace forms with optional leading &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Dimensionless tokens (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dimensionless&amp;lt;/code&amp;gt;) mean &amp;quot;no units&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Index handling ===&lt;br /&gt;
&lt;br /&gt;
* Explicit &amp;lt;code&amp;gt;INDEX&amp;lt;/code&amp;gt; items:&lt;br /&gt;
** Build and assign named sets from column values.&lt;br /&gt;
** Supported element types: integer, symbol.&lt;br /&gt;
* Implicit row-index mode (no explicit &amp;lt;code&amp;gt;INDEX&amp;lt;/code&amp;gt; items):&lt;br /&gt;
** Unresolved simple set names in map indices are bound to row positions 1..N.&lt;br /&gt;
** The corresponding set is assigned as integer row labels.&lt;br /&gt;
** Current restriction: one undeclared set name per DATASET.&lt;br /&gt;
&lt;br /&gt;
=== Map assignment ===&lt;br /&gt;
&lt;br /&gt;
* Map targets assign to constant instances (real/int/symbol/bool constants).&lt;br /&gt;
* Units rules:&lt;br /&gt;
** Map units and column units must match if both are present.&lt;br /&gt;
** Cell units (&amp;lt;code&amp;gt;value{unit}&amp;lt;/code&amp;gt;) must match map/column units if those are present.&lt;br /&gt;
** If map/column units are absent, cell units may provide units for real constants.&lt;br /&gt;
** Units are rejected for integer/symbol/boolean constants.&lt;br /&gt;
&lt;br /&gt;
=== Runtime notes ===&lt;br /&gt;
&lt;br /&gt;
* Loaded DATASET content is materialized in memory and cached per file during pass 1.&lt;br /&gt;
* For simple 1D array targets (eg &amp;lt;code&amp;gt;dni[t]&amp;lt;/code&amp;gt;), assignment uses a direct array-child fast path instead of per-cell &amp;lt;code&amp;gt;FindInstances&amp;lt;/code&amp;gt;.&lt;br /&gt;
* After this fast path, DATASET loading/assignment is much cheaper; large runtime is currently dominated by relation instantiation (eg large &amp;lt;code&amp;gt;SUM[...]&amp;lt;/code&amp;gt; relations).&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Syntax_highlighting&amp;diff=6375</id>
		<title>Syntax highlighting</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Syntax_highlighting&amp;diff=6375"/>
		<updated>2026-02-23T23:31:44Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you would like to make use of syntax highlighting with ASCEND code, we have a number of options available. Contributions for other editors, or improvements for the ones already here, are always welcome!&lt;br /&gt;
&lt;br /&gt;
== gedit ==&lt;br /&gt;
&lt;br /&gt;
[http://projects.gnome.org/gedit/ gedit] is the default text editor in GNOME (Linux: Ubuntu, Fedora, etc) and is also available on Windows and Mac. We have a syntax definition for gedit to support  a4c/a4l files. This file, &amp;lt;tt&amp;gt;ascend.lang&amp;lt;/tt&amp;gt; needs to be placed in &amp;lt;tt&amp;gt;/usr/share/gtksourceview-N.0/language-specs/ascend.lang&amp;lt;/tt&amp;gt;. The exact location where you need to put the file may vary depending on your version of GNOME (check the version fo gtksourceview installed on your system). Note that unless you also follow the instructions in [[Desktop integration]], you will still have to manually specify that you want to apply this syntax highlighting.&lt;br /&gt;
&lt;br /&gt;
* See {{src|tools/gedit/ascend.lang}} (for older systems based on gtksourceview-1.x)&lt;br /&gt;
* See {{src|tools/gtksourceview-2.0/ascend.lang}} (for systems based on gtksourceview-2.x)&lt;br /&gt;
* See {{src|tools/gtksourceview-3.0/ascend.lang}} (for current systems based on gtksourceview-3.x)&lt;br /&gt;
&lt;br /&gt;
== Notepad++ ==&lt;br /&gt;
&lt;br /&gt;
[http://notepad-plus-plus.org/ Notepad++] is a pretty nice free open-source text editor for Windows. We have an XML syntax definition file {{src|tools/notepad-plus/userDefineLang_ASCEND.xml}} which you can use to add highlighting for the ASCEND language. The syntax file was contributed by Wojciech Mandziuk. For instructions on how to use this file, see {{src|tools/notepad-plus/README.txt}}&lt;br /&gt;
&lt;br /&gt;
If anyone would like to help improve this highlighting file, some problems are currently present with nested comments and also with [[ARE_THE_SAME]] when immediately followed by a semicolon. Also some [[ATOM]] types should be added. But it&#039;s still very useful as-is.&lt;br /&gt;
&lt;br /&gt;
== TextPad ==&lt;br /&gt;
&lt;br /&gt;
[http://www.textpad.com TextPad] is a popular text editor on Windows&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/textpad/ascend.syn}}&lt;br /&gt;
&lt;br /&gt;
== highlight ==&lt;br /&gt;
&lt;br /&gt;
Andre Simon&#039;s [http://www.andre-simon.de/ highlight] is a syntax highlighting utility that can be used to produce HTML, LaTeX and other forms of highlighted output. It can also be integrated with the scientific wordprocessor [http://www.lyx.org LyX] as well as the online code viewer [http://www.viewvc.org/ ViewVC].&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/highlight/a4c.lang}}&lt;br /&gt;
&lt;br /&gt;
== Vim ==&lt;br /&gt;
&lt;br /&gt;
[http://www.vim.org/ Vim] is a very popular Linux/Unix text editor with a history going back to 1976. Syntax file contributed by Edgar Simo.&lt;br /&gt;
&lt;br /&gt;
* see {{srcdir|tools/vim}}&lt;br /&gt;
* and {{src|tools/vim/ascend.vim}}&lt;br /&gt;
&lt;br /&gt;
== GNU nano ==&lt;br /&gt;
&lt;br /&gt;
[http://www.nano-editor.org/ GNU nano] is the default console-based editor for several newer distributions of Linux including Fedora and Ubuntu. It includes support for syntax highlighting since about 2002. A &amp;lt;tt&amp;gt;~/.nanorc&amp;lt;/tt&amp;gt; for this editor has been contributed by Ondrej Krc-Jediny.&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/nano/ASCEND.nanorc}}&lt;br /&gt;
&lt;br /&gt;
== GNU Emacs ==&lt;br /&gt;
&lt;br /&gt;
Previously, Emacs was used by a lot of the core ASCEND developers, and a special &#039;ASCEND mode&#039; was developed. See {{srcdir|tools/emacs}}. There is some question about whether this mode still works correctly, see [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00098.html the details].&lt;br /&gt;
&lt;br /&gt;
== listings ==&lt;br /&gt;
&lt;br /&gt;
Listings is a LaTeX package that performs syntax highlighting. You can extract the necessary code from the latex preamble of the file {{src|doc/book.lyx}}.&lt;br /&gt;
&lt;br /&gt;
[[Category:ASCEND tools]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=Syntax_highlighting&amp;diff=6374</id>
		<title>Syntax highlighting</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Syntax_highlighting&amp;diff=6374"/>
		<updated>2026-02-23T23:30:47Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you would like to make use of syntax highlighting with ASCEND code, we have a number of options available. Contributions for other editors, or improvements for the ones already here, are always welcome!&lt;br /&gt;
&lt;br /&gt;
== gedit ==&lt;br /&gt;
&lt;br /&gt;
[http://projects.gnome.org/gedit/ gedit] is the default text editor in GNOME (Linux: Ubuntu, Fedora, etc) and is also available on Windows and Mac. We have a syntax definition for gedit to support  a4c/a4l files. This file, &amp;lt;tt&amp;gt;ascend.lang&amp;lt;/tt&amp;gt; needs to be placed in &amp;lt;tt&amp;gt;/usr/share/gtksourceview-N.0/language-specs/ascend.lang&amp;lt;/tt&amp;gt;. The exact location where you need to put the file may vary depending on your version of GNOME (check the version fo gtksourceview installed on your system). Note that unless you also follow the instructions in [[Desktop integration]], you will still have to manually specify that you want to apply this syntax highlighting.&lt;br /&gt;
&lt;br /&gt;
* See {{src|tools/gedit/ascend.lang}} (for older systems based on gtksourceview-1.x)&lt;br /&gt;
* See {{src|tools/gtksourceview-2.0/ascend.lang}} (for systems based on gtksourceview-2.x)&lt;br /&gt;
* See {{src|tools/gtksourceview-3.0/ascend.lang}} (for current systems based on gtksourceview-3.x)&lt;br /&gt;
&lt;br /&gt;
== Notepad++ ==&lt;br /&gt;
&lt;br /&gt;
[http://notepad-plus-plus.org/ Notepad++] is a pretty nice free open-source text editor for Windows. We have an XML syntax definition file {{src|tools/notepad-plus/userDefineLang_ASCEND.xml}} which you can use to add highlighting for the ASCEND language. The syntax file was contributed by Wojciech Mandziuk. For instructions on how to use this file, see {{src|tools/notepad-plus/README.txt}}&lt;br /&gt;
&lt;br /&gt;
If anyone would like to help improve this highlighting file, some problems are currently present with nested comments and also with [[ARE_THE_SAME]] when immediately followed by a semicolon. Also some [[ATOM]] types should be added. But it&#039;s still very useful as-is.&lt;br /&gt;
&lt;br /&gt;
== TextPad ==&lt;br /&gt;
&lt;br /&gt;
[http://www.textpad.com TextPad] is a popular text editor on Windows&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/textpad/ascend.syn}}&lt;br /&gt;
&lt;br /&gt;
== highlight ==&lt;br /&gt;
&lt;br /&gt;
Andre Simon&#039;s [http://www.andre-simon.de/ highlight] is a syntax highlighting utility that can be used to produce HTML, LaTeX and other forms of highlighted output. It can also be integrated with the scientific wordprocessor [http://www.lyx.org LyX] as well as the online code viewer [http://www.viewvc.org/ ViewVC].&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/highlight/a4c.lang}}&lt;br /&gt;
&lt;br /&gt;
== Vim ==&lt;br /&gt;
&lt;br /&gt;
[http://www.vim.org/ Vim] is a very popular Linux/Unix text editor with a history going back to 1976. Syntax file contributed by Edgar Simo.&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/vim/ascend.vim}}&lt;br /&gt;
&lt;br /&gt;
== GNU nano ==&lt;br /&gt;
&lt;br /&gt;
[http://www.nano-editor.org/ GNU nano] is the default console-based editor for several newer distributions of Linux including Fedora and Ubuntu. It includes support for syntax highlighting since about 2002. A &amp;lt;tt&amp;gt;~/.nanorc&amp;lt;/tt&amp;gt; for this editor has been contributed by Ondrej Krc-Jediny.&lt;br /&gt;
&lt;br /&gt;
* see {{src|tools/nano/ASCEND.nanorc}}&lt;br /&gt;
&lt;br /&gt;
== GNU Emacs ==&lt;br /&gt;
&lt;br /&gt;
Previously, Emacs was used by a lot of the core ASCEND developers, and a special &#039;ASCEND mode&#039; was developed. See {{srcdir|tools/emacs}}. There is some question about whether this mode still works correctly, see [http://www.mail-archive.com/ascend-sim-users@lists.sourceforge.net/msg00098.html the details].&lt;br /&gt;
&lt;br /&gt;
== listings ==&lt;br /&gt;
&lt;br /&gt;
Listings is a LaTeX package that performs syntax highlighting. You can extract the necessary code from the latex preamble of the file {{src|doc/book.lyx}}.&lt;br /&gt;
&lt;br /&gt;
[[Category:ASCEND tools]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6373</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6373"/>
		<updated>2026-02-17T12:55:55Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the TABLE/VALUES/DATASET syntax and behavior that is actually implemented in ASCEND at present.&lt;br /&gt;
&lt;br /&gt;
== Status Summary ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt;: parsed and compiled.&lt;br /&gt;
* &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt;: parsed only (no statement object/lowering yet).&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt;: parsed only (no statement object/lowering yet).&lt;br /&gt;
&lt;br /&gt;
== TABLE Syntax (Implemented) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;target_name&amp;gt; [IS_A &amp;lt;type_name&amp;gt;[(&amp;lt;type_args&amp;gt;)] [OF &amp;lt;set_type&amp;gt;]] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
    ...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;&amp;amp;lt;target_name&amp;amp;gt;&amp;lt;/code&amp;gt; is an indexed array reference such as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
cost[r,c]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
cost[r][c]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Inline declaration is supported, eg &amp;lt;code&amp;gt;TABLE cost[r,c] IS_A factor_constant;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* When inline declaration is used, ASCEND injects an equivalent &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; declaration statement before the TABLE statement during parsing.&lt;br /&gt;
* &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DEFAULT&amp;lt;/code&amp;gt; may both be written.&lt;br /&gt;
* Body rows are newline-based.&lt;br /&gt;
* Tokens accepted in TABLE body include identifiers, quoted symbols, integers, reals, &amp;lt;code&amp;gt;{...}&amp;lt;/code&amp;gt;, and punctuation &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== TABLE Compilation Behavior ==&lt;br /&gt;
&lt;br /&gt;
=== 1) POSITIONAL TABLE ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant POSITIONAL;&lt;br /&gt;
    11 12 13&lt;br /&gt;
    21 22 23&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented behavior:&lt;br /&gt;
&lt;br /&gt;
* Supports 1-D and 2-D targets.&lt;br /&gt;
* Values must be numeric.&lt;br /&gt;
* Signs &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; are supported.&lt;br /&gt;
* Comma can be used as a value separator.&lt;br /&gt;
* A sequence containing at least one semicolon and/or newline ends the current row.&lt;br /&gt;
* Enforces row/column/value counts against index cardinality.&lt;br /&gt;
* Sparse punctuation (&amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;) is rejected in POSITIONAL mode.&lt;br /&gt;
&lt;br /&gt;
=== 2) Dense non-POSITIONAL TABLE ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant;&lt;br /&gt;
	    3 1 2&lt;br /&gt;
	    2 23 21 22&lt;br /&gt;
	    1 13 11 12&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented behavior:&lt;br /&gt;
&lt;br /&gt;
* Dense non-POSITIONAL mode currently requires exactly 2 indices.&lt;br /&gt;
* First non-empty row is the column-label header.&lt;br /&gt;
* Header may optionally start with &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Each data row begins with a row label; &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Cell values are numeric only.&lt;br /&gt;
* Row/column labels can be integer or symbol-valued.&lt;br /&gt;
* Duplicate row labels and duplicate column labels are rejected.&lt;br /&gt;
* Label membership is checked against index sets when those sets are already defined.&lt;br /&gt;
* Row/column counts must match first/second index set cardinality.&lt;br /&gt;
* Comma-separated rows (CSV-like) are accepted.&lt;br /&gt;
* A sequence containing at least one semicolon and/or newline ends the current row.&lt;br /&gt;
&lt;br /&gt;
== Label Rules ==&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c];&lt;br /&gt;
	    x y&lt;br /&gt;
	    north 11 12&lt;br /&gt;
	    south 21 22&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant;&lt;br /&gt;
	    c3,c1,c2;&lt;br /&gt;
	    alan,23,21,22;&lt;br /&gt;
	    bernhard,13,11,12;&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Current label handling:&lt;br /&gt;
&lt;br /&gt;
* Integer labels: parsed as integers and matched to integer sets.&lt;br /&gt;
* Symbol labels: unquoted identifiers or quoted symbols (e.g. &amp;lt;code&amp;gt;&#039;New York&#039;&amp;lt;/code&amp;gt;) are matched to symbol sets.&lt;br /&gt;
&lt;br /&gt;
== Implicit Set Inference (Implemented for Dense TABLE) ==&lt;br /&gt;
&lt;br /&gt;
If an index set expression cannot yet be evaluated and it is a simple named set, dense TABLE can infer and assign that set from labels.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
r IS_A set OF integer_constant;&lt;br /&gt;
c IS_A set OF symbol_constant;&lt;br /&gt;
&lt;br /&gt;
TABLE cost[r,c] IS_A integer_constant;&lt;br /&gt;
        a  b&lt;br /&gt;
    2: 21 22&lt;br /&gt;
    1: 11 12&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Behavior:&lt;br /&gt;
&lt;br /&gt;
* If all labels are unquoted integers, infer integer set.&lt;br /&gt;
* Otherwise infer symbol set.&lt;br /&gt;
* Duplicate inferred labels are rejected.&lt;br /&gt;
&lt;br /&gt;
== Current Limitations ==&lt;br /&gt;
&lt;br /&gt;
* Sparse non-POSITIONAL TABLE assignment (e.g. &amp;lt;code&amp;gt;row: col=value ...&amp;lt;/code&amp;gt;) is not implemented.&lt;br /&gt;
* &amp;lt;code&amp;gt;DEFAULT &amp;amp;lt;expr&amp;amp;gt;&amp;lt;/code&amp;gt; is parsed and stored but not yet used in TABLE lowering.&lt;br /&gt;
* Non-numeric TABLE cell values are not yet supported.&lt;br /&gt;
* TABLE index ranges written directly in index expressions are not currently supported by dense lowering.&lt;br /&gt;
* &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; are parse-only at this stage.&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6372</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6372"/>
		<updated>2026-02-17T11:41:26Z</updated>

		<summary type="html">&lt;p&gt;Jpye: updated -- as implemented&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
== TABLE Syntax (Implemented) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;target_name&amp;gt; [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
    ...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;&amp;amp;lt;target_name&amp;amp;gt;&amp;lt;/code&amp;gt; is an indexed array reference such as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
cost[r,c]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
cost[r][c]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DEFAULT&amp;lt;/code&amp;gt; may both be written.&lt;br /&gt;
* Body rows are newline-based.&lt;br /&gt;
* Tokens accepted in TABLE body include identifiers, quoted symbols, integers, reals, &amp;lt;code&amp;gt;{...}&amp;lt;/code&amp;gt;, and punctuation &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;,&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== TABLE Compilation Behavior ==&lt;br /&gt;
&lt;br /&gt;
=== 1) POSITIONAL TABLE ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c] POSITIONAL;&lt;br /&gt;
    11 12 13&lt;br /&gt;
    21 22 23&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented behavior:&lt;br /&gt;
&lt;br /&gt;
* Supports 1-D and 2-D targets.&lt;br /&gt;
* Values must be numeric.&lt;br /&gt;
* Signs &amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; are supported.&lt;br /&gt;
* Comma can be used as a value separator.&lt;br /&gt;
* A sequence containing at least one semicolon and/or newline ends the current row.&lt;br /&gt;
* Enforces row/column/value counts against index cardinality.&lt;br /&gt;
* Sparse punctuation (&amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;) is rejected in POSITIONAL mode.&lt;br /&gt;
&lt;br /&gt;
=== 2) Dense non-POSITIONAL TABLE ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c];&lt;br /&gt;
	    3 1 2&lt;br /&gt;
	    2 23 21 22&lt;br /&gt;
	    1 13 11 12&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented behavior:&lt;br /&gt;
&lt;br /&gt;
* Dense non-POSITIONAL mode currently requires exactly 2 indices.&lt;br /&gt;
* First non-empty row is the column-label header.&lt;br /&gt;
* Header may optionally start with &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Each data row begins with a row label; &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Cell values are numeric only.&lt;br /&gt;
* Row/column labels can be integer or symbol-valued.&lt;br /&gt;
* Duplicate row labels and duplicate column labels are rejected.&lt;br /&gt;
* Label membership is checked against index sets when those sets are already defined.&lt;br /&gt;
* Row/column counts must match first/second index set cardinality.&lt;br /&gt;
* Comma-separated rows (CSV-like) are accepted.&lt;br /&gt;
* A sequence containing at least one semicolon and/or newline ends the current row.&lt;br /&gt;
&lt;br /&gt;
== Label Rules ==&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c];&lt;br /&gt;
	    x y&lt;br /&gt;
	    north 11 12&lt;br /&gt;
	    south 21 22&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE cost[r,c];&lt;br /&gt;
	    c3,c1,c2;&lt;br /&gt;
	    alan,23,21,22;&lt;br /&gt;
	    bernhard,13,11,12;&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Current label handling:&lt;br /&gt;
&lt;br /&gt;
* Integer labels: parsed as integers and matched to integer sets.&lt;br /&gt;
* Symbol labels: unquoted identifiers or quoted symbols (e.g. &amp;lt;code&amp;gt;&#039;New York&#039;&amp;lt;/code&amp;gt;) are matched to symbol sets.&lt;br /&gt;
&lt;br /&gt;
== Implicit Set Inference (Implemented for Dense TABLE) ==&lt;br /&gt;
&lt;br /&gt;
If an index set expression cannot yet be evaluated and it is a simple named set, dense TABLE can infer and assign that set from labels.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
r IS_A set OF integer_constant;&lt;br /&gt;
c IS_A set OF symbol_constant;&lt;br /&gt;
cost[r][c] IS_A integer_constant;&lt;br /&gt;
&lt;br /&gt;
TABLE cost[r,c];&lt;br /&gt;
        a  b&lt;br /&gt;
    2: 21 22&lt;br /&gt;
    1: 11 12&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Behavior:&lt;br /&gt;
&lt;br /&gt;
* If all labels are unquoted integers, infer integer set.&lt;br /&gt;
* Otherwise infer symbol set.&lt;br /&gt;
* Duplicate inferred labels are rejected.&lt;br /&gt;
&lt;br /&gt;
== Current Limitations ==&lt;br /&gt;
&lt;br /&gt;
* Sparse non-POSITIONAL TABLE assignment (e.g. &amp;lt;code&amp;gt;row: col=value ...&amp;lt;/code&amp;gt;) is not implemented.&lt;br /&gt;
* &amp;lt;code&amp;gt;DEFAULT &amp;amp;lt;expr&amp;amp;gt;&amp;lt;/code&amp;gt; is parsed and stored but not yet used in TABLE lowering.&lt;br /&gt;
* Non-numeric TABLE cell values are not yet supported.&lt;br /&gt;
* TABLE index ranges written directly in index expressions are not currently supported by dense lowering.&lt;br /&gt;
* &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; are parse-only at this stage.&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6371</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6371"/>
		<updated>2026-02-17T11:07:23Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
** first row contains column labels.&lt;br /&gt;
** subsequent rows contain row label followed by row values.&lt;br /&gt;
** &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
** no header row required.&lt;br /&gt;
** each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
** &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
** &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
** no row/column labels in body.&lt;br /&gt;
** values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
** newline is the natural row separator.&lt;br /&gt;
** &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
Dense form, with row and column labels, as well as the central data array:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
      1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3 1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
             Sydney &#039;New York&#039; Rome&lt;br /&gt;
    Alan     2      4          5&lt;br /&gt;
    Bernhard 3      1          2&lt;br /&gt;
    Colin    4      2          1&lt;br /&gt;
    David    4      5          3&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sparse form, as flagged via the &amp;lt;tt&amp;gt;DEFAULT value&amp;lt;/tt&amp;gt; term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;Positional&#039; form, where row and column labels are implied (integer sequence):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6370</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6370"/>
		<updated>2026-02-17T11:06:12Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
  * first row contains column labels.&lt;br /&gt;
  * subsequent rows contain row label followed by row values.&lt;br /&gt;
  * &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
  * no header row required.&lt;br /&gt;
  * each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
  * &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
  * &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
  * no row/column labels in body.&lt;br /&gt;
  * values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
  * newline is the natural row separator.&lt;br /&gt;
  * &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
Dense form, with row and column labels, as well as the central data array:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
      1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3 1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
             Sydney &#039;New York&#039; Rome&lt;br /&gt;
    Alan     2      4          5&lt;br /&gt;
    Bernhard 3      1          2&lt;br /&gt;
    Colin    4      2          1&lt;br /&gt;
    David    4      5          3&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sparse form, as flagged via the &amp;lt;tt&amp;gt;DEFAULT value&amp;lt;/tt&amp;gt; term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;Positional&#039; form, where row and column labels are implied (integer sequence):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6369</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6369"/>
		<updated>2026-02-17T11:04:12Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
  * first row contains column labels.&lt;br /&gt;
  * subsequent rows contain row label followed by row values.&lt;br /&gt;
  * &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
  * no header row required.&lt;br /&gt;
  * each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
  * &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
  * &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
  * no row/column labels in body.&lt;br /&gt;
  * values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
  * newline is the natural row separator.&lt;br /&gt;
  * &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&#039;Standard form&#039;, with row and column labels, as well as the central data array:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
      1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3 1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sparse form, as flagged via the &amp;lt;tt&amp;gt;DEFAULT value&amp;lt;/tt&amp;gt; term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;Positional&#039; form, where row and column labels are implied (integer sequence):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6368</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6368"/>
		<updated>2026-02-17T11:01:37Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
  * first row contains column labels.&lt;br /&gt;
  * subsequent rows contain row label followed by row values.&lt;br /&gt;
  * &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
  * no header row required.&lt;br /&gt;
  * each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
  * &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
  * &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
  * no row/column labels in body.&lt;br /&gt;
  * values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
  * newline is the natural row separator.&lt;br /&gt;
  * &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
    1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3;&lt;br /&gt;
    1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6367</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6367"/>
		<updated>2026-02-17T11:01:22Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
Header:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Body and ending:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
  * first row contains column labels.&lt;br /&gt;
  * subsequent rows contain row label followed by row values.&lt;br /&gt;
  * &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
  * no header row required.&lt;br /&gt;
  * each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
  * &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
  * &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
  * no row/column labels in body.&lt;br /&gt;
  * values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
  * newline is the natural row separator.&lt;br /&gt;
  * &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
    1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3;&lt;br /&gt;
    1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6366</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6366"/>
		<updated>2026-02-17T09:04:46Z</updated>

		<summary type="html">&lt;p&gt;Jpye: category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
Header:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Body and ending:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
  * first row contains column labels.&lt;br /&gt;
  * subsequent rows contain row label followed by row values.&lt;br /&gt;
  * &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
  * no header row required.&lt;br /&gt;
  * each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
  * &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
  * &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
  * no row/column labels in body.&lt;br /&gt;
  * values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
  * newline is the natural row separator.&lt;br /&gt;
  * &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
    1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3;&lt;br /&gt;
    1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TABLES&amp;diff=6365</id>
		<title>TABLES</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TABLES&amp;diff=6365"/>
		<updated>2026-02-17T08:52:15Z</updated>

		<summary type="html">&lt;p&gt;Jpye: initial spec&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document captures the current v0.5 concept for tabular data syntax in ASCEND. It is a language design draft, not a complete implementation specification.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
* Keep ASCEND’s explicit, type-aware style.&lt;br /&gt;
* Minimize repetitive boilerplate for indexed data.&lt;br /&gt;
* Support both compact in-model data and external datasets.&lt;br /&gt;
* Preserve dimensional/unit checking as a first-class feature.&lt;br /&gt;
&lt;br /&gt;
== New Declarations ==&lt;br /&gt;
&lt;br /&gt;
=== 1) &amp;lt;code&amp;gt;TABLE&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for two-axis table data mapped to existing arrays.&lt;br /&gt;
&lt;br /&gt;
Header:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE &amp;lt;array_name&amp;gt;[&amp;lt;row_index_set&amp;gt;,&amp;lt;col_index_set&amp;gt;] [POSITIONAL] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Body and ending:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;...&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
&lt;br /&gt;
* Default (non-&amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt;) form:&lt;br /&gt;
  * first row contains column labels.&lt;br /&gt;
  * subsequent rows contain row label followed by row values.&lt;br /&gt;
  * &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; after row label is optional.&lt;br /&gt;
* Sparse form:&lt;br /&gt;
  * no header row required.&lt;br /&gt;
  * each row uses &amp;lt;code&amp;gt;&amp;lt;col_label&amp;gt;=&amp;lt;value&amp;gt;&amp;lt;/code&amp;gt; pairs.&lt;br /&gt;
  * &amp;lt;code&amp;gt;DEFAULT &amp;lt;expr&amp;gt;&amp;lt;/code&amp;gt; indicates unspecified cells are filled with the default.&lt;br /&gt;
  * &amp;lt;code&amp;gt;POSITIONAL&amp;lt;/code&amp;gt; form:&lt;br /&gt;
  * no row/column labels in body.&lt;br /&gt;
  * values are interpreted positionally from set ordering.&lt;br /&gt;
* Row separator:&lt;br /&gt;
  * newline is the natural row separator.&lt;br /&gt;
  * &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; immediately before newline joins lines, so one logical row can wrap across physical lines.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE ship_cost[customer,facility];&lt;br /&gt;
    1 2 3&lt;br /&gt;
    1 2 4 5&lt;br /&gt;
    2 3;&lt;br /&gt;
    1 2&lt;br /&gt;
    3 4 2 1&lt;br /&gt;
    4 5 3 2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;TABLE ship_cost[customer,facility] DEFAULT 0;&lt;br /&gt;
    1: 1=2 2=4 3=5&lt;br /&gt;
    2: 1=3 2=1 3=2&lt;br /&gt;
    4 1=5 3=2&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
TABLE c[city,city] POSITIONAL;&lt;br /&gt;
    0 89 22 11&lt;br /&gt;
    21 0 94 77&lt;br /&gt;
    11 19 0 35&lt;br /&gt;
    79 33 99 0&lt;br /&gt;
END TABLE;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2) &amp;lt;code&amp;gt;VALUES&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for vectors and sparse ND assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES &amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;, ...] [DEFAULT &amp;lt;expr&amp;gt;];&lt;br /&gt;
   &amp;lt;k1&amp;gt;[,&amp;lt;k2&amp;gt;...] = &amp;lt;value&amp;gt;;&lt;br /&gt;
   ...&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
VALUES demand[customer] DEFAULT 0;&lt;br /&gt;
    1 = 45;&lt;br /&gt;
    2 = 30;&lt;br /&gt;
    3 = 40;&lt;br /&gt;
    4 = 35;&lt;br /&gt;
END VALUES;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3) &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Intended for external files, especially large time-series and operational data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET &amp;lt;dataset_name&amp;gt; FROM &amp;quot;file.csv&amp;quot;;&lt;br /&gt;
INDEX &amp;lt;set_name&amp;gt; FROM COLUMN &amp;lt;col_name&amp;gt; IS_A &amp;lt;type_name&amp;gt;;&lt;br /&gt;
&amp;lt;array_name&amp;gt;[&amp;lt;index_set&amp;gt;] FROM COLUMN &amp;lt;col_name&amp;gt; [{&amp;lt;units&amp;gt;}] [IS_A &amp;lt;type_name&amp;gt;];&lt;br /&gt;
...&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=ascend&amp;gt;&lt;br /&gt;
DATASET ops FROM &amp;quot;ops.csv&amp;quot;;&lt;br /&gt;
    INDEX t FROM COLUMN timestamp IS_A time;&lt;br /&gt;
    load[t] FROM COLUMN load_MW {MW};&lt;br /&gt;
END DATASET;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; map targets must be indexed (&amp;lt;code&amp;gt;name[...]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* If &amp;lt;code&amp;gt;IS_A&amp;lt;/code&amp;gt; is omitted on a map line, a default type (planned: &amp;lt;code&amp;gt;real_constant&amp;lt;/code&amp;gt;, dimensionless) can be assumed during compile/lowering.&lt;br /&gt;
&lt;br /&gt;
== Labels and Quoting ==&lt;br /&gt;
&lt;br /&gt;
* Identifier-like labels can be unquoted.&lt;br /&gt;
* Labels with spaces/punctuation require symbol-constant quoting: &amp;lt;tt&amp;gt;&#039;New York&#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Units Concept ==&lt;br /&gt;
&lt;br /&gt;
* Unit metadata may come from file metadata/rows (future data-handler behavior).&lt;br /&gt;
* Inline units in &amp;lt;code&amp;gt;DATASET&amp;lt;/code&amp;gt; mappings are allowed and should be checked for compatibility against declared type dimensions.&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HiGHS&amp;diff=6364</id>
		<title>HiGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HiGHS&amp;diff=6364"/>
		<updated>2026-02-15T10:55:42Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new (2026) solver interface to the [https://highs.dev/ HiGHS] linear (LP) and mixed-integer program (MIP) solver has recently been added to ASCEND. We welcome any feedback!&lt;br /&gt;
&lt;br /&gt;
This solver successfully solves the following example problems (see {{src|ascend/solver/test/test_highs.c}}, models in {{srcdir|models/test/mip}} {{src|models/test/highs}}):&lt;br /&gt;
&lt;br /&gt;
* a simple single-[[MODEL]] trivial linear program {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a hierarchical model that yields an LP {{src|models/test/ipopt/lp_structured.a4c}}&lt;br /&gt;
* a simple MIP {{src|models/test/mip/mip_mixed.a4c}}&lt;br /&gt;
* a simplified &#039;capacitated facility-location problem&#039; {{src|models/test/mip/facility_location.a4c}}&lt;br /&gt;
* a classic travellling salesman (TSP) problem {{src|models/test/mip/tsp_mtz8.a4c}}&lt;br /&gt;
* the &#039;whiskas&#039; blending problem {{src|models/test/highs/blend_whiskas2.a4c}}&lt;br /&gt;
* the Netlib &#039;AFIRO&#039; benchmark problem {{src|models/test/highs/afiro.a4c}}&lt;br /&gt;
&lt;br /&gt;
== Building HiGHS for use with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
Tested on Ubuntu 24.04:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~&lt;br /&gt;
git clone https://github.com/ERGO-Code/HiGHS.git highs&lt;br /&gt;
cd highs&lt;br /&gt;
cmake -S . -B build \&lt;br /&gt;
  -DCMAKE_BUILD_TYPE=Release \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=$HOME/.local \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DCMAKE_INSTALL_RPATH=$HOME/.local/lib&lt;br /&gt;
cmake --build build -j&lt;br /&gt;
cmake --install build&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing HiGHS with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
To run the [[CUnit]] test suite for HiGHS, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j4 test&lt;br /&gt;
./a4 cutest solver_highs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please make sure your ASCEND code is up to date, and note that you will need the latest patched version of [[CUnit]]. We&#039;re working on getting this version released and distributed, but for now it needs to be compiled from source.&lt;br /&gt;
&lt;br /&gt;
== Reference ==&lt;br /&gt;
* [https://github.com/ERGO-Code/HiGHS HiGHS Github page]&lt;br /&gt;
&lt;br /&gt;
[[Category:LP solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HiGHS&amp;diff=6363</id>
		<title>HiGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HiGHS&amp;diff=6363"/>
		<updated>2026-02-15T09:19:43Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new (2026) solver interface to the [https://highs.dev/ HiGHS] linear (LP) and mixed-integer program (MIP) solver has recently been added to ASCEND. We welcome any feedback!&lt;br /&gt;
&lt;br /&gt;
This solver successfully solves the following example problems (see {{src|ascend/solver/test/test_highs.c}}, models in {{srcdir|models/test/mip}} {{src|models/test/highs}}):&lt;br /&gt;
&lt;br /&gt;
* a simple single-[[MODEL]] trivial linear program {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a hierarchical model that yields an LP {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a simple MIP {{src|models/test/mip/mip_mixed.a4c}}&lt;br /&gt;
* a simplified &#039;capacitated facility-location problem&#039; {{src|models/test/mip/facility_location.a4c}}&lt;br /&gt;
* a classic travellling salesman (TSP) problem {{src|models/test/mip/tsp_mtz8.a4c}}&lt;br /&gt;
* the &#039;whiskas&#039; blending problem {{src|models/test/highs/blend_whiskas2.a4c}}&lt;br /&gt;
* the Netlib &#039;AFIRO&#039; benchmark problem {{src|models/test/highs/afiro.a4c}}&lt;br /&gt;
&lt;br /&gt;
== Building HiGHS for use with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
Tested on Ubuntu 24.04:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~&lt;br /&gt;
git clone https://github.com/ERGO-Code/HiGHS.git highs&lt;br /&gt;
cd highs&lt;br /&gt;
cmake -S . -B build \&lt;br /&gt;
  -DCMAKE_BUILD_TYPE=Release \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=$HOME/.local \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DCMAKE_INSTALL_RPATH=$HOME/.local/lib&lt;br /&gt;
cmake --build build -j&lt;br /&gt;
cmake --install build&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing HiGHS with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
To run the [[CUnit]] test suite for HiGHS, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j4 test&lt;br /&gt;
./a4 cutest solver_highs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please make sure your ASCEND code is up to date, and note that you will need the latest patched version of [[CUnit]]. We&#039;re working on getting this version released and distributed, but for now it needs to be compiled from source.&lt;br /&gt;
&lt;br /&gt;
== Reference ==&lt;br /&gt;
* [https://github.com/ERGO-Code/HiGHS HiGHS Github page]&lt;br /&gt;
&lt;br /&gt;
[[Category:LP solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HiGHS&amp;diff=6362</id>
		<title>HiGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HiGHS&amp;diff=6362"/>
		<updated>2026-02-15T09:16:13Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new (2026) solver interface to the [https://highs.dev/ HiGHS] linear (LP) and mixed-integer program (MIP) solver has recently been added to ASCEND.&lt;br /&gt;
&lt;br /&gt;
This solver successfully solves the following example problems (see {{src|ascend/solver/test/test_highs.c}}, models in {{srcdir|models/test/mip}} {{src|models/test/highs}}):&lt;br /&gt;
&lt;br /&gt;
* a simple single-[[MODEL]] trivial linear program {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a hierarchical model that yields an LP {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a simple MIP {{src|models/test/mip/mip_mixed.a4c}}&lt;br /&gt;
* a simplified &#039;capacitated facility-location problem&#039; {{src|models/test/mip/facility_location.a4c}}&lt;br /&gt;
* a classic travellling salesman (TSP) problem {{src|models/test/mip/tsp_mtz8.a4c}}&lt;br /&gt;
* the &#039;whiskas&#039; blending problem {{src|models/test/highs/blend_whiskas2.a4c}}&lt;br /&gt;
* the Netlib &#039;AFIRO&#039; benchmark problem {{src|models/test/highs/afiro.a4c}}&lt;br /&gt;
&lt;br /&gt;
== Building HiGHS for use with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
Tested on Ubuntu 24.04:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~&lt;br /&gt;
git clone https://github.com/ERGO-Code/HiGHS.git highs&lt;br /&gt;
cd highs&lt;br /&gt;
cmake -S . -B build \&lt;br /&gt;
  -DCMAKE_BUILD_TYPE=Release \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=$HOME/.local \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DCMAKE_INSTALL_RPATH=$HOME/.local/lib&lt;br /&gt;
cmake --build build -j&lt;br /&gt;
cmake --install build&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing HiGHS with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
To run the [[CUnit]] test suite for HiGHS, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j4 test&lt;br /&gt;
./a4 cutest solver_highs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please make sure your ASCEND code is up to date, and note that you will need the latest patched version of [[CUnit]]. We&#039;re working on getting this version released and distributed, but for now it needs to be compiled from source.&lt;br /&gt;
&lt;br /&gt;
== Reference ==&lt;br /&gt;
* [https://github.com/ERGO-Code/HiGHS HiGHS Github page]&lt;br /&gt;
&lt;br /&gt;
[[Category:LP solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HiGHS&amp;diff=6361</id>
		<title>HiGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HiGHS&amp;diff=6361"/>
		<updated>2026-02-15T09:16:03Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A new (2026) solver interface to the [https://highs.dev/ HiGHS] linear (LP) and mixed-integer program (MIP) solver has recently been added to ASCEND.&lt;br /&gt;
&lt;br /&gt;
This solver successfully solves the following example problems (see {{src|ascend/solver/test/test_highs.c}}, models in {{srcdir|models/test/mip}} {{src|models/test/highs}}):&lt;br /&gt;
&lt;br /&gt;
* a simple single-[[MODEL]] trivial linear program {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a hierarchical model that yields an LP {{src|models/test/ipopt/lp1.a4c}}&lt;br /&gt;
* a simple MIP {{src|models/test/mip/mip_mixed.a4c}}&lt;br /&gt;
* a simplified &#039;capacitated facility-location problem&#039; {{src|models/test/mip/facility_location.a4c}}&lt;br /&gt;
* a classic travellling salesman (TSP) problem {{src|models/test/mip/tsp_mtz8.a4c}}&lt;br /&gt;
* the &#039;whiskas&#039; blending problem {{src|models/test/highs/blend_whiskas2.a4c}}&lt;br /&gt;
* the Netlib &#039;AFIRO&#039; benchmark problem {{src|models/test/highs/afiro.a4c}}&lt;br /&gt;
&lt;br /&gt;
== Building HiGHS for use with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
Tested on Ubuntu 24.04:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~&lt;br /&gt;
git clone https://github.com/ERGO-Code/HiGHS.git highs&lt;br /&gt;
cd highs&lt;br /&gt;
cmake -S . -B build \&lt;br /&gt;
  -DCMAKE_BUILD_TYPE=Release \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=$HOME/.local \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DCMAKE_INSTALL_RPATH=$HOME/.local/lib&lt;br /&gt;
cmake --build build -j&lt;br /&gt;
cmake --install build&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing HiGHS with ASCEND ==&lt;br /&gt;
&lt;br /&gt;
To run the [[CUnit]] test suite for HiGHS, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shellscript&amp;gt;&lt;br /&gt;
cd ~/ascend&lt;br /&gt;
scons -j4 test&lt;br /&gt;
./a4 cutest solver_highs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please make sure your ASCEND code is up to date, and note that you will need the latest patched version of [[CUnit]]. We&#039;re working on getting this version released and distributed, but for now it needs to be compiled from source.&lt;br /&gt;
&lt;br /&gt;
== Reference ==&lt;br /&gt;
* [https://github.com/ERGO-Code/HiGHS HiGHS Github page]&lt;br /&gt;
&lt;br /&gt;
[[Category:LP Solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=MakeMPS&amp;diff=6360</id>
		<title>MakeMPS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=MakeMPS&amp;diff=6360"/>
		<updated>2026-02-15T09:15:53Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{solvers}}&lt;br /&gt;
&lt;br /&gt;
MakeMPS is a &#039;solver&#039; for ASCEND that exports an active [[MODEL]] to the [https://en.wikipedia.org/wiki/MPS_(format) MPS file format], with support for linear and mixed-integer programs (LP and MIP). The exported file can then be loaded and solved using an external program, such as &amp;lt;tt&amp;gt;highs&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;gurobi&amp;lt;/tt&amp;gt;. It should then be possible to re-incorporate the solution back into ASCEND again when completed, although this part is currently untested.&lt;br /&gt;
&lt;br /&gt;
The source code is available at {{srcdir|solvers/makemps}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Update&#039;&#039;&#039;: this solver was &#039;re-commissioned&#039; in 2026, with numerous updates following changes to the [[Solver API]] are required. Some sample problems have been added and exported in the CUnit test suite (see {{srcdir|ascend/solver/test/test_makemps.c}}, and the code tests that the resulting problems are successfully solved.&lt;br /&gt;
&lt;br /&gt;
Note that the MPS format is restricted to linear and mixed integer and linear programs. Another file format, supported by AMPL, is the &#039;&#039;&#039;.nl&#039;&#039;&#039; file format, which can also handle non-linear equations. It would be desirable to extend the current MakeMPS export code and implement support for &#039;&#039;&#039;.nl&#039;&#039;&#039; file export.&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/MPS_(format) MPS file format]&lt;br /&gt;
* [https://web.archive.org/web/20161228202832/https://cfwebprod.sandia.gov/cfdocs/CompResearch/docs/nlwrite20051130.pdf Writing .nl files]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Nl_%28format%29 nl (format)] (Wikipedia)&lt;br /&gt;
&lt;br /&gt;
[[Category:LP solvers]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=LP_Solvers&amp;diff=6359</id>
		<title>LP Solvers</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=LP_Solvers&amp;diff=6359"/>
		<updated>2026-02-15T09:15:39Z</updated>

		<summary type="html">&lt;p&gt;Jpye: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float:right;&amp;quot;&amp;gt;{{solverstable}}&amp;lt;/div&amp;gt;&amp;lt;!--to avoid classification of this category as a subcategory --&amp;gt;&lt;br /&gt;
Linear program solvers&lt;br /&gt;
&lt;br /&gt;
* [[HiGHS]]: capable of solving LP and MIP problems&lt;br /&gt;
* [[MakeMPS]]: can export an LP or MIP to the &amp;lt;tt&amp;gt;.mps&amp;lt;/tt&amp;gt; file format, allowing solution with a range of external tools.&lt;br /&gt;
&lt;br /&gt;
{{stub}}&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=ASCEND_overview&amp;diff=6358</id>
		<title>ASCEND overview</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=ASCEND_overview&amp;diff=6358"/>
		<updated>2026-02-15T09:14:38Z</updated>

		<summary type="html">&lt;p&gt;Jpye: /* Solvers and integrators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&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 play around 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;
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 model 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;quot;atoms.a4l&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-example1.png|thumb|400px|none|The simple &amp;lt;tt&amp;gt;tank&amp;lt;/tt&amp;gt; model, loaded and solved in ASCEND.]]&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-tank21.png|thumb|400px|none|You can easily &#039;free&#039; and &#039;fix&#039; variables to solve the same model for a different set of unknowns.]]&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;
[[Image:solve-order1.png|thumb|400px|none|For small models, ASCEND can generate a graphical representation of the solution process, useful when debugging.]]&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:observer1.png|thumb|700px|none|The &#039;observer&#039; tab allows results for a set of scenarios to be calculated and stored, and then plotted.]]&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;
== 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;quot;johnpye/rankine.a4c&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 (see {{src|models/johnpye/rankine.a4c}} for the full code). More documentation [[:Category:Syntax|about the syntax]] is available, or you can look at our other models in this area of [[energy system modelling]].&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;
== 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;
* [[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;
* [[LP Solvers]] (including MIP solvers), where equations are linear, possibly with some variables required to be boolean/integer (see [[HiGHS]])&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-incidence1.png|thumb|400px|none]]&lt;br /&gt;
&lt;br /&gt;
See [[Solvers]] and [[Dynamic modelling]] for more information.&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;
== 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;
* [[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;
== 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;
== 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;
If you are interested in contributing to ASCEND, please see our [[Development Activities]] page and also our list of [[Student Projects]] for [[GSOC]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=HIGHS&amp;diff=6357</id>
		<title>HIGHS</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=HIGHS&amp;diff=6357"/>
		<updated>2026-02-15T09:13:11Z</updated>

		<summary type="html">&lt;p&gt;Jpye: Redirected page to HiGHS&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[HiGHS]]&lt;/div&gt;</summary>
		<author><name>Jpye</name></author>
	</entry>
</feed>