![]() |
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 document is mainly the code implementation of motor phase sequence correction and FOC algorithm. More...
#include "foc.h"
#include "config.h"
#include "fast_math.h"
#include "encoder.h"
#include "system.h"
#include "timer.h"
Go to the source code of this file.
Functions | |
void | foc_calibrate_phase (void) |
automatic phase sequence detection and correction More... | |
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... | |
Variables | |
volatile FOC_Structure_t | FOC_Struct |
FOC handler. More... | |
volatile unsigned char | phase_sequence = 0 |
motor phase sequence flag variable More... | |
unsigned char | foc_parameter_available_flag = 1 |
flag variable for FOC parameter availability More... | |
this document is mainly the code implementation of motor phase sequence correction and FOC algorithm.
Definition in file foc.c.
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().
unsigned char foc_parameter_available_flag = 1 |
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().
volatile FOC_Structure_t FOC_Struct |
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().
volatile unsigned char phase_sequence = 0 |
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().