Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

FMI-compliant Model Estimation in Python

License

NotificationsYou must be signed in to change notification settings

sdu-cfei/modest-py

Repository files navigation

modestpy
unit_test_status
downloads

Description

ModestPy facilitates parameter estimation in models compliant withFunctional 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,
  • scalable to multiple cores (genetic algorithm frommodestga),
  • Python 3.

Due to time constraints, ModestPy is no longer actively developed. The last system known to work well was Ubuntu 18.04.Unit tests in GitHub Actions are run on Ubuntu 18.04 and Python 3.6/3.7.It does not mean it will not work on other systems, but it is not guaranteed.Use Docker (as described below) if you want to run ModestPy on a tested platform.

Installation with pip (recommended)

It is now possible to install ModestPy with a single command:

pip install modestpy

Alternatively:

pip install https://github.com/sdu-cfei/modest-py/archive/master.zip

Installation with conda

Conda is installation is less frequently tested, but should work:

conda config --add channels conda-forgeconda install modestpy

Docker

Due to time constraints, Modestpy is no longer actively developed.The last system known to work well was Ubuntu 18.04.If you encounter any issues with running ModestPy on your system (e.g. some libs missing), try using Docker.

I prepared aDockerfile and some initialmake commands:

  • make build - build an image with ModestPy, based on Ubuntu 18.04 (tag =modestpy)
  • make run - run the container (name =modestpy_container)
  • make test - run unit tests in the running container and print output to terminal
  • make bash - run Bash in the running container

Most likely you will like to modifyDockerfile andMakefile to your needs, e.g. by adding bind volumes with your FMUs.

Test your installation

The unit tests will work only if you installed ModestPy with conda or cloned the project from GitHub. To run tests:

>>>frommodestpy.testimportrun>>>run.tests()

or

cd <project_directory>python ./bin/test.py

Usage

Users are supposed to call only the high level API included inmodestpy.Estimation. The API is fully discussed in thedocs.You can also check out thissimple example.The basic usage is as follows:

frommodestpyimportEstimationif__name__=="__main__":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 thedocumentation.

Theif __name__ == "__main__": wrapper is needed on Windows, becausemodestpyrelies onmultiprocessing. You can find more explanation on why this is neededhere.

modestpy automatically saves results in the workingdirectory including csv files with estimates and some useful plots,e.g.:

  1. Error evolution in combined GA+PS estimation (dots represent switchfrom GA to PS):Error-evolution
  2. Visualization of GA evolution:GA-evolution
  3. Scatter matrix plot for interdependencies between parameters:Intedependencies

Cite

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 availablehere. The paper was based on v.0.0.8.

License

Copyright (c) 2017-2019, University of Southern Denmark. All rights reserved.

This code is licensed under BSD 2-clause license. SeeLICENSE file in the project root for license terms.


[8]ページ先頭

©2009-2025 Movatter.jp