Explorar o código

不管是否有母线采样,母线电流软件计算都执行

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui %!s(int64=3) %!d(string=hai) anos
pai
achega
390d180c61

+ 4 - 9
Applications/foc/core/PMSM_FOC_Core.c

@@ -1021,7 +1021,6 @@ void PMSM_FOC_Set_PlotType(Plot_t t) {
 }
 //获取母线电流和实际输出电流矢量大小
 void PMSM_FOC_Calc_Current(void) {
-#ifdef NO_SAMPLE_IDC
 	float vd = gFoc_Ctrl.out.s_OutVdq.d;
 	float vq = gFoc_Ctrl.out.s_OutVdq.q;
 
@@ -1032,14 +1031,10 @@ void PMSM_FOC_Calc_Current(void) {
 		iDC x vDC = 2/3(iq x vq + id x vd);
 	*/
 	float m_pow = (vd * id + vq * iq); //s32q10
-	float id_thr = ABS(id);
-	if (id_thr >= 100.0f) {
-		id_thr = 100.0f;
-	}
-	float raw_idc = m_pow / get_vbus_float() * (1.0f - 0.2f * id_thr/100.0f);// * 1.5f * 0.66f; //s16q5
-#else
-	float raw_idc = get_vbus_current();
-#endif
+	float raw_idc = m_pow / get_vbus_float();// * 1.5f * 0.66f; //s16q5
+	LowPass_Filter(gFoc_Ctrl.out.s_CalciDC, raw_idc, 0.1f);
+
+	raw_idc = get_vbus_current();
 	LowPass_Filter(gFoc_Ctrl.out.s_FilteriDC, raw_idc, 0.1f);
 
 	gFoc_Ctrl.out.s_RealCurrent = sqrtf(SQ(gFoc_Ctrl.out.s_FilterIdq.d) + SQ(gFoc_Ctrl.out.s_FilterIdq.q));

+ 1 - 0
Applications/foc/core/PMSM_FOC_Core.h

@@ -152,6 +152,7 @@ typedef struct {
 	DQ_t  s_RealVdq;
 	DQ_t  s_FilterIdq;
 	float s_FilteriDC;
+	float s_CalciDC;
 	float s_RealCurrent;
 	float f_vdqRation;
 	s16   test_sample;