例如:
//TODO computePRcontrollerCoeff()
// PI =Kp+ (2*s*wrc)/(s^2+2*s*wrc+wo^2)
void computePRcontrollerCoeff(CNTL_2P2Z_F_COEFFS *coef1, float kp, float ki, float wo, float fs, float wrc )
{
float temp1, temp2, wo_adjusted;
wo_adjusted=2*fs*tan(wo/(2*fs));
temp1=4*fs*fs+wo_adjusted*wo_adjusted+4*fs*wrc;
temp2=4*ki*wrc*fs/temp1;
coef1->Coeff_B0=temp2;
coef1->Coeff_B1=0;
coef1->Coeff_B2=-temp2;
coef1->Coeff_A1=(-8*fs*fs+2*wo_adjusted*wo_adjusted)/temp1;
coef1->Coeff_A2=(temp1-8*fs*wrc)/temp1;
coef1->IMin=-10.0;
coef1->Max=10.0;
coef1->Min=-10.0;
if(kp!=0)
{
coef1->Coeff_B0+=kp;
coef1->Coeff_B1+=kp*coef1->Coeff_A1;
coef1->Coeff_B2+=kp*coef1->Coeff_A2;
}
coef1->Coeff_A1=-coef1->Coeff_A1;
coef1->Coeff_A2=-coef1->Coeff_A2;
}
问题:函数功能是直接实现s到z域的转换吗? 我试一下此函数的执行结果,然后对比一下直接使用MATHLAB离散化的结果对比。
Susan Yang:
请您参考一下下面的文档
CNTL_2P2Z.pdf
Susan Yang:
另外附上之前的相关帖子,希望对您有所帮助
e2echina.ti.com/…/142128
user4675816:
回复 Susan Yang:
这个文档里面的差分方程是错的。别被误导了。