Kilowatts is a measure of the rate of energy production/consumption. 1 watt is 1 joule per second.
So just for fun lets examine Kw/hr
. Kilowatts/hour is kJ*s
-1*hour
-1 = .278J*s
-2 which becomes 278milligram*meters
2/sec
4. Raising time to the fourth power is just complete nonsense for what you most likely want, unless you are trying to do some kind of diabolical twisted physics to end the universe.
Kilowatt-hours is a measure of an amount of energy, which I suspect is what you may be wanting. The word hours in the energy unit kwh does not mandate that the energy use rate be measured over a 1 hour period. It means that it is the amount of energy used if energy is used at a constant rate of 1KW for one hour, or that 1 kwh = 1KJ*s
-1*3600s = 3600KJ. Whether you use 3600KJ of energy in a millisecond, one second, one day, or one month, you have used one kilowatt-hour of energy.
So if energy consumption is what you want to measure and your energy use is not perfectly constant then you need to sample at short intervals to improve your accuracy.
Use the TOT instruction in a periodic task to totalize the kilowatts. Use a small period for the task, say maybe 100mS or 500mS. Make the gain 1. Make the timebase of the TOT 2, keeping in mind that the timebase does not dictate the time sampling and totalizing period, its there for the TOT instruction to use to compute the proper engineering units. If you were computing kilojoules instead of kwh you would use a time base of 0 to get the right units.