SLIDE  3.0.0
A simulator for lithium-ion battery pack degradation
Loading...
Searching...
No Matches
running_Cell_SPM.hpp
Go to the documentation of this file.
1/*
2 * running_Cell_Bucket.hpp
3 *
4 * Benchmark file for Cell_Bucket
5 *
6 * Created on: 07 Aug 2022
7 * Author(s): Volkan Kumtepeli
8 */
9
10#pragma once
11
12#include "../src/slide.hpp"
13
14#include <string>
15#include <fstream>
16#include <iostream>
17
18namespace slide::benchmarks {
19
20inline void run_Cell_SPM_1(double Crate)
21{
22 std::string ID = "PyBAMM_1_CC_Crate"; // + std::to_string(Crate) + '_'
23 auto c = Cell_SPM();
24
25 const auto Idisch = Crate * c.Cap();
26
27 c.getStateObj().rDCn() = 0;
28 c.getStateObj().rDCp() = 0;
29 c.getStateObj().rDCcc() = 0;
30
31 std::cout << "Vbefore: " << c.V() << '\n';
32 c.setBlockDegAndTherm(true);
33 ThroughputData th{};
34
35 auto cyc = Cycler(&c, ID);
36
37 Clock clk;
38 cyc.CC(Idisch, 2.7, 3600, 0.5, 2, th);
39 std::cout << "Finished " << ID << " in " << clk << ".\n";
40
41 std::cout << "Vafter: " << c.V() << '\n';
42
43 cyc.writeData();
44}
45
46
47inline void run_Cell_SPM_2(double Crate)
48{
49 std::string ID = "PyBAMM_2_CC_Crate_Cell_SPM_cellData"; // + std::to_string(Crate) + '_'
50 auto c = Cell_SPM();
51
52 const auto Idisch = 1.0; // Crate * c.Cap();
53
54 c.getStateObj().rDCn() = 0;
55 c.getStateObj().rDCp() = 0;
56 c.getStateObj().rDCcc() = 0;
57
58 std::cout << "Vbefore: " << c.V() << '\n';
59 c.setBlockDegAndTherm(true);
60 ThroughputData th{};
61
62 c.setCurrent(Idisch);
63
64 const double T_end{ 3600 }, dt{ 0.5 };
65 double t_now{ 0 };
66 Clock clk;
67
68 std::ofstream file{ PathVar::results / (ID + ".csv"), std::ios::out };
69
70 file << "\n\n\n";
71 while (t_now <= T_end && c.V() > 2.7) {
72 file << t_now << ',' << c.V() << ',' << c.SOC() << ',' << c.T() << ','
73 << c.getThroughputs().time() << ',' << c.getThroughputs().Ah() << ','
74 << c.getThroughputs().Wh() << ',' << c.getOCV() << "\n";
75
76 c.timeStep_CC(dt, 2);
77
78 t_now += dt * 2;
79 }
80
81 std::cout << "Finished " << ID << " in " << clk << ".\n";
82 std::cout << "Vafter: " << c.V() << '\n';
83
84 file.close();
85}
86
87} // namespace slide::benchmarks
Definition: Cell_SPM.hpp:39
Definition: Cycler.hpp:19
Definition: benchmark_Cell_ECM.hpp:16
void run_Cell_SPM_2(double Crate)
Definition: running_Cell_SPM.hpp:47
void run_Cell_SPM_1(double Crate)
Definition: running_Cell_SPM.hpp:20
Definition: timing.hpp:21
Definition: State.hpp:24