zoukankan      html  css  js  c++  java
  • BACnet标准初探

    一、准备知识

    BACnet是用于智能建筑通讯协定,是国际标准化组织(ISO)、美国国家标准协会(ANSI)及美国冷冻空调协会ASHRAE)定义的通讯协定。BACnet针对智能建筑及控制系统的应用所设计的通讯,可用在暖通空调系统(HVAC,包括暖气通风空气调节)也可以用在照明控制、门禁系统、火警侦测系统及其相关的设备。优点在于能降低维护系统所需成本并且安装比一般工业通讯协定更为简易,而且提供有五种业界常用的标准协定,此可防止设备供应商及系统业者的垄断,也因此未来系统扩充性与相容性大为增加

    在BACnet通讯协定问世后,美国Alerton公司就在1996年推出了一系列支援BACnet的HVAC产品,从小型的变风量控制器到操作员的工作站。后来也有许多厂商开发支援BACnet的产品。到2010年1月为止,已有超过480家公司申请了支援BACnet需要的设备商识别码(Vender ID)。

    二、正文

    1、背景

    本文源自WireShark截获的一帧数据,结合官方文档对BACnet标准进行入门级的理解。

    2、实验截图及分析

    WireShark截取BACnet WhoHas服务数据解析实例。

    下图是截取数据概览,可知数据帧的封包格式为:IP--UDP--BVLC--NPDU--APDU

    下图是截取数据的详情:

    (1)、BVLC层

    BACnet通讯协定中定义了几种不同的资料链结层/实体层,包括:

    BACnet Virtual Link Layer部分(内容来自标准的官方文档,版本135-2008)

    The BACnet Virtual Link Layer (BVLL) provides the interface between the BACnet Network Layer (Clause 6) and the
    underlying capabilities of a particular communication subsystem. This Annex specifies the BACnet Virtual Link Control
    (BVLC) functions required to support BACnet/IP directed and broadcast messages. The purpose and format of each message is
    described in the following subclauses.
    Note that each BVLL message has at least three fields. The 1-octet BVLC Type field indicates which underlying communication
    subsystem or microprotocol is in use. In this case, a BVLC Type of X'81' indicates the use of BACnet/IP as defined in this
    Annex. The 1-octet BVLC Function field identifies the specific function to be carried out in support of the indicated
    communication subsystem or microprotocol type. The 2-octet BVLC Length field is the length, in octets, of the entire BVLL
    message, including the two octets of the length field itself, most significant octet first.

    (2)、NPDU层

    NPDU中包括了BACnet协议的版本信息,截取的信息显示是第一版。目前我接触到的版本有135-2001;135-2004和较新的135-2008。

    (3)、APDU层

    上图的APDU中代码1和7的含义如下:

    代码1代表PDU类型unconfirmed-request-PDU:

    BACnetPDU ::= CHOICE {
    confirmed-request-PDU [0] BACnet-Confirmed-Request-PDU,
    unconfirmed-request-PDU [1] BACnet-Unconfirmed-Request-PDU,
    simpleACK-PDU [2] BACnet-SimpleACK-PDU,
    complexACK-PDU [3] BACnet-ComplexACK-PDU,
    segmentAck-PDU [4] BACnet-SegmentACK-PDU,
    error-PDU [5] BACnet-Error-PDU,
    reject-PDU [6] BACnet-Reject-PDU,
    abort-PDU [7] BACnet-Abort-PDU
    }

    代码7代表Who-Has服务:

    BACnet通讯协定中定义了许多服务(service),可供各设备之间的通讯,服务可以分为五类:

    1)有关设备物件管理的服务包括Who-Is、I-Am、Who-Has及I-Have等服务(本例);

    2)有关物件访问的服务包括读取属性、写入属性等服务;

    3)有关报警与事件的服务包括确认报警、属性改变(change of state)报告等;

    4)有关文件读写的服务;

    5)有关虚拟终端的服务;

    BACnetUnconfirmedServiceChoice ::= ENUMERATED {
    i-Am (0),
    i-Have (1),
    unconfirmedCOVNotification (2),
    unconfirmedEventNotification (3),
    unconfirmedPrivateTransfer (4),
    unconfirmedTextMessage (5),
    timeSynchronization (6),
    who-Has (7),
    who-Is (8),
    utcTimeSynchronization (9)
    }

    进一步的详情:下图的Object Name部分展示了设备名称是ASCII编码的:"device(389002)"[猜测ANSI X3.4-1968应该是ASCII的早起某版本]

    3、其它

    为了提供不同厂商BACnet设备之间的互操作性,BACnet协定也定义了BACnet互操作基本块(BACnet Interoperability Building Block,简称BIBB),BACnet互操作基本块是由一个或多个服务所组成,说明在特定需求下,服务器(server)端及客户(client)端需要支援的服务及程序。BACnet互操作基本块可分为以下的五种:

    • 资料分享
    • 警告及事件管理
    • 排程
    • 趋势
    • 设备及网络管理

    每个BACnet设备都会有一份名为“协议实现一致性声明”(Protocol Implementation Conformance Statement,PICS)的文件,其中需说明设备所支援的BACnet互操作基本块、物件种类及定义、使用文字集及通讯时需要的资料。

  • 相关阅读:

    远见卓识,领导力在于把握企业潮流
    创业者白手起家需要的6个基本因素
    企业领袖的最高境界
    人才招聘中的“笔迹分析技术”
    个人品牌,无法复制的职场优势
    美丽的姑娘,请允许我为你写诗
    重做日志浪费(redo wastage)
    利用Toad for Data Analysts软件生成查询语句
    JailbreakMe.com最新浏览器模式破解iPhones,iPads和iPod Touches方法
  • 原文地址:https://www.cnblogs.com/gmth/p/3246377.html
Copyright © 2011-2022 走看看