ModelPredictiveControl

An open source model predictive control package for Julia.

https://github.com/juliacontrol/modelpredictivecontrol.jl

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.7%) to scientific vocabulary

Keywords

automatic-control control-systems feedback-systems feedforward-control julia linear-control linear-dynamic-systems model-predictive-control moving-horizon-estimation nonlinear-control nonlinear-dynamics state-estimation

Keywords from Contributors

automatic-differentiation pde numerical
Last synced: 6 months ago · JSON representation ·

Repository

An open source model predictive control package for Julia.

Basic Info
Statistics
  • Stars: 97
  • Watchers: 5
  • Forks: 2
  • Open Issues: 6
  • Releases: 103
Topics
automatic-control control-systems feedback-systems feedforward-control julia linear-control linear-dynamic-systems model-predictive-control moving-horizon-estimation nonlinear-control nonlinear-dynamics state-estimation
Created over 3 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

ModelPredictiveControl.jl

Build Status codecov doc-stable doc-dev

An open source model predictive control package for Julia.

The package depends on ControlSystemsBase.jl for the linear systems, JuMP.jl for the optimization and DifferentiationInterface.jl for the derivatives.

Installation

To install the ModelPredictiveControl package, run this command in the Julia REPL:

julia using Pkg; Pkg.add("ModelPredictiveControl")

Getting Started

To construct model predictive controllers (MPCs), we must first specify a plant model that is typically extracted from input-output data using system identification. The model here is linear with one input, two outputs and a large time delay in the first channel (a transfer function matrix, with $s$ as the Laplace variable):

math \mathbf{G}(s) = \frac{\mathbf{y}(s)}{\mathbf{u}(s)} = \begin{bmatrix} \frac{2e^{-20s}}{10s + 1} \\[3pt] \frac{10}{4s +1} \end{bmatrix}

We first construct the plant model with a sample time $T_s = 1$ s:

julia using ModelPredictiveControl, ControlSystemsBase G = [ tf( 2 , [10, 1])*delay(20) tf( 10, [4, 1]) ] Ts = 1.0 model = LinModel(G, Ts)

Our goal is controlling the first output $y1$, but the second one $y2$ should never exceed 35:

julia mpc = LinMPC(model, Mwt=[1, 0], Nwt=[0.1]) mpc = setconstraint!(mpc, ymax=[Inf, 35])

The keyword arguments Mwt and Nwt are the output setpoint tracking and move suppression weights, respectively. A setpoint step change of five tests mpc controller in closed-loop. The result is displayed with Plots.jl:

julia using Plots ry = [5, 0] res = sim!(mpc, 40, ry) plot(res, plotry=true, plotymax=true)

StepChangeResponse

See the manual for more detailed examples.

Features

Model Predictive Control Features

  • linear and nonlinear plant models exploiting multiple dispatch
  • model linearization based on automatic differentiation (exact Jacobians)
  • supported objective function terms:
    • output setpoint tracking
    • move suppression
    • input setpoint tracking
    • terminal costs
    • custom economic costs (economic model predictive control)
  • control horizon distinct from prediction horizon and custom move blocking
  • adaptive linear model predictive controller
    • manual model modification
    • automatic successive linearization of a nonlinear model
    • objective function weights and covariance matrices modification
  • explicit predictive controller for problems without constraint
  • online-tunable soft and hard constraints on:
    • output predictions
    • manipulated inputs
    • manipulated inputs increments
    • terminal states to ensure nominal stability
  • custom nonlinear inequality constraints (soft or hard)
  • supported feedback strategy:
    • state estimator (see State Estimation features)
    • internal model structure with a custom stochastic model
  • automatic model augmentation with integrating states for offset-free tracking
  • support for unmeasured model outputs
  • feedforward action with measured disturbances that supports direct transmission
  • custom predictions for (or preview):
    • output setpoints
    • measured disturbances
    • input setpoints
  • easy integration with Plots.jl
  • optimization based on JuMP.jl to quickly compare multiple optimizers:
    • many quadratic solvers for linear control
    • many nonlinear solvers for nonlinear control (local or global)
  • derivatives based on DifferentiationInterface.jl to compare different approaches:
    • automatic differentiation (exact solution)
    • symbolic differentiation (exact solution)
    • finite difference (approximate solution)
  • supported transcription methods of the optimization problem:
    • direct single shooting
    • direct multiple shooting
    • trapezoidal collocation
  • additional information about the optimum to ease troubleshooting
  • real-time control loop features:
    • implementations that carefully limits the allocations
    • simple soft real-time utilities

State Estimation Features

  • supported state estimators/observers:
    • steady-state Kalman filter
    • Kalman filter
    • Luenberger observer
    • internal model structure
    • extended Kalman filter
    • unscented Kalman filter
    • moving horizon estimator
  • disable built-in observer to manually provide your own state estimate
  • easily estimate unmeasured disturbances by adding one or more integrators at the:
    • manipulated inputs
    • measured outputs
  • bumpless manual to automatic transfer for control with a proper initial estimate
  • estimators in two possible forms:
    • filter (or current) form to improve accuracy and robustness
    • predictor (or delayed) form to reduce computational load
  • moving horizon estimator in two formulations:
    • linear plant models (quadratic optimization)
    • nonlinear plant models (nonlinear optimization)
  • moving horizon estimator online-tunable soft and hard constraints on:
    • state estimates
    • process noise estimates
    • sensor noise estimates

Owner

  • Name: JuliaControl
  • Login: JuliaControl
  • Kind: organization

Control Systems Design in Julia

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite the article below."
authors:
  - name:  "ModelPredictiveControl.jl contributors"
title: "ModelPredictiveControl.jl - An open source model predictive control package for Julia."
url: "https://github.com/JuliaControl/ModelPredictiveControl.jl"
preferred-citation:
  type: generic
  authors:
    - family-names: "Gagnon"
      given-names: "Francis"
    - family-names: "Thivierge"
      given-names: "Alex"
    - family-names: "Desbiens"
      given-names: "André"
    - family-names: "Bagge Carlson"
      given-names: "Fredrik"
  title: "ModelPredictiveControl.jl: advanced process control made easy in Julia"
  year: 2024
  doi: "10.48550/arXiv.2411.09764"
  url: "https://arxiv.org/abs/2411.09764"

GitHub Events

Total
  • Create event: 116
  • Commit comment event: 52
  • Release event: 27
  • Issues event: 27
  • Watch event: 31
  • Delete event: 81
  • Issue comment event: 328
  • Push event: 882
  • Pull request review comment event: 7
  • Pull request review event: 8
  • Pull request event: 176
  • Fork event: 2
Last Year
  • Create event: 116
  • Commit comment event: 52
  • Release event: 27
  • Issues event: 27
  • Watch event: 31
  • Delete event: 81
  • Issue comment event: 328
  • Push event: 882
  • Pull request review comment event: 7
  • Pull request review event: 8
  • Pull request event: 176
  • Fork event: 2

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 1,033
  • Total Committers: 4
  • Avg Commits per committer: 258.25
  • Development Distribution Score (DDS): 0.02
Past Year
  • Commits: 599
  • Committers: 3
  • Avg Commits per committer: 199.667
  • Development Distribution Score (DDS): 0.018
Top Committers
Name Email Commits
franckgaga f****2@g****m 1,012
CompatHelper Julia c****y@j****g 10
Francis Gagnon 3****a 8
Fredrik Bagge Carlson b****n@g****m 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 18
  • Total pull requests: 121
  • Average time to close issues: 20 days
  • Average time to close pull requests: 2 days
  • Total issue authors: 5
  • Total pull request authors: 5
  • Average comments per issue: 5.17
  • Average comments per pull request: 1.13
  • Merged pull requests: 105
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 13
  • Pull requests: 72
  • Average time to close issues: 28 days
  • Average time to close pull requests: 1 day
  • Issue authors: 3
  • Pull request authors: 4
  • Average comments per issue: 6.0
  • Average comments per pull request: 1.46
  • Merged pull requests: 56
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • franckgaga (19)
  • 1-Bart-1 (7)
  • caxelrud (3)
  • ufechner7 (2)
  • pekpuglia (1)
  • acxz (1)
  • baggepinnen (1)
Pull Request Authors
  • franckgaga (194)
  • baggepinnen (8)
  • github-actions[bot] (3)
  • dependabot[bot] (2)
  • gdalle (1)
Top Labels
Issue Labels
enhancement (1) wontfix (1)
Pull Request Labels
dependencies (2) github_actions (2) benchmark (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 11 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 103
juliahub.com: ModelPredictiveControl

An open source model predictive control package for Julia.

  • Versions: 103
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 11 Total
Rankings
Dependent repos count: 9.9%
Dependent packages count: 38.9%
Average: 41.6%
Forks count: 53.5%
Stargazers count: 64.2%
Last synced: 6 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v3 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/documentation.yml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia v1 composite