//=================速度环PI===================================
Speed_Ref=_IQ(SpeedRef);
Speed_Fdb=Speed;
Speed_Error=Speed_Ref - Speed_Fdb;//误差
Speed_Up=_IQmpy(Speed_Kp,Speed_Error);//kp
Speed_OutPreSat=Speed_Up+Speed_Ui;
if(Speed_OutPreSat>Speed_OutMax)
{
Speed_Out=Speed_OutMax;
}
else if(Speed_OutPreSat<Speed_OutMin)
{
Speed_Out=Speed_OutMin;
}
else
{
Speed_Out=Speed_OutPreSat;
}
Speed_SatError=Speed_Out-Speed_OutPreSat;
Speed_Ui=Speed_Ui + _IQmpy(Speed_Ki,Speed_Up) + _IQmpy(Speed_Ki,Speed_SatError);
IQ_Given=Speed_Out; // 速度与电流是线性的所以使用标幺值方便。双环串联
}
else
{
SpeedLoopCount++;
}
//======================================================================================================
//IQ电流PID调节控制
//======================================================================================================
IQ_Ref=IQ_Given;
IQ_Fdb=iq;
IQ_Error=IQ_Ref-IQ_Fdb;//误差
IQ_Up=_IQmpy(IQ_Kp,IQ_Error);//kp
IQ_OutPreSat=IQ_Up+IQ_Ui;
if(IQ_OutPreSat>IQ_OutMax)
{
IQ_Out=IQ_OutMax;
}
else if(IQ_OutPreSat<IQ_OutMin)
{
IQ_Out=IQ_OutMin;
}
else
{
IQ_Out=IQ_OutPreSat;
}
IQ_SatError=IQ_Out-IQ_OutPreSat;
IQ_Ui=IQ_Ui + _IQmpy(IQ_Ki,IQ_Up) + _IQmpy(IQ_Ki,IQ_SatError);
Uq=IQ_Out;
//======================================================================================================
//ID电流PID调节控制
//======================================================================================================
ID_Ref=0;
ID_Fdb=id;
ID_Error=ID_Ref-ID_Fdb;//误差
ID_Up=_IQmpy(ID_Kp,ID_Error);
ID_OutPreSat=ID_Up+ID_Ui;
if(ID_OutPreSat>ID_OutMax)
{
ID_Out=ID_OutMax;
}
else if(ID_OutPreSat<ID_OutMin)
{
ID_Out=ID_OutMin;
}
else
{
ID_Out=ID_OutPreSat;
}
ID_SatError=ID_Out-ID_OutPreSat;
ID_Ui=ID_Ui+_IQmpy(ID_Ki,ID_Up)+_IQmpy(ID_Ki,ID_SatError);
Ud=ID_Out;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)