When is it correct to initialize a timer and how?
Be sure to use "If Time > 00:00 Then XXX ON/OFF" correctly.
It is very easy to get carried away and use the "If Time" statement to rid your
display of "U"s but this may not always produce the output you expect. The
following example is a case when you should NOT use the "If Time" statement:
If PH > 7.0 Then CO2 ON // CO2 ON when PH > 7.0
If PH < 6.5 Then CO2 OFF // CO2 stays ON until PH < 6.5
Or
If Temp > 79.0 Then COL ON // COL ON when Temp > 79.0
If Temp < 78.0 Then COL OFF // COL stays ON until Temp < 78.0
Or
If ORP < 300 Then OZN ON
If ORP > 350 Then OZN OFF
(I think you should get the idea by now).
You may be thinking, why can't you use the "If Timer" to initialize CO2, COL and
OZN, after all you will get a "U" if the AC3 is updated and the values fall in
the middle of the ranges and the timer might be ON or OFF and I won't know.
To understand this we need to walk through the logic, placing the initializer
there to see why it causes problems...
Let's take one:
If Time > 00:00 Then COL OFF // Init COL to OFF
If Temp > 79.0 Then COL ON // COL ON when Temp > 79
If Temp < 78.0 Then COL OFF // COL OFF when Temp < 78
Hmm, looks like it will work, right.....
What will happen in the above is that the COL will turn on when Temp > 79.0 but
it will turn off when the Temp drops to 79.0; it will not stay on until Temp <
78.0. Do you see why, I'll explain...
The "If Time" initializes COL to "OFF" and this happens for each evaluation
cycle. Next the Temp is tested and if it is 79.1 (which is greater than 79.0)
the COL os turned ON (great, just what I wanted). Next evaluation the COL if
initialized to "OFF" and the Temp has dropped to 79.0 and since 79.0 is not >
79.0 COL state remains unchanged (OFF, set by the "If Time") and since no other
statement affects COL it will be turned off.
But what state is my timer in when "U" is displayed. The real answer is that it
can be ON or it can be OFF; the "U" says that the AC3 does not if it should turn
it ON or OFF (so it does nothing). Wow, that means my heater could be on and I
don't know it. The short answer is yes, but if the heater is ON then the tank
temp will raise and you should hit the "If Temp" which will turn the heater OFF
and remove the "U" until the next time you reset the AC3.
A good rule of thumb...
* Never use "If Timer > 00:00" to initialize a timer when you have ON and OFF
statements for a timer, sooner or later the "U" will go away and the timer state
will be known.
* Use "If Timer" when a timer can be initialized once, and changed by many
conditions (it saves program lines). For example, turn a pump on by default and
program feed cycles to turn it off.