modestpy facilitates parameter estimation in models compliant with Functional Mock-up Interface.
Features:
- combination of global and local search methods (genetic algorithm, pattern search, truncated Newton method, L-BFGS-B, sequential least squares),
- suitable also for non-continuous and non-differentiable models,
- compatible with both Python 2.7 and 3.
It is now possible to install ModestPy through conda
:
conda config --add channels conda-forge conda install modestpy
This procedure has been tested on Debian 9 and Ubuntu 16.04 with Python 3.
It is advised to use conda
to install the required dependencies.
modestpy
itself can be installed using pip
inside the conda
environment.
Create separate environment (optional):
conda create --name modestpy conda activate modestpy
Install dependencies:
conda install scipy pandas numpy matplotlib conda install -c chria pyfmi conda install -c conda-forge pydoe
Install modestpy
:
python -m pip install modestpy
This procedure has been tested on Windows 7 with Python 2.
Install pyfmi
as part of JModelica.
To install modestpy
use pip
(other dependencies will be installed automatically):
python -m pip install modestpy
To get the latest development version download directly from GitHub repository:
python -m pip install https://github.com/sdu-cfei/modest-py/archive/master.zip
Note, that JModelica installs Python and libraries in a separate directory than the standard Python distribution. Therefore either the path to those libraries needs to be added to PYTHONPATH or ModestPy needs to be installed inside the JModelica distribution.
The unit tests will work only if you installed modestpy with conda or cloned the project from GitHub. To run tests:
>>> from modestpy.test import run
>>> run.tests()
or
cd <project_directory> python ./bin/test.py
Users are supposed to call only the high level API included in
modestpy.Estimation
. The API is fully discussed in this
wiki. You
can also check out this simple example. The basic
usage is as follows:
>>> from modestpy import Estimation
>>> session = Estimation(workdir, fmu_path, inp, known, est, ideal)
>>> estimates = session.estimate()
>>> err, res = session.validate()
More control is possible via optional arguments, as discussed in the documentation.
modestpy
automatically saves results in the working
directory including csv files with estimates and some useful plots,
e.g.:
- Error evolution in combined GA+PS estimation (dots represent switch from GA to PS):
- Visualization of GA evolution:
- Scatter matrix plot for interdependencies between parameters:
To cite ModestPy, please use:
K. Arendt, M. Jradi, M. Wetter, C.T. Veje, ModestPy: An Open-Source Python Tool for Parameter Estimation in Functional Mock-up Units, Proceedings of the American Modelica Conference 2018, Cambridge, MA, USA, October 9-10, 2018.
The preprint version of the conference paper presenting ModestPy is available here. The paper was based on v.0.0.8.
Copyright (c) 2017-2019, University of Southern Denmark. All rights reserved.
This code is licensed under BSD 2-clause license. See LICENSE file in the project root for license terms.