Debug SOC calculation to match CLUSTER

This commit is contained in:
Carsten Schmiemann 2022-09-08 12:23:18 +02:00
parent 3433335cbe
commit 5955b23617

View file

@ -46,13 +46,18 @@ void OvmsVehicleRenaultZoePh2OBD::IncomingLBC(uint16_t type, uint16_t pid, const
}
case 0x9002: { //Battery SOC
//StandardMetrics.ms_v_bat_soc->SetValue((float) (CAN_UINT(0)) * 0.01, Percentage);
if ( ((CAN_UINT(0)) * 0.01) < 100 ) {
StandardMetrics.ms_v_bat_soc->SetValue((float) ((CAN_UINT(0)) * 0.01)+(float) ((CAN_UINT(0)) * 0.01)*0.03, Percentage);
float bat_soc = CAN_UINT(0) * 0.01;
if ( bat_soc < 100.0f ) {
StandardMetrics.ms_v_bat_soc->SetValue(bat_soc + (bat_soc * 0.03), Percentage);
} else {
StandardMetrics.ms_v_bat_soc->SetValue((float) 100, Percentage);
StandardMetrics.ms_v_bat_soc->SetValue(100.0f, Percentage);
}
StandardMetrics.ms_v_bat_cac->SetValue(Bat_cell_capacity * CAN_UINT(0) * 0.0001);
//ESP_LOGD(TAG, "9002 LBC mt_bat_lbc_soc: %f", CAN_UINT(0) * 0.01);
ESP_LOGD(TAG, "9002 LBC mt_bat_lbc_soc: %f", bat_soc);
ESP_LOGD(TAG, "9002 LBC mt_bat_lbc_soc calculated: %f", bat_soc + (bat_soc * 0.03));
break;
}
case 0x9003: { //Battery SOH