|
@@ -33,9 +33,9 @@ static float min_discharger_power_recovery_cell_vol[] = {2200, 2600}; //
|
|
|
|
|
|
|
|
/*能提供大电的最小电压*/
|
|
/*能提供大电的最小电压*/
|
|
|
static float min_discharger_vol[] = {30000, 36000};//允许能放电的最小电压
|
|
static float min_discharger_vol[] = {30000, 36000};//允许能放电的最小电压
|
|
|
-static float min_discharger_recovery_vol[] = {32000, 38000};//恢复放电的最小电压
|
|
|
|
|
-static float min_discharger_cell_vol[] = {2000, 2400};//允许能放电的最小电芯电压
|
|
|
|
|
-static float min_discharger_cell_recovery_vol[] = {2100, 2500};//恢复放电的最小电芯电压
|
|
|
|
|
|
|
+static float min_discharger_recovery_vol[] = {32000, 40000};//恢复放电的最小电压
|
|
|
|
|
+static float min_discharger_cell_vol[] = {2000, 2500};//允许能放电的最小电芯电压
|
|
|
|
|
+static float min_discharger_cell_recovery_vol[] = {2100, 2600};//恢复放电的最小电芯电压
|
|
|
|
|
|
|
|
/*电池PowerDown的最小电压 */
|
|
/*电池PowerDown的最小电压 */
|
|
|
static float min_discharger_pdown_vol[] = {28000, 34000}; //power down的最小电压
|
|
static float min_discharger_pdown_vol[] = {28000, 34000}; //power down的最小电压
|
|
@@ -59,7 +59,7 @@ void health_init(void){
|
|
|
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] = 5;//毫欧,暂时用一个固定数据,后期需要计算R0=(U2-U1)/(I1-I2) - R1(R1为电路上的等效电阻+采样电阻)
|
|
|
}
|
|
}
|
|
|
- _health.is_work_temp_lower = 0;
|
|
|
|
|
|
|
+ _health.is_work_temp_normal = 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bms_health_t *bms_health(){
|
|
bms_health_t *bms_health(){
|
|
@@ -179,8 +179,8 @@ static int _can_powerdown(void){
|
|
|
if (io_state()->charger_detect || bms_state_get()->charging){
|
|
if (io_state()->charger_detect || bms_state_get()->charging){
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- if ((bms_state_get()->pack_voltage <= min_discharger_pdown_vol[_health.is_work_temp_lower] ||
|
|
|
|
|
- bms_state_get()->cell_min_vol <= min_discharger_pdown_cell_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ if ((bms_state_get()->pack_voltage <= min_discharger_pdown_vol[_health.is_work_temp_normal] ||
|
|
|
|
|
+ bms_state_get()->cell_min_vol <= min_discharger_pdown_cell_vol[_health.is_work_temp_normal])){
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
return 0;
|
|
return 0;
|
|
@@ -207,40 +207,40 @@ void check_voltage_state(void) {
|
|
|
//check sigle cell's voltage for discharger
|
|
//check sigle cell's voltage for discharger
|
|
|
_health.charger_over_voltage = _health.sigle_cell_over_voltage = 0;
|
|
_health.charger_over_voltage = _health.sigle_cell_over_voltage = 0;
|
|
|
|
|
|
|
|
- if ((bms_state_get()->cell_min_vol <= min_discharger_cell_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ 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)){
|
|
if (judge_debounce(!_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
|
_health.sigle_cell_lower_voltage = 1;
|
|
_health.sigle_cell_lower_voltage = 1;
|
|
|
}
|
|
}
|
|
|
- }else if ((bms_state_get()->cell_min_vol >= min_discharger_cell_recovery_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ }else if ((bms_state_get()->cell_min_vol >= min_discharger_cell_recovery_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
if (judge_debounce(_health.sigle_cell_lower_voltage, &_sigle_cell_discharger_lower_vol)){
|
|
|
_health.sigle_cell_lower_voltage = 0;
|
|
_health.sigle_cell_lower_voltage = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//check sigle pack's voltage for discharger
|
|
//check sigle pack's voltage for discharger
|
|
|
- if (bms_state_get()->pack_voltage <= min_discharger_vol[_health.is_work_temp_lower]){
|
|
|
|
|
|
|
+ if (bms_state_get()->pack_voltage <= min_discharger_vol[_health.is_work_temp_normal]){
|
|
|
if (judge_debounce(!_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
if (judge_debounce(!_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
|
_health.discharger_lower_voltage = 1;
|
|
_health.discharger_lower_voltage = 1;
|
|
|
}
|
|
}
|
|
|
- }else if (bms_state_get()->pack_voltage >= min_discharger_recovery_vol[_health.is_work_temp_lower]){
|
|
|
|
|
|
|
+ }else if (bms_state_get()->pack_voltage >= min_discharger_recovery_vol[_health.is_work_temp_normal]){
|
|
|
if (judge_debounce(_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
if (judge_debounce(_health.discharger_lower_voltage, &_discharger_lower_voltage)){
|
|
|
_health.discharger_lower_voltage = 0;
|
|
_health.discharger_lower_voltage = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//check for shutdown power
|
|
//check for shutdown power
|
|
|
- if ((bms_state_get()->cell_min_vol <= min_discharger_power_cell_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ if ((bms_state_get()->cell_min_vol <= min_discharger_power_cell_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(!_health.discharger_cell_shutpower_voltage, &_shut_discharger_cell_lower_voltage)){
|
|
if (judge_debounce(!_health.discharger_cell_shutpower_voltage, &_shut_discharger_cell_lower_voltage)){
|
|
|
_health.discharger_cell_shutpower_voltage = 1;
|
|
_health.discharger_cell_shutpower_voltage = 1;
|
|
|
}
|
|
}
|
|
|
- }else if ((bms_state_get()->cell_min_vol >= min_discharger_power_recovery_cell_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ }else if ((bms_state_get()->cell_min_vol >= min_discharger_power_recovery_cell_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(_health.discharger_cell_shutpower_voltage, &_shut_discharger_cell_lower_voltage)){
|
|
if (judge_debounce(_health.discharger_cell_shutpower_voltage, &_shut_discharger_cell_lower_voltage)){
|
|
|
_health.discharger_cell_shutpower_voltage = 0;
|
|
_health.discharger_cell_shutpower_voltage = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if ((bms_state_get()->cell_min_vol <= min_discharger_power_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ if ((bms_state_get()->cell_min_vol <= min_discharger_power_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(!_health.discharger_cell_shutpower_voltage, &_shut_discharger_lower_voltage)){
|
|
if (judge_debounce(!_health.discharger_cell_shutpower_voltage, &_shut_discharger_lower_voltage)){
|
|
|
_health.discharger_shutpower_voltage = 1;
|
|
_health.discharger_shutpower_voltage = 1;
|
|
|
}
|
|
}
|
|
|
- }else if ((bms_state_get()->cell_min_vol >= min_discharger_power_recovery_vol[_health.is_work_temp_lower])){
|
|
|
|
|
|
|
+ }else if ((bms_state_get()->cell_min_vol >= min_discharger_power_recovery_vol[_health.is_work_temp_normal])){
|
|
|
if (judge_debounce(_health.discharger_cell_shutpower_voltage, &_shut_discharger_lower_voltage)){
|
|
if (judge_debounce(_health.discharger_cell_shutpower_voltage, &_shut_discharger_lower_voltage)){
|
|
|
_health.discharger_shutpower_voltage = 0;
|
|
_health.discharger_shutpower_voltage = 0;
|
|
|
}
|
|
}
|
|
@@ -320,6 +320,12 @@ static void _aux_unlock_timer_handler(shark_timer_t *t){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+void health_stop_aux_detect(void){
|
|
|
|
|
+ shark_timer_cancel(&_aux_unlock_timer);
|
|
|
|
|
+ shark_timer_cancel(&_aux_lock_timer);
|
|
|
|
|
+ bms_health()->small_current_short = 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void health_process_aux_lock(void){
|
|
void health_process_aux_lock(void){
|
|
|
if (io_state()->aux_lock_detect) {
|
|
if (io_state()->aux_lock_detect) {
|
|
|
if (AUX_VOL_IS_OPEN()){
|
|
if (AUX_VOL_IS_OPEN()){
|