Skip to content

Commit

Permalink
BMS common: Remove custom cell type
Browse files Browse the repository at this point in the history
Instead, the pre-populated typical values for certain chemistries should
be adjusted to avoid having totally invalid configurations (e.g. SOC
lookup tables with 0 V)
  • Loading branch information
martinjaeger committed Jul 23, 2024
1 parent 2c9d661 commit 22f1e95
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
17 changes: 6 additions & 11 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,32 @@ config BAT_CAPACITY_AH
Nominal battery capacity or sum of parallel cells capacity

choice
prompt "Cell type"
prompt "Default cell type"
default CELL_TYPE_LFP
help
Select the type of the single cells inside the battery
to determine voltage set points. Total voltage set points
are multiplied with the selected number of cells.

The default values based on this configuration can be overriden via ThingSet.

config CELL_TYPE_LFP
bool "LiFePO4, 3.3V nominal"

config CELL_TYPE_NMC
bool "NMC/Graphite, 3.7V nominal, 4.2V max"

config CELL_TYPE_NMC_HV
bool "NMC/Graphite High Voltage, 3.7V nominal, 4.35 max"

config CELL_TYPE_LTO
bool "NMC/Titanate, 2.4 V nominal"

config CELL_TYPE_CUSTOM
bool "Enable manual configuration for all customizable parameters"
endchoice

# values must match enum CellType in bms.h
config CELL_TYPE
int
default 0 if CELL_TYPE_CUSTOM
default 1 if CELL_TYPE_LFP
default 2 if CELL_TYPE_NMC
default 3 if CELL_TYPE_NMC_HV
default 4 if CELL_TYPE_LTO
default 0 if CELL_TYPE_LFP
default 1 if CELL_TYPE_NMC
default 2 if CELL_TYPE_LTO

endmenu

Expand Down
2 changes: 1 addition & 1 deletion app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ CONFIG_THINGSET_NODE_NAME="Libre Solar BMS"
# Change default battery nominal capacity (in Ah)
#CONFIG_BAT_CAPACITY_AH=?

# Select cell type for initial configuration: LFP (default), NMC, NMC_HV, LTO or CUSTOM
# Select cell type for initial configuration: LFP (default), NMC or LTO
#CONFIG_CELL_TYPE_???=y
2 changes: 0 additions & 2 deletions app/src/bms_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ void bms_init_config(struct bms_context *bms, enum bms_cell_type type, float nom
bms->ic_conf.cell_uv_limit = 1.90F;
memcpy(ocv_points, ocv_lto, sizeof(ocv_points));
break;
case CELL_TYPE_CUSTOM:
break;
}

/* trigger alert for all possible errors by default */
Expand Down
2 changes: 1 addition & 1 deletion docs/src/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Amongst all features inherited from underlying Zephyr, the BMS has the following

- Pack layout

- Cell chemistry (LiFePO4, NMC, NCA)
- Cell chemistry (e.g. LiFePO4, NMC, NCA, LTO)
- Nominal capacity
- Number of cells
- Thermistor type
Expand Down
7 changes: 3 additions & 4 deletions include/bms/bms.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ enum bms_state
*/
enum bms_cell_type
{
CELL_TYPE_CUSTOM = 0, ///< Custom settings
CELL_TYPE_LFP, ///< LiFePO4 Li-ion cells (3.3 V nominal)
CELL_TYPE_NMC, ///< NMC/Graphite Li-ion cells (3.7 V nominal)
CELL_TYPE_LTO ///< NMC/Titanate (2.4 V nominal)
CELL_TYPE_LFP, ///< LiFePO4 Li-ion cells (3.3 V nominal)
CELL_TYPE_NMC, ///< NMC/Graphite Li-ion cells (3.7 V nominal)
CELL_TYPE_LTO, ///< NMC/Titanate (2.4 V nominal)
};

/**
Expand Down

0 comments on commit 22f1e95

Please sign in to comment.