mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
Add estimated charge/discharge values
This commit is contained in:
parent
5d40e5a986
commit
8204676c9d
2 changed files with 15 additions and 3 deletions
|
@ -168,9 +168,19 @@ void update_values_kiaHyundai_64_battery() { //This function maps all the value
|
||||||
|
|
||||||
remaining_capacity_Wh = static_cast<int>((static_cast<double>(SOC) / 10000) * BATTERY_WH_MAX);
|
remaining_capacity_Wh = static_cast<int>((static_cast<double>(SOC) / 10000) * BATTERY_WH_MAX);
|
||||||
|
|
||||||
max_target_discharge_power = (uint16_t)allowedDischargePower * 10; //From kW*100 to Watts
|
//max_target_charge_power = (uint16_t)allowedChargePower * 10; //From kW*100 to Watts
|
||||||
|
//The allowed charge power is not available. We estimate this value
|
||||||
max_target_charge_power = (uint16_t)allowedChargePower * 10; //From kW*100 to Watts
|
if (SOC == 10000) { // When scaled SOC is 100%, set allowed charge power to 0
|
||||||
|
max_target_charge_power = 0;
|
||||||
|
} else { // No limits, max charging power allowed
|
||||||
|
max_target_charge_power = MAXCHARGEPOWERALLOWED;
|
||||||
|
}
|
||||||
|
//max_target_discharge_power = (uint16_t)allowedDischargePower * 10; //From kW*100 to Watts
|
||||||
|
if (SOC < 100) { // When scaled SOC is <1%, set allowed charge power to 0
|
||||||
|
max_target_discharge_power = 0;
|
||||||
|
} else { // No limits, max charging power allowed
|
||||||
|
max_target_discharge_power = MAXDISCHARGEPOWERALLOWED;
|
||||||
|
}
|
||||||
|
|
||||||
powerWatt = ((batteryVoltage * batteryAmps) / 100);
|
powerWatt = ((batteryVoltage * batteryAmps) / 100);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#define ABSOLUTE_MAX_VOLTAGE \
|
#define ABSOLUTE_MAX_VOLTAGE \
|
||||||
4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
|
4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
|
||||||
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
|
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
|
||||||
|
#define MAXCHARGEPOWERALLOWED 10000
|
||||||
|
#define MAXDISCHARGEPOWERALLOWED 10000
|
||||||
|
|
||||||
// These parameters need to be mapped for the Gen24
|
// These parameters need to be mapped for the Gen24
|
||||||
extern uint16_t SOC; //SOC%, 0-100.00 (0-10000)
|
extern uint16_t SOC; //SOC%, 0-100.00 (0-10000)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue