123487

Dependencies:   mbed-dev-f303 FastPWM3

Revision:
56:9353ebcf19c6
Parent:
54:d889fe62bc0c
Child:
57:8200454194cf
--- a/main.cpp	Tue Nov 19 08:54:35 2019 +0000
+++ b/main.cpp	Thu Jan 02 16:15:46 2020 +0000
@@ -12,7 +12,7 @@
 
 #define VERSION_NUM "1.9"
 
-
+int torque_count=0;   //shaorui add
 float __float_reg[64];                                                          // Floats stored in flash
 int __int_reg[256];                                                             // Ints stored in flash.  Includes position sensor calibration lookup table
 
@@ -232,7 +232,15 @@
 
                 controller.timeout++;
                 count++; 
-            
+                /***********shaorui add for torque_des**********/
+               // torque_count++;
+               // if(torque_count>50000)
+                   // {
+                       // printf("the desired iq : %.3f\n\r",controller. i_q_ref);
+                       // printf("the desired torque : %.3f\n\r",KT_OUT*controller. i_q_ref);
+                       // torque_count=0;    
+                   // }
+                /***********shaorui endfor torque_des**********/
                 }     
                 break;
             case SETUP_MODE:
@@ -473,7 +481,13 @@
             //printf("%.3f  %.3f  %.3f\n\r", (float)observer.temperature, (float)observer.temperature2, observer.resistance);
             //printf("%.3f  %.3f  %.3f %.3f %.3f\n\r", controller.v_d, controller.v_q, controller.i_d_filt, controller.i_q_filt, controller.dtheta_elec);
             //printf("%.3f\n\r", controller.dtheta_mech);
-            wait(.002);
+            //wait(.002);
+            //printf(" True speed:  %.3f\n\r", controller.dtheta_mech*60/(2*PI));  //shaorui ADD
+            //wait(2);
+              //printf("speed:%.3f\n\r", controller.dtheta_mech);
+            printf("position:%.3f\n\r", controller.theta_mech*360/(2*PI));
+            //wait(.002);
+            wait(1);
         }