Here’s a program I use to keep up with the last time our emergency generator comes on. When the generator is running, the voltage at the battery is up slightly because it is charging it.
The problem is that this problem seems to randomly jump to its sub-routine every few days. Other than using a GoSub command, which I know you don’t like, have I done anything else stupid here? I use the trend log and the only time GENRUNS is “On” is while the generator is actually running. Maybe I am using the Time-On command incorrectly? Ted
10 REM GEN OFF TIME CALCULATOR
40 REM IF THE ABOVE CONDITIONS ARE MET THEN THE GEN IS RUNNING
50 REM LASTHRS IS THE TIME IN HOURS SINCE THE LAST TIME THE GEN RAN
60 REM GENSINCE IS THE TIME IN DAYS SINCE THE LAST TIME THE GEN RAN
70 REM GENRUNS IS A FLAG TO KNOW IF THE GEN IS RUNNING
80 LASTGEN = LASTGEN + 0.008
90 LASTHRS = LASTGEN / 60
100 GENVOLTS = BATTVOLT * 2
110 GENSINCE = LASTGEN / 1440
120 IF GENVOLTS > 14 AND GENVOLTS < 14.500 THEN START GENRUNS ELSE STOP GENRUNS
170 IF TIME-ON ( GENRUNS ) > 00:15:00 THEN GOSUB 600
200 END
599 REM ================================================
600 REM THIS IS THE TRIGGER ROUTINE THAT ZEROES OUT THE
610 REM WAITING SECONDS WHICH
615 REM TRIGGERS A GEN TIME RESET
640 LASTGEN = 0
650 GENSINCE = 0
660 RUNDAY = DOW
690 RETURN