Skip to content

Commit 0caaf03

Browse files
Merge pull request #339 from pglr/FEAT_fix_2Phase_Measurements
Feature: FIX 2 phase measurements resulting in bad DQ currents
2 parents 639ccab + be1f0aa commit 0caaf03

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/common/base_classes/CurrentSense.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ float CurrentSense::getDCCurrent(float motor_electrical_angle){
1616
// if only two measured currents
1717
i_alpha = current.a;
1818
i_beta = _1_SQRT3 * current.a + _2_SQRT3 * current.b;
19-
}if(!current.a){
19+
}else if(!current.a){
2020
// if only two measured currents
2121
float a = -current.c - current.b;
2222
i_alpha = a;
2323
i_beta = _1_SQRT3 * a + _2_SQRT3 * current.b;
24-
}if(!current.b){
24+
}else if(!current.b){
2525
// if only two measured currents
2626
float b = -current.a - current.c;
2727
i_alpha = current.a;
@@ -62,12 +62,12 @@ DQCurrent_s CurrentSense::getFOCCurrents(float angle_el){
6262
// if only two measured currents
6363
i_alpha = current.a;
6464
i_beta = _1_SQRT3 * current.a + _2_SQRT3 * current.b;
65-
}if(!current.a){
65+
}else if(!current.a){
6666
// if only two measured currents
6767
float a = -current.c - current.b;
6868
i_alpha = a;
6969
i_beta = _1_SQRT3 * a + _2_SQRT3 * current.b;
70-
}if(!current.b){
70+
}else if(!current.b){
7171
// if only two measured currents
7272
float b = -current.a - current.c;
7373
i_alpha = current.a;

0 commit comments

Comments
 (0)