casainho
10 GW
- Joined
- Feb 14, 2011
- Messages
- 6,058
For knowledge, please see calculation of FOC angle using motor inductance and not phase current -- this is an early experiment but seems to be inline of what we expect:
casainho said:Got an experimental code working near what is expected - I will explain:
On purpose, I put an wrong angle value at startup and I see my motor asking to much current when I increase the speed. When I put a correct value of 0, it simple don't ask much current is about 0.6 amps on full speed and I think that is because it has low current/load.
So I put an angle of 10: #define MOTOR_ROTOR_OFFSET_ANGLE 10
Here the the experimental code, that calcs Iwl and V, than it does asinf and convert to angle values. Yes, I think some part of the code may not doing correct angle conversion.... can you please review?
The code prints the variables and also puts the negative value to ui8_angle_correction, that is used to correct the angle.
I did 2 tests, by keeping the ui8_angle_correction always at 0 (angle offset error of 10) or by apply the value calculated. I show t
he graphs and logged as also videos, where you can see the power supply current for each case and listen the motor noise.
Code:ui32_l_x1000000 = 135; ui32_temp = ui32_w_angular_velocity_x10 * ui32_l_x1000000; ui32_temp *= ui32_i_phase_current_x2; ui16_iwl = (ui32_temp / 2000000); f_temp = asinf((float) ui16_iwl / (float) ui16_e_phase_voltage) * 5732.0; ui16_temp = f_temp; printf ("%d,%d,%d,%d\n", ui16_e_phase_voltage, ui16_i_phase_current, ui16_motor_speed_erps, ui16_temp/100); ui8_angle_correction = - (ui16_temp/100);
FOC calculation disabled:
- speed ERPS = 450
- phase current = 3.5A
FOC calculation enabled:
- speed ERPS = 350
- phase current = 0.5A
FOC calculation disabled
FOC calculation enabled
FOC calculation disabled
[youtube]-cUIJlzcs2c[/youtube]
FOC calculation enabled
[youtube]8uOsVOv5oS4[/youtube]