BACnet通讯分析.docx

上传人:b****2 文档编号:2477361 上传时间:2023-05-03 格式:DOCX 页数:49 大小:30.59KB
下载 相关 举报
BACnet通讯分析.docx_第1页
第1页 / 共49页
BACnet通讯分析.docx_第2页
第2页 / 共49页
BACnet通讯分析.docx_第3页
第3页 / 共49页
BACnet通讯分析.docx_第4页
第4页 / 共49页
BACnet通讯分析.docx_第5页
第5页 / 共49页
BACnet通讯分析.docx_第6页
第6页 / 共49页
BACnet通讯分析.docx_第7页
第7页 / 共49页
BACnet通讯分析.docx_第8页
第8页 / 共49页
BACnet通讯分析.docx_第9页
第9页 / 共49页
BACnet通讯分析.docx_第10页
第10页 / 共49页
BACnet通讯分析.docx_第11页
第11页 / 共49页
BACnet通讯分析.docx_第12页
第12页 / 共49页
BACnet通讯分析.docx_第13页
第13页 / 共49页
BACnet通讯分析.docx_第14页
第14页 / 共49页
BACnet通讯分析.docx_第15页
第15页 / 共49页
BACnet通讯分析.docx_第16页
第16页 / 共49页
BACnet通讯分析.docx_第17页
第17页 / 共49页
BACnet通讯分析.docx_第18页
第18页 / 共49页
BACnet通讯分析.docx_第19页
第19页 / 共49页
BACnet通讯分析.docx_第20页
第20页 / 共49页
亲,该文档总共49页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

BACnet通讯分析.docx

《BACnet通讯分析.docx》由会员分享,可在线阅读,更多相关《BACnet通讯分析.docx(49页珍藏版)》请在冰点文库上搜索。

BACnet通讯分析.docx

BACnet通讯分析

BACnet通讯

1、概述.

系统实现基于BACnet/IP(又称B/IP)网络进行通讯。

BACnet虚拟链路层(BVLL)提供了BACnet网络层和某指定的通讯子系统的接口,本文指定了BACnet虚拟链路控制(BVLC)要求支持的定向和广播信息。

本实现关于BACnet协议定义主要可分为三层:

B/IP网络虚拟层,BACnet网络层和BACnet应用层。

B/IP提供了TCP/IP一样的通讯结构,采用UDP的通讯方式。

本文接下来将对此三层结构进行详细的讲解。

其文本协议的大致格式如下:

BACnet/IP

BACnet网络层

BACnet应用层

BVLCType

BVLCFunction

Length

NPDU

APDU

NPDU:

BACnet网络层数据结构,下文进行详细的讲解

APDU:

BACnet应用层数据结构,下文进行详细的讲解

2、BACnet/IP.

BVLCType:

0x81,代表BACnet/IP网络

BVLCFunction:

指定报文的类型,何种作用;本应用使用的报文类型分为两种:

0A:

点对点通讯

0B:

广播通信

Length:

指定报文的长度,包括BVLCType、BVLCFunction以及本身在内NPDU:

根据不同情况,报文长短不同,见下文的解析。

APDU:

根据NPDU不同以及不同的请求,报文不同,见下文的解析。

3、BACnetNPDU结构.

版本信息

1Byte

Version

控制字

1Byte

Control

目标网络号

2Bytes

DNET

目标网络长度

1Byte

DLEN

目标地址

可变长度

DADR

原网络号

2Bytes

SNET

原网络长度

1Byte

SLEN

原地址

可变

SNET

路由数目

1Byte

HopCount

消息类型

1Byte

MessageType

卖方ID

2Bytes

VendorID

应用层信息

可变

APDU

版本信息:

默认0x01

控制字:

BIT7:

1表示MessageType存在,为0时MessageType不存在

BIT6:

保留,为0

BIT5:

1表示DNETDLENHopCount存在,当DLEN为0时表明广播网络

DADR不存在;0表示DNETDLENDADRHopCount不存在

BIT4:

保留,为0

BIT3:

1表示SNETSLEN存在,当SLEN为0时表明无效SADR不存在;

0表示SNETSLENSADRHopCount不存在

BIT2:

1表示为一个需确认的请求数据单元,一复杂ACK数据单元或一网络层

信息非reply的;0表示除去上述情形的数据单元

BIT1、0:

网络优先级

11=LifeSafetymessage

10=CriticalEquipmentmessage

01=Urgentmessage

00=Normalmessage

目标网络号:

FFFF的时候表示广播

目标长度:

表示DADR的长度

目标地址:

目标网络MAC地址

原网络号:

同目标网络号

原网络长度:

表示SADR的长度

原地址:

原网络的MAC地址

路由数目:

数据需要经过的路由个数,当不存在DNET的时候,需设置为FF

消息类型:

X'00':

Who-Is-Router-To-Network

X'01':

I-Am-Router-To-Network

X'02':

I-Could-Be-Router-To-Network

X'03':

Reject-Message-To-Network

X'04':

Router-Busy-To-Network

X'05':

Router-Available-To-Network

X'06':

Initialize-Routing-Table

X'07':

Initialize-Routing-Table-Ack

X'08':

Establish-Connection-To-Network

X'09':

Disconnect-Connection-To-Network

X'0A'toX'7F':

ReservedforusebyASHRAE

X'80'toX'FF':

Availableforvendorproprietarymessages

卖方ID:

当控制字的BIT7为1并且消息类型为X'80'toX'FF':

的时候,才会存在

本次开发没有用到,不再解释

本次应用中控制字只用到0x20和0x04两种,前者为广播查询设备,后者微点对对取设备数据或属性。

4、BACnetAPDU结构:

(应用层协议数据单元)

BACnet网络层数据主要分为一下几种:

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

}

对于本次应用,主要用到了

BACnet-Confirmed-Request-PDU(需确认的请求协议数据单元)

BACnet-Unconfirmed-Request-PDU(无需确认的请求协议数据单元)

BACnet-ComplexACK-PDU(复杂的ACK命令)

BACnet-Error-PDU(报错的协议数据单元)

对于上述几种数据的分类主要根据pdutype(下文进行讲解)进行判定。

.BACnet-Confirmed-Request-PDU的结构:

BACnet-Confirmed-Request-PDU:

:

=SEQUENCE

{

pdu-type[0]Unsigned(0..15),--0forthisPDUtype

segmented-message[1]BOOLEAN,

more-follows[2]BOOLEAN,

segmented-response-accepted[3]BOOLEAN,

reserved[4]Unsigned(0..3),--mustbesettozero

max-segments-accepted[5]Unsigned(0..7),--asper20.1.2.4

max-APDU-length-accepted[6]Unsigned(0..15),--asper20.1.2.5

invokeID[7]Unsigned(0..255),

sequence-number[8]Unsigned(0..255)OPTIONAL,--onlyifsegmentedmsg

proposed-window-size[9]Unsigned(1..127)OPTIONAL,--onlyifsegmentedmsg

service-choice[10]BACnetConfirmedServiceChoice,

service-request[11]BACnet-Confirmed-Service-RequestOPTIONAL

}

BIT7

BIT6

BIT5

BIT4

BIT3

BIT2

BIT1

BIT0

PDUTYPE

SEG

MOR

SA

0

0

MaxSegs

MaxResp

InvokeID

SequenceNumber(onlypresentbySEG==1)

ProposedWindowSize(onlypresentbySEG==1)

ServiceChioce

ServiceRequest……

PDUType0(BACnet-Confirmed-Service-Request-PDU)

SEG0(UnsegmentedRequest)

1(SegmentedRequest)

MOR0(NoMoreSegmentsFollow)

1(MoreSegmentsFollow)

SA0(SegmentedResponsenotaccepted)

1(SegmentedResponseaccepted)

MaxSegs(0..7)(Numberofresponsesegmentsacceptedper20.1.2.4)

MaxResp(0..15)(SizeofMaximumAPDUacceptedper20.1.2.5)

InvokeID(0..255)

SequenceNumber(0..255)OnlypresentifSEG=1

ProposedWindowSize(1..127)OnlypresentifSEG=1

ServiceChoiceBACnetConfirmedServiceChoice

ServiceRequestVariableEncoding

SEG:

指出当前的数据单元是否为完整的还是为一部分分段信息

MOR:

指出是否还有更多的分段信息

SA:

为1时指出将收到一个复杂的回应(complexack)

MaxSegs:

指出设备将要接收到多少分段信息

B'000'Unspecifiednumberofsegmentsaccepted.

B'001'2segmentsaccepted.

B'010'4segmentsaccepted.

B'011'8segmentsaccepted.

B'100'16segmentsaccepted.

B'101'32segmentsaccepted.

B'110'64segmentsaccepted.

B'111'Greaterthan64segmentsaccepted.

MaxResp:

指出将收到的(APDU)最大长度

B'0000'UptoMinimumMessageSize(50octets)

B'0001'Upto128octets

B'0010'Upto206octets(fitsinaLonTalkframe)

B'0011'Upto480octets(fitsinanARCNETframe)

B'0100'Upto1024octets

B'0101'Upto1476octets(fitsinanISO8802-3frame)

InvokeID:

调用者ID

ServiceChioce:

此处表明次报文的作用,详见BACnetConfirmedServiceChoice

ServiceRequest:

根据BACnetConfirmedServiceChoice不同而结构不同,详见

BACnet-Confirmed-Service-Request

BACnetConfirmedServiceChoice:

:

=枚举类型

{

--AlarmandEventServices

acknowledgeAlarm(0),

confirmedCOVNotification

(1),

confirmedEventNotification

(2),

getAlarmSummary(3),

getEnrollmentSummary(4),

getEventInformation(29),

subscribeCOV(5),

subscribeCOVProperty(28),

lifeSafetyOperation(27),

--FileAccessServices

atomicReadFile(6),

atomicWriteFile(7),

--ObjectAccessServices

addListElement(8),

removeListElement(9),

createObject(10),

deleteObject(11),

readProperty(12),

readPropertyConditional(13),

readPropertyMultiple(14),

readRange(26),

writeProperty(15),

writePropertyMultiple(16),

}

上述标记为红色的表示本次应用中所用到的,所以只对这些进行讲解。

可以根据BACnetConfirmedServiceChoice找到相对应的Request或者Ack的数据的结构

BACnet-Confirmed-Service-Request:

:

=CHOICE

127)OPTIONAL,

--requiredforMS/TPmaster,see

max-info-frames[63]UnsignedOPTIONAL,

--requiredforMS/TPmaster,see

device-address-binding[30]SEQUENCEOFBACnetAddressBinding,

database-revision[155]Unsigned,

configuration-files[154]SEQUENCEOFBACnetObjectIdentifier,

last-restore-time[157]BACnetTimeStamp,

backup-failure-timeout[153]Unsigned16,

active-cov-subscriptions[152]SEQUENCEOFBACnetCOVSubscription,

max-segments-accepted[167]Unsigned,

slave-proxy-enable[172]SEQUENCEOFBOOLEANOPTIONAL,

auto-slave-discovery[169]SEQUENCEOFBOOLEANOPTIONAL,

slave-address-binding[171]SEQUENCEOFBACnetAddressBindingOPTIONAL,

manual-slave-address-binding[170]SEQUENCEOFBACnetAddressBindingOPTIONAL,

profile-name[168]CharacterStringOPTIONAL

}

上述标记为红色者既是本次应用用到的设备属性对象

ANALOG-INPUT:

:

=SEQUENCE

{

object-identifier[75]BACnetObjectIdentifier,

object-name[77]CharacterString,

object-type[79]BACnetObjectType,

present-value[85]REAL,

description[28]CharacterStringOPTIONAL,

device-type[31]CharacterStringOPTIONAL,

status-flags[111]BACnetStatusFlags,

event-state[36]BACnetEventState,

reliability[103]BACnetReliabilityOPTIONAL,

out-of-service[81]BOOLEAN,

update-interval[118]UnsignedOPTIONAL,

units[117]BACnetEngineeringUnits,

min-pres-value[69]REALOPTIONAL,

max-pres-value[65]REALOPTIONAL,

resolution[106]REALOPTIONAL,

cov-increment[22]REALOPTIONAL,

time-delay[113]UnsignedOPTIONAL,

notification-class[17]UnsignedOPTIONAL,

high-limit[45]REALOPTIONAL,

low-limit[59]REALOPTIONAL,

deadband[25]REALOPTIONAL,

limit-enable[52]BACnetLimitEnableOPTIONAL,

event-enable[35]BACnetEventTransitionBitsOPTIONAL,

acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,

notify-type[72]BACnetNotifyTypeOPTIONAL,

event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,

--accessedasaBACnetARRAY

profile-name[168]CharacterStringOPTIONAL

}

ANALOG-OUTPUT:

:

=SEQUENCE

{

object-identifier[75]BACnetObjectIdentifier,

object-name[77]CharacterString,

object-type[79]BACnetObjectType,

present-value[85]REAL,

description[28]CharacterStringOPTIONAL,

device-type[31]CharacterStringOPTIONAL,

status-flags[111]BACnetStatusFlags,

event-state[36]BACnetEventState,

reliability[103]BACnetReliabilityOPTIONAL,

out-of-service[81]BOOLEAN,

units[117]BACnetEngineeringUnits,

min-pres-value[69]REALOPTIONAL,

max-pres-value[65]REALOPTIONAL,

resolution[106]REALOPTIONAL,

priority-array[87]BACnetPriorityArray,

relinquish-default[104]REAL,

cov-increment[22]REALOPTIONAL,

time-delay[113]UnsignedOPTIONAL,

notification-class[17]UnsignedOPTIONAL,

high-limit[45]REALOPTIONAL,

low-limit[59]REALOPTIONAL,

deadband[25]REALOPTIONAL,

limit-enable[52]BACnetLimitEnableOPTIONAL,

event-enable[35]BACnetEventTransitionBitsOPTIONAL,

acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,

notify-type[72]BACnetNotifyTypeOPTIONAL,

event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,

--accessedasaBACnetARRAY

profile-name[168]CharacterStringOPTIONAL

}

ANALOG-VALUE:

:

=SEQUENCE

{

object-identifier[75]BACnetObjectIdentifier,

object-name[77]CharacterString,

object-type[79]BACnetObjectType,

present-value[85]REAL,

description[28]CharacterStringOPTIONAL,

status-flags[111]BACnetStatusFlags,

event-state[36]BACnetEventState,

reliability[103]BACnetReliabilityOPTIONAL,

out-of-service[81]BOOLEAN,

units[117]BACnetEngineeringUnits,

priority-array[87]BACnetPriorityArrayOPTIONAL,

relinqu

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2