From f6f4d520d7a38466373fe156025fc6e507a75d4c Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 6 Feb 2024 15:00:20 +0200 Subject: [PATCH 1/3] Fix average temperature calculation --- Software/src/inverter/BYD-CAN.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Software/src/inverter/BYD-CAN.cpp b/Software/src/inverter/BYD-CAN.cpp index 1b0cc036..3909cc2b 100644 --- a/Software/src/inverter/BYD-CAN.cpp +++ b/Software/src/inverter/BYD-CAN.cpp @@ -109,8 +109,9 @@ CAN_frame_t BYD_210 = {.FIR = {.B = static int discharge_current = 0; static int charge_current = 0; static int initialDataSent = 0; -static int temperature_average = 0; - +static int16_t temperature_average = 0; +static int16_t temp_min = 0; +static int16_t temp_max = 0; static int inverter_voltage = 0; static int inverter_SOC = 0; static long inverter_timestamp = 0; @@ -134,7 +135,9 @@ void update_values_can_byd() { //This function maps all the values fetched from MAXDISCHARGEAMP; //Cap the value to the max allowed Amp. Some inverters cannot handle large values. } - temperature_average = ((temperature_max + temperature_min) / 2); + temp_min = temperature_min; //Convert from unsigned to signed + temp_max = temperature_max; + temperature_average = ((temp_max + temp_min) / 2); //Map values to CAN messages //Maxvoltage (eg 400.0V = 4000 , 16bits long) From af8bb72d286de5e54e202141609cd57ae3cde26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C3=96ster?= Date: Tue, 6 Feb 2024 20:40:22 +0200 Subject: [PATCH 2/3] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 166b6a85..ee8d3b33 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -35,6 +35,7 @@ Examples of unacceptable behavior include: address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting +* No excessive self-promotion ## Enforcement Responsibilities From c31d93c62807f18ac9a44ddde76a5ab7d8c9d893 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 6 Feb 2024 21:22:34 +0200 Subject: [PATCH 3/3] Improve serialprintout for Tesla packs --- Software/src/battery/TESLA-MODEL-3-BATTERY.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp index 59aa7c18..12697ad0 100644 --- a/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp +++ b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp @@ -323,13 +323,9 @@ void update_values_tesla_model_3_battery() { //This function maps all the value Serial.print("Battery values: "); Serial.print("Real SOC: "); - Serial.print(soc_vi); + Serial.print(soc_vi / 10.0, 1); print_int_with_units(", Battery voltage: ", volts, "V"); - print_int_with_units(", Battery current: ", (amps * 0.1), "A"); - Serial.println(""); - print_int_with_units("Discharge limit battery: ", discharge_limit, "kW"); - Serial.print(", "); - print_int_with_units("Charge limit battery: ", regenerative_limit, "kW"); + print_int_with_units(", Battery HV current: ", (amps * 0.1), "A"); Serial.print(", Fully charged?: "); if (full_charge_complete) Serial.print("YES, "); @@ -355,7 +351,7 @@ void update_values_tesla_model_3_battery() { //This function maps all the value Serial.print(", "); print_int_with_units("Low Voltage: ", low_voltage, "V"); Serial.println(""); - print_int_with_units("Current Output: ", output_current, "A"); + print_int_with_units("DC/DC 12V current: ", output_current, "A"); Serial.println(""); Serial.println("Values passed to the inverter: "); @@ -364,9 +360,9 @@ void update_values_tesla_model_3_battery() { //This function maps all the value Serial.print(", "); print_int_with_units(" Max charge power: ", max_target_charge_power, "W"); Serial.println(""); - print_int_with_units(" Max temperature: ", (temperature_max * 0.1), "°C"); + print_int_with_units(" Max temperature: ", ((int16_t)temperature_max * 0.1), "°C"); Serial.print(", "); - print_int_with_units(" Min temperature: ", (temperature_min * 0.1), "°C"); + print_int_with_units(" Min temperature: ", ((int16_t)temperature_min * 0.1), "°C"); Serial.println(""); #endif }