forked from gary/BCU
2
0
Fork 0

单体温感排线错误故障

This commit is contained in:
guzz 2025-02-12 15:02:26 +08:00
parent 0375e81dd6
commit de4f10aaf2
9 changed files with 370 additions and 362271 deletions

View File

@ -240,14 +240,20 @@ void bmu_vlot_breakline_check()
}
static int tempJudge_cnt[26][9] = {0};
//@wkun the here can add temp line break or connect
void bmu_temp_breakline_check()
void bmu_temp_breakline_check(int value, int bmuIdx, int tempIdx)
{
//核心逻辑是通过每个bmu中的温度是否大于60000来确定温感排线是否有问题通过for循环然后将故障塞入kFaultCode_TempCable对应的故障中
//bms_get_bmu_fault_bit(kBmuFaultBit_TempCable)将这个接口中的数据如果有则置1否则为0
if (value > 6000)
{
tempJudge_cnt[bmuIdx][tempIdx]++;
}
if(tempJudge_cnt[bmuIdx][tempIdx] > 1)
{
bms_set_bmu_fault_bit(kBmuFaultBit_TempCable, 1);
}
}
@ -361,7 +367,7 @@ static void bmu_statistic_cell_temp(uint16_t bmuIdx)
void bmu_data_handler(uint32_t base_time)
{
uint8_t bmuIdx = 0,cellIdx = 0,_cellIdx = 0,_bmuIdx = 0,_ntcIdx = 0;
uint16_t current = 0,load = 0;
uint16_t current = 0,load = 0, tempJudge = 0;
//calc cell volt
for(bmuIdx = 0;bmuIdx < bmu_data.total_ic_num;bmuIdx++)
{
@ -388,7 +394,9 @@ void bmu_data_handler(uint32_t base_time)
current = 1;
}
load = (bmu_data.ic[bmuIdx].aux.a_codes[_ntcIdx] / 10) * 1000 / current; //修订索引错误
bmu_data.bmu_unit[bmuIdx].cell_temp_buf[cellIdx] = (bms_get_linear_temp(load, kNtcType_CWFH708_H713) - 500) / 10;
tempJudge = (bms_get_linear_temp(load, kNtcType_CWFH708_H713) - 500) / 10;
bmu_data.bmu_unit[bmuIdx].cell_temp_buf[cellIdx] = tempJudge;
bmu_temp_breakline_check(tempJudge, bmuIdx, _ntcIdx);
}
//统计温度
bmu_statistic_cell_temp(bmuIdx);
@ -396,7 +404,6 @@ void bmu_data_handler(uint32_t base_time)
//alarm monitor
//bmu_comm_offline_check(base_time);
bmu_vlot_breakline_check();
bmu_temp_breakline_check();
}
@ -437,10 +444,14 @@ void bms_poll_bmu(uint32_t base_time)
run_command(6,bmu_data.bmu_num*bmu_data.bmu_ic_num);
bmu_data_handler(base_time);
//温感检测是否脱落加上了防抖需要两次大于6000才设置温感排线错误温感排线错误显示的有点慢
memset(tempJudge_cnt, 0, sizeof(tempJudge_cnt));
//2-5 @wangk add this line bcu statistic data is show
bms_poll_statistic(0);
//2-6 @wangk
bms_poll_run_status(base_time);
//2-10 @wangk
task_dido_ctrl_handle(1000);
}

View File

@ -19,6 +19,7 @@ extern "C" {
//2-6
#include "statistic_manager.h"
#include "run_status.h"
#include "logic_ctrl.h"
typedef struct
{

View File

@ -432,10 +432,12 @@ const uint32_t adIc_default_rate[kAdIc_End] = {1, 1, 1, 1, 1};
//
void bms_init_cur_hv(void)
{
static uint8_t errcnt = 0;
uint32_t i = 0, cnt = 30;
#ifdef ADS_8688_EN
while(drv_ads8688_Init())
while(drv_ads8688_Init() && errcnt < 30)
{
errcnt++;
OSTimeDly(20);
}

View File

@ -26,6 +26,7 @@ void ord_di_do_feedback_func(uint32_t base_time, DiStatus di_signal, DiType di)
di_param_item[di].dly += base_time;
if(di_param_item[di].dly >= 5000)
{
//这里会写进错误--反馈异常,这里的一级代表三级错误
bms_set_fault_level(kFaultCode_Feedback, kFaultLevel_First, kFaultHandle_AlarmIdx);
}
}
@ -93,6 +94,7 @@ void ord_di_breaker1_fun(uint32_t base_time, DiStatus di_signal, DiType di)
{
if((di < kDiType_End) && (di_signal == kDiStatus_Trigger))
{
//这里会写进错误--反馈异常,这里的三级代表一级错误
di_param_item[di].dly += base_time;
bms_set_fault_level(kFaultCode_Feedback, kFaultLevel_Third, kFaultHandle_CutNoRelIdx);
}

View File

@ -106,28 +106,30 @@ void poll_1ms_task_init(void)
bms_init_di_do(bmsCircuitCtrl, kDoCtrlStrategy_End, doLogicArray);
bsp_create_task(&poll_10ms_task, (uint8_t *)"10ms");
KIT_DEBUG_PRINTF("cur_hv init start \r\n");
//KIT_DEBUG_PRINTF("cur_hv init start \r\n");
//debug here is no more run
bms_init_cur_hv();
KIT_DEBUG_PRINTF("cur_hv init ok \r\n");
//KIT_DEBUG_PRINTF("cur_hv init ok \r\n");
while(KIT_GET_BIT_32(is_data_ok, BMU_FINISH_BIT) == 0)
{
bsp_task_delay_ms(10);
}
//耗时初始化 ≈300ms 确保信号正常
KIT_DEBUG_PRINTF("signal init start \r\n");
//KIT_DEBUG_PRINTF("signal init start \r\n");
bms_poll_statistic(0);
bms_init_signal();
//刷新信号策略 确保例如常闭等需要立即闭合do输出
task_dido_ctrl_handle(1000);
KIT_DEBUG_PRINTF("signal init ok \r\n");
//KIT_DEBUG_PRINTF("signal init ok \r\n");
KIT_SET_BIT_MASK_32(is_data_ok, SIGNAL_FINISH_BIT);
bsp_create_task(&ord_ctrl_task, (uint8_t *)"ctrl");
}
void poll_10ms_task_init(void)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,7 @@ uint16_t bcu_total_msg_fill(uint16_t start_addr, uint8_t reg_num, uint8_t *buf)
//READ_FC03_F04_ITEM(1, test99+=10);
//2 动力电池组总电流
READ_FC03_F04_ITEM(2, bms_get_show_current() + 211);
READ_FC03_F04_ITEM(2, bms_get_show_current());
//3 SOC
//READ_FC03_F04_ITEM(3,get_eeprom_data(kEep_SOC,kEepromDataType_Full) / 100);
READ_FC03_F04_ITEM(3, bms_get_soc() / 100);