automation and MODbus TCP data logging


Thread Starter

Dan Fuchs

My questions are regarding how to best combine Modbus data logging in a PC that is running another automation task.

We have a data acquisition system running on a computer that will be deployed in a power plant for our special sensors monitoring. The computer (Windows XP, dual LAN) has a few boards for data sampling that keep the PCI bus very busy. The whole process is running 24/7 by an automation script (autoit3) and sends the resulting data over the internet (FTP) for final analysis.

While collecting sensor data in the system we also need to know the operational conditions of the plant. Those will be provided by the power plant DCS (data collection system) which has a Modbus RTU TCP interface. The DCS is the master, and will be configured to send the data periodically (probably every 2 seconds or every minute) to a few Modbus registers (3xxxx) (about 10 parameters - tags).

for our final analysis we have to combine both data. the one coming from our system, and the operational data from the plant.

I am trying to figure the simplest optimal way to configure the system. The first configuration I have in mind is of writing a program that will test the values of the Modbus registers every minute, and save them with a time stamp to a file and transfer over the internet every hour or so.

1. How much will this kind of program running in the background load the PCI or other resources of the computer? Since the other process is very heavy. I want to make sure it doesn’t blow things out of sync.

2. I guess there are a number of ways to write such a program and I am looking for a reasonable one? The tools that we already use are the Autoit for the gross automation, I have written Labview code to interface with a device on a COM port, we have some Matlab capability.

3. is offering a Modbus toolkit? Will that be of any help to me?

Another idea that comes to mind is perhaps to just buy another computer just for that. It will listen to the Modbus log it and FTP the data every hour.

4. Is there something like a ‘Modbus streamer’ out there that one can buy?

5. Any clues or examples from the forum that would be nice?

I'm not sure if it would be useful to you or not, but ICC provides a free Modbus master tool (works for RTU or TCP) that can continuously monitor and log register sets to a .CSV file for post-processing. The .CSV file is shared, which means that other applications can access the data while new values are simultaneously being logged. Of course this doesn't address any of your comparison program etc. requirements, but it might be good enough for you for the Modbus-to-file portion.

> My questions are regarding how to best combine Modbus data logging in a PC that is running another automation task.

There is a simple Modbus example (and screen shot) near the bottom of this (free open source) page:

I'd be interested in taking the program further to do some of the things you mentioned. The six year old "monitor" educational project also has parts to easily send emails.

Curt Wuollet

If you can avoid the GUI trap, such a program would use very little resource. A loop with a select call on the serial port to receive the data directly and a few lines of code to decode the packet would be pretty efficient. If you want efficiency, it's hard to beat C. A write to buffered IO wouldn't be too disruptive.

Thanks. If I understood correctly, the master is going to the plant computer. so that means I have to be the slave. no? So the Master simulation program wouldn't help. or am I missing something?
The other computer is the master and I will be his slave. Is there a slave code you can please point to?
I think I need a slave simulation since the other computer talking to my computer will be the master. Is that correct that I would need to get a slave simulator?
>The other computer is the master and I
>will be his slave. Is there a slave code
>you can please point to?

I hope to add such an example soon, but right now the only example is a master.