Getting monthly kWh report from a Modbus Energy Meter

Hi guys!

I'm looking for your suggestion on the most efficient way to generate a monthly kWh report from a Modbus Energy Meter. Currently, I am using a brand-less Modbus EM that I got online for testing. It already has the kWh parameter on its register table so at first glance, this should be easy since I only need to record the kWh recorded in the EM by the end of the month. However, what got me thinking is what happens once I move to the next month since the kWh recorded will not reset and will just continue to increment (I am assuming that that's how the EM will work since it did not say anything in the manual about it resetting automatically). That being said, I cannot just use the logic of me getting the recorded kWh from the EM every end of the month because it will only be accurate during the first month.

Another way that I thought was to store the recorded kWh before the month jumps to the next one and just subtract it to the latest recorded kWh once the latest month ends (and then repeat the same process before it jumps to the next month). Right now this is the only idea that I think will work. Do you guys have other idea on how to approach this that might be more efficient?

Thank you.
 
This is one of those situations where you take a giant leap backwards and ask yourself - what do I want from this report?
What you have described is obtaining one figure at month end - not really a report then.

I would suggest you obtain a reading several minutes before midnight to provide you with a daily reading so you end up with a monthly report with daily trending. That's the easy bit.

Assuming you are extracting to a PLC then all calculations are done in one scan at midnight for your daily figures; and is achieved sequentially. You also have another single scan for month end calculations.

Based on the above philosophy, a lot depends on how you interface with a realtime clock - might be easier to do your daily calculation one second after midnight; how can you determine logically what day of the month it is; you will need 31 registers for calculated results - but not every month uses all registers so you need to know what month it is - you may find it easier to do month end calculations in the first second of the new month.

Your energy meter works like a non-resetting totaliser - you need to know when it goes back to zero - as opposed to giving you false results.

Now try and code the above in the most efficient way possible; and get it comissioned without too much 'simulation' !

Finally, you have not mentioned how to display this monthly report.
I've done conveyor throughput rates for my own information so results appear on a progammer; also done water flowrates to appear as bar graph on HMI.
 
This is one of those situations where you take a giant leap backwards and ask yourself - what do I want from this report?
What you have described is obtaining one figure at month end - not really a report then.

I would suggest you obtain a reading several minutes before midnight to provide you with a daily reading so you end up with a monthly report with daily trending. That's the easy bit.

Assuming you are extracting to a PLC then all calculations are done in one scan at midnight for your daily figures; and is achieved sequentially. You also have another single scan for month end calculations.

Based on the above philosophy, a lot depends on how you interface with a realtime clock - might be easier to do your daily calculation one second after midnight; how can you determine logically what day of the month it is; you will need 31 registers for calculated results - but not every month uses all registers so you need to know what month it is - you may find it easier to do month end calculations in the first second of the new month.

Your energy meter works like a non-resetting totaliser - you need to know when it goes back to zero - as opposed to giving you false results.

Now try and code the above in the most efficient way possible; and get it comissioned without too much 'simulation' !

Finally, you have not mentioned how to display this monthly report.
I've done conveyor throughput rates for my own information so results appear on a progammer; also done water flowrates to appear as bar graph on HMI.
Hi,

I appreciate your response and input regarding my query. Yes, there other parameters that I am going to include in the report. I just focused on the kWh since it will be the highlight of the said report that I am trying to generate. With regards to your suggestion on how to scan the the data that I need for my calculations, I think it is the better approach compared to what I initially thought of. I'll proceed on figuring out how to code it the most efficient way possible. Now that you mentioned it, I haven't really thought of how this report should actually look like.

By the way, this activity is just an experiment that I am trying to conduct to further expand my skills in programming Automation Controllers. Your response is really appreciated. I'll let you know on what I came up with once I am done with this. Thanks a lot!
 
What do you need the report for?
Why don't you use SCADA and DB (such as SQL)?
From what I understood you only need to record once a month the KWh in the energy meter. So may be it would be easier to record only the differences of each month and then sum them up at the demand of the record. But for that you will define some array that would be limited in amount of data to store.
KWh ( n ) = KWh - (KWh(n-1) + Kwh(n-2)+...+KWh(1))
 
Top