SLIDE  3.0.0
A simulator for lithium-ion battery pack degradation
Loading...
Searching...
No Matches
CellDataStorage.hpp
Go to the documentation of this file.
1/*
2 * CellDataStorage.hpp
3 *
4 * Created on: 10 Apr 2022
5 * Author(s): Jorn Reniers, Volkan Kumtepeli
6 */
7
8#pragma once
9
10#include "../Histogram.hpp"
11#include "cell_data.hpp"
12#include "../../settings/enum_definitions.hpp"
13
14#include <utility>
15#include <iostream>
16#include <array>
17#include <vector>
18
19namespace slide {
20
21template <settings::cellDataStorageLevel N>
23{
24 template <typename Cell_t>
25 inline void initialise(Cell_t &) {}
26
27 template <typename Cell_t>
28 inline void storeData(Cell_t &) {}
29};
30
31template <>
32struct CellDataStorage<settings::cellDataStorageLevel::storeHistogramData>
33{
34 std::array<Histogram<>, 3> data;
35
36 template <typename Cell_t>
37 inline void initialise(Cell_t &cell)
38 {
39 data[0] = Histogram<>(-cell.Cap(), cell.Cap());
40 data[1] = Histogram<>(cell.Vmin(), cell.Vmax());
41 data[2] = Histogram<>(cell.Tmin(), cell.Tmax());
42 }
43
44 template <typename Cell_t>
45 inline void storeData(Cell_t &cell)
46 {
47 data[0].add(cell.I());
48 data[1].add(cell.V());
49 data[2].add(cell.T());
50 }
51};
52
53template <>
54struct CellDataStorage<settings::cellDataStorageLevel::storeTimeData>
55{
56 std::vector<double> data;
57
58 template <typename Cell_t>
59 inline void initialise(Cell_t &) {}
60
61 template <typename Cell_t>
62 inline void storeData(Cell_t &cell)
63 {
64 const auto throughputs = cell.getThroughputs();
65 // #TODO just write all states, throughputs will be included.
66 data.push_back(cell.I());
67 data.push_back(cell.V());
68 data.push_back(cell.SOC());
69 data.push_back(cell.T());
70 data.push_back(throughputs.time()); // time
71 data.push_back(throughputs.Ah()); // Ah
72 data.push_back(throughputs.Wh()); // Wh
73 }
74};
75} // namespace slide
Definition: Histogram.hpp:31
Slide namespace contains all the types, classes, and functions for the simulation framework.
Definition: Cell.hpp:27
Default settings
Definition: simulate_ECM_modules.m:8
std::array< Histogram<>, 3 > data
Definition: CellDataStorage.hpp:34
void initialise(Cell_t &cell)
Definition: CellDataStorage.hpp:37
void storeData(Cell_t &cell)
Definition: CellDataStorage.hpp:45
void initialise(Cell_t &)
Do nothing.
Definition: CellDataStorage.hpp:59
void storeData(Cell_t &cell)
Definition: CellDataStorage.hpp:62
std::vector< double > data
Common data.
Definition: CellDataStorage.hpp:56
Definition: CellDataStorage.hpp:23
void initialise(Cell_t &)
Do nothing.
Definition: CellDataStorage.hpp:25
void storeData(Cell_t &)
Do nothing.
Definition: CellDataStorage.hpp:28