# Equation * time

## Recommended Posts

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.

##### Share on other sites

I am really trying to find  calculating cumulative kW-h. over a span of 10 min. test.

##### Share on other sites

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 []

##### Share on other sites

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.

##### Share on other sites

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.

##### Share on other sites

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.

##### Share on other sites

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.