1
Dependencies: mbed-dev-f303 FastPWM3
structs.h@37:c0f352d6e8e3, 2018-04-13 (annotated)
- Committer:
- benkatz
- Date:
- Fri Apr 13 13:50:54 2018 +0000
- Revision:
- 37:c0f352d6e8e3
- Parent:
- 34:51647c6c500d
- Child:
- 48:1b51771c3647
always samples position sensor
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 "CANnucleo.h" |
benkatz | 20:bf9ea5125d52 | 5 | #include "mbed.h" |
benkatz | 20:bf9ea5125d52 | 6 | #include "FastPWM.h" |
benkatz | 20:bf9ea5125d52 | 7 | |
benkatz | 20:bf9ea5125d52 | 8 | |
benkatz | 20:bf9ea5125d52 | 9 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 10 | DigitalOut *enable; |
benkatz | 37:c0f352d6e8e3 | 11 | DigitalOut *led; |
benkatz | 20:bf9ea5125d52 | 12 | FastPWM *pwm_u, *pwm_v, *pwm_w; |
benkatz | 20:bf9ea5125d52 | 13 | } GPIOStruct; |
benkatz | 20:bf9ea5125d52 | 14 | |
benkatz | 20:bf9ea5125d52 | 15 | typedef struct{ |
benkatz | 20:bf9ea5125d52 | 16 | |
benkatz | 20:bf9ea5125d52 | 17 | }COMStruct; |
benkatz | 20:bf9ea5125d52 | 18 | |
benkatz | 20:bf9ea5125d52 | 19 | typedef struct{ |
benkatz | 37:c0f352d6e8e3 | 20 | int adc1_raw, adc2_raw, adc3_raw; |
benkatz | 20:bf9ea5125d52 | 21 | float i_a, i_b, i_c; |
benkatz | 20:bf9ea5125d52 | 22 | float v_bus; |
benkatz | 20:bf9ea5125d52 | 23 | float theta_mech, theta_elec; |
benkatz | 34:51647c6c500d | 24 | float dtheta_mech, dtheta_elec, dtheta_elec_filt; |
benkatz | 34:51647c6c500d | 25 | float i_d, i_q, i_q_filt; |
benkatz | 20:bf9ea5125d52 | 26 | float v_d, v_q; |
benkatz | 20:bf9ea5125d52 | 27 | float dtc_u, dtc_v, dtc_w; |
benkatz | 20:bf9ea5125d52 | 28 | float v_u, v_v, v_w; |
benkatz | 20:bf9ea5125d52 | 29 | float d_int, q_int; |
benkatz | 20:bf9ea5125d52 | 30 | int adc1_offset, adc2_offset; |
benkatz | 20:bf9ea5125d52 | 31 | float i_d_ref, i_q_ref; |
benkatz | 22:60276ba87ac6 | 32 | int loop_count; |
benkatz | 28:8c7e29f719c5 | 33 | int timeout; |
benkatz | 22:60276ba87ac6 | 34 | int mode; |
benkatz | 37:c0f352d6e8e3 | 35 | int ovp_flag; |
benkatz | 26:2b865c00d7e9 | 36 | float p_des, v_des, kp, kd, t_ff; |
benkatz | 23:2adf23ee0305 | 37 | float cogging[128]; |
benkatz | 20:bf9ea5125d52 | 38 | } ControllerStruct; |
benkatz | 20:bf9ea5125d52 | 39 | |
benkatz | 22:60276ba87ac6 | 40 | typedef struct{ |
benkatz | 37:c0f352d6e8e3 | 41 | float theta_m, theta_est; |
benkatz | 37:c0f352d6e8e3 | 42 | float thetadot_m, thetadot_est; |
benkatz | 37:c0f352d6e8e3 | 43 | float i_d_m, i_d_est; |
benkatz | 37:c0f352d6e8e3 | 44 | float i_q_m, i_q_est; |
benkatz | 37:c0f352d6e8e3 | 45 | float i_d_dot, i_q_dot; |
benkatz | 37:c0f352d6e8e3 | 46 | float e_d, e_q; |
benkatz | 37:c0f352d6e8e3 | 47 | float e_d_int, e_q_int; |
benkatz | 37:c0f352d6e8e3 | 48 | } ObserverStruct; |
benkatz | 22:60276ba87ac6 | 49 | |
benkatz | 20:bf9ea5125d52 | 50 | #endif |