![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Slurp
structs.h@0:9edd6ec0f56a, 2017-05-20 (annotated)
- Committer:
- austinbrown124
- Date:
- Sat May 20 21:42:20 2017 +0000
- Revision:
- 0:9edd6ec0f56a
First Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
austinbrown124 | 0:9edd6ec0f56a | 1 | #ifndef STRUCTS_H |
austinbrown124 | 0:9edd6ec0f56a | 2 | #define STRUCTS_H |
austinbrown124 | 0:9edd6ec0f56a | 3 | |
austinbrown124 | 0:9edd6ec0f56a | 4 | //#include "CANnucleo.h" |
austinbrown124 | 0:9edd6ec0f56a | 5 | #include "mbed.h" |
austinbrown124 | 0:9edd6ec0f56a | 6 | #include "FastPWM.h" |
austinbrown124 | 0:9edd6ec0f56a | 7 | |
austinbrown124 | 0:9edd6ec0f56a | 8 | |
austinbrown124 | 0:9edd6ec0f56a | 9 | typedef struct{ |
austinbrown124 | 0:9edd6ec0f56a | 10 | DigitalOut *enable; |
austinbrown124 | 0:9edd6ec0f56a | 11 | FastPWM *pwm_ul, *pwm_vl, *pwm_wl, *pwm_uh, *pwm_vh, *pwm_wh; |
austinbrown124 | 0:9edd6ec0f56a | 12 | int phasing; |
austinbrown124 | 0:9edd6ec0f56a | 13 | } GPIOStruct; |
austinbrown124 | 0:9edd6ec0f56a | 14 | |
austinbrown124 | 0:9edd6ec0f56a | 15 | typedef struct{ |
austinbrown124 | 0:9edd6ec0f56a | 16 | |
austinbrown124 | 0:9edd6ec0f56a | 17 | }COMStruct; |
austinbrown124 | 0:9edd6ec0f56a | 18 | |
austinbrown124 | 0:9edd6ec0f56a | 19 | typedef struct{ |
austinbrown124 | 0:9edd6ec0f56a | 20 | int adc1_raw, adc2_raw; |
austinbrown124 | 0:9edd6ec0f56a | 21 | float i_a, i_b, i_c; |
austinbrown124 | 0:9edd6ec0f56a | 22 | float v_bus; |
austinbrown124 | 0:9edd6ec0f56a | 23 | float theta_mech, theta_elec; |
austinbrown124 | 0:9edd6ec0f56a | 24 | float dtheta_mech, dtheta_elec; |
austinbrown124 | 0:9edd6ec0f56a | 25 | float i_d, i_q; |
austinbrown124 | 0:9edd6ec0f56a | 26 | float v_d, v_q; |
austinbrown124 | 0:9edd6ec0f56a | 27 | float dtc_u, dtc_v, dtc_w; |
austinbrown124 | 0:9edd6ec0f56a | 28 | float v_u, v_v, v_w; |
austinbrown124 | 0:9edd6ec0f56a | 29 | float d_int, q_int; |
austinbrown124 | 0:9edd6ec0f56a | 30 | int adc1_offset, adc2_offset; |
austinbrown124 | 0:9edd6ec0f56a | 31 | float i_d_ref, i_q_ref; |
austinbrown124 | 0:9edd6ec0f56a | 32 | int loop_count; |
austinbrown124 | 0:9edd6ec0f56a | 33 | int mode; |
austinbrown124 | 0:9edd6ec0f56a | 34 | float cogging[128]; |
austinbrown124 | 0:9edd6ec0f56a | 35 | } ControllerStruct; |
austinbrown124 | 0:9edd6ec0f56a | 36 | |
austinbrown124 | 0:9edd6ec0f56a | 37 | typedef struct{ |
austinbrown124 | 0:9edd6ec0f56a | 38 | float vel_1; |
austinbrown124 | 0:9edd6ec0f56a | 39 | float vel_1_old; |
austinbrown124 | 0:9edd6ec0f56a | 40 | float vel_1_est; |
austinbrown124 | 0:9edd6ec0f56a | 41 | float vel_2; |
austinbrown124 | 0:9edd6ec0f56a | 42 | float vel_2_old; |
austinbrown124 | 0:9edd6ec0f56a | 43 | float vel_2_est; |
austinbrown124 | 0:9edd6ec0f56a | 44 | float ts; |
austinbrown124 | 0:9edd6ec0f56a | 45 | float est; |
austinbrown124 | 0:9edd6ec0f56a | 46 | } VelocityEstimatorStruct; |
austinbrown124 | 0:9edd6ec0f56a | 47 | |
austinbrown124 | 0:9edd6ec0f56a | 48 | #endif |