1
Dependencies: mbed-dev-f303 FastPWM3
structs.h@56:4f73fa55baa0, 2020-05-14 (annotated)
- Committer:
- shaorui
- Date:
- Thu May 14 10:44:41 2020 +0000
- Revision:
- 56:4f73fa55baa0
- Parent:
- 48:74a40481740c
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benkatz | 20:bf9ea5125d52 | 1 | #ifndef STRUCTS_H |
benkatz | 20:bf9ea5125d52 | 2 | #define STRUCTS_H |
benkatz | 20:bf9ea5125d52 | 3 | |
benkatz | 20:bf9ea5125d52 | 4 | #include "mbed.h" |
benkatz | 20:bf9ea5125d52 | 5 | #include "FastPWM.h" |
benkatz | 20:bf9ea5125d52 | 6 | |
benkatz | 20:bf9ea5125d52 | 7 | |
benkatz | 20:bf9ea5125d52 | 8 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 9 | DigitalOut *enable; |
benkatz | 37:c0f352d6e8e3 | 10 | DigitalOut *led; |
benkatz | 20:bf9ea5125d52 | 11 | FastPWM *pwm_u, *pwm_v, *pwm_w; |
benkatz | 20:bf9ea5125d52 | 12 | } GPIOStruct; |
benkatz | 20:bf9ea5125d52 | 13 | |
benkatz | 20:bf9ea5125d52 | 14 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 15 | |
benkatz | 20:bf9ea5125d52 | 16 | }COMStruct; |
benkatz | 20:bf9ea5125d52 | 17 | |
benkatz | 20:bf9ea5125d52 | 18 | typedef struct{ |
benkatz | 45:26801179208e | 19 | int adc1_raw, adc2_raw, adc3_raw; // Raw ADC Values |
benkatz | 45:26801179208e | 20 | float i_a, i_b, i_c; // Phase currents |
benkatz | 45:26801179208e | 21 | float v_bus; // DC link voltage |
benkatz | 45:26801179208e | 22 | float theta_mech, theta_elec; // Rotor mechanical and electrical angle |
benkatz | 45:26801179208e | 23 | float dtheta_mech, dtheta_elec, dtheta_elec_filt; // Rotor mechanical and electrical angular velocit |
benkatz | 47:e1196a851f76 | 24 | float i_d, i_q, i_q_filt, i_d_filt; // D/Q currents |
benkatz | 45:26801179208e | 25 | float v_d, v_q; // D/Q voltages |
benkatz | 45:26801179208e | 26 | float dtc_u, dtc_v, dtc_w; // Terminal duty cycles |
benkatz | 45:26801179208e | 27 | float v_u, v_v, v_w; // Terminal voltages |
benkatz | 45:26801179208e | 28 | float k_d, k_q, ki_d, ki_q, alpha; // Current loop gains, current reference filter coefficient |
benkatz | 45:26801179208e | 29 | float d_int, q_int; // Current error integrals |
benkatz | 45:26801179208e | 30 | int adc1_offset, adc2_offset; // ADC offsets |
benkatz | 45:26801179208e | 31 | float i_d_ref, i_q_ref, i_d_ref_filt, i_q_ref_filt; // Current references |
benkatz | 45:26801179208e | 32 | int loop_count; // Degubbing counter |
benkatz | 45:26801179208e | 33 | int timeout; // Watchdog counter |
benkatz | 22:60276ba87ac6 | 34 | int mode; |
benkatz | 45:26801179208e | 35 | int ovp_flag; // Over-voltage flag |
benkatz | 45:26801179208e | 36 | float p_des, v_des, kp, kd, t_ff; // Desired position, velocity, gians, torque |
benkatz | 47:e1196a851f76 | 37 | float v_ref, fw_int; // output voltage magnitude, field-weakening integral |
benkatz | 23:2adf23ee0305 | 38 | float cogging[128]; |
benkatz | 20:bf9ea5125d52 | 39 | } ControllerStruct; |
benkatz | 20:bf9ea5125d52 | 40 | |
benkatz | 22:60276ba87ac6 | 41 | typedef struct{ |
benkatz | 48:74a40481740c | 42 | double temperature; // Estimated temperature |
benkatz | 48:74a40481740c | 43 | double temperature2; |
benkatz | 48:74a40481740c | 44 | float resistance; |
benkatz | 48:74a40481740c | 45 | } ObserverStruct; |
benkatz | 20:bf9ea5125d52 | 46 | #endif |