The polling time of these two schemes for four devices should be the same.
The total time for a and B programs is the same as that for the four slave stations, or for reading and writing an instruction. If the total time of training four slave stations in rotation, the time of scheme a is shorter than that of scheme B. Four ports and two communication stations are equivalent. If it is to read a single instruction, I have not yet tested it. It is possible to use two port communication and one port communication at the same time. The CPU load of two port communication is larger than that of one port communication. When the CPU load is not very high, the communication time may not be significantly different. If the CPU load is used to a certain utilization rate, this condition is the same Then one port will communicate faster than two ports.
The rotation time is related to the length of the data read. There is also a calculation formula for this. Here is a passage from the S7-200 data. If you require a fast speed, Modbus RTU communication is very difficult to meet the requirements. You have time to test the communication time of your two methods.
Execution time of Modbus RTU master protocol library:
MBus of Modbus RTU master protocol library_ The CTRL instruction does not take long to execute. MBUS_ It takes 1.11 MS for initialization and only 0.41 MS for each subsequent scan cycle.
Calling MBus_ The MSG subroutine will increase the processing time. Most of the time is used in CRC calculation. It takes 1.85 MS to read and write a word of data. In the case of the most data (reading and writing 120 words of data), the scanning time will increase by 222 Ms. The time of reading operation is mainly consumed in receiving data; the time of writing operation is mainly consumed in sending data.