pidtuner / pidtuner.github.io

Free PID Controller gains tuning tool
GNU General Public License v3.0
239 stars 27 forks source link

Question about sys id and documentation #8

Closed seanxu112 closed 3 years ago

seanxu112 commented 3 years ago

Hello,

I was trying to do sys id with least square approach and do some pole placement or lqr based on my first order model. And then I found out about your website.

It really takes out a lot of the work that I had to do. A few thing I want to ask.

  1. It seems like both first and second order model has a time delay in the base model. Is it possible to get rid of the delay? It might be easier for me to model the delay as slower response instead of a real delay for the purpose of pole placement.

  2. is there any documentation on how the tool is choosing the optimal parameter? The reasoning is if the tool did not find a set of param that works, tuning further would be harder.

Thank you for advance,

Sincerely, Sean

pidtuner commented 3 years ago

Hi Sean,

  1. You can manually overwrite any of the estimated model parameters. This way you can set the delay value to zero. Maybe this solves your problem?

  2. With optimal parameters do you mean the model parameters or the PID parameters (gains)? The model parameters are estimated using a typical nonlinear least squares algorithm. The PID parameters are calculated using Skogestad rules.

Glad you find this tool useful,

seanxu112 commented 3 years ago

Thanks for the paper link and the info. Is there a way to explicitly fit a model without delay? I played around with the parameters, but cannot guarantee the optimality.

Though maybe the model I have manually tuned is not far away from optimal first order model without delay (so it is completely usable), it is still good to know the optimal parameters. Purely for the sake of resting peacefully at night.

Sincerely, Sean

pidtuner commented 3 years ago

At the moment there is no way to "fix" a parameter during the system identification optimization routine. In any case the delay that the PIDTuner identifies is a "pure" delay, so even if you were able to fix it to zero during the optimization routine, it wouldn't affect much the estimation of the rest of the parameters (the values would be around the same).

You can test the previous doing the following;

  1. Run the PIDTuner with your original data (containing delay) and let it estimate your model with a delay "tao". Take a note on the value of the rest of your parameters.

  2. Take your original data, move it to excel or any other data processing software, use it to "shift" the input data over time to the right for "tao" seconds. Alternatively you can "shift" the output data left, but don't do both. This will have the effect of removing the delay from your data.

  3. Import the new "shifted" data into the PIDTuner (copy-paste) and run the identification algorithm again. This time it should have identified a zero tao delay. The rest of the parameters should be similar to the ones estimated with the original data.

pidtuner commented 3 years ago

You mentioned you would like to "model the delay as slower response instead of a real delay for the purpose of pole placement", in that case I suggest you take the tao estimated by the PIDTuner and apply a Pade approximation.