-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
226 lines (197 loc) · 7.83 KB
/
index.html
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="manifest" href="/lifepo4/manifest.json" crossorigin="use-credentials" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JBD BMS Monitor</title>
<script src="d3.v7.min.js"></script>
<script type="module" src="index.js"></script>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="views">
<label>API host
<input id="url" value="boatsystems.local" />
</label>
<button id="connect" >Connect</button>
<button id="disconnect" class="hidden">Disconnect</button>
<span id="connectionError" class="xxx">o</span>
<span id="streamCount">streams:0</span>
<span id="connectionCount">connections:0</span>
<span id="timeoutCount">timeouts:0</span>
<span id="receivedCount">received:0</span>
<span id="decodedCount">used:0</span>
</div>
<div>
</div>
<div class="bms">
<svg id="currentWidget" height="200" width="200" class="guage" >
<defs>
<linearGradient id="currentGradCharge" x1="0" y1="0" x2="1" y2="1">
<stop offset="15%" stop-color="orange" stop-opacity="1"></stop>
<stop offset="85%" stop-color="yellow" stop-opacity="1"></stop>
</linearGradient>
<linearGradient id="currentGradDischarge" x1="0" y1="0" x2="1" y2="1">
<stop offset="15%" stop-color="red" stop-opacity="1"></stop>
<stop offset="85%" stop-color="blue" stop-opacity="1"></stop>
</linearGradient>
<path
id="guageCurrentTextPath"
fill="none"
stroke="red"
d="M64.64,64.64 A 50 50 0 0 1 135.35,64.64" />
<path
id="guageStateOfChargeTextPath"
fill="none"
stroke="red"
d="M64.64,135.35 A 50 50 0 0 0 135.35,135.35" />
</defs>
<!-- the stroke color indicates charg vs discharge
the dasharray dash is the %, full scale is pi*d*270/360.
dash is percent*full scale is pi*d*270/360
-->
<circle
class="guageBase"
id="currentBase"
cx="100"
cy="100"
fill="transparent"
stroke="gray"
r="75"
stroke-width="25"
stroke-dasharray="353 471"
transform="rotate(135, 100, 100)"
/>
<circle
class="guagePercent"
id="currentGuage"
cx="100"
cy="100"
fill="transparent"
r=75
stroke="url(#currentGradCharge)"
stroke-width="25"
stroke-dasharray="87 471"
transform="rotate(135, 100, 100)"
style="transition: stroke-dasharray 0.3s"
/>
<!-- bottom arc charge
green filling the whole arc
overlayed by dark grey giving the impression that the green
sector is the qauge, easier to do but the dash array for the grey sector has
to be adjusted to 1-%
full scale is 0 dash
0 is pi*d*90/360
dash is (1-percent)*(p*d*90/360)
-->
<circle
class="guageSubBase"
id="stateOfChargeBase"
cx="100"
cy="100"
fill="transparent"
stroke="green"
r="75"
stroke-width="25"
stroke-dasharray="120 471"
transform="rotate(45, 100, 100)"
style="transition: stroke 0.3s"
/>
<circle
class="guageSubPercent"
id="chargeGuage"
cx="100"
cy="100"
fill="transparent"
stroke="darkgrey"
r="75"
stroke-width="25"
stroke-dasharray="90 471"
transform="rotate(45, 100, 100)"
style="transition: stroke-dasharray 0.3s"
/>
<!-- annotations
current in the center.
soc and voltage below that.
-->
<text id="guageVoltageText" x="100" y="100" alignment-baseline="middle" text-anchor="middle">?v</text>
<text text-anchor="middle" >
<textPath id="guageCurrentText" startOffset="50%" alignment-baseline="middle" href="#guageCurrentTextPath">?A</textPath>
</text>
<text text-anchor="middle" >
<textPath id="guageStateOfChargeText" startOffset="50%" alignment-baseline="middle" href="#guageStateOfChargeTextPath">?Ah</textPath>
</text>
</svg>
<ul class="state">
<li>State</li>
<li>Voltage: <span id="status.voltage">?</span> V</li>
<li>Current: <span id="status.current">?</span> A</li>
<li>State Of Charge: <span id="status.capacity.stateOfCharge">?</span> %</li>
<li>Full Capacity: <span id="status.capacity.fullCapacity">?</span> Ah</li>
<li><span id="status.charging" class="enabled">Charging</span> <span id="status.discharging" class="disabled">Discharging</span></li>
</ul>
<ul class="cells">
<li>Cells</li>
<li>0: <span id="cell.voltage0">0.0</span> V <span id="status.balanceActive0">◉</span></li>
<li>1: <span id="cell.voltage1">0.0</span> V <span id="status.balanceActive1">◉</span></li>
<li>2: <span id="cell.voltage2">0.0</span> V <span id="status.balanceActive2">◉</span></li>
<li>3: <span id="cell.voltage3">0.0</span> V <span id="status.balanceActive3">◉</span></li>
<li>Range <span id="cell.range">0.0</span> V</li>
<li>Difference <span id="cell.diff">0.0</span> V</li>
</ul>
<ul class="temperatures">
<li>Temperatures</li>
<li>Board <span id="status.tempSensorValues0">?</span> C </li>
<li>Cell 0 <span id="status.tempSensorValues1">?</span> C </li>
<li>Cell 1 <span id="status.tempSensorValues2">?</span> C </li>
</ul>
<ul class="errors">
<li>Protections</li>
<li class="disabled" id="status.errors.singleCellOvervolt">singleCellOvervolt</li>
<li class="disabled" id="status.errors.singleCellUndervolt">singleCellUndervolt</li>
<li class="disabled" id="status.errors.packOvervolt">packOvervolt</li>
<li class="disabled" id="status.errors.packUndervolt">packUndervolt</li>
<li class="disabled" id="status.errors.chargeOvertemp">chargeOvertemp</li>
<li class="disabled" id="status.errors.chargeUndertemp">chargeUndertemp</li>
<li class="disabled" id="status.errors.dischargeOvertemp">dischargeOvertemp</li>
<li class="disabled" id="status.errors.dischargeUndertemp">dischargeUndertemp</li>
<li class="disabled" id="status.errors.chargeOvercurrent">chargeOvercurrent</li>
<li class="disabled" id="status.errors.dischargeOvercurrent">dischargeOvercurrent</li>
<li class="disabled" id="status.errors.shortCircut">shortCircut</li>
<li class="disabled" id="status.errors.frontEndDetectionICError">frontEndDetectionICError</li>
<li class="disabled" id="status.errors.softwareLockMOS">softwareLockMOS</li>
</ul>
<ul class="info">
<li>Info</li>
<li>Chemistry: <span id="status.chemistry">?</span></li>
<li>Charge Cycles: <span id="status.chargeCycles">?</span></li>
<li>Pack Capacity: <span id="status.packBalCap">?</span> Ah</li>
<li>ProductionDate: <span id="status.productionDate">?</span></li>
<li>BMS SW Version: <span id="status.bmsSWVersion">?</span></li>
<li>Number of Cells: <span id="status.numberOfCells">?</span></li>
<li>Number of NTC Sensors: <span id="status.tempSensorCount">?</span></li>
</ul>
</div>
<div id="status.lastUpdate"></div>
<label for="timewindow">Graph Time Period</label>
<select id="timewindow">
<option value="3600000">1h</option>
<option value="10800000">3h</option>
<option value="21600000">6h</option>
<option value="43200000">12h</option>
<option value="86400000">24h</option>
</select>
<input type="range" id="endOfWindow" min="-86400000" max="0" step="600000" value="0">
<div class="history" >
<div id="packVoltageGraph" ></div>
<div id="cellVoltagesGraph" ></div>
<div id="currentGraph" ></div>
<div id="temperatureGraph" ></div>
<div id="stateOfChargeGraph" ></div>
<div id="chargeRemainingGraph" ></div>
</div>
<script type="text/javascript">
</script>
</body>
</html>