yezhong yezhong / Motor_DRV8323RH_for_2019-

Dependencies:   mbed-dev-f303 FastPWM3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers structs.h Source File

structs.h

00001 #ifndef STRUCTS_H
00002 #define STRUCTS_H
00003 
00004 //#include "CANnucleo.h"
00005 #include "mbed.h"
00006 #include "FastPWM.h"
00007 
00008 
00009 typedef struct{
00010     DigitalOut *enable;
00011     DigitalOut *led;
00012     FastPWM *pwm_u, *pwm_v, *pwm_w;
00013     } GPIOStruct;
00014     
00015 typedef struct{
00016     
00017     }COMStruct;
00018     
00019 typedef struct{
00020     int adc1_raw, adc2_raw, adc3_raw;
00021     float i_a, i_b, i_c;
00022     float v_bus;
00023     float theta_mech, theta_elec;
00024     float dtheta_mech, dtheta_elec, dtheta_elec_filt;
00025     float i_d, i_q, i_q_filt;
00026     float v_d, v_q;
00027     float dtc_u, dtc_v, dtc_w;
00028     float v_u, v_v, v_w;
00029     float d_int, q_int;
00030     int adc1_offset, adc2_offset;
00031     float i_d_ref, i_q_ref;
00032     int loop_count;
00033     int timeout;
00034     int mode;
00035     int ovp_flag;
00036     float p_des, v_des, kp, kd, t_ff;
00037 //**************WYC ADD*******************2021/11/4************//
00038     float ki,error,integral_prev,output_prev,error_prev,timestamp_prev;
00039     float LIMIT;
00040 //**************WYC END*******************2021/11/4************//
00041     float cogging[128];
00042     } ControllerStruct;
00043 
00044 typedef struct{
00045     float theta_m, theta_est;
00046     float thetadot_m, thetadot_est;
00047     float i_d_m, i_d_est;
00048     float i_q_m, i_q_est;
00049     float i_d_dot, i_q_dot;
00050     float e_d, e_q;
00051     float e_d_int, e_q_int;
00052     } ObserverStruct;
00053     
00054 #endif