All states explode to increase in Simulink using MPC toolbox
2 views (last 30 days)
Show older comments
Hi, I’m trying to simulate two wheel inverted pendulum model using MPC toolbox on Simulink but the simulation result doesn’t make sense. Please tell me what is wrong with my MATLAB code and Simulink.
FYM, this is the two wheel inverted pendulum model. θ,φ represents wheel angle and body angle respectively.
First of all, I defined the model according to this https://jp.mathworks.com/help/mpc/getting-started-with-model-predictive-control-toolbox.html
g =9.8100
Jb =8.5450e-04
Jw =2.0100e-06
l =0.0590
m =0.0190
M =0.2360
r =0.0210
X =0.1366
Y =5.2133e-04
Z =0.0028
A=[0 1 0 0 ; 0 0 0 0 ; 0 0 0 1 ; 0 0 X/Z 0 ];
B=[0 ; 1 ; 0 ; -Y/Z];
C=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];
D=[0];
inv=ss(A,B,C,D);
mpcDesigner;
Then, on the MPC Designer tab, in the MPC Structure section, I did like this and clicked “define and import”
Sample time= 0.1
Manipulated Variables = 1
Measured Outputs = [1;2;3;4]
Then, some plots appear on the MPC Designer tab.
Next, I exported the controller with no tuning nor weight nor constraints cus it seems not important in this prototype.
At last, I connected Simulink blocks like this, ref =[0;0;0;0], initial states of inv = [0;0;10;0] which means baby angle is a little bit tilted.
Once run the simulation, all states explode to increase.
I can’t tell why this happens and how to solve this problem. I think this might be the causes; All states have reference value, which seems impossible to be achieved.
Please teach me what is wrong with my whole process.
Thank you
0 Comments
Answers (0)
See Also
Categories
Find more on Controller Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!