-
Notifications
You must be signed in to change notification settings - Fork 1
/
abeeway_battery.html
431 lines (350 loc) · 18.6 KB
/
abeeway_battery.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE html>
<html>
<head>
<title>Abeeway battery life-time calculator</title>
<meta>
<link rel=icon href=https://www.abeeway.com/wp-content/uploads/2020/01/favicon.png sizes=32x32>
<link rel=icon href=https://www.abeeway.com/wp-content/uploads/2020/01/favicon.png sizes=192x192>
<link rel=apple-touch-icon href=https://www.abeeway.com/wp-content/uploads/2020/01/favicon.png>
</meta>
<style>
html {
margin: 10px;
font-family: sans-serif, Arial, Helvetica;
font-size: 90%;
}
h1 {
color: #008293;
}
legend {
color: #008293;
font-weight: bold;
font-size: 100%;
}
.flexcontainer {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: stretch;
align-content: flex-start
}
.flexitem {
flex-flow: 1 1 1;
padding: 4px;
box-sizing: border-box;
min-width: 200px;
}
.flexitem1 {
flex-flow: 1 1 1;
padding: 4px;
box-sizing: border-box;
min-width: 196px;
}
input[type="text"], input[type="number"], select, button, textarea {
width: 100%;
padding: 2px 3px 2px 3px;
margin-bottom: 10px;
box-sizing: border-box;
}
textarea {
width: 392px;
height: 150px;
padding: 2px 3px 2px 3px;
margin-bottom: 10px;
box-sizing: border-box;
}
.radiogroup {
margin-bottom: 10px;
}
</style>
</head>
<body>
<img src="https://www.abeeway.com/wp-content/uploads/2019/06/Abeeway_LOGO_blue-small.png" alt="Abeeway Logo" height=40px>
<h1>Abeeway battery life-time calculator</h1>
<p>
The results as an output of this tool can vary from the field due to impact of environment and other ambient factors.</br>
The values that should be entered should be typical average usage of the tracker and NOT worst case scenario.
</p>
<div class="flexcontainer">
<fieldset class='flexcontainer flexitem'>
<legend>General config params:</legend>
<div class='flexitem1'>
<label for="product">Product:</label><br />
<select id="product" name="product">
<option value="industrial">Industrial Tracker</option>
<option value="compact">Compact Tracker</option>
<option value="micro">Microtracker</option>
<option value="smart_badge" selected>Smart Badge</option>
</select><br />
<label for="tx_power">Tx power:</label><br />
<select id="tx_power" name="tx_power">
<option value="_14dBm_">14dBm</option>
<option value="_17dBm_">17dBm</option>
<option value="_19dBm_">19dBm</option>
</select><br />
<label for="sf">Spreading Factor:</label><br />
<select id="sf" name="sf">
<option value="7">SF7</option>
<option value="8">SF8</option>
<option value="9">SF9</option>
<option value="10" selected>SF10</option>
<option value="11">SF11</option>
<option value="12">SF12</option>
</select><br />
</div>
<div class='flexitem1'>
<label for="nof_msg_repetition">N. of times every msg sent:</label><br />
<select id="nof_msg_repetition" name="nof_msg_repetition">
<option value=1 selected>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
</select><br />
<label for="accelerometer_on">Accelerometer On:</label>
<input type="checkbox" id="accelerometer_on" name="accelerometer_on" checked><br />
</div>
</fieldset>
<fieldset class='flexitem'>
<legend>Custom messages:</legend>
<label for="custom_msg_nof_msg_per_day">Num. of msg/day:</label><br />
<input type="number" min="0" id="custom_msg_nof_msg_per_day" name="custom_msg_nof_msg_per_day" value="0"><br />
<label for="custom_msg_payl_len">Payload length [byte]:</label><br />
<input type="number" min="0" id="custom_msg_payl_len" name="custom_msg_payl_len" value="17">
</fieldset>
<fieldset class='flexitem'>
<legend>Heartbeat messages:</legend>
<label for="heartbeat_nof_msg_per_day">Num. of msg/day:</label><br />
<input type="number" min="0" id="heartbeat_nof_msg_per_day" name="heartbeat_nof_msg_per_day" value="0"><br />
</fieldset>
<fieldset class='flexitem'>
<legend>GPS location updates:</legend>
<label for="gps_nof_msg_per_day">Num. of update/day:</label><br />
<input type="number" min="0" id="gps_nof_msg_per_day" name="gps_nof_msg_per_day" value="0"><br />
<label for="gps_ttff">Time to first fix [s]:</label><br />
<input type="number" min="0" id="gps_ttff" name="gps_ttff" value="49"><br />
<label for="gps_conv_time">GPS convergence time [s]:</label><br />
<input type="number" min="0" id="gps_conv_time" name="gps_conv_time" value="90"><br />
</fieldset>
<fieldset class='flexitem'>
<legend>AGPS location updates:</legend>
<label for="agps_nof_msg_per_day">Num. of update/day:</label><br />
<input type="number" min="0" id="agps_nof_msg_per_day" name="agps_nof_msg_per_day" value="0"><br />
<label for="agps_on_time">AGPS on time [s]:</label><br />
<input type="number" min="0" id="agps_on_time" name="agps_on_time" value="8"><br />
<label for="agps_nof_satellites">Num. of satellites:</label><br />
<select id="agps_nof_satellites" name="agps_nof_satellites">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5 selected>5</option>
</select>
</fieldset>
<fieldset class='flexitem'>
<legend>WiFi location updates:</legend>
<label for="wifi_nof_msg_per_day">Num. of update/day:</label><br />
<input type="number" min="0" id="wifi_nof_msg_per_day" name="wifi_nof_msg_per_day" value="0"><br />
<label for="wifi_nof_bssid">Num. of BSSID/msg:</label><br />
<select id="wifi_nof_bssid" name="wifi_nof_bssid">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4 selected>4</option>
</select>
</fieldset>
<fieldset class='flexitem'>
<legend>BLE location updates:</legend>
<label for="ble_nof_msg_per_day">Num. of update/day:</label><br />
<input type="number" min="0" id="ble_nof_msg_per_day" name="ble_nof_msg_per_day" value="0"><br />
<label for="ble_nof_beaconid">Num. of beacon ID/msg:</label><br />
<select id="ble_nof_beaconid" name="ble_nof_beaconid">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4 selected>4</option>
</select><br />
</fieldset>
<fieldset class='flexitem'>
<legend>Custom BLE usage:</legend>
<label for="custom_ble_usage_time_per_day">Usage per day [hour]:</label><br />
<input type="number" min="0" id="custom_ble_usage_time_per_day" name="custom_ble_usage_time_per_day" value="0"><br />
<label for="custom_ble_operation">BLE operation:</label><br />
<select id="custom_ble_operation" name="custom_ble_operation">
<option value="fast_adv">Fast advertisement (2s)</option>
<option value="slow_adv">Slow advertisement (10s)</option>
<option value="connected">Connected (2s)</option>
<option value="slow_scan">Slow BLE scan (30sec)</option>
<option value="fast_scan">Fast BLE scan (8sec)</option>
</select><br />
</fieldset>
<fieldset class='flexcontainer flexitem'>
<legend>Scan collection reports:</legend>
<div class='flexitem1'>
<label for="scancoll_nof_msg_per_day">Num. of report/day:</label><br />
<input type="number" min="0" id="scancoll_nof_msg_per_day" name="scancoll_nof_msg_per_day" value="0"><br />
<div id="scancoll_tech_radiogroup" class="radiogroup">
Applied technology:<br />
<input
type="radio" id="scancoll_tech_ble" name="scancoll_tech" value="BLE" checked
onchange = "javascript:document.getElementById('scancoll_idtype_radiogroup').style.display='block'"
>
<label for="male">BLE</label>
<input
type="radio" id="scancoll_tech_wifi" name="scancoll_tech" value="WiFi"
onchange = "javascript:document.getElementById('scancoll_idtype_radiogroup').style.display='none'">
<label for="female">WiFi</label><br>
</div>
<div id="scancoll_idtype_radiogroup" class="radiogroup">
BLE ID Type:<br />
<input type="radio" id="scancoll_idtype_mac" name="scancoll_idtype" value="MAC" checked>
<label for="male">MAC Addr (6 bytes)</label><br />
<input type="radio" id="scancoll_idtype_id" name="scancoll_idtype" value="ID">
<label for="female">Beacon ID (2 bytes)</label><br>
</div>
</div>
<div class='flexitem1'>
<label for="scancoll_max_payl_len">Max. payload len. [byte]:</label><br />
<select id="scancoll_max_payl_len" name="scancoll_max_payl_len">
<option value=36>36 (SF12..SF10)</option>
<option value=92>92 (SF9..SF7)</option>
</select><br />
<label for="scancoll_nof_id">Num. of ID/msg:</label><br />
<select id="scancoll_nof_id" name="scancoll_nof_id">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8 selected>8</option>
<option value=9>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
</select><br />
</div>
</fieldset>
<!-- Will be implemented soon!!! -->
<!--
<fieldset class='flexitem'>
<legend>Proximity detection:</legend>
<label for="proximity_usage_time_per_day">Usage per day [hour]:</label><br />
<input type="number" min="0" id="proximity_usage_time_per_day" name="proximity_usage_time_per_day" value="0"><br />
<label for="proximity_alarms_per_day">Num. of alarms per day :</label><br />
<input type="number" min="0" id="proximity_alarms_per_day" name="proximity_alarms_per_day" value="10"><br />
<label for="proximity_warnings_per_day">Num. of warnings per day :</label><br />
<input type="number" min="0" id="proximity_warnings_per_day" name="proximity_warnings_per_day" value="20"><br />
</fieldset>
-->
<fieldset class='flexitem'>
<legend>Calculation:</legend>
<button onClick = "calculate()">Calculate</button><br />
<label for="result">Result:</label><br />
<textarea id="result"></textarea>
</fieldset>
</div>
</body>
<script>
/*********************************************************************/
/***** GUI SCRIPTS *****/
/*********************************************************************/
function calculate() {
let input = {
product: document.getElementById('product').value, // industrial|compact|micro|smart_badge
tx_power: document.getElementById('tx_power').value, // _14dBm_|_17dBm_|_19dBm
sf: parseInt(document.getElementById('sf').value), // 7|8|9|10|11|12
nof_msg_repetition: parseInt(document.getElementById('nof_msg_repetition').value),
accelerometer_on: document.getElementById('accelerometer_on').checked,
custom_msg: {
nof_msg_per_day: parseInt(document.getElementById('custom_msg_nof_msg_per_day').value),
payl_len: parseInt(document.getElementById('custom_msg_payl_len').value), // [bytes]
},
heartbeat: {
nof_msg_per_day: parseInt(document.getElementById('heartbeat_nof_msg_per_day').value),
},
gps: {
nof_msg_per_day: parseInt(document.getElementById('gps_nof_msg_per_day').value),
ttff: parseFloat(document.getElementById('gps_ttff').value), // [s]
conv_time: parseFloat(document.getElementById('gps_conv_time').value), // [s]
},
agps: {
nof_msg_per_day: parseInt(document.getElementById('agps_nof_msg_per_day').value),
on_time: parseFloat(document.getElementById('agps_on_time').value), // [s]
nof_satellites: parseInt(document.getElementById('agps_nof_satellites').value),
},
wifi: {
nof_msg_per_day: parseInt(document.getElementById('wifi_nof_msg_per_day').value),
nof_bssid: parseInt(document.getElementById('wifi_nof_bssid').value),
},
ble: {
nof_msg_per_day: parseInt(document.getElementById('ble_nof_msg_per_day').value),
nof_beaconid: parseInt(document.getElementById('ble_nof_beaconid').value),
},
custom_ble: {
usage_time_per_day: parseFloat(document.getElementById('custom_ble_usage_time_per_day').value),
operation: document.getElementById('custom_ble_operation').value, // fast_adv|slow_adv|connected|fast_scan|slow_scan
},
scan_collection: {
nof_msg_per_day: parseInt(document.getElementById('scancoll_nof_msg_per_day').value),
tech: document.getElementById('scancoll_tech_ble').checked ? "BLE" : "WiFi",
idtype: document.getElementById('scancoll_tech_ble').checked && document.getElementById('scancoll_idtype_id').checked ? "ID" : "MAC",
max_payl_len: parseInt(document.getElementById('scancoll_max_payl_len').value),
nof_id: parseInt(document.getElementById('scancoll_nof_id').value),
},
// The following parameters will be implemented soon!!!
/*
proximity: {
usage_time_per_day: document.getElementById('proximity_usage_time_per_day').value,
alarms_per_day: document.getElementById('proximity_alarms_per_day').value,
warnings_per_day: document.getElementById('proximity_warnings_per_day').value,
}
*/
};
let result = calculate_battery_life_time(input);
// document.getElementById('result').value = JSON.stringify(result, null, 2);
let result_text = "Battery life time: " + result.battery_life_time + " days (" + (result.battery_life_time/365).toFixed(2) + " years)\n";
result_text += "Energy distribution:\n";
if (result.current_distribution.custom_msg > 0) {
result_text += " Custom msg: " + result.current_distribution.custom_msg + " %\n";
}
if (result.current_distribution.heartbeat > 0) {
result_text += " Heartbeat: " + result.current_distribution.heartbeat + " %\n";
}
if (result.current_distribution.gps > 0) {
result_text += " GPS: " + result.current_distribution.gps + " %\n";
}
if (result.current_distribution.agps > 0) {
result_text += " AGPS: " + result.current_distribution.agps + " %\n";
}
if (result.current_distribution.wifi > 0) {
result_text += " WiFi: " + result.current_distribution.wifi + " %\n";
}
if (result.current_distribution.ble > 0) {
result_text += " BLE: " + result.current_distribution.ble + " %\n";
}
if (result.current_distribution.custom_ble > 0) {
result_text += " Custom BLE: " + result.current_distribution.custom_ble + " %\n";
}
if (result.current_distribution.scan_collection > 0) {
result_text += " Scan Collection: " + result.current_distribution.scan_collection + " %\n";
}
if (result.current_distribution.accelerometer > 0) {
result_text += " Accelerometer: " + result.current_distribution.accelerometer + " %\n";
}
if (result.current_distribution.quiesent_and_battery_leakage > 0) {
result_text += " Quiesent and Battery leakage: " + result.current_distribution.quiesent_and_battery_leakage + " %\n";
}
document.getElementById('result').value = result_text;
}
</script>
<script src="abeeway_battery.js"></script>
</html>