-
Notifications
You must be signed in to change notification settings - Fork 2
Support nonlinear estimator with linear model predictive control #205
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
Comments
It is possible right now only if the plant model is identical in the state estimator and in the linear mpc, hence only with linear plant model. The only reason was to simplify the constructor (I fetch the plant model at My only concern is how to "enforce" that the state-space realization in the state estimator is close enough to the state-space realization of the controller model (if there is two arguments at construction). The only thing we can check is the state vector length, it seems to me. Another solution would be #142. The @baggepinnen I think this feature is supported in JuliaSimControl ? How do you deal these aspects if that's the case? |
Both a |
Yeah so the |
I suppose it would be for a successive linearization MPC? What I have in mind is an API like this: model = NonLinModel( ... )
x_init, u_init = ... # specify the initial linearization point here
linModel = linearize(model, x=x_init, u=u_init)
nint_ym = ... # specify a custom model augmentation scheme here if needed
custom = CustomEstimator(linModel, nint_ym)
mpc = LinearMPC(custom)
estim = UnscentedKalmanFilter(model, nint_ym)
for i=1:10
y = ... # get current measured outputs
x̂ = preparestate!(estim, y) # correct UKF state estimate
preparestate!(mpc, y) # do nothing at all, can be omitted
setstate!(mpc, x̂) # update MPC with the UKF corrected state
u = moveinput!(mpc)
x = x̂[1:end-sum(nint_ym)]
linearize!(linModel, model, x, u)
setmodel!(mpc, linModel)
x̂ = updatestate!(estim, u, y) # update UKF state estimate
updatestate!(mpc, u, y) # do nothing except store u as the lastu value
setstate!(mpc, x̂) # update MPC with the UKF updated state
end Would it be something that match your need ? |
The optimizer isn't concerned with how the state estimate is produced, it can come from anywhere. In our higher-level simulation routines, we allow any estimator that produces a state of the correct dimension. In practice, it will of course only work if the state represents the same thing in the controller and optimizer model. The state of the "actual" system and the state of the estimator are separate things in JSC, making it easy to use any estimator with any model. |
Yes
Yes I think that makes a lot of sense |
I'm shedding bike here, but In essence, the new type would behave like this: "when you will call You can vote: 👍 |
NoEstimator or ManualEstimator? It sounds like the option turns off the built in estimator? |
Yes it turn off the builtin estimator. The object is only there to pass the necessary information to construct the predictive controller (e.g. the state augmentation scheme). I like |
FYI @1-Bart-1 I decided to move the storing of model = NonLinModel( ... )
x_init, u_init = ... # specify the initial linearization point here
linModel = linearize(model, x=x_init, u=u_init)
nint_ym = ... # specify a custom model augmentation scheme here if needed
man = ManualEstimator(linModel, nint_ym)
mpc = LinearMPC(man)
estim = UnscentedKalmanFilter(model, nint_ym)
for i=1:10
y = ... # get current measured outputs
x̂ = preparestate!(estim, y) # correct UKF state estimate
preparestate!(mpc, y) # do nothing at all, can be omitted
setstate!(mpc, x̂) # update MPC with the UKF corrected state
u = moveinput!(mpc)
x = x̂[1:end-sum(nint_ym)]
linearize!(linModel, model, x, u)
setmodel!(mpc, linModel)
x̂ = updatestate!(estim, u, y) # update UKF state estimate
updatestate!(mpc, u, y) # CHANGED: do nothing at all, can be omitted
setstate!(mpc, x̂) # update MPC with the UKF updated state
end |
Uh oh!
There was an error while loading. Please reload this page.
Is there any reason this cannot be done? It would improve the state estimation of non-measured states while still keeping good performance.
https://github.com/JuliaControl/ModelPredictiveControl.jl/blob/db2827a5ee43b207a7d1bea46d612d1bbc079831/src/controller/linmpc.jl#L259C1-L259C80
The text was updated successfully, but these errors were encountered: