Modbus Simulator v2

Mar 27, 2022 2 min read

This project is the sequel of the already published Modbus Simulator.

Enhancements

While the previous project was already working, some enhancements were made:

  1. Replacement of the REST interface for sending commands and getting server status with an asynchronous interface (i.e. MQTT);
  2. Addition of basic hosting of Doxygen documentation of the Modbus Simulator;
  3. Development of a Modbus TCP client that shows the working operation of the system.

The system is composed by the same blocks, the only change in the HLA was the addition of the containerised Mosquitto broker.

Figure 1) Graphical representation of the system.

Here below some detail regarding the design choices that were taken for designing and implementing said systems.

Figure 2) Design choices taken for Modbus Simulator.

Modbus Simulator

The Modbus Simulator remained almost untouched, except for the replacement of the Flask app with a Paho MQTT Client, which enables the communication between the client and the Simulator.

Figure 3) Graphical representation of the Modbus Simulator software.

Modbus Client

The client is an addition in respect to the previous version:

Frontend

The frontend was slightly changed, replacing the HTTP Ajax client with a Paho MQTT client. In the image here below can be seen the new structure of the frontend code.

Figure 4) Graphical representation of the frontend software layers.

In this section there are the graphical representation and the steps description of the main architectural flows.

Figure 5) Graphical representation of “Web-App” flow.

Figure 6) Graphical representation of “Set Registers” flow.

Figure 7) Graphical representation of “Command” flow.

Figure 8) Graphical representation of “Status Change” flow.

Figure 9) Graphical representation of “Poll Data” flow.

Here below there is the video that shows the new working operation of the Modbus Simulator. In particular, it’s possible to appreciate:

  1. Static hosting of the Doxygen documentation;
  2. Modbus Simulation of three registers with different curves (ramp, sin, step) which are polled and plotted by the Modbus Client.