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

#include <Battery.hpp>

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

Public Member Functions

 Battery ()
 
 Battery (std::string IDi)
 
void setModule (Deep_ptr< Module > &&module)
 
void setSeriesandParallel (unsigned int ser, unsigned int par)
 basic getters and setters More...
 
double Cap () const override
 
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
 
double getRtot () override
 
size_t getNcells () override
 return the number of single cells connected to this SU More...
 
ModulegetCells ()
 int getNstates() { return cells->getNstates() + 1; } //!< +1 for the temperature of this battery More...
 
void getStates (getStates_t &s) override
 returns one long array with the states More...
 
void setBlockDegAndTherm (bool block)
 
Status setCurrent (double Inew, bool checkV=true, bool print=true) override
 
Status setStates (setStates_t s, bool checkStates=true, bool print=true) override
 opposite of getStates, check the states are valid? More...
 
double getAndResetConvLosses ()
 
double getConvLosses_total ()
 
void resetConvLosses ()
 voltage More...
 
double getOCV () override
 
double V () override
 print is an optional argument More...
 
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...
 
double T () override
 
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 thermalModel (int Nneighb, double Tneighb[], double Kneighb[], double Aneighb[], double tim) override
 calculate the thermal model of this SU More...
 
void setT (double Tnew) override
 functionality More...
 
auto * getCoolSystem ()
 
double getCoolingLoad ()
 return the energy required to run the entire coolingsystem of this module and all its children More...
 
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...
 
void storeData () override
 
void writeData (const std::string &prefix) override
 
Batterycopy () override
 copy this SU to a new object 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 Attributes

Deep_ptr< Modulecells {}
 Module with the cells of this battery. More...
 
Deep_ptr< CoolSystem_HVACcool {}
 HVAC system of the battery. More...
 
Converter conv {}
 power electronic converter. Dual step DC/DC and DC/AC More...
 
unsigned int nseries { 1 }
 
unsigned int nparallel { 1 }
 number of series/parallel 'copies' of this module More...
 
double convlosses {}
 losses in the converter during a given period (set to 0 by reset_convlosses) More...
 
double convlosses_tot {}
 total cumulative losses in the converter during the entire lifetime 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 >
 
- Protected Member Functions inherited from slide::StorageUnit
virtual size_t calculateNcells ()
 

Constructor & Destructor Documentation

◆ Battery() [1/2]

slide::Battery::Battery ( )

◆ Battery() [2/2]

slide::Battery::Battery ( std::string  IDi)

Member Function Documentation

◆ Cap()

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

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ checkVoltage()

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

get the voltage and check if it is valid

Implements slide::StorageUnit.

◆ copy()

Battery * slide::Battery::copy ( )
inlineoverridevirtual

copy this SU to a new object

Implements slide::StorageUnit.

◆ getAndResetConvLosses()

double slide::Battery::getAndResetConvLosses ( )

◆ getCells()

Module * slide::Battery::getCells ( )
inline

int getNstates() { return cells->getNstates() + 1; } //!< +1 for the temperature of this battery

◆ getConvLosses_total()

double slide::Battery::getConvLosses_total ( )
inline

◆ getCoolingLoad()

double slide::Battery::getCoolingLoad ( )

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

functionality

< heat of the coolsystem of this battery

< energy to run coolsystem of this module

< reset to 0

< coolsystem of child cells

Here is the call graph for this function:

◆ getCoolSystem()

auto * slide::Battery::getCoolSystem ( )
inline
Here is the caller graph for this function:

◆ getNcells()

size_t slide::Battery::getNcells ( )
inlineoverridevirtual

return the number of single cells connected to this SU

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ getOCV()

double slide::Battery::getOCV ( )
inlineoverridevirtual

Implements slide::StorageUnit.

◆ getRtot()

double slide::Battery::getRtot ( )
inlineoverridevirtual

Implements slide::StorageUnit.

◆ getStates()

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

returns one long array with the states

< States of the cells and the temperature of the battery

Here is the call graph for this function:

◆ getThermalSurface()

double slide::Battery::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::Battery::getThotSpot ( )
inlineoverridevirtual

the T of the hottest element in the SU

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ getVhigh()

double slide::Battery::getVhigh ( )
inlineoverridevirtual

return the voltage of the cell with the highest voltage

Implements slide::StorageUnit.

◆ getVlow()

double slide::Battery::getVlow ( )
inlineoverridevirtual

return the voltage of the cell with the lowest voltage

thermal model

Implements slide::StorageUnit.

◆ I()

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

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ resetConvLosses()

void slide::Battery::resetConvLosses ( )
inline

voltage

◆ setBlockDegAndTherm()

void slide::Battery::setBlockDegAndTherm ( bool  block)

◆ setCurrent()

Status slide::Battery::setCurrent ( double  Inew,
bool  checkV = true,
bool  print = true 
)
inlineoverridevirtual

Implements slide::StorageUnit.

◆ setModule()

void slide::Battery::setModule ( Deep_ptr< Module > &&  module)

< check the Module is compatible has no parent yet does not have an HVAC cool system

< set the parent of the module to this

< make HVAC coolsystem

< idle losses of the converter (due to switching and others)

< Scale the power electronic converter correspondingly

Here is the call graph for this function:

◆ setSeriesandParallel()

void slide::Battery::setSeriesandParallel ( unsigned int  ser,
unsigned int  par 
)

basic getters and setters

◆ setStates()

Status slide::Battery::setStates ( setStates_t  s,
bool  checkStates = true,
bool  print = true 
)
overridevirtual

opposite of getStates, check the states are valid?

< #TODO probably here we need to check?

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ setT()

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

functionality

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ storeData()

void slide::Battery::storeData ( )
overridevirtual

< Store data of the cells and the cooling system

< store local data

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ T()

double slide::Battery::T ( )
inlineoverridevirtual

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ thermalModel()

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

calculate the thermal model of this SU

< Calculate the model of the cells, the battery's HVAC coolsystem will cool the cells

< The battery heats up from cooling all cells

< cooling energy extracted from the children

< double Qcells = Echildren;

< and from the losses in the converter

< there are no neighbours or parents, so ignore inputs

< update the battery temperature

< cout<<"Battery thermal balance: Qcells = "<<Qcells<<", converter "<<conv->getLosses(cells->V(), cells->I())*tim<<" resutling in new T "<<Tbatt<<" for battery power "<<cells->V()*cells->I()<<endl;

< Check the new temperature is valid

< #TODO -> 75.0 is magical number.

Implements slide::StorageUnit.

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

◆ timeStep_CC()

void slide::Battery::timeStep_CC ( double  dt,
int  steps = 1 
)
overridevirtual

take a number of time steps

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

< integrate in time for the cells

< increase the losses from the converter

< losses [J] during this period

< Calculate the thermal model

< Call the thermal model without heat exchanges with neighbours or parents (since this module doesn't have any)

< 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

< data storage

Implements slide::StorageUnit.

Here is the call graph for this function:

◆ V()

double slide::Battery::V ( )
inlineoverridevirtual

print is an optional argument

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ validStates()

bool slide::Battery::validStates ( bool  print = true)
inlineoverridevirtual

checks if a state array is valid

Implements slide::StorageUnit.

◆ Vmax()

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

upper voltage limit of the cell

Implements slide::StorageUnit.

Here is the caller graph for this function:

◆ VMAX()

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

safety cut off

thermal model

Implements slide::StorageUnit.

◆ Vmin()

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

lower voltage limit of the cell

Implements slide::StorageUnit.

◆ VMIN()

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

safety cut off

Implements slide::StorageUnit.

◆ writeData()

void slide::Battery::writeData ( const std::string &  prefix)
overridevirtual

< Write data for the cooling system DATASTORE_COOL > 0

< write data for the cells

< write local data

Implements slide::StorageUnit.

Here is the call graph for this function:

Member Data Documentation

◆ cells

Deep_ptr<Module> slide::Battery::cells {}
protected

Module with the cells of this battery.

◆ conv

Converter slide::Battery::conv {}
protected

power electronic converter. Dual step DC/DC and DC/AC

◆ convlosses

double slide::Battery::convlosses {}
protected

losses in the converter during a given period (set to 0 by reset_convlosses)

◆ convlosses_tot

double slide::Battery::convlosses_tot {}
protected

total cumulative losses in the converter during the entire lifetime

◆ cool

Deep_ptr<CoolSystem_HVAC> slide::Battery::cool {}
protected

HVAC system of the battery.

◆ nparallel

unsigned int slide::Battery::nparallel { 1 }
protected

number of series/parallel 'copies' of this module

◆ nseries

unsigned int slide::Battery::nseries { 1 }
protected

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