下面一段程序是SVPWM代码中的一段,文件名是rampgen.c
Description: The Ramp Generation
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20
-------------------------------------------------------------------------------------*/
#include "IQmathLib.h" // Include header for IQmath library
// Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file
#include "rampgen.h"
void rampgen_calc(RAMPGEN *v)
{
// Compute the angle rate
v->Angle += _IQmpy(v->StepAngleMax,v->Freq);
// Saturate the angle rate within (-1,1)
if (v->Angle>_IQ(1.0))
v->Angle -= _IQ(1.0);
else if (v->Angle<_IQ(-1.0))
v->Angle += _IQ(1.0);
// Compute the ramp output
v->Out = _IQmpy(v->Angle,v->Gain) + v->Offset;
// Saturate the ramp output within (-1,1)
if (v->Out>_IQ(1.0))
v->Out -= _IQ(1.0);
else if (v->Out<_IQ(-1.0))
v->Out += _IQ(1.0);
}
请问高手,这段程序是干什么的?谢谢!