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.
pid.h
Go to the documentation of this file.
1/**************************************************************************/
10#ifndef MINIFOC_ALGORITHM_PID_H_
11#define MINIFOC_ALGORITHM_PID_H_
12
14#define TORQUE_LOOP_CONTROL 1
16#define SPEED_LOOP_CONTROL 2
18#define ANGLE_LOOP_CONTROL 3
19
24typedef struct {
25 float kp;
26 float ki;
27 float kd;
28 float summary;
29 float expect;
30 float maximum;
31 float minimum;
33 float last_error;
35
36extern unsigned char pid_parameter_available_flag;
37extern volatile unsigned char pid_control_mode_flag;
40void pid_config(unsigned char mode);
41float pid_calculate_result(PID_Structure_t *pid_handler, float collect);
42
43#endif //MINIFOC_ALGORITHM_PID_H_
volatile unsigned char pid_control_mode_flag
flag variable of PID closed loop mode
Definition: pid.c:20
unsigned char pid_parameter_available_flag
flag variable for PID parameter availability
Definition: pid.c:16
void pid_config(unsigned char mode)
configure pid loop parameters
Definition: pid.c:33
volatile PID_Structure_t angle_pid_handler
algorithm handler of PID angle loop
Definition: pid.c:28
volatile PID_Structure_t speed_pid_handler
algorithm handler of PID speed loop
Definition: pid.c:24
float pid_calculate_result(PID_Structure_t *pid_handler, float collect)
calculate result using sampling value
Definition: pid.c:61
structure of PID algorithm
Definition: pid.h:24
float ki
integral term coefficient in PID
Definition: pid.h:26
float kp
proportional term coefficient in PID
Definition: pid.h:25
float minimum
minimum output in PID
Definition: pid.h:31
float maximum
maximum output in PID
Definition: pid.h:30
float sum_maximum
maximum of anti saturation integral in PID
Definition: pid.h:32
float last_error
error value of previous calculation in PID
Definition: pid.h:33
float summary
value of integral term in PID
Definition: pid.h:28
float expect
user expectations in PID
Definition: pid.h:29
float kd
differential term coefficient in PID
Definition: pid.h:27