TI中文支持网
TI专业的中文技术问题搜集分享网站

PID

inline void PID_run(PID_Handle pidHandle,const float32_t refValue,const float32_t fbackValue,float32_t *pOutValue)
{PID_Obj *pid = (PID_Obj *)pidHandle;float32_t Error;			// PID internal variablesfloat32_t Up;float32_t Ui;uint32_t  index;			// Index value returned by arm min/max f32 functionsuint32_t  blocksize = 2;	// Block size for min/max value calculationfloat32_t minArg[2];		// Arguments for min functionfloat32_t maxArg[2];		// Arguments for max functionfloat32_t maxValue;		// Output of min functionfloat32_t minValue;		// output of max function// Update proportional outputError = refValue - fbackValue;Ui = pid->Ui;// load the previous integral outputUp = (pid->Kp * Error);// Compute the proportional output// Compute the integral output with saturation// Handle saturation minimum bound conditionminArg[0] = (Ui + (pid->Ki * Up));minArg[1] = pid->outMax;arm_min_f32(minArg,blocksize,&minValue,&index);// Handle saturation maximum bound conditionmaxArg[0] = minValue;maxArg[1] = pid->outMin;arm_max_f32 (maxArg,blocksize,&maxValue,&index);Ui = maxValue;pid->Ui = Ui;// store the intetral outputpid->refValue = refValue;pid->fbackValue = fbackValue;// Saturate the output// Handle saturation minimum bound conditionminArg[0] = Up + Ui;minArg[1] = pid->outMax;arm_min_f32(minArg,blocksize,&minValue,&index);// Handle saturation maximum bound conditionmaxArg[0] = minValue;maxArg[1] = pid->outMin;arm_max_f32 (maxArg,blocksize,&maxValue,&index);*pOutValue = maxValue;return;
} // end of PID_run() function

这段PID程序云行结束后输出的,是与refValue的偏值差还是,计算后应该设置的值

SZ1:

是后者。 

赞(0)
未经允许不得转载:TI中文支持网 » PID
分享到: 更多 (0)