Tuning simulink PID parameters via external C++ code
2 views (last 30 days)
Show older comments
Hello. I implemented an optimization algorithm for dynamic environments and I need to try it on a real world problem or a simulation. In the simulation, there must be such environment that, the PID should require its parameters to get tuned time to time. Or there might be disruptive that can be controlled manually so we can make the environment dynamic. Note that my knowledge on simulink & matlab is limited. The PID in the simulation may control a robot or a motor or something like that. It is up to you experts.
My first question is: Is there any saved simulink file for that purpose? If not, is there any good tutorial to prepare that? Like tutorial for dummies :)
Secondly; my optimization algorithm will work like that:
set Kp,Kd,Ki randomly for initalizing
setPIDparams(Kp,Kd,Ki); //send values to the simulink
while(1)
error = getErrorViaSimulink(); //receive error from simulink
[Kp,Kd,Ki]=getNewParams(error) //run optimization algorithm to get new optimized PID params (minimize the error)
setPIDparams(Kp,Kd,Ki); //send values to the simulink
end
How can I make a protocol between C++ and Simulink easily? Any idea might be useful.
Again, note that: The environment must be dynamic or can be dynamic manually (I don't know maybe there is a chance to put a potentiometer in the simulation and makes us to control the environmental changes)
Note: I have Ubuntu 18.04 on my system with Matlab 2018b
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!