Arduino-PID-Library icon indicating copy to clipboard operation
Arduino-PID-Library copied to clipboard

How can I compute new pid coeff from old ones based on

Open JulienDevillers opened this issue 1 year ago • 2 comments

Hello

I'm driving the pwm of an electric motor with a pid controler. It works pretty well.

After some testings, I realized that the fact that the motor is powered by a battery makes the system behave differently depending on the battery voltage.

I will change the system in order to make the pid system control the voltage provided to the motor instead of the pwm ; another system will do the conversion V -> PWM based on the battery voltage. Therefore, I expect the same behaviour whatever the battery voltage (if of course, the pid does not ask for a voltage more than battery voltage)

Concretely, PID will not control values from 0 to 20k (pwm period) but 0 to 8400 (mV).

My question is: Is there a mathematical way to compute the new PID coefficients from the old ones to get the same behaviour with the new actuator without having to go again to a new pid tuning session?

Thanks.

JulienDevillers avatar Nov 10 '24 13:11 JulienDevillers

So an output range of of 0-20k is now 0-8.4k, and the rest of the loop is equivalent? If so, then the controller is now 2.4x (20/8.4) more powerful. That is, an output change of 1 means 2.4x more process change than it used to. As a result, dividing the 3 coefficients by 2.4 should make the pid output with the same oomph as before the conversion

On Sun, Nov 10, 2024, 8:26 AM Julien Devillers @.***> wrote:

Hello

I'm driving the pwm of an electric motor with a pid controler. It works pretty well.

After some testings, I realized that the fact that the motor is powered by a battery makes the system behave differently depending on the battery voltage.

I will change the system in order to make the pid system control the voltage provided to the motor instead of the pwm ; another system will do the conversion V -> PWM based on the battery voltage. Therefore, I expect the same behaviour whatever the battery voltage (if of course, the pid does not ask for a voltage more than battery voltage)

Concretely, PID will not control values from 0 to 20k (pwm period) but 0 to 8400 (mV).

My question is: Is there a mathematical way to compute the new PID coefficients from the old ones to get the same behaviour with the new actuator without having to go again to a new pid tuning session?

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/br3ttb/Arduino-PID-Library/issues/147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACYX4Q47M56QSH5TXQ6VDTZ75NHZAVCNFSM6AAAAABRQG4JYWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2DOMRSHEZTQNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

br3ttb avatar Nov 17 '24 12:11 br3ttb

Hi Brett,

Thanks for your answer, it was obvious for p, but a confirmation for i and d was useful!

Le dim. 17 nov. 2024 à 13:35, br3ttb @.***> a écrit :

So an output range of of 0-20k is now 0-8.4k, and the rest of the loop is equivalent? If so, then the controller is now 2.4x (20/8.4) more powerful. That is, an output change of 1 means 2.4x more process change than it used to. As a result, dividing the 3 coefficients by 2.4 should make the pid output with the same oomph as before the conversion

On Sun, Nov 10, 2024, 8:26 AM Julien Devillers @.***> wrote:

Hello

I'm driving the pwm of an electric motor with a pid controler. It works pretty well.

After some testings, I realized that the fact that the motor is powered by a battery makes the system behave differently depending on the battery voltage.

I will change the system in order to make the pid system control the voltage provided to the motor instead of the pwm ; another system will do the conversion V -> PWM based on the battery voltage. Therefore, I expect the same behaviour whatever the battery voltage (if of course, the pid does not ask for a voltage more than battery voltage)

Concretely, PID will not control values from 0 to 20k (pwm period) but 0 to 8400 (mV).

My question is: Is there a mathematical way to compute the new PID coefficients from the old ones to get the same behaviour with the new actuator without having to go again to a new pid tuning session?

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/br3ttb/Arduino-PID-Library/issues/147, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AACYX4Q47M56QSH5TXQ6VDTZ75NHZAVCNFSM6AAAAABRQG4JYWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2DOMRSHEZTQNI>

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/br3ttb/Arduino-PID-Library/issues/147#issuecomment-2481249622, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUD2A7KY35VGIAKPLAZ5C32BCEQVAVCNFSM6AAAAABRQG4JYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBRGI2DSNRSGI . You are receiving this because you authored the thread.Message ID: @.***>

JulienDevillers avatar Nov 19 '24 12:11 JulienDevillers