fix shunt problem when current is minus
This commit is contained in:
parent
7e580ed58c
commit
9f84c0a1c5
|
@ -394,8 +394,7 @@ void bmu_data_handler(uint32_t base_time)
|
||||||
}
|
}
|
||||||
load = (bmu_data.ic[bmuIdx].aux.a_codes[_ntcIdx] / 10) * 1000 / current; //修订索引错误
|
load = (bmu_data.ic[bmuIdx].aux.a_codes[_ntcIdx] / 10) * 1000 / current; //修订索引错误
|
||||||
tempJudge = (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; origin
|
bmu_data.bmu_unit[bmuIdx].cell_temp_buf[cellIdx] = tempJudge;
|
||||||
bmu_data.bmu_unit[bmuIdx].cell_temp_buf[cellIdx] = 20;
|
|
||||||
bmu_temp_breakline_check(tempJudge, bmuIdx, _ntcIdx);
|
bmu_temp_breakline_check(tempJudge, bmuIdx, _ntcIdx);
|
||||||
}
|
}
|
||||||
//统计温度
|
//统计温度
|
||||||
|
|
|
@ -187,7 +187,7 @@ int16_t bms_caculate_current(uint32_t base_time)
|
||||||
#if CUR_FILTER_ENABLE
|
#if CUR_FILTER_ENABLE
|
||||||
static uint16_t dly = 0;
|
static uint16_t dly = 0;
|
||||||
#endif
|
#endif
|
||||||
int32_t tmp, tmp1, current ,volval = 0;
|
int32_t tmp, tmp1, current ,tmp_cur ,volval = 0;
|
||||||
CurProp *prop;
|
CurProp *prop;
|
||||||
if (cur_item.channel < kCurChannel_End)
|
if (cur_item.channel < kCurChannel_End)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ int16_t bms_caculate_current(uint32_t base_time)
|
||||||
{
|
{
|
||||||
case kCurSensor_Shunt:
|
case kCurSensor_Shunt:
|
||||||
// 分流器 cur_hv_item.cur_volt_avg / cur_prop.shunt_volt * cur_prop.cur_scale;
|
// 分流器 cur_hv_item.cur_volt_avg / cur_prop.shunt_volt * cur_prop.cur_scale;
|
||||||
current = (int32_t)cur_hv_item.value[kAdIc_Cur] * prop->scale / cur_item.shunt_volt / 100;
|
current = (int32_t)cur_hv_item.value[kAdIc_Cur] * prop->scale / cur_item.shunt_volt / 10;
|
||||||
//current = HighResCurTrans(cur_hv_item.value[kAdIc_Cur]);
|
//current = HighResCurTrans(cur_hv_item.value[kAdIc_Cur]);
|
||||||
break;
|
break;
|
||||||
case kCurSensor_SigHall:
|
case kCurSensor_SigHall:
|
||||||
|
@ -242,12 +242,12 @@ int16_t bms_caculate_current(uint32_t base_time)
|
||||||
{
|
{
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
current = (int64_t)current * get_eeprom_data(kEep_Hall1CalFactor, kEepromDataType_Full) / 1000;
|
//current = (int64_t)current * get_eeprom_data(kEep_Hall1CalFactor, kEepromDataType_Full) / 1000;
|
||||||
|
tmp_cur = current / 10;
|
||||||
//调试
|
//调试
|
||||||
bms_integral_soc(current, base_time);
|
bms_integral_soc(tmp_cur, base_time);
|
||||||
|
|
||||||
cur_hv_item.current = current * 10;
|
cur_hv_item.current = current;
|
||||||
|
|
||||||
#if CUR_FILTER_ENABLE
|
#if CUR_FILTER_ENABLE
|
||||||
dly += base_time;
|
dly += base_time;
|
||||||
|
@ -346,8 +346,19 @@ void get_ad_sample(void)
|
||||||
dir = -1;
|
dir = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(i == kAdIc_Cur)
|
||||||
|
// {
|
||||||
|
// if(cur_hv_item.ad_avg[i] < 0)
|
||||||
|
// {
|
||||||
|
// ad = 32769 - KIT_ABS(cur_hv_item.ad_avg[i]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
ad = KIT_ABS(cur_hv_item.ad_avg[i]);
|
ad = KIT_ABS(cur_hv_item.ad_avg[i]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (i == kAdIc_HvIso)
|
if (i == kAdIc_HvIso)
|
||||||
{
|
{
|
||||||
//cur_hv_item.value[i] = HighVolTrans2(ad)/100;
|
//cur_hv_item.value[i] = HighVolTrans2(ad)/100;
|
||||||
|
@ -376,6 +387,11 @@ void get_ad_sample(void)
|
||||||
// temp_calc = (int64_t)ad * 15625 / 10000;
|
// temp_calc = (int64_t)ad * 15625 / 10000;
|
||||||
// ad = temp_calc / 100; //单位是0.1 mv
|
// ad = temp_calc / 100; //单位是0.1 mv
|
||||||
|
|
||||||
|
if(cur_hv_item.ad_avg[i] < 0)
|
||||||
|
{
|
||||||
|
ad = 32769 - KIT_ABS(cur_hv_item.ad_avg[i]);
|
||||||
|
}
|
||||||
|
|
||||||
ad = (ad * 2560 * 10 * 100 / (0x01 << 15)) / 82; //单位是0.1 mv
|
ad = (ad * 2560 * 10 * 100 / (0x01 << 15)) / 82; //单位是0.1 mv
|
||||||
|
|
||||||
// 防止eeprom中没有设置电压校准系数
|
// 防止eeprom中没有设置电压校准系数
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue