首页 > 解决方案 > 电力电子数据中显示滤波的要求

问题描述

我正在尝试使用编译器 V.6.0.2 调试复杂的固件 CCS V.5 程序。我的控制代码可以通过 PC 程序访问。我的应用程序的所有寄存器都是定制的。我的目标是显示特定的通道电压,但逻辑上的数学代码应该是可以理解的。开始了

void DispFiltering1(void)
{
    float       k;
    float in_data;

    ///////////////////////////////////////////////////////////////////
    in_data = Register[CH1_VOLTAGE] * 1000 - Vfilt_16;
    dVfilt_16 = in_data + (dVfilt_16 * 0.5f);
    idvfilt_16 += dVfilt_16;

    k = (int)(idvfilt_16 * timeconst_inverse_16);
    idvfilt_16 -= k * timeconst_16;


    if(k < -slewrate_16) Vfilt_16 -= slewrate_16;
    else if(k > slewrate_16) Vfilt_16 += slewrate_16;
    else Vfilt_16 += k;

    Register[DISP_CH1_VOLTAGE] = Vfilt_16 * 0.001;

    ///////////////////////////////////////////////////////////////////
    in_data = Register[CH1_CURRENT] * 1000 - Vfilt_17;
    dVfilt_17= in_data + (dVfilt_17 * 0.5f);
    idvfilt_17 += dVfilt_17;

    k = (int)(idvfilt_17 * timeconst_inverse_17);
    idvfilt_17 -= k * timeconst_17;


    if(k < -slewrate_17) Vfilt_17 -= slewrate_17;
    else if(k > slewrate_17) Vfilt_17 += slewrate_17;
    else Vfilt_17 += k;

    Register[DISP_CH1_CURRENT] = Vfilt_17 * 0.001;
}

如果您能解释为什么在这里需要过滤、转换率和时间常数,我会很高兴?

标签: c++cmathdisplay

解决方案


推荐阅读