Login
升级VIP 登录 注册 安全退出
当前位置: 首页 > word文档 > 其他文档 > BACnet通讯分析,bacnet报文分析

BACnet通讯分析,bacnet报文分析

收藏

本作品内容为BACnet通讯分析,格式为 doc ,大小 283176 KB ,页数为 36页

BACnet通讯分析


('BACnet通讯1、概述.系统实现基于BACnet/IP(又称B/IP)网络进行通讯。BACnet虚拟链路层(BVLL)提供了BACnet网络层和某指定的通讯子系统的接口,本文指定了BACnet虚拟链路控制(BVLC)要求支持的定向和广播信息。本实现关于BACnet协议定义主要可分为三层:B/IP网络虚拟层,BACnet网络层和BACnet应用层。B/IP提供了TCP/IP一样的通讯结构,采用UDP的通讯方式。本文接下来将对此三层结构进行详细的讲解。其文本协议的大致格式如下:BACnet/IPBACnet网络层BACnet应用层BVLCTypeBVLCFunctionLengthNPDUAPDUNPDU:BACnet网络层数据结构,下文进行详细的讲解APDU:BACnet应用层数据结构,下文进行详细的讲解2、BACnet/IP.BVLCType:0x81,代表BACnet/IP网络BVLCFunction:指定报文的类型,何种作用;本应用使用的报文类型分为两种:0A:点对点通讯0B:广播通信Length:指定报文的长度,包括BVLCType、BVLCFunction以及本身在内NPDU:根据不同情况,报文长短不同,见下文的解析。APDU:根据NPDU不同以及不同的请求,报文不同,见下文的解析。3、BACnetNPDU结构.版本信息1ByteVersion控制字1ByteControl目标网络号2BytesDNET目标网络长度1ByteDLEN目标地址可变长度DADR原网络号2BytesSNET原网络长度1ByteSLEN原地址可变SNET路由数目1ByteHopCount消息类型1ByteMessageType卖方ID2BytesVendorID应用层信息可变APDU版本信息:默认0x01控制字:BIT7:1表示MessageType存在,为0时MessageType不存在BIT6:保留,为0BIT5:1表示DNETDLENHopCount存在,当DLEN为0时表明广播网络DADR不存在;0表示DNETDLENDADRHopCount不存在BIT4:保留,为0BIT3:1表示SNETSLEN存在,当SLEN为0时表明无效SADR不存在;0表示SNETSLENSADRHopCount不存在BIT2:1表示为一个需确认的请求数据单元,一复杂ACK数据单元或一网络层信息非reply的;0表示除去上述情形的数据单元BIT1、0:网络优先级11=LifeSafetymessage10=CriticalEquipmentmessage01=Urgentmessage00=Normalmessage目标网络号:FFFF的时候表示广播目标长度:表示DADR的长度目标地址:目标网络MAC地址原网络号:同目标网络号原网络长度:表示SADR的长度原地址:原网络的MAC地址路由数目:数据需要经过的路由个数,当不存在DNET的时候,需设置为FF消息类型:X\'00\':Who-Is-Router-To-NetworkX\'01\':I-Am-Router-To-NetworkX\'02\':I-Could-Be-Router-To-NetworkX\'03\':Reject-Message-To-NetworkX\'04\':Router-Busy-To-NetworkX\'05\':Router-Available-To-NetworkX\'06\':Initialize-Routing-TableX\'07\':Initialize-Routing-Table-AckX\'08\':Establish-Connection-To-NetworkX\'09\':Disconnect-Connection-To-NetworkX\'0A\'toX\'7F\':ReservedforusebyASHRAEX\'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(下文进行讲解)进行判定。4.1.BACnet-Confirmed-Request-PDU的结构:BACnet-Confirmed-Request-PDU::=SEQUENCE{pdu-type[0]Unsigned(0..15),--0forthisPDUtypesegmented-message[1]BOOLEAN,more-follows[2]BOOLEAN,segmented-response-accepted[3]BOOLEAN,reserved[4]Unsigned(0..3),--mustbesettozeromax-segments-accepted[5]Unsigned(0..7),--asper20.1.2.4max-APDU-length-accepted[6]Unsigned(0..15),--asper20.1.2.5invokeID[7]Unsigned(0..255),sequence-number[8]Unsigned(0..255)OPTIONAL,--onlyifsegmentedmsgproposed-window-size[9]Unsigned(1..127)OPTIONAL,--onlyifsegmentedmsgservice-choice[10]BACnetConfirmedServiceChoice,service-request[11]BACnet-Confirmed-Service-RequestOPTIONAL}BIT7BIT6BIT5BIT4BIT3BIT2BIT1BIT0PDUTYPESEGMORSA00MaxSegsMaxRespInvokeIDSequenceNumber(onlypresentbySEG==1)ProposedWindowSize(onlypresentbySEG==1)ServiceChioceServiceRequest……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=1ProposedWindowSize(1..127)OnlypresentifSEG=1ServiceChoiceBACnetConfirmedServiceChoiceServiceRequestVariableEncodingSEG:指出当前的数据单元是否为完整的还是为一部分分段信息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\'Upto128octetsB\'0010\'Upto206octets(fitsinaLonTalkframe)B\'0011\'Upto480octets(fitsinanARCNETframe)B\'0100\'Upto1024octetsB\'0101\'Upto1476octets(fitsinanISO8802-3frame)InvokeID:调用者IDServiceChioce:此处表明次报文的作用,详见BACnetConfirmedServiceChoiceServiceRequest:根据BACnetConfirmedServiceChoice不同而结构不同,详见BACnet-Confirmed-Service-RequestBACnetConfirmedServiceChoice::=枚举类型{--AlarmandEventServicesacknowledgeAlarm(0),confirmedCOVNotification(1),confirmedEventNotification(2),getAlarmSummary(3),getEnrollmentSummary(4),getEventInformation(29),subscribeCOV(5),subscribeCOVProperty(28),lifeSafetyOperation(27),--FileAccessServicesatomicReadFile(6),atomicWriteFile(7),--ObjectAccessServicesaddListElement(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//对应上面的Choice{--AlarmandEventServicesacknowledgeAlarm[0]AcknowledgeAlarm-Request,confirmedCOVNotification[1]ConfirmedCOVNotification-Request,confirmedEventNotification[2]ConfirmedEventNotification-Request,--getAlarmSummaryconveysnoparametersgetEnrollmentSummary[4]GetEnrollmentSummary-Request,getEventInformation[29]GetEventInformation-Request,subscribeCOV[5]SubscribeCOV-Request,subscribeCOVProperty[28]SubscribeCOVProperty-Request,lifeSafetyOperation[27]LifeSafetyOperation-Request,--FileAccessServicesatomicReadFile[6]AtomicReadFile-Request,atomicWriteFile[7]AtomicWriteFile-Request,--ObjectAccessServicesaddListElement[8]AddListElement-Request,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-Request,writeProperty[15]WriteProperty-Request,writePropertyMultiple[16]WritePropertyMultiple-Request,。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。}上述标记为红色的既是针对BACnetConfirmedServiceChoice所用到的数据结构。ReadProperty-Request::=SEQUENCE//读数据请求和读数据回答{objectIdentifier[0]BACnetObjectIdentifier,propertyIdentifier[1]BACnetPropertyIdentifier,propertyArrayIndex[2]UnsignedOPTIONAL--usedonlywitharraydatatype}ReadPropertyMultiple-Request::=SEQUENCE{listOfReadAccessSpecsSEQUENCEOFReadAccessSpecification}ReadAccessSpecification::=SEQUENCE{objectIdentifier[0]BACnetObjectIdentifier,listOfPropertyReferences[1]SEQUENCEOFBACnetPropertyReference}BACnetPropertyReference::=SEQUENCE{propertyIdentifier[0]BACnetPropertyIdentifier,propertyArrayIndex[1]UnsignedOPTIONAL--usedonlywitharraydatatype--ifomittedwithanarraytheentirearrayisreferenced}BACnetPropertyIdentifier::=ENUMERATED{accepted-modes(175),acked-transitions(0),ack-required(1),action(2),action-text(3),active-text(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-members(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-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(77),object-property-reference(78),object-type(79),operation-expected(161),optional(80),out-of-service(81),output-units(82),--seeevent-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),protocol-version(98),reliability(103),relinquish-default(104),schedule-default(174),segmentation-supported(107),state-text(110),status-flags(111),stop-time(143),stop-when-full(144),system-status(112),tracking-value(164),units(117),variance-value(151),vendor-identifier(120),vendor-name(121),--seedatabase-revision(155),}上述标记为红色者既是本次应用所用到的属性对象BACnetObjectIdentifier的编码分为两个部分:ObjecttypeInstanceNumber占用了10Bits占用了22BitsObjectType的表格如下:BACnetObjectTypesSupported::=BITSTRING{--accumulator(23),analog-input(0),analog-output(1),analog-value(2),--averaging(18),binary-input(3),binary-output(4),binary-value(5),calendar(6),command(7),device(8),event-enrollment(9),file(10),group(11),loop(12),multi-state-input(13),multi-state-output(14),--multi-state-value(19),notification-class(15),program(16),}设备对象所具备的所有属性及其数据结构如下:DEVICE::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,system-status[112]BACnetDeviceStatus,vendor-name[121]CharacterString,vendor-identifier[120]Unsigned16,model-name[70]CharacterString,firmware-revision[44]CharacterString,application-software-version[12]CharacterString,location[58]CharacterStringOPTIONAL,description[28]CharacterStringOPTIONAL,protocol-version[98]Unsigned,protocol-revision[139]Unsigned,protocol-services-supported[97]BACnetServicesSupported,protocol-object-types-supported[96]BACnetObjectTypesSupported,object-list[76]SEQUENCEOFBACnetObjectIdentifier,--accessedasaBACnetARRAYmax-APDU-length-supported[62]Unsigned,segmentation-supported[107]BACnetSegmentation,vt-classes-supported[122]SEQUENCEOFBACnetVTClassOPTIONAL,active-vt-sessions[5]SEQUENCEOFBACnetVTSessionOPTIONAL,local-time[57]TimeOPTIONAL,local-date[56]DateOPTIONAL,utc-offset[119]INTEGEROPTIONAL,daylight-savings-status[24]BOOLEANOPTIONAL,apdu-segment-timeout[10]Unsigned,apdu-timeout[11]Unsigned,number-of-APDU-retries[73]Unsigned,list-of-session-keys[55]SEQUENCEOFBACnetSessionKeyOPTIONAL,time-synchronization-recipients[116]SEQUENCEOFBACnetRecipientOPTIONAL,--requiredfortimemastermax-master[64]Unsigned(1..127)OPTIONAL,--requiredforMS/TPmaster,see12.11max-info-frames[63]UnsignedOPTIONAL,--requiredforMS/TPmaster,see12.11device-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,--accessedasaBACnetARRAYprofile-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,--accessedasaBACnetARRAYprofile-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,relinquish-default[104]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,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}BINARY-INPUT::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,present-value[85]BACnetBinaryPV,description[28]CharacterStringOPTIONAL,device-type[31]CharacterStringOPTIONAL,status-flags[111]BACnetStatusFlags,event-state[36]BACnetEventState,reliability[103]BACnetReliabilityOPTIONAL,out-of-service[81]BOOLEAN,polarity[84]BACnetPolarity,inactive-text[46]CharacterStringOPTIONAL,active-text[4]CharacterStringOPTIONAL,change-of-state-time[16]BACnetDateTimeOPTIONAL,change-of-state-count[15]UnsignedOPTIONAL,time-of-state-count-reset[115]BACnetDateTimeOPTIONAL,elapsed-active-time[33]Unsigned32OPTIONAL,time-of-active-time-reset[114]BACnetDateTimeOPTIONAL,time-delay[113]UnsignedOPTIONAL,notification-class[17]UnsignedOPTIONAL,alarm-value[6]BACnetBinaryPVOPTIONAL,event-enable[35]BACnetEventTransitionBitsOPTIONAL,acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,notify-type[72]BACnetNotifyTypeOPTIONAL,event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}BINARY-OUTPUT::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,present-value[85]BACnetBinaryPV,description[28]CharacterStringOPTIONAL,device-type[31]CharacterStringOPTIONAL,status-flags[111]BACnetStatusFlags,event-state[36]BACnetEventState,reliability[103]BACnetReliabilityOPTIONAL,out-of-service[81]BOOLEAN,polarity[84]BACnetPolarity,inactive-text[46]CharacterStringOPTIONAL,active-text[4]CharacterStringOPTIONAL,change-of-state-time[16]BACnetDateTimeOPTIONAL,change-of-state-count[15]UnsignedOPTIONAL,time-of-state-count-reset[115]BACnetDateTimeOPTIONAL,elapsed-active-time[33]Unsigned32OPTIONAL,time-of-active-time-reset[114]BACnetDateTimeOPTIONAL,minimum-off-time[66]Unsigned32OPTIONAL,minimum-on-time[67]Unsigned32OPTIONAL,priority-array[87]BACnetPriorityArray,relinquish-default[104]BACnetBinaryPV,time-delay[113]UnsignedOPTIONAL,notification-class[17]UnsignedOPTIONAL,feedback-value[40]BACnetBinaryPVOPTIONAL,event-enable[35]BACnetEventTransitionBitsOPTIONAL,acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,notify-type[72]BACnetNotifyTypeOPTIONAL,event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}BINARY-VALUE::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,present-value[85]BACnetBinaryPV,description[28]CharacterStringOPTIONAL,status-flags[111]BACnetStatusFlags,event-state[36]BACnetEventState,reliability[103]BACnetReliabilityOPTIONAL,out-of-service[81]BOOLEAN,inactive-text[46]CharacterStringOPTIONAL,active-text[4]CharacterStringOPTIONAL,change-of-state-time[16]BACnetDateTimeOPTIONAL,change-of-state-count[15]UnsignedOPTIONAL,time-of-state-count-reset[115]BACnetDateTimeOPTIONAL,elapsed-active-time[33]Unsigned32OPTIONAL,time-of-active-time-reset[114]BACnetDateTimeOPTIONAL,minimum-off-time[66]Unsigned32OPTIONAL,minimum-on-time[67]Unsigned32OPTIONAL,priority-array[87]BACnetPriorityArrayOPTIONAL,relinquish-default[104]BACnetBinaryPVOPTIONAL,time-delay[113]UnsignedOPTIONAL,notification-class[17]UnsignedOPTIONAL,alarm-value[6]BACnetBinaryPVOPTIONAL,event-enable[35]BACnetEventTransitionBitsOPTIONAL,acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,notify-type[72]BACnetNotifyTypeOPTIONAL,event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}MULTI-STATE-INPUT::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,present-value[85]Unsigned,--maximumvalueisrestrictedbythenumber-of-statesdescription[28]CharacterStringOPTIONAL,device-type[31]CharacterStringOPTIONAL,status-flags[111]BACnetStatusFlags,event-state[36]BACnetEventState,reliability[103]BACnetReliabilityOPTIONAL,out-of-service[81]BOOLEAN,number-of-states[74]Unsigned,state-text[110]SEQUENCEOFCharacterStringOPTIONAL,--accessedasaBACnetARRAYtime-delay[113]UnsignedOPTIONAL,notification-class[17]UnsignedOPTIONAL,alarm-values[7]SEQUENCEOFUnsignedOPTIONAL,fault-values[39]SEQUENCEOFUnsignedOPTIONAL,event-enable[35]BACnetEventTransitionBitsOPTIONAL,acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,notify-type[72]BACnetNotifyTypeOPTIONAL,event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}MULTI-STATE-OUTPUT::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,present-value[85]Unsigned,--maximumvalueisrestrictedbythenumber-of-statesdescription[28]CharacterStringOPTIONAL,device-type[31]CharacterStringOPTIONAL,status-flags[111]BACnetStatusFlags,event-state[36]BACnetEventState,reliability[103]BACnetReliabilityOPTIONAL,out-of-service[81]BOOLEAN,number-of-states[74]Unsigned,state-text[110]SEQUENCEOFCharacterStringOPTIONAL,--accessedasaBACnetARRAYpriority-array[87]BACnetPriorityArray,relinquish-default[104]Unsigned,time-delay[113]UnsignedOPTIONAL,notification-class[17]UnsignedOPTIONAL,feedback-value[40]UnsignedOPTIONAL,event-enable[35]BACnetEventTransitionBitsOPTIONAL,acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,notify-type[72]BACnetNotifyTypeOPTIONAL,event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}MULTI-STATE-VALUE::=SEQUENCE{object-identifier[75]BACnetObjectIdentifier,object-name[77]CharacterString,object-type[79]BACnetObjectType,present-value[85]Unsigned,--maximumvalueisrestrictedbythenumber-of-statesdescription[28]CharacterStringOPTIONAL,status-flags[111]BACnetStatusFlags,event-state[36]BACnetEventState,reliability[103]BACnetReliabilityOPTIONAL,out-of-service[81]BOOLEAN,number-of-states[74]Unsigned,state-text[110]SEQUENCEOFCharacterStringOPTIONAL,--accessedasaBACnetARRAYpriority-array[87]BACnetPriorityArrayOPTIONAL,relinquish-default[104]UnsignedOPTIONAL,time-delay[113]UnsignedOPTIONAL,notification-class[17]UnsignedOPTIONAL,alarm-values[7]SEQUENCEOFUnsignedOPTIONAL,fault-values[39]SEQUENCEOFUnsignedOPTIONAL,event-enable[35]BACnetEventTransitionBitsOPTIONAL,acked-transitions[0]BACnetEventTransitionBitsOPTIONAL,notify-type[72]BACnetNotifyTypeOPTIONAL,event-time-stamps[130]SEQUENCEOFBACnetTimeStampOPTIONAL,--accessedasaBACnetARRAYprofile-name[168]CharacterStringOPTIONAL}BACnetObjectType::=ENUMERATED{accumulator(23),analog-input(0),analog-output(1),analog-value(2),averaging(18),binary-input(3),binary-output(4),binary-value(5),calendar(6),command(7),device(8),event-enrollment(9),file(10),group(11),life-safety-point(21),life-safety-zone(22),loop(12),multi-state-input(13),multi-state-output(14),multi-state-value(19),notification-class(15),program(16),pulse-converter(24),schedule(17),--seeaveraging(18),--seemulti-state-value(19),trend-log(20),--seelife-safety-point(21),--seelife-safety-zone(22),--seeaccumulator(23),--seepulse-converter(24),}上述标记为红色者即为本次应用所用到的对象类型BACnetAddressBinding::=SEQUENCE{deviceObjectIdentifierBACnetObjectIdentifier,deviceAddressBACnetAddress}BACnetAddress::=SEQUENCE{network-numberUnsigned16,--Avalueof0indicatesthelocalnetworkmac-addressOCTETSTRING--Astringoflength0indicatesabroadcast}priority-array的类型结构解释:BACnetPriorityArray::=SEQUENCESIZE(16)OFBACnetPriorityValue--accessedasaBACnetARRAYBACnetPriorityValue::=CHOICE{nullNULL,realREAL,binaryBACnetBinaryPV,integerUnsigned,constructedValue[0]ABSTRACT-SYNTAX.&Type}relinquish-default的结构BACnetBinaryPV::=ENUMERATED{inactive(0),active(1)}status-flags的类型结构:BACnetStatusFlags::=BITSTRING{in-alarm(0),fault(1),overridden(2),out-of-service(3)}Reliability的类型结构:BACnetReliability::=ENUMERATED{no-fault-detected(0),no-sensor(1),over-range(2),under-range(3),open-loop(4),shorted-loop(5),no-output(6),unreliable-other(7),process-error(8),multi-state-fault(9),configuration-error(10),}system-status的类型结构:BACnetDeviceStatus::=ENUMERATED{operational(0),operational-read-only(1),download-required(2),download-in-progress(3),non-operational(4),backup-in-progress(5),}Units的解释说明如下:BACnetEngineeringUnits::=ENUMERATED{--Electricalmilliamperes(2),amperes(3),amperes-per-meter(167),amperes-per-square-meter(168),ampere-square-meters(169),farads(170),henrys(171),ohms(4),ohm-meters(172),milliohms(145),kilohms(122),megohms(123),siemens(173),--1mhoequals1siemenssiemens-per-meter(174),teslas(175),volts(5),millivolts(124),kilovolts(6),megavolts(7),volt-amperes(8),kilovolt-amperes(9),megavolt-amperes(10),volt-amperes-reactive(11),kilovolt-amperes-reactive(12),megavolt-amperes-reactive(13),volts-per-degree-Kelvin(176),volts-per-meter(177),degrees-phase(14),power-factor(15),webers(178),--Energyjoules(16),kilojoules(17),kilojoules-per-kilogram(125),megajoules(126),watt-hours(18),kilowatt-hours(19),megawatt-hours(146),btus(20),kilo-btus(147),mega-btus(148),therms(21),ton-hours(22),--Frequencycycles-per-hour(25),cycles-per-minute(26),hertz(27),kilohertz(129),megahertz(130),per-hour(131),--Powermilliwatts(132),watts(47),kilowatts(48),megawatts(49),btus-per-hour(50),kilo-btus-per-hour(157),horsepower(51),tons-refrigeration(52),--Temperaturedegrees-Celsius(62),degrees-Kelvin(63),degrees-Kelvin-per-hour(181),degrees-Kelvin-per-minute(182),degrees-Fahrenheit(64),degree-days-Celsius(65),degree-days-Fahrenheit(66),delta-degrees-Fahrenheit(120),delta-degrees-Kelvin(121),--Timeyears(67),months(68),weeks(69),days(70),hours(71),minutes(72),seconds(73),hundredths-seconds(158),milliseconds(159),--Otherdegrees-angular(90),degrees-Celsius-per-hour(91),degrees-Celsius-per-minute(92),degrees-Fahrenheit-per-hour(93),degrees-Fahrenheit-per-minute(94),joule-seconds(183),kilograms-per-cubic-meter(186),kilowatt-hours-per-square-meter(137),kilowatt-hours-per-square-foot(138),megajoules-per-square-meter(139),megajoules-per-square-foot(140),no-units(95),newton-seconds(187),newtons-per-meter(188),parts-per-million(96),parts-per-billion(97),percent(98),percent-obscuration-per-foot(143),percent-obscuration-per-meter(144),percent-per-second(99),per-minute(100),per-second(101),psi-per-degree-Fahrenheit(102),radians(103),radians-per-second(184),revolutions-per-minute(104),square-meters-per-Newton(185),watts-per-meter-per-degree-Kelvin(189),watts-per-square-meter-degree-kelvin(141)}event-state的结构如下:BACnetEventState::=ENUMERATED{normal(0),fault(1),offnormal(2),high-limit(3),low-limit(4),life-safety-alarm(5),}protocol-services-supported的结构如下:BACnetServicesSupported::=BITSTRING{--AlarmandEventServicesacknowledgeAlarm(0),confirmedCOVNotification(1),confirmedEventNotification(2),getAlarmSummary(3),getEnrollmentSummary(4),--getEventInformation(39),subscribeCOV(5),--subscribeCOVProperty(38),--lifeSafetyOperation(37),--FileAccessServicesatomicReadFile(6),atomicWriteFile(7),--ObjectAccessServicesaddListElement(8),removeListElement(9),createObject(10),deleteObject(11),readProperty(12),readPropertyConditional(13),readPropertyMultiple(14),--readRange(35),writeProperty(15),writePropertyMultiple(16),--RemoteDeviceManagementServicesdeviceCommunicationControl(17),confirmedPrivateTransfer(18),confirmedTextMessage(19),reinitializeDevice(20),--VirtualTerminalServicesvtOpen(21),vtClose(22),vtData(23),--SecurityServicesauthenticate(24),requestKey(25),--UnconfirmedServicesi-Am(26),i-Have(27),unconfirmedCOVNotification(28),unconfirmedEventNotification(29),unconfirmedPrivateTransfer(30),unconfirmedTextMessage(31),timeSynchronization(32),--utcTimeSynchronization(36),who-Has(33),who-Is(34),}BACnetSegmentation::=ENUMERATED{segmented-both(0),segmented-transmit(1),segmented-receive(2),no-segmentation(3)}4.2.BACnet-Unconfirmed-Request-PDU结构:BACnet-Unconfirmed-Request-PDU::=SEQUENCE{pdu-type[0]Unsigned(0..15),--1forthisPDUtypereserved[1]Unsigned(0..15),--mustbesettozeroservice-choice[2]BACnetUnconfirmedServiceChoice,service-request[3]BACnet-Unconfirmed-Service-Request}BIT7BIT6BIT5BIT4BIT3BIT2BIT1BIT0PDUTYPEReservedServiceChioceServiceRequestPDUTYPE:1ServiceChioce:详见BACnetUnconfirmedServiceChoiceServiceRequest:根据BACnetConfirmedServiceChoice不同而结构不同,详见BACnet-Unconfirmed-Service-Request其它同上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)}BACnet-Unconfirmed-Service-Request::=CHOICE{i-Am[0]I-Am-Request,i-Have[1]I-Have-Request,unconfirmedCOVNotification[2]UnconfirmedCOVNotification-Request,unconfirmedEventNotification[3]UnconfirmedEventNotification-Request,unconfirmedPrivateTransfer[4]UnconfirmedPrivateTransfer-Request,unconfirmedTextMessage[5]UnconfirmedTextMessage-Request,timeSynchronization[6]TimeSynchronization-Request,who-Has[7]Who-Has-Request,who-Is[8]Who-Is-Request,utcTimeSynchronization[9]UTCTimeSynchronization-Request}I-Am-Request::=SEQUENCE{iAmDeviceIdentifierBACnetObjectIdentifier,maxAPDULengthAcceptedUnsigned,segmentationSupportedBACnetSegmentation,vendorIDUnsigned}Who-Is-Request::=SEQUENCEdeviceInstanceRangeLowLimit[0]Unsigned(0..4194303)OPTIONALdeviceInstanceRangeHighLimit[1]Unsigned(0..4194303)OPTIONAL}deviceInstanceRangeLowLimit:下限(3octor)deviceInstanceRangeHighLimit:上限(3octor)4.3.BACnet-ComplexACK-PDU结构:BACnet-ComplexACK-PDU::=SEQUENCE{pdu-type[0]Unsigned(0..15),--3forthisPDUtypesegmented-message[1]BOOLEAN,more-follows[2]BOOLEAN,reserved[3]Unsigned(0..3),--mustbesettozeroinvokeID[4]Unsigned(0..255),sequence-number[5]Unsigned(0..255)OPTIONAL,--onlyifsegmentproposed-window-size[6]Unsigned(1..127)OPTIONAL,--onlyifsegmentservice-ACK-choice[7]BACnetConfirmedServiceChoice,service-ACK[8]BACnet-Confirmed-Service-ACK}BIT7BIT6BIT5BIT4BIT3BIT2BIT1BIT0PDUTYPESEGMOR0OriginalInvokeIDSequenceNumber(onlypresentbySEG==1)ProposedWindowSize(onlypresentbySEG==1)ServiceAckChioceServiceACKPDUTYPE:1ServiceAckChioce:详见BACnetConfirmedServiceChoiceServiceACK:根据BACnetConfirmedServiceChoice不同而结构不同,详见BACnet-Confirmed-Service-ACK其它同上BACnet-Confirmed-Service-ACK::=CHOICE{--AlarmandEventServicesgetAlarmSummary[3]GetAlarmSummary-ACK,getEnrollmentSummary[4]GetEnrollmentSummary-ACK,getEventInformation[29]GetEventInformation-ACK,--FileAccessServicesatomicReadFile[6]AtomicReadFile-ACK,atomicWriteFile[7]AtomicWriteFile-ACK,--ObjectAccessServicescreateObject[10]CreateObject-ACK,readProperty[12]ReadProperty-ACK,readPropertyConditional[13]ReadPropertyConditional-ACK,readPropertyMultiple[14]ReadPropertyMultiple-ACK,readRange[26]ReadRange-ACK,--RemoteDeviceManagementServicesconfirmedPrivateTransfer[18]ConfirmedPrivateTransfer-ACK,--VirtualTerminalServicesvtOpen[21]VT-Open-ACK,vtData[23]VT-Data-ACK,--SecurityServicesauthenticate[24]Authenticate-ACK}ReadProperty-ACK::=SEQUENCE{objectIdentifier[0]BACnetObjectIdentifier,propertyIdentifier[1]BACnetPropertyIdentifier,propertyArrayIndex[2]UnsignedOPTIONAL,--usedonlywitharraydatatypepropertyValue[3]ABSTRACT-SYNTAX.&Type}ReadPropertyMultiple-ACK::=SEQUENCE{listOfReadAccessResultSEQUENCEOFReadAccessResult}ReadAccessResult::=SEQUENCE{objectIdentifier[0]BACnetObjectIdentifier,listOfResults[1]SEQUENCEOFSEQUENCE{propertyIdentifier[2]BACnetPropertyIdentifier,propertyArrayIndex[3]UnsignedOPTIONALreadResultCHOICE{propertyValue[4]ABSTRACT-SYNTAX.&Type,propertyAccessError[5]Error}}OPTIONAL}4.4.BACnet-Error-PDU结构:BACnet-Error-PDU::=SEQUENCE{pdu-type[0]Unsigned(0..15),--5forthisPDUtypereserved[1]Unsigned(0..15),--mustbesettozerooriginal-invokeID[2]Unsigned(0..255),error-choice[3]BACnetConfirmedServiceChoice,error[4]BACnet-Error}BIT7BIT6BIT5BIT4BIT3BIT2BIT1BIT0PDUTYPE0OriginalInvokeIDErrorChoiceError。。。。PDUTYPE:5OriginalInvokeID:调用者IDErrorChioce:详见BACnetConfirmedServiceChioceError:根据ErrorChioce不同而不同,详见BACnet-ErrorBACnet-Error::=CHOICE{other[127]Error,--AlarmandEventServicesacknowledgeAlarm[0]Error,confirmedCOVNotification[1]Error,confirmedEventNotification[2]Error,getAlarmSummary[3]Error,。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。--ObjectAccessServicesaddListElement[8]ChangeList-Error,removeListElement[9]ChangeList-Error,createObject[10]CreateObject-Error,deleteObject[11]Error,readProperty[12]Error,readPropertyConditional[13]Error,readPropertyMultiple[14]Error,readRange[26]Error,writeProperty[15]Error,writePropertyMultiple[16]WritePropertyMultiple-Error,--RemoteDeviceManagementServicesdeviceCommunicationControl[17]Error,confirmedPrivateTransfer[18]ConfirmedPrivateTransfer-Error,confirmedTextMessage[19]Error,。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。}Error::=SEQUENCE{error-classENUMERATED{device(0),object(1),property(2),resources(3),security(4),services(5),vt(6),},error-codeENUMERATED{other(0),authentication-failed(1),character-set-not-supported(41),invalid-array-index(42),invalid-configuration-data(46),invalid-data-type(9),unknown-property(32),}}5、BACnetAPDU可变部分的编码这部分的数据编码通常分为两个部分:数据类型描述部分和数据部分。描述部分主要描述接下来的数据是什么类型,如何编码,所占长度等信息;关于这部分需要详细的说明如下:首先描述部分含有一个Tags,主要分为两类:应用Tag和上下文Tag,前者的结构如下:BIT7---BIT4Bit3Bit2—Bit0TagnumberClassLength/Value/TypeTagnumber:指出了数据的类型(0-14只占据4位数据,当高四位置为‘1111’时表示接下来的一个字节作为Tag的描述)Class:0时表示数据位应用数据类型,1表示上下文数据类型;此种情况下TagNumber为上下文TagLength/Value/Type:当(0-4)时表示数据的长度,当为’101’时表示后边的octor代表数据的长度.如果为’110’表示为一个openingtag,那么必然需要一个closeingTag(‘111’)Applicationtags:0:NULL1:Boolean2:unsignedinteger3:signedinterger4:Real(ASNSI/IEEE-754)5:Double(ANSI/IEEE-754doubleprecisionfloatingpoint)6:octorstring7:Characterstring8:Bitstring9:Enumerated10:Date11:Time12:BACnetObjectIdentifierContext-specialtags:含有一个contexttag如其位于结构中的第一个contexttag则为1,第二个contexttag则为2Example:Application-taggednullvalueASN.1=NULLApplicationTag=Null(TagNumber=0)EncodedTag=X\'00\'Example:Application-taggedBooleanvalue(Boolean编码在一个字节中)ASN.1=BOOLEANValue=FALSEApplicationTag=Boolean(TagNumber=1)EncodedTag=X\'10\'Example:Context-taggedBooleanvalue(上下文Boolean的编码)ASN.1=[2]BOOLEANValue=TRUEContextTag=2EncodedTag=X\'29\'EncodedData=X\'01\'Example:Application-taggedunsignedintegerASN.1=UnsignedValue=72ApplicationTag=UnsignedInteger(TagNumber=2)EncodedTag=X\'21\'EncodedData=X\'48\'Example:Application-taggedsignedintegerASN.1=INTEGERValue=72ApplicationTag=SignedInteger(TagNumber=3)EncodedTag=X\'31\'EncodedData=X\'48\'Example:Application-taggedsingleprecisionrealASN.1=REALValue=72.0ApplicationTag=Real(TagNumber=4)EncodedTag=X\'44\'EncodedData=X\'42900000\'Example:Application-taggeddoubleprecisionreal(双精度占用8字节)ASN.1=DoubleValue=72.0ApplicationTag=Double(TagNumber=5)EncodedTag=X\'55\'ExtendedLength=X\'08\'EncodedData=X\'4052000000000000\'Example:Application-taggedoctetstringASN.1=OCTETSTRINGValue=X\'1234FF\'ApplicationTag=OctetString(TagNumber=6)EncodedTag=X\'63\'EncodedData=X\'1234FF\'Theinitialoctetshallspecifythecharactersetwiththefollowingencoding:X\'00\'ANSIX3.4X\'01\'IBM™/Microsoft™DBCSX\'02\'JISC6226X\'03\'ISO10646(UCS-4)X\'04\'ISO10646(UCS-2)X\'05\'ISO8859-1Example:Application-taggedcharacterstringASN.1=CharacterStringValue="ThisisaBACnetstring!"(ANSIX3.4)ApplicationTag=CharacterString(TagNumber=7)EncodedTag=X\'75\'LengthExtension=X\'19\'CharacterSet=X\'00\'(ANSIX3.4)EncodedData=X\'546869732069732061204241436E657420737472696E6721\'Example:Application-taggedcharacterstring(DBCS)ASN.1=CharacterStringValue="ThisisaBACnetString!"(IBM/MicrosoftDBCS,codepage850)ApplicationTag=CharacterString(TagNumber=7)EncodedTag=X\'75\'LengthExtension=X\'1B\'EncodedData=X\'010352546869732069732061204241436E657420737472696E6721\'不再举例,本程序使用(ANSIX3.4)类型的字符串编码Example:Application-taggedbitstringASN.1=BITSTRINGValue=B\'10101\'ApplicationTag=BitString(TagNumber=8)EncodedTag=X\'82\'EncodedData=X\'03A8\'Example:Application-taggedenumerationASN.1=BACnetObjectTypeValue=ANALOG-INPUT(0)ApplicationTag=Enumerated(TagNumber=9)EncodedTag=X\'91\'EncodedData=X\'00\'Example:Application-taggeddatevalueASN.1=DateValue=January24,1991(Dayofweek=Thursday)ApplicationTag=Date(TagNumber=10)EncodedTag=X\'A4\'EncodedData=X\'5B011804\'Example:Application-taggedtimevalueASN.1=TimeValue=5:35:45.17P.M.=17:35:45.17ApplicationTag=Time(TagNumber=11)EncodedTag=X\'B4\'EncodedData=X\'11232D11\'Example:Application-taggedobjectidentifiervalueASN.1=ObjectIdentifierValue=(BinaryInput,15)ApplicationTag=ObjectIdentifier(TagNumber=12)EncodedTag=X\'C4\'EncodedData=X\'00C0000F\'Context-specialtags:Example:Context-taggednullvalueASN.1=[3]NULLContextTag=3EncodedTag=X\'38\'Example:Context-taggedBooleanvalueASN.1=[6]BOOLEANValue=FALSEContextTag=6EncodedTag=X\'69\'EncodedData=X\'00\'Example:Context-taggedunsignedintegerASN.1=[0]UnsignedValue=256ContextTag=0EncodedTag=X\'0A\'EncodedData=X\'0100\'Example:Context-taggedsignedintegerASN.1=[5]INTEGERValue=-72ContextTag=5EncodedTag=X\'59\'EncodedData=X\'B8\'Example:Context-taggedsingleprecisionrealASN.1=[0]REALValue=-33.3ContextTag=0EncodedTag=X\'0C\'EncodedData=X\'C2053333\'Example:Context-taggeddoubleprecisionrealASN.1=[1]DoubleValue=-33.3ContextTag=1EncodedTag=X\'1D\'ExtendedLength=X\'08\'EncodedData=X\'C040A66666666666\'Example:Context-taggedoctetstringASN.1=[1]OctetStringValue=X\'4321\'ContextTag=1EncodedTag=X\'1A\'EncodedData=X\'4321\'Example:Context-taggedcharacterstringASN.1=[5]CharacterStringValue="ThisisaBACnetstring!"(ANSIX3.4)ContextTag=5EncodedTag=X\'5D\'LengthExtension=X\'19\'CharacterSet=X\'00\'(ANSIX3.4)EncodedData=X\'546869732069732061204241436E657420737472696E6721\'Example:Context-taggedbitstringASN.1=[0]BITSTRINGValue=B\'10101\'ContextTag=0EncodedTag=X\'0A\'UnusedBitsinLastOctet=X\'03\'EncodedData=X\'A8\'Example:Context-taggedenumerationASN.1=[9]BACnetObjectTypeValue=ANALOG-INPUT(0)ContextTag=9EncodedTag=X\'99\'EncodedData=X\'00\'Example:Context-taggeddatevalueASN.1=[9]DateValue=January24,1991(Dayofweek=Thursday)ContextTag=9EncodedTag=X\'9C\'EncodedData=X\'5B011805\'Example:Context-taggedtimevalueASN.1=[4]TimeValue=5:35:45.17P.M.=17:35:45.17ContextTag=4EncodedTag=X\'4C\'EncodedData=X\'11232D11\'Example:Context-taggedobjectidentifiervalueASN.1=[4]ObjectIdentifierValue=(BinaryInput,15)ContextTag=4EncodedTag=X\'4C\'EncodedData=X\'00C0000F\'6、通讯步骤描述数据通讯的步骤,以此作为描述文档进行备份及参考。本次应用数据通讯主要分为如下几步:\uf0d8IED设备发送广播命令,查询网络中的BACnet设备;通讯机(实现BACnet)接收到命令后,同样回应一条广播命令,告诉IED自己属于BACnet设备\uf0d8IED开始点对点通讯,查询设备属性;通讯机应答复杂回应(命令的一种),送上属性信息或者回应属性不存在的错误应答\uf0d8IED开始召唤设备的所具备的数据对象的属性(ID、名称等);通讯机应答这些数据对象信息(对象ID、名称等)或者错误的对象不存在应答\uf0d8IED开始召唤数据对象的值;通讯局送上某个或某些数据对象的数据信息或一些属性信息接下来进行报文举例说明:6.1.广播查找设备命令810B000C0120FFFF00FF10080000-00000000解释:81:B/IP虚拟协议的标示0B:广播通信000C:长度0120FFFF00FF为NPDU部分,见NPDU部分报文的说明如下:01:网络层的版本20:表明目标网络信息存在FFFF:DNET设为0xFFFF表示广播00:DLEN为0,表示DADR不存在,广播报文FF:HopCount在这里需设置为FF1008000000000000:此为APDU部分,详见解释如下:10:表示无需确认的请求信息08:类型为WHO-IS00(6个):表示网络地址的范围不限810B00180120FFFF00FF1000C402-0012BD2205B291032125此报文是上面报文的应答这里的类型为00,及时I-AM的意思,紧接的报文为I-AM-REQUEST的格式,参照第四章及第五章的内容。6.2.读取某一设备信息810A0011010402045F0C0C020012-BD196100读取ID为0x02BD设备的属性(0x61)810A001A0100305F0C0C020012BD19613E850601000B0030603F回答上述属性,这里的回应格式根据所要属性的格式进行组织。详见第五章810A001D01040204600E0C020012-BD1E0979096B0978094D097009461F读取ID为0x02BD设备的多个属性(0x790x6B0x780x4D0x700x46)810A006A010030600E0C020012BD-1E29794E7519004669656C6453657276-657220546563686E6F6C6F676965734F-296B4E91034F29784E21254F294D4E75-1100496E74656772615F313633305F42-434E4F29704E91004F29464E750C0050-726F746F436573736F724F1F上述报文的应答格式,详见第五章的内容810A001201040204610C0C020012-BD1A08F3读取属性0x08F3,由于不存在此属性,故报错如下810A000D010050610C9102912000-00000000810A001301040204620C0C020012-BD194C2900读取设备的object_list,带有数值下标(0x2900),第一个先回答object的个数,然后才开始每个对象。回应如下:810A0016010030620C0C020012BD-194C29003E21453F810A001301040204630C0C020012-BD194C2901再次读取设备的object_list,此为第一个对象,回答为device的ID,然后才是设备的数据对象810A0019010030630C0C020012BD-194C29013EC4020012BD3F810A001301040204640C0C020012-BD194C2902读取设备的第一个数据对象。810A0019010030640C0C020012BD-194C29023EC4008000C83F回答第一个数据对象的ID信息6.3.读取数据信息810A001101040204650C0C008000-C8194D00读取analog-value对象的名称属性810A0024010030650C0C008000C8-194D3E7510005365745F6E6F64655F6F-66667365743F回答analog-value对象的名称810A001701040204730E0C000000-0F1E09750955096F1F读取analog-input的多个属性810A0026010030730E0C0000000F-1E29754E910B4F29554E44000000004F-296F4E8204004F1F回答analog-input的属性询问其它的数据访问方式基本相同的道理,至于报文格式的细节解释详见第四、五章的内容',)


  • 编号:1700773883
  • 分类:其他文档
  • 软件: wps,office word
  • 大小:36页
  • 格式:docx
  • 风格:商务
  • PPT页数:283176 KB
  • 标签:

广告位推荐

相关其他文档更多>