Replace discharge curve with measured one.

This commit is contained in:
Phillip Kühne 2025-02-14 21:08:37 +01:00
parent ef8a757772
commit e6c7454e5b
Signed by: phillip
GPG Key ID: E4C1C4D2F90902AA

View File

@ -14,19 +14,20 @@
namespace PowerParameters { namespace PowerParameters {
struct Battery { struct Battery {
// Datasheet values // Datasheet values
static constexpr float CELL_CAPACITY_MAH = 120; static constexpr float CELL_CAPACITY_MAH = 120;
static constexpr float CELL_VOLTAGE_NOMINAL = 3.7; static constexpr float CELL_VOLTAGE_NOMINAL = 3.7;
struct DISCHARGE_CURVE { struct DISCHARGE_CURVE {
static constexpr float REFERENCE_CURRENT_A = 0.05; static constexpr float REFERENCE_CURRENT_A = 0.063925;
static constexpr int NUM_POINTS = 22; static constexpr int NUM_POINTS = 22;
static constexpr float VOLTAGES[NUM_POINTS] = { static constexpr float VOLTAGES[NUM_POINTS] = {
4.15, 4.05, 3.97, 3.9, 3.84, 3.795, 3.765, 3.74, 3.72, 3.7, 3.69, 3.7426, 3.6110, 3.5621, 3.5027, 3.4826, 3.4391, 3.4005,
3.68, 3.675, 3.67, 3.665, 3.66, 3.64, 3.61, 3.55, 3.45, 3.25, 3.0}; 3.3674, 3.3387, 3.3137, 3.2846, 3.2400, 3.2212, 3.1949,
3.1749, 3.1575, 3.1148, 3.0967, 3.0234, 2.9689, 2.8903};
static constexpr int CHARGE_STATES[NUM_POINTS] = { static constexpr int CHARGE_STATES[NUM_POINTS] = {
100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50,
45, 40, 35, 30, 25, 20, 15, 10, 5, 0, -5}; 45, 40, 35, 30, 25, 20, 15, 10, 5, 0};
}; };
// Derived values // Derived values
@ -44,17 +45,17 @@ namespace PowerParameters {
// Configuration // Configuration
static constexpr int AVERAGING_SAMPLES = 10; static constexpr int AVERAGING_SAMPLES = 10;
}; };
// Factors concerning Buck-Boost-Converter // Factors concerning Buck-Boost-Converter
static constexpr float BUCK_BOOST_EFFICIENCY = 0.9; static constexpr float BUCK_BOOST_EFFICIENCY = 0.9;
/* /*
* The current consumptions in milliamperes of the different components are * The current consumptions in milliamperes of the different components are
* defined here. These values are measured on 3,3 Volts, and need to be * defined here. These values are measured on 3,3 Volts, and need to be
* converted to currents actually occuring at the battery. * converted to currents actually occuring at the battery.
*/ */
struct CurrentConsumptions { struct CurrentConsumptions {
static constexpr float CURRENT_ESP_BASE = 37.42; static constexpr float CURRENT_ESP_BASE = 37.42;
static constexpr float CURRENT_ESP_LOAD = 88.43; static constexpr float CURRENT_ESP_LOAD = 88.43;
static constexpr float CURRENT_ESP_AVG = static constexpr float CURRENT_ESP_AVG =
@ -80,23 +81,23 @@ namespace PowerParameters {
static constexpr float CURRENT_IMU = 0.55; static constexpr float CURRENT_IMU = 0.55;
// LED Current. Placeholder. // LED Current. Placeholder.
static constexpr float CURRENT_UV_LED = 200; static constexpr float CURRENT_UV_LED = 200;
}; };
/* /*
* Single consumer current limit up to which requests are granted no matter what. * Single consumer current limit up to which requests are granted no matter
* The idea is, that this will allow Sensors (with their miniscule power draw) * what. The idea is, that this will allow Sensors (with their miniscule power
* to always be granted power, which should massively improve behaviour. * draw) to always be granted power, which should massively improve behaviour.
*/ */
static constexpr float CURRENT_INSIGNIFICANT = 1; static constexpr float CURRENT_INSIGNIFICANT = 1;
struct PinConfig { struct PinConfig {
static constexpr int BAT_ADC = 10; static constexpr int BAT_ADC = 10;
static constexpr int BAT_ADC_EN = 9; static constexpr int BAT_ADC_EN = 9;
static constexpr int VUSB_SENS = 38; static constexpr int VUSB_SENS = 38;
static constexpr int BAT_CHG_STAT = 39; static constexpr int BAT_CHG_STAT = 39;
}; };
enum PowerConsumers { enum PowerConsumers {
ESP, ESP,
WIFI, WIFI,
LED_RGB_TOP_LEFT, LED_RGB_TOP_LEFT,
@ -112,7 +113,7 @@ namespace PowerParameters {
MOTOR_LEFT, MOTOR_LEFT,
MOTOR_RIGHT, MOTOR_RIGHT,
IMU IMU
};
}; };
}; // namespace PowerParameters
#endif // Consumptions_h #endif // Consumptions_h