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.
foc.h
Go to the documentation of this file.
1/**************************************************************************/
10#ifndef MINIFOC_ALGORITHM_FOC_H_
11#define MINIFOC_ALGORITHM_FOC_H_
12
17typedef struct {
22
24#define MECHANGLE_COEFFICIENT (6.2831854f / ENCODER_RESO)
26#define ELECANGLE_COEFFICIENT ((6.2831854f * POLAR_PAIRS) / ENCODER_RESO)
28#define SPEED_COEFFICIENT ((6.2831852f * TIM13_FREQUENCY) / ENCODER_RESO)
29
30extern unsigned char foc_parameter_available_flag;
31extern volatile unsigned char phase_sequence;
32extern volatile FOC_Structure_t FOC_Struct;
33void foc_calculate_dutycycle(float elect_angle, float d, float q, float *u, float *v, float *w);
34void foc_calibrate_phase(void);
35
36#endif //MINIFOC_ALGORITHM_FOC_H_
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
Definition: foc.c:99
unsigned char foc_parameter_available_flag
flag variable for FOC parameter availability
Definition: foc.c:28
volatile FOC_Structure_t FOC_Struct
FOC handler.
Definition: foc.c:20
void foc_calibrate_phase(void)
automatic phase sequence detection and correction
Definition: foc.c:33
volatile unsigned char phase_sequence
motor phase sequence flag variable
Definition: foc.c:24
structure of FOC algorithm
Definition: foc.h:17
float user_expect
user expect value of miniFOC
Definition: foc.h:20
float rotate_speed
motor rotate speed calculate from timer
Definition: foc.h:19
float mechanical_angle
mechanical angle read form encoder
Definition: foc.h:18