Posted 19 Mar 2015 Now, I know this is simple... kW * H = kWh... My problem is different... I have a power monitoring device (Diris A40) with a 4-20mA module giving me instantaneous power in kW, and from that I need to generate the previous 7 days kWh. Can it be done? I have a function block that takes a pulse to generate totals, and if I can generate this pulse from another bit of code I would sleep a lot better at night. I'm thinking of taking a rolling average over an hour and generating a pulse every ( 1 / AveragekW ) hours, or ( 60 / AveragekW ) minutes. Would this work? My brain is fried right now which I why I'm asking for help. I'm not asking for anyone to write my code, just outline how I might go about this or tell me I'm stupid and you simply can't do it. Before anyone says, this is for use over hundreds of aging sites, so it's cheaper and easier to develop a function block than buy the pulse module for the Diris. Thanks in advance Share this post Link to post Share on other sites
Posted 19 Mar 2015 You could accumulate kWh over a one hour period. Also create a buffer of 168 elements. At the conclusion of the hour, push the latest hour's kWh into the buffer and push out the oldest value. The sum of all 168 values in the buffer is the total over the past seven days. Share this post Link to post Share on other sites
Posted 21 Mar 2015 What PLC are you using? Many PLCs have a Totaliser function to accumulate volume based on measured flow rate. This is basically the same application, but kWh is the measured "volume" and kW is the "rate". Share this post Link to post Share on other sites
Posted 22 Mar 2015 Nailed it, thanks guys. I basically modded an old flow totaliser block (like Mr Automation suggested), works a dream. Thanks all round Share this post Link to post Share on other sites
Posted 22 Mar 2015 No problem. Glad to know it worked out for you! Share this post Link to post Share on other sites