Table Of Contents

ModelicaRes

Python utilities to set up and analyze Modelica simulation experiments

ModelicaRes is a free, open-source tool to manage Modelica simulations, interpret results, and create publishable figures. It is possible to

  • Auto-generate simulation scripts,
  • Browse data,
  • Perform custom calculations, and
  • Produce various plots and diagrams.

The figures are generated via matplotlib, which offers a rich set of plotting routines. ModelicaRes includes convenient functions to automatically pre-format and label some figures, like xy plots, Bode and Nyquist plots, and Sankey diagrams. ModelicaRes can be scripted or run from a Python interpreter with math and matrix functions from NumPy.

Variable browser Nyquist plot of PID with varying differential time constant

Plot of Chua circuit Sankey digarams of three tanks model

The links below and in the sidebar describe the components of ModelicaRes. For an introduction, please see loadres, which loads data files and provides a Python interpreter to help analyze them.

The top-level module, modelicares, provides direct access to the most important classes and functions. Others must be accessed through their submodules. The modelicares.simres submodule has classes to load, analyze, and plot simulation results. The modelicares.linres submodule has a class to load, analyze, and plot results from linearizing a model. The modelicares.multi submodule has functions to load and plot results from multiple data files at once. The modelicares.exps submodule has tools to set up and manage simulation experiments. The modelicares.texunit submodule has functions to translate Modelica unit and displayUnit strings into LaTeX-formatted strings. The last submodule, modelicares.base, has general supporting functions.

For a list of changes, please see the changelog. A PDF version of this documentation is available here.

Installation

The easiest way to install this package is to use pip:

pip install modelicares

On Linux, it may be necessary to have root privileges:

sudo pip install modelicares

Another way is to download and extract a copy of the package from the main project site, the master branch at GitHub, or the PyPI page. Run the following command from the base folder:

python setup.py install

Or, on Linux:

sudo python setup.py install

The matplotlibrc file in the base folder has some recommended revisions to matplotlib‘s defaults. To use it, copy or move it to the working directory or matplotlib‘s configuration directory. See http://matplotlib.org/users/customizing.html for details.

Credits

The main author is Kevin Davies. Improvements, bug fixes, and suggestions have been provided by Arnout Aertgeerts, Kevin Bandy, Thomas Beutlich, Martin Sjölund, Mike Tiller, and Michael Wetter.

Third-party code has been included from:

License terms and development

ModelicaRes is published under a BSD license (see LICENSE.txt). Please share any modifications you make (preferably on a Github fork from https://github.com/kdavies4/ModelicaRes) in order to help others. If you find a bug, please report it. If you have suggestions, please share them.

See also

The following Python projects are related: