NLMPC state function parameters

조회 수: 16 (최근 30일)
Eduardo
Eduardo 2023년 1월 10일
I am currently developing a NLMPC controller for my system and the plant model described in the MPC uses a large array of parameters. Since I would like to adapt these parameters through my simulation I do not want to define them directly in my stateFcn.
According to the matlab documentation each one of the parameters should be define din the handle of the stateFcn, e.g.:
function stateFcCT(x, u, p1, p2, p3, p4, ..., p37)
These parameters are fed through a predefined bus which is also a little bit troublesome to define. There is no example using more than one parameter and since I am using an EKF I am not sure how to feed all these parameters into the EKF block....
Is there an easier way to define these parameters for my state functions?
I have tried using an external function but this seems to slow the simulations too heavily.
varargin also doesnt work in this case...

채택된 답변

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2023년 1월 24일
편집: Emmanouil Tzorakoleftherakis 2023년 1월 27일
Hi,
Given that it is not possible to package all variables into a struct and feed them into the MPC controller that way (it's not supported), one alternative would be to create a vector with all the desired values and pass it as a single variable to the state function. You can then index into the vector to access individual parameters as needed
  댓글 수: 3
Eduardo
Eduardo 2023년 1월 27일
I have tried using an IC block and also a signal specification block to get the dimension of the output but to not avail...
Eduardo
Eduardo 2023년 1월 27일
편집: Eduardo 2023년 1월 27일
I just found the source of error.
I am also using a Kalman filter to estimate the states from measurements and since it uses the state function the parameters should also go into the block.
Currently I commented out the filter just to see if the NLMPC runs and it does. Now the question would be how to input the array into the EKF so that it can be compiled

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Plant Specification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by