static inline _iq FILTER_FO_run(FILTER_FO_Handle handle,const _iq inputValue)
{
FILTER_FO_Obj *obj = (FILTER_FO_Obj *)handle;
_iq a1 = obj->a1;
_iq b0 = obj->b0;
_iq b1 = obj->b1;
_iq x1 = obj->x1;
_iq y1 = obj->y1;
// compute the output
_iq y0 = _IQmpy(b0,inputValue) + _IQmpy(b1,x1) – _IQmpy(a1,y1);
// store values for next time
obj->x1 = inputValue;
obj->y1 = y0;
return(y0);
} // end of FILTER_FO_run() function
//! \brief Runs a first-order filter of the form
//! y[n] = b0*x[n] – a1*y[n-1]
//!
//! \param[in] handle The filter handle
//! \param[in] inputValue The input value to filter
//! \return The output value from the filter
static inline _iq FILTER_FO_run_form_0(FILTER_FO_Handle handle,const _iq inputValue)
{
FILTER_FO_Obj *obj = (FILTER_FO_Obj *)handle;
_iq a1 = obj->a1;
_iq b0 = obj->b0;
_iq y1 = obj->y1;
// compute the output
_iq y0 = _IQmpy(b0,inputValue) – _IQmpy(a1,y1);
// store values for next time
obj->y1 = y0;
return(y0);
} // end of FILTER_FO_run_form_0() function
这两个滤波器有什么不一样? 使用场合有什么不同?
Eric Ma:
你是在哪个历程看到这个代码的?
C:\ti\controlSUITE\libs\app_libs
一般在controlSUITE下面都有对这些函数的说明。
ERIC
static inline _iq FILTER_FO_run(FILTER_FO_Handle handle,const _iq inputValue)
{
FILTER_FO_Obj *obj = (FILTER_FO_Obj *)handle;
_iq a1 = obj->a1;
_iq b0 = obj->b0;
_iq b1 = obj->b1;
_iq x1 = obj->x1;
_iq y1 = obj->y1;
// compute the output
_iq y0 = _IQmpy(b0,inputValue) + _IQmpy(b1,x1) – _IQmpy(a1,y1);
// store values for next time
obj->x1 = inputValue;
obj->y1 = y0;
return(y0);
} // end of FILTER_FO_run() function
//! \brief Runs a first-order filter of the form
//! y[n] = b0*x[n] – a1*y[n-1]
//!
//! \param[in] handle The filter handle
//! \param[in] inputValue The input value to filter
//! \return The output value from the filter
static inline _iq FILTER_FO_run_form_0(FILTER_FO_Handle handle,const _iq inputValue)
{
FILTER_FO_Obj *obj = (FILTER_FO_Obj *)handle;
_iq a1 = obj->a1;
_iq b0 = obj->b0;
_iq y1 = obj->y1;
// compute the output
_iq y0 = _IQmpy(b0,inputValue) – _IQmpy(a1,y1);
// store values for next time
obj->y1 = y0;
return(y0);
} // end of FILTER_FO_run_form_0() function
这两个滤波器有什么不一样? 使用场合有什么不同?
user1303469:
回复 Eric Ma:
电机例程里面的 filter-fo.h 这个滤波器只是在计算偏移的使用。 不知道 为什么控制的时候不使用? 测量母线电压的时候也没有用。