#define _IQsat(A, Pos, Neg) __IQsat(A, Pos, Neg)
#define PID_MACRO(v) \
v.Err = v.Ref – v.Fdb; /* Compute the error */ \
v.Up= _IQmpy(v.Kp,v.Err); /* Compute the proportional output */ \
v.Ui= v.Ui + _IQmpy(v.Ki,v.Up) + _IQmpy(v.Kc,v.SatErr); /* Compute the integral output */ \
v.OutPreSat= v.Up + v.Ui; /* Compute the pre-saturated output */ \
v.Out = _IQsat(v.OutPreSat, v.OutMax, v.OutMin); /* Saturate the output */ \
v.SatErr = v.Out – v.OutPreSat; /* Compute the saturate difference */ \
v.Up1 = v.Up; /* Update the previous proportional output */
v.Err = v.Ref – v.Fdb; /* Compute the error */ \
v.Up= _IQmpy(v.Kp,v.Err); /* Compute the proportional output */ \
v.Ui= v.Ui + _IQmpy(v.Ki,v.Up) + _IQmpy(v.Kc,v.SatErr); /* Compute the integral output */ \
v.OutPreSat= v.Up + v.Ui; /* Compute the pre-saturated output */ \
v.Out = _IQsat(v.OutPreSat, v.OutMax, v.OutMin); /* Saturate the output */ \
v.SatErr = v.Out – v.OutPreSat; /* Compute the saturate difference */ \
v.Up1 = v.Up; /* Update the previous proportional output */
#endif // __PIDREG3_H__
// Add the lines below if derivative output is needed following the integral update
// v.Ud = _IQmpy(v.Kd,(v.Up – v.Up1));// v.OutPreSat = v.Up + v.Ui + v.Ud;
// v.Ud = _IQmpy(v.Kd,(v.Up – v.Up1));// v.OutPreSat = v.Up + v.Ui + v.Ud;
可以解释下v.Out = _IQsat(v.OutPreSat, v.OutMax, v.OutMin);这句话的意思吗,
个人理解IQsat是将v.OutPreSat限制在v.OutMax和 v.OutMin之间然后赋给v.Out,后面 v.SatErr = v.Out – v.OutPreSat; v.SatErr结果为0吗?
user5770821:
回复 Shine:
CCS28335,controlsuiteHVACI_Sensorless例程中的,我对函数IQsat不懂,可以讲下这个函数吗