File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -39,12 +39,8 @@ DQCurrent_s CurrentSense::getFOCCurrents(float angle_el){
39
39
ABCurrent_s ABcurrent = getABCurrents (current);
40
40
41
41
// calculate park transform
42
- float ct;
43
- float st;
44
- _sincos (angle_el, &st, &ct);
45
- DQCurrent_s return_current;
46
- return_current.d = ABcurrent.alpha * ct + ABcurrent.beta * st;
47
- return_current.q = ABcurrent.beta * ct - ABcurrent.alpha * st;
42
+ DQCurrent_s return_current = getDQCurrents (ABcurrent,angle_el);
43
+
48
44
return return_current;
49
45
}
50
46
@@ -84,6 +80,20 @@ ABCurrent_s CurrentSense::getABCurrents(PhaseCurrent_s current){
84
80
return return_ABcurrent;
85
81
}
86
82
83
+ // function used with the foc algorihtm
84
+ // calculating D and Q currents from Alpha Beta currents and electrical angle
85
+ // - function calculating Clarke transform of the phase currents
86
+ DQCurrent_s CurrentSense::getDQCurrents (ABCurrent_s current, float angle_el){
87
+ // calculate park transform
88
+ float ct;
89
+ float st;
90
+ _sincos (angle_el, &st, &ct);
91
+ DQCurrent_s return_current;
92
+ return_current.d = current.alpha * ct + current.beta * st;
93
+ return_current.q = current.beta * ct - current.alpha * st;
94
+ return return_current;
95
+ }
96
+
87
97
/* *
88
98
Driver linking to the current sense
89
99
*/
Original file line number Diff line number Diff line change @@ -78,6 +78,15 @@ class CurrentSense{
78
78
*/
79
79
ABCurrent_s getABCurrents (PhaseCurrent_s current);
80
80
81
+ /* *
82
+ * Function used for Park transform in FOC control
83
+ * It reads the Alpha Beta currents and electircal angle of the motor
84
+ * It returns the D and Q currents
85
+ *
86
+ * @param current - phase current
87
+ */
88
+ DQCurrent_s getDQCurrents (ABCurrent_s current,float angle_el);
89
+
81
90
82
91
};
83
92
You can’t perform that action at this time.
0 commit comments