-
Notifications
You must be signed in to change notification settings - Fork 9
/
BMSModule.h
70 lines (67 loc) · 1.84 KB
/
BMSModule.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
#pragma once
#include <FlexCAN.h>
class BMSModule
{
public:
BMSModule();
void decodecan(int Id, CAN_message_t &msg,int debug);
void decodetemp(CAN_message_t &msg, int CSC);
void clearmodule();
void readStatus();
int getscells();
int getbalstat();
bool readModuleValues();
float getCellVoltage(int cell);
float getLowCellV();
float getHighCellV();
float getAverageV();
float getLowTemp();
float getHighTemp();
float getHighestModuleVolt();
float getLowestModuleVolt();
float getHighestCellVolt(int cell);
float getLowestCellVolt(int cell);
float getHighestTemp();
float getLowestTemp();
float getAvgTemp();
float getModuleVoltage();
float getTemperature(int temp);
uint8_t getFaults();
uint8_t getAlerts();
uint8_t getCOVCells();
uint8_t getCUVCells();
uint32_t getError();
void setAddress(int newAddr);
int getAddress();
bool isExisting();
void setExists(bool ex);
bool isReset();
void setReset(bool ex);
void settempsensor(int tempsensor);
void setIgnoreCell(float Ignore);
void setTempOff( int16_t tempoff);
private:
float cellVolt[12]; // calculated as 16 bit value * 6.250 / 16383 = volts
float lowestCellVolt[12];
float highestCellVolt[12];
float moduleVolt; // calculated as 16 bit value * 33.333 / 16383 = volts
float temperatures[4]; // Don't know the proper scaling at this point
float lowestTemperature;
float highestTemperature;
float lowestModuleVolt;
float highestModuleVolt;
float IgnoreCell;
bool exists;
bool reset;
int alerts;
int faults;
int COVFaults;
int CUVFaults;
int sensor;
uint8_t moduleAddress; //1 to 0x3E
int scells;
int balstat;
uint32_t error;
int variant;
int16_t TempOff;
};