MATLAB: Simulink PID autotuning problem

autotuningpidsimulinkSimulink Control Design

Hi, I have tried simple PID auto tuning function, but I'm getting rather strange result. I have attached mdl file, so You can maybe point to me where I'm doing wrong.
Pete
P.S. Sorry if question sounds stupid, I'm a newbie in Matlab/Simulink world

Best Answer

There is nothing wrong or strange with your model. You did not provide op_trim1 operating point that your model uses, so I just initialized the integrator in PID block at 6.37 (I can explain how I did this if you want) - basically to get rid of a large initial transient.
Once I did that, and ran the simulation with your PID gains, I got a reasonable response:
Another note: as gravity is somethign that does not change much, you can just add a constant feedforward term to your controller to compensate for it. Then, even if gravity changes a bit as you change locations, PID will do a good job compensating for that: