Przeglądaj źródła

充电单电芯过压,校准容量到100%,通过放电确定真实容量

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 lat temu
rodzic
commit
c782f403da
2 zmienionych plików z 21 dodań i 14 usunięć
  1. 1 0
      Application/app/sox/health.c
  2. 20 14
      Application/app/sox/soc.c

+ 1 - 0
Application/app/sox/health.c

@@ -233,6 +233,7 @@ void check_voltage_state(void) {
 		if ((bms_state_get()->cell_max_vol>= SIGLE_CELL_MAX_CHARGER_VOLTAGE)){
 			if (judge_debounce(!_health.sigle_cell_over_voltage, &_sigle_cell_charger_max_vol)){
 				_health.sigle_cell_over_voltage = 1;
+				sys_debug("sigle cell %d\n", bms_state_get()->cell_max_vol);
 			}
 		}else if ((bms_state_get()->cell_max_vol < SIGLE_CELL_MAX_CHARGER_VOLTAGE)){
 			if (judge_debounce(_health.sigle_cell_over_voltage, &_sigle_cell_charger_max_vol)){

+ 20 - 14
Application/app/sox/soc.c

@@ -166,6 +166,12 @@ static __inline__ int can_modify_min_cap(void){
 	return 0;
 }
 
+static void _force_capacity_full(void){
+	_soc.capacity = 100;
+	is_force_full = 1;
+	force_full_ts = shark_get_seconds();
+}
+
 int soc_update_by_ocv(void){
 	static int ocv_full_count = 0;
 	int changed = 0;
@@ -186,11 +192,13 @@ int soc_update_by_ocv(void){
 			}
 		}
 		if (chargering && !is_force_full){
-			if (bms_state_get()->pack_voltage >= (FULL_MAX_VOLTAGE) && (measure_value()->load_current <= FULL_MIN_CURRENT)){
+			if (bms_health()->sigle_cell_over_voltage) {
+				_force_capacity_full();
+				ocv_full_count = 0;
+				changed = 1;
+			}else if (bms_state_get()->pack_voltage >= (FULL_MAX_VOLTAGE) && (measure_value()->load_current <= FULL_MIN_CURRENT)){
 				if (ocv_full_count++ >= 30) {
-					_soc.capacity = 100;
-					is_force_full = 1;
-					force_full_ts = shark_get_seconds();
+					_force_capacity_full();
 					ocv_full_count = 0;
 					changed = 1;
 				}
@@ -207,21 +215,19 @@ static void soc_calibrate(uint8_t prev_charge_status){
 	static int cali_full_count = 0;
 	if (!(_soc.flags & SOC_FLAG_CALIBRATED)){
 		if (chargering){//ÓÃocv½øÐÐÑϸñУ׼
-			if (!is_force_full && (measure_value()->load_current <= FULL_MIN_CURRENT) && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){				
-				cali_full_count ++;
-				if (cali_full_count == 10) {
+			if (!is_force_full){
+				if ((measure_value()->load_current <= FULL_MIN_CURRENT) && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
+					cali_full_count ++;
+				}
+				if (cali_full_count == 10 || bms_health()->sigle_cell_over_voltage) {
 					soc_debug("calibrate Capacity to 100, measure_value()->load_current %d\n", measure_value()->load_current);
-					_soc.capacity = 100;
-					force_full_ts = shark_get_seconds();
-					is_force_full = 1;
+					_force_capacity_full();
 				}
 			}
 		}else if (prev_charge_status){
-			if(!is_force_full && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
+			if(!is_force_full && ((bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE) || bms_health()->sigle_cell_over_voltage)){
 				soc_debug("calibrate Capacity to 100\n");
-				_soc.capacity = 100;
-				force_full_ts = shark_get_seconds();
-				is_force_full = 1;
+				_force_capacity_full();
 			}
 		}
 	}