I have created a Lab environment for inspect Modbus/TCP traffic in this repo via Factory IO and OpenPLC.
For this:
OpenPLC Editor: Used for creating and compiling PLC program.
OpenPLC Service: Works as PLC and HMI.
Factory IO: Contains 3D models of actuators and sensors that can interact with OpenPLC Server.
It has a conveyor actuator as output and a sensor as input. In this scenario, the conveyor runs until the box reaches the sensor. The conveyor will stop when the box arrives.
Driver configured as Modbus TCP/IP server.
PLC is programmed so that the conveyor can be controlled with. The program has basic contactor and actuator and is created with ladder diagram. Used OpenPLC Editor for this.
OpenPLC installed and configured on Ubuntu.
It is important to make sure that the OpenPLC service is enabled and running correctly.
Now we can configurate OpenPLC from web interface.
After the device configuration completed, the program.st file can be uploaded from the program tab.
When the operations are done correctly, we are completely ready to run OpenPLC.
The status of the sensor and actuator can be followed from the Openplc monitoring tab.
Finally the Modbus traffic can be inspected via Wireshark.