计算机工程与应用 ›› 2021, Vol. 57 ›› Issue (23): 137-145.DOI: 10.3778/j.issn.1002-8331.2105-0146

• 网络、通信与安全 • 上一篇    下一篇

基于NS-3的MQTT协议仿真研究

赵靖,王如武,周皓   

  1. 大连理工大学 软件学院,辽宁 大连 116024
  • 出版日期:2021-12-01 发布日期:2021-12-02

Simulation Research of MQTT Protocol Based on NS-3

ZHAO Jing, WANG Ruwu, ZHOU Hao   

  1. School of Software, Dalian University of Technology, Dalian, Liaoning 116024, China
  • Online:2021-12-01 Published:2021-12-02

摘要:

如今,制造业数字化转型中采用消息队列遥测传输(MQTT)协议已成为趋势,而工业场景中往往存在大量的传感器等设备。考虑到实际部署的复杂性,在工业场景中实际部署MQTT前,进行必要的模拟以获取网络性能等数据是不可或缺的,这将更有利于工业场景中的链路设计和网络规划。而NS-3作为当前最流行的网络仿真器之一,提供了丰富的网络模型,非常适合像工业场景这种大型复杂网络的仿真,但目前利用其模拟部署MQTT仍是一项困难的工作。针对该问题,提出了一个适用于NS-3的扩展仿真框架ns3-mqtt,该框架由多个MQTT组件构成,能够以软件包的形式集成到NS-3中,并且提供简洁易用的仿真接口,使得扩展后的NS-3可较容易地对MQTT进行模拟部署并获取相关数据,以此研究不同工业场景下MQTT协议的性能,指导MQTT的实际部署。仿真测试结果证明了提出的ns3-mqtt框架的正确性和有效性。

关键词: MQTT协议, NS-3, 工业互联网

Abstract:

Nowadays, it has become a trend to use the Message Queue Telemetry Transmission(MQTT) protocol in the digital transformation of the manufacturing industry, while there are often a large number of sensors and other devices in the industrial scene. Considering the complexity of the actual deployment, it is indispensable to carry out the necessary simulation to obtain data such as network performance before the actual deployment of MQTT, which will be more conducive to link design and network planning in industrial scenarios. NS-3 is one of the most popular network simulators, providing a wealth of network models, ideal for simulation of large complex networks like industrial scenarios. But currently using it to simulate deployment of MQTT is still a difficult job. To solve this problem, an extended simulation framework ns3-mqtt for NS-3 is proposed. The framework consists of several MQTT components, which can be integrated into NS-3 in the form of software packages and provide a simple and easy-to-use simulation interface. It makes the extended NS-3 can easily simulate the deployment of MQTT and obtain relevant data to study the performance of the MQTT protocol under different industrial scenarios, and guide the actual deployment of MQTT. Simulation results show that the proposed ns3-mqtt framework is correct and effective.

Key words: MQTT protocol, NS-3, industrial Internet