[Logo] Mango Community
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
concurrency parameter  XML
Forum Index » Modbus4J general discussion
Author Message
pentavalle

Initiate

Joined: 01/02/2011 05:45:33
Messages: 9
Offline

Just taking a look at 1.13 release in CVS, I have seen that ModbusFactory.createRtuMaster and ModbusFactory.createAsciiMaster now requires an int "concurrency" parameter.
This parameter could be SerialMaster.SYNC_TRANSPORT, SerialMaster.SYNC_SLAVE or SerialMaster.SYNC_FUNCTION and modify the behaviour of SerialWaitingRoomKeyFactory.
What's the difference between those 3 values?
mlohbihler

Master
[Avatar]

Joined: 01/03/2007 22:48:52
Messages: 1850
Offline

This parameter tells Modbus4J at what concurrency level it needs to operate. This is for when you have multiple threads using the same modbus master to send requests. (Note that Modbus4J doesn't handle the multi-threading for you. You still need to do that yourself.)

For example, one thread may be sending requests to slave 1, and another to slave 2. You can send both requests at the same time and have each slave generate the response concurrently, which is more efficient then sending them serially. To do this, you should set your master concurrency level to SYNC_SLAVE.

Does this make sense?

Best regards,
Matthew Lohbihler
pentavalle

Initiate

Joined: 01/02/2011 05:45:33
Messages: 9
Offline

Good improvement!

Looks like SYNC_FUNCTION syncs on slaveId and functionCode, so both must be different to send a concurrent request, and SYNC_TRANSPORT doesn't allow to send concurrent modbus requests, like before.
Please correct me if I'm wrong.
mlohbihler

Master
[Avatar]

Joined: 01/03/2007 22:48:52
Messages: 1850
Offline

You are correct.

Best regards,
Matthew Lohbihler
 
Forum Index » Modbus4J general discussion
Go to:   
Powered by JForum 2.1.9 © JForum Team