Time stamp with Modbus

C

Thread Starter

Cem Kamoy

Can anybody tell me how it is possible to embed a time stamp data into modbus rtu to send it to the scada. This will be done on a leased line communication (I guess this has nothing to do with it) I heard that some hardware can do that.
 
J

Jake Brodsky

Uhhh, there's lots of ways to do it, but the most common method is to use what most *IX systems use: Seconds since 00:00 UTC on January 1, 1970. You should use at least a single unsigned 32 bit integer for this purpose.

Modbus doesn't really have any other way to communicate time. There are no time-oriented objects. So this method is commonly used...
 
K
If you would like to discuss how this is done you can contact me at 770-265-8947. Time stamping on the PLC side is quite possible. The main issue
when using a SCADA is how to append historical information from the PLC into the SCADA historian. If you are using Intellution we have a solution for this.

Regards,
 
G

Greg Goodman

> Can anybody tell me how it is possible to embed a time stamp data into
> modbus rtu to send it to the scada.

1. Define a format that your PLC program will use to store timestamps in registers.

example: days since jan 1, 1970 stored as an unsigned 32-bit integer in a holding register, plus milliseconds since the beginning of the day stored as an unsigned 32-bit integer in the next sequential holding register

example: store the values for month, day, year, hour, minute, second, millisecond in successive registers

example: store milliseconds since jan 1 1970 as an IEEE float in 2 successive registers

2. Define a convention for associating a timestamp with a data value or data set

example: every sample (register) is followed immediately by its timestamp

example: a sample record consists of some number of related data values, a set of data quality flags, and a timestamp

3. Develop your application such that it is aware of the format and association specified above, parses the correct registers as timestamps, and stores the associated data with the provided timestamp (and any associated data quality flags) in an appropriate place in the database.

Note that this requires cooperative implementation both in the PLC and in the master application. You are, in essence, defining a super-protocol on top of Modbus; Modbus itself acts as the transport for raw data whose meaning is defined by your application.

You have to decide whether to use a generic Modbus driver and implement the data association and custom timestamp parsing in an application layer above that, or develop a custom Modbus driver that knows about your convention, and provides properly parsed and associated data directly to your application.

I have done this both ways. Personally, I prefer the custom driver approach. We've found it easier to maintain a custom driver and a straightforward application than to maintain the extra application-level code, database tags and configuration required to post-process data after it reaches the database.

Hope this helps.

Greg Goodman
Chiron Consulting
 
If you're worried about timestamping events in the RTU it may be because your communications pipe to the remote is too thin or unreliable to trust the timestamp your SCADA host attachs to process image changes.

In this case, you've got more to worry about than just applying the timestamp to the data. You have to synchronize the clock at the RTU, you
may have to spool the discrete and analog change events at the RTU so you don't miss process events between scans.

You can build all this functionality yourself on top of Modbus. It might make more sense to use a DNP3-to-Modbus gateway provided your SCADA host can handle a DNP3 driver.

"http://www.dnp.org/":http://www.dnp.org/
"http://www.prolinxgateways.com/":http://www.prolinxgateways.com/
"http://www.novatech-llc.com/":http://www.novatech-llc.com/

Joe Manns
Arden Environmental Engineering Inc.
3550 Lexington Ave. N
Shoreview, MN 55126
Ph 651-484-5415
Fax 651-484-5568
 
Top