Richard Posted May 25, 2017 Share Posted May 25, 2017 I am trying to get a total sum at time increments. ex: probe1 * (0 sec) , probe1*(1 sec) and so on. And then adding this together. At real time. Can this be achieved with a timer and how could I start and stop the timer. Also for the probe variables, how can I save the previous and then have them sum up with the next. Link to comment Share on other sites More sharing options...
Richard Posted May 25, 2017 Author Share Posted May 25, 2017 I am really trying to find calculating cumulative kW-h. over a span of 10 min. test. Link to comment Share on other sites More sharing options...
AzeoTech Posted May 25, 2017 Share Posted May 25, 2017 You can just use sum. So, for example, if probe1 is your kw channel, then the total kwh over the last 10 minutes is: sum(probe1[systime(), systime() - 600]) * 6 where 600 is the number of seconds in 10 minutes, and 6 is the number of 10 minute sections in an hour. Of course you can substitute other variables for the times inside the [] Link to comment Share on other sites More sharing options...
Richard Posted May 25, 2017 Author Share Posted May 25, 2017 I already have the kWh and need it to add onto itself in previous time intervals of 1 second. I was reading other posts and I would like to have a variable channel to store the current reading of the kWh. Then a formula to sum up the total kWh. Once I get these values I want to get a chart/graph to show the progression of the accumulation curve. I tried using the following into an event but it did not work. kWh.AddValue(kWh[0]+(Power_Consumption.Time[0] - Power_Consumption.Time[1])) The power consumption is our calculated kWh. And the kWh is the channel ; test ; timing 0. Link to comment Share on other sites More sharing options...
AzeoTech Posted May 25, 2017 Share Posted May 25, 2017 That is the right method, but I'm not sure about the formula. What you provided will add the deltaT of consecutive power_consumption readings. It should be in the event for the power_consumption channel. Note that you have to initialize your kwh channel to 0, or the code will never work. This is because you reference kwh[0] which the very first time doesn't exist, so the formula fails. So, in a startup sequence or somewhere else, do kwh.addValue(0) to reset it. Link to comment Share on other sites More sharing options...
Richard Posted May 25, 2017 Author Share Posted May 25, 2017 Is this formula correct? sum((((Value+CT_2)/2)*208*.85)[systime(), systime(0)])/1000/3600 . We are trying to get the commutative value while the system is running. We are expecting the graph to always go up. Link to comment Share on other sites More sharing options...
Richard Posted May 26, 2017 Author Share Posted May 26, 2017 Ok I figured out a way to do this with the conversion/equation way. (((V*cosѲ )/2)/1000/3600)((Sum(Value))+Sum(CT_2)) increments of 1 sec, where the value is CT1. And taking the average of both CT's. Of course for our tests we have clear our history before we run the tests. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.