Quellcode durchsuchen

Merge branch 'master' of http://192.168.0.107/bms/BMS_LFP

FuangCao vor 5 Jahren
Ursprung
Commit
dfea82b899
1 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
  1. 7 3
      Application/app/sox/soc.c

+ 7 - 3
Application/app/sox/soc.c

@@ -23,6 +23,8 @@ uint32_t charger_remain_time = 0;
 
 #define DEFALUT_MAX_COULOMB (MAX_HA * 3600.0f)
 #define DEFALUT_MIN_COULOMB (25.0f * 3600.0f)
+#define FULL_MAX_VOLTAGE (53500)//mV
+#define FULL_MIN_CURRENT (500.0f) //mA
 static void calibrate_soc_by_ocv(void);
 
 #if LEAST_SQUARE==1
@@ -167,7 +169,7 @@ int soc_update_by_ocv(void){
 			}
 		}
 		if (chargering && !is_force_full){
-			if (bms_state_get()->pack_voltage >= (53500) && (measure_value()->load_current <= 500.0f)){
+			if (bms_state_get()->pack_voltage >= (FULL_MAX_VOLTAGE) && (measure_value()->load_current <= FULL_MIN_CURRENT)){
 				_soc.capacity = 100;
 				is_force_full = 1;
 				changed = 1;
@@ -182,7 +184,7 @@ 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 <= 500.0f) && (bms_state_get()->pack_voltage >= 53500)){				
+			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) {
 					soc_debug("calibrate Capacity to 100, measure_value()->load_current %d\n", measure_value()->load_current);
@@ -191,7 +193,7 @@ static void soc_calibrate(uint8_t prev_charge_status){
 				}
 			}
 		}else if (prev_charge_status){
-			if(!is_force_full && (bms_state_get()->pack_voltage >= 53500)){
+			if(!is_force_full && (bms_state_get()->pack_voltage >= FULL_MAX_VOLTAGE)){
 				soc_debug("calibrate Capacity to 100\n");
 				_soc.capacity = 100;
 				is_force_full = 1;
@@ -270,10 +272,12 @@ static void soc_update_by_current_and_time(float current_now, float delta_time,
 			soc_warning("calibrate OK, charging coulomb: %f\n", _soc.charger_coulomb);
 		}else { //如果校准过,单电芯过压,100%的容量,设置最大容量为当前容量
 			if (bms_health()->sigle_cell_over_voltage){
+#if 0	/* 暂时去掉,最大容量不变化,只校准欠压后的可放电的最小容量 */			
 				if ((_soc.coulomb_now >= DEFALUT_MIN_COULOMB) && (_soc.coulomb_now <= DEFALUT_MAX_COULOMB)) {
 					_soc.coulomb_max = _soc.coulomb_now;
 					soc_warning("signal cell over vol, cap full, reset coul max to coul now: %f\n", _soc.coulomb_max);
 				}
+#endif 				
 			}
 		}
 	}