/* =================================================================================
File name:        RMP_CNTL.C
===================================================================================*/


#include "rmp_cntl.h"


void RC_MACRO(RMPCNTL *v)	{
	v->Tmp = v->TargetValue - v->SetpointValue;
/*  0.0000305 is resolution of Q15 */
if (_IQabs(v->Tmp) >= _IQ(0.0000305))
{
	v->RampDelayCount++	;
		if (v->RampDelayCount >= v->RampDelayMax)
		{
			if (v->TargetValue >= v->SetpointValue)
				v->SetpointValue += _IQ(0.0000305);
			else
				v->SetpointValue -= _IQ(0.0000305);

			v->SetpointValue=_IQsat(v->SetpointValue,v->RampHighLimit,v->RampLowLimit);
			v->RampDelayCount = 0;

		}
}
else v->EqualFlag = 0x7FFFFFFF;
}

