|
float PID_realize(float speed)
{
pid.ActualSpeed=out;
pid.SetSpeed=speed;
pid.err=pid.SetSpeed-pid.ActualSpeed;
pid.incrementSpeed=pid.Kp*(pid.err-pid.err_next)+pid.Ki*pid.err;
// +pid.Kd*(pid.err-2*pid.err_next+pid.err_last);
pid.u+=pid.incrementSpeed;
//pid.err_last=pid.err_next;
pid.err_next=pid.err;
return pid.u;
};
out=ADI1*0.006; out是AD采样值
y=150*PID_realize(utemp); Y是占空比 utemp是设定值
BUCK电路可以用 但是BOOST 就不行了,Y一直跑飞!
请问是什么原因呢 |
|