Parcourir la source

some changes

master
qdjjx il y a 3 ans
Parent
révision
dfdca269f7

+ 598
- 0
专题/后端/数据/办公楼版API数据处理.md Voir le fichier

@@ -0,0 +1,598 @@
1
+# 实时数据
2
+
3
+> 实时数据从`Redis`缓存获取
4
+
5
+请求
6
+
7
+```
8
+POST http://47.103.61.198:5008/api/breaker/data
9
+
10
+Header:
11
+
12
+Content-Type:application/json
13
+DD-Open-Key:d2ca79f1-4666-4ad5-953b-7ba5ee480fe0
14
+
15
+Body:
16
+
17
+{
18
+	"mac":"187ED53338C4"
19
+}
20
+```
21
+
22
+响应:
23
+
24
+```
25
+{
26
+    "data": {
27
+        "serverinfo": {
28
+            "port": "12345",
29
+            "hardware": "T25",
30
+            "execleakcheck": "false",
31
+            "protocol_ver": "19",
32
+            "mac": "187ED53338C4",
33
+            "loginid": "187ED53338C4",
34
+            "gate": "",
35
+            "ip": "192.168.8.146",
36
+            "version": "1.3.08",
37
+            "loginpwd": "7a57a5a743894ae4",
38
+            "ssidpwd": "2803f88db851c67a",
39
+            "ssid": "DDINGW",
40
+            "timezoneId": "Asia/Shanghai",
41
+            "ServerProtocol": "2",
42
+            "server": "47.103.61.198:5008/ebx-bishop/data/carry",
43
+            "datetime": "2021-02-25 02:10:23",
44
+            "leakcheckdate": "3,13,33",
45
+            "lastleakcheckdate": "2017-01-01 10:00:00"
46
+        },
47
+        "distributbox": {
48
+            "breakers": {
49
+                "1": {
50
+                    "version": "1.03",
51
+                    "title": "总路",
52
+                    "model": "JZK2L100-BL6523",
53
+                    "alarm": 0,
54
+                    "enableNetCtrl": true,
55
+                    "mxdw": 0,
56
+                    "mxgg": 14080,
57
+                    "mxgl": 96,
58
+                    "mxgw": 90,
59
+                    "mxgy": 260,
60
+                    "mxld": 30,
61
+                    "mxqy": 0,
62
+                    "openClose": false,
63
+                    "addr": 1,
64
+                    "power": 0.029,
65
+                    "specification": "64",
66
+                    "control": 1,
67
+                    "visibility": 1,
68
+                    "totalChannelId": -1,
69
+                    "lineType": "220",
70
+                    "a_A": 0,
71
+                    "a_T": 30.5,
72
+                    "a_V": 227,
73
+                    "a_WP": 0,
74
+                    "a_LD": 0,
75
+                    "a_PF": 0,
76
+                    "g_A": 0,
77
+                    "g_T": 0,
78
+                    "g_V": 0,
79
+                    "g_WP": 0,
80
+                    "g_LD": 0,
81
+                    "g_PF": 0,
82
+                    "b_A": 0,
83
+                    "b_T": 0,
84
+                    "b_V": 0,
85
+                    "b_WP": 0,
86
+                    "b_PF": 0,
87
+                    "c_A": 0,
88
+                    "c_T": 0,
89
+                    "c_V": 0,
90
+                    "c_WP": 0,
91
+                    "c_PF": 0,
92
+                    "n_A": 0,
93
+                    "n_T": 0
94
+                },
95
+                "2": {
96
+                    "version": "1.03",
97
+                    "title": "线路1",
98
+                    "model": "JZK2L100-BL6523",
99
+                    "alarm": 0,
100
+                    "enableNetCtrl": true,
101
+                    "mxdw": 0,
102
+                    "mxgg": 100,
103
+                    "mxgl": 30,
104
+                    "mxgw": 90,
105
+                    "mxgy": 260,
106
+                    "mxld": 30,
107
+                    "mxqy": 175,
108
+                    "openClose": true,
109
+                    "addr": 2,
110
+                    "power": 0,
111
+                    "specification": "20",
112
+                    "control": 1,
113
+                    "visibility": 1,
114
+                    "totalChannelId": 1,
115
+                    "lineType": "220",
116
+                    "a_A": 0,
117
+                    "a_T": 34.1,
118
+                    "a_V": 227,
119
+                    "a_WP": 0,
120
+                    "a_LD": 0,
121
+                    "a_PF": 0,
122
+                    "g_A": 0,
123
+                    "g_T": 0,
124
+                    "g_V": 0,
125
+                    "g_WP": 0,
126
+                    "g_LD": 0,
127
+                    "g_PF": 0,
128
+                    "b_A": 0,
129
+                    "b_T": 0,
130
+                    "b_V": 0,
131
+                    "b_WP": 0,
132
+                    "b_PF": 0,
133
+                    "c_A": 0,
134
+                    "c_T": 0,
135
+                    "c_V": 0,
136
+                    "c_WP": 0,
137
+                    "c_PF": 0,
138
+                    "n_A": 0,
139
+                    "n_T": 0
140
+                },
141
+                "3": {
142
+                    "version": "1.03",
143
+                    "title": "线路2",
144
+                    "model": "JZK2L100-BL6523",
145
+                    "alarm": 0,
146
+                    "enableNetCtrl": true,
147
+                    "mxdw": 0,
148
+                    "mxgg": 4400,
149
+                    "mxgl": 30,
150
+                    "mxgw": 90,
151
+                    "mxgy": 260,
152
+                    "mxld": 30,
153
+                    "mxqy": 175,
154
+                    "openClose": false,
155
+                    "addr": 3,
156
+                    "power": 0,
157
+                    "specification": "20",
158
+                    "control": 1,
159
+                    "visibility": 1,
160
+                    "totalChannelId": 1,
161
+                    "lineType": "220",
162
+                    "a_A": 0,
163
+                    "a_T": 34.1,
164
+                    "a_V": 227,
165
+                    "a_WP": 0,
166
+                    "a_LD": 0,
167
+                    "a_PF": 0,
168
+                    "g_A": 0,
169
+                    "g_T": 0,
170
+                    "g_V": 0,
171
+                    "g_WP": 0,
172
+                    "g_LD": 0,
173
+                    "g_PF": 0,
174
+                    "b_A": 0,
175
+                    "b_T": 0,
176
+                    "b_V": 0,
177
+                    "b_WP": 0,
178
+                    "b_PF": 0,
179
+                    "c_A": 0,
180
+                    "c_T": 0,
181
+                    "c_V": 0,
182
+                    "c_WP": 0,
183
+                    "c_PF": 0,
184
+                    "n_A": 0,
185
+                    "n_T": 0
186
+                }
187
+            },
188
+            "change": null
189
+        }
190
+    },
191
+    "isError": false,
192
+    "message": "success",
193
+    "code": 200
194
+}
195
+```
196
+
197
+代码:
198
+
199
+```
200
+using DD.Libs.Devices.ManDun;
201
+
202
+var cacheRequest = new  {mac="187ed5312345"};
203
+
204
+var cacheResponse = await cacheUrl
205
+                   .WithHeader("Content-Type","application/json")
206
+                   .WithHeader("DD-Open-Key", "d2ca79f1-4666-4ad5-953b-7ba5ee480fe0")
207
+                   .PostJsonAsync(cacheRequest)
208
+                   .ReceiveJson<RealtimeData>();
209
+```
210
+
211
+```
212
+    public class RealtimeData
213
+    {
214
+        /// <summary>
215
+        /// 配置信息
216
+        /// port,hardware,execleakcheck,mac,loginid,gate,ip, version, loginpwd,ssidpwd,ssid,timezoneId,server, datetime, leakcheckdate, lastleakcheckdate
217
+        /// </summary>
218
+        public IDictionary<string, string> serverinfo { get; set; }
219
+
220
+        /// <summary>
221
+        /// 断路器开关数据
222
+        /// </summary>
223
+        public DistributeBox distributbox { get; set; }
224
+    }
225
+    
226
+        /// <summary>
227
+    /// 分布式电箱
228
+    /// </summary>
229
+    public class DistributeBox
230
+    {
231
+        /// <summary>
232
+        /// 一个电箱有多个断路器
233
+        /// </summary>
234
+        public IDictionary<string, Breaker> Breakers { get; set; }
235
+
236
+        /// <summary>
237
+        /// 模块关键数据是否有变化:1有变化,0没有变化。不用
238
+        /// </summary>
239
+        public string Change { get; set; }
240
+    }
241
+    
242
+    
243
+      public class Breaker
244
+    {
245
+        #region 不带三相时的数据
246
+        /// <summary>
247
+        /// 版本号
248
+        /// </summary>
249
+        public string version { get; set; }
250
+
251
+        /// <summary>
252
+        /// 线路名称
253
+        /// </summary>
254
+        public string title { get; set; }
255
+
256
+        /// <summary>
257
+        /// 线路型号(JZK2L100-BL6523表示是总路,JFK2L103-BL6523表示是分路)
258
+        /// </summary>
259
+        public string model { get; set; }
260
+
261
+        /// <summary>
262
+        /// 当前告警信息:0表示告警取消
263
+        /// </summary>
264
+        public long Alarm { get; set; }
265
+
266
+        /// <summary>
267
+        /// 是否远程关闭:true是;false否
268
+        /// </summary>
269
+        public bool EnableNetCtrl { get; set; }
270
+
271
+
272
+        /// <summary>
273
+        /// 低温门限值
274
+        /// </summary>
275
+        public decimal MXDW { get; set; }
276
+
277
+        /// <summary>
278
+        ///  过功门限值
279
+        /// </summary>
280
+        public decimal MXGG { get; set; }
281
+
282
+        /// <summary>
283
+        /// 过流门限值
284
+        /// </summary>
285
+        public decimal MXGL { get; set; }
286
+
287
+        /// <summary>
288
+        /// 过温门限值
289
+        /// </summary>
290
+        public decimal MXGW { get; set; }
291
+
292
+        /// <summary>
293
+        /// 过压门限值
294
+        /// </summary>
295
+        public decimal MXGY { get; set; }
296
+
297
+        /// <summary>
298
+        /// 漏电门限值
299
+        /// </summary>
300
+        public decimal MXLD { get; set; }
301
+
302
+        /// <summary>
303
+        /// 欠压门限值
304
+        /// </summary>
305
+        public decimal MXQY { get; set; }
306
+
307
+        /// <summary>
308
+        /// 线路状态:true开;false关
309
+        /// </summary>
310
+        public bool OpenClose { get; set; }
311
+
312
+
313
+        /// <summary>
314
+        /// 线路地址
315
+        /// </summary>
316
+        public short addr { get; set; }
317
+
318
+        /// <summary>
319
+        /// 累计电量KW
320
+        /// </summary>
321
+        public decimal power { get; set; }
322
+
323
+
324
+        /// <summary>
325
+        /// 线路规格
326
+        /// </summary>
327
+        public string specification { get; set; }
328
+
329
+        /// <summary>
330
+        /// 是否能控制(1为能,0为不能)
331
+        /// </summary>
332
+        public short control { get; set; }
333
+
334
+        /// <summary>
335
+        /// 线路是否显示(1显示;0不显示)
336
+        /// </summary>
337
+        public short visibility { get; set; }
338
+
339
+        /// <summary>
340
+        /// 接入到汇电线路下(-1为进线直连,非-1表示接入某总路的总路的线路ID)
341
+        /// </summary>
342
+        public int totalChannelId { get; set; }
343
+
344
+        /// <summary>
345
+        /// 线路类型(参数值有:220,380等)
346
+        /// </summary>
347
+        public string lineType { get; set; }
348
+
349
+        /// <summary>
350
+        /// A相电流(或单相电流)
351
+        /// </summary>
352
+        public decimal A_A { get; set; }
353
+
354
+        /// <summary>
355
+        /// A相温度(或单相温度)
356
+        /// </summary>
357
+        public decimal A_T { get; set; }
358
+
359
+        /// <summary>
360
+        /// A相电压(或单相电压)
361
+        /// </summary>
362
+        public decimal A_V { get; set; }
363
+
364
+        /// <summary>
365
+        /// A相功率(或单相功率)
366
+        /// </summary>
367
+        public decimal A_WP { get; set; }
368
+
369
+        /// <summary>
370
+        /// 单相漏电流(三相无值)
371
+        /// </summary>
372
+        public decimal A_LD { get; set; }
373
+
374
+        /// <summary>
375
+        /// A相功率因素(或单相功率因素)
376
+        /// </summary>
377
+        public decimal A_PF { get; set; }
378
+        #endregion
379
+
380
+
381
+
382
+        /// <summary>
383
+        /// 平均电流(单相无值)
384
+        /// </summary>
385
+        public decimal G_A { get; set; }
386
+
387
+        /// <summary>
388
+        /// 机壳温度(单相无值)
389
+        /// </summary>
390
+        public decimal G_T { get; set; }
391
+
392
+        /// <summary>
393
+        /// 平均电压(单相无值)
394
+        /// </summary>
395
+        public decimal G_V { get; set; }
396
+
397
+        /// <summary>
398
+        /// 功率和值(单相无值)
399
+        /// </summary>
400
+        public decimal G_WP { get; set; }
401
+
402
+        /// <summary>
403
+        /// 三相漏电流(单相无值)
404
+        /// </summary>
405
+        public decimal G_LD { get; set; }
406
+
407
+        /// <summary>
408
+        /// 合相功率因数(单相无值)
409
+        /// </summary>
410
+        public decimal G_PF { get; set; }
411
+
412
+
413
+
414
+        /// <summary>
415
+        /// B相电流
416
+        /// </summary>
417
+        public decimal B_A { get; set; }
418
+
419
+        /// <summary>
420
+        /// B相温度
421
+        /// </summary>
422
+        public decimal B_T { get; set; }
423
+
424
+        /// <summary>
425
+        /// B相电压
426
+        /// </summary>
427
+        public decimal B_V { get; set; }
428
+
429
+        /// <summary>
430
+        /// B相功率
431
+        /// </summary>
432
+        public decimal B_WP { get; set; }
433
+
434
+        /// <summary>
435
+        /// B相功率因素
436
+        /// </summary>
437
+        public decimal B_PF { get; set; }
438
+
439
+        /// <summary>
440
+        /// C相电流
441
+        /// </summary>
442
+        public decimal C_A { get; set; }
443
+
444
+        /// <summary>
445
+        /// C相温度
446
+        /// </summary>
447
+        public decimal C_T { get; set; }
448
+
449
+        /// <summary>
450
+        /// C相电压
451
+        /// </summary>
452
+        public decimal C_V { get; set; }
453
+
454
+        /// <summary>
455
+        /// C相功率
456
+        /// </summary>
457
+        public decimal C_WP { get; set; }
458
+
459
+        /// <summary>
460
+        /// C相功率因素
461
+        /// </summary>
462
+        public decimal C_PF { get; set; }
463
+
464
+        /// <summary>
465
+        /// 零线电流
466
+        /// </summary>
467
+        public decimal N_A { get; set; }
468
+
469
+        /// <summary>
470
+        /// 零线温度
471
+        /// </summary>
472
+        public decimal N_T { get; set; }
473
+
474
+
475
+
476
+    }  
477
+```
478
+
479
+
480
+
481
+> 模拟模块的模拟数据,也存入`Redis`缓存
482
+
483
+
484
+
485
+> 开放平台接口如何设计?
486
+
487
+- 任意多个模块
488
+- 任意时间段内
489
+- 任意数据:电流、电压、全部
490
+
491
+# 报警报表
492
+
493
+
494
+
495
+> 从哪里获取?
496
+
497
+如果没有选择时间,从报警历史数据中获取,报警的历史数据保存在时序数据库。
498
+
499
+
500
+
501
+> 有哪些有关时间的条件?
502
+
503
+- 按小时:过去60分钟
504
+- 按天:前一天的凌晨到现在的小时
505
+- 按周:过去7天
506
+- 按月:过去30天
507
+
508
+
509
+
510
+> 时间以外的条件?
511
+
512
+报警类型。
513
+
514
+
515
+
516
+> 时序数据库设计
517
+
518
+```
519
+ts timestamp
520
+mac
521
+addr
522
+start:报警开始时间
523
+end:报警结束时间
524
+type:报警类型
525
+level:报警级别
526
+val:当前值
527
+limit:阈值
528
+```
529
+
530
+> 接口如何设计
531
+
532
+```
533
+time
534
+type
535
+level
536
+mac
537
+addr
538
+```
539
+
540
+> 要做的事
541
+
542
+- 创建时序数据库
543
+- 随时创建按小时、按天、按周、按月的种子数据接口
544
+- 根据条件查询报警历史数据
545
+
546
+
547
+
548
+> 开放平台接口如何设计?
549
+
550
+- 任意多个模块
551
+- 任意时间段内
552
+- 任意报警类型
553
+
554
+# 电量报表
555
+
556
+> 从哪里获取
557
+
558
+从时序数据库获取,调用开放平台的接口。
559
+
560
+
561
+
562
+> 有哪些查询条件?
563
+
564
+- 按天:前一天的凌晨到现在的小时
565
+- 按周:过去7天
566
+- 按月:过去30天
567
+- 某个开关
568
+
569
+
570
+
571
+>  开放平台接口如何设计?
572
+
573
+- 任意多个模块
574
+- 任意时间段内
575
+- 任意计算
576
+
577
+# 负荷报表
578
+
579
+
580
+
581
+> 有哪些查询条件?
582
+
583
+- 最近60分钟
584
+- 按开关
585
+- 按公司
586
+
587
+
588
+
589
+> 从哪里获取?
590
+
591
+开放平台提供接口,从关系数据库获取。
592
+
593
+
594
+
595
+> 开放平台如何设计?
596
+
597
+- 最近60分钟内
598
+- 任意计算

+ 1
- 1
专题/后端/数据/数据问题的基本面.md Voir le fichier

@@ -283,7 +283,7 @@ OpenAPI_Test:187ED53159E4,macss 就是缓存的键。其中OpenAPI_Test可以理
283 283
 
284 284
 > 报警存入哪里?
285 285
 
286
-报警分为实时报警和历史报警。实时报警就是当下所有开关的报警;历史报警是发生在过去,报警已经解除的哪些报警。比如,开关A,在`8:10`程序判断出现手动分断报警,那么在实时报警中添加一条记录。接着,在`9:10`程序判断开关A已经正常,就在历史报警中添加一条记录,这条记录的报警开始时间是`8:10`,结束时间是`9:10`,并且在实时报警中更新该条记录,更新为开关A属于正常状态
286
+报警分为实时报警和历史报警。实时报警就是当下所有开关的报警;历史报警是发生在过去,报警已经解除的哪些报警。比如,开关A,在`8:10`程序判断出现手动分断报警,那么在实时报警中添加一条记录。接着,在`9:10`程序判断开关A已经正常,就在历史报警中添加一条记录,这条记录的报警开始时间是`8:10`,结束时间是`9:10`,并且在实时报警中删除该条记录
287 287
 
288 288
 
289 289
 

Chargement…
Annuler
Enregistrer