10#include "../StorageUnit.hpp"
11#include "../cooling/cooling.hpp"
12#include "../types/State.hpp"
13#include "../settings/settings.hpp"
14#include "../utility/utility.hpp"
39 using SUs_t = std::vector<SU_t>;
73 double thermalModel_coupled(
int Nneighbours,
double Tneighbours[],
double Kneighbours[],
double Aneighb[],
double tim);
78 Module(std::string_view ID_,
double Ti,
bool print,
bool pari,
int Ncells,
int coolControl,
int cooltype);
79 Module(std::string_view ID_,
double Ti,
bool print,
bool pari,
int Ncells,
CoolSystem_t &&coolControlPtr,
int cooltype);
96 virtual bool validStates(
bool print =
true)
override;
104 double T()
override {
return cool->
T(); }
108 double thermalModel(
int Nneighbours,
double Tneighbours[],
double Kneighbours[],
double Aneighb[],
double tim)
override;
110 virtual void setSUs(
SUs_span_t c,
bool checkCells =
true,
bool print =
true);
134 for (
const auto &SU :
SUs)
146 for (
const auto &SU :
SUs)
147 SU->writeData(prefix);
152 std::string name = prefix +
"_" +
getFullID() +
"_ModuleData.csv";
155 std::ofstream file(name, std::ios_base::app);
157 if (!file.is_open()) {
158 std::cerr <<
"ERROR in Module::writeData, could not open file " << name <<
'\n';
176 SU->setBlockDegAndTherm(block);
200 double Thot =
cool->
T();
201 for (
const auto &SU :
SUs)
202 Thot = std::max(Thot, SU->getThotSpot());
Definition: CoolSystem.hpp:22
virtual void storeData(size_t Ncells)
Definition: CoolSystem.cpp:282
void setT(double Tnew)
Definition: CoolSystem.cpp:110
virtual void writeData(const std::string &prefix)
Definition: CoolSystem.cpp:315
double T()
Definition: CoolSystem.hpp:59
Definition: Deep_ptr.hpp:23
T * get() const
Get the raw pointer.
Definition: Deep_ptr.hpp:76
Definition: Module.hpp:34
double Vmodule
voltage of the module
Definition: Module.hpp:53
double getVlow() override
return the voltage of the cell with the lowest voltage
Definition: Module.cpp:151
ModuleThermalParam therm
voltage
Definition: Module.hpp:49
const auto & operator[](size_t i) const
Definition: Module.hpp:85
size_t getNSUs()
note that these child-SUs can be modules themselves (or they can be cells)
Definition: Module.hpp:82
double getVhigh() override
return the voltage of the cell with the highest voltage
Definition: Module.cpp:140
size_t Ncells
Number of cells this module contains.
Definition: Module.hpp:52
double T() override
get the temperature of this module
Definition: Module.hpp:104
void setT(double Tnew) override
set a module temperature
Definition: Module.hpp:186
bool Vmodule_valid
boolean indicating if stored the voltage of the module is valid
Definition: Module.hpp:54
Module(std::string_view ID_)
Definition: Module.hpp:77
void getStates(getStates_t &s) override
returns one long array with the states: getStates-array of each cell followed by the states of the mo...
Definition: Module.cpp:161
double getThermalSurface() override
return the 'A' for the thermal model of this SU (Q = hA*dT)
Definition: Module.hpp:106
std::vector< double > data
Time data.
Definition: Module.hpp:59
virtual Status checkVoltage(double &v, bool print) noexcept override
get the voltage and check if it is valid
Definition: Module.cpp:113
double thermalModel_cell()
Definition: Module.cpp:270
State< 0, settings::data::N_CumulativeModule > st_module
Definition: Module.hpp:58
double getCoolingLoad()
return the energy required to run the entire coolingsystem of this module and all its children
Definition: Module.cpp:482
size_t getNcells() override
Definition: Module.hpp:193
auto & operator[](size_t i)
Definition: Module.hpp:86
void setRcontact(std::span< double > Rc)
Definition: Module.hpp:118
double thermalModel(int Nneighbours, double Tneighbours[], double Kneighbours[], double Aneighb[], double tim) override
calculate the thermal model of this SU
Definition: Module.cpp:456
virtual Module * copy() override=0
copy this SU to a new object
virtual bool validStates(bool print=true) override
check if a state-array is valid for this module (uses setStates)
Definition: Module.cpp:174
bool par
Definition: Module.hpp:55
double thermalModel_coupled(int Nneighbours, double Tneighbours[], double Kneighbours[], double Aneighb[], double tim)
Definition: Module.cpp:306
Deep_ptr< CoolSystem > CoolSystem_t
Definition: Module.hpp:41
void setBlockDegAndTherm(bool block)
Definition: Module.hpp:173
SUs_t SUs
Definition: Module.hpp:44
SUs_t & getSUs()
Definition: Module.hpp:83
Module()
Definition: Module.hpp:76
void storeData() override
Definition: Module.hpp:132
virtual void setSUs(SUs_span_t c, bool checkCells=true, bool print=true)
Definition: Module.cpp:66
std::vector< double > Rcontact
array with the contact resistance for cell i
Definition: Module.hpp:45
std::span< SU_t > SUs_span_t
Definition: Module.hpp:40
virtual Status setStates(setStates_t s, bool checkV=true, bool print=true) override
thermal model
Definition: Module.cpp:193
size_t calculateNcells() override
Definition: Module.hpp:62
CoolSystem_t cool
cooling system of this module //!< make<CoolSystem>(settings::MODULE_NSUs_MAX, 1);
Definition: Module.hpp:48
CoolSystem * getCoolSystem()
Definition: Module.hpp:116
double getThotSpot() override
< get the maximum temperature of the cells or the module
Definition: Module.hpp:198
void writeData(const std::string &prefix) override
Definition: Module.hpp:144
std::vector< SU_t > SUs_t
Definition: Module.hpp:39
Definition: StorageUnit.hpp:27
bool blockDegAndTherm
if true, degradation and the thermal ODE are ignored
Definition: StorageUnit.hpp:31
virtual double I() const =0
std::span< double > & setStates_t
To pass states to read, non-expandable container.
Definition: StorageUnit.hpp:32
virtual std::string getFullID()
Definition: StorageUnit.hpp:49
std::vector< double > & getStates_t
To pass states to save, expandable container.
Definition: StorageUnit.hpp:33
virtual double V()=0
print is an optional argument
void write_data(std::ofstream &file, std::vector< double > &data, size_t N=1)
Definition: free_functions.hpp:49
constexpr auto DATASTORE_MODULE
See moduleDataStorageLevel for different options.
Definition: settings.hpp:56
constexpr int MODULE_NSUs_MAX
Definition: settings.hpp:66
Slide namespace contains all the types, classes, and functions for the simulation framework.
Definition: Cell.hpp:27
auto transform_sum(const auto &SUs, auto &function)
Definition: slide_algorithms.hpp:17
Status
Definition: Status.hpp:15
testNow Rc
Definition: simulate_ECM_modules.m:13
Definition: Module.hpp:26
double A
thermally active surface area of this module. The first number is the thermal active surface area of ...
Definition: Module.hpp:28
double time
time since the last update of the thermal model [s]
Definition: Module.hpp:30
double Qcontact
heat energy generated in the contact resistances since the last time the thermal model was solved
Definition: Module.hpp:29
double k_cell2cell
conductive heat transfer coefficient for heat transfer betweenthe child SUs
Definition: Module.hpp:27
auto Wh() const
Energy throughput [Wh].
Definition: State.hpp:35
auto Ah() const
Current throughput [Ah].
Definition: State.hpp:34
auto time() const
time [s]
Definition: State.hpp:33