Invalid setting in ‘Model’ for parameter ‘Gain’.
I am trying to tune a PID controller for controlling a plant model buit in Simulink. My aim is to obtain the gains of the PID controller using an optimization technique whose code is written in a script file. So, the objective function is calculated by obtaining the loged values from the simulink model. While I run my code, it always shows the error: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’, where the simulink file’s name is Model. Since I am tuning the gains using optimization, the are changing in each iteration. Kp, Ki, and Kd are the gains. The error is: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’.
function objective_func = F3(x)
Kp=x(1)
Ki=x(2)
Kd=x(3)
mdl = "Model";
open_system(mdl)
in = Simulink.SimulationInput(mdl)
out = sim(in)
simout = out.J(3001) %objective function value
objective_func=simout;
endI am trying to tune a PID controller for controlling a plant model buit in Simulink. My aim is to obtain the gains of the PID controller using an optimization technique whose code is written in a script file. So, the objective function is calculated by obtaining the loged values from the simulink model. While I run my code, it always shows the error: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’, where the simulink file’s name is Model. Since I am tuning the gains using optimization, the are changing in each iteration. Kp, Ki, and Kd are the gains. The error is: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’.
function objective_func = F3(x)
Kp=x(1)
Ki=x(2)
Kd=x(3)
mdl = "Model";
open_system(mdl)
in = Simulink.SimulationInput(mdl)
out = sim(in)
simout = out.J(3001) %objective function value
objective_func=simout;
end I am trying to tune a PID controller for controlling a plant model buit in Simulink. My aim is to obtain the gains of the PID controller using an optimization technique whose code is written in a script file. So, the objective function is calculated by obtaining the loged values from the simulink model. While I run my code, it always shows the error: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’, where the simulink file’s name is Model. Since I am tuning the gains using optimization, the are changing in each iteration. Kp, Ki, and Kd are the gains. The error is: Invalid setting in ‘Model/PID/Gain’ for parameter ‘Gain’.
function objective_func = F3(x)
Kp=x(1)
Ki=x(2)
Kd=x(3)
mdl = "Model";
open_system(mdl)
in = Simulink.SimulationInput(mdl)
out = sim(in)
simout = out.J(3001) %objective function value
objective_func=simout;
end simulink, gain block, optimization MATLAB Answers — New Questions