Fork and fix for mwork

Dependencies:   mbed-dev-f303 FastPWM3 millis

Revision:
45:26801179208e
Parent:
37:c0f352d6e8e3
Child:
47:e1196a851f76
--- a/structs.h	Mon Jun 11 00:04:06 2018 +0000
+++ b/structs.h	Wed Jun 27 03:44:44 2018 +0000
@@ -17,23 +17,25 @@
     }COMStruct;
     
 typedef struct{
-    int adc1_raw, adc2_raw, adc3_raw;
-    float i_a, i_b, i_c;
-    float v_bus;
-    float theta_mech, theta_elec;
-    float dtheta_mech, dtheta_elec, dtheta_elec_filt;
-    float i_d, i_q, i_q_filt;
-    float v_d, v_q;
-    float dtc_u, dtc_v, dtc_w;
-    float v_u, v_v, v_w;
-    float d_int, q_int;
-    int adc1_offset, adc2_offset;
-    float i_d_ref, i_q_ref;
-    int loop_count;
-    int timeout;
+    int adc1_raw, adc2_raw, adc3_raw;                       // Raw ADC Values
+    float i_a, i_b, i_c;                                    // Phase currents
+    float v_bus;                                            // DC link voltage
+    float theta_mech, theta_elec;                           // Rotor mechanical and electrical angle
+    float dtheta_mech, dtheta_elec, dtheta_elec_filt;       // Rotor mechanical and electrical angular velocit
+    float i_d, i_q, i_q_filt;                               // D/Q currents
+    float v_d, v_q;                                         // D/Q voltages
+    float dtc_u, dtc_v, dtc_w;                              // Terminal duty cycles
+    float v_u, v_v, v_w;                                    // Terminal voltages
+    float k_d, k_q, ki_d, ki_q, alpha;                      // Current loop gains, current reference filter coefficient
+    float d_int, q_int;                                     // Current error integrals
+    int adc1_offset, adc2_offset;                           // ADC offsets
+    float i_d_ref, i_q_ref, i_d_ref_filt, i_q_ref_filt;     // Current references
+    float did_dt, diq_dt;                                   // Current reference derivatives
+    int loop_count;                                         // Degubbing counter
+    int timeout;                                            // Watchdog counter
     int mode;
-    int ovp_flag;
-    float p_des, v_des, kp, kd, t_ff;
+    int ovp_flag;                                           // Over-voltage flag
+    float p_des, v_des, kp, kd, t_ff;                       // Desired position, velocity, gians, torque
     float cogging[128];
     } ControllerStruct;