实时数据从
Redis
缓存获取
请求
POST http://47.103.61.198:5008/api/breaker/data
Header:
Content-Type:application/json
DD-Open-Key:d2ca79f1-4666-4ad5-953b-7ba5ee480fe0
Body:
{
"mac":"187ED53338C4"
}
响应:
{
"data": {
"serverinfo": {
"port": "12345",
"hardware": "T25",
"execleakcheck": "false",
"protocol_ver": "19",
"mac": "187ED53338C4",
"loginid": "187ED53338C4",
"gate": "",
"ip": "192.168.8.146",
"version": "1.3.08",
"loginpwd": "7a57a5a743894ae4",
"ssidpwd": "2803f88db851c67a",
"ssid": "DDINGW",
"timezoneId": "Asia/Shanghai",
"ServerProtocol": "2",
"server": "47.103.61.198:5008/ebx-bishop/data/carry",
"datetime": "2021-02-25 02:10:23",
"leakcheckdate": "3,13,33",
"lastleakcheckdate": "2017-01-01 10:00:00"
},
"distributbox": {
"breakers": {
"1": {
"version": "1.03",
"title": "总路",
"model": "JZK2L100-BL6523",
"alarm": 0,
"enableNetCtrl": true,
"mxdw": 0,
"mxgg": 14080,
"mxgl": 96,
"mxgw": 90,
"mxgy": 260,
"mxld": 30,
"mxqy": 0,
"openClose": false,
"addr": 1,
"power": 0.029,
"specification": "64",
"control": 1,
"visibility": 1,
"totalChannelId": -1,
"lineType": "220",
"a_A": 0,
"a_T": 30.5,
"a_V": 227,
"a_WP": 0,
"a_LD": 0,
"a_PF": 0,
"g_A": 0,
"g_T": 0,
"g_V": 0,
"g_WP": 0,
"g_LD": 0,
"g_PF": 0,
"b_A": 0,
"b_T": 0,
"b_V": 0,
"b_WP": 0,
"b_PF": 0,
"c_A": 0,
"c_T": 0,
"c_V": 0,
"c_WP": 0,
"c_PF": 0,
"n_A": 0,
"n_T": 0
},
"2": {
"version": "1.03",
"title": "线路1",
"model": "JZK2L100-BL6523",
"alarm": 0,
"enableNetCtrl": true,
"mxdw": 0,
"mxgg": 100,
"mxgl": 30,
"mxgw": 90,
"mxgy": 260,
"mxld": 30,
"mxqy": 175,
"openClose": true,
"addr": 2,
"power": 0,
"specification": "20",
"control": 1,
"visibility": 1,
"totalChannelId": 1,
"lineType": "220",
"a_A": 0,
"a_T": 34.1,
"a_V": 227,
"a_WP": 0,
"a_LD": 0,
"a_PF": 0,
"g_A": 0,
"g_T": 0,
"g_V": 0,
"g_WP": 0,
"g_LD": 0,
"g_PF": 0,
"b_A": 0,
"b_T": 0,
"b_V": 0,
"b_WP": 0,
"b_PF": 0,
"c_A": 0,
"c_T": 0,
"c_V": 0,
"c_WP": 0,
"c_PF": 0,
"n_A": 0,
"n_T": 0
},
"3": {
"version": "1.03",
"title": "线路2",
"model": "JZK2L100-BL6523",
"alarm": 0,
"enableNetCtrl": true,
"mxdw": 0,
"mxgg": 4400,
"mxgl": 30,
"mxgw": 90,
"mxgy": 260,
"mxld": 30,
"mxqy": 175,
"openClose": false,
"addr": 3,
"power": 0,
"specification": "20",
"control": 1,
"visibility": 1,
"totalChannelId": 1,
"lineType": "220",
"a_A": 0,
"a_T": 34.1,
"a_V": 227,
"a_WP": 0,
"a_LD": 0,
"a_PF": 0,
"g_A": 0,
"g_T": 0,
"g_V": 0,
"g_WP": 0,
"g_LD": 0,
"g_PF": 0,
"b_A": 0,
"b_T": 0,
"b_V": 0,
"b_WP": 0,
"b_PF": 0,
"c_A": 0,
"c_T": 0,
"c_V": 0,
"c_WP": 0,
"c_PF": 0,
"n_A": 0,
"n_T": 0
}
},
"change": null
}
},
"isError": false,
"message": "success",
"code": 200
}
代码:
using DD.Libs.Devices.ManDun;
var cacheRequest = new {mac="187ed5312345"};
var cacheResponse = await cacheUrl
.WithHeader("Content-Type","application/json")
.WithHeader("DD-Open-Key", "d2ca79f1-4666-4ad5-953b-7ba5ee480fe0")
.PostJsonAsync(cacheRequest)
.ReceiveJson<RealtimeData>();
public class RealtimeData
{
/// <summary>
/// 配置信息
/// port,hardware,execleakcheck,mac,loginid,gate,ip, version, loginpwd,ssidpwd,ssid,timezoneId,server, datetime, leakcheckdate, lastleakcheckdate
/// </summary>
public IDictionary<string, string> serverinfo { get; set; }
/// <summary>
/// 断路器开关数据
/// </summary>
public DistributeBox distributbox { get; set; }
}
/// <summary>
/// 分布式电箱
/// </summary>
public class DistributeBox
{
/// <summary>
/// 一个电箱有多个断路器
/// </summary>
public IDictionary<string, Breaker> Breakers { get; set; }
/// <summary>
/// 模块关键数据是否有变化:1有变化,0没有变化。不用
/// </summary>
public string Change { get; set; }
}
public class Breaker
{
#region 不带三相时的数据
/// <summary>
/// 版本号
/// </summary>
public string version { get; set; }
/// <summary>
/// 线路名称
/// </summary>
public string title { get; set; }
/// <summary>
/// 线路型号(JZK2L100-BL6523表示是总路,JFK2L103-BL6523表示是分路)
/// </summary>
public string model { get; set; }
/// <summary>
/// 当前告警信息:0表示告警取消
/// </summary>
public long Alarm { get; set; }
/// <summary>
/// 是否远程关闭:true是;false否
/// </summary>
public bool EnableNetCtrl { get; set; }
/// <summary>
/// 低温门限值
/// </summary>
public decimal MXDW { get; set; }
/// <summary>
/// 过功门限值
/// </summary>
public decimal MXGG { get; set; }
/// <summary>
/// 过流门限值
/// </summary>
public decimal MXGL { get; set; }
/// <summary>
/// 过温门限值
/// </summary>
public decimal MXGW { get; set; }
/// <summary>
/// 过压门限值
/// </summary>
public decimal MXGY { get; set; }
/// <summary>
/// 漏电门限值
/// </summary>
public decimal MXLD { get; set; }
/// <summary>
/// 欠压门限值
/// </summary>
public decimal MXQY { get; set; }
/// <summary>
/// 线路状态:true开;false关
/// </summary>
public bool OpenClose { get; set; }
/// <summary>
/// 线路地址
/// </summary>
public short addr { get; set; }
/// <summary>
/// 累计电量KW
/// </summary>
public decimal power { get; set; }
/// <summary>
/// 线路规格
/// </summary>
public string specification { get; set; }
/// <summary>
/// 是否能控制(1为能,0为不能)
/// </summary>
public short control { get; set; }
/// <summary>
/// 线路是否显示(1显示;0不显示)
/// </summary>
public short visibility { get; set; }
/// <summary>
/// 接入到汇电线路下(-1为进线直连,非-1表示接入某总路的总路的线路ID)
/// </summary>
public int totalChannelId { get; set; }
/// <summary>
/// 线路类型(参数值有:220,380等)
/// </summary>
public string lineType { get; set; }
/// <summary>
/// A相电流(或单相电流)
/// </summary>
public decimal A_A { get; set; }
/// <summary>
/// A相温度(或单相温度)
/// </summary>
public decimal A_T { get; set; }
/// <summary>
/// A相电压(或单相电压)
/// </summary>
public decimal A_V { get; set; }
/// <summary>
/// A相功率(或单相功率)
/// </summary>
public decimal A_WP { get; set; }
/// <summary>
/// 单相漏电流(三相无值)
/// </summary>
public decimal A_LD { get; set; }
/// <summary>
/// A相功率因素(或单相功率因素)
/// </summary>
public decimal A_PF { get; set; }
#endregion
/// <summary>
/// 平均电流(单相无值)
/// </summary>
public decimal G_A { get; set; }
/// <summary>
/// 机壳温度(单相无值)
/// </summary>
public decimal G_T { get; set; }
/// <summary>
/// 平均电压(单相无值)
/// </summary>
public decimal G_V { get; set; }
/// <summary>
/// 功率和值(单相无值)
/// </summary>
public decimal G_WP { get; set; }
/// <summary>
/// 三相漏电流(单相无值)
/// </summary>
public decimal G_LD { get; set; }
/// <summary>
/// 合相功率因数(单相无值)
/// </summary>
public decimal G_PF { get; set; }
/// <summary>
/// B相电流
/// </summary>
public decimal B_A { get; set; }
/// <summary>
/// B相温度
/// </summary>
public decimal B_T { get; set; }
/// <summary>
/// B相电压
/// </summary>
public decimal B_V { get; set; }
/// <summary>
/// B相功率
/// </summary>
public decimal B_WP { get; set; }
/// <summary>
/// B相功率因素
/// </summary>
public decimal B_PF { get; set; }
/// <summary>
/// C相电流
/// </summary>
public decimal C_A { get; set; }
/// <summary>
/// C相温度
/// </summary>
public decimal C_T { get; set; }
/// <summary>
/// C相电压
/// </summary>
public decimal C_V { get; set; }
/// <summary>
/// C相功率
/// </summary>
public decimal C_WP { get; set; }
/// <summary>
/// C相功率因素
/// </summary>
public decimal C_PF { get; set; }
/// <summary>
/// 零线电流
/// </summary>
public decimal N_A { get; set; }
/// <summary>
/// 零线温度
/// </summary>
public decimal N_T { get; set; }
}
模拟模块的模拟数据,也存入
Redis
缓存开放平台接口如何设计?
从哪里获取?
如果没有选择时间,从报警历史数据中获取,报警的历史数据保存在时序数据库。
有哪些有关时间的条件?
时间以外的条件?
报警类型。
时序数据库设计
ts timestamp
mac
addr
start:报警开始时间
end:报警结束时间
type:报警类型
level:报警级别
val:当前值
limit:阈值
接口如何设计
time
type
level
mac
addr
要做的事
开放平台接口如何设计?
从哪里获取
从时序数据库获取,调用开放平台的接口。
有哪些查询条件?
开放平台接口如何设计?
有哪些查询条件?
从哪里获取?
开放平台提供接口,从关系数据库获取。
开放平台如何设计?