Page 3 of 5
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:08 pm
by lnevo
You are missing the - between now() and 3600
Look at the other lines for reference.
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:26 pm
by Sacohen
I had it looking exactly like the code 2 lines above for the DeNit_Pump, but it was still giving me an error, so I copied that line and changed DeNit_PUmp to ATO_Pump and the <1200 to <1500 and it compiled fine.
It is in the middle of the 7pm cycle now so I can't do anything until it finishes.
Thanks for the help.
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:48 pm
by Sacohen
Ok. Got it uploaded and immediately after the reboot the ATO pump kicked in.
It was already at 34%. It ran for about 1 min and took it up to 35% before it shut off.
It shouldn't have gone on at all since it was not below 31%.
This makes no sense.
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:48 pm
by lnevo
Make sure the exclamation is there!!! Otherwise it will turn the ato pump ON!!
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:51 pm
by lnevo
Wait!! Go back to the old code for now too...i need to make sure I'm not missing something...may need to use the if one i gave you before i changed it to look like the denit ones! Shoot..let me think...
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:54 pm
by lnevo
Yeah, we cant use Set...sorry i'm running you in circles.. Replace the line with te one i gave earlier...im gonna double check it and post it next so wait a min...
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:59 pm
by Sacohen
I had removed the exclamation point because it wasn't in the other lines.
I'll wait for what you have next.
Thanks
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 4:59 pm
by lnevo
Code: Select all
if (((now()-3600)-1200)%21600<1500) ReefAngel.Relay.Off(ATO_Pump); // Start time same as DeNit_Pump but keep it off for 1500 seconds (25 minutes)
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 5:02 pm
by Sacohen
So replace
Code: Select all
ReefAngel.Relay.Set(ATO_Pump,!((now()-3600)-1200)%21600<1500); // Start time same as DeNit_Pump but for 1500 seconds (25 minutes)
With
Code: Select all
if (((now()-3600)-1200)%21600<1500) ReefAngel.Relay.Off(ATO_Pump); // Start time same as DeNit_Pump but keep it off for 1500 seconds (25 minutes)
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 5:58 pm
by lnevo
Yes, exactly.
The issue with the first one its time for the DeNitrate pump to turn on, the ato will indeed be off, but all other times the port will be ON!!
The second one says if it's time for the nitrate to start then turn the ATO off otherwise it doesn't do anything... Which is what we want
Re: ATO code is not working properly.
Posted: Fri Sep 13, 2013 6:27 pm
by Sacohen
I uploaded it and it seems good. I'll see what it does at 7am
Thanks for putting up with me.
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 6:02 am
by lnevo
No worries...did it work?? Do we have to wait till 1???
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 7:46 am
by Sacohen
I wasn't watching it very closely at 7am (I had to get my son ready for therapy) but I didn't hear it kick in at all. on the other hand the WL was at 35% prior to the exchange so it will only drop about 3% during the exchange so I don't think it got below 31%. during the exchange.
It's 33% now so I'm sure at 1pm it will drop below 31%.
I did check the relay activity and saw that the ATO port went on at about 1:05am, in the beginning of a cycle, but unless I see or hear it I'm not going to really bring it up.
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 10:09 am
by Sacohen
Sorry to say that 1pm came, the water exchange started and when the WL dtropped to 30% the ATO pump kicked in.
This doesn't make any sense?
Right now I turned off the mask so it is not dumping fresh water in when it really doesn't need to, or at least to put in as much as it thinks it does.
When the 20 min is over I'll turn it back on.
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 11:41 am
by lnevo
Alright, go back to the old code with the 40 minutes. I need to do some modulo math and check the statement because maybe it is not doing exactly what we want... I think actually I may know why at least now.
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 12:01 pm
by Sacohen
Sorry this is not going as easy as you may have thought when you said you would help me. I'll go back to the lady code. If you,don't have time for this let me know and I think there is a version that works good enough.
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 12:45 pm
by lnevo
No, I'm happy to help, this is a good challenge...we'll get it!!!!
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 1:00 pm
by Sacohen
I know you like a challenge, but I can also tell you're getting frustrated a bit and when you say we'll, you mean you'll get it.
Re: ATO code is not working properly.
Posted: Sat Sep 14, 2013 1:05 pm
by lnevo
Well i cant do it without your patience either...and my growling in frustration has nothing to do with my determination!
Re: ATO code is not working properly.
Posted: Sun Sep 15, 2013 5:07 am
by Sacohen
Just a confirmation that the 40 min code works.
I put it in last night and didn't catch the 7pm or 1am cycles, but see on the portal that the ATO wa snot triggered and I caught the 7am cycle and didn't hear the ATO Pump kick in at all.
I like that pump that Roberto sells, but it's so noisy.
I'm considering re-arranging my tank in the guest room and if I move it to the other wall it boarders on the garage, I may put the ATO pump in the garage along with some other equipment.
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 8:02 am
by lnevo
Sacohen wrote:No. Sorry to say you are wrong about the port (relays) being backwards.
I've checked that many times when we first set it up (with cosmith71) and more recently barbecue the dosing pump broke and I had to replace a part, so I watched that it was turning correctly when I did that.
I'm sorry to say that the MATH does not support this... From the checking that I have done, this is what I see..
The math for this line happens first.
Code: Select all
ReefAngel.Relay.Set(DeNit_Doser,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
The math for this line happens next.
Code: Select all
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
Based on what I've been able to determine the ATO would be disabled starting at the 20 minute mark and continuing for 25 minutes which is not what we want... it would be interesting to test the previous lines I used and see if the ATO is in fact disabled during the 2nd 20 minutes... but I don't think it's necessary
Can you please try the following code and we'll see the result.
Code: Select all
if ( (now()-3600)%21600<1500) ReefAngel.Relay.Off(ATO_Pump);
If anyone can explain to me why I'm wrong regarding the math above fine, but everything points to this that I can tell.
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 8:13 am
by lnevo
Here is how I've tested this in a nutshell...
Here's the line for the doser
Code: Select all
ReefAngel.Relay.Set(DeNit_Doser,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
now() at 7am = 1378450800 (that's today's 7am)
1378450800 - 3600 = 1378447200
1378447200 % 21600 = 0
0 < 1200 = True
True = Relay is On.
So the DeNit_Doser is on from 7am until 20 minutes later when
7:20am = 1378452000
1378452000 - 3600 = 1378448400
1378448400 % 21600 = 1200
1200 < 1200 = false
False = Relay Off
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 8:18 am
by lnevo
Continuing the results:
Code: Select all
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
now() at 7:20 = 1378452000
1378452000 - 3600 = 1378448400
1378448400 - 1200 = 1378447200
1378447200 % 21600 = 0
0 < 1200 = true
True = DeNit_Pump is on.
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 8:20 am
by lnevo
Anyway, I know you're not a programmer, and some of this math may not make sense, but to repeat through all the noise.
Please try this line to disable the ATO during the DeNitrate Process. I'm 99.9% sure at this point after double/triple checking the math
Code: Select all
if ( (now()-3600)%21600<1500) ReefAngel.Relay.Off(ATO_Pump);
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 10:02 am
by Sacohen
You are right. None of that made sense to me. It read like Charlie Brown's teacher talking.
I will try to get the line in before the 7pm cycle today and see what happens.
Can you tell me where this line will go?
I currently have the 40 min off code in the RA is it going in that version or in your latest version on page 6?
Does it go after...
////// Place your custom code below here
ReefAngel.Relay.Set( Moon_Lights, !ReefAngel.Relay.Status( Actinic_Lights ) );
ReefAngel.Relay.Set(DeNit_Doser,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 10:11 am
by lnevo
It would be the same line that you edited in the recent code I posted. NOT The 40 minute off code. That one has a larger block of code to replace.
Sacohen wrote:So replace
Code: Select all
ReefAngel.Relay.Set(ATO_Pump,!((now()-3600)-1200)%21600<1500); // Start time same as DeNit_Pump but for 1500 seconds (25 minutes)
With
Code: Select all
if (((now()-3600)-1200)%21600<1500) ReefAngel.Relay.Off(ATO_Pump); // Start time same as DeNit_Pump but keep it off for 1500 seconds (25 minutes)
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 10:14 am
by lnevo
It would replace this line in the code on page 6.
Code: Select all
// Disable ATO
ReefAngel.Relay.Set(ATO_Pump, !((now()-3600(-1200)%21600<1500); // Start time same as DeNit_Pump but for 1500 seconds (25 minutes)
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 10:23 am
by Sacohen
Thanks. I'll try to do it before I leave work so I can observer what happens when I get home.
I will triple check the the ports are not reversed also.
Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 11:01 am
by lnevo
Well don't change any ports yet! but watch your activity for sure.

Re: ATO code is not working properly.
Posted: Mon Sep 16, 2013 11:09 am
by Sacohen
No, I won't change ports because I know this is written for the ports the way you think they are.
I'm just going to confirm if they are correct or backwards.