FINAL ACS TO BE USED FOR TESTING. COMMISSIONING, ACS MAIN, DATA ACQ ALL DONE.

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of ACS_FULL_Flowchart_BAE by Team Fox

Revision:
5:bb592f3185cc
Parent:
3:07e15677a75c
Child:
6:036d08b62785
--- a/EPS.cpp	Wed Dec 30 04:57:46 2015 +0000
+++ b/EPS.cpp	Thu Dec 31 17:12:52 2015 +0000
@@ -3,7 +3,7 @@
 /***********************************************global variable declaration***************************************************************/
 extern uint32_t BAE_STATUS;
 extern uint32_t BAE_ENABLE;
-
+extern uint8_t BAE_data[73]; 
 
 //m_I2C.frequency(10000)
 const char RCOMP0= 0x97;
@@ -12,6 +12,7 @@
 BAE_HK_min_max bae_HK_minmax;
 BAE_HK_arch arch_data;
 
+
 //......................................Peripheral declarations.........................................................//
 Serial pc_eps(USBTX,USBRX);
 
@@ -191,7 +192,7 @@
     quant_data.BAE_temp_quant=quantiz(tstart,tstep,actual_data.BAE_temp_actual);
     
     for(Iteration=0;Iteration<3;Iteration++){
-        quant_data.AngularSpeed_quant[Iteration]=quantiz(AngularSpeed_start,AngularSpeed_step,actual_data.AngularSpeed_actual[Iteration]);
+        quant_data.AngularSpeed_quant[Iteration]=actual_data.AngularSpeed_actual[Iteration];
     }
     
     for(Iteration=0;Iteration<3;Iteration++){
@@ -206,12 +207,50 @@
     arch_data.EPS_PCB_temp=quant_data.voltage_quant[14];
     arch_data.Batt_SOC=quant_data.Batt_gauge_quant[1];
     arch_data.power_mode=actual_data.power_mode;
+    arch_data.faultPoll_status=actual_data.faultPoll_status;
+    arch_data.faultIr_status=actual_data.faultIr_status;
     arch_data.Batt_voltage=quant_data.Batt_voltage_quant;    
     
     
 }
 
-int quantiz(float start,float step,float x)
+void FCTN_APPEND_HKDATA()
+{
+    // quantized data
+    for (int i=0;i<16;i++)
+        BAE_data[i] = quant_data.voltage_quant[i];
+    for (int i=16;i<28;i++)
+        BAE_data[i] = quant_data.current_quant[i-16];
+    BAE_data[28] = quant_data.Batt_temp_quant[0];
+    BAE_data[29] = quant_data.Batt_temp_quant[1]; 
+    BAE_data[30] = quant_data.Batt_gauge_quant[1]; 
+    BAE_data[31] = quant_data.Batt_gauge_quant[1]; 
+    BAE_data[32] = quant_data.Batt_gauge_quant[1]; 
+    FCTN_CONVERT_FLOAT(quant_data.Batt_gauge_alerts,&BAE_data[33]);
+    BAE_data[37] = quant_data.BAE_temp_quant;
+    FCTN_CONVERT_FLOAT(quant_data.AngularSpeed_quant[0],&BAE_data[38]); 
+    FCTN_CONVERT_FLOAT(quant_data.AngularSpeed_quant[1],&BAE_data[42]); 
+    FCTN_CONVERT_FLOAT(quant_data.AngularSpeed_quant[2],&BAE_data[46]); 
+    FCTN_CONVERT_FLOAT(quant_data.Bvalue_quant[0],&BAE_data[50]); 
+    FCTN_CONVERT_FLOAT(quant_data.Bvalue_quant[1],&BAE_data[54]); 
+    FCTN_CONVERT_FLOAT(quant_data.Bvalue_quant[2],&BAE_data[58]); 
+    BAE_data[62] = quant_data.Batt_voltage_quant;
+    BAE_data[63] = (uint8_t)actual_data.power_mode;      
+    BAE_data[64] = actual_data.faultPoll_status; 
+    BAE_data[65] = actual_data.faultIr_status;
+    // archived data
+    BAE_data[66] = arch_data.Batt_1_temp;            //verify if uint8_t is right
+    BAE_data[67] = arch_data.Batt_2_temp; 
+    BAE_data[68] = arch_data.EPS_PCB_temp;
+    BAE_data[69] = arch_data.Batt_SOC;           
+    BAE_data[70] = (uint8_t)arch_data.power_mode;
+    BAE_data[71] = arch_data.faultPoll_status; 
+    BAE_data[72] = arch_data.faultIr_status;
+    BAE_data[73] = arch_data.Batt_voltage;
+    
+}
+
+uint8_t quantiz(float start,float step,float x)
 {
     int y=(x-start)/step;
     if(y<=0)y=0;