Line data Source code
1 : /*
2 : * Cycler.hpp
3 : *
4 : * Created on: 19 Dec 2019
5 : * Author(s): Jorn Reniers, Volkan Kumtepeli
6 : */
7 :
8 : #pragma once
9 :
10 : #include "../StorageUnit.hpp"
11 : #include "../types/data_storage/cell_data.hpp"
12 :
13 : #include <string>
14 : #include <memory>
15 : #include <span>
16 :
17 : namespace slide {
18 : class Cycler
19 : {
20 : private:
21 : std::string ID{ "Cycler" }; //!< identification string of this cycler
22 : StorageUnit *su{ nullptr }; //!< (pointer to) something of type storage unit which is connected to this cycler
23 :
24 : size_t index{ 0 }; //!< Cycler should keep its on index for data writing.
25 : bool diagnostic{ false }; //!< are we running in diagnostic mode or not?
26 :
27 : //!< secondary functions
28 : Status setCurrent(double I, double vlim); //!< sets the current to the connected SU
29 :
30 : public:
31 27 : Cycler() = default;
32 : Cycler(StorageUnit *sui) : su(sui) {}
33 : Cycler(StorageUnit *sui, const std::string &IDi) : ID(IDi), su(sui) {}
34 : Cycler(Deep_ptr<StorageUnit> &sui, const std::string &IDi) : Cycler(sui.get(), IDi) {}
35 :
36 : Cycler &initialise(StorageUnit *sui, const std::string &IDi);
37 : Cycler &initialise(Deep_ptr<StorageUnit> &sui, const std::string &IDi) { return initialise(sui.get(), IDi); }
38 :
39 : Cycler &setDiagnostic(bool newDia);
40 : double getSafetyVmin() { return su->VMIN() * 0.99; } //!< #TODO probably causing many calculations.
41 : double getSafetyVmax() { return su->VMAX() * 1.01; }
42 :
43 : Status rest(double tlim, double dt, int ndt_data, ThroughputData &th);
44 : Status CC(double I, double vlim, double tlim, double dt, int ndt_data, ThroughputData &th);
45 : Status CV(double Vset, double Ilim, double tlim, double dt, int ndt_data, ThroughputData &th);
46 : Status CCCV(double I, double Vset, double Ilim, double dt, int ndt_data, ThroughputData &th);
47 : Status CCCV_with_tlim(double I, double Vset, double Ilim, double tlim, double dt, int ndt_data, ThroughputData &th);
48 :
49 : Status Profile(std::span<double> I_vec, double vlim, double tlim, double dt, int ndt_data, double &Ah, double &Wh);
50 :
51 : int storeData();
52 : int writeData();
53 :
54 : double testCapacity(double &Ah, double &ttot);
55 : double testCapacity()
56 : {
57 : double Ah{}, ttot{};
58 : return testCapacity(Ah, ttot);
59 : }
60 :
61 :
62 : StorageUnit *getSU() { return su; }
63 : };
64 : } // namespace slide
|