Prechádzať zdrojové kódy

调整最小容量策略
0.5C,1C,1.5C,>1.5C 放电对应设置的 最小容量系数1.0f, 0.8f, 0.6f, 0.4f

Signed-off-by: huhui <huhui@sharkgulf.com>

huhui 4 rokov pred
rodič
commit
f4a35504b5

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

@@ -232,6 +232,36 @@ static int _can_powerdown(void){
 	return 0;
 }
 
+static void _single_low_judge_current(bool set) {
+	if (!set){
+		bms_health()->b_flags &= ~(B_FLAGS_SINGLE_LOW_CURRENT | B_FLAGS_SINGLE_MID_CURRENT | B_FLAGS_SINGLE_BIG_CURRENT | B_FLAGS_SINGLE_LARGER_CURRENT);
+		return;
+	}
+	if (measure_value()->load_current < MAX_HA*1000/2) { // 0.5C ???
+		bms_health()->b_flags |= B_FLAGS_SINGLE_LOW_CURRENT;
+	}else if (measure_value()->load_current < MAX_HA*1000) { // 1C ???
+		bms_health()->b_flags |= B_FLAGS_SINGLE_MID_CURRENT;
+	}else if (measure_value()->load_current < MAX_HA * 1000 * 3/2) { // 1.5C ???
+		bms_health()->b_flags |= B_FLAGS_SINGLE_BIG_CURRENT;
+	}else {
+		bms_health()->b_flags |= B_FLAGS_SINGLE_LARGER_CURRENT;
+	}
+}
+static void _pack_low_judge_current(bool set) {
+	if (!set){
+		bms_health()->b_flags &= ~(B_FLAGS_PACK_LOW_CURRENT | B_FLAGS_PACK_MID_CURRENT | B_FLAGS_PACK_BIG_CURRENT | B_FLAGS_PACK_LARGER_CURRENT);
+		return;
+	}
+	if (measure_value()->load_current < MAX_HA*1000/2) {
+		bms_health()->b_flags |= B_FLAGS_PACK_LOW_CURRENT;
+	}else if (measure_value()->load_current < MAX_HA*1000) {
+		bms_health()->b_flags |= B_FLAGS_PACK_MID_CURRENT;
+	}else if (measure_value()->load_current < MAX_HA * 1000 * 3/2){
+		bms_health()->b_flags |= B_FLAGS_PACK_BIG_CURRENT;
+	}else {
+		bms_health()->b_flags |= B_FLAGS_PACK_LARGER_CURRENT;
+	}
+}
 
 void check_voltage_state(void) {
 	if (bms_state_get()->charging){ //check sigle cell's voltage for charger
@@ -257,10 +287,12 @@ void check_voltage_state(void) {
 		if ((bms_state_get()->cell_min_vol <= min_discharger_cell_vol[_health.is_work_temp_normal])){
 			if (judge_debounce(!_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
 				_health.sigle_cell_lower_voltage = 1;
+				_single_low_judge_current(true);
 				error_counts.cell_under_voltage++;
 				discharger_lower_cell_voltage = bms_state_get()->cell_min_vol;
 			}
 		}else if ((bms_state_get()->cell_min_vol >= min_discharger_cell_recovery_vol[_health.is_work_temp_normal])){
+			_single_low_judge_current(false);
 			if (judge_debounce(_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
 				_health.sigle_cell_lower_voltage = 0;
 			}
@@ -269,10 +301,12 @@ void check_voltage_state(void) {
 		if (bms_state_get()->pack_voltage <= min_discharger_vol[_health.is_work_temp_normal]){
 			if (judge_debounce(!_health.discharger_lower_voltage, &_discharger_lower_voltage)){
 				_health.discharger_lower_voltage = 1;
+				_pack_low_judge_current(true);
 				error_counts.pack_under_voltage++;
 				discharger_lower_voltage = bms_state_get()->pack_voltage;
 			}
 		}else if (bms_state_get()->pack_voltage >= min_discharger_recovery_vol[_health.is_work_temp_normal]){
+			_pack_low_judge_current(false);
 			if (judge_debounce(_health.discharger_lower_voltage, &_discharger_lower_voltage)){
 				_health.discharger_lower_voltage = 0;
 			}

+ 16 - 0
Application/app/sox/health.h

@@ -54,8 +54,20 @@ typedef struct {
 	};
 	uint8_t    internal_resistance[CELLS_NUM];   //cell's internal resistance
 	uint32_t      pd_time;
+	uint32_t      b_flags;
 }bms_health_t;
 
+#define B_FLAGS_SINGLE_LOW_CURRENT 0x1
+#define B_FLAGS_SINGLE_MID_CURRENT 0x2
+#define B_FLAGS_SINGLE_BIG_CURRENT 0x4
+#define B_FLAGS_SINGLE_LARGER_CURRENT 0x8
+
+#define B_FLAGS_PACK_LOW_CURRENT 0x10
+#define B_FLAGS_PACK_MID_CURRENT 0x20
+#define B_FLAGS_PACK_BIG_CURRENT 0x40
+#define B_FLAGS_PACK_LARGER_CURRENT 0x80
+
+
 typedef struct {
 	uint32_t soft_current_short;
 	uint32_t hard_current_short;
@@ -82,6 +94,10 @@ void health_stop_aux_detect(void);
 uint32_t bms_health_pack_lower_voltage(void);
 uint32_t bms_health_cell_lower_voltage(void);
 void health_log(void);
+#define health_is_low_current() (bms_health()->b_flags & (B_FLAGS_SINGLE_LOW_CURRENT | B_FLAGS_PACK_LOW_CURRENT))
+#define health_is_mid_current() (bms_health()->b_flags & (B_FLAGS_SINGLE_MID_CURRENT | B_FLAGS_PACK_MID_CURRENT))
+#define health_is_big_current() (bms_health()->b_flags & (B_FLAGS_SINGLE_BIG_CURRENT | B_FLAGS_PACK_BIG_CURRENT)) 
+#define health_is_larger_current() (bms_health()->b_flags & (B_FLAGS_SINGLE_LARGER_CURRENT | B_FLAGS_PACK_LARGER_CURRENT)) 
 
 #endif /* _HEALTH_H__ */
 

+ 10 - 1
Application/app/sox/soc.c

@@ -280,7 +280,16 @@ static int _soc_update_by_ocv(uint8_t prev_charge_status){
 		if (_soc.capacity && _soc_is_under_voltage()) {
 			soc_warning("judge calib min col %d - %d\n", shark_get_seconds(), force_full_ts);
 			if (can_modify_min_cap()){
-				_soc.coulomb_min = _soc.coulomb_now; //已经校准过了,而且电池在常温下进入powerdown,最小容量修正为当前容量
+				if (health_is_low_current()) {
+					_soc.coulomb_min = _soc.coulomb_now; //已经校准过了,而且电池在常温下进入powerdown,最小容量修正为当前容量
+				}else if (health_is_mid_current()) {
+					_soc.coulomb_min = _soc.coulomb_now * 0.8f;
+				}else if (health_is_big_current()){
+					_soc.coulomb_min = _soc.coulomb_now * 0.6f;
+				}else {
+					_soc.coulomb_min = _soc.coulomb_now * 0.4f;
+				}
+				_soc.coulomb_now = _soc.coulomb_min;
 				soc_warning("calicablite coulomb_min %f\n", _soc.coulomb_min);
 			}else {
 				_soc.coulomb_now = _soc.coulomb_min;