1. Mapping映射表规范

1.1. Mappingtemplate(映射表模板)

Mapping_template出脚本主要作用于设备信息的扩展字段,在设备信息信息中需要显示哪些设备字段在此配置即可。

扩展字段示例 Image - 扩展字段示例

上图显示扩展字段代码模板如下:

  1. [{
  2. "title": "锅炉信息",
  3. "data": [
  4. ["燃料类型", "天然气"],
  5. ["锅炉重量", "2吨"],
  6. ["出厂日期", "2018-03-03"]
  7. ]
  8. }, {
  9. "title": "能效指标信息",
  10. "data": [
  11. ["热效率", 0.8],
  12. ["燃料热值", 7000],
  13. ["*吨汽燃料指标*", 0.21]
  14. ]
  15. }]
  • Title:为段落标题,名称可自定义,即代码中“锅炉信息”、“能效指标信息”可更改。
  • Data:为段落中字段内容,字段名和字段值可自定义。

1.2. Mappingscript(映射表脚本)

Mapping_script处脚本主要将适配器上报的key映射为系统可识别的变量,并将适配器和设备的关系进行关联对应。

代码模板如下:

  1. [
  2. ["S02","Instant Flow","瞬时流量","$AprusID-1","L1_3_0","STA"]
  3. ]

依次顺序说明:

  • 变量
  • 英文标签
  • 中文标签
  • 适配器标识
  • 设备上报KEY
  • 数据类型
中文说明变量英文标签中文标签适配器标识设备上报KEY数据类型
示例参考S02Instant Flow瞬时流量$AprusID-1L1_3_0STA

注:上述映射表中还有一类书写规则,离线数据和统计计算数据,这一类数据不是通过适配器上报的数据,而是通过外部程序获取数据,目前规则还未完善,待后续补充。

1.2.1. 变量

变量是系统可识别的KEY又名,适配器识别KEY,系统识别变量。通过映射,变量、参数名称、KEY可进行相互转换。

1.2.2. 标签

标签分为英文标签和中文标签。表示的是KEY的含义。

1.2.3. 适配器标识

$AprusID-1这样的适配器标识是将适配器标识经过宏替换后转化而来,后续的生产环境中也大多使用这种方式,也可以直接使用适配器标识,例如:瞬时流量中就直接写入的适配器标识。

具体规则见如下举例:

适配器的组合 Image - 适配器的组合

如果这个是一个特定的设备与适配器的组合,我们把设备1-4定义为“设备”,Mapping我们可以这样写:

  1. [
  2. ["X1","Device1Temperature","设备1温度","A8901","L1_1_123","STA"],
  3. ["X2","Device1Pressure","设备1压力","A8901","L1_1_234","STA"],
  4. ["X3","Device1Current","设备1电流","A8902","L1_1_123","STA"],
  5. ["X4","Device1Voltage","设备1电压","A8902","L1_1_234","STA"],
  6. ["X5","Device2Current","设备2电流","A8902","L1_1_345","STA"],
  7. ["X6","Device2Voltage","设备2电压","A8902","L1_1_456","STA"],
  8. ["X7","Device2Gas","设备2气量","A8903","L1_1_123","STA"],
  9. ["X8","Device2Hydro","设备2电量","A8903","L1_1_234","STA"],
  10. ["X9","Device3Gas","设备3气量","A8903","L1_1_345","STA"],
  11. ["X10","Device3Hydro","设备3电量","A8903","L1_1_456","STA"],
  12. ["X11","Device3Temperature","设备3温度","A8904","L1_1_123","STA"],
  13. ["X12","Device3Pressure","设备3压力","A8904","L1_1_234","STA"],
  14. ["X13","Device3Gas","设备3气量","A8905","L1_1_123","STA"],
  15. ["X14","Device3Hydro","设备3电量","A8905","L1_1_234","STA"],
  16. ["X15","Device4Gas","设备4气量","A8905","L1_1_345","STA"],
  17. ["X16","Device4Hydro","设备4电量","A8905","L1_1_456","STA"],
  18. ["X17","Device4Temperature","设备4温度","A8906","L1_1_123","STA"],
  19. ["X18","Device4Pressure","设备4压力","A8906","L1_1_234","STA"]
  20. ]

下面就是宏替换

宏替换 Image - 宏替换

  1. [
  2. ["X1","Device1Temperature","设备1温度","$AprusID-1","L1_1_123","STA"],
  3. ["X2","Device1Pressure","设备1压力","$AprusID-1","L1_1_234","STA"],
  4. ["X3","Device1Current","设备1电流","$AprusID-2","L1_1_123","STA"],
  5. ["X4","Device1Voltage","设备1电压","$AprusID-2","L1_1_234","STA"],
  6. ["X5","Device2Current","设备2电流","$AprusID-2","L1_1_345","STA"],
  7. ["X6","Device2Voltage","设备2电压","$AprusID-2","L1_1_456","STA"],
  8. ["X7","Device2Gas","设备2气量","$AprusID-3","L1_1_123","STA"],
  9. ["X8","Device2Hydro","设备2电量","$AprusID-3","L1_1_234","STA"],
  10. ["X9","Device3Gas","设备3气量","$AprusID-3","L1_1_345","STA"],
  11. ["X10","Device3Hydro","设备3电量","$prusID-3","L1_1_456","STA"],
  12. ["X11","Device3Temperature","设备3温度","$AprusID-4","L1_1_123","STA"],
  13. ["X12","Device3Pressure","设备3压力","$AprusID-4","L1_1_234","STA"],
  14. ["X13","Device3Gas","设备3气量","$AprusID-5","L1_1_123","STA"],
  15. ["X14","Device3Hydro","设备3电量","$AprusID-5","L1_1_234","STA"],
  16. ["X15","Device4Gas","设备4气量","$AprusID-5","L1_1_345","STA"],
  17. ["X16","Device4Hydro","设备4电量","$AprusID-5","L1_1_456","STA"],
  18. ["X17","Device4Temperature","设备4温度","$AprusID-6","L1_1_123","STA"],
  19. ["X18","Device4Pressure","设备4压力","$AprusID-6","L1_1_234","STA"]
  20. ]

只要符合这样对应关系的设备,只需要保证在设备的AprusList属性中的顺序是(AprusID-1,AprusID-2,….,AprusID-6)就行了。MosaicMaker程序就是根据这个,去进行Mosaic拼图,拼出来的结果,就是Mosaic={"X1":$X1,"X2":$X2,….,"Xn":$Xn},每个Xi就是对应的某个设备的参数。

1.2.4. 上报数据KEY

定义的KEY直接在数据表中可获取。为区分数据类型,所以KEY的开头字母根据不同,数据类型有所不同

  • 事件:E开头,例如E1_2_3
  • 报警:A开头,例如A1_2_3
  • 故障:F开头,例如F1_2_3
  • 运行参数:L开头,例如L1_2_3
  • 运行状态:直接以Z表示

1.2.5. 数据类型

数据类型分别为:STA(状态)、SET(设置)、CMD(控制)、FLT(故障)、ALT(报警)、EVNT(事件)

注:脚本中所需书写的数据类型在数据表中可直接查询。