Skip to content

This repo contains the code related to the paper "Parallelizable Parametric Nonlinear System Identification via tuning of a Moving Horizon State Estimator"

License

Notifications You must be signed in to change notification settings

Leo-Simpson/MHE4SysId

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MHE4SysId

This repository contains the code associated to the paper Parallelizable Parametric Nonlinear System Identification via tuning of a Moving Horizon State Estimator by Léo Simpson, Jonas Asprion, Simon Muntwiler, Johannes Köhler and Moritz Diehl.

Please refer to the paper for explanations of the content of the code here.

Organization of the files

  • The files in the folder SCRIPTS/ contain Python script that correspond to the experiments described in the paper, with the exception of example1(noplot).py and example2(noplot).py, which are not related to the examples of the paper, but more examples to use the code.

    • example1(noplot).py test our the algorithm on a simple linear SISO system.
    • example2(noplot).pytest our the algorithm on a simple linear MIMO system.
    • illustration_MHE(plot).py creates an illustration for MHE, Fig. 1 of the paper.
    • counterex(plot).py runs the experiment leading to Fig. 2 of the paper. Basically a very simple example, but with a lot of realizations with growing horizons, which shows the convergence or not of the methods.
    • illustration_3D_Lorenz(plot).py creates a 3D illustration of the Lorenz oscillator, Fig. 3 of the paper.
    • trajectories_Lorenz(plot).py creates a plot for some trajectories of the Lorenz oscillator together with the associated measurement: Fig. 4 of the paper.
    • estimates_Lorenz(generate).py is the long experiment leading to Fig. 5 of the paper. It estimates parameters in the Lorenz system for 4*10 different datasets (10 realizations for 4 true parameters). The results are saved in a pickle file.
    • estimates_Lorenz(plot).py loads the pickle file generated by estimates_Lorenz(generate).py and creates Fig. 5 of the paper.
  • The files in the folder SOURCE/ contain Python scripts that correspond to the algorithms used in this work. It should be noted that a large amount of the code uses CasADi (a package for automatic differentation), so it is sometimes difficult to track what is exactly going on (some methods create casadi-functions, that are passsed to other methods, etc).

    • nlp.py create a data-structure for formulating Nonlinear Programs (NLPs) with CasADi (similar to OptiStack, but hand-made).
    • ipopt.py for the functions related to IPOPT solving some optimization problems.
    • opti.py for our optimization algorithm, based on iteratively solve some esaier problems, through linearization.
    • lti_method.py implement our method, but specifically in the case of LTI system. In this case, the method can be made way faster, because only the sample covariance of the data subsequences is used. So even for large amount of subsequences (e.g. $10^6$), the method remains fast.
    • misc_method.py a large amount of miscellaneous functions used in the other files to implement the method. It is usually to functions to create useful casadi functions (e.g. for the arrival cost, the constraints in MHE, etc).
    • initial_guess.py: solve the arrival-cost-free MHE problems to estimate x0 and on its covariance matrix (which will be used as initial guess for the arrival costs).
    • method.py mainly a wrapper to assemble the different important functions (such as initial guess, building the arrival cost, building the NLP, solving the NLP, etc) to implement the method described in the paper. It also treats all the if conditions due to the different options (LTI vs NL, arrival cost or not, etc).
    • vanilla_method.py this creates a vanilla implementation of the problem by simply giving it to IPOPT without any special treatment. This is not currently used in the scripts, but might be useful.
    • simple_MHE.py simple MHE implementation. Actually not used in the algorithm, but used in the script illustration_MHE(plot).py to create an illustration of MHE.
  • The files in the folder UTILS/ contain utility functions used in the scripts:

    • models.py for creatinf the models
    • simulation.py for simulating the models
    • data_prepare.py for data pre-processing functions
    • plotting.py for functions related to plotting
  • In the folder FIGURES/ one might find the figures generated by the scripts in SCRIPTS/, and presented in the paper.

About

This repo contains the code related to the paper "Parallelizable Parametric Nonlinear System Identification via tuning of a Moving Horizon State Estimator"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages