Trying to understand dimensions of state estimates output of MPC block in Simulink

조회 수: 3 (최근 30일)
I'm running an MPC in Simulink that was defined in a matlab script using the MPC Controller block and I want to inspect the state estimates of the observer which is the default input disturbance observer defined as follows:
setindist(mpcobj,'integrators');
The MPC model has 20 states:
>> size(mpcobj)
MPC controller with 4 measured output(s), 0 unmeasured output(s),
3 manipulated input(s), 0 measured disturbance(s), 3 unmeasured disturbance(s)
I wanted to check the state estimates so I selected the option to include them as an output.
However, the size of the state estimates vector is 24.
>> size(out.X_EST)
ans =
1501 24
I want to compute the estimated outputs (x3), so I need the C matrix for the observer model, which must be 3 x 24 presumably.
Whereas, the size of the plant model C matrix is 4 x 20:
>> size(mpcobj.Model.Plant.C)
ans =
4 20
What are the extra 4 states of the estimator and how do I compute the estimated outputs from these?

채택된 답변

Bill Tubbs
Bill Tubbs 2022년 9월 30일
편집: Bill Tubbs 2022년 9월 30일
I figured out that you can use the following to get all the parameters of the Kalman Filter including the augmented model used by the observer:
>> [L, M, A, Cm, Bu, Bv, Dvm] = getEstimator(mpcobj);
>> Cm * out.X_EST(end, :)'
ans =
6.8182
2.2083
1.2348
0.0001
Can I get this Cm matrix in simulink so I can calculate the output estimates during the simulation?
I couldn't find a way so I used a from-workspace block to get the precalculated Cm matrix and used it to copmute the output estimates like this. If anyone knows a simpler way, please let me know!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Refinement에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by