From 4c3a137b0c1fb6cba39668214a29c32139f740db Mon Sep 17 00:00:00 2001 From: Scott A <89099102+Sabramz@users.noreply.github.com> Date: Sun, 2 Feb 2025 18:42:05 -0500 Subject: [PATCH] add P45B cell characteristics --- Core/Inc/bmsConfig.h | 35 ++++++++++++++++++++--------------- Core/Src/analyzer.c | 14 +++++++------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Core/Inc/bmsConfig.h b/Core/Inc/bmsConfig.h index 96e8e42..7555993 100644 --- a/Core/Inc/bmsConfig.h +++ b/Core/Inc/bmsConfig.h @@ -16,27 +16,32 @@ #define NUM_THERMS_PER_CHIP 14 // Firmware limits -#define MAX_TEMP 65 //degrees C -#define MIN_TEMP -25 // deg C -#define MAX_VOLT_MEAS 65535 -#define MIN_VOLT_MEAS 0 +#define MAX_TEMP 60 /* Celsius */ +#define MIN_TEMP -40 /* Celsius */ +#define MAX_CELL_TEMP_BAL 45 /* Celsius */ +#define MAX_DELTA_V 0.015 +#define BAL_MIN_V 4.00 // Boosting Parameters #define BOOST_TIME 5 // seconds #define BOOST_RECHARGE_TIME 30 // seconds #define CONTDCL_MULTIPLIER 3 -//cell limits -#define MIN_VOLT 2.5 -#define MAX_VOLT 4.2 -#define MAX_CHARGE_VOLT 4.21 -#define MAX_DELTA_V 0.015 -#define BAL_MIN_V 4.00 -#define MAX_CELL_TEMP 55 -#define MIN_CELL_TEMP 15 -#define MAX_CELL_CURR 500 // Amps per BMS cell -#define MAX_CELL_TEMP_BAL 45 -#define MAX_CHG_CELL_CURR 20 +/* Molicel P45B Cell Specifications */ +#define TYP_CAPICITY_AH 4.5 /* Amp-hours */ +#define TYP_CAPACITY_WH 16.2 /* Watt-hours */ +#define MIN_CAPICITY_AH 4.3 /* Amp-hours */ +#define MIN_CAPACITY_WH 15.5 /* Watt-hours */ +#define MIN_VOLT 2.5 +#define NOM_VOLT 3.6 +#define MAX_VOLT 4.2 +#define MAX_CHARGE_VOLT 4.205 +#define MAX_CHG_CURR 13.5 /* Amps */ +#define MAX_DISCHG_CURR 45 /* Amps */ +#define MIN_CHG_TEMP 0 /* Celsius */ +#define MIN_DISCHG_TEMP -40 /* Celsius */ +#define MAX_CELL_TEMP 60 /* Celsius */ +#define TYP_IMPDNCE 0.015 /* Ohms, DC, 50% SoC */ // Algorithm settings #define CHARGE_SETL_TIMEOUT 60000 // 1 minute, may need adjustment diff --git a/Core/Src/analyzer.c b/Core/Src/analyzer.c index adc0b2f..7b123f9 100644 --- a/Core/Src/analyzer.c +++ b/Core/Src/analyzer.c @@ -432,13 +432,13 @@ void calc_dcl(acc_data_t *bmsdata) } /* ceiling for current limit */ - if (current_limit > MAX_CELL_CURR) { - bmsdata->discharge_limit = MAX_CELL_CURR; + if (current_limit > MAX_DISCHG_CURR) { + bmsdata->discharge_limit = MAX_DISCHG_CURR; return; } /* protection against being init to a high value */ - if (bmsdata->discharge_limit > MAX_CELL_CURR) { + if (bmsdata->discharge_limit > MAX_DISCHG_CURR) { bmsdata->discharge_limit = 0; prev_dcl = 0; } @@ -517,8 +517,8 @@ void calcCCL(acc_data_t *bmsdata) } /* ceiling for current limit */ - if (currentLimit > MAX_CHG_CELL_CURR) { - bmsdata->charge_limit = MAX_CHG_CELL_CURR; + if (currentLimit > MAX_CHG_CURR) { + bmsdata->charge_limit = MAX_CHG_CURR; } else { bmsdata->charge_limit = currentLimit; } @@ -541,8 +541,8 @@ void calc_cont_ccl(acc_data_t *bmsdata) bmsdata->cont_CCL = TEMP_TO_CCL[max_res_index]; } - if (bmsdata->cont_CCL > MAX_CHG_CELL_CURR) { - bmsdata->cont_CCL = MAX_CHG_CELL_CURR; + if (bmsdata->cont_CCL > MAX_CHG_CURR) { + bmsdata->cont_CCL = MAX_CHG_CURR; } }