ATO code is not working properly.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
You are missing the - between now() and 3600
Look at the other lines for reference.
Look at the other lines for reference.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
It is in the middle of the 7pm cycle now so I can't do anything until it finishes.
Thanks for the help.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
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.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
Make sure the exclamation is there!!! Otherwise it will turn the ato pump ON!!
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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...
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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...
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
I had removed the exclamation point because it wasn't in the other lines.
I'll wait for what you have next.
Thanks
I'll wait for what you have next.
Thanks
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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)
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
So replace
With
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)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)
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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
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
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
I uploaded it and it seems good. I'll see what it does at 7am
Thanks for putting up with me.
Thanks for putting up with me.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
No worries...did it work?? Do we have to wait till 1???
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
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.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
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.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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.
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
No, I'm happy to help, this is a good challenge...we'll get it!!!!
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
Well i cant do it without your patience either...and my growling in frustration has nothing to do with my determination!
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
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.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
I'm sorry to say that the MATH does not support this... From the checking that I have done, this is what I see..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.
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
Code: Select all
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
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);
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
Here is how I've tested this in a nutshell...
Here's the line for the doser
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
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
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
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
Continuing the results:
now() at 7:20 = 1378452000
1378452000 - 3600 = 1378448400
1378448400 - 1200 = 1378447200
1378447200 % 21600 = 0
0 < 1200 = true
True = DeNit_Pump is on.
Code: Select all
ReefAngel.Relay.Set(DeNit_Pump,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
1378452000 - 3600 = 1378448400
1378448400 - 1200 = 1378447200
1378447200 % 21600 = 0
0 < 1200 = true
True = DeNit_Pump is on.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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
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);
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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
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
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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
WithCode: Select all
ReefAngel.Relay.Set(ATO_Pump,!((now()-3600)-1200)%21600<1500); // Start time same as DeNit_Pump but for 1500 seconds (25 minutes)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)
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
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)
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
I will triple check the the ports are not reversed also.
- lnevo
- Posts: 5422
- Joined: Fri Jul 20, 2012 9:42 am
Re: ATO code is not working properly.
Well don't change any ports yet! but watch your activity for sure. 
- Sacohen
- Posts: 1833
- Joined: Sun Apr 21, 2013 6:25 am
- Location: Davie, FL
Re: ATO code is not working properly.
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.
I'm just going to confirm if they are correct or backwards.