Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
structs.h
00001 #ifndef STRUCTS_H 00002 #define STRUCTS_H 00003 00004 #include "mbed.h" 00005 #include "FastPWM.h" 00006 00007 /* ----- 00008 移除速度控制,把位置控制改成PID 00009 00010 log file: 00011 11/05: 在ControllerStruct新增ki(desired KI),保留v_des(desired velocity) 00012 ----- */ 00013 00014 typedef struct{ 00015 DigitalOut *enable; 00016 DigitalOut *led; 00017 FastPWM *pwm_u, *pwm_v, *pwm_w; 00018 } GPIOStruct; 00019 00020 typedef struct{ 00021 00022 }COMStruct; 00023 00024 typedef struct{ 00025 int adc1_raw, adc2_raw, adc3_raw; // Raw ADC Values 00026 float i_a, i_b, i_c; // Phase currents 00027 float v_bus; // DC link voltage 00028 float theta_mech, theta_elec; // Rotor mechanical and electrical angle 00029 float dtheta_mech, dtheta_elec, dtheta_elec_filt; // Rotor mechanical and electrical angular velocit 00030 float i_d, i_q, i_q_filt, i_d_filt; // D/Q currents 00031 float v_d, v_q; // D/Q voltages 00032 float dtc_u, dtc_v, dtc_w; // Terminal duty cycles 00033 float v_u, v_v, v_w; // Terminal voltages 00034 float k_d, k_q, ki_d, ki_q, alpha; // Current loop gains, current reference filter coefficient 00035 float d_int, q_int; // Current error integrals 00036 int adc1_offset, adc2_offset; // ADC offsets 00037 float i_d_ref, i_q_ref, i_d_ref_filt, i_q_ref_filt; // Current references 00038 int loop_count; // Degubbing counter 00039 int timeout; // Watchdog counter 00040 int mode; 00041 int ovp_flag; // Over-voltage flag 00042 float p_des, v_des, kp, ki, kd, t_ff; // Desired position, velocity, gians, torque 00043 float v_ref, fw_int; // output voltage magnitude, field-weakening integral 00044 float cogging[128]; 00045 } ControllerStruct; 00046 00047 typedef struct{ 00048 double temperature; // Estimated temperature 00049 double temperature2; 00050 float resistance; 00051 } ObserverStruct; 00052 #endif
Generated on Thu Jul 21 2022 06:45:42 by
1.7.2