Explorar o código

电压圆之后DQ电压乘以SQRT3_BY_2, svm中不需要在乘SQRT3_BY_2

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui %!s(int64=3) %!d(string=hai) anos
pai
achega
3ff5f6c657
Modificáronse 2 ficheiros con 8 adicións e 5 borrados
  1. 6 3
      Applications/foc/core/PMSM_FOC_Core.c
  2. 2 2
      Applications/foc/core/svpwm.c

+ 6 - 3
Applications/foc/core/PMSM_FOC_Core.c

@@ -236,7 +236,7 @@ void PMSM_FOC_CoreInit(void) {
 #ifdef CONFIG_SMO_OBSERVER
 	smo_observer_init(CONFIG_SMO_PLL_BANDWITH, CONFIG_SMO_LFP_WC, CONFIG_SMO_GAIN_K, CONFIG_SMO_SIGMOID_MAX);
 #endif
-	gFoc_Ctrl.plot_type = Plot_SMO_OBS;
+	gFoc_Ctrl.plot_type = Plot_Phase_curr;
 }
 
 //#define PHASE_LFP_FIR
@@ -364,9 +364,12 @@ void PMSM_FOC_Schedule(void) {
 		gFoc_Ctrl.in.s_targetVdq.d = FOC_Get_DqRamp(&gFoc_Ctrl.vdq_ctl[0]);
 		gFoc_Ctrl.in.s_targetVdq.q = FOC_Get_DqRamp(&gFoc_Ctrl.vdq_ctl[1]);	
 	}
-
-	gFoc_Ctrl.out.f_vdqRation = Circle_Limitation(&gFoc_Ctrl.in.s_targetVdq, gFoc_Ctrl.in.s_vDC, gFoc_Ctrl.params.n_modulation, &gFoc_Ctrl.out.s_OutVdq);
 	
+	gFoc_Ctrl.out.f_vdqRation = Circle_Limitation(&gFoc_Ctrl.in.s_targetVdq, gFoc_Ctrl.in.s_vDC, gFoc_Ctrl.params.n_modulation, &gFoc_Ctrl.out.s_OutVdq);
+
+	gFoc_Ctrl.out.s_OutVdq.d *= SQRT3_BY_2;
+	gFoc_Ctrl.out.s_OutVdq.q *= SQRT3_BY_2;
+
 	RevPark(&gFoc_Ctrl.out.s_OutVdq, gFoc_Ctrl.in.s_motAngle, &gFoc_Ctrl.out.s_OutVAB);
 	
 	SVM_Duty_Fix(&gFoc_Ctrl.out.s_OutVAB, gFoc_Ctrl.in.s_vDC, FOC_PWM_Half_Period, &gFoc_Ctrl.out);

+ 2 - 2
Applications/foc/core/svpwm.c

@@ -537,8 +537,8 @@ void SVM_Duty_Fix(AB_t *alb, s16q5_t vbus, u32 PWM_half_period, FOC_OutP *out) {
 #define Duty_Sat(max, t1, t2) 
 #endif
 void SVM_Duty_Fix(AB_t *alb, float vbus, u32 PWM_half_period, FOC_OutP *out) {
-	float alpha = (alb->a) * SQRT3_BY_2;
-	float beta  = (alb->b)  * SQRT3_BY_2;
+	float alpha = (alb->a);// * SQRT3_BY_2;
+	float beta  = (alb->b);//  * SQRT3_BY_2;
 	s32   PWM_Period = PWM_half_period * 2;
 	u8    sector = 0xFF;
 	s32   tA, tB, tC;