|
@@ -23,7 +23,7 @@ static int8_t discharger_normal_low_temp[PACK_TEMPS_NUM] = {-10,-10,-10,-5};//
|
|
|
static int8_t discharger_normal_high_temp[PACK_TEMPS_NUM] = {50,50,50,55};//正常的放电最高温度
|
|
static int8_t discharger_normal_high_temp[PACK_TEMPS_NUM] = {50,50,50,55};//正常的放电最高温度
|
|
|
static int8_t discharger_lower_low_temp[PACK_TEMPS_NUM] = {-15,-15,-15,-10}; //需要停止放电的最低温度
|
|
static int8_t discharger_lower_low_temp[PACK_TEMPS_NUM] = {-15,-15,-15,-10}; //需要停止放电的最低温度
|
|
|
static int8_t discharger_higher_high_temp[PACK_TEMPS_NUM] = {55,55,55,60};//需要停止放电的最高温度
|
|
static int8_t discharger_higher_high_temp[PACK_TEMPS_NUM] = {55,55,55,60};//需要停止放电的最高温度
|
|
|
-
|
|
|
|
|
|
|
+static int8_t work_lower_temp[PACK_TEMPS_NUM] = {0,0,0,5};
|
|
|
/*定义低温和正常温度下的电池保护参数, [0]低温参数, [1]常温参数 */
|
|
/*定义低温和正常温度下的电池保护参数, [0]低温参数, [1]常温参数 */
|
|
|
/*能提供动力的最小电压*/
|
|
/*能提供动力的最小电压*/
|
|
|
static float min_discharger_power_vol[] = {32000, 38000}; //允许能提供动力的最小电压
|
|
static float min_discharger_power_vol[] = {32000, 38000}; //允许能提供动力的最小电压
|
|
@@ -58,7 +58,7 @@ void health_init(void){
|
|
|
ml5238_register_notify_handler(check_ml5238_state);
|
|
ml5238_register_notify_handler(check_ml5238_state);
|
|
|
set_log_level(MOD_HEALTH, L_debug);
|
|
set_log_level(MOD_HEALTH, L_debug);
|
|
|
for (int i = 0; i < CELLS_NUM; i++){
|
|
for (int i = 0; i < CELLS_NUM; i++){
|
|
|
- _health.internal_resistance[i] = 5;//毫欧,暂时用一个固定数据,后期需要计算R0=(U2-U1)/(I1-I2) - R1(R1为电路上的等效电阻+采样电阻)
|
|
|
|
|
|
|
+ _health.internal_resistance[i] = 1;//毫欧,暂时用一个固定数据,后期需要计算R0=(U2-U1)/(I1-I2) - R1(R1为电路上的等效电阻+采样电阻)
|
|
|
}
|
|
}
|
|
|
_health.is_work_temp_normal = 1;
|
|
_health.is_work_temp_normal = 1;
|
|
|
}
|
|
}
|
|
@@ -266,6 +266,7 @@ static debounce_t _charger_normal_temp = {.count = 0, .max_count = 10, .init_
|
|
|
static debounce_t _discharger_over_temp = {.count = 0, .max_count = 10, .init_count = 0};
|
|
static debounce_t _discharger_over_temp = {.count = 0, .max_count = 10, .init_count = 0};
|
|
|
static debounce_t _discharger_lower_temp = {.count = 0, .max_count = 10, .init_count = 0};
|
|
static debounce_t _discharger_lower_temp = {.count = 0, .max_count = 10, .init_count = 0};
|
|
|
static debounce_t _discharger_normal_temp = {.count = 0, .max_count = 10, .init_count = 0};
|
|
static debounce_t _discharger_normal_temp = {.count = 0, .max_count = 10, .init_count = 0};
|
|
|
|
|
+static debounce_t _work_lower_temp = {.count = 0, .max_count = 5, .init_count = 0};
|
|
|
|
|
|
|
|
static int _is_over_temp(int8_t *temps){
|
|
static int _is_over_temp(int8_t *temps){
|
|
|
for (int i = 0; i < PACK_TEMPS_NUM; i++){
|
|
for (int i = 0; i < PACK_TEMPS_NUM; i++){
|
|
@@ -411,6 +412,27 @@ void check_temp_state(void){
|
|
|
debounce_reset(_discharger_normal_temp);
|
|
debounce_reset(_discharger_normal_temp);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!_health.is_work_temp_normal){
|
|
|
|
|
+ if (_is_over_temp(work_lower_temp)){
|
|
|
|
|
+ debounce_inc(_work_lower_temp);
|
|
|
|
|
+ if (debounce_reach_max(_work_lower_temp)){
|
|
|
|
|
+ _health.is_work_temp_normal = 1;
|
|
|
|
|
+ debounce_reset(_work_lower_temp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ debounce_reset(_work_lower_temp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if (_is_low_temp(work_lower_temp)){
|
|
|
|
|
+ debounce_inc(_work_lower_temp);
|
|
|
|
|
+ if (debounce_reach_max(_work_lower_temp)){
|
|
|
|
|
+ _health.is_work_temp_normal = 0;
|
|
|
|
|
+ debounce_reset(_work_lower_temp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ debounce_reset(_work_lower_temp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (bms_state_get()->charging){
|
|
if (bms_state_get()->charging){
|
|
|
_health.discharger_over_temp = 0;
|
|
_health.discharger_over_temp = 0;
|
|
|
_health.discharger_lower_temp = 0;
|
|
_health.discharger_lower_temp = 0;
|