You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/simplefoc_library/digging_deeper/theory/FOC_routine.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,11 @@ Field oriented control algorithm's main task is to take user defined voltage <i>
17
17
18
18
<imgsrc="../extras/Images/voltage_loop.png">
19
19
20
-
FOC algorithm calculates the phase voltages which create the magnetic field in the motor's stator which are exactly 90 degrees "behind" the magnetic field of the permanent magnets of the rotor, creating a pushing effect. Here is a very nice animation of what happens inside of the motor when running simplified version of the the FOC called six-step modulation.
20
+
The FOC algorithm calculates the phase voltages which create the magnetic field in the motor's stator which are exactly 90 degrees "behind" the magnetic field of the permanent magnets of the rotor, creating a pushing effect. Here is a very nice animation of what happens inside of the motor when running simplified version of the the FOC called six-step modulation.
Another way to look at why we need 90 degree angle in between rotor and stator fields if by remembering the equation of the electric force generated by the wire passing through the magnetic field:
24
+
Another way to look at why we need 90 degree angle in between rotor and stator fields is by remembering the equation of the electric force generated by the wire passing through the magnetic field:
25
25
26
26
```cpp
27
27
F = B*I*L*sin(alpha)
@@ -32,12 +32,12 @@ Where `B` is the strength of the magnetic field, `L` is the length of the wire,
32
32
33
33
## How to calculate the appropriate voltages <i>u<sub>a</sub></i>,<i>u<sub>b</sub></i> and <i>u<sub>c</sub></i>
34
34
35
-
Since the <span class="simple">Simple<span class="foc">FOC</span>library</span> is intended for education about the FOC algorithm as well for enabling various applications, the two most standard versions of the FOC modulation are implemented in this library.
35
+
Since the <span class="simple">Simple<span class="foc">FOC</span>library</span> is intended for education about the FOC algorithm as well for enabling various applications, the two most standard versions of FOC modulation are implemented in this library.
36
36
37
37
- Sinusoidal PWM: `SinePWM`
38
38
- Space Vector PWM: `SpaceVectorPWM`
39
39
40
-
You can configure them by setting the value of `motor.foc_modulation` variable:
40
+
You can configure them by setting the value of the `motor.foc_modulation` variable:
Second step is projecting the <i>T<sub>0,1,2</sub></i> values to the appropriate duty-cycles <i>T<sub>a,b,c</sub></i> which depend directly of the sector the motor is currently in.
103
+
The second step is projecting the <i>T<sub>0,1,2</sub></i> values to the appropriate duty-cycles <i>T<sub>a,b,c</sub></i> which depend directly on the sector the motor is currently in.
Here is one example of a pwm signal generated using SVM table for parameters: <i>s = 2</i>, <i><i>T<sub>1</sub></i> = 1/8 = 0.125</i>, <i><i>T<sub>2</sub></i> = 1/8 = 0.125</i> and <i><i>T<sub>0</sub></i> = 1/2 = 0.5</i>
114
+
Here is one example of a pwm signal generated using the SVM table for parameters: <i>s = 2</i>, <i><i>T<sub>1</sub></i> = 1/8 = 0.125</i>, <i><i>T<sub>2</sub></i> = 1/8 = 0.125</i> and <i><i>T<sub>0</sub></i> = 1/2 = 0.5</i>
There are several key differences in between these two algorithms. But in terms of <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> all that you need to know is that Space Vector algorithm better uses the maximal voltage range of the power supply. In the tables above, you can see that for <i>U<sub>q</sub> = 0.5V</i> the magnitude of sine waves generated by the Sinusoidal modulation is exactly equal to 1, and Space vector modulation is not quite there yet. The "double sine" wave produced by the space vector has lower magnitude by the factor of `2/sqrt(3) = 1.15` which means that it can deliver 15% more power to the motor using same power supply.
205
+
There are several key differences between these two algorithms. But in terms of the <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> all that you need to know is that the Space Vector algorithm better uses the maximal voltage range of the power supply. In the tables above, you can see that for <i>U<sub>q</sub> = 0.5V</i> the magnitude of sine waves generated by the Sinusoidal modulation is exactly equal to 1, and Space vector modulation is not quite there yet. The "double sine" wave produced by the space vector has lower magnitude by the factor of `2/sqrt(3) = 1.15` which means that it can deliver 15% more power to the motor using same power supply.
206
206
207
207
This means, for your power-supply with the voltage <i>V<sub>power_supply</sub></i>, when using `SinePWM` you will be able to set maximal <i>U<sub>q</sub> = 0.5 V<sub>power_supply</sub> </i> and if using `SpaceVectorPWM` you will be able to set <i>U<sub>q</sub> = 0.58 V<sub>power_supply</sub> </i>
208
208
@@ -213,7 +213,7 @@ The power supply voltage <i>V<sub>power_supply</sub></i> you should specify by c
213
213
motor.voltage_power_supply = 12;
214
214
```
215
215
<blockquoteclass="warning"> <pclass="heading">What if I don't specify this parameter?</p>
216
-
If you don't <codeclass="highlighter-rouge">motor.voltage_power_supply</code>, the algorithm will still work but your <codeclass="highlighter-rouge">motor.voltage_q</code> value will no longer be equal to the real output voltage.
216
+
If you don't specify <codeclass="highlighter-rouge">motor.voltage_power_supply</code>, the algorithm will still work but your <codeclass="highlighter-rouge">motor.voltage_q</code> value will no longer be equal to the real output voltage.
217
217
</blockquote>
218
218
<imgsrc="../extras/Images/sine_foc.png" >
219
219
@@ -222,7 +222,7 @@ If you don't <code class="highlighter-rouge">motor.voltage_power_supply</code>,
222
222
223
223
If you try to put voltage <i>U<sub>q</sub></i> higher than <i>U<sub>q</sub> = 0.5 V<sub>power_supply</sub> </i> for `SinePWM` or <i>U<sub>q</sub> = 0.58 V<sub>power_supply</sub> </i> for `SpaceVectorPWM`, it will still work but the <i>U<sub>a,b,c</sub></i> signals will be saturated.
224
224
225
-
Here are few images of the `SinePWM` for different <i>U<sub>q</sub></i> values.
225
+
Here are a few images of the `SinePWM` for different <i>U<sub>q</sub></i> values.
@@ -232,7 +232,7 @@ Basically what you can see on images is that the <i>U<sub>a,b,c</sub></i> are sa
232
232
The motor is still getting some increase of power, but it is no longer linear or smooth.
233
233
234
234
<blockquoteclass="warning"> <pclass="heading">RULE OF THUMB</p>
235
-
In reality the motor can see the difference all the way till <i>U<sub>q</sub> ~ 0.7 V<sub>power_supply</sub> </i>. After this value the <i>U<sub>a,b,c</sub></i> are too saturated and further increase of <i>U<sub>q</sub></i> doesn't result in increase of motor power.
235
+
In reality the motor can see the difference all the way till <i>U<sub>q</sub> ~ 0.7 V<sub>power_supply</sub> </i>. After this value the <i>U<sub>a,b,c</sub></i> are too saturated and further increase of <i>U<sub>q</sub></i> doesn't result in an increase of motor power.
236
236
237
237
But every motor is a bit different and you can check these values empirically on your own easily. Just put the motor in the voltage control and see after which value of the voltage <i>U<sub>q</sub></i> you can no longer see the improvement in motor power (it will stop accelerating).
0 commit comments