Setting up Modbus RTU over TCP simulation
To debug software on a PLC, it was necessary to set up a simulation of a device that is polled via the Modbus RTU protocol. All the programs and actions listed below were performed in Windows OS.
For the simulation I used a combination of the following programs:
Modbus Poll as a Modbus client
ModRSsim2 for Modbus server simulation
VESPE (Virtual Serial Ports Emulator (64 bit)),
I had some ancient version of VESPE – 1.0.5.443
The first thing you need to do is set up a virtual COM port. Launch VESPE and create a connector:
The PC where I installed the simulator already had some kind of COM port, so the example will be COM2:
After that, to connect to it via TCP, you need to create a TCP server that will open a port for communication over TCP:
We select the previously created COM port and assign the TCP port through which we will access the MOdbus client to read registers:
Next, we launch MODRSSIM (I installed it from the ModbusOPCServer demo trial package from MPSSoft (this is the one that MasterScada produces) and configure it to MOdbus RS-232, and also connect to COM2:
Let's fill in the holding registers:
Connect to ModbusPoll:
There is a connection, requests are coming, answers are coming:
I decided to write this article for myself as a cheat sheet. I believe that there are many such examples on the Internet. I would be grateful if you share your experience in simulating Modbus RTU, Modbus TCP devices based on Linux in the comments.