#include "circle_limitation.h"

void CirCle_Limitation_Process(dq_t *inout_vdq, float in_vbus, float svm_ration){
	float svd = SQ(inout_vdq->Vd);
	float svq = SQ(inout_vdq->Vq);
	float svBus = SQ(in_vbus*svm_ration);
	if (svd + svq > svBus) {
		float r = sqrtf(svBus/(svd+svq));
		inout_vdq->Vd *= r;
		inout_vdq->Vq *= r;
	}
}

