-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule_Battery_Management_System.h
73 lines (59 loc) · 1.39 KB
/
Module_Battery_Management_System.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include <vector>
#include <memory>
#include "BasicPOCModule.h"
#include "BQ76952.h"
class Module_Battery_Management_System :
public BasicPOCModule {
private:
BQ76952 bq;
public:
class Cell {
private:
bool isActive = true;
double maxVoltage = 3.3; //V
double minVoltage = 0; //V
double maxCapacity = 1.8; //Ah
unsigned int number;
public:
Cell(unsigned int number);
unsigned int getNumber();
double getVoltage();
void setMaxVoltage(double maxVoltage);
double getMaxVoltage();
void setMaxCapacity(double maxCapacity);
double getMaxCapacity();
void setMinVoltage(double minCapacity);
double getMinVoltage();
bool getIsActive();
void activate();
void deactivate();
};
Cell cell1{ 1 };
Cell cell2{ 2 };
Cell cell3{ 3 };
Cell cell4{ 4 };
Cell cell5{ 5 };
Cell cell6{ 6 };
Cell cell7{ 7 };
Cell cell8{ 8 };
vector<shared_ptr<Cell>> cells{
make_shared<Cell>(cell1),
make_shared<Cell>(cell2),
make_shared<Cell>(cell3),
make_shared<Cell>(cell4),
make_shared<Cell>(cell5),
make_shared<Cell>(cell6),
make_shared<Cell>(cell7),
make_shared<Cell>(cell8)
};
Module_Battery_Management_System();
void init() final;
void selfTest() final;
const uint16_t getId() const final;
const string getClassName() const final;
double getBatteryCapacityLeft();
double getBatteryMaxCapacity();
double getBatteryState();
double getCurrentDraw();
};