SLIDE  3.0.0
A simulator for lithium-ion battery pack degradation
Loading...
Searching...
No Matches
Module_p.hpp
Go to the documentation of this file.
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
17namespace slide {
18class Module_p : public Module
19{
20protected:
21 void getVall(std::span<double> Vall, bool print = true);
22
23public:
24 Module_p() : Module("moduleP") {}
25 Module_p(std::string_view ID_, double Ti, bool print, bool pari, int Ncells_, int coolControl, int cooltype)
26 : Module(ID_, Ti, print, pari, Ncells_, coolControl, cooltype) {}
27
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>); }
35 double Cap() const override { return transform_sum(SUs, free::get_Cap<SU_t>); }
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;
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
Definition: Module_p.hpp:19
double VMIN() const override
safety cut off
Definition: Module_p.hpp:30
double Vmax() const override
upper voltage limit of the cell
Definition: Module_p.hpp:31
double Vmin() const override
lower voltage limit of the cell
Definition: Module_p.hpp:29
Module_p * copy() override
copy this SU to a new object
Definition: Module_p.hpp:47
Status setVoltage(double Vnew, bool checkI=true, bool print=true) override
Definition: Module_p.cpp:151
double I() const override
the current is the sum of the current of each cell. Returns 0 if empty.
Definition: Module_p.hpp:34
double getOCV() override
Definition: Module_p.hpp:37
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 Vm...
Definition: Module_p.hpp:25
Status setCurrent(double Inew, bool checkV=true, bool print=true) override
set a module current
Definition: Module_p.cpp:189
double getRtot() override
Calculate the total resistance of the module.
Definition: Module_p.cpp:33
void getVall(std::span< double > Vall, bool print=true)
get the voltage of all SUs while accounting for the contact resistance
Definition: Module_p.cpp:56
double V() override
print is an optional argument
Definition: Module_p.hpp:39
Module_p()
#TODO note this constructor should never be used. It can't determine which coolsystem to use
Definition: Module_p.hpp:24
double Cap() const override
module capacity (sum of cells)
Definition: Module_p.hpp:35
double VMAX() const override
safety cut off
Definition: Module_p.hpp:32
Status redistributeCurrent(bool checkV=true, bool print=true)
Redistribute the current among the SUs to balance the voltage.
Definition: Module_p.cpp:102
void timeStep_CC(double dt, int steps=1) override
Perform a time step at a constant current.
Definition: Module_p.cpp:289
Definition: Module.hpp:34
SUs_t SUs
Definition: Module.hpp:44
std::vector< double > Rcontact
array with the contact resistance for cell i
Definition: Module.hpp:45
Slide namespace contains all the types, classes, and functions for the simulation framework.
Definition: Cell.hpp:27
auto transform_mean(const auto &SUs, auto &function)
Definition: slide_algorithms.hpp:50
auto transform_min(const auto &SUs, auto &function)
Definition: slide_algorithms.hpp:37
auto transform_sum(const auto &SUs, auto &function)
Definition: slide_algorithms.hpp:17
Status
Definition: Status.hpp:15
auto transform_max(const auto &SUs, auto &function)
Definition: slide_algorithms.hpp:23