Accurate timesource / loop execution time?
-
Hi,
I'm developing (UiFLow2, Core2) powermeter/energy counter for wood fired boiler. So far, I've been able to create required hardware, read the sensors using ADC and digital input, but because it's powermeter, it needs exact timekeeping to count generated energy and power accurately. My software has five conditions in main loop for different states of boiler and only one of them is energy generating, other are warming up, cooling down etc...I think there are two options for calculating energy and power:
-
loop that lasts exactly known time, preferably one second (1000ms) or
-
loop lasting artificial time and time period is measured (this can be below one second, or slightly more, even variable)
For the accuracy requirement, for option one it's not catastrophic to have, say 3590...3010 measurements in hour, but for example 2972 would be terrible accuracywise. For option two, still hoping to get measurement about every second. There are three purely analog temp sensors and two digital inputs, conversion times shouldn't be problem.
Is 1000ms timer (UiFlow2 Timer) right tool for this, or timedelta (UiFLow2 Time / ticks)? This should be very easy, if loop execution time is known. Doucmentation for UiFlow2 still need improvements (compared to UiFlow1). I know this ain't running on RTOS, but still want it to be as accurate as possible.
-