郞性人生

导航

通信可靠性总结——小小总结,小小心得

1.现在设备系统中,功能的实现需要良好的通信才能完成。而良好的通信依赖很多因素,不同的环境对通信可靠性的要求也不相同。现在已经有很多开源通信协议可供我们选择,如何评价选择的通信协议是否满足我们工作环境的需要?如何在实用中把握通信协议的可靠性,且根据可靠性实现我们的功能要求?

2.根据我们的硬件条件选择的通信协议可性如何?可以借鉴MQTT的Qos分级进行评测:

QoS0:at most once delivery:

The message is delivered according to the capabilities of the underlying network. No response is sent by the receiver and no retry is performed by the sender. The message arrives at the receiver either once or not at all.

QoS1:at least once delivery:

This quality of service ensures that the message arrives at the receiver at least once. A QoS 1 PUBLISH Packet has a Packet Identifier in its variable header and is acknowledged by a PUBACK Packet. Section 2.3.1 provides more information about Packet Identifiers.

In the QoS 1 delivery protocol, the Sender:
  MUST assign an unused Packet Identifier each time it has a new Application Message to publish.
  MUST send a PUBLISH Packet containing this Packet Identifier with QoS=1, DUP=0.
  MUST treat the PUBLISH Packet as “unacknowledged” until it has received the corresponding PUBACK packet from the receiver. See Section 4.4 for a discussion of unacknowledged messages.

In the QoS 1 delivery protocol, the Receiver:
  MUST respond with a PUBACK Packet containing the Packet Identifier from the incoming PUBLISH Packet, having accepted ownership of the Application Message.

  After it has sent a PUBACK Packet the Receiver MUST treat any incoming PUBLISH packet that contains the same Packet Identifier as being a new publication, irrespective of the setting of its DUP flag.

QoS2:Exactly once delivery 

This is the highest quality of service, for use when neither loss nor duplication of messages are acceptable. There is an increased overhead associated with this quality of service.

In the QoS 2 delivery protocol, the Sender
  MUST assign an unused Packet Identifier when it has a new Application Message to publish.
  MUST send a PUBLISH packet containing this Packet Identifier with QoS=2, DUP=0.
  MUST treat the PUBLISH packet as “unacknowledged” until it has received the corresponding PUBREC packet from the receiver. See Section 4.4 for a discussion of unacknowledged messages.
  MUST send a PUBREL packet when it receives a PUBREC packet from the receiver. This PUBREL packet MUST contain the same Packet Identifier as the original PUBLISH packet.
  MUST treat the PUBREL packet as “unacknowledged” until it has received the corresponding PUBCOMP packet from the receiver.
  MUST NOT re-send the PUBLISH once it has sent the corresponding PUBREL packet.

In the QoS 2 delivery protocol, the Receiver
  MUST respond with a PUBREC containing the Packet Identifier from the incoming PUBLISH Packet, having accepted ownership of the Application Message.
  Until it has received the corresponding PUBREL packet, the Receiver MUST acknowledge any subsequent PUBLISH packet with the same Packet Identifier by sending a PUBREC. It MUST NOT cause duplicate messages to be delivered to any onward   recipients in this case.
  MUST respond to a PUBREL packet by sending a PUBCOMP packet containing the same Packet Identifier as the PUBREL.
  After it has sent a PUBCOMP, the receiver MUST treat any subsequent PUBLISH packet that contains that Packet Identifier as being a new publication.

3.应用场景不同要求的可靠性也不尽相同

生产,调试时配置通信,可以用的通信协议,及功能实现协议方案,要想用到系统正常通信协议中需要重新考虑通信的可靠性是否可行;

接入系统正常通信,通信可靠性的要求:

3.1.单个目标功能,单条通信协议指令实现可以降低可靠性;如果采用多条指令,需要每条指令都要有QoS 2级的可靠性;

 

posted on 2019-09-07 18:14  郞性人生  阅读(660)  评论(0编辑  收藏  举报