-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbms.py
71 lines (55 loc) · 1.49 KB
/
bms.py
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
from abc import ABC, abstractmethod
"""
Interface class description of the BMS interface
"""
class BMS(ABC):
def __init__(self):
self._error = None # None or string in case of an error
self._voltage = None # voltage [V]
self._current = None # current [A]
self._temperature = None # temperature [°C]
self._soc = None # State of charge [%]
self._soc_low = None # lowest soc with multiple packs (set to soc for single pack)
self._soc_high = None # highest soc with multiple packs (set to soc for single pack)
@property
def voltage(self):
return self._voltage
@property
def current(self):
return self._current
@property
def temperature(self):
return self._temperature
@property
def soc(self):
return self._soc
@property
def soc_low(self):
return self._soc_low
@property
def soc_high(self):
return self._soc_high
@property
def error(self):
return self._error
@abstractmethod
def update(self):
"""
Run update / read cycle. If implemented as thread, update() must be a Dummy
:return:
"""
pass
@abstractmethod
def get_state(self):
"""
Get actual state
:return: Dictionary
"""
pass
@abstractmethod
def get_detail(self):
"""
Get actual state with detailed Information
:return: Dictionary
"""
pass