SoC estimation
This commit is contained in:
		@ -54,7 +54,7 @@ void shunt_handle_can_msg(uint16_t id, const uint8_t *data) {
 | 
			
		||||
    if (shunt_data.last_current_message > 0) {
 | 
			
		||||
      uint32_t now = HAL_GetTick();
 | 
			
		||||
      float dt = (now - shunt_data.last_current_message) * 0.001f;
 | 
			
		||||
      shunt_data.current_counter += shunt_data.current * dt;
 | 
			
		||||
      shunt_data.current_counter -= shunt_data.current * dt;
 | 
			
		||||
    }
 | 
			
		||||
    shunt_data.last_current_message = HAL_GetTick();
 | 
			
		||||
    break;
 | 
			
		||||
 | 
			
		||||
@ -12,10 +12,10 @@
 | 
			
		||||
#define SOC_ESTIMATION_NO_CURRENT_TIME 100000    // ms
 | 
			
		||||
#define SOC_ESTIMATION_BATTERY_CAPACITY 70300800 // mAs
 | 
			
		||||
ocv_soc_pair_t OCV_SOC_PAIRS[] = {
 | 
			
		||||
    {25000, 0.00f},  {29900, 3.97f},  {32300, 9.36f},  {33200, 12.60f},
 | 
			
		||||
    {33500, 13.68f}, {34100, 20.15f}, {35300, 32.01f}, {38400, 66.53f},
 | 
			
		||||
    {40100, 83.79f}, {40200, 90.26f}, {40400, 94.58f}, {41000, 98.89f},
 | 
			
		||||
    {42000, 100.00f}};
 | 
			
		||||
    {2500, 0.00f},  {2990, 3.97f},  {3230, 9.36f},  {3320, 12.60f},
 | 
			
		||||
    {3350, 13.68f}, {3410, 20.15f}, {3530, 32.01f}, {3840, 66.53f},
 | 
			
		||||
    {4010, 83.79f}, {4020, 90.26f}, {4040, 94.58f}, {4100, 98.89f},
 | 
			
		||||
    {4200, 100.00f}};
 | 
			
		||||
 | 
			
		||||
float current_soc;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user