Skip to content

Commit

Permalink
[MCPWM_FOC] Change 2 --> 2.0
Browse files Browse the repository at this point in the history
As per review request.
  • Loading branch information
kubark42 committed Nov 7, 2021
1 parent 9753962 commit 2cb9b3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mcpwm_foc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3973,7 +3973,7 @@ static void update_valpha_vbeta(volatile motor_all_state_t *motor, float mod_alp

/* mod_alpha_sign = 2/3*sign(ia) - 1/3*sign(ib) - 1/3*sign(ic) */
/* mod_beta_sign = 1/sqrt(3)*sign(ib) - 1/sqrt(3)*sign(ic) */
const float mod_alpha_filter_sgn = (1.0 / 3.0) * (2 * SIGN(ia_filter) - SIGN(ib_filter) - SIGN(ic_filter));
const float mod_alpha_filter_sgn = (1.0 / 3.0) * (2.0 * SIGN(ia_filter) - SIGN(ib_filter) - SIGN(ic_filter));
const float mod_beta_filter_sgn = ONE_BY_SQRT3 * (SIGN(ib_filter) - SIGN(ic_filter));

const float mod_comp_fact = conf_now->foc_dt_us * 1e-6 * conf_now->foc_f_sw;
Expand All @@ -3991,7 +3991,7 @@ static void update_valpha_vbeta(volatile motor_all_state_t *motor, float mod_alp

/* v_alpha = 2/3*Va - 1/3*Vb - 1/3*Vc */
/* v_beta = 1/sqrt(3)*Vb - 1/sqrt(3)*Vc */
float v_alpha = (1.0 / 3.0) * (2 * Va - Vb - Vc);
float v_alpha = (1.0 / 3.0) * (2.0 * Va - Vb - Vc);
float v_beta = ONE_BY_SQRT3 * (Vb - Vc);

// Keep the modulation updated so that the filter stays updated
Expand Down

0 comments on commit 2cb9b3f

Please sign in to comment.