SLIDE  3.0.0
A simulator for lithium-ion battery pack degradation
Loading...
Searching...
No Matches
slide::Cell_ECM< N_RC > Class Template Reference

#include <Cell_ECM.hpp>

Inheritance diagram for slide::Cell_ECM< N_RC >:
[legend]
Collaboration diagram for slide::Cell_ECM< N_RC >:
[legend]

Public Member Functions

 Cell_ECM ()
 
 Cell_ECM (double capin, double SOCin)
 
 Cell_ECM (double capin, double SOCin, double Rdc_, std::array< double, N_RC > Rp_, std::array< double, N_RC > inv_tau_)
 
 Cell_ECM (std::string IDi, double capin, double SOCin, double Rdc_, std::array< double, N_RC > Rp_, std::array< double, N_RC > inv_tau_)
 
 Cell_ECM (std::string IDi, double capin, double SOCin)
 
 Cell_ECM (std::string IDi)
 
double I () const override
 
double getIr ()
 current through the parallel resistance More...
 
double SOC () override
 
double T () override
 overwrite from Cell More...
 
std::span< double > viewStates () override
 Only for cells to see individual states. More...
 
void getStates (getStates_t s) override
 returns one long array with the states More...
 
auto & getStateObj ()
 
double V () override
 crit is an optional argument More...
 
Status setStates (setStates_t s, bool checkStates=true, bool print=true) override
 opposite of getStates, check the states are valid? More...
 
double getRtot () override
 Return the total resistance, V = OCV - I*Rtot. More...
 
double getThotSpot () override
 the T of the hottest element in the SU More...
 
double getThermalSurface () override
 return the 'A' for the thermal model of this SU (Q = hA*dT) More...
 
double getOCV () override
 Not implemented? More...
 
Status setSOC (double SOCnew, bool checkV=true, bool print=true) override
 
Status setCurrent (double Inew, bool checkV=true, bool print=true) override
 
Status setVoltage (double Vnew, bool checkI=true, bool print=true) override
 
void setT (double Tnew) override
 functionality More...
 
virtual bool validStates (bool print=true) override
 checks if a state array is valid More...
 
void timeStep_CC (double dt, int steps=1) override
 take a number of time steps More...
 
ThroughputData getThroughputs () override
 
Cell_ECM< N_RC > * copy () override
 copy this SU to a new object More...
 
- Public Member Functions inherited from slide::Cell
 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
 
- Public Member Functions inherited from slide::StorageUnit
 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 StorageUnitcopy ()=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
 

Protected Attributes

State_ECM< N_RC > st { settings::T_ENV, 0.5 }
 parameters: More...
 
std::array< double, N_RC > Rp {}
 
std::array< double, N_RC > inv_tau {}
 
XYdata_ff OCV
 SOC vs voltage curve. More...
 
double Rdc { 2e-3 }
 DC resistance [Ohm]. More...
 
- Protected Attributes inherited from slide::Cell
double capNom { 16 }
 capacity [Ah]. More...
 
CellData< settings::DATASTORE_CELLcellData
 Cell data storage. More...
 
- Protected Attributes inherited from slide::StorageUnit
std::string ID { "StorageUnit" }
 identification string More...
 
StorageUnitparent { 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...
 

Additional Inherited Members

- Static Public Attributes inherited from slide::Cell
static constexpr CellLimits limits { defaultCellLimits }
 
- Protected Types inherited from slide::StorageUnit
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 >
 
- Protected Member Functions inherited from slide::StorageUnit
virtual size_t calculateNcells ()
 

Constructor & Destructor Documentation

◆ Cell_ECM() [1/6]

template<size_t N_RC>
slide::Cell_ECM< N_RC >::Cell_ECM
inline

Default constructor for Cell_ECM class template.

OCV curve, dummy linear curve with 3 points from 2.0V to 4.4V

Here is the call graph for this function:

◆ Cell_ECM() [2/6]

template<size_t N_RC>
slide::Cell_ECM< N_RC >::Cell_ECM ( double  capin,
double  SOCin 
)
inline

Constructor for Cell_ECM class template with given capacity and state of charge.

Parameters
capinCapacity input.
SOCinState of charge input.

check that the input argument is valid

Here is the call graph for this function:

◆ Cell_ECM() [3/6]

template<size_t N_RC>
slide::Cell_ECM< N_RC >::Cell_ECM ( double  capin,
double  SOCin,
double  Rdc_,
std::array< double, N_RC >  Rp_,
std::array< double, N_RC >  inv_tau_ 
)
inline

Constructor for Cell_ECM class template with given capacity, state of charge, and other parameters.

Parameters
capinCapacity input.
SOCinState of charge input.
Rdc_DC resistance.
Rp_Array of parallel resistance values.
inv_tau_Array of inverse time constant values.

◆ Cell_ECM() [4/6]

template<size_t N_RC = 1>
slide::Cell_ECM< N_RC >::Cell_ECM ( std::string  IDi,
double  capin,
double  SOCin,
double  Rdc_,
std::array< double, N_RC >  Rp_,
std::array< double, N_RC >  inv_tau_ 
)
inline

◆ Cell_ECM() [5/6]

template<size_t N_RC = 1>
slide::Cell_ECM< N_RC >::Cell_ECM ( std::string  IDi,
double  capin,
double  SOCin 
)
inline

◆ Cell_ECM() [6/6]

template<size_t N_RC = 1>
slide::Cell_ECM< N_RC >::Cell_ECM ( std::string  IDi)
inline

Member Function Documentation

◆ copy()

template<size_t N_RC = 1>
Cell_ECM< N_RC > * slide::Cell_ECM< N_RC >::copy ( )
inlineoverridevirtual

copy this SU to a new object

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ getIr()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::getIr ( )
inline

current through the parallel resistance

Here is the caller graph for this function:

◆ getOCV()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::getOCV ( )
inlineoverridevirtual

Not implemented?

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ getRtot()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::getRtot ( )
inlineoverridevirtual

Return the total resistance, V = OCV - I*Rtot.

Implements slide::StorageUnit.

◆ getStateObj()

template<size_t N_RC = 1>
auto & slide::Cell_ECM< N_RC >::getStateObj ( )
inline

◆ getStates()

template<size_t N_RC = 1>
void slide::Cell_ECM< N_RC >::getStates ( getStates_t  s)
inlineoverridevirtual

returns one long array with the states

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ getThermalSurface()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::getThermalSurface ( )
inlineoverridevirtual

return the 'A' for the thermal model of this SU (Q = hA*dT)

Implements slide::StorageUnit.

◆ getThotSpot()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::getThotSpot ( )
inlineoverridevirtual

the T of the hottest element in the SU

Reimplemented from slide::Cell.

Here is the call graph for this function:

◆ getThroughputs()

template<size_t N_RC = 1>
ThroughputData slide::Cell_ECM< N_RC >::getThroughputs ( )
inlineoverridevirtual

Reimplemented from slide::Cell.

◆ I()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::I ( ) const
inlineoverridevirtual

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ setCurrent()

template<size_t N_RC>
Status slide::Cell_ECM< N_RC >::setCurrent ( double  Inew,
bool  checkV = true,
bool  print = true 
)
inlineoverridevirtual

sets the current

checkV true, the voltage is checked after setting the current if it is outside the safety limits of the cell, error 3 is thrown and the old current is restored if it is outside the valid limits of the cell, error 2 is thrown but the new current is kept if inside allowed Vrange, it returns the voltage false, the voltage is not checked (function returns 0, no errors are thrown) if no value of checkV is given, it is set to true print controls the printing of error messages if true, error messages are printed (if the global printing variable is high enough) if false, no messages are printed, but the errors are still thrown if no value, the default is true

returns the voltage if checkV = true, else it returns 0

THROWS 2 checkV is true && the voltage is outside the allowed range but still in the safety range and current is in the correct direction. I.e. if charging and V > Vmax or discharging and V < Vmin 3 checkV is true && the voltage is outside the safety limits, old current is restored and current is in the correct direction. I.e. if charging and V > VMAX or discharging and V < VMAX if currents are in the 'wrong' direction (e.g. charging but V < Vmin or V < VMIN) then don't throw errors since this current is helping to rectify the situation

Implements slide::StorageUnit.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSOC()

template<size_t N_RC>
Status slide::Cell_ECM< N_RC >::setSOC ( double  SOCnew,
bool  checkV = true,
bool  print = true 
)
inlineoverridevirtual

Sets the state of charge (SOC) of the cell and checks the voltage if specified.

Note
This function is mainly used for testing purposes.
Parameters
SOCnewNew SOC value (must be between 0 and 1).
checkVIf true, the voltage is checked after setting the SOC (default is true).
  • If the voltage is outside the safety limits, an error is thrown and the old SOC is restored.
  • If the voltage is outside the valid limits, an error is thrown but the new SOC is kept.
  • If the voltage is within the allowed range, the function returns the voltage.
printIf true, error messages are printed based on the global printing variable (default is true). If false, no messages are printed, but errors are still thrown.
Returns
The status of the operation.
Exceptions
10If SOCnew is illegal (values must be between 0 and 1).

< get the voltage Does not throw anymore!

< Restore states here.

Parameters
printAlso not used except test functions.

Implements slide::Cell.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStates()

template<size_t N_RC>
Status slide::Cell_ECM< N_RC >::setStates ( setStates_t  s,
bool  checkStates = true,
bool  print = true 
)
inlineoverridevirtual

opposite of getStates, check the states are valid?

< Back-up values.

< Copy states.

< Remove first Nstates elements from span.

< Restore states here.

Implements slide::StorageUnit.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setT()

template<size_t N_RC = 1>
void slide::Cell_ECM< N_RC >::setT ( double  Tnew)
inlineoverridevirtual

functionality

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ setVoltage()

template<size_t N_RC>
Status slide::Cell_ECM< N_RC >::setVoltage ( double  Vnew,
bool  checkI = true,
bool  print = true 
)
inlineoverridevirtual

Sets the voltage of the cell, updates the current accordingly, and checks the current if specified.

Parameters
VnewNew voltage value.
checkIIf true, checks the current after setting the voltage (default is true).
printIf true, prints error messages (default is true).
Returns
The status of the operation.

Reimplemented from slide::StorageUnit.

Here is the call graph for this function:

◆ SOC()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::SOC ( )
inlineoverridevirtual

Implements slide::Cell.

Here is the caller graph for this function:

◆ T()

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::T ( )
inlineoverridevirtual

overwrite from Cell

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ timeStep_CC()

template<size_t N_RC>
void slide::Cell_ECM< N_RC >::timeStep_CC ( double  dt,
int  steps = 1 
)
inlineoverridevirtual

take a number of time steps

Data collection of cycling data (I, V, T, etc. for every cell)

< take the specified number of time steps

< Using forward Euler time integration.

< increase the cumulative variables of this cell

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ V()

template<size_t N_RC>
double slide::Cell_ECM< N_RC >::V
inlineoverridevirtual

crit is an optional argument

Calculates the cell voltage based on the current state of the cell.

Note
Throws an error if the SOC is outside the allowed range.
Template Parameters
N_RCThe number of RC-elements in the ECM model.
Returns
The calculated cell voltage.
Exceptions
1If the SOC is outside the allowed range (passed on from linear interpolation).

< print if the (global) verbose-setting is above the threshold

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ validStates()

template<size_t N_RC>
bool slide::Cell_ECM< N_RC >::validStates ( bool  print = true)
inlineoverridevirtual

checks if a state array is valid

< print if the (global) verbose-setting is above the threshold

< check if each value is in the allowed range

Implements slide::StorageUnit.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ viewStates()

template<size_t N_RC = 1>
std::span< double > slide::Cell_ECM< N_RC >::viewStates ( )
inlineoverridevirtual

Only for cells to see individual states.

Reimplemented from slide::StorageUnit.

Member Data Documentation

◆ inv_tau

template<size_t N_RC = 1>
std::array<double, N_RC> slide::Cell_ECM< N_RC >::inv_tau {}
protected

◆ OCV

template<size_t N_RC = 1>
XYdata_ff slide::Cell_ECM< N_RC >::OCV
protected

SOC vs voltage curve.

◆ Rdc

template<size_t N_RC = 1>
double slide::Cell_ECM< N_RC >::Rdc { 2e-3 }
protected

DC resistance [Ohm].

◆ Rp

template<size_t N_RC = 1>
std::array<double, N_RC> slide::Cell_ECM< N_RC >::Rp {}
protected

◆ st

template<size_t N_RC = 1>
State_ECM<N_RC> slide::Cell_ECM< N_RC >::st { settings::T_ENV, 0.5 }
protected

parameters:

States T, SOC, , I, Ir, ... ;


The documentation for this class was generated from the following file: