|
|
@@ -77,7 +77,7 @@ void soc_restore_by_iap(uint8_t flags, uint8_t capaticy){
|
|
|
nv_save_all_soc();
|
|
|
}
|
|
|
|
|
|
-static void soc_jugde_temp(void){
|
|
|
+static void soc_update_discharger_coeff(void){
|
|
|
int low_temp = 0xFFFF;
|
|
|
for (int i = 0; i < PACK_TEMPS_NUM-1; i++) {
|
|
|
low_temp = MIN(low_temp, measure_value()->pack_temp[i]);
|
|
|
@@ -98,6 +98,35 @@ static void soc_jugde_temp(void){
|
|
|
}
|
|
|
force_full_ts = 0xFFFFFFFF;
|
|
|
}
|
|
|
+ if (_soc.flags & SOC_FLAG_CALIBRATED) {
|
|
|
+ float coff = 1.0f;
|
|
|
+ if (_soc.capacity <= 20) {
|
|
|
+ if (abs(measure_value()->load_current) >= 50000) {
|
|
|
+ coff = 1.06f;
|
|
|
+ }else if (abs(measure_value()->load_current) >= 40000) {
|
|
|
+ coff = 1.05f;
|
|
|
+ }else if (abs(measure_value()->load_current) >= 30000) {
|
|
|
+ coff = 1.03f;
|
|
|
+ }
|
|
|
+ }else if (_soc.capacity <= 40) {
|
|
|
+ if (abs(measure_value()->load_current) >= 50000) {
|
|
|
+ coff = 1.05f;
|
|
|
+ }else if (abs(measure_value()->load_current) >= 40000) {
|
|
|
+ coff = 1.03f;
|
|
|
+ }else if (abs(measure_value()->load_current) >= 30000) {
|
|
|
+ coff = 1.02f;
|
|
|
+ }
|
|
|
+ }else if (_soc.capacity <= 60) {
|
|
|
+ if (abs(measure_value()->load_current) >= 50000) {
|
|
|
+ coff = 1.03f;
|
|
|
+ }else if (abs(measure_value()->load_current) >= 40000) {
|
|
|
+ coff = 1.02f;
|
|
|
+ }else if (abs(measure_value()->load_current) >= 30000) {
|
|
|
+ coff = 1.01f;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _discharger_coefficient = _discharger_coefficient * coff;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#if LEAST_SQUARE==1
|
|
|
@@ -226,6 +255,18 @@ static int _soc_is_under_voltage(void) {
|
|
|
bms_health()->discharger_lower_voltage);
|
|
|
}
|
|
|
|
|
|
+static int _soc_force_capaticy(uint8_t capaticy){
|
|
|
+ float cap = (float)capaticy / 100.0f;
|
|
|
+ float min = (_soc.coulomb_now - cap * _soc.coulomb_max)/(1.0f - cap);
|
|
|
+ if (min > 0.0f) {
|
|
|
+ _soc.coulomb_min = min;
|
|
|
+ _soc.capacity = capaticy;
|
|
|
+ force_full_ts = 0xFFFFFFFF;
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int _soc_update_by_ocv(uint8_t prev_charge_status){
|
|
|
static int ocv_full_count = 0;
|
|
|
int changed = 0;
|
|
|
@@ -243,6 +284,9 @@ static int _soc_update_by_ocv(uint8_t prev_charge_status){
|
|
|
}
|
|
|
_soc.capacity = 0;
|
|
|
return 1;
|
|
|
+ }else if ((!prev_charge_status) && (bms_state_get()->cell_min_vol <= 2900) && (_soc.capacity > 10)) {
|
|
|
+ /* 如果单电芯最小电压小于2.9v,并且容量大于10%,需要校准到10% */
|
|
|
+ return _soc_force_capaticy(10);
|
|
|
}
|
|
|
}
|
|
|
if (chargering || prev_charge_status) {
|
|
|
@@ -353,7 +397,7 @@ static void soc_update_by_current_and_time(float current_now, float delta_time,
|
|
|
update_capticy = 1;
|
|
|
}
|
|
|
}else {
|
|
|
- soc_jugde_temp();
|
|
|
+ soc_update_discharger_coeff();
|
|
|
delta_q = delta_q * _discharger_coefficient;
|
|
|
_soc.dischrger_coulomb += abs(delta_q);
|
|
|
if ((est_capaticy > 0) && (est_capaticy <= _soc.capacity)) { //放电,容量不能等于0,需要靠欠压或者PowerDown 矫正到0
|