![]() |
SLIDE
3.0.0
A simulator for lithium-ion battery pack degradation
|
#include <Cell_LGChemNMC.hpp>
Public Member Functions | |
Cell_LGChemNMC (Model_SPM *, int verbosei) | |
constructor More... | |
Cell_LGChemNMC (Model_SPM *M, DEG_ID &, int verbosei) | |
![]() | |
Cell_SPM (OCVcurves OCV_curves_) | |
< Constructor More... | |
Cell_SPM (std::string IDi, const DEG_ID °id, double capf, double resf, double degfsei, double degflam) | |
Cell_SPM () | |
Default constructor. More... | |
Cell_SPM (Model_SPM *M_ptr) | |
getters More... | |
double | T () noexcept override |
returns the uniform battery temperature in [K] More... | |
double | getTenv () const noexcept |
get the environmental temperature [K] More... | |
Status | setCurrent (double Inew, bool checkV=true, bool print=true) override |
Status | setSOC (double SOCnew, bool checkV=true, bool print=true) override |
auto & | getStateObj () |
auto | setStateObj (State_SPM &st_new) |
std::array< double, 4 > | getVariations () const noexcept override |
void | getTemperatures (double *Tenv, double *Tref) noexcept |
< get the environmental and reference temperature More... | |
double | getThermalSurface () override |
return the 'A' for the thermal model of this SU (Q = hA*dT) More... | |
double | thermalModel (int Nneighb, double Tneighb[], double Kneighb[], double Aneighb[], double tim) override |
double | thermal_getTotalHeat () |
function for unit testing More... | |
double | getRdc () noexcept |
calculate the resistance from every component More... | |
double | getRtot () override |
double | getAnodeSurface () noexcept |
get the anode pure surface area (without cracks) product of the effective surface area (an) with the electrode volume More... | |
double | I () const override |
get the cell current [A] positive for discharging More... | |
double | V () override |
print is an optional argument More... | |
bool | getCSurf (double &cps, double &cns, bool print) |
get the surface concentrations More... | |
void | getC (double cp[], double cn[]) noexcept |
get the concentrations at all nodes More... | |
int | getVoltage (bool print, double *V, double *OCVp, double *OCVn, double *etap, double *etan, double *Rdrop, double *Temp) |
get the cell's voltage More... | |
int | getVoltage_ne (bool print, double *V, double *OCVp, double *OCVn, double *etap, double *etan, double *Rdrop, double *Temp) |
get the cell's voltage noexcept More... | |
void | getDaiStress (double *sigma_p, double *sigma_n, sigma_type &sigma_r_p, sigma_type &sigma_r_n, sigma_type &sigma_t_p, sigma_type &sigma_t_n, sigma_type &sigma_h_p, sigma_type &sigma_h_n) noexcept |
get the stresses at all nodes according to Dai's stress model More... | |
void | updateDaiStress () noexcept |
updated the stored stress values for Dai's stress model More... | |
void | getLaresgoitiStress (bool print, double *sigma_n) |
get the stresses at all nodes according to Laresgoiti's stress model More... | |
void | updateLaresgoitiStress (bool print) |
update the stored stress values for Laresgoiti's stress model More... | |
void | setT (double T) override |
set the cell's temperature More... | |
void | setTenv (double Tenv) |
void setStates(const State_SPM &si, double I); //!< set the cell's states to the states in the State object and the cell current to the given value More... | |
void | setC (double cp0, double cn0) |
void setCurrent(bool critical, bool check, double I); //!< set the cell's current to the specified value -> From old slide. More... | |
void | peekVoltage (double I) |
Peeks voltage for state for given I. More... | |
ThroughputData | getThroughputs () override |
void | overwriteCharacterisationStates (double Dpi, double Dni, double ri) |
void | overwriteGeometricStates (double thickpi, double thickni, double epi, double eni, double api, double ani) |
void ETI_electr(bool print, double I, double dti, bool blockDegradation, bool pos); //!< step forward with only one electrode using forward Euler time integration More... | |
State_SPM::states_type | dState (bool print, State_SPM &d_state) |
Utility. More... | |
void | checkModelparam () |
check if the inputs to the MATLAB code are the same as the ones here in the C++ code More... | |
void | getStates (getStates_t s) override |
returns the states of the cell collectively. More... | |
std::span< double > | viewStates () override |
Only for cells to see individual states. More... | |
double | getOCV () override |
Status | setStates (setStates_t sSpan, bool checkV, bool print) override |
opposite of getStates, check the states are valid? More... | |
bool | validStates (bool print=true) override |
checks if a state array is valid More... | |
double | SOC () override |
void | timeStep_CC (double dt, int steps=1) override |
setStates(std::move(states)); //!< store new states, checks if they are illegal (throws an error in that case) More... | |
Cell_SPM * | copy () override |
Obsolete functions (do not use): More... | |
void | ETI (bool print, double dti, bool blockDegradation) |
step forward in time using forward Eurler time integration More... | |
void | setOCVcurve (const std::string &namepos, const std::string &nameneg) |
sets the OCV curve of the cell to the given value More... | |
void | setInitialConcentration (double cmaxp, double cmaxn, double lifracp, double lifracn) |
sets the initial concentration More... | |
void | setGeometricParameters (double capnom, double elec_surf, double ep, double en, double thickp, double thickn) |
void setRamping(double Istep, double tstep); //!< sets the ramping parameters More... | |
void | setCharacterisationParam (double Dp, double Dn, double kp, double kn, double Rdc) |
sets the parameters related to the characterisation of the cell More... | |
![]() | |
Cell () | |
Cell (const std::string &ID_) | |
virtual | ~Cell ()=default |
double | Cap () const final override |
void | setCapacity (double capacity) |
constexpr double | Vmin () const override |
lower voltage limit of the cell More... | |
constexpr double | VMIN () const override |
safety cut off More... | |
constexpr double | VMAX () const override |
safety cut off More... | |
constexpr double | Vmax () const override |
upper voltage limit of the cell More... | |
constexpr double | Tmax () |
constexpr double | Tmin () |
double | getVhigh () final |
return the voltage of the cell with the highest voltage More... | |
double | getVlow () final |
return the voltage of the cell with the lowest voltage More... | |
virtual Status | setSOC (double SOCnew, bool checkV=true, bool print=true)=0 |
virtual double | SOC ()=0 |
virtual double | getThotSpot () override |
the T of the hottest element in the SU More... | |
size_t | getNcells () override final |
this is a single cell More... | |
virtual Status | checkCurrent (bool checkV, bool print) noexcept |
virtual Status | checkVoltage (double &v, bool print) noexcept override |
Check the voltage status of the cell. More... | |
virtual double | thermalModel (int Nneighb, double Tneighb[], double Kneighb[], double Aneighb[], double tim) override |
Calculate the thermal model of the cell. More... | |
virtual void | storeData () override |
Add another data point in the array. More... | |
virtual void | writeData (const std::string &prefix) override |
virtual ThroughputData | getThroughputs () |
virtual std::array< double, 4 > | getVariations () const noexcept |
![]() | |
StorageUnit ()=default | |
< basic getters and setters More... | |
StorageUnit (std::string_view ID_) | |
StorageUnit (std::string_view ID_, StorageUnit *parent_, bool blockDegAndTherm_) | |
virtual | ~StorageUnit ()=default |
const std::string & | getID () |
void | setID (std::string IDi) |
Return the full ID string, including the ID of the parent module. More... | |
virtual std::string | getFullID () |
virtual double | Cap () const =0 |
auto * | getParent () |
virtual double | I () const =0 |
virtual double | getRtot ()=0 |
virtual size_t | getNcells ()=0 |
return the number of single cells connected to this SU More... | |
bool | isCharging () |
negative means charge. More... | |
bool | isDischarging () |
positive means discharge. More... | |
virtual void | getStates (getStates_t s)=0 |
returns one long array with the states More... | |
virtual viewStates_t | viewStates () |
Only for cells to see individual states. More... | |
void | setBlockDegAndTherm (bool block) |
virtual void | setParent (StorageUnit *p) |
set the parent More... | |
virtual Status | setCurrent (double Inew, bool checkV=true, bool print=true)=0 |
virtual Status | setVoltage (double Vnew, bool checkI=true, bool print=true) |
virtual Status | setStates (setStates_t s, bool checkStates=true, bool print=true)=0 |
opposite of getStates, check the states are valid? More... | |
virtual void | backupStates () |
Back-up states. More... | |
virtual void | restoreStates () |
restore backed-up states. More... | |
virtual double | getOCV ()=0 |
virtual double | V ()=0 |
print is an optional argument More... | |
virtual Status | checkVoltage (double &v, bool print) noexcept=0 |
get the voltage and check if it is valid More... | |
virtual double | getVhigh ()=0 |
return the voltage of the cell with the highest voltage More... | |
virtual double | getVlow ()=0 |
return the voltage of the cell with the lowest voltage More... | |
virtual double | Vmin () const =0 |
lower voltage limit of the cell More... | |
virtual double | VMIN () const =0 |
safety cut off More... | |
virtual double | Vmax () const =0 |
upper voltage limit of the cell More... | |
virtual double | VMAX () const =0 |
safety cut off More... | |
virtual double | T ()=0 |
virtual double | getThotSpot ()=0 |
the T of the hottest element in the SU More... | |
virtual double | getThermalSurface ()=0 |
return the 'A' for the thermal model of this SU (Q = hA*dT) More... | |
virtual double | thermalModel (int Nneighb, double Tneighb[], double Kneighb[], double Aneighb[], double tim)=0 |
calculate the thermal model of this SU More... | |
virtual void | setT (double Tnew)=0 |
functionality More... | |
virtual bool | validStates (bool print=true)=0 |
checks if a state array is valid More... | |
virtual StorageUnit * | copy ()=0 |
copy this SU to a new object More... | |
virtual void | timeStep_CC (double dt, int steps=1)=0 |
take a number of time steps More... | |
virtual void | storeData ()=0 |
virtual void | writeData (const std::string &prefix)=0 |
Additional Inherited Members | |
![]() | |
using | sigma_type = std::array< double, settings::nch+2 > |
![]() | |
DEG_ID | deg_id |
structure with the identification of which degradation model(s) to use #TODO may be protected. More... | |
![]() | |
static constexpr CellLimits | limits { defaultCellLimits } |
![]() | |
using | setStates_t = std::span< double > & |
To pass states to read, non-expandable container. More... | |
using | getStates_t = std::vector< double > & |
To pass states to save, expandable container. More... | |
using | viewStates_t = std::span< double > |
![]() | |
std::pair< double, double > | calcSurfaceConcentration (double jp, double jn, double Dpt, double Dnt) |
std::pair< double, double > | calcOverPotential (double cps, double cns, double i_app) |
Should not throw normally, except divide by zero? More... | |
double | calcArrheniusCoeff () |
Calculates Arrhenius coefficient. More... | |
std::array< double, 2 > | calcDiffConstant () |
Calculate the diffusion constant at the battery temperature using an Arrhenius relation. More... | |
std::array< double, 3 > | calcMolarFlux () |
Calculate molar flux. More... | |
void | SEI (double OCVnt, double etan, double *isei, double *den) |
calculate the effect of SEI growth More... | |
void | CS (double OCVnt, double etan, double *isei_multiplyer, double *dCS, double *dDn) |
calculate the effect of surface crack growth More... | |
void | LAM (bool critical, double zp_surf, double etap, double *dthickp, double *dthickn, double *dap, double *dan, double *dep, double *den) |
calculate the effect of LAM More... | |
double | LiPlating (double OCVnt, double etan) |
state space model More... | |
void | dState_diffusion (bool print, State_SPM &d_state) |
just diffusion PDE More... | |
void | dState_thermal (bool print, double &dQgen) |
calculate the heat generation More... | |
void | dState_degradation (bool print, State_SPM &d_state) |
calculate the effect of lithium plating More... | |
void | dState_all (bool print, State_SPM &d_state) |
individual functions are combined in one function to gain speed. More... | |
double | thermalModel_cell () |
double | thermalModel_coupled (int Nneighb, double Tneighb[], double Kneighb[], double Aneighb[], double tim) |
cell to cell variations // #TODO why do we store variations? More... | |
![]() | |
virtual size_t | calculateNcells () |
![]() | |
State_SPM | st {} |
< protected such that child classes can access the class variables More... | |
State_SPM | s_ini {} |
the battery current/initial state, grouping all parameter which change over the battery's lifetime (see State_SPM.hpp) More... | |
double | Cmaxpos { 51385 } |
maximum lithium concentration in the cathode [mol m-3] value for NMC More... | |
double | Cmaxneg { 30555 } |
maximum lithium concentration in the anode [mol m-3] value for C More... | |
double | C_elec { 1000 } |
Li- concentration in electrolyte [mol m-3] standard concentration of 1 molar. More... | |
double | n { 1 } |
number of electrons involved in the main reaction [-] #TODO if really constant? More... | |
double | kp { 5e-11 } |
rate constant of main reaction at positive electrode at reference temperature More... | |
double | kp_T { 58000 } |
activation energy for the Arrhenius relation of kp More... | |
double | kn { 1.7640e-11 } |
rate constant of main reaction at negative electrode at reference temperature More... | |
double | kn_T { 20000 } |
The diffusion constants at reference temperature are part of State because they can change over the battery's lifetime. More... | |
double | Dp_T { 29000 } |
activation energy for the Arrhenius relation of Dp More... | |
double | Dn_T { 35000.0 / 5.0 } |
activation energy for the Arrhenius relation of Dn More... | |
double | Therm_Qgen {} |
total heat generation since the last update [J] More... | |
double | Therm_Qgentot {} |
variable for unit testing, total heat generation since the beginning of this cell's life [J] More... | |
double | Therm_time {} |
time since the last update of the thermal model More... | |
double | T_env { settings::T_ENV } |
environment temperature [K] More... | |
double | T_ref { 25.0_degC } |
reference temperature [K] More... | |
double | Qch { 45 } |
convective heat transfer coefficient per volume [W K-1 m-3] More... | |
double | rho { 1626 } |
density of the battery More... | |
double | Cp { 750 } |
thermal capacity of the battery #TODO = units missing. More... | |
param::Geometry_SPM | geo {} |
other geometric parameters are part of State because they can change over the battery's lifetime More... | |
param::StressParam | sparam { param::def::StressParam_Kokam } |
Stress parameters. More... | |
double | rsei { 2037.4 * 50 } |
specific resistance times real surface area of the SEI film [Ohm m] ? #TODO if unit is correct. aging fit. More... | |
double | nsei { 1 } |
number of electrons involved in the SEI reaction [-] More... | |
double | alphasei { 1 } |
charge transfer coefficient of the SEI reaction [-] More... | |
double | OCVsei { 0.4 } |
equilibrium potential of the SEI side reaction [V] More... | |
double | rhosei { 100e3 } |
partial molar volume of the SEI layer [m3 mol-1] More... | |
double | c_elec0 { 4.541e-3 } |
bulk concentration of the electrolyte molecule participating in the SEI growth (e.g. EC) [mol m-3] More... | |
double | Vmain { 13 } |
partial molar volume of the main reaction, see Ashwin et al, 2016 More... | |
double | Vsei { 64.39 } |
partial molar volume of the SEI side reaction, see Ashwin et al., 2016 More... | |
param::SEIparam | sei_p { param::def::SEIparam_Kokam } |
structure with the fitting parameters of the different SEI growth models More... | |
param::CSparam | csparam {} |
structure with the fitting parameters of the different crack growth models More... | |
double | OCVnmc { 4.1 } |
equilibrium potential of the NMC dissolution side reaction [V] More... | |
param::LAMparam | lam_p { param::def::LAMparam_Kokam } |
structure with the fitting parameters of the different LAM models More... | |
double | npl { 1 } |
number of electrons involved in the plating reaction [-] More... | |
double | alphapl { 1 } |
charge transfer constant for the plating reaction [-] More... | |
double | OCVpl { 0 } |
OCV of the plating reaction [V]. More... | |
double | rhopl { 10e6 } |
density of the plated lithium layer More... | |
param::PLparam | pl_p |
structure with the fitting parameters of the different plating models More... | |
Model_SPM * | M { Model_SPM::makeModel() } |
OCV curves. More... | |
OCVcurves | OCV_curves |
bool | Vcell_valid { false } |
Functions. More... | |
double | var_cap { 1 } |
relative factor increasing the capacity of the cell More... | |
double | var_R { 1 } |
relative factor increasing the DC resistance More... | |
double | var_degSEI { 1 } |
relative factor to speed up or slow down the rate of SEI growth More... | |
double | var_degLAM { 1 } |
relative factor to speed up or slow down the rate of LAM More... | |
![]() | |
double | capNom { 16 } |
capacity [Ah]. More... | |
CellData< settings::DATASTORE_CELL > | cellData |
Cell data storage. More... | |
![]() | |
std::string | ID { "StorageUnit" } |
identification string More... | |
StorageUnit * | parent { nullptr } |
pointer to the SU 'above' this one [e.g. the module to which a cell is connected] More... | |
bool | blockDegAndTherm { false } |
if true, degradation and the thermal ODE are ignored More... | |
|
inline |
constructor
< maximum concentrations
< value for NMC
< value for C
< standard concentration of 1 molar
< constants
< Cell parameters
< thermal parameters
< 40 is representative for a cell on a shelf without forced cooling
< geometry
< do NOT CHANGE this value, if you do change it, you have to recalculate the spatial discretisation with the supplied MATLAB scripts. See the word document '2 overview of the code', section 'MATLAB setup before running the C++ code'
< do NOT CHANGE this value, if you do change it, you have to recalculate the spatial discretisation with the supplied MATLAB scripts. See the word document '2 overview of the code', section 'MATLAB setup before running the C++ code'
< Stress parameters
< main Li reaction
< fitting parameter
< fitting parameter
< The diffusion coefficients at reference temperature are part of 'State'. The values are set in the block of code below ('Initialise state variables')
< spatial discretisation of the solid diffusion PDE
< check if the inputs to the MATLAB code are the same as the ones here in the C++ code
< Initialise state variables
< LLI, thickp, thickn, ep, en, ap, an, CS, Dp, Dn, R, delta_pl;
< DC resistance of the total cell in Ohm
< lithium fraction in the cathode at 50% soc [-]
< lithium fraction in the anode at 50% soc [-]
< cell temperature
< SEI thickness. Start with a fresh cell, which has undergone some formation cycles so it has an initial SEI layer. never start with a value of 0, because some equations have a term 1/delta, which would give nan or inf so this will give errors in the code
< lost lithium. Start with 0 so we can keep track of how much li we lose while cycling the cell
< thickness of the positive electrode
< thickness of the negative electrode
< volume fraction of active material in the cathode
< volume fraction of active material in the anode
< effective surface area of the cathode, the 'real' surface area is the product of the effective surface area (a) with the electrode volume (elec_surf * thick)
< effective surface area of the anode
< initial crack surface. Start with 1% of the real surface area
< diffusion constant of the cathode at reference temperature
< diffusion constant of the anode at reference temperature
< specific resistance of the combined electrodes, see State::iniStates
< thickness of the plated lithium layer. You can start with 0 here
< set the states, with a random value for the concentration
< set the states, with a random value for the concentration
< Check if this was a valid state
< set the lithium concentration
< SEI parameters
< fitting parameters of the models
< surface cracking fitting parameters of the models
< assume the maximum crack surface is 5 times the initial surface
< Loss of active material
< fitting parameters of the models
< li-plating parameters
< fitting parameters of the models
< degradation identifiers: no degradation
< no SEI growth, there is 1 SEI model (namely '0')
< don't decrease the volume fraction
< no surface cracks //!< there is 1 model (that there are no cracks)
< don't decrease the diffusion coefficient
< no LAM //!< there is 1 LAM model
< no lithium plating
< Check if we will have to calculate the stress according to Dai's stress model
< check if we need to calculate the stress according to Laresgoiti's stress model
< Check if we will have to calculate the stress according to Dai's stress model
< check if we need to calculate the stress according to Laresgoiti's stress model