-
Notifications
You must be signed in to change notification settings - Fork 0
/
BMSModuleManager.h
94 lines (89 loc) · 2.56 KB
/
BMSModuleManager.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
#include "config.h"
#include "BMSModule.h"
#include <mcp_can.h>
#define MAX_MODULE_ADDR 0x3E
class BMSModuleManager
{
public:
BMSModuleManager(int);
bool initCan(int INTr);
void checkCan(int whichCan);
int seriescells();
void clearmodules();
void decodecan(long unsigned int id, uint8_t rx[8], int debug, int whichCan);
void decodetemp(long unsigned int id, uint8_t rx[8], int debug, int type, int whichCan);
void getAllVoltTemp(bool debug);
void readSetpoints();
void setBatteryID(int id);
void setPstrings(int Pstrings);
void setUnderVolt(float newVal);
void setOverVolt(float newVal);
void setOverTemp(float newVal);
void setBalanceV(float newVal);
void setBalanceHyst(float newVal);
void setSensors(int sensor, float Ignore, float VoltDelta);
void balanceCells(int debug);
void sendCommand();
void sendbalancingtest();
void setBalancing(bool);
float getPackVoltage();
float getAvgTemperature();
float getHighTemperature();
float getLowTemperature();
float getAvgCellVolt();
float getLowCellVolt();
float getHighCellVolt();
float getHighVoltage();
float getLowVoltage();
String getCellJson(String a);
void setDebug(bool deb);
void setCanDebug(bool deb);
/*
void processCANMsg(CAN_FRAME &frame);
*/
void printAllCSV(unsigned long timestamp, float current, int SOC);
void printPackSummary();
void printPackDetails(int digits);
int getNumModules();
bool checkcomms();
MCP_CAN *CAN1;
//Balance testing
int balinit = 0;
int balon = 0;
int balcycle = 0;
private:
float packVolt; // All modules added together
int Pstring;
float LowCellVolt;
float HighCellVolt;
float lowestPackVolt;
float highestPackVolt;
float lowestPackTemp;
float highestPackTemp;
float highTemp;
float lowTemp;
float BalHys;
BMSModule modules[MAX_MODULE_ADDR + 1]; // store data for as many modules as we've configured for.
int batteryID;
int numFoundModules; // The number of modules that seem to exist
bool isFaulted;
int spack;
bool candebug = 0;
bool debug = 0;
int CAN1_INT;
long unsigned int txId;
long unsigned int rxId;
uint8_t rxBuf[8];
uint8_t tx[8];
unsigned char len;
bool ext;
bool balancing;
uint8_t balcnt;
char msgString[128];
/*
void sendBatterySummary();
void sendModuleSummary(int module);
void sendCellDetails(int module, int cell);
*/
};