Skip to content

Commit

Permalink
Merge pull request #339 from pglr/FEAT_fix_2Phase_Measurements
Browse files Browse the repository at this point in the history
Feature: FIX 2 phase measurements resulting in bad DQ currents
  • Loading branch information
runger1101001 authored Nov 13, 2023
2 parents 639ccab + be1f0aa commit 0caaf03
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common/base_classes/CurrentSense.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ float CurrentSense::getDCCurrent(float motor_electrical_angle){
// if only two measured currents
i_alpha = current.a;
i_beta = _1_SQRT3 * current.a + _2_SQRT3 * current.b;
}if(!current.a){
}else if(!current.a){
// if only two measured currents
float a = -current.c - current.b;
i_alpha = a;
i_beta = _1_SQRT3 * a + _2_SQRT3 * current.b;
}if(!current.b){
}else if(!current.b){
// if only two measured currents
float b = -current.a - current.c;
i_alpha = current.a;
Expand Down Expand Up @@ -62,12 +62,12 @@ DQCurrent_s CurrentSense::getFOCCurrents(float angle_el){
// if only two measured currents
i_alpha = current.a;
i_beta = _1_SQRT3 * current.a + _2_SQRT3 * current.b;
}if(!current.a){
}else if(!current.a){
// if only two measured currents
float a = -current.c - current.b;
i_alpha = a;
i_beta = _1_SQRT3 * a + _2_SQRT3 * current.b;
}if(!current.b){
}else if(!current.b){
// if only two measured currents
float b = -current.a - current.c;
i_alpha = current.a;
Expand Down

0 comments on commit 0caaf03

Please sign in to comment.