Add switch bedween user and lbc SOC
This commit is contained in:
parent
061746588f
commit
869138633f
|
@ -229,6 +229,11 @@ void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const ch
|
|||
ESP_LOGD(TAG, "2009 EVC mt_v_env_pressure: %d mbar", CAN_UINT(0));
|
||||
break;
|
||||
}
|
||||
case 0x21CD: { // User SOC
|
||||
mt_bat_user_soc->SetValue((float) (CAN_UINT(0)) * 0.01, Percentage);
|
||||
ESP_LOGD(TAG, "21CD EVC mt_bat_user_soc: %f", CAN_UINT(0) * 0.01);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
char *buf = NULL;
|
||||
|
|
|
@ -45,8 +45,8 @@ void OvmsVehicleRenaultZoePh2::IncomingLBC(uint16_t type, uint16_t pid, const ch
|
|||
break;
|
||||
}
|
||||
case 0x9002: { //Battery SOC
|
||||
StandardMetrics.ms_v_bat_soc->SetValue((float) (CAN_UINT(0)) * 0.01, Percentage);
|
||||
//ESP_LOGD(TAG, "9002 LBC ms_v_bat_soc: %f", CAN_UINT(0) * 0.01);
|
||||
mt_bat_lbc_soc->SetValue((float) (CAN_UINT(0)) * 0.01, Percentage);
|
||||
//ESP_LOGD(TAG, "9002 LBC mt_bat_lbc_soc: %f", CAN_UINT(0) * 0.01);
|
||||
break;
|
||||
}
|
||||
case 0x9003: { //Battery SOH
|
||||
|
|
|
@ -61,6 +61,7 @@ static const OvmsVehicle::poll_pid_t renault_zoe_polls[] = {
|
|||
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x300B, { 0, 2, 300, 10 }, 0, ISOTP_EXTFRAME }, // AC phases
|
||||
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2B8A, { 0, 2, 300, 10 }, 0, ISOTP_EXTFRAME }, // AC mains voltage
|
||||
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2009, { 0, 20, 20, 20 }, 0, ISOTP_EXTFRAME }, // Ambient air pressure
|
||||
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x21CD, { 0, 10, 10, 10 }, 0, ISOTP_EXTFRAME }, // User SOC
|
||||
|
||||
//BCM
|
||||
//{ 0x745, 0x765, VEHICLE_POLL_TYPE_OBDIISESSION, SESSION_DEFAULT, { 0, 60, 60, 60 }, 0, ISOTP_STD }, // OBD Extended Diagnostic Session
|
||||
|
|
|
@ -46,14 +46,14 @@ using namespace std;
|
|||
void OvmsVehicleRenaultZoePh2::WebCfgCommon(PageEntry_t& p, PageContext_t& c)
|
||||
{
|
||||
std::string error, rangeideal, battcapacity;
|
||||
bool UseCarTrip;
|
||||
bool UseBMScalculation;
|
||||
bool UseCarTrip, UseBMScalculation, UseBMSsoc;
|
||||
|
||||
if (c.method == "POST") {
|
||||
rangeideal = c.getvar("rangeideal");
|
||||
battcapacity = c.getvar("battcapacity");
|
||||
UseCarTrip = (c.getvar("UseCarTrip") == "no");
|
||||
UseBMScalculation = (c.getvar("UseBMScalculation") == "no");
|
||||
UseBMSsoc = (c.getvar("UseBMSsoc") == "no");
|
||||
|
||||
if (!rangeideal.empty()) {
|
||||
int v = atoi(rangeideal.c_str());
|
||||
|
@ -66,6 +66,7 @@ void OvmsVehicleRenaultZoePh2::WebCfgCommon(PageEntry_t& p, PageContext_t& c)
|
|||
MyConfig.SetParamValue("xrz2", "battcapacity", battcapacity);
|
||||
MyConfig.SetParamValueBool("xrz2", "UseCarTrip", UseCarTrip);
|
||||
MyConfig.SetParamValueBool("xrz2", "UseBMScalculation", UseBMScalculation);
|
||||
MyConfig.SetParamValueBool("xrz2", "UseBMSsoc", UseBMSsoc);
|
||||
|
||||
c.head(200);
|
||||
c.alert("success", "<p class=\"lead\">Renault Zoe Ph2 battery setup saved.</p>");
|
||||
|
@ -84,6 +85,7 @@ void OvmsVehicleRenaultZoePh2::WebCfgCommon(PageEntry_t& p, PageContext_t& c)
|
|||
battcapacity = MyConfig.GetParamValue("xrz2", "battcapacity", "52000");
|
||||
UseCarTrip = MyConfig.GetParamValueBool("xrz2", "UseCarTrip", false);
|
||||
UseBMScalculation = MyConfig.GetParamValueBool("xrz2", "UseBMScalculation", false);
|
||||
UseBMSsoc = MyConfig.GetParamValueBool("xrz2", "UseBMSsoc", false);
|
||||
c.head(200);
|
||||
}
|
||||
|
||||
|
@ -107,11 +109,20 @@ void OvmsVehicleRenaultZoePh2::WebCfgCommon(PageEntry_t& p, PageContext_t& c)
|
|||
c.input_radio_option("UseCarTrip", "Car trip counter from Cluster", "yes", UseCarTrip == true);
|
||||
c.input_radio_end("");
|
||||
|
||||
c.fieldset_end();
|
||||
|
||||
c.fieldset_start("Battery energy calculation");
|
||||
|
||||
c.input_radio_start("Which trip energy calculation?", "UseBMScalculation");
|
||||
c.input_radio_option("UseBMScalculation", "OVMS energy calculation", "no", UseBMScalculation == false);
|
||||
c.input_radio_option("UseBMScalculation", "BMS-based calculation", "yes", UseBMScalculation == true);
|
||||
c.input_radio_end("");
|
||||
|
||||
c.input_radio_start("State of Charge - Display", "UseBMSsoc");
|
||||
c.input_radio_option("UseBMSsoc", "Use SOC from Cluster", "no", UseBMSsoc == false);
|
||||
c.input_radio_option("UseBMSsoc", "Real SOC from BMS", "yes", UseBMSsoc == true);
|
||||
c.input_radio_end("");
|
||||
|
||||
c.fieldset_end();
|
||||
|
||||
c.print("<hr>");
|
||||
|
|
|
@ -89,6 +89,8 @@ OvmsVehicleRenaultZoePh2::OvmsVehicleRenaultZoePh2() {
|
|||
mt_hvac_compressor_power = MyMetrics.InitFloat("zph2.h.compressor.power", SM_STALE_MID, 0, Watts);
|
||||
mt_hvac_compressor_mode = MyMetrics.InitString("zph2.h.compressor.mode", SM_STALE_MID, 0);
|
||||
mt_v_env_pressure = MyMetrics.InitFloat("zph2.v.e.pressure", SM_STALE_MIN, 0);
|
||||
mt_bat_lbc_soc = MyMetrics.InitFloat("zph2.b.lbc.soc", SM_STALE_NONE, 0, Percentage);
|
||||
mt_bat_user_soc = MyMetrics.InitFloat("zph2.b.user.soc", SM_STALE_NONE, 0, Percentage);
|
||||
|
||||
// BMS configuration:
|
||||
BmsSetCellArrangementVoltage(96, 1);
|
||||
|
@ -116,6 +118,7 @@ void OvmsVehicleRenaultZoePh2::ConfigChanged(OvmsConfigParam* param) {
|
|||
m_battery_capacity = MyConfig.GetParamValueInt("xrz2", "battcapacity", 52000);
|
||||
m_UseCarTrip = MyConfig.GetParamValueBool("xrz2", "UseCarTrip", false);
|
||||
m_UseBMScalculation = MyConfig.GetParamValueBool("xrz2", "UseBMScalculation", false);
|
||||
m_UseBMSsoc = MyConfig.GetParamValueBool("xrz2", "UseBMSsoc", false);
|
||||
StandardMetrics.ms_v_bat_range_ideal->SetValue(m_range_ideal, Kilometers);
|
||||
ESP_LOGI(TAG, "Renault Zoe Ph2 reload configuration: Range ideal: %d, Battery capacity: %d, Use Car trip counter: %s, Use BMS as energy cout: %s", m_range_ideal, m_battery_capacity, m_UseCarTrip ? "Yes" : "No", m_UseBMScalculation ? "yes" : "no");
|
||||
}
|
||||
|
@ -320,6 +323,12 @@ void OvmsVehicleRenaultZoePh2::Ticker1(uint32_t ticker) {
|
|||
StandardMetrics.ms_v_pos_trip->SetValue(mt_pos_car_trip->AsFloat());
|
||||
}
|
||||
StandardMetrics.ms_v_bat_range_est->SetValue((m_range_ideal * (StandardMetrics.ms_v_bat_soc->AsFloat(1) * 0.01)), Kilometers);
|
||||
|
||||
if(m_UseBMSsoc) {
|
||||
StandardMetrics.ms_v_bat_soc->SetValue(mt_bat_lbc_soc->AsFloat(0));
|
||||
} else {
|
||||
StandardMetrics.ms_v_bat_soc->SetValue(mt_bat_user_soc->AsFloat(0));
|
||||
}
|
||||
}
|
||||
|
||||
class OvmsVehicleRenaultZoePh2Init {
|
||||
|
|
|
@ -81,6 +81,7 @@ class OvmsVehicleRenaultZoePh2 : public OvmsVehicle {
|
|||
int m_battery_capacity;
|
||||
bool m_UseCarTrip = false;
|
||||
bool m_UseBMScalculation = false;
|
||||
bool m_UseBMSsoc = false;
|
||||
void IncomingINV(uint16_t type, uint16_t pid, const char* data, uint16_t len);
|
||||
void IncomingEVC(uint16_t type, uint16_t pid, const char* data, uint16_t len);
|
||||
void IncomingBCM(uint16_t type, uint16_t pid, const char* data, uint16_t len);
|
||||
|
@ -106,6 +107,8 @@ class OvmsVehicleRenaultZoePh2 : public OvmsVehicle {
|
|||
OvmsMetricFloat *mt_bat_aux_power_consumer; //Power usage by consumer
|
||||
OvmsMetricFloat *mt_bat_aux_power_ptc; //Power usage by PTCs
|
||||
OvmsMetricFloat *mt_bat_max_charge_power; //Battery max allowed charge, recd power
|
||||
OvmsMetricFloat *mt_bat_lbc_soc; //Battery real SOC by BMS
|
||||
OvmsMetricFloat *mt_bat_user_soc; //Battery user SOC by Cluster
|
||||
OvmsMetricFloat *mt_main_power_available; //Mains power available
|
||||
OvmsMetricString *mt_main_phases; //Mains phases used
|
||||
OvmsMetricFloat *mt_main_phases_num; //Mains phases used
|
||||
|
|
Loading…
Reference in New Issue