Prius IPM controller

Dependencies:   mbed

Fork of analoghalls5_5 by N K

Revision:
21:da41c08e51bc
Parent:
16:fd6771a6685a
Child:
22:46d164aa4f1c
--- a/callbacks.cpp	Mon Mar 09 03:36:59 2015 +0000
+++ b/callbacks.cpp	Mon Mar 09 05:07:49 2015 +0000
@@ -8,25 +8,22 @@
 
 void fast(Context *c) {
     float alpha, beta, d, q, ref_d, ref_q, valpha, vbeta;
-    float I_b, I_c, angle;
+    float I_b, I_c, angle, d_filtered, q_filtered, vd, vq;
     I_b = c->motor->GetCurrentB();
     I_c = c->motor->GetCurrentC();
     angle = c->motor->GetPosition();
     dbg_angle = angle;
-    
+
     Clarke(-(I_b + I_c), I_b, &alpha, &beta); //--switched to standard clarke transform
     Parke(alpha, beta, angle, &d, &q);
     
-    float d_filtered = c->filter_d->Update(d);
-    float q_filtered = c->filter_q->Update(q); //--was Update(d), not sure if my typo or orignal
-    
-    dbg_d_filtered = d_filtered;
-    dbg_q_filtered = q_filtered;
+    d_filtered = c->filter_d->Update(d);
+    q_filtered = c->filter_q->Update(q); //--was Update(d), not sure if my typo or orignal
 
     c->reference->GetReference(angle, c->user->throttle, &ref_d, &ref_q);
-    
-    float vd = c->pid_d->Update(ref_d, d_filtered);
-    float vq = c->pid_q->Update(ref_q, q_filtered);
+
+    vd = c->pid_d->Update(ref_d, d_filtered);
+    vq = c->pid_q->Update(ref_q, q_filtered);
     
     vd = 0.0f;
     vq = c->user->throttle;
@@ -41,5 +38,5 @@
 }
 
 void debug(Context *c) {
-    c->serial->printf("%f \n\r", dbg_angle);
+    c->serial->printf("%f %f %f %f\n\r", dbg_angle, dbg_dtcA, dbg_dtcB, dbg_dtcC);
 }
\ No newline at end of file