PDA

View Full Version : Code problem ATO config


jeremyjoslin
06/02/2013, 09:22 PM
Background: I setup my Apex to do ATO for me. It's been working for 6+ months without a problem. I haven't changed anything, really, in that time. Except for a few beta (then production) versions of the Apex firmware. I've been at production version since it was released.

I use a basement sump which has 3 float switches at different levels. The switches are Normal Open so that when they float up they Close.

Here's the order and arrangement of the switches:

--0-- (switch 2)

--0-- (switch 6)
++++++++++++++++ normal water level +++++++

--0-- (switch 1)

I created virtual outlets to interpret the state of the switches:

[ vS_NeedH2O ]
Program Type: Advanced
Display Icon: Light B
Program:
Set OFF
If Switch6 OPEN Then ON
If Switch1 OPEN Then OFF
Defer 000:05 Then ON

[ vS_Sump_Lo ]
Program Type: Advanced
Display Icon: Left/Right Arrows
Program:
Set OFF
If Switch1 OPEN Then ON
Defer 000:05 Then ON

[ vS_Sump_Hi ]
Program Type: Advanced
Display Icon: Left/Right Arrows
Program:
Set OFF
If Switch2 CLOSED Then ON
If Switch6 OPEN Then OFF
If FeedA 031 Then OFF

The extra logic in here (Defer 000:05 Then ON) is to prevent chatter.
The FeedA 031 Then OFF is so that I don't get an alarm everytime I stop the pumps for a feed cycle (when the sump rises).

I then use the virtual outlets to define when I need to pump RO water from a 5 gallon bucket. The 5 gallon bucket also has a float switch and receives water from a solenoid-controlled RO system. Logic only allows the bucket to get filled once every 10 hours so there's a limit to how much I can "overfill" my tank with fresh water. I mix kalk powder into the bucket on occasion and an aqualifter pumps water out of the bucket into the sump when water is needed in the tank. As an extra backup, I monitor salinity for big swings.

[ 4_ATO_Kalk_P ] (aqualifter into sump)
Program Type: Advanced
Display Icon: Up/Down Arrows
Program:
Fallback OFF
Set OFF
If Outlet vS_NeedH2O = ON Then ON
If Outlet vS_Sump_Hi = ON Then OFF
If pH > 08.40 Then OFF
Defer 000:10 Then ON
Defer 001:00 Then OFF

Problem: Something has failed. On several occasions in the last week, I've noticed a swing in salinity (minor), checked on the sump, and found the water level in the sump to be above Switch2 and my 5 gallon bucket empty. I say "several occasions" because at first I thought it was a stuck switch6 so I jiggled it and found it clean and easily moving. Maybe it was a glitch? So I tried again. Next day, same thing. This time I noticed that my VO called vS_NeedH2O was in an ON state. I jiggled the switches again, and nothing changed. I turned that VO to OFF and then back to AUTO, and it stayed in the OFF state. Now I thought maybe something was wrong with the Apex. Next day, it happened again so I restarted my Apex. That didn't do anything. I had to turn the VO to OFF and back to AUTO for it to switch off.

I can't figure it out. I think it may be a bad Switch6 still, but something is wrong in that even if Switch6 stays OPEN (when it should report CLOSED), my VO called vS_NeedH2O should still be OFF (it clearly stayed on), and even more of a backup my VO called 4_ATO_Kalk_P should stay OFF because of this line

If Outlet vS_Sump_Hi = ON Then OFF

But both of those safeguards failed. I was saved by my mechanical bucket limit and a salinity warning.

Can someone review my logic. Help me sort this out. It's killing me that I can't figure out what's wrong.

Thanks.

jeremyjoslin
06/03/2013, 08:25 AM
This felt like an Apex problem, but that's unlikely. More likely is my programming has built-in errors that need to be fixed. The switches are cheap, but don't explain the problem (that I can see).

jeremyjoslin
06/10/2013, 08:19 PM
I'm rewriting everything.... back to basics....