Hi,
I'm not completely sure on how Modbus cycle time operates compared to PLC cycle time.
In an application, I need to read a lot of Modbus variables from remote devices.
I'm wondering if the reading cycle of the Modbus was connected or not connected with the PLC.
Let me explain clearly using a real case. To permit data consistency inside the application program, all data must be acquired before the PLC program execution cycle starts. If the Modbus reading process is not "synchronized" with the PLC, it could happen a consistency data lost: that means that a variable can change during running (due to Modbus cycle reading process) with not predictable results.
Searching inside MODBUS MASTER Parameters I discovered a setting called "OptimizationOn" that was TRUE (see picture).
Is this flag responsible for the cycle time of the Modbus?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I suppose optimization it's related to reducing numbers of Modbus request (ex. you defined to read address from 40001 to 40010 and from 40020 to 40030: in stand of 2 reading call the optimization read the entire area (from 40001 to 40030).
About sync between modbus scan and PLC cycle I think it's not possible..usually, when CPU starts, I set a certain number of "empty" cycle (just put a return in PLC_PRG). In the meantime empty cycles runs, Modbus updated required variables.
Or you can manually defines (modbus library) a POU for Modbus client and "interlock" the execution of logic code with properly modbus response..but in this way you're depending on network delay, comm timout,...(in my opinion not the best way)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm not completely sure on how Modbus cycle time operates compared to PLC cycle time.
In an application, I need to read a lot of Modbus variables from remote devices.
I'm wondering if the reading cycle of the Modbus was connected or not connected with the PLC.
Let me explain clearly using a real case. To permit data consistency inside the application program, all data must be acquired before the PLC program execution cycle starts. If the Modbus reading process is not "synchronized" with the PLC, it could happen a consistency data lost: that means that a variable can change during running (due to Modbus cycle reading process) with not predictable results.
Searching inside MODBUS MASTER Parameters I discovered a setting called "OptimizationOn" that was TRUE (see picture).
Is this flag responsible for the cycle time of the Modbus?
I suppose optimization it's related to reducing numbers of Modbus request (ex. you defined to read address from 40001 to 40010 and from 40020 to 40030: in stand of 2 reading call the optimization read the entire area (from 40001 to 40030).
About sync between modbus scan and PLC cycle I think it's not possible..usually, when CPU starts, I set a certain number of "empty" cycle (just put a return in PLC_PRG). In the meantime empty cycles runs, Modbus updated required variables.
Or you can manually defines (modbus library) a POU for Modbus client and "interlock" the execution of logic code with properly modbus response..but in this way you're depending on network delay, comm timout,...(in my opinion not the best way)