Accessing EKM Meter with PLC using Modbus on RS485?

For more advanced meter data users. Learn from others and ask questions about how to read meters, how to use the EKM Push Data, and how to display the meter data in useful ways.
Post Reply
Zaaphod
Posts: 20
Joined: Fri Oct 23, 2015 2:04 pm

Accessing EKM Meter with PLC using Modbus on RS485?

Post by Zaaphod » Sat Oct 24, 2015 1:00 pm

Can I access the registers in an EKM meter with a PLC using MODBUS with the RS485 port?

I would like to both read the registers of the meter, and control the outputs over RS485. I have a PLC already communicating and controlling other MODBUS devices, so I'm wondering if I can read and write to your meters on the same system?

Jameson
Posts: 770
Joined: Fri Nov 04, 2011 7:42 pm
Location: Santa Cruz, CA
Contact:

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Jameson » Sat Oct 24, 2015 8:11 pm

Our Omnimeters do not use Modbus to communicate. Modbus is too limited for our needs (especially in regards to the EKM Push system), we use our own communications standard. There is a lot of information about it on this forum and how to calculate CRC16 etc.

You had indicated that you are interested in the Omnimeter Pulse v.4 in a different post on this forum. Here is the Omnimeter Pulse v.4 communications parsing document (for reading): http://documents.ekmmetering.com/Omnime ... arsing.pdf

In order to write to the meter or to be able to make meter settings (relay control for example) you will want to refer to this document: http://documents.ekmmetering.com/Omnime ... otocol.pdf

These are both towards the bottom of this page, along with additional information, which is really the best place to start: http://www.ekmmetering.com/developer-portal/

Let me know if you need a hand.
Jameson
EKM METERING
http://www.ekmmetering.com
831.425.7371

Zaaphod
Posts: 20
Joined: Fri Oct 23, 2015 2:04 pm

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Zaaphod » Sun Oct 25, 2015 8:33 am

It seems that trying to communicate with the meters over RS485 directly may not be the best solution. My PLC is already controlling a lot of other devices with modbus, so I think that if I wanted to do something else with it, I would have to stop modbus, do the other thing, then start it again.. Also as you mentioned in my other post, if both devices tried to read at the same time there could be a collision, while I'm sure this would be quickly detected and rejected by the checksum, I'm thinking perhaps there is a better way. My PLC also has TCP/IP and is on my network, could I read the data from the EKM push over TCP/IP, and thereby eliminating the problem of more than one device accessing the RS485 ports, as well as interfering with my modbus setup. Is this a possibility?

Jameson
Posts: 770
Joined: Fri Nov 04, 2011 7:42 pm
Location: Santa Cruz, CA
Contact:

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Jameson » Mon Oct 26, 2015 5:53 pm

I would not be too worried about collisions if you are not trying to read the meters too fast. If you are reading at 60 seconds and 55 seconds, you wont have too many collisions for example.

You can read our meters over your LAN using TCP/IP and our EKM iSerial. This is possible, you would be using what is called a "Virtual COM Port". This would take quite a bit of programming proficiency and networking knowhow to setup but it is quite doable. Please search this forum for more information.

You will not be able to use the EKM Push as your system is not connected to the internet as mentioned in your other post: http://forum.ekmmetering.com/viewtopic.php?f=1&t=3467

The EKM Push is not able to send data to your local server, all data from the EKM Push gateways goes to a central server cluster over the internet, our users then Pull their data out of their EKM Push account using our API, EKM Dash, encompass.io, the Widget, etc.
Jameson
EKM METERING
http://www.ekmmetering.com
831.425.7371

Zaaphod
Posts: 20
Joined: Fri Oct 23, 2015 2:04 pm

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Zaaphod » Tue Oct 27, 2015 7:44 am

I have two different installations I'm working on, one does have internet, the other does not, so I may end up with an ekm push, or perhaps the iserial or usb device... I don't think which other device is actually reading the meters really matters, because requests transmitted and data received by these devices would all be the same as far as the RS485 interface goes, so for the purpose of this conversation, I'll just call it a datalogging device, which will refer to one of these methods for that part of the project.

I am wanting to read it fairly quickly as I'm wanting to get the voltage readings to create a brownout protection system, where it will trip a 200amp shunt trip breaker in line on my mains if the voltage goes out of range.. if I waited 60seconds, I could end up with bad voltage for that long, and that's long enough to fry my A/C compressor. The datalogging device however doesn't need to be all that fast, I'm mostly wanting historical data from that part of it. I'm hoping for a trip response time of less than 3 seconds, but I would like to be able to read the meter maybe 5 times a second so I can verify by multiple reads that the voltage really is out of range... which leads me to my next question...

I realize the speed at which I could repeatedly read an Omnimeter would depend on how many of them were being read, because only one device should be sending on the RS485 line at a time, the rest should all be receiving, but for just a single omnimeter, what is the maximum read speed I could expect to achieve?

I have a little, (very little) experience with RS485 communications, on with a little project I did to make a Modbus over RS485 slave device using a pic processor. Basically for that, It just read from the RS485 port every time anything at all was present on the line, and when it received a message, it checked to see if the slave address was for itself, if so, it would continue reading and process the request, and if not, it would just stop and wait for the next message... the only reason I stopped was because I wanted to, because if the address wasn't for that device, it was irrelevant what was going on. It seems to me that if I just simply waited for the datalog device to send the request to the particular omnimeter I was interested in, I could then just go ahead and read the data off the RS485 line while it's on the way to the datalog device, there's really nothing from stopping me from using the response from the omnimeter for my own purpose. So once that is done, I'll have one reading to process, and I will then know how long I have before the next datalog request, and I could read the meter by issuing my own requests a few times in between the datlog cycles. I would then have absolutely no chance of any collisions ever.

I'm also having a new idea to modify my Modbus pic Processor project to use a PIC with dual RS485 ports, have one port read the Omnimeter data, store the information in it's registers, then have the second port run my modbus slave program, and send the appropriate registers to my PLC over modbus. I would probably use a second pic processor for this, and have that one perhaps just wait for the brown out protection pic to send a request and then read the response at the same time.

Would this work? Is there any reason I couldn't recognize the request from a datalog device like ekm push, i serial, or usb converter and just read the data myself while it's on the line, even though this processor didn't make the request? It seems to me that if you wanted to read the meters at the same time something like EKM push was reading them, you would never need to send on the RS485 line at all, and if you did want to send a signal, to activate a relay perhaps, you could schedule the transmission to be just after a read is complete, so you know you have time to get it done before the next read.

Please let me know what you think of this idea... and please correct me if I'm wrong about recognizing requests made by other devices and just reading the data as it goes by.

Jameson
Posts: 770
Joined: Fri Nov 04, 2011 7:42 pm
Location: Santa Cruz, CA
Contact:

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Jameson » Tue Oct 27, 2015 8:38 am

There are a few things to address before we move forward.

It takes 3/4 to 1 second to request meter data from a meter and to have it respond over RS485. So the fastest rate you will be able to read a meter with your own device is once per 3/4 to 1 second. This also assumes a 1 meter to 1 device connection.

You can sniff the RS485 bus to look for the data you are interested in. It may be harder to code than the traditional Master and Slave arrangement, because the data you request is the data you get back (rather than trying to discern the data you need from a stream of Hex characters)

Hope this helps.
Jameson
EKM METERING
http://www.ekmmetering.com
831.425.7371

Zaaphod
Posts: 20
Joined: Fri Oct 23, 2015 2:04 pm

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Zaaphod » Tue Oct 27, 2015 3:12 pm

Yes, that helps very much, thank you.

Since I would also see the request coming from the other device, so I would know what data was coming back... I just need to act like a slave device and when I see a request for the target device, I just read what the real target device is sending. There must be some method the slave devices use to determine there is a request with an address, then they check the address.. I just need to do the same thing and then I will be in sync.

that being said, I'm now thinking of an even better way to do it...

I could get my Pic Processor to be the ONLY device hooked up to the one omnimeter, It would send requests as fast as practical to that one meter, and do it's own thing with that information.. Then I get a second Pic processor... one with Dual USARTs and connect them both to RS485 transceivers, one of these will read the data from the omnimeter along with the first pic, but it will store the data in it's own registers. I could synchronize them very easily by just sending a hard wire sync pulse from the output of the first pic to an input on the second pic. now the second pic will have it's registers always current to the nearest second or two... and with the second USART, it can be hooked up to all the other omnimeters and the datalogging device... and I'll just program it to actually BE the slave device for that one meter instead of the meter itself, when it's address is requested, it can just answer the request with the data stored in it's registers. So the datalogging would end up being delayed by a few seconds on that one meter, but if it's only logging once a minute anyway, that's well within tolerance. This scheme will allow me to read the meter as fast as possible continuously without even 1 interuption to send data to the datalog device, and yet still send the data to the datalog device immediately upon receiving the request.

Zaaphod
Posts: 20
Joined: Fri Oct 23, 2015 2:04 pm

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Zaaphod » Sun Nov 01, 2015 2:41 pm

Jameson wrote: It takes 3/4 to 1 second to request meter data from a meter and to have it respond over RS485. So the fastest rate you will be able to read a meter with your own device is once per 3/4 to 1 second. This also assumes a 1 meter to 1 device connection.

I've been looking over the document at http://documents.ekmmetering.com/Omnime ... arsing.pdf. I notice you have Type A and Type B requests.. I'm wondering if the 3/4 to 1 second figure is for doing both requests and waiting for both responses?

Assume I don't use any other device but my own to access the omnimeter over RS485, and that I only repeatedly issued Type A requests, and no other devices of any sort on the RS485 line, how fast could I do that, and is there any point to doing it that fast... how often are the registers updated inside the omnimeter?

I'm also curious what the difference between "Total kWh L1" from type A request and "Total kWh T1" from type B request is.

Jameson
Posts: 770
Joined: Fri Nov 04, 2011 7:42 pm
Location: Santa Cruz, CA
Contact:

Re: Accessing EKM Meter with PLC using Modbus on RS485?

Post by Jameson » Mon Nov 02, 2015 3:26 pm

For Omnimeter Pulse v.4s thy to have a Request Type A (mostly real-time data) and a Request Type B (mostly returns cumulative data and settings)

It takes about 3/4 of a second to call and receive a Request Type A response and double this for a Request Type A call/response and Request Type B call/response.
difference between "Total kWh L1" from type A request and "Total kWh T1" from type B request
Total kWh L1 is the Total kWh on Line 1, the v.4 meters keep track of the Total and Reverse kWh on each of the 3 lines or phases separately.
Total kWh T1 is the Total kWh in Tariff 1. You can setup both our v.3 meters and v.4 meters keep track of Total kWh and Reverse kWh in 4 different Tariffs. You can set the times, weekend schedules, holidays, and seasonal variations of these Tariffs in our EKM Dash software (using an iSerial or USB converter) This is useful if you want the meter to keep track of how many kWh were used in the morning vs the afternoon, as some utilities charge TOU rates where power is more expensive in the afternoon than in the morning or at night.
Jameson
EKM METERING
http://www.ekmmetering.com
831.425.7371

Post Reply