Model Predictive Control (MPC) Weight Tuning
5 ビュー (過去 30 日間)
古いコメントを表示
Hello!
I am working on building an MPC controller for an active suspension. However, I am finding that the controller is not performing significantly better than the system by itself. I have attached my code below. One issue I keep getting is that when I change the weight of every other output variable to be greater than 1, it gives me an error (the outputs alternate between the change in displacement of the suspension components and the ROC - the ROC variables are the ones causing the issue). The other displacement outputs give no issues when changed. I have posted the error message below the code.
The simulation I am running is that it simply introduces a step input at t=2. If anyone could give some tips on tuning, I would greatly appreciate it because right now I am not having any luck. Thank you!
model=ss(A,B,C,D);
Ts=.01;
model.InputName={'Xrf', 'Xrr', 'faf', 'far'}; %designates the 4 inputs of the model
model.OutputName={'X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8', 'X9', 'X10', 'X11', 'X12', 'X13','X14'}; %designates the outputs as all the states
model.StateName={'X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8', 'X9', 'X10', 'X11', 'X12','X13','X14'}; %designates the states of the model
model.InputGroup.MV=[3 4]; %designates the indices for the 2 manipulated variables
model.InputGroup.UD=[1 2]; %designates the indices for the 2 unmeasured disturbances
model.OutputGroup.MO=[1 2 3 4 5 6 7 8 9 10 11 12 13 14]; %designates the indices for the 12 outputs
p=10; %prediction horizon
m=3; %control horizon
weights=struct('ManipulatedVariables',[.01 .01],'ManipulatedVariablesRate',[.01 .01],'OutputVariables',[1 1 1 1 1 1 1 1 1 1 1 1 1 1]); %creates the weights for all the inputs and outputs
manipulated(1)=struct('Name','faf','Min',-Inf,'Max',Inf); %specifies which of the inputs are manipulated
manipulated(2)=struct('Name','far','Min',-Inf,'Max',Inf);
for i =1:length(model.OutputName) %specifies the output names
name=strcat('X',num2str(i));
output(i)=struct('Name',name,'Max',Inf,'Min',-Inf);
end
disturbance(1)=struct('Name','Xrf'); %specifies which of the inputs are disturbances
disturbance(2)=struct('Name','Xrr');
MPC=mpc(model,Ts,p,m,weights,manipulated,output,disturbance); %creates the MPC object
%review(MPC)
IC=[0 0 0 0 0 0 0 0 0 0 0 0 0 0];
state=mpcstate(MPC);
state.PLANT=IC;
time=[0:Ts:8];
time_between_inputs=.4;
for i =1:length(time)
if time(i)>=2
u1(i)=1;
else
u1(i)=0;
end
if time(i)>=2+time_between_inputs
u2(i)=1;
else
u2(i)=0;
end
end
u1=transpose(u1);
u2=transpose(u2);
u=[u1 u2];
for i =1:length(time)
for j=1:length(model.OutputName)
if time(i)>=2
if mod(j,2)==0 || j==13
ref(i,j)=0;
else
ref(i,j)=1;
end
else
ref(i,j)=0;
end
end
end
simoptions=mpcsimopt(MPC);
simoptions.UnmeasuredDisturbance=u;
simoptions.PlantInitialState=IC;
simoptions.ControllerInitialState=state;
[outputs,t,force_input,states]=sim(MPC,length(time),ref,simoptions);
Error using mpcstate (line 82)
Problems encountered when designing the default state estimator (Kalman filter) used by MPC.
The "kalman" command could not compute a convergent Kalman estimator for this combination of plant, disturbance and noise
models.
To remedy the problem:
(1) Make sure that the plant model has minimal realization.
(2) Change disturbance and noise models such that all the states are observable.
Error in Half_Car_Model_Edit (line 214)
state=mpcstate(MPC);
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Model Predictive Control Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!