Speed loop
speed_angle
这个模块主要提供速度斜坡与速度环的一些功能参数。
和BLDC里面的一些函数与配置很相似,但也有一些不同的点:
PI:Speedloop变量PI参数计算,它根据速度将速度环路PI参数分为三个部分,低速时使用低速PI,高速时使用高速PI,中间速度线性过渡。
/*!
* @brief Speedloop variable PI parameters calculate, it divides the speed loop PI parameters into three sections
according to the speed, low speed PI is used at low speed, high speed PI is used at high speed, and the
intermediate speed is linearly transitioned.
*Speedloop变量PI参数计算,它根据速度将速度环路PI参数分为三个部分,低速时使用低速PI,高速时使用高速PI,中间速度线性过渡。
* @param[in] freq: motor electrical frequency pu value in Q15
* @param[in] asrVarPI: pointer to ASR_SPEEDVARPI structure
* @param[in] asrPidCof: pointer to PID_REGULATOR_COF structure
* @return none
*/
void ASR_SpeedVarPICalc(int16_t freq, ASR_SPEEDVARPI *asrVarPI, PID_REGULATOR_COF *asrPidCof)
{
uint16_t s_absFre = 0;
s_absFre = Math_Qabs(freq);
if (s_absFre > asrVarPI->frepuH)
{
asrPidCof->**u = asrVarPI->kpH;
asrPidCof->kiPu = asrVarPI->kiH;
}
else if (s_absFre > asrVarPI->frepuL)
{
asrPidCof->**u = asrVarPI->kpL + Math_Mpy((s_absFre - asrVarPI->frepuL), asrVarPI->kpGain);
asrPidCof->kiPu = asrVarPI->kiL + Math_Mpy((s_absFre - asrVarPI->frepuL), asrVarPI->kiGain);
}
else
{
asrPidCof->**u = asrVarPI->kpL;
asrPidCof->kiPu = asrVarPI->kiL;
}
}
|