Most efficient way to populate channels Modbus


Recommended Posts

Timeout is set to 500 ms, the tx rx round is taking about 200 ms and timing is 1s. I'm getting timeout errors, that's what led me to discover this about the max frame size being 120 bytes. There is something still causing timeouts when I increase the number of equipments read in the network.

Link to comment
Share on other sites

500ms is too short if your round trip is 200ms. Make it more like 1000ms. The problem is that if you are reading 3 blocks from a single timing/offset, then you are essentially blocking the port for 600ms. The other blocks at offset 0.01 will start waiting 10 ms after the first starts, then timeout (with port locked) at 510ms because the port hasn't been released. You may also want to try setting the offset for the second block to 0.5.

I forgot: are you running on a 485 multidrop? If so, you might get timeouts between devices. This happens because DF queries faster than the transceivers can respond. You have to use offset, then, to stagger the reads enough so that the last query for one device occurs 50ms or so before the next query on the next device starts.

For TCP this is not an issue and you should be able to read from multiple devices concurrently in DAQFactory by putting each device's channels on separate timing/offset combinations.

Link to comment
Share on other sites

I'm running it over ethernet, we use a RS485- TCP/IP converter with 2 or 3 equipments on each IP.

I forgot there might be a issue with the converter TCP/IP timeout also! The converter must have a lower timeout than DAQFactory, else it will get in the way of DAQ. Will check that and see if anything changes.

Link to comment
Share on other sites

Well, if you have more than one device connected to each tcp/ip converter than you have a multidrop situation at each IP. So, most likely you'll need to spread out the reads between devices (using Offset) to ensure that DAQFactory gives enough time between devices. We don't do this automatically because not all devices have this issue and we want to make sure those that don't have the issue can get the max performance and adding an arbitrary delay would affect that.

Link to comment
Share on other sites

Thanks, I've tested it and it seens to work now.

In the initialization sequence:

define oset = 2
global offset = 0.01

...
switch
   case (IsEmpty(evaluate("Offset_"+curnet+"_"+device)))
	  execute("global Offset_"+curnet+"_"+device)
	  offset = offset + oset
	  execute("Offset_"+curnet+"_"+device+"="+offset)
...
endcase

Somehow, this code is making offset be:

10000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000000000000000000000000000000000000000000000000000

00000000000000000000000000000000000000000000000000000000000000000000000000000000

000000000000000000000000000000000000000000000000000000000000000000.00

And I dont seen to find a way around it... any thoughts?

Link to comment
Share on other sites

I found it!

When adding the channel, I was doing:

channel.Add("V2_"+ curnet+"_"+ device,"Mod_"+ device,curnet,"Read Input Float (4)", 4, timing, "Offset_"+curnet+"_"+ device)

Which was wrong, cause offset is a number, so it must be:

channel.Add("V2_"+ curnet+"_"+ device,"Mod_"+ device,curnet,"Read Input Float (4)",4,timing,evaluate("Offset_"+curnet+"_"+ device))

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.