1、 3、BACnet NPDU结构.版本信息1 ByteVersion控制字Control目标网络号2 BytesDNET目标网络长度DLEN目标地址可变长度DADR原网络号SNET原网络长度SLEN原地址可变路由数目Hop Count消息类型Message Type卖方IDVendor ID应用层信息版本信息 :默认0x01控制字 :BIT7:1表示Message Type存在,为0时Message Type不存在 BIT6:保存,为0 BIT5:1表示DNET DLEN Hop Count存在,当DLEN为0时说明播送网络DADR不存在;0表示DNET DLEN DADR Hop Count
2、不存在 BIT4: BIT3:1表示SNET SLEN存在,当SLEN为0时说明无效SADR不存在;0表示SNET SLEN SADR Hop Count不存在 BIT2:1表示为一个需确认的请求数据单元,一复杂ACK数据单元或一网络层信息非reply的;0表示除去上述情形的数据单元 BIT1、0:网络优先级 11 = Life Safety message10 = Critical Equipment message01 = Urgent message00 = Normal message目标网络号:FFFF的时候表示播送目标长度: 表示DADR的长度目标地址: 目标网络MAC地址原网络号
3、: 同目标网络号原网络长度:表示SADR的长度原地址: 原网络的MAC地址路由数目: 数据需要经过的路由个数,当不存在DNET的时候,需设置为FF消息类型: X00: Who-Is-Router-To-NetworkX01 I-Am-Router-To-Network02 I-Could-Be-Router-To-Network03 Reject-Message-To-Network04 Router-Busy-To-Network05 Router-Available-To-Network06 Initialize-Routing-Table07 Initialize-Routing-Tab
4、le-Ack08 Establish-Connection-To-Network09 Disconnect-Connection-To-Network0A to X7F Reserved for use by ASHRAE80FF Available for vendor proprietary messages卖方ID: 当控制字的BIT7为1并且消息类型为X的时候,才会存在 本次开发没有用到,不再解释本次应用中控制字只用到0x20和0x04两种,前者为播送查询设备,后者微点对对取设备数据或属性。4、BACnet APDU结构:应用层协议数据单元BACnet网络层数据主要分为一下几种:BAC
5、netPDU := 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-PD
6、U,abort-PDU 7 BACnet-Abort-PDU对于本次应用,主要用到了BACnet-Confirmed-Request-PDU需确认的请求协议数据单元BACnet-Unconfirmed-Request-PDU无需确认的请求协议数据单元BACnet-ComplexACK-PDU复杂的ACK命令BACnet-Error-PDU报错的协议数据单元对于上述几种数据的分类主要根据pdu type下文进行讲解进行判定。4.1. BACnet-Confirmed-Request-PDU的结构:BACnet-Confirmed-Request-PDU := SEQUENCE pdu-type
7、0 Unsigned (0.15), - 0 for this PDU typesegmented-message 1 BOOLEAN,more-follows 2 BOOLEAN,segmented-response-accepted 3 BOOLEAN,reserved 4 Unsigned (0.3), - must be set to zeromax-segments-accepted 5 Unsigned (0.7), - as per .4max-APDU-length-accepted 6 Unsigned (0.15), - as per .5invokeID 7 Unsign
8、ed (0.255),sequence-number 8 Unsigned (0.255) OPTIONAL, - only if segmented msgproposed-window-size 9 Unsigned (1.127) OPTIONAL, - only if segmented msgservice-choice 10 BACnetConfirmedServiceChoice,service-request 11 BACnet-Confirmed-Service-Request OPTIONALBIT7BIT6BIT5BIT4BIT3BIT2BIT1BIT0PDU TYPES
9、EGMORSAMax SegsMax RespInvoke IDSequence Number(only present by SEG=1)Proposed Window Size(only present by SEG=1)Service ChioceService RequestPDU Type 0 (BACnet-Confirmed-Service-Request-PDU)SEG 0 (Unsegmented Request)1 (Segmented Request)MOR 0 (No More Segments Follow)1 (More Segments Follow)SA 0 (
10、Segmented Response not accepted)1 (Segmented Response accepted)Max Segs (0.7) (Number of response segments accepted per .4)Max Resp (0.15) (Size of Maximum APDU accepted per .5)Invoke ID (0.255)Sequence Number (0.255) Only present if SEG = 1Proposed Window Size (1.127) Only present if SEG = 1Service
11、 Choice BACnetConfirmedServiceChoiceService Request Variable EncodingSEG:指出当前的数据单元是否为完整的还是为一局部分段信息MOR:指出是否还有更多的分段信息SA: 为1时指出将收到一个复杂的回应complex ackMax Segs :指出设备将要接收到多少分段信息 B000 Unspecified number of segments accepted.B001 2 segments accepted.010 4 segments accepted.011 8 segments accepted.100 16 segm
12、ents accepted.101 32 segments accepted.110 64 segments accepted.111 Greater than 64 segments accepted.Max Resp:指出将收到的APDU最大长度0000 Up to MinimumMessageSize (50 octets)0001 Up to 128 octets0010 Up to 206 octets (fits in a LonTalk frame)0011 Up to 480 octets (fits in an ARCNET frame)0100 Up to 1024 oct
13、ets0101 Up to 1476 octets (fits in an ISO 8802-3 frame)Invoke ID:调用者IDService Chioce:此处说明次报文的作用,详见BACnetConfirmedServiceChoiceService Request:根据BACnetConfirmedServiceChoice不同而结构不同,详见BACnet-Confirmed-Service-RequestBACnetConfirmedServiceChoice := 枚举类型 - Alarm and Event ServicesacknowledgeAlarm (0),co
14、nfirmedCOVNotification (1),confirmedEventNotification (2),getAlarmSummary (3),getEnrollmentSummary (4),getEventInformation (29),subscribeCOV (5),subscribeCOVProperty (28),lifeSafetyOperation (27),- File Access ServicesatomicReadFile (6),atomicWriteFile (7),- Object Access ServicesaddListElement (8),
15、removeListElement (9),createObject (10),deleteObject (11),readProperty (12),readPropertyConditional (13),readPropertyMultiple (14),readRange (26),writeProperty (15),writePropertyMultiple (16),。上述标记为红色的表示本次应用中所用到的,所以只对这些进行讲解。可以根据BACnetConfirmedServiceChoice找到相对应的Request或者Ack的数据的结构BACnet-Confirmed-Ser
16、vice-Request := CHOICE /对应上面的ChoiceacknowledgeAlarm 0 AcknowledgeAlarm-Request,confirmedCOVNotification 1 ConfirmedCOVNotification-Request,confirmedEventNotification 2 ConfirmedEventNotification-Request,- getAlarmSummary conveys no parametersgetEnrollmentSummary 4 GetEnrollmentSummary-Request,getEve
17、ntInformation 29 GetEventInformation-Request,subscribeCOV 5 SubscribeCOV-Request,subscribeCOVProperty 28 SubscribeCOVProperty-Request,lifeSafetyOperation 27 LifeSafetyOperation-Request,atomicReadFile 6 AtomicReadFile-Request,atomicWriteFile 7 AtomicWriteFile-Request,addListElement 8 AddListElement-R
18、equest,removeListElement 9 RemoveListElement-Request,createObject 10 CreateObject-Request,deleteObject 11 DeleteObject-Request,readProperty 12 ReadProperty-Request,readPropertyConditional 13 ReadPropertyConditional-Request,readPropertyMultiple 14 ReadPropertyMultiple-Request,readRange 26 ReadRange-R
19、equest,writeProperty 15 WriteProperty-Request,writePropertyMultiple 16 WritePropertyMultiple-Request,上述标记为红色的既是针对BACnetConfirmedServiceChoice所用到的数据结构。ReadProperty-Request := SEQUENCE /读数据请求和读数据答复objectIdentifier 0 BACnetObjectIdentifier,propertyIdentifier 1 BACnetPropertyIdentifier,propertyArrayInde
20、x 2 Unsigned OPTIONAL -used only with array datatypeReadPropertyMultiple-Request :listOfReadAccessSpecs SEQUENCE OF ReadAccessSpecificationReadAccessSpecification :objectIdentifier 0 BACnetObjectIdentifier,listOfPropertyReferences 1 SEQUENCE OF BACnetPropertyReferenceBACnetPropertyReference :propert
21、yIdentifier 0 BACnetPropertyIdentifier,propertyArrayIndex 1 Unsigned OPTIONAL -used only with array datatype- if omitted with an array the entire array is referencedBACnetPropertyIdentifier := ENUMERATED accepted-modes (175),acked-transitions (0),ack-required (1),action (2),action-text (3),active-te
22、xt (4),active-vt-sessions (5),active-cov-subscriptions (152),adjust-value (176),alarm-value (6),alarm-values (7),all (8),all-writes-successful (9),apdu-segment-timeout (10),apdu-timeout (11),application-software-version (12),firmware-revision (44),archive (13),attempted-samples (124),list-of-group-m
23、embers (53),list-of-object-property-references (54),list-of-session-keys (55),local-date (56),local-time (57),location (58),maintenance-required (158),manipulated-variable-reference (60),manual-slave-address-binding (170),maximum-output (61),maximum-value (135),maximum-value-timestamp (149),max-apdu
24、-length-accepted (62),max-info-frames (63),max-master (64),max-pres-value (65),max-segments-accepted (167),member-of (159),minimum-off-time (66),minimum-on-time (67),minimum-output (68),event-state (36),model-name (70),number-of-APDU-retries (73),object-identifier (75),object-list (76),object-name (
25、77),object-property-reference (78),object-type (79),operation-expected (161),optional (80),out-of-service (81),output-units (82),- see event-parameters (83),polarity (84),prescale (185),present-value (85),priority (86),pulse-rate (186),priority-array (87),priority-for-writing (88),protocol-object-types-supported (96),protocol-revision (139),protocol-services-supported (97),protoco
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1