How to communicate with multiple (200) modbus TCP/IP devices at a time in vb.net?

T

Thread Starter

T Shri

I want to create an application in vb.net which communicate with 200 modbus tcp/ip devices at a time and store data in sql. How can I communicate 200 modbus tcp/ip devices at a time?
 
J

James Ingraham

Threads.

Okay, here's a slightly less snarky answer. Talking to one device is almost trivial. If you don't care much about rate you could scan your 200 devices one after the other in a for loop. Assuming you set a 5 second timeout on your read attempt, and a minimum of say 50ms normally, your scan will take between 10 and 500 seconds. If you can handle the occasional 10-minute hang-up, fine.

Generally, though, what you would do is give each device it's own thread. Thread programming in VB.NET is beyond the scope of this answer, and probably beyond the scope of Control.com in general. (Not to try and speak for the mods or the rest of the community, but that's essentially a pure-programming questions better suited to forums dedicated to such things.)

Finally, I should point out that doing this in VB.Net is not necessarily a good idea. An off-the-shelf OPC server and data logger would solve this problem with zero-programming, be easy to support, and probably work better than any roll-your-own solution. KEPware, Matrikon, and Software Toolbox all come to mind, but there are plenty of others. Yes, you'll have to buy them. However, it doesn't take all that much developer time to burn through the roughly two thousand US dollars you'd spend on off-the-shelf, supported, easy to use software.

Good luck.

-James Ingraham
Sage Automation, Inc.
 
> and store data in sql.

Also, there are numerous threads on this forum about why storing time series data in an SQL relational database is a really bad idea. Essentially, while SQL is "relatively" efficient at complex queries it simply isn't good enough for the absolutely massive amounts of data you can potentially accumulate in a data logger.

If you're going to use an SQL database make sure its really suitable for your application.

Rob
www[.]lymac.co.nz
 
Hello,

The task as defined is not that hard. If you are experienced with communication protocols MODBUS is one of the easiest to implement. 200 concurrent connections is very doable. As another reply stated, polling 200 devices out of one socket is also doable with the understanding an update of the ‘complete’ database will take much longer.

Saving to SQL can get a bit more involved. You do not state if the data is an ‘overwrite’ of existing data or acting as a ‘logger’, a new entry for each data fetch from the device.

> ...burn through the roughly two thousand US dollars you'd spend on...

Or you could spend much less for PeakHMI can accomplish the task.

Good luck,

Mark
http://peakhmi.com/
 
Check out Automated Solutions Modbus/TCP Master (client) driver for .NET.

The driver can be set to perform background scanning of data points at your specified scan rate. It also optimizes multi-register packets to minimize transactions, supports data change events, has a simple, well documented API, and includes many example applications and associated C# and VB.NET source code.

http://automatedsolutions.com/products/dotnet/ascomm/mb.master.net.asp (remove the space between . and asp)

If you decide to use another controller brand like A-B, Siemens, GE-IP, etc. down the road, those drivers are there too and can be accessed simply by a simple namespace change.
 
Dear all,
thanks.

How many modbus tcp/ip devices can communicate with any scada or .net application?
 
Hello,

>How many modbus tcp/ip devices can
>communicate with any scada...

For PeakHMI, the limit is the processing power of the computer, the network speed, amount of RAM, etc.

Good luck,

Mark
http://peakhmi.com/
 
Top