实际调试通过,响应速度小于5mS
void SSRF_PLL(void)
{
sClarkeParkSwitch.a = gUaFdb;
sClarkeParkSwitch.b = gUbFdb;
sClarkeParkSwitch.c = gUcFdb;
sClarkeParkSwitch.Clarke(&sClarkeParkSwitch);
sClarkeParkSwitch.sin_sita = sin(sSPLL.wt);
sClarkeParkSwitch.cos_sita = cos(sSPLL.wt);
sClarkeParkSwitch.Park(&sClarkeParkSwitch);
sSPLL.Ud_fb = sClarkeParkSwitch.d;
sSPLL.Uq_fb = sClarkeParkSwitch.q;
sSPLL.err = sSPLL.Uq_ref - sSPLL.Uq_fb; //sSPLL.Uq_ref已经初始化为0
sSPLL.errd = sSPLL.err - sSPLL.errold; //误差的微分
sSPLL.errold = sSPLL.err; //记录本拍的误差值,给下一拍使用。
sSPLL.w = (sSPLL.PLL_Kp + sSPLL.PLL_Ki)*sSPLL.err + sSPLL.erri + sSPLL.PLL_Kd*sSPLL.errd;
sSPLL.erri += sSPLL.PLL_Ki*sSPLL.err;
}
sSPLL.w = Num100PI + sSPLL.w;//计算估测的当前电网电压矢量角速度。
sSPLL.wt = sSPLL.wt + sSPLL.w*Ts;
if( sSPLL.wt >= TWICE_PI )
{
sSPLL.wt = sSPLL.wt - TWICE_PI;
}
}
来源:https://blog.csdn.net/blueoce/article/details/99676529