-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added: adaptation of controller/estimator based on LinModel
#54
Conversation
…ld ones doc : reducing Hp no longer required for SLMPC (with bug fix)
@baggepinnen New model adaptation feature, related to #48 request. I don't ask to review everything, there is way too much modifications! Here's a quick summary: For the support of adaptive linear MPC and state estimators, I completely refactored the handling of the operating points (and also my notation in the doc/struct). The old implementation with See https://courses.engr.illinois.edu/ece486/fa2021/documentation/lectures/slides/Lecture25B_Linearization.pdf (slide 10) for the procedure on continuous dynamics at equilibrium (discrete case is similar). I added some details in
and I added an example of model adaptation based on successive linearization on the pendulum in the manual. The closed-loop response is very similar to the nonlinear MPC, and the computations are about 125 times faster, impressive! Note that MATLAB also support it (https://www.mathworks.com/help/mpc/ug/adaptive-mpc-control-of-nonlinear-chemical-reactor-using-successive-linearization.html) but inside the "Successive Linearizer" block is in fact the analytical derivative of the CSTR model. It's way more simple with I also added simple tests for |
LinModel
LinModel
I enabled |
I'll just merge into main and you can comment here for advices/corrections. They will be included in the next version. |
Hey! Sorry it takes me a while to get to things on github at the moment, I'm on parental leave so I have a new full-time job. :) I was initially a bit confused about what exactly "adaptation" referred to in this context, this is not adaptation as in adaptive control (example), but a heuristic way to achieve nonlinear MPC by solving linear MPC problems and using a new linearization at each time step? In any case, it sounds like a feature worth having! Having figured that out, it looks like the new feature is reached by linmodel = linearize(nonlinmodel; u, x=x̂[1:2])
setmodel!(mpc, linmodel) i.e., the user may call Questions: |
No worry, in the end open source development is voluntary work :). My working week is 4 days and I don't have kids, so more time available. The "p" should be in subscript. The correct additive constant to update the deviation vector of the state A mistake in FYI, MATLAB call the two operating points There is two approaches for adaptation of a linear plant model. To quote MATLAB doc (the link with the CSTR example above):
I applied the first approach in the manual since it was straightforward, and it shows how to correctly call The P.S. In your adaptive MPC example, I don't understand why and how the OSQP solver (quadratic programming) is used to solve the optimization problem if the plant model is nonlinear (it should be a nonlinear program). You also perform succesive linearization ? |
I use SQP (sequential quadratic programming), so I linearize around the trajectory, solve QP, linearize again and iterate |
Oh I see, you implemented it yourself ? Impressive! A FOSS SQP method is lacking in the current JuMP ecosystem. If I understand correctly, my sequential linearization MPC is equivalent to your solution with one iteration. |
Yeah, but I also wish there was a robust solution available in the ecosystem, my solver is not battle tested and likely not as robust as I'd like.
Not quite, you linearize in a single point before each solve, and before the next solve linearize in a new point. SQP instead linearizes around the trajectory of the previous solution, i.e., before each solve, the model is linearized in |
No description provided.