PID constants

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

PID constants

912 次查看
binukannur
Contributor III

Hai,

  Iam using HCS08 and codewarrior studio.    I implemented a PID algorithm for a generator speed control by  valve control  using stepper motor. Here Iam measuring rpm of generator with hall effect  sensor as  a feedback.

It works fine, but in this algorithm I changed my Kp,Ki,Kd constants in different conditions. ie nearest of setpoint I changed these constants to get fine values and if there is a big difference changed to get large error value.

 

My question is , can i change PID constants in running condition? Is it favourable ?

标签 (1)
0 项奖励
回复
3 回复数

601 次查看
trytohelp
NXP Employee
NXP Employee

Hi,

To investigate the problem we need more info.

What is the development tool version you're using ?

Please can you provide us to code or example code  showing the behavior ?


Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

601 次查看
binukannur
Contributor III

Hai,

      Iam using   Code Warrior Development studio V.10.6, and controller MC9s08DZ128.

Here is the bit of code we want to investgate.

  if(count > (rpm_setpoint-4) && count <(rpm_setpoint+4))//fine tune PID constants when setpoint reached

     {

      PID=PID_Compute(0.5,0.2,0.01,1,-5,5);//kp, ki, kd, dt(time intervell) , outmin, outmax

     }

     else

     {

     PID=PID_Compute(1,0.5,0.25,1,-20,20);//kp,ki,kd,dt,outmin,outmax

     }

//////////////////////////////////////////////////

count  -- it is the feedback value .here it is generator RPM input

rpm_setpoint  --- set point

PID_Compute---- PID function

PID----  it is the output

outmin,outmax  -- Iterm minimum and max value.

In the first loop , PID value is small and in the second loop PID value is high compared to first.

So if there is a large error the second loop will run and faster the adjustments.

0 项奖励
回复

601 次查看
kef2
Senior Contributor V

What do you do to PID integral when you change PID constants? If close to the right anti windup control is implemented, then at least you should recalculate PID integral every time you change PID constants. IMO it is totally wrong to change PID constants (constants!) on the flight.