Compare commits

..

No commits in common. "75b9136a1dd929aa9b625b2b7c069909e927fb8c" and "6c0bbb83f6fcf379a328dff2d24f03ac07877d6d" have entirely different histories.

2 changed files with 8 additions and 15 deletions

View File

@ -7,12 +7,12 @@ extern uint8_t current_soc;
#define N_MODELPARAMETERS 11 #define N_MODELPARAMETERS 11
#define BATTERYCAPACITYAs (20000.0*3600) //TODO Check if value is correct Cap in Ah * 3600 (Convert to As) #define BATTERYCAPACITYAs (21000.0*3600) //TODO Check if value is correct Cap in Ah * 3600 (Convert to As)
void soc_init(); void soc_init();
void soc_update(int32_t shunt_current); void soc_update(int32_t shunt_current);
float soe_update(); void soe_update();
void soap_update(); void soap_update();
#endif // INC_SOC_ESTIMATION_H #endif // INC_SOC_ESTIMATION_H

View File

@ -13,7 +13,7 @@ const float R0[N_MODELPARAMETERS]={0.0089,0.0087,0.0090,0.0087,0.0087,0.0087,0.0
const float R1[N_MODELPARAMETERS]={0.0164,0.0063,0.0050,0.0055,0.0051,0.0052,0.0057,0.0048,0.0059,0.0055,0.0061}; const float R1[N_MODELPARAMETERS]={0.0164,0.0063,0.0050,0.0055,0.0051,0.0052,0.0057,0.0048,0.0059,0.0055,0.0061};
const float C1[N_MODELPARAMETERS]={2.5694,0.2649,0.2876,0.2594,0.2415,0.2360,0.2946,0.2558,0.2818,0.2605,0.2763}; const float C1[N_MODELPARAMETERS]={2.5694,0.2649,0.2876,0.2594,0.2415,0.2360,0.2946,0.2558,0.2818,0.2605,0.2763};
const float OCV_Data[N_MODELPARAMETERS]={2.762504,3.326231,3.460875,3.57681,3.655326,3.738444,3.835977,3.925841,4.032575,4.078275,4.191449}; const float OCV_Data[N_MODELPARAMETERS]={2.762504,3.326231,3.460875,3.57681,3.655326,3.738444,3.835977,3.925841,4.032575,4.078275,4.191449};
const float SOE_Data[N_MODELPARAMETERS]={0.0,0.079358,0.165140,0.256008,0.348836,0.445961,0.549115,0.655642,0.769677,0.875699,1.0};
//--------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------
@ -60,26 +60,19 @@ void soc_update(int32_t shunt_current) {
} }
float soe_update() void soe_update()
{ {
return soc_approxparameterbysoc(current_floatsoc, SOE_Data, N_MODELPARAMETERS); //TODO
} }
void soap_update() void soap_update()
{ {
// //TODO
} }
float soc_approxparameterbysoc(float soc,float* lut, uint8_t lutlen) float soc_approxparameterbysoc(float soc,float* lut, uint8_t lutlen)
{ {
//TODO
uint8_t idx = (uint8_t) (soc*(lutlen-1)); return 0;
if(idx == (lutlen-1))
return lut[lutlen-1];
float linapprox = 10*(soc-(((float)idx)/((float)(lutlen-1))))*(lut[idx+1]-lut[idx]);
linapprox += lut[idx];
return linapprox;
} }
float soc_approxsocbyocv(float ocv) float soc_approxsocbyocv(float ocv)