Line data Source code
1 : /* 2 : * Module_p.hpp 3 : * 4 : * Created on: 18 Dec 2019 5 : * Author(s): Jorn Reniers, Volkan Kumtepeli 6 : */ 7 : 8 : #pragma once 9 : 10 : #include "Module.hpp" 11 : #include "../types/data_storage/cell_data.hpp" 12 : #include "../utility/utility.hpp" 13 : 14 : #include <string> 15 : #include <span> 16 : 17 : namespace slide { 18 : class Module_p : public Module 19 : { 20 : protected: 21 : void getVall(std::span<double> Vall, bool print = true); //!< get the voltage of all SUs while accounting for the contact resistance 22 : 23 : public: 24 1 : Module_p() : Module("moduleP") {} //!< #TODO note this constructor should never be used. It can't determine which coolsystem to use 25 49 : Module_p(std::string_view ID_, double Ti, bool print, bool pari, int Ncells_, int coolControl, int cooltype) 26 49 : : Module(ID_, Ti, print, pari, Ncells_, coolControl, cooltype) {} 27 : 28 : //!< the voltage limits are the most constraining limits of all cells ie the highest Vmin of SUs is the Vmin of the module 29 : double Vmin() const override { return transform_max(SUs, free::get_Vmin<SU_t>); } 30 : double VMIN() const override { return transform_max(SUs, free::get_VMIN<SU_t>); } 31 : double Vmax() const override { return transform_min(SUs, free::get_Vmax<SU_t>); } 32 : double VMAX() const override { return transform_min(SUs, free::get_VMAX<SU_t>); } 33 : 34 : double I() const override { return transform_sum(SUs, free::get_I<SU_t>); } //!< the current is the sum of the current of each cell. Returns 0 if empty. 35 : double Cap() const override { return transform_sum(SUs, free::get_Cap<SU_t>); } //!< module capacity (sum of cells) 36 : 37 : double getOCV() override { return transform_mean(SUs, free::get_OCV<SU_t>); } 38 : double getRtot() override; 39 : double V() override { return SUs.empty() ? 0 : SUs[0]->V() - I() * Rcontact[0]; } 40 : 41 : Status setCurrent(double Inew, bool checkV = true, bool print = true) override; //!< set a module current 42 : Status setVoltage(double Vnew, bool checkI = true, bool print = true) override; 43 : Status redistributeCurrent(bool checkV = true, bool print = true); 44 : 45 : void timeStep_CC(double dt, int steps = 1) override; 46 : 47 : Module_p *copy() override { return new Module_p(*this); } 48 : }; 49 : } // namespace slide