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

#include <Module_p.hpp>

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

Public Member Functions

 Module_p ()
 #TODO note this constructor should never be used. It can't determine which coolsystem to use More...
 
 Module_p (std::string_view ID_, double Ti, bool print, bool pari, int Ncells_, int coolControl, int cooltype)
 the voltage limits are the most constraining limits of all cells ie the highest Vmin of SUs is the Vmin of the module More...
 
double Vmin () const override
 lower voltage limit of the cell More...
 
double VMIN () const override
 safety cut off More...
 
double Vmax () const override
 upper voltage limit of the cell More...
 
double VMAX () const override
 safety cut off More...
 
double I () const override
 the current is the sum of the current of each cell. Returns 0 if empty. More...
 
double Cap () const override
 module capacity (sum of cells) More...
 
double getOCV () override
 
double getRtot () override
 Calculate the total resistance of the module. More...
 
double V () override
 print is an optional argument More...
 
Status setCurrent (double Inew, bool checkV=true, bool print=true) override
 set a module current More...
 
Status setVoltage (double Vnew, bool checkI=true, bool print=true) override
 
Status redistributeCurrent (bool checkV=true, bool print=true)
 Redistribute the current among the SUs to balance the voltage. More...
 
void timeStep_CC (double dt, int steps=1) override
 Perform a time step at a constant current. More...
 
Module_pcopy () override
 copy this SU to a new object More...
 
- Public Member Functions inherited from slide::Module
 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

void getVall (std::span< double > Vall, bool print=true)
 get the voltage of all SUs while accounting for the contact resistance More...
 
- Protected Member Functions inherited from slide::Module
size_t calculateNcells () override
 
double thermalModel_cell ()
 
double thermalModel_coupled (int Nneighbours, double Tneighbours[], double Kneighbours[], double Aneighb[], double tim)
 
virtual size_t calculateNcells ()
 

Additional Inherited Members

- Public Types inherited from slide::Module
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 >
 
- 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 Attributes inherited from slide::Module
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...
 

Constructor & Destructor Documentation

◆ Module_p() [1/2]

slide::Module_p::Module_p ( )
inline

#TODO note this constructor should never be used. It can't determine which coolsystem to use

Here is the caller graph for this function:

◆ Module_p() [2/2]

slide::Module_p::Module_p ( std::string_view  ID_,
double  Ti,
bool  print,
bool  pari,
int  Ncells_,
int  coolControl,
int  cooltype 
)
inline

the voltage limits are the most constraining limits of all cells ie the highest Vmin of SUs is the Vmin of the module

Member Function Documentation

◆ Cap()

double slide::Module_p::Cap ( ) const
inlineoverridevirtual

module capacity (sum of cells)

Implements slide::StorageUnit.

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

◆ copy()

Module_p * slide::Module_p::copy ( )
inlineoverridevirtual

copy this SU to a new object

Implements slide::Module.

Here is the call graph for this function:

◆ getOCV()

double slide::Module_p::getOCV ( )
inlineoverridevirtual

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ getRtot()

double slide::Module_p::getRtot ( )
overridevirtual

Calculate the total resistance of the module.

Computes the total resistance using the formula for resistances in parallel: 1/Rtot = sum(1/R_i)

Returns
The total resistance of the module.

Implements slide::StorageUnit.

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

◆ getVall()

void slide::Module_p::getVall ( std::span< double >  Vall,
bool  print = true 
)
protected

get the voltage of all SUs while accounting for the contact resistance

Calculate the voltage of each SU accounting for contact resistance.

Computes the terminal voltage Vt for each SU in the module while considering contact resistances and stores the values in the Vall span.

Parameters
VallA span to store the voltage values.
printUnused parameter (can be removed if not required).
Here is the caller graph for this function:

◆ I()

double slide::Module_p::I ( ) const
inlineoverridevirtual

the current is the sum of the current of each cell. Returns 0 if empty.

Implements slide::StorageUnit.

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

◆ redistributeCurrent()

Status slide::Module_p::redistributeCurrent ( bool  checkV = true,
bool  print = true 
)

Redistribute the current among the SUs to balance the voltage.

Iteratively adjusts the current of each SU to balance the voltages across them.

Parameters
checkVUnused parameter (can be removed if not required).
printUnused parameter (can be removed if not required).
Returns
The status of the operation.

< get cell voltages

< #TODO if we should make them vector.

< voltage and initial current of each cell //!< #TODO it is a constant value SU.

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

◆ setCurrent()

Status slide::Module_p::setCurrent ( double  Inew,
bool  checkV = true,
bool  print = true 
)
overridevirtual

set a module current

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

< get the old currents so we can revert if needed

< throw error, the catch statement will use the iterative function

< #TODO problem

Implements slide::StorageUnit.

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

◆ setVoltage()

Status slide::Module_p::setVoltage ( double  Vnew,
bool  checkI = true,
bool  print = true 
)
overridevirtual

< get the old currents so we can revert if needed

Reimplemented from slide::StorageUnit.

Here is the call graph for this function:

◆ timeStep_CC()

void slide::Module_p::timeStep_CC ( double  dt,
int  nstep = 1 
)
overridevirtual

Perform a time step at a constant current.

Takes a time step at a constant current by either explicitly solving the system of equations or letting every cell take a CC time step and checking if the voltage equation is satisfied.

Parameters
dtThe time step.
nstepNumber of steps.

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

< Increase the heat from the contact resistances

< current through resistor I

< resistor i sees the currents through the cells 'behind' them

< if there is no parent, this module is the top-level. It then directly exchanges heat with the environment at a fixed temperature If there is no parent, assume we update T every nstep*dt. So update the temperature now

< double check that we have an HVAC coolsystem (see constructor)

< Make the arrays even though they will not be used (length should be 0 but I don't think you can make an array of length 0)

< the 0 signals there are no neighbours or parents

< we have changed the SOC/concnetration, so the stored voltage is no longer valid

< check if the cell's voltage is valid #TODO I changed this to make redistribute everytime!

< don't check the currents

< don't check the currents

< #TODO

Implements slide::StorageUnit.

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

◆ V()

double slide::Module_p::V ( )
inlineoverridevirtual

print is an optional argument

Implements slide::StorageUnit.

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

◆ Vmax()

double slide::Module_p::Vmax ( ) const
inlineoverridevirtual

upper voltage limit of the cell

Implements slide::StorageUnit.

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

◆ VMAX()

double slide::Module_p::VMAX ( ) const
inlineoverridevirtual

safety cut off

thermal model

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ Vmin()

double slide::Module_p::Vmin ( ) const
inlineoverridevirtual

lower voltage limit of the cell

Implements slide::StorageUnit.

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

◆ VMIN()

double slide::Module_p::VMIN ( ) const
inlineoverridevirtual

safety cut off

Implements slide::StorageUnit.

Here is the call graph for this function:

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