mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Add way to omit broken temperature sensor
This commit is contained in:
parent
6f717841a0
commit
0ba4f9e84b
2 changed files with 25 additions and 2 deletions
|
@ -135,9 +135,30 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
|
|
||||||
datalayer.battery.status.cell_min_voltage_mV = BMS_lowest_cell_voltage_mV;
|
datalayer.battery.status.cell_min_voltage_mV = BMS_lowest_cell_voltage_mV;
|
||||||
|
|
||||||
datalayer.battery.status.temperature_min_dC = BMS_lowest_cell_temperature * 10; // Add decimals
|
// Initialize min and max variables for temperature calculation
|
||||||
|
battery_calc_min_temperature = battery_daughterboard_temperatures[0];
|
||||||
|
battery_calc_max_temperature = battery_daughterboard_temperatures[0];
|
||||||
|
|
||||||
datalayer.battery.status.temperature_max_dC = BMS_highest_cell_temperature * 10;
|
// Loop through the array of 10x daughterboard temps to find the smallest and largest values
|
||||||
|
// Note, it is possible for user to skip using a faulty sensor in the .h file
|
||||||
|
if (SKIP_TEMPERATURE_SENSOR_NUMBER == 1) { //If sensor 1 is skipped, init minmax to sensor 2
|
||||||
|
battery_calc_min_temperature = battery_daughterboard_temperatures[1];
|
||||||
|
battery_calc_max_temperature = battery_daughterboard_temperatures[1];
|
||||||
|
}
|
||||||
|
for (int i = 1; i < 10; i++) {
|
||||||
|
if (i == SKIP_TEMPERATURE_SENSOR_NUMBER) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (battery_daughterboard_temperatures[i] < battery_calc_min_temperature) {
|
||||||
|
battery_calc_min_temperature = battery_daughterboard_temperatures[i];
|
||||||
|
}
|
||||||
|
if (battery_daughterboard_temperatures[i] > battery_calc_max_temperature) {
|
||||||
|
battery_calc_max_temperature = battery_daughterboard_temperatures[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Write the result to datalayer
|
||||||
|
datalayer.battery.status.temperature_min_dC = battery_calc_min_temperature * 10;
|
||||||
|
datalayer.battery.status.temperature_max_dC = battery_calc_max_temperature * 10;
|
||||||
|
|
||||||
// Update webserver datalayer
|
// Update webserver datalayer
|
||||||
datalayer_extended.bydAtto3.SOC_method = SOC_method;
|
datalayer_extended.bydAtto3.SOC_method = SOC_method;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#define MAXPOWER_CHARGE_W 10000
|
#define MAXPOWER_CHARGE_W 10000
|
||||||
#define MAXPOWER_DISCHARGE_W 10000
|
#define MAXPOWER_DISCHARGE_W 10000
|
||||||
|
|
||||||
|
#define SKIP_TEMPERATURE_SENSOR_NUMBER 0 // Enter incase one of your temperature sensors are broken (1-10)
|
||||||
|
|
||||||
/* Do not modify the rows below */
|
/* Do not modify the rows below */
|
||||||
#define BATTERY_SELECTED
|
#define BATTERY_SELECTED
|
||||||
#define MAX_PACK_VOLTAGE_DV 4410 //5000 = 500.0V
|
#define MAX_PACK_VOLTAGE_DV 4410 //5000 = 500.0V
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue