SLIDE  3.0.0
A simulator for lithium-ion battery pack degradation
Loading...
Searching...
No Matches
slide::Module Class Referenceabstract

#include <Module.hpp>

Inheritance diagram for slide::Module:
[legend]
Collaboration diagram for slide::Module:
[legend]

Public Types

using SU_t = Deep_ptr< StorageUnit >
 < connected child SUs More...
 
using SUs_t = std::vector< SU_t >
 
using SUs_span_t = std::span< SU_t >
 
using CoolSystem_t = Deep_ptr< CoolSystem >
 

Public Member Functions

 Module ()
 
 Module (std::string_view ID_)
 
 Module (std::string_view ID_, double Ti, bool print, bool pari, int Ncells, int coolControl, int cooltype)
 
 Module (std::string_view ID_, double Ti, bool print, bool pari, int Ncells, CoolSystem_t &&coolControlPtr, int cooltype)
 common implementation for all base-modules More...
 
size_t getNSUs ()
 note that these child-SUs can be modules themselves (or they can be cells) More...
 
SUs_tgetSUs ()
 
const auto & operator[] (size_t i) const
 
auto & operator[] (size_t i)
 
virtual Status checkVoltage (double &v, bool print) noexcept override
 get the voltage and check if it is valid More...
 
double getVhigh () override
 return the voltage of the cell with the highest voltage More...
 
double getVlow () override
 return the voltage of the cell with the lowest voltage More...
 
void getStates (getStates_t &s) override
 returns one long array with the states: getStates-array of each cell followed by the states of the module (Tmod) More...
 
virtual bool validStates (bool print=true) override
 check if a state-array is valid for this module (uses setStates) More...
 
virtual Status setStates (setStates_t s, bool checkV=true, bool print=true) override
 thermal model More...
 
double T () override
 get the temperature of this module More...
 
double getThermalSurface () override
 return the 'A' for the thermal model of this SU (Q = hA*dT) More...
 
double getCoolingLoad ()
 return the energy required to run the entire coolingsystem of this module and all its children More...
 
double thermalModel (int Nneighbours, double Tneighbours[], double Kneighbours[], double Aneighb[], double tim) override
 calculate the thermal model of this SU More...
 
virtual void setSUs (SUs_span_t c, bool checkCells=true, bool print=true)
 
CoolSystemgetCoolSystem ()
 
void setRcontact (std::span< double > Rc)
 
virtual Modulecopy () override=0
 copy this SU to a new object More...
 
void storeData () override
 
void writeData (const std::string &prefix) override
 
void setBlockDegAndTherm (bool block)
 
void setT (double Tnew) override
 set a module temperature More...
 
size_t getNcells () override
 
double getThotSpot () override
 < get the maximum temperature of the cells or the module More...
 
- 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 Member Functions

size_t calculateNcells () override
 
double thermalModel_cell ()
 
double thermalModel_coupled (int Nneighbours, double Tneighbours[], double Kneighbours[], double Aneighb[], double tim)
 
virtual size_t calculateNcells ()
 

Protected Attributes

SUs_t SUs
 
std::vector< double > Rcontact
 array with the contact resistance for cell i More...
 
CoolSystem_t cool { nullptr }
 cooling system of this module //!< make<CoolSystem>(settings::MODULE_NSUs_MAX, 1); More...
 
ModuleThermalParam therm
 voltage More...
 
size_t Ncells
 Number of cells this module contains. More...
 
double Vmodule { 0 }
 voltage of the module More...
 
bool Vmodule_valid { false }
 boolean indicating if stored the voltage of the module is valid More...
 
bool par { true }
 
State< 0, settings::data::N_CumulativeModulest_module
 
std::vector< double > data
 Time data. 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

- 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 >
 

Member Typedef Documentation

◆ CoolSystem_t

◆ SU_t

< connected child SUs

◆ SUs_span_t

using slide::Module::SUs_span_t = std::span<SU_t>

◆ SUs_t

using slide::Module::SUs_t = std::vector<SU_t>

Constructor & Destructor Documentation

◆ Module() [1/4]

slide::Module::Module ( )
inline

◆ Module() [2/4]

slide::Module::Module ( std::string_view  ID_)
inline

◆ Module() [3/4]

slide::Module::Module ( std::string_view  ID_,
double  Ti,
bool  print,
bool  pari,
int  Ncells,
int  coolControl,
int  cooltype 
)

< Set the module temperature

< thermally active surface area. The first number is the thermal active surface area of a cell

< constant ancillary losses. There are none since a module only has cells

Here is the call graph for this function:

◆ Module() [4/4]

slide::Module::Module ( std::string_view  ID_,
double  Ti,
bool  print,
bool  pari,
int  Ncells,
CoolSystem_t &&  coolControlPtr,
int  cooltype 
)

common implementation for all base-modules

< thermally active surface area. The first number is the thermal active surface area of a cell

Here is the call graph for this function:

Member Function Documentation

◆ calculateNcells()

size_t slide::Module::calculateNcells ( )
inlineoverrideprotectedvirtual

< #TODO this function needs to call parent to update their number of cells if they are module.

Reimplemented from slide::StorageUnit.

Here is the call graph for this function:

◆ checkVoltage()

Status slide::Module::checkVoltage ( double &  v,
bool  print 
)
overridevirtualnoexcept

get the voltage and check if it is valid

< const bool printCrit = print && (settings::printBool::printCrit); //!< print if the (global) verbose-setting is above the threshold const bool printNonCrit = print && (settings::printBool::printNonCrit); //!< print if the (global) verbose-setting is above the threshold

< check the voltage of the module

< #TODO here was a not useful chuck of code for repeated checking. We may have constant limits for module voltage.

< check the voltages of the connected cells

Implements slide::StorageUnit.

◆ copy()

virtual Module * slide::Module::copy ( )
overridepure virtual

copy this SU to a new object

Implements slide::StorageUnit.

Implemented in slide::Module_p, and slide::Module_s.

◆ getCoolingLoad()

double slide::Module::getCoolingLoad ( )

return the energy required to run the entire coolingsystem of this module and all its children

< energy to run coolsystem of this module

< reset to 0

< loop for the children, and if they are modules, add their cooling energy

< cast to a module pointer instead of storage unit

< add energy

< reset cooling energy for that child

Here is the call graph for this function:

◆ getCoolSystem()

CoolSystem * slide::Module::getCoolSystem ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNcells()

size_t slide::Module::getNcells ( )
inlineoverridevirtual

Return the temperature of the hottest element of the module. Note that this will be the T of a cell, since child-modules will pass on this function to their cells

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ getNSUs()

size_t slide::Module::getNSUs ( )
inline

note that these child-SUs can be modules themselves (or they can be cells)

Here is the caller graph for this function:

◆ getStates()

void slide::Module::getStates ( getStates_t s)
override

returns one long array with the states: getStates-array of each cell followed by the states of the module (Tmod)

< pass a vector, the next nsi locations will be automatically filled with the states of cell i

< store the module temperature

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

◆ getSUs()

SUs_t & slide::Module::getSUs ( )
inline
Here is the caller graph for this function:

◆ getThermalSurface()

double slide::Module::getThermalSurface ( )
inlineoverridevirtual

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

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ getThotSpot()

double slide::Module::getThotSpot ( )
inlineoverridevirtual

< get the maximum temperature of the cells or the module

Implements slide::StorageUnit.

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

◆ getVhigh()

double slide::Module::getVhigh ( )
overridevirtual

return the voltage of the cell with the highest voltage

< return the voltage of the cell with the highest voltage note CELL not child SU

< will be called recursively to the cell levels

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ getVlow()

double slide::Module::getVlow ( )
overridevirtual

return the voltage of the cell with the lowest voltage

< return the voltage of the cell with the lowest voltage note CELL not child SU

< will be called recursively to the cell levels

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ operator[]() [1/2]

auto & slide::Module::operator[] ( size_t  i)
inline

◆ operator[]() [2/2]

const auto & slide::Module::operator[] ( size_t  i) const
inline

◆ setBlockDegAndTherm()

void slide::Module::setBlockDegAndTherm ( bool  block)
inline

◆ setRcontact()

void slide::Module::setRcontact ( std::span< double >  Rc)
inline

< we are changing the resistance, so the stored voltage is no longer valid

Parameters
Rc#TODO if ok.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStates()

Status slide::Module::setStates ( setStates_t  s,
bool  checkV = true,
bool  print = true 
)
overridevirtual

thermal model

Set the states of this module to the given one note: setStates is the master function to check if states and cells are valid if checkV=true, then also the cell and module voltages are checked the other functions just call setStates to check validity

< we are changing the states, so the stored voltage is no longer valid

< set the new cell states

< set the states

< restore the original states without checking validity (they should be valid)

< set the module temperature

< #TODO here we are checking but should we?

< check that the cells are valid for this module configuration (same I if series, same V if parallel)

< return success.

Implements slide::StorageUnit.

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

◆ setSUs()

void slide::Module::setSUs ( SUs_span_t  c,
bool  checkCells = true,
bool  print = true 
)
virtual

Sets the cells of this module. Checks module-constraints does not check if the states of cells are valid, nor the voltages of the cells and module it only checks whether the cells are ok for this module (same current if series, same voltage if parallel) note on virtual functions, see StorageUnit.hpp

< check the cells don't have parents yet (unless it is this module)

< #TODO probably cannot be this since it is a unique_ptr

< connect the cells to this module

< we are changing the SUs, so the stored voltage is no longer valid

< Set the parent of all cells/ Does not throw.

< Make Rcontact zero? #TODO

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

◆ setT()

void slide::Module::setT ( double  Tnew)
inlineoverridevirtual

set a module temperature

Implements slide::StorageUnit.

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

◆ storeData()

void slide::Module::storeData ( )
inlineoverridevirtual

< Tell all connected cells to store their data

< Store data for the coolsystem

< Store data of this module

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ T()

double slide::Module::T ( )
inlineoverridevirtual

get the temperature of this module

Implements slide::StorageUnit.

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

◆ thermalModel()

double slide::Module::thermalModel ( int  Nneighb,
double  Tneighb[],
double  Kneighb[],
double  Aneighb[],
double  tim 
)
overridevirtual

calculate the thermal model of this SU

< indicate we have ran the thermal model

< control the cooling system is done at the time integration function

Implements slide::StorageUnit.

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

◆ thermalModel_cell()

double slide::Module::thermalModel_cell ( )
protected

< array with the new temperatures of the child SUs

< dummy arrays

< calculate cells' temperature

< the temperature of a module doesn't change

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

◆ thermalModel_coupled()

double slide::Module::thermalModel_coupled ( int  Nneighbours,
double  Tneighbours[],
double  Kneighbours[],
double  Aneighb[],
double  tim 
)
protected

< Check the time keeping

< then check whether our internal time keeping matches up with the external one

< array with the new temperatures of the child SUs

< ************************************************************* heat exchange with child SUs ******************************************************************* Make the arrays for heat exchange to each child SU. They have max length 3 (cooling from here, and 2 neighbours)

< parent, left neighbour, right neighbour

< The first element is the cooling from the parent module to the child SUs

< Loop to cool each child SU

< left cell

< conductive heat exchange via long sides of cell

< left is cell i-1

< left is module

< Last cell. getNSUs() is unsigned therefore getNSUs() -1 is omitted.

< right is edge of module

< additional cooling to the first and last cell of the stack (which both have 1 edge from the coolsystem)

< #TODO problem.

< cooling energy extracted from the children

< *********************************************************** Heat exchange with neighbours and parent **********************************************************

< The module exchanges heat with its parent and neighbours

< Calculate the new temperature of the coolant rho * cp * dT/dt = Qtot / V where Qtot is total power in W V is the total volume of fluid over the time period, the product of the flow rate and the time (therm_v*tim) so integrated over time this is rho * cp * (Tnew - Told) = Etot / V

< Set all the new temperatures to the children

< reset the time since the last update of the thermal model

< Check the new temperature is valid

< no time has passed -> no heat generated -> just return present temperature

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

◆ validStates()

bool slide::Module::validStates ( bool  print = true)
overridevirtual

check if a state-array is valid for this module (uses setStates)

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

Implements slide::StorageUnit.

◆ writeData()

void slide::Module::writeData ( const std::string &  prefix)
inlineoverridevirtual

< Tell all connected cells to write their data

< Write data for this module

< name of the file, start with the full hierarchy-ID to identify this cell

< append the new data to the existing file

Implements slide::StorageUnit.

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

Member Data Documentation

◆ cool

CoolSystem_t slide::Module::cool { nullptr }
protected

cooling system of this module //!< make<CoolSystem>(settings::MODULE_NSUs_MAX, 1);

◆ data

std::vector<double> slide::Module::data
protected

Time data.

◆ Ncells

size_t slide::Module::Ncells
protected

Number of cells this module contains.

◆ par

bool slide::Module::par { true }
protected

if true, some functions will be calculated parallel using multithreaded computing data storage

◆ Rcontact

std::vector<double> slide::Module::Rcontact
protected

array with the contact resistance for cell i

thermal model

◆ st_module

State<0, settings::data::N_CumulativeModule> slide::Module::st_module
protected

◆ SUs

SUs_t slide::Module::SUs
protected

◆ therm

ModuleThermalParam slide::Module::therm
protected

voltage

◆ Vmodule

double slide::Module::Vmodule { 0 }
protected

voltage of the module

◆ Vmodule_valid

bool slide::Module::Vmodule_valid { false }
protected

boolean indicating if stored the voltage of the module is valid


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