![]() |
miniFOC 1.0.3
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.
|
this is the header file of foc.c, which defines the structure of FOC algorithm and angle conversion factor. More...
Go to the source code of this file.
Data Structures | |
| struct | FOC_Structure_t |
| structure of FOC algorithm More... | |
Macros | |
| #define | MECHANGLE_COEFFICIENT (6.2831854f / ENCODER_RESO) |
| mechanical angle conversion factor More... | |
| #define | ELECANGLE_COEFFICIENT ((6.2831854f * POLAR_PAIRS) / ENCODER_RESO) |
| electric angle conversion factor More... | |
| #define | SPEED_COEFFICIENT ((6.2831852f * TIM13_FREQUENCY) / ENCODER_RESO) |
| mechanical rotate speed conversion factor More... | |
Functions | |
| void | foc_calculate_dutycycle (float elect_angle, float d, float q, float *u, float *v, float *w) |
| calculate the corresponding three-phase PWM duty cycle under the current electrical angle More... | |
| void | foc_calibrate_phase (void) |
| automatic phase sequence detection and correction More... | |
Variables | |
| unsigned char | foc_parameter_available_flag |
| flag variable for FOC parameter availability More... | |
| volatile unsigned char | phase_sequence |
| motor phase sequence flag variable More... | |
| volatile FOC_Structure_t | FOC_Struct |
| FOC handler. More... | |
this is the header file of foc.c, which defines the structure of FOC algorithm and angle conversion factor.
Definition in file foc.h.
| #define ELECANGLE_COEFFICIENT ((6.2831854f * POLAR_PAIRS) / ENCODER_RESO) |
| #define MECHANGLE_COEFFICIENT (6.2831854f / ENCODER_RESO) |
| #define SPEED_COEFFICIENT ((6.2831852f * TIM13_FREQUENCY) / ENCODER_RESO) |
| void foc_calculate_dutycycle | ( | float | elect_angle, |
| float | d, | ||
| float | q, | ||
| float * | u, | ||
| float * | v, | ||
| float * | w | ||
| ) |
calculate the corresponding three-phase PWM duty cycle under the current electrical angle
| [in] | elect_angle | electrical angle of motor rotor, in radian system |
| [in] | d | expected field strength in the direct axis direction of the motor |
| [in] | q | expected field strength in the quadrature axis direction of the motor |
| [out] | u | calculation results of U-phase duty cycle |
| [out] | v | calculation results of V-phase duty cycle |
| [out] | w | calculation results of W-phase duty cycle |
Definition at line 99 of file foc.c.
References fast_cos, fast_sin(), and VBUS.
Referenced by encoder_zeroing(), foc_calibrate_phase(), and TIMER2_IRQHandler().
| void foc_calibrate_phase | ( | void | ) |
automatic phase sequence detection and correction
Definition at line 33 of file foc.c.
References CALI_TORQUE, delayms(), encoder_get_mechanical_angle(), foc_calculate_dutycycle(), phase_sequence, and update_pwm_dutycycle().
Referenced by main().
|
extern |
flag variable for FOC parameter availability
Definition at line 28 of file foc.c.
Referenced by flash_read_parameters(), mdtp_callback_handler(), and report_local_variable().
|
extern |
FOC handler.
Definition at line 20 of file foc.c.
Referenced by encoder_get_electronic_angle(), encoder_update_speed(), mdtp_callback_handler(), report_angle_speed(), report_local_variable(), TIMER13_IRQHandler(), and TIMER2_IRQHandler().
|
extern |
motor phase sequence flag variable
Definition at line 24 of file foc.c.
Referenced by flash_read_parameters(), flash_write_parameters(), foc_calibrate_phase(), report_local_variable(), and TIMER2_IRQHandler().