鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

办公楼版API数据处理.md 14KB

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