- Model-Builder
Infobox Software
name = Model-Builder
latest_release_version = 0.4.0
latest_release_date = March. 26, 2007
developer = Flávio Codeço Coelho, Cláudia Torres Codeço, Antônio Pacheco
operating_system =Cross-platform
genre =Ordinary differential equations ,mathematical modeling
license =GPL
website = [http://model-builder.sourceforge.net home-page][http://model-builder.sourceforge.net Model-Builder] is an application written in
Python programming language , designed to provide a simple graphical interface for writing simulating and analyzingmathematical models based onordinary differential equations .Graphical User Interface
Model-builder's GUI is a very simple one designed to be as unobstrusive as possible. Models are written in standard mathematical language (with operator syntax from Python). The design principle is: "If you can write your equations on paper, you can write implement them in Model-Builder".
The menus
The first menu is the file menu. It contains the standard open, save, save as, close and exit options. These are pretty much self-explanatory.
The second menu is the analysis menu. This menu contains two options: The uncertainty analysis (UA) and State-space Diagram . This first option opens the uncertainty analysis panel, and makes ModelBuilder go into UA mode. The second allow the creation of state-space plot of up to two variables.
The third and last is the help menu with its usual functionality
The Toolbar
The toolbar contains three buttons. The first one is the run button, which starts the simulation.
The second button shows a typeset version of the differential equations in the model (this feature requires the latest version of matplotlib).
The third button shows the results of a simulation on a spreadsheet. From there you can select variables to plot separately and save the results to a csv(comma separated values) file.
Installation Guide
Since Model-builder is written entirely in Python, it is distributed as a source package. However, it needs a Python installation (>=2.4) and utilizes other libraries that need to be installed in your system so that Model-Builder can be started.
Dependencies
#
wxPython : wxpython is the GUI toolkit used by Model-Builder
#NumPy : Python package with many number crunching functions, written in C and Fortran.
#SciPy : Is another Python library that provides the Numerical integration code used by Model-Builder.
#Matplotlib : This is a python plotting library which is used to produce all the graphical output.For Linux and Mac users those dependencies are all available as packages ready for easy installation. For windows users, those packages are also available but the best optio is to install the [http://code.enthought.com/enthon/ Python Enthought Edition] . which already comes bundled with all the above packages.
Once all of the pre-requisites are installed the best way to get the latest Model-Builder is by means of the [http://peak.telecommunity.com/DevCenter/EasyInstall Python setuptools] package (which also needs to be installed). If you have setuptools installed, all you have to do is type the following command on the command prompt:
easy_install Model-Builder
Then setuptools with fetch Model-builder's most recent package from
Sourceforge and install it on you machine. If you are a linux user, you will need to have root privileges to do this.Quick-start Tutorial
If you've gone through the installation process withou problems, you should be able to start Model-Builder from the
console with a simple command:PyMB
On some
Linux distros, an entry for Model-Builder will show up on the programs menu under Science & Math.if you have also Downloaded the [http://sourceforge.net/project/showfiles.php?group_id=164374&package_id=213689&release_id=468580 examples package] from the sourceforge site, you can open the lotka-volterra2.ode model file.
Now, just press the little stopwatch button on toobar, the start button, to start the simulation. On completion, a line plot will pop-up with the result.The results can also be opened in a spreadsheet wher it can be further analyzed, graphed and exported to a csv file.
to write a model from scratch in Model-builder, a little knowledge about acceptable syntax is required.
Equations are written on the equations box which is situated on the top left part of the GUI. Equations may include symbols defined in the parameter box, as well as the time symbol, available automatically, since the model equations are considered as derivatives with respect to time.
General form of equations:
The general form of a differential equation is, for instance: .
In Model Builder, to simplify notaion, on the LHS of the equation we can put only the symbol of the State variable. So the equation above would become:. It is obvious that this equation is not mathematically equivalent to the real differential equation we are trying to calculate. But Model-Builder only uses the LHS of equations as a labels for the state variables. Only what is on the RHS of the equations is included in calculations. So make sure all you equations conform to these rules before entering them in the equation box. Note also that on the RHS of the equation became simply x. Whenever state variables appear on the RHS, they are assumed to be functions of time, so no explicit notation is necessary, or allowed. Equations may include symbols defined in the parameter box, locate on the right side of the GUI. Thus, in our simple example, the parameter must be defined like this (for instance): in the parameter box. Parameter expressions may not reference state space variables.
Both Equations and parameter expressions may also include the symbol (time) as well as any mathematical [http://www.scipy.org/Numpy_Example_List function defined in numerical python] , like for example .
Equations are to be entered according to Python's syntax for mathematical expressions. This means that basic arithmetic operators become:
Wikimedia Foundation. 2010.