void App_GridCurrLimt(void) { static uint16_t u16Cnt = 0; // 定义一个静态变量 u16Cnt,并初始化为 0 tVbus.fLimtMax1 = tVbus.fLimtMaxSet; // 将 tVbus.fLimtMaxSet 的值赋给 tVbus.fLimtMax1

if (0 == tSys.u16PowerSoftSet) { tSys.u16PowerSoft = 0; } // 如果 tSys.u16PowerSoftSet 为 0,则将 tSys.u16PowerSoft 设置为 0
tVbus.fLimtStep = 0.005f; // 将 tVbus.fLimtStep 设置为 0.005

if (0 == tSys.u16PowerSoft) // 如果 tSys.u16PowerSoft 为 0
{
    if (tVbus.fLimtMax > tVbus.fLimtMaxSet) // 如果 tVbus.fLimtMax 大于 tVbus.fLimtMaxSet
    {
        tVbus.fLimtMax -= tVbus.fLimtStep; // 将 tVbus.fLimtMax 减去 tVbus.fLimtStep
    }
    else
    {
        tVbus.fLimtMax += tVbus.fLimtStep; // 将 tVbus.fLimtMax 加上 tVbus.fLimtStep
    }
    // tGridInvCur.fIqSet = 0.1f;////-tVbus.fLimtMax*sqrtf(1.0F*-0.8F*0.8F);
}
else // 否则
{
    u16Cnt++; // u16Cnt 加 1
    if (u16Cnt > 1000) // 如果 u16Cnt 大于 1000
    {
        u16Cnt = 0; // 将 u16Cnt 设置为 0
        if (tVbus.fLimtMax > tVbus.fLimtMaxSet) // 如果 tVbus.fLimtMax 大于 tVbus.fLimtMaxSet
        {
            tVbus.fLimtMax -= 0.75f; // 将 tVbus.fLimtMax 减去 0.75
        }
        else
        {
            // tVbus.fLimtMax +=tVbus.fLimtMaxSet*0.098f*0.08f*1.3f;
            tVbus.fLimtMax += tVbus.fLimtMaxSet * 0.010192f; // 将 tVbus.fLimtMax 加上 tVbus.fLimtMaxSet 乘以 0.010192 的结果
        }
    }
    // tGridInvCur.fIqSet = 0.1f;//-tVbus.fLimtMax*sqrtf(1.0F*-0.8F*0.8F);
}

}

App_GridCurrLimt 函数代码分析和解释

原文地址: https://www.cveoy.top/t/topic/nNHx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录