@jiabaida/tools 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cjs/core/BleApiManager.js +1 -1
  2. package/dist/cjs/core/BleCmdAnalysis/BaseParamProtocol.js +1 -0
  3. package/dist/cjs/core/BleCmdAnalysis/BleCmdAnalysis.js +1 -0
  4. package/dist/cjs/core/BleCmdAnalysis/BleCmdDD.js +1 -0
  5. package/dist/cjs/core/BleCmdAnalysis/BleCmdFFAA.js +1 -0
  6. package/dist/cjs/core/BleCmdAnalysis/BleCmdHVES.js +1 -0
  7. package/dist/cjs/core/BleCmdAnalysis/ESHostProtocol.js +1 -0
  8. package/dist/cjs/core/BleCmdAnalysis/readAndSetParam.js +1 -0
  9. package/dist/cjs/core/BleCmdAnalysis.js +1 -0
  10. package/dist/cjs/core/BleDataProcess.js +1 -0
  11. package/dist/cjs/core/OtaUpgrade.js +1 -0
  12. package/dist/cjs/core/TelinkApi.js +1 -0
  13. package/dist/cjs/core/Transfer.js +1 -0
  14. package/dist/cjs/core/commonfun.js +1 -1
  15. package/dist/cjs/core/dataJson/baseParamsJson.js +1 -0
  16. package/dist/cjs/core/keyAndPwdManager.js +1 -0
  17. package/dist/cjs/index.js +1 -1
  18. package/dist/esm/core/BleApiManager.js +1 -1
  19. package/dist/esm/core/BleCmdAnalysis/BaseParamProtocol.js +1 -0
  20. package/dist/esm/core/BleCmdAnalysis/BleCmdAnalysis.js +1 -0
  21. package/dist/esm/core/BleCmdAnalysis/BleCmdDD.js +1 -0
  22. package/dist/esm/core/BleCmdAnalysis/BleCmdFFAA.js +1 -0
  23. package/dist/esm/core/BleCmdAnalysis/BleCmdHVES.js +1 -0
  24. package/dist/esm/core/BleCmdAnalysis/ESHostProtocol.js +1 -0
  25. package/dist/esm/core/BleCmdAnalysis/readAndSetParam.js +1 -0
  26. package/dist/esm/core/BleCmdAnalysis.js +1 -0
  27. package/dist/esm/core/BleDataProcess.js +1 -0
  28. package/dist/esm/core/OtaUpgrade.js +1 -0
  29. package/dist/esm/core/TelinkApi.js +1 -0
  30. package/dist/esm/core/Transfer.js +1 -0
  31. package/dist/esm/core/commonfun.js +1 -1
  32. package/dist/esm/core/dataJson/baseParamsJson.js +1 -0
  33. package/dist/esm/core/keyAndPwdManager.js +1 -0
  34. package/dist/esm/index.js +1 -1
  35. package/package.json +13 -3
  36. package/src/core/BleApiManager.js +487 -0
  37. package/src/core/BleCmdAnalysis/BaseParamProtocol.js +651 -0
  38. package/src/core/BleCmdAnalysis/BleCmdAnalysis.js +220 -0
  39. package/src/core/BleCmdAnalysis/BleCmdDD.js +1214 -0
  40. package/src/core/BleCmdAnalysis/BleCmdDDA4.js +762 -0
  41. package/src/core/BleCmdAnalysis/BleCmdFFAA.js +407 -0
  42. package/src/core/BleCmdAnalysis/BleCmdHVES.js +1222 -0
  43. package/src/core/BleCmdAnalysis/ESHostProtocol.js +829 -0
  44. package/src/core/BleCmdAnalysis/index.js +7 -0
  45. package/src/core/BleCmdAnalysis/readAndSetParam.js +288 -0
  46. package/src/core/BleDataProcess.js +355 -0
  47. package/src/core/OtaUpgrade.js +338 -0
  48. package/src/core/TelinkApi.js +73 -0
  49. package/src/core/Transfer.js +516 -0
  50. package/src/core/array.js +10 -0
  51. package/src/core/commonfun.js +84 -0
  52. package/src/core/dataJson/baseParamsJson.js +754 -0
  53. package/src/core/dataJson/index.js +1 -0
  54. package/src/core/keyAndPwdManager.js +346 -0
  55. package/src/core/mqttServer.js +296 -0
  56. package/src/core/rsaEncrypt.js +45 -0
  57. package/src/index.js +11 -0
@@ -0,0 +1,1222 @@
1
+ import { getData } from './BleCmdAnalysis.js'
2
+ import { generateCrcCheckSum, decimalToHex, hex2string, hexArr2string, hex2Ascii, stringToTwoHexArray, hexArr2Assic, generateCrc16modbusCheck, hex2Binary, extractBits, hexStrAscii } from '../BleDataProcess';
3
+
4
+ /** 格式化储能数据
5
+ *
6
+ * @param {string[]} value 十六进制字符串数据
7
+ * @param {*} n 倍数系数
8
+ * @param {*} offset 偏移系数
9
+ * @param {*} scope 小数位精度
10
+ * @returns
11
+ */
12
+ const format = (value, n, offset, scope) => {
13
+ const v = parseInt(value.join(''), 16) * n + offset;
14
+ if (scope == undefined) return v;
15
+ return v.toFixed(scope);
16
+ }
17
+ /** 格式化储能数据-向下取整-(适用于SOC等)
18
+ *
19
+ * @param {*} value
20
+ * @param {*} n
21
+ * @param {*} offset
22
+ * @param {*} scope
23
+ * @returns
24
+ */
25
+ const format2floor = (value, n, offset, scope) => {
26
+ const v = parseInt(value.join(''), 16) * n + offset;
27
+ return Math.floor(v);
28
+ }
29
+ /** 解析成二进制0/1进行Boolean类型处理
30
+ *
31
+ * @param {*} value
32
+ * @param {*} n
33
+ * @param {*} offset
34
+ * @param {*} scope
35
+ * @param {*} len
36
+ * @returns
37
+ */
38
+ const formatBools = (value, n, offset, scope, len) => {
39
+ const hexs = value.join('');
40
+ const binary = hex2Binary(hexs).split('');
41
+ // 倒叙取值
42
+ binary.reverse();
43
+ const arr = new Array(Math.max(len, binary.length));
44
+ for (let i = 0; i < arr.length; i++) {
45
+ arr[i] = binary[i] == '1';
46
+ }
47
+ return arr;
48
+ }
49
+ /** 显示原始十六进制字符串
50
+ *
51
+ * @param {*} value
52
+ * @returns
53
+ */
54
+ const format2HexString = (value) => {
55
+ return value.map((o) => hex2string(o)).join('');
56
+ }
57
+ /** 0x010E => v1.14
58
+ *
59
+ * @param {*} value
60
+ * @returns
61
+ */
62
+ const format2Version = (value) => {
63
+ return value.map((o) => o.toString()).join('.');
64
+ }
65
+ const formatExtractBits = (value, n, offset, scope, bitsSpriter) => {
66
+ const v = format(value, n, offset, scope);
67
+ const _v = bitsSpriter.map(([s, e]) => extractBits(v, s, e));
68
+ return _v.join('-');
69
+ }
70
+ const formatAssicString = (value) => {
71
+ const v = format2HexString(value);
72
+ return hexStrAscii(v);
73
+ }
74
+
75
+ const push = (arr, [label, key, formatter, value, n, offset, scope, len = 0, bitsSpriter = []]) => {
76
+ if (!formatter) {
77
+ arr.push([label, key, value, undefined, n, offset, scope, undefined]);
78
+ return value;
79
+ }
80
+ const _value = formatter.call(this, value, n, offset, scope, len, bitsSpriter);
81
+ arr.push([label, key, _value, value.join(''), n, offset, scope, formatter.name]);
82
+ return _value;
83
+ }
84
+ // #region 储能协议通用指令
85
+ /**储能协议通用指令
86
+ *
87
+ * @param {*} deviceId
88
+ * @param {*} command 指令十六进制指令数组
89
+ * @returns
90
+ */
91
+ export const getCMDESInfoAsync = async (deviceId, command) => {
92
+ if (typeof command == 'string') {
93
+ command = command.match(/(.{2})/g).map((o) => `0x${o}`);
94
+ }
95
+ const data = await getData(
96
+ deviceId,
97
+ {
98
+ command,
99
+ // 01 78 1000 1200 007E 063D063E0000753000000000
100
+ commandVerifyHandler: (hexArr) => ({ verified: hexArr[0] == command[0] && hexArr[1] == command[1], pkgLen: hexArr[7] + 10 }),
101
+ pkgVerifyHandler: (pkg) => {
102
+ const len = pkg.length;
103
+ const [c1, c2] = generateCrc16modbusCheck(pkg.slice(0, len - 2), true);
104
+ const [_c1, _c2] = [pkg[len - 2], pkg[len - 1]];
105
+ return { verified: c1 == _c1 && c2 == _c2 };
106
+ },
107
+ },
108
+ `CMDES_储能协议通用指令`,
109
+ );
110
+ let result = null;
111
+ if (data) {
112
+ const dataStr = hexArr2string(data);
113
+ const header = dataStr.slice(0, 8 * 2);
114
+ result = {
115
+ data,
116
+ dataStr,
117
+ header
118
+ };
119
+ }
120
+ return result;
121
+ }
122
+ // #region 高压家储 读取HVES信息
123
+ /**读取HVES信息
124
+ *
125
+ * @param {*} deviceId
126
+ * @param {*} codes 地址码-功能码-起始地址-结束地址-数据长度-校验位
127
+ * @returns
128
+ */
129
+ export const getHVESInfoAsync = async (deviceId, codes) => {
130
+ const [addr, code] = codes;
131
+ const checks = generateCrc16modbusCheck(codes, true);
132
+ const command = [...codes, ...checks];
133
+ return getData(
134
+ deviceId,
135
+ {
136
+ command,
137
+ // 01 78 1000 1200 007E 063D063E0000753000000000
138
+ commandVerifyHandler: (hexArr) => ({ verified: hexArr[0] == addr && hexArr[1] == code, pkgLen: hexArr[7] + 10 }),
139
+ pkgVerifyHandler: (pkg) => {
140
+ const len = pkg.length;
141
+ const [c1, c2] = generateCrc16modbusCheck(pkg.slice(0, len - 2), true);
142
+ const [_c1, _c2] = [pkg[len - 2], pkg[len - 1]];
143
+ return { verified: c1 == _c1 && c2 == _c2 };
144
+ },
145
+ },
146
+ `HVES_${addr}_${code}`,
147
+ );
148
+ }
149
+
150
+ // #region 储能BMS统计信息
151
+ /** 储能BMS统计信息 0x50 4000 407a */
152
+ // 解析储能BMS统计信息- 0x50 4000 407a
153
+ export const resolveHVESSumInfo = async (data) => {
154
+ if (!data) return null;
155
+ const dataStr = hexArr2string(data);
156
+ const header = dataStr.slice(0, 8 * 2);
157
+
158
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
159
+ let i = 0;
160
+ let _data = [];
161
+ const _ = this;
162
+
163
+ push(_data, ['总电压V', 'sumV', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
164
+ push(_data, ['总电流A', 'sumE', format, c.slice(i, (i += 2)), 0.1, -3000, 1]);
165
+ push(_data, ['SOC%', 'soc', format2floor, c.slice(i, (i += 2)), 1, 0, 0]);
166
+ push(_data, ['SOH%', 'soh', format2floor, c.slice(i, (i += 2)), 1, 0, 0]);
167
+
168
+ push(_data, ['总容量Ah', 'sumC', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
169
+ push(_data, ['标称容量Ah', 'designC', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
170
+ push(_data, ['剩余容量Ah', 'restC', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
171
+
172
+ push(_data, ['告警信息', 'warningInfo', formatBools, c.slice(i, (i += 8)), 1, 0, undefined, 19]);
173
+ const cellNo = push(_data, ['并机个数', 'cellNo', format, c.slice(i, (i += 2)), 1, 0, 0]);
174
+ push(_data, ['并机状态', 'cellState', formatBools, c.slice(i, (i += 2)), 1, 0, undefined, cellNo]);
175
+ push(_data, ['循环次数', 'cycleNo', format, c.slice(i, (i += 2)), 1, 0, 0]);
176
+
177
+ push(_data, [
178
+ '最高单体序号',
179
+ 'maxVolNo',
180
+ formatExtractBits,
181
+ c.slice(i, (i += 2)),
182
+ 1,
183
+ 0,
184
+ 0,
185
+ [
186
+ [12, 15],
187
+ [7, 11],
188
+ [0, 6],
189
+ ],
190
+ ]);
191
+ push(_data, ['最高单体电压mV', 'maxVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
192
+ push(_data, [
193
+ '最低单体序号',
194
+ 'minVolNo',
195
+ formatExtractBits,
196
+ c.slice(i, (i += 2)),
197
+ 1,
198
+ 0,
199
+ 0,
200
+ [
201
+ [12, 15],
202
+ [7, 11],
203
+ [0, 6],
204
+ ],
205
+ ]);
206
+ push(_data, ['最低单体电压mV', 'minVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
207
+
208
+ push(_data, [
209
+ '最高温度序号',
210
+ 'maxTemNo',
211
+ formatExtractBits,
212
+ c.slice(i, (i += 2)),
213
+ 1,
214
+ 0,
215
+ 0,
216
+ [
217
+ [12, 15],
218
+ [7, 11],
219
+ [0, 6],
220
+ ],
221
+ ]);
222
+ push(_data, ['最高温度℃', 'maxTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
223
+ push(_data, [
224
+ '最低温度序号',
225
+ 'minTemNo',
226
+ formatExtractBits,
227
+ c.slice(i, (i += 2)),
228
+ 1,
229
+ 0,
230
+ 0,
231
+ [
232
+ [12, 15],
233
+ [7, 11],
234
+ [0, 6],
235
+ ],
236
+ ]);
237
+ push(_data, ['最低温度℃', 'minTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
238
+
239
+ push(_data, ['系统状态', 'sysState', format2HexString, c.slice(i, (i += 2)), 0, 0, 0]);
240
+
241
+ push(_data, ['预留1', 'n1', format2HexString, c.slice(i, (i += 2)), 0, 0, 0]);
242
+ push(_data, ['预留2', 'n2', format2HexString, c.slice(i, (i += 2)), 0, 0, 0]);
243
+ push(_data, ['预留3', 'n3', format2HexString, c.slice(i, (i += 2)), 0, 0, 0]);
244
+ push(_data, ['预留4', 'n4', format2HexString, c.slice(i, (i += 2)), 0, 0, 0]);
245
+
246
+ let packs = [];
247
+ [...Array(cellNo)].forEach((__, i) => {
248
+ let arr = [];
249
+ const j = i + 1;
250
+ push(arr, [`PACK${j} 电压V`, `pack${j}V`, format, c.slice(i, (i += 2)), 0.1, 0, 1]);
251
+ push(arr, [`PACK${j} 电流A`, `pack${j}E`, format, c.slice(i, (i += 2)), 0.1, -3000, 1]);
252
+ push(arr, [`PACK${j} SOC`, `pack${j}SOC`, format2floor, c.slice(i, (i += 2)), 1, 0, 0]);
253
+ push(arr, [`PACK${j} 状态`, `pack${j}State`, format, c.slice(i, (i += 2)), 1, 0, 0]);
254
+
255
+ packs.push(arr);
256
+ });
257
+ push(_data, [`PACKS`, `packs`, undefined, packs, undefined, undefined, undefined]);
258
+
259
+ let res = {};
260
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
261
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
262
+ }
263
+
264
+ // #region 储能BMS系统基本信息
265
+ /** 储能BMS系统基本信息 0x78 1000 107c */
266
+ // 解析储能BMS系统基本信息- 0x78 1000 107c
267
+ export const resolveHVESBaseInfo = (data) => {
268
+ if (!data) return null;
269
+ const dataStr = hexArr2string(data);
270
+ const header = dataStr.slice(0, 8 * 2);
271
+
272
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
273
+ let i = 0;
274
+ let _data = [];
275
+ const _ = this;
276
+
277
+ push(_data, ['总电压V', 'sumV', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
278
+ push(_data, ['母线回踩电压V', 'muxianV', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
279
+ push(_data, ['总电流A', 'sumE', format, c.slice(i, (i += 4)), 0.1, -3000, 1]);
280
+ push(_data, ['SOC%', 'soc', format2floor, c.slice(i, (i += 2)), 0.01, 0, 0]);
281
+
282
+ push(_data, ['剩余容量Ah', 'restC', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
283
+ push(_data, ['满充容量Ah', 'fullC', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
284
+ push(_data, ['标称容量Ah', 'designC', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
285
+
286
+ push(_data, ['环境温度℃', 'envTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
287
+ push(_data, ['充放电状态(0待机1充电2放电)', 'state', format, c.slice(i, (i += 2)), 1, 0, 0]);
288
+
289
+ push(_data, ['SOH%', 'soh', format2floor, c.slice(i, (i += 2)), 1, 0, 0]);
290
+
291
+ const LEN = 8;
292
+ const warningInfoHex = push(_data, ['告警信息原始值', 'warningInfoHex', format2HexString, c.slice(i, (i += LEN)), 1, 0, undefined, undefined]);
293
+ const warningInfo = warningInfoHex
294
+ .match(/(.{2})/g)
295
+ .map((o) => hex2Binary(o, 8))
296
+ .join('')
297
+ .match(/(.{2})/g)
298
+ .map((o) => parseInt(o, 2))
299
+ .reverse();
300
+ push(_data, [`告警信息`, `warningInfo`, undefined, warningInfo, undefined, undefined, undefined]);
301
+
302
+ push(_data, ['故障信息', 'faultInfo', formatBools, c.slice(i, (i += 4)), 1, 0, undefined, 9]);
303
+
304
+ push(_data, ['MOS状态', 'mosState', formatBools, c.slice(i, (i += 2)), 1, 0, undefined, 10]);
305
+ push(_data, ['信号状态', 'signalState', formatBools, c.slice(i, (i += 2)), 1, 0, undefined, 5]);
306
+
307
+ push(_data, ['循环次数', 'cycleNo', format, c.slice(i, (i += 2)), 1, 0, 0]);
308
+
309
+ push(_data, [
310
+ '最高单体序号',
311
+ 'maxVolNo',
312
+ formatExtractBits,
313
+ c.slice(i, (i += 2)),
314
+ 1,
315
+ 0,
316
+ 0,
317
+ [
318
+ [8, 15],
319
+ [0, 7],
320
+ ],
321
+ ]);
322
+ push(_data, ['最高单体mV', 'maxVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
323
+ push(_data, [
324
+ '最低单体序号',
325
+ 'minVolNo',
326
+ formatExtractBits,
327
+ c.slice(i, (i += 2)),
328
+ 1,
329
+ 0,
330
+ 0,
331
+ [
332
+ [8, 15],
333
+ [0, 7],
334
+ ],
335
+ ]);
336
+ push(_data, ['最低单体mV', 'minVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
337
+ push(_data, ['平均电压mV', 'avgVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
338
+
339
+ push(_data, [
340
+ '最高温度序号',
341
+ 'maxTemNo',
342
+ formatExtractBits,
343
+ c.slice(i, (i += 2)),
344
+ 1,
345
+ 0,
346
+ 0,
347
+ [
348
+ [8, 15],
349
+ [0, 7],
350
+ ],
351
+ ]);
352
+ push(_data, ['最高温度℃', 'maxTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
353
+ push(_data, [
354
+ '最低温度序号',
355
+ 'minTemNo',
356
+ formatExtractBits,
357
+ c.slice(i, (i += 2)),
358
+ 1,
359
+ 0,
360
+ 0,
361
+ [
362
+ [8, 15],
363
+ [0, 7],
364
+ ],
365
+ ]);
366
+ push(_data, ['最低温度℃', 'minTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
367
+ push(_data, ['平均温度℃', 'avgTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
368
+
369
+ push(_data, ['充电需求电压V', 'chargeVol', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
370
+ push(_data, ['充电需求电流A', 'chargeE', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
371
+ push(_data, ['放电需求电压V', 'disChargeVol', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
372
+ push(_data, ['放电需求电流A', 'dischargeE', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
373
+
374
+ push(_data, ['软件版本', 'softwareV', format2Version, c.slice(i, (i += 2)), 1, 0, 0]);
375
+ push(_data, ['SN码', 'sn', hex2Ascii, c.slice(i, (i += 30)), 1, 0, 0]);
376
+
377
+ push(_data, ['回踩电压2V', 'muxian2V', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
378
+ const sysLevel = push(_data, ['系统等级', 'sysLevel', format2HexString, c.slice(i, (i += 2)), 1, 0, 0]);
379
+ const bmuNo = extractBits(parseInt(sysLevel, 16), 0, 5);
380
+ push(_data, [`BMU数`, `bmuNo`, undefined, bmuNo, undefined, undefined, undefined]);
381
+
382
+ push(_data, ['负绝缘电阻KΩ', 'nIR', format, c.slice(i, (i += 2)), 0.1, 0, 0]);
383
+ push(_data, ['正绝缘电阻KΩ', 'pIR', format, c.slice(i, (i += 2)), 0.1, 0, 0]);
384
+
385
+ push(_data, ['最高单体编号', 'maxCellNo', format, c.slice(i, (i += 2)), 1, 0, 0]);
386
+ push(_data, ['最低单体编号', 'minCellNo', format, c.slice(i, (i += 2)), 1, 0, 0]);
387
+ push(_data, ['最高温度编号', 'maxTemNo_', format, c.slice(i, (i += 2)), 1, 0, 0]);
388
+ push(_data, ['最低温度编号', 'minTemNo_', format, c.slice(i, (i += 2)), 1, 0, 0]);
389
+
390
+ push(_data, ['极柱温度1', 'pTem1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
391
+ push(_data, ['极柱温度2', 'pTem2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
392
+ push(_data, ['极柱温度3', 'pTem3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
393
+ push(_data, ['极柱温度4', 'pTem4', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
394
+
395
+ push(_data, ['RS485协议', 'rs485', format, c.slice(i, (i += 1)), 1, 0, 0]);
396
+ push(_data, ['CAN协议', 'can', format, c.slice(i, (i += 1)), 1, 0, 0]);
397
+
398
+ let res = {};
399
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
400
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
401
+ }
402
+ // #region 解析HVES 参数信息
403
+ /** 解析HVES 参数信息*/
404
+ export const resolveHVESParamsInfo = (data) => {
405
+ if (!data) return null;
406
+ const [v0, v1, v2, v3, v4, v5, v6] = data;
407
+ // && v5 == '0x2e'
408
+ if (v2 == '0x18' && v3 == '0x00' && v4 == '0x18') {
409
+ return resolveHVESMonoVolInfo(data);
410
+ }
411
+ if (v2 == '0x18' && v3 == '0x30' && v4 == '0x18') {
412
+ return resolveHVESSumVolInfo(data);
413
+ }
414
+ if (v2 == '0x18' && v3 == '0x60' && v4 == '0x18') {
415
+ return resolveHVESOvrInfo(data);
416
+ }
417
+ if (v2 == '0x18' && v3 == '0x78' && v4 == '0x18') {
418
+ return resolveHVESOeInfo(data);
419
+ }
420
+ if (v2 == '0x18' && v3 == '0xa8' && v4 == '0x18') {
421
+ return resolveHVESCtInfo(data);
422
+ }
423
+ if (v2 == '0x18' && v3 == '0xd8' && v4 == '0x19') {
424
+ return resolveHVESDisCtInfo(data);
425
+ }
426
+ if (v2 == '0x19' && v3 == '0x08' && v4 == '0x19') {
427
+ return resolveHVESEtInfo(data);
428
+ }
429
+ if (v2 == '0x19' && v3 == '0x38' && v4 == '0x19') {
430
+ return resolveHVESOtrInfo(data);
431
+ }
432
+ if (v2 == '0x19' && v3 == '0x50' && v4 == '0x19') {
433
+ return resolveHVESOtRisingInfo(data);
434
+ }
435
+ if (v2 == '0x19' && v3 == '0x68' && v4 == '0x19') {
436
+ return resolveHVESElectrodeHTInfo(data);
437
+ }
438
+ if (v2 == '0x19' && v3 == '0x80' && v4 == '0x19') {
439
+ return resolveHVESInsulationLRInfo(data);
440
+ }
441
+ if (v2 == '0x19' && v3 == '0x98' && v4 == '0x19') {
442
+ return resolveHVESLSocInfo(data);
443
+ }
444
+ if (v2 == '0x20' && v3 == '0x00' && v4 == '0x20') {
445
+ return resolveHVESCalibrationInfo(data);
446
+ }
447
+ if (v2 == '0x22' && v3 == '0x00' && v4 == '0x22') {
448
+ return resolveHVESCalibrationConfigInfo(data);
449
+ }
450
+ if (v2 == '0x1c' && v3 == '0x00' && v4 == '0x1c') {
451
+ return resolveHVESPackInfo(data);
452
+ }
453
+ return null;
454
+ }
455
+ // #region 解析HVES 告警与保护参数(单体过压-单体欠压)
456
+ /** 解析HVES 告警与保护参数(单体过压-单体欠压) 0x78 1800 1830 */
457
+ // 解析告警与保护参数(单体过压-单体欠压)- 0x78 1800 1830
458
+ export const resolveHVESMonoVolInfo = (data) => {
459
+ if (!data) return null;
460
+ const dataStr = hexArr2string(data);
461
+ const header = dataStr.slice(0, 8 * 2);
462
+
463
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
464
+ let i = 0;
465
+ let _data = [];
466
+ const _ = this;
467
+ // 单体过压
468
+ push(_data, ['单体过压-1级告警值mV', 'M_OV_alarmV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
469
+ push(_data, ['单体过压-1级告警延时mS', 'M_OV_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
470
+ push(_data, ['单体过压-1级恢复值mV', 'M_OV_recoverV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
471
+ push(_data, ['单体过压-1级恢复延时S', 'M_OV_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
472
+
473
+ push(_data, ['单体过压-2级告警值mV', 'M_OV_alarmV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
474
+ push(_data, ['单体过压-2级告警延时mS', 'M_OV_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
475
+ push(_data, ['单体过压-2级恢复值mV', 'M_OV_recoverV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
476
+ push(_data, ['单体过压-2级恢复延时S', 'M_OV_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
477
+
478
+ push(_data, ['单体过压-3级保护值mV', 'M_OV_protectionV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
479
+ push(_data, ['单体过压-3级保护延时mS', 'M_OV_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
480
+ push(_data, ['单体过压-3级恢复值mV', 'M_OV_recoverV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
481
+ push(_data, ['单体过压-3级恢复延时S', 'M_OV_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
482
+ // 单体欠压
483
+ push(_data, ['单体欠压-1级告警值mV', 'M_UV_alarmV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
484
+ push(_data, ['单体欠压-1级告警延时mS', 'M_UV_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
485
+ push(_data, ['单体欠压-1级恢复值mV', 'M_UV_recoverV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
486
+ push(_data, ['单体欠压-1级恢复延时S', 'M_UV_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
487
+
488
+ push(_data, ['单体欠压-2级告警值mV', 'M_UV_alarmV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
489
+ push(_data, ['单体欠压-2级告警延时mS', 'M_UV_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
490
+ push(_data, ['单体欠压-2级恢复值mV', 'M_UV_recoverV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
491
+ push(_data, ['单体欠压-2级恢复延时S', 'M_UV_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
492
+
493
+ push(_data, ['单体欠压-3级保护值mV', 'M_UV_protectionV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
494
+ push(_data, ['单体欠压-3级保护延时mS', 'M_UV_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
495
+ push(_data, ['单体欠压-3级恢复值mV', 'M_UV_recoverV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
496
+ push(_data, ['单体欠压-3级恢复延时S', 'M_UV_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
497
+
498
+ let res = {};
499
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
500
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
501
+ }
502
+ // #region 解析HVES 告警与保护参数(总压过压-总压欠压)
503
+ /** 解析HVES 告警与保护参数(总压过压-总压欠压) 0x78 1830 1860 */
504
+ // 解析告警与保护参数(总压过压-总压欠压)- 0x78 1830 1860
505
+ export const resolveHVESSumVolInfo = (data) => {
506
+ if (!data) return null;
507
+ const dataStr = hexArr2string(data);
508
+ const header = dataStr.slice(0, 8 * 2);
509
+
510
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
511
+ let i = 0;
512
+ let _data = [];
513
+ const _ = this;
514
+ // 总压过压
515
+ push(_data, ['总压过压-1级告警值V', 'S_OV_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
516
+ push(_data, ['总压过压-1级告警延时mS', 'S_OV_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
517
+ push(_data, ['总压过压-1级恢复V', 'S_OV_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
518
+ push(_data, ['总压过压-1级恢复延时S', 'S_OV_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
519
+
520
+ push(_data, ['总压过压-2级告警值V', 'S_OV_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
521
+ push(_data, ['总压过压-2级告警延时mS', 'S_OV_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
522
+ push(_data, ['总压过压-2级恢复V', 'S_OV_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
523
+ push(_data, ['总压过压-2级恢复延时S', 'S_OV_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
524
+
525
+ push(_data, ['总压过压-3级保护值V', 'S_OV_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
526
+ push(_data, ['总压过压-3级保护延时mS', 'S_OV_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
527
+ push(_data, ['总压过压-3级恢复V', 'S_OV_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
528
+ push(_data, ['总压过压-3级恢复延时S', 'S_OV_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
529
+
530
+ // 总压欠压
531
+ push(_data, ['总压欠压-1级告警值V', 'S_UV_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
532
+ push(_data, ['总压欠压-1级告警延时mS', 'S_UV_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
533
+ push(_data, ['总压欠压-1级恢复V', 'S_UV_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
534
+ push(_data, ['总压欠压-1级恢复延时S', 'S_UV_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
535
+
536
+ push(_data, ['总压欠压-2级告警值V', 'S_UV_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
537
+ push(_data, ['总压欠压-2级告警延时mS', 'S_UV_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
538
+ push(_data, ['总压欠压-2级恢复V', 'S_UV_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
539
+ push(_data, ['总压欠压-2级恢复延时S', 'S_UV_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
540
+
541
+ push(_data, ['总压欠压-3级保护值V', 'S_UV_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
542
+ push(_data, ['总压欠压-3级保护延时mS', 'S_UV_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
543
+ push(_data, ['总压欠压-3级恢复V', 'S_UV_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
544
+ push(_data, ['总压欠压-3级恢复延时S', 'S_UV_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
545
+
546
+ let res = {};
547
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
548
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
549
+ }
550
+ // #region 解析HVES 告警与保护参数(压差过大)
551
+ /** 解析HVES 告警与保护参数(压差过大) 0x78 1860 1878 */
552
+ // 解析告警与保护参数(压差过大)- 0x78 1860 1878
553
+ export const resolveHVESOvrInfo = (data) => {
554
+ if (!data) return null;
555
+ const dataStr = hexArr2string(data);
556
+ const header = dataStr.slice(0, 8 * 2);
557
+
558
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
559
+ let i = 0;
560
+ let _data = [];
561
+ const _ = this;
562
+
563
+ push(_data, ['压差过大-1级告警值mV', 'OVR_alarmV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
564
+ push(_data, ['压差过大-1级告警延时mS', 'OVR_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
565
+ push(_data, ['压差过大-1级恢复mV', 'OVR_recoverV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
566
+ push(_data, ['压差过大-1级恢复延时S', 'OVR_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
567
+
568
+ push(_data, ['压差过大-2级告警值mV', 'OVR_alarmV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
569
+ push(_data, ['压差过大-2级告警延时mS', 'OVR_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
570
+ push(_data, ['压差过大-2级恢复mV', 'OVR_recoverV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
571
+ push(_data, ['压差过大-2级恢复延时S', 'OVR_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
572
+
573
+ push(_data, ['压差过大-3级保护值mV', 'OVR_protectionV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
574
+ push(_data, ['压差过大-3级保护延时mS', 'OVR_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
575
+ push(_data, ['压差过大-3级恢复mV', 'OVR_recoverV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
576
+ push(_data, ['压差过大-3级恢复延时S', 'OVR_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
577
+
578
+ let res = {};
579
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
580
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
581
+ }
582
+ // #region 解析HVES 告警与保护参数(充电过流-放电过流)
583
+ /** 解析HVES 告警与保护参数(充电过流-放电过流) 0x78 1878 18a8 */
584
+ // 解析告警与保护参数(充电过流-放电过流)- 0x78 1878 18a8
585
+ export const resolveHVESOeInfo = (data) => {
586
+ if (!data) return null;
587
+ const dataStr = hexArr2string(data);
588
+ const header = dataStr.slice(0, 8 * 2);
589
+
590
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
591
+ let i = 0;
592
+ let _data = [];
593
+ const _ = this;
594
+
595
+ // 充电过流
596
+ push(_data, ['充电过流-1级告警值A', 'C_OE_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
597
+ push(_data, ['充电过流-1级告警延时mS', 'C_OE_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
598
+ push(_data, ['充电过流-1级恢复值A', 'C_OE_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
599
+ push(_data, ['充电过流-1级恢复延时S', 'C_OE_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
600
+
601
+ push(_data, ['充电过流-2级告警值A', 'C_OE_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
602
+ push(_data, ['充电过流-2级告警延时mS', 'C_OE_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
603
+ push(_data, ['充电过流-2级恢复值A', 'C_OE_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
604
+ push(_data, ['充电过流-2级恢复延时S', 'C_OE_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
605
+
606
+ push(_data, ['充电过流-3级保护值A', 'C_OE_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
607
+ push(_data, ['充电过流-3级保护延时mS', 'C_OE_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
608
+ push(_data, ['充电过流-3级恢复值A', 'C_OE_recoverV_l3', format, c.slice(i, (i += 2)), 1, 0, 1]);
609
+ push(_data, ['充电过流-3级恢复延时S', 'C_OE_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
610
+
611
+ // 放电过流
612
+ push(_data, ['放电过流-1级告警值A', 'Dis_C_OE_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
613
+ push(_data, ['放电过流-1级告警延时mS', 'Dis_C_OE_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
614
+ push(_data, ['放电过流-1级恢复值A', 'Dis_C_OE_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
615
+ push(_data, ['放电过流-1级恢复延时S', 'Dis_C_OE_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
616
+
617
+ push(_data, ['放电过流-2级告警值A', 'Dis_C_OE_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
618
+ push(_data, ['放电过流-2级告警延时mS', 'Dis_C_OE_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
619
+ push(_data, ['放电过流-2级恢复值A', 'Dis_C_OE_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
620
+ push(_data, ['放电过流-2级恢复延时S', 'Dis_C_OE_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
621
+
622
+ push(_data, ['放电过流-3级保护值A', 'Dis_C_OE_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
623
+ push(_data, ['放电过流-3级保护延时mS', 'Dis_C_OE_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
624
+ push(_data, ['放电过流-3级恢复值A', 'Dis_C_OE_recoverV_l3', format, c.slice(i, (i += 2)), 1, 0, 1]);
625
+ push(_data, ['放电过流-3级恢复延时S', 'Dis_C_OE_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
626
+
627
+ let res = {};
628
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
629
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
630
+ }
631
+ // #region 解析HVES 告警与保护参数(充电高温-充电低温)
632
+ /** 解析HVES 告警与保护参数(充电高温-充电低温) 0x78 18a8 18d8 */
633
+ // 解析告警与保护参数(充电高温-充电低温)- 0x78 18a8 18d8
634
+ export const resolveHVESCtInfo = (data) => {
635
+ if (!data) return null;
636
+ const dataStr = hexArr2string(data);
637
+ const header = dataStr.slice(0, 8 * 2);
638
+
639
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
640
+ let i = 0;
641
+ let _data = [];
642
+ const _ = this;
643
+
644
+ // 充电高温
645
+ push(_data, ['充电高温-1级告警值℃', 'C_HT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
646
+ push(_data, ['充电高温-1级告警延时mS', 'C_HT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
647
+ push(_data, ['充电高温-1级恢复值℃', 'C_HT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
648
+ push(_data, ['充电高温-1级恢复延时S', 'C_HT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
649
+
650
+ push(_data, ['充电高温-2级告警值℃', 'C_HT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
651
+ push(_data, ['充电高温-2级告警延时mS', 'C_HT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
652
+ push(_data, ['充电高温-2级恢复值℃', 'C_HT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
653
+ push(_data, ['充电高温-2级恢复延时S', 'C_HT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
654
+
655
+ push(_data, ['充电高温-3级保护值℃', 'C_HT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
656
+ push(_data, ['充电高温-3级保护延时mS', 'C_HT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
657
+ push(_data, ['充电高温-3级恢复值℃', 'C_HT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
658
+ push(_data, ['充电高温-3级恢复延时S', 'C_HT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
659
+
660
+ // 充电低温
661
+ push(_data, ['充电低温-1级告警值℃', 'C_LT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
662
+ push(_data, ['充电低温-1级告警延时mS', 'C_LT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
663
+ push(_data, ['充电低温-1级恢复值℃', 'C_LT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
664
+ push(_data, ['充电低温-1级恢复延时S', 'C_LT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
665
+
666
+ push(_data, ['充电低温-2级告警值℃', 'C_LT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
667
+ push(_data, ['充电低温-2级告警延时mS', 'C_LT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
668
+ push(_data, ['充电低温-2级恢复值℃', 'C_LT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
669
+ push(_data, ['充电低温-2级恢复延时S', 'C_LT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
670
+
671
+ push(_data, ['充电低温-3级保护值℃', 'C_LT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
672
+ push(_data, ['充电低温-3级保护延时mS', 'C_LT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
673
+ push(_data, ['充电低温-3级恢复值℃', 'C_LT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
674
+ push(_data, ['充电低温-3级恢复延时S', 'C_LT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
675
+
676
+ let res = {};
677
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
678
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
679
+ }
680
+ // #region 解析HVES 告警与保护参数(放电高温-放电低温)
681
+ /** 解析HVES 告警与保护参数(放电高温-放电低温) 0x78 18d8 1908 */
682
+ // 解析告警与保护参数(放电高温-放电低温)- 0x78 18d8 1908
683
+ export const resolveHVESDisCtInfo = (data) => {
684
+ if (!data) return null;
685
+ const dataStr = hexArr2string(data);
686
+ const header = dataStr.slice(0, 8 * 2);
687
+
688
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
689
+ let i = 0;
690
+ let _data = [];
691
+ const _ = this;
692
+
693
+ // 放电高温
694
+ push(_data, ['放电高温-1级告警值℃', 'Dis_C_HT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
695
+ push(_data, ['放电高温-1级告警延时mS', 'Dis_C_HT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
696
+ push(_data, ['放电高温-1级恢复值℃', 'Dis_C_HT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
697
+ push(_data, ['放电高温-1级恢复延时S', 'Dis_C_HT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
698
+
699
+ push(_data, ['放电高温-2级告警值℃', 'Dis_C_HT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
700
+ push(_data, ['放电高温-2级告警延时mS', 'Dis_C_HT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
701
+ push(_data, ['放电高温-2级恢复值℃', 'Dis_C_HT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
702
+ push(_data, ['放电高温-2级恢复延时S', 'Dis_C_HT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
703
+
704
+ push(_data, ['放电高温-3级保护值℃', 'Dis_C_HT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
705
+ push(_data, ['放电高温-3级保护延时mS', 'Dis_C_HT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
706
+ push(_data, ['放电高温-3级恢复值℃', 'Dis_C_HT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
707
+ push(_data, ['放电高温-3级恢复延时S', 'Dis_C_HT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
708
+
709
+ // 放电低温
710
+ push(_data, ['放电低温-1级告警值℃', 'Dis_C_LT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
711
+ push(_data, ['放电低温-1级告警延时mS', 'Dis_C_LT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
712
+ push(_data, ['放电低温-1级恢复值℃', 'Dis_C_LT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
713
+ push(_data, ['放电低温-1级恢复延时S', 'Dis_C_LT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
714
+
715
+ push(_data, ['放电低温-2级告警值℃', 'Dis_C_LT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
716
+ push(_data, ['放电低温-2级告警延时mS', 'Dis_C_LT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
717
+ push(_data, ['放电低温-2级恢复值℃', 'Dis_C_LT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
718
+ push(_data, ['放电低温-2级恢复延时S', 'Dis_C_LT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
719
+
720
+ push(_data, ['放电低温-3级保护值℃', 'Dis_C_LT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
721
+ push(_data, ['放电低温-3级保护延时mS', 'Dis_C_LT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
722
+ push(_data, ['放电低温-3级恢复值℃', 'Dis_C_LT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
723
+ push(_data, ['放电低温-3级恢复延时S', 'Dis_C_LT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
724
+
725
+ let res = {};
726
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
727
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
728
+ }
729
+ // #region 解析HVES 告警与保护参数(环境高温-环境低温)
730
+ /** 解析HVES 告警与保护参数(环境高温-环境低温) 0x78 1908 1938 */
731
+ // 解析告警与保护参数(环境高温-环境低温)- 0x78 1908 1938
732
+ export const resolveHVESEtInfo = (data) => {
733
+ if (!data) return null;
734
+ const dataStr = hexArr2string(data);
735
+ const header = dataStr.slice(0, 8 * 2);
736
+
737
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
738
+ let i = 0;
739
+ let _data = [];
740
+ const _ = this;
741
+
742
+ // 环境高温
743
+ push(_data, ['环境高温-1级告警值℃', 'E_HT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
744
+ push(_data, ['环境高温-1级告警延时mS', 'E_HT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
745
+ push(_data, ['环境高温-1级恢复值℃', 'E_HT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
746
+ push(_data, ['环境高温-1级恢复延时S', 'E_HT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
747
+
748
+ push(_data, ['环境高温-2级告警值℃', 'E_HT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
749
+ push(_data, ['环境高温-2级告警延时mS', 'E_HT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
750
+ push(_data, ['环境高温-2级恢复值℃', 'E_HT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
751
+ push(_data, ['环境高温-2级恢复延时S', 'E_HT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
752
+
753
+ push(_data, ['环境高温-3级保护值℃', 'E_HT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
754
+ push(_data, ['环境高温-3级保护延时mS', 'E_HT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
755
+ push(_data, ['环境高温-3级恢复值℃', 'E_HT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
756
+ push(_data, ['环境高温-3级恢复延时S', 'E_HT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
757
+
758
+ // 环境低温
759
+ push(_data, ['环境低温-1级告警值℃', 'E_LT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
760
+ push(_data, ['环境低温-1级告警延时mS', 'E_LT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
761
+ push(_data, ['环境低温-1级恢复值℃', 'E_LT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
762
+ push(_data, ['环境低温-1级恢复延时S', 'E_LT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
763
+
764
+ push(_data, ['环境低温-2级告警值℃', 'E_LT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
765
+ push(_data, ['环境低温-2级告警延时mS', 'E_LT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
766
+ push(_data, ['环境低温-2级恢复值℃', 'E_LT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
767
+ push(_data, ['环境低温-2级恢复延时S', 'E_LT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
768
+
769
+ push(_data, ['环境低温-3级保护值℃', 'E_LT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
770
+ push(_data, ['环境低温-3级保护延时mS', 'E_LT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
771
+ push(_data, ['环境低温-3级恢复值℃', 'E_LT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
772
+ push(_data, ['环境低温-3级恢复延时S', 'E_LT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
773
+
774
+ let res = {};
775
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
776
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
777
+ }
778
+ // #region 解析HVES 告警与保护参数(温差过大)
779
+ /** 解析HVES 告警与保护参数(温差过大) 0x78 1938 1950 */
780
+ // 解析告警与保护参数(温差过大)- 0x78 1938 1950
781
+ export const resolveHVESOtrInfo = (data) => {
782
+ if (!data) return null;
783
+ const dataStr = hexArr2string(data);
784
+ const header = dataStr.slice(0, 8 * 2);
785
+
786
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
787
+ let i = 0;
788
+ let _data = [];
789
+ const _ = this;
790
+
791
+ push(_data, ['温差过大-1级告警值℃', 'OTR_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
792
+ push(_data, ['温差过大-1级告警延时mS', 'OTR_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
793
+ push(_data, ['温差过大-1级恢复℃', 'OTR_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
794
+ push(_data, ['温差过大-1级恢复延时S', 'OTR_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
795
+
796
+ push(_data, ['温差过大-2级告警值℃', 'OTR_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
797
+ push(_data, ['温差过大-2级告警延时mS', 'OTR_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
798
+ push(_data, ['温差过大-2级恢复℃', 'OTR_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
799
+ push(_data, ['温差过大-2级恢复延时S', 'OTR_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
800
+
801
+ push(_data, ['温差过大-3级保护值℃', 'OTR_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
802
+ push(_data, ['温差过大-3级保护延时mS', 'OTR_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
803
+ push(_data, ['温差过大-3级恢复℃', 'OTR_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
804
+ push(_data, ['温差过大-3级恢复延时S', 'OTR_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
805
+
806
+ let res = {};
807
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
808
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
809
+ }
810
+ // #region 解析HVES 告警与保护参数(温升过高)
811
+ /** 解析HVES 告警与保护参数(温升过高) 0x78 1950 1968 */
812
+ // 解析告警与保护参数(温升过高)- 0x78 1950 1968
813
+ export const resolveHVESOtRisingInfo = (data) => {
814
+ if (!data) return null;
815
+ const dataStr = hexArr2string(data);
816
+ const header = dataStr.slice(0, 8 * 2);
817
+
818
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
819
+ let i = 0;
820
+ let _data = [];
821
+ const _ = this;
822
+
823
+ push(_data, ['温升过高-1级告警值℃', 'OTRising_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
824
+ push(_data, ['温升过高-1级告警延时mS', 'OTRising_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
825
+ push(_data, ['温升过高-1级恢复℃', 'OTRising_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
826
+ push(_data, ['温升过高-1级恢复延时S', 'OTRising_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
827
+
828
+ push(_data, ['温升过高-2级告警值℃', 'OTRising_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
829
+ push(_data, ['温升过高-2级告警延时mS', 'OTRising_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
830
+ push(_data, ['温升过高-2级恢复℃', 'OTRising_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
831
+ push(_data, ['温升过高-2级恢复延时S', 'OTRising_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
832
+
833
+ push(_data, ['温升过高-3级保护值℃', 'OTRising_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
834
+ push(_data, ['温升过高-3级保护延时mS', 'OTRising_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
835
+ push(_data, ['温升过高-3级恢复℃', 'OTRising_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
836
+ push(_data, ['温升过高-3级恢复延时S', 'OTRising_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
837
+
838
+ let res = {};
839
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
840
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
841
+ }
842
+ // #region 解析HVES 告警与保护参数(极柱高温)
843
+ /** 解析HVES 告警与保护参数(极柱高温) 0x78 1968 1980 */
844
+ // 解析告警与保护参数(极柱高温)- 0x78 1968 1980
845
+ export const resolveHVESElectrodeHTInfo = (data) => {
846
+ if (!data) return null;
847
+ const dataStr = hexArr2string(data);
848
+ const header = dataStr.slice(0, 8 * 2);
849
+
850
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
851
+ let i = 0;
852
+ let _data = [];
853
+ const _ = this;
854
+
855
+ push(_data, ['极柱高温-1级告警值℃', 'Electrode_HT_alarmV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
856
+ push(_data, ['极柱高温-1级告警延时mS', 'Electrode_HT_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
857
+ push(_data, ['极柱高温-1级恢复值℃', 'Electrode_HT_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
858
+ push(_data, ['极柱高温-1级恢复延时S', 'Electrode_HT_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
859
+
860
+ push(_data, ['极柱高温-2级告警值℃', 'Electrode_HT_alarmV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
861
+ push(_data, ['极柱高温-2级告警延时mS', 'Electrode_HT_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
862
+ push(_data, ['极柱高温-2级恢复值℃', 'Electrode_HT_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
863
+ push(_data, ['极柱高温-2级恢复延时S', 'Electrode_HT_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
864
+
865
+ push(_data, ['极柱高温-3级保护值℃', 'Electrode_HT_protectionV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
866
+ push(_data, ['极柱高温-3级保护延时mS', 'Electrode_HT_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
867
+ push(_data, ['极柱高温-3级恢复值℃', 'Electrode_HT_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
868
+ push(_data, ['极柱高温-3级恢复延时S', 'Electrode_HT_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
869
+
870
+ let res = {};
871
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
872
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
873
+ }
874
+ // #region 解析HVES 告警与保护参数(绝缘电阻过低)
875
+ /** 解析HVES 告警与保护参数(绝缘电阻过低) 0x78 1980 1998 */
876
+ // 解析告警与保护参数(绝缘电阻过低)- 0x78 1980 1998
877
+ export const resolveHVESInsulationLRInfo = (data) => {
878
+ if (!data) return null;
879
+ const dataStr = hexArr2string(data);
880
+ const header = dataStr.slice(0, 8 * 2);
881
+
882
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
883
+ let i = 0;
884
+ let _data = [];
885
+ const _ = this;
886
+
887
+ push(_data, ['绝缘过低-1级告警值KΩ', 'Insulation_LR_alarmV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
888
+ push(_data, ['绝缘过低-1级告警延时mS', 'Insulation_LR_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
889
+ push(_data, ['绝缘过低-1级恢复值KΩ', 'Insulation_LR_recoverV_l1', format, c.slice(i, (i += 2)), 0.1, 0, 0]);
890
+ push(_data, ['绝缘过低-1级恢复延时S', 'Insulation_LR_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
891
+
892
+ push(_data, ['绝缘过低-2级告警值KΩ', 'Insulation_LR_alarmV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
893
+ push(_data, ['绝缘过低-2级告警延时mS', 'Insulation_LR_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
894
+ push(_data, ['绝缘过低-2级恢复值KΩ', 'Insulation_LR_recoverV_l2', format, c.slice(i, (i += 2)), 0.1, 0, 0]);
895
+ push(_data, ['绝缘过低-2级恢复延时S', 'Insulation_LR_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
896
+
897
+ push(_data, ['绝缘过低-3级保护值KΩ', 'Insulation_LR_protectionV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
898
+ push(_data, ['绝缘过低-3级保护延时mS', 'Insulation_LR_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
899
+ push(_data, ['绝缘过低-3级恢复值KΩ', 'Insulation_LR_recoverV_l3', format, c.slice(i, (i += 2)), 0.1, 0, 0]);
900
+ push(_data, ['绝缘过低-3级恢复延时S', 'Insulation_LR_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
901
+
902
+ let res = {};
903
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
904
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
905
+ }
906
+ // #region 解析HVES 告警与保护参数(SOC过低)
907
+ /** 解析HVES 告警与保护参数(SOC过低) 0x78 1998 19b0 */
908
+ // 解析告警与保护参数(SOC过低)- 0x78 1998 19b0
909
+ export const resolveHVESLSocInfo = (data) => {
910
+ if (!data) return null;
911
+ const dataStr = hexArr2string(data);
912
+ const header = dataStr.slice(0, 8 * 2);
913
+
914
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
915
+ let i = 0;
916
+ let _data = [];
917
+ const _ = this;
918
+
919
+ push(_data, ['SOC过低-1级告警值%', 'L_SOC_alarmV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
920
+ push(_data, ['SOC过低-1级告警延时mS', 'L_SOC_alarmD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
921
+ push(_data, ['SOC过低-1级恢复值%', 'L_SOC_recoverV_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
922
+ push(_data, ['SOC过低-1级恢复延时S', 'L_SOC_recoverD_l1', format, c.slice(i, (i += 2)), 1, 0, 0]);
923
+
924
+ push(_data, ['SOC过低-2级告警值%', 'L_SOC_alarmV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
925
+ push(_data, ['SOC过低-2级告警延时mS', 'L_SOC_alarmD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
926
+ push(_data, ['SOC过低-2级恢复值%', 'L_SOC_recoverV_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
927
+ push(_data, ['SOC过低-2级恢复延时S', 'L_SOC_recoverD_l2', format, c.slice(i, (i += 2)), 1, 0, 0]);
928
+
929
+ push(_data, ['SOC过低-3级保护值%', 'L_SOC_protectionV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
930
+ push(_data, ['SOC过低-3级保护延时mS', 'L_SOC_protectionD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
931
+ push(_data, ['SOC过低-3级恢复值%', 'L_SOC_recoverV_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
932
+ push(_data, ['SOC过低-3级恢复延时S', 'L_SOC_recoverD_l3', format, c.slice(i, (i += 2)), 1, 0, 0]);
933
+
934
+ let res = {};
935
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
936
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
937
+ }
938
+ // #region 解析HVES PACK参数
939
+ /** 解析HVES PACK参数 0x78 1c00 1c90 */
940
+ // PACK参数- 0x78 1c00 1c90
941
+ export const resolveHVESPackInfo = (data) => {
942
+ if (!data) return null;
943
+ const dataStr = hexArr2string(data);
944
+ const header = dataStr.slice(0, 8 * 2);
945
+
946
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
947
+ let i = 0;
948
+ let _data = [];
949
+ const _ = this;
950
+
951
+ push(_data, ['电池类型-0铁锂1三元', 'batteryType', format, c.slice(i, (i += 2)), 1, 0, 0]);
952
+ push(_data, ['电池厂家', 'batteryFactory', format, c.slice(i, (i += 2)), 1, 0, 0]);
953
+ push(_data, ['均衡开启电压', 'equilizationOpenedVoltage', format, c.slice(i, (i += 2)), 1, 0, 0]);
954
+ push(_data, ['均衡开启压差', 'equilibriumOpenedVoltageDeviation', format, c.slice(i, (i += 2)), 1, 0, 0]);
955
+ push(_data, ['加热开启温度-℃', 'hotOpenedTemperature', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
956
+ push(_data, ['加热关闭温度-℃', 'hotClosedTemperature', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
957
+ push(_data, ['满充校准电压-V', 'fullyChargedCalibrationVoltage', format, c.slice(i, (i += 2)), 0.01, 0, 1]);
958
+ push(_data, ['满充校准电流-mA', 'fullyChargedCalibrationElectricity', format, c.slice(i, (i += 2)), 1, 0, 0]);
959
+
960
+ push(_data, ['BMS条码', 'bmsBarcode', hex2Ascii, c.slice(i, (i += 30)), 1, 0, 0]);
961
+ const y = push(_data, ['BMS生产日期-年', 'bmsProductionDate_Year', format, c.slice(i, (i += 2)), 1, 0, 0]);
962
+ const m = push(_data, ['BMS生产日期-月', 'bmsProductionDate_Month', format, c.slice(i, (i += 2)), 1, 0, 0]);
963
+ const d = push(_data, ['BMS生产日期-日', 'bmsProductionDate_Day', format, c.slice(i, (i += 2)), 1, 0, 0]);
964
+ // push(_data, [`BMS生产日期`, `bmsProductionDate`, undefined, [y, m, d].join('-'), undefined, undefined, undefined]);
965
+
966
+ push(_data, ['SN条码', 'snBarcode', hex2Ascii, c.slice(i, (i += 30)), 1, 0, 0]);
967
+ const _y = push(_data, ['PACK生产日期-年', 'packProductionDate_Year', format, c.slice(i, (i += 2)), 1, 0, 0]);
968
+ const _m = push(_data, ['PACK生产日期-月', 'packProductionDate_Month', format, c.slice(i, (i += 2)), 1, 0, 0]);
969
+ const _d = push(_data, ['PACK生产日期-日', 'packProductionDate_Day', format, c.slice(i, (i += 2)), 1, 0, 0]);
970
+ // push(_data, [`PACK生产日期`, `packProductionDate`, undefined, [_y, _m, _d].join('-'), undefined, undefined, undefined]);
971
+
972
+ push(_data, ['厂家代号', 'factoryCode', hex2Ascii, c.slice(i, (i += 30)), 1, 0, 0]);
973
+
974
+ push(_data, ['CAN协议', 'can', format, c.slice(i, (i += 2)), 1, 0, 0]);
975
+ push(_data, ['待机休眠电压-mV', 'standbySleepVoltage', format, c.slice(i, (i += 2)), 1, 0, 0]);
976
+ push(_data, ['待机休眠延时-min', 'standbySleepDelay', format, c.slice(i, (i += 2)), 1, 0, 0]);
977
+ push(_data, ['均衡模式0充电均衡1静态与充电均衡', 'equilibriumMode', format, c.slice(i, (i += 2)), 1, 0, 0]);
978
+ push(_data, ['RS485协议', 'rs485', format, c.slice(i, (i += 2)), 1, 0, 0]);
979
+ push(_data, ['CAN波特率设置', 'canTeport', format, c.slice(i, (i += 2)), 1, 0, 0]);
980
+ push(_data, ['RS485波特率设置', 'rs385Teport', format, c.slice(i, (i += 2)), 1, 0, 0]);
981
+ push(_data, ['传感器类型', 'sensorType', format, c.slice(i, (i += 2)), 1, 0, 0]);
982
+ const [Insulation, Electrode] = push(_data, ['开关设置', 'switcher', formatBools, c.slice(i, (i += 2)), 1, 0, undefined, 2]);
983
+
984
+ push(_data, [`绝缘检测`, `Insulation`, undefined, Insulation, undefined, undefined, undefined]);
985
+ push(_data, [`极柱高温`, `Electrode`, undefined, Electrode, undefined, undefined, undefined]);
986
+
987
+ push(_data, ['预充延时mS', 'pre_c_D', format, c.slice(i, (i += 2)), 1, 0, 0]);
988
+ push(_data, ['分流器-电压系数mV', 'K_v', format, c.slice(i, (i += 2)), 1, 0, 0]);
989
+ push(_data, ['分流器-电流系数A', 'K_e', format, c.slice(i, (i += 2)), 1, 0, 1]);
990
+ push(_data, ['OCV校准命令', 'ovc', format, c.slice(i, (i += 2)), 1, 0, 0]);
991
+
992
+ let res = {};
993
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
994
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
995
+ }
996
+
997
+ // #region 解析HVES校准信息
998
+ /** 解析HVES校准信息 0x78 2000 2032 */
999
+ // 校准信息(容量参数 & SOP参数)- 0x78 2000 2032
1000
+ export const resolveHVESCalibrationInfo = (data) => {
1001
+ if (!data) return null;
1002
+ const dataStr = hexArr2string(data);
1003
+ const header = dataStr.slice(0, 8 * 2);
1004
+
1005
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
1006
+ let i = 0;
1007
+ let _data = [];
1008
+ const _ = this;
1009
+
1010
+ push(_data, ['标称容量AH', 'n_C', format, c.slice(i, (i += 2)), 0.01, 0, 2]);
1011
+ push(_data, ['满充容量AH', 'f_C', format, c.slice(i, (i += 2)), 0.01, 0, 2]);
1012
+ push(_data, ['剩余容量AH', 'r_C', format, c.slice(i, (i += 2)), 0.01, 0, 2]);
1013
+ push(_data, ['SOC%', 'soc', format, c.slice(i, (i += 2)), 0.01, 0, 2]);
1014
+ push(_data, ['SOH%', 'soh', format, c.slice(i, (i += 2)), 1, 0, 0]);
1015
+ push(_data, ['循环次数', 'cycleNo', format, c.slice(i, (i += 2)), 1, 0, 0]);
1016
+ push(_data, ['循环衰减系数(衰减1%循环次数)', 'cycleReduceRate', format, c.slice(i, (i += 2)), 1, 0, 0]);
1017
+ push(_data, ['循环系数%', 'cycleRate', format, c.slice(i, (i += 2)), 1, 0, 0]);
1018
+ push(_data, ['累计充电AH', 'cum_charge', format, c.slice(i, (i += 4)), 0.1, 0, 0]);
1019
+ push(_data, ['累计放电AH', 'cum_discharge', format, c.slice(i, (i += 4)), 0.1, 0, 0]);
1020
+ push(_data, ['电池自功耗系数(多少天1%)', 'self_power_rate', format, c.slice(i, (i += 2)), 1, 0, 0]);
1021
+
1022
+ push(_data, ['OCV校准电压1', 'ocv_v1', format, c.slice(i, (i += 2)), 1, 0, 0]);
1023
+ push(_data, ['OCV校准soc1%', 'ocv_soc1', format, c.slice(i, (i += 2)), 1, 0, 0]);
1024
+ push(_data, ['OCV校准电压2', 'ocv_v2', format, c.slice(i, (i += 2)), 1, 0, 0]);
1025
+ push(_data, ['OCV校准soc2%', 'ocv_soc2', format, c.slice(i, (i += 2)), 1, 0, 0]);
1026
+ push(_data, ['OCV校准电压3', 'ocv_v3', format, c.slice(i, (i += 2)), 1, 0, 0]);
1027
+ push(_data, ['OCV校准soc3%', 'ocv_soc3', format, c.slice(i, (i += 2)), 1, 0, 0]);
1028
+ push(_data, ['OCV校准电压4', 'ocv_v4', format, c.slice(i, (i += 2)), 1, 0, 0]);
1029
+ push(_data, ['OCV校准soc4%', 'ocv_soc4', format, c.slice(i, (i += 2)), 1, 0, 0]);
1030
+
1031
+ push(_data, ['充电需求电压V', 'c_DV', format, c.slice(i, (i += 2)), 0.1, 0, 2]);
1032
+ push(_data, ['充电需求电流A', 'c_DA', format, c.slice(i, (i += 2)), 0.1, 0, 2]);
1033
+ push(_data, ['放电需求电压V', 'dis_c_DV', format, c.slice(i, (i += 2)), 0.1, 0, 2]);
1034
+ push(_data, ['放电需求电流A', 'dis_c_DA', format, c.slice(i, (i += 2)), 0.1, 0, 2]);
1035
+
1036
+ let res = {};
1037
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
1038
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
1039
+ }
1040
+ // #region 解析HVES校准系数模块配置
1041
+ /** 解析HVES校准系数模块配置 0x78 2200 220a */
1042
+ // 校准系数-模块配置- 0x78 2200 220a
1043
+ export const resolveHVESCalibrationConfigInfo = (data) => {
1044
+ if (!data) return null;
1045
+ const dataStr = hexArr2string(data);
1046
+ const header = dataStr.slice(0, 8 * 2);
1047
+
1048
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
1049
+ let i = 0;
1050
+ let _data = [];
1051
+ const _ = this;
1052
+
1053
+ push(_data, ['BMU个数', 'bmu_num', format, c.slice(i, (i += 2)), 1, 0, 0]);
1054
+ push(_data, ['单体个数', 'cell_num', format, c.slice(i, (i += 2)), 1, 0, 0]);
1055
+ push(_data, ['温控个数', 'temp_num', format, c.slice(i, (i += 2)), 1, 0, 0]);
1056
+ const mono_invalid_locations = push(_data, ['单体无效位置', 'mono_invalid_locations', formatBools, c.slice(i, (i += 4)), 1, 0, undefined, 32]);
1057
+
1058
+ let arr = [];
1059
+ mono_invalid_locations.forEach((_, i) => _ && arr.push(`B${i + 1}`));
1060
+ push(_data, [`单体无效位置`, `mono_invalid_location`, undefined, arr.join(', '), undefined, undefined, undefined]);
1061
+
1062
+ let res = {};
1063
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
1064
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
1065
+ }
1066
+ // #region 解析HVES校准系数C1
1067
+ /** 解析HVES校准系数 0x78 2156 216c */
1068
+ // 校准系数- 0x78 2156 216c
1069
+ export const resolveHVESCalibrationC1Info = (data) => {
1070
+ if (!data) return null;
1071
+ const dataStr = hexArr2string(data);
1072
+ const header = dataStr.slice(0, 8 * 2);
1073
+
1074
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
1075
+ let i = 0;
1076
+ let _data = [];
1077
+ const _ = this;
1078
+
1079
+ push(_data, ['零点校准值A', 'c_0', format, c.slice(i, (i += 2)), 0.1, -3000, 0]);
1080
+
1081
+ push(_data, ['充电电流校准系数K', 'c_v_K', format, c.slice(i, (i += 2)), 1, 0, 0]);
1082
+ push(_data, ['充电电流校准系数B', 'c_v_B', format, c.slice(i, (i += 2)), 0.1, -100, 0]);
1083
+ push(_data, ['放电电流校准系数K', 'dis_c_v_K', format, c.slice(i, (i += 2)), 1, 0, 0]);
1084
+ push(_data, ['放电电流校准系数B', 'dis_c_v_B', format, c.slice(i, (i += 2)), 0.1, -100, 0]);
1085
+
1086
+ push(_data, ['总压校准系数K', 's_v_K', format, c.slice(i, (i += 2)), 1, 0, 0]);
1087
+ push(_data, ['总压校准系数B', 's_v_B', format, c.slice(i, (i += 2)), 0.1, -100, 0]);
1088
+
1089
+ push(_data, ['回踩电压1校准K', 'h_v1_K', format, c.slice(i, (i += 2)), 1, 0, 0]);
1090
+ push(_data, ['回踩电压1校准B', 'h_v1_B', format, c.slice(i, (i += 2)), 0.1, -100, 0]);
1091
+ push(_data, ['回踩电压2校准K', 'h_v2_K', format, c.slice(i, (i += 2)), 1, 0, 0]);
1092
+ push(_data, ['回踩电压2校准B', 'h_v2_B', format, c.slice(i, (i += 2)), 0.1, -100, 0]);
1093
+
1094
+ let res = {};
1095
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
1096
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
1097
+ }
1098
+ // #region 解析HVES校准系数C2
1099
+ /** 解析HVES校准系数 0x78 2200 2232 */
1100
+ // 校准系数- 0x78 2200 2232
1101
+ export const resolveHVESCalibrationC2Info = (data) => {
1102
+ if (!data) return null;
1103
+ const dataStr = hexArr2string(data);
1104
+ const header = dataStr.slice(0, 8 * 2);
1105
+
1106
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
1107
+ let i = 0;
1108
+ let _data = [];
1109
+ const _ = this;
1110
+
1111
+ push(_data, ['BMU个数', 'bmu_num', format, c.slice(i, (i += 2)), 1, 0, 0]);
1112
+ push(_data, ['单体个数', 'cell_num', format, c.slice(i, (i += 2)), 1, 0, 0]);
1113
+ push(_data, ['温度个数', 'temp_num', format, c.slice(i, (i += 2)), 1, 0, 0]);
1114
+ push(_data, ['单体无效位置', 'mono_invalid_location', format, c.slice(i, (i += 4)), 1, 0, 0]);
1115
+ push(_data, ['配置使能', 'enabler_conf', format, c.slice(i, (i += 2)), 1, 0, 0]);
1116
+
1117
+ let bmus = [];
1118
+ [...Array(32)].forEach((__, i) => {
1119
+ let arr = [];
1120
+ const j = i + 1;
1121
+ push(arr, [`BMU${j}单体个数`, `bmu${j}_cell_num`, format, c.slice(i, (i += 2)), 1, 0, 0]);
1122
+ push(arr, [`BMU${j}温度个数`, `bmu${j}}_temp_num`, format, c.slice(i, (i += 2)), 1, -3000, 0]);
1123
+ push(arr, [`BMU${j}无效位置`, `bmu${j}}_mono_invalid_location`, format, c.slice(i, (i += 2)), 1, 0, 0]);
1124
+
1125
+ bmus.push(arr);
1126
+ });
1127
+ push(_data, [`BMUs`, `bmus`, undefined, bmus, undefined, undefined, undefined]);
1128
+
1129
+ let res = {};
1130
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
1131
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
1132
+ }
1133
+ // #region 解析HVES版本信息
1134
+ /** 解析HVES版本信息 */
1135
+ // 版本信息- 0x78 2810 282c
1136
+ export const resolveHVESVersionInfo = (data) => {
1137
+ if (!data) return null;
1138
+ const dataStr = hexArr2string(data);
1139
+ const header = dataStr.slice(0, 8 * 2);
1140
+
1141
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
1142
+ let i = 0;
1143
+ let _data = [];
1144
+ const _ = this;
1145
+
1146
+ push(_data, ['BOOT版本', 'bootV', format, c.slice(i, (i += 2)), 1, 0, 0]);
1147
+ push(_data, ['硬件版本', 'hardwareV', format, c.slice(i, (i += 2)), 1, 0, 0]);
1148
+ push(_data, ['APP主版本', 'app_v_major', format, c.slice(i, (i += 2)), 1, 0, 0]);
1149
+ push(_data, ['APP次版本', 'app_v_minor', format, c.slice(i, (i += 2)), 1, 0, 0]);
1150
+ push(_data, ['测试版本', 'test_v', format, c.slice(i, (i += 2)), 1, 0, 0]);
1151
+ push(_data, ['协议版本', 'protocolV', format, c.slice(i, (i += 2)), 1, 0, 0]);
1152
+ push(_data, ['硬件名称', 'hardwareName', formatAssicString, c.slice(i, (i += 16)), 1, 0, 0]);
1153
+ push(_data, ['项目名称', 'projectName', formatAssicString, c.slice(i, (i += 16)), 1, 0, 0]);
1154
+
1155
+ let res = {};
1156
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
1157
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
1158
+ }
1159
+
1160
+ // BMU数据 0x78 5000(5200) 5200(5400)
1161
+ export const resolveHVESBMUInfo = (data) => {
1162
+ // 017850005200004c0cf50cdd0000007802f602ef0000000000000000000000000000000000100cf00cef0cf50cea0cee0cea0ceb0ce80cdd0ce30ced0cea0cf50cf50cf00cf3000602f502f102f002f602f202efcef5
1163
+ // 0178 5000 5200 004c
1164
+ // 0cf5 0cdd 0000 0078 02f6 02ef
1165
+ // 0000 0000 0000 0000 0000 0000 0000 0000
1166
+ // 0010
1167
+ // 0cf00cef0cf50cea0cee0cea0ceb0ce80cdd0ce30ced0cea0cf50cf50cf00cf3000602f502f102f002f602f202efcef5
1168
+ if (!data) return null;
1169
+ const dataStr = hexArr2string(data);
1170
+ const header = dataStr.slice(0, 8 * 2);
1171
+
1172
+ const c = data.slice(8, data.length - 2).map((o) => hex2string(o));
1173
+ let i = 0;
1174
+ let _data = [];
1175
+ const _ = this;
1176
+
1177
+ push(_data, ['最高单体电压mV', 'maxVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
1178
+ push(_data, ['最低单体电压mV', 'minVol', format, c.slice(i, (i += 2)), 1, 0, 0]);
1179
+ push(_data, ['DO/DI状态', 'do_di_state', format, c.slice(i, (i += 2)), 1, 0, 0]);
1180
+ push(_data, ['电源电压V', 'batteryVOl', format, c.slice(i, (i += 2)), 0.1, 0, 1]);
1181
+ push(_data, ['最高温度℃', 'maxTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
1182
+ push(_data, ['最低温度℃', 'minTem', format, c.slice(i, (i += 2)), 0.1, -50, 1]);
1183
+ for (let j = 1; j <= 8; j++) {
1184
+ push(_data, [`预留${j}`, `pre_${j}`, format2HexString, c.slice(i, (i += 2)), 1, 0, 0]);
1185
+ }
1186
+
1187
+ // 电芯电压/均衡/在线
1188
+ const cellNo = push(_data, ['单体个数', 'cellNo', format, c.slice(i, (i += 2)), 1, 0, 0]) * 1;
1189
+ let cells = [];
1190
+ [...Array(cellNo)].forEach(() => {
1191
+ const _v = c.slice(i, (i += 2));
1192
+ const v = format(_v, 1, 0, undefined);
1193
+ cells.push({
1194
+ v,
1195
+ hex: _v.join(''),
1196
+ cellV: extractBits(v, 0, 12),
1197
+ equState: extractBits(v, 13, 14),
1198
+ onlioeState: extractBits(v, 15, 16),
1199
+ });
1200
+ });
1201
+ push(_data, [`CELLS`, `cells`, undefined, cells, undefined, undefined, undefined]);
1202
+
1203
+ // 电芯电压/均衡/在线
1204
+ const tempNo = push(_data, ['温度个数', 'tempNo', format, c.slice(i, (i += 2)), 1, 0, 0]) * 1;
1205
+ let temps = [];
1206
+ [...Array(tempNo)].forEach(() => {
1207
+ const _v = c.slice(i, (i += 2));
1208
+
1209
+ const v = format(_v, 0.1, -50, 1);
1210
+ temps.push({
1211
+ v,
1212
+ hex: _v.join(''),
1213
+ temp: extractBits(v, 0, 14),
1214
+ onlioeState: extractBits(v, 15, 16),
1215
+ });
1216
+ });
1217
+ push(_data, [`TEMPS`, `temps`, undefined, temps, undefined, undefined, undefined]);
1218
+
1219
+ let res = {};
1220
+ _data.forEach(([v0, v1, v2]) => (res[v1] = v2));
1221
+ return { dataStr, header, _data, upTime: new Date().getTime(), res };
1222
+ }