Page 1 of 1

Code for Doser based on Schedule

Posted: Tue May 27, 2014 5:51 pm
by howaboutme
Hi all....

Please verify this code below. I am only dosing Alk using a BRS 1.1 mL doser on port 6. I only want to dose it between the hours of 10pm and 10am, once an hour for 68 minutes. I will not hard code this so I can adjust on the fly at least during this trial period. Total is 12 doses.

Lee...I've decided (as you've suggested) to get the basic dosing schedule down first and let it run for a while before I try your custom code..which I am very interested in understanding...

I've included this:

Code: Select all

ReefAngel.DosingPumpRepeat1( Port6 );
And this in the custom code area:

Code: Select all

////DoserAlk Schedule
            if ((hour() >= 10) && (hour() < 22)) { // Between 10am and 10pm we will disable Port 6
              ReefAngel.Relay.Off(Port6);
            }
Will this accurately do what I want it to do? The only thing I'm concerned about is will it dose at the first hour and the last hour? Should I add some buffer in the scheduling? Like use 9:30am (in seconds) and 9:30pm instead? Thanks!

Re: Code for Doser based on Schedule

Posted: Tue May 27, 2014 6:04 pm
by rimai
Looks good.
It will not dose starting at 10:00am all the way to 9:59pm

Sent from my SM-G900P using Tapatalk

Re: Code for Doser based on Schedule

Posted: Tue May 27, 2014 6:30 pm
by howaboutme
So based on what you said, it will only run the doser 11 times during the set period. I want it to run 12 times. So I need to set the schedule from 11 am so it will dose at the 10 am hour. Am I correct or will my initial code dose 12 times? Thanks!

Re: Code for Doser based on Schedule

Posted: Tue May 27, 2014 6:51 pm
by lnevo
I think it will do 11

Re: Code for Doser based on Schedule

Posted: Tue May 27, 2014 8:14 pm
by rimai
If you also need the 10am, you need to change the >=10 to only >10.

Re: Code for Doser based on Schedule

Posted: Wed May 28, 2014 4:30 am
by howaboutme
Thanks Roberto. I thought about that last night too and it's cleaner than changing it to 9. I will test the code out tonight and drip into a measuring cup to measure.

Re: Code for Doser based on Schedule

Posted: Thu May 29, 2014 5:22 pm
by howaboutme
So I ran the doser on schedule last night and it seems to only have pushed out less than 10mL. It's suppose to be 15mL so something's not right here. Before all of this, I did run the pump for 10 minutes and it did spew out approximately 11 mL's. Can someone check my math? I actually used the OSC spreadsheet from Reeftronics to help me. I am running it 1x per hour for 68 mins x 12 times. Based on 1.1 mL/minute (approx), I should get ~ 15mL. Am I right on the math?

I am going to run a stop watch tonight to see if the pump is actually running the set amount of time. I have set this via the portal. Thanks.

Re: Code for Doser based on Schedule

Posted: Thu May 29, 2014 6:12 pm
by lnevo
14.96 ml

Re: Code for Doser based on Schedule

Posted: Thu May 29, 2014 7:06 pm
by howaboutme
Thanks for the verification..

So I just timed the pump. It's being turned on for exactly the right amount of time. Could evaporation be an issue? I can't check the amount dosed until I get home, which is like 9 hrs after the last dose. That doesn't sound right to me but can't think of anything else. The only other ?? is if the pump is not 1.1 and is slightly less.

I am upping the time the pump turns on for 72 seconds and see where I am at. I can see how Lee's code would work better because it doses on volume rather than time, right?

Re: Code for Doser based on Schedule

Posted: Fri May 30, 2014 5:38 am
by lnevo
In the end it would dose the same amount of time because it would be doing the same math we just did.

The only thing it does better is help you calibrate and not do math later.

Evaporation could definitely be at play.

I wouldn't worry too much at the end of the day your going to set the timer (or volume) based on the alk in the tank.

Meaning start it up dosing your tank once your comfortable, and actually your current 68 second would be safer to start out with. Measure your alk. If it dropped raise the number of seconds. If it went up, lower it. A couple of seconds up or down isnt going to make or break anything. Monitoring the tank is going to be the best method.

Here's something else you can do to rule out evap. Measure the alk of your solution and the alk that you measure out overnight. If its higher in the measure out cup then dilute it back to 15ml and test it again. If its closer than its an evaporation issue :)

Re: Code for Doser based on Schedule

Posted: Fri May 30, 2014 6:01 am
by howaboutme
i checked the measuring cup this morning before I left for work and after 7 doses, it was at around 10mL. This is based on 72 seconds per dose. It still have 5 doses left so that will definitely be above 15 mL. Based on that, I'm thinking everything is working correctly and evaporation probably was the culprit. I agree with you that starting with 68 seconds is best and then monitor. Will start tonight! Thanks.

Re: Code for Doser based on Schedule

Posted: Sun Sep 26, 2021 1:26 pm
by howaboutme
This was my thread many years ago. I'm looking to do the exact same thing. When I plugged in the code:

Code: Select all

  //DoserAlk Schedule
              if ((hour() > 10) && (hour() < 22)) { // Between 10am and 10pm we will disable Port 6
              ReefAngel.Relay.Off(Port6);
            }  
I get an error saying expected ";" before if.

So I added it:

Code: Select all

  //DoserAlk Schedule
              ;if ((hour() > 10) && (hour() < 22)) { // Between 10am and 10pm we will disable Port 6
              ReefAngel.Relay.Off(Port6);
            }  
It complied fine. I'm curious why the error? Did something change in the background for this line to need the ";"? Will this do what I want?

Thanks!

Re: Code for Doser based on Schedule

Posted: Sun Sep 26, 2021 7:52 pm
by rimai
It is probably missing from before the code you posted

Re: Code for Doser based on Schedule

Posted: Mon Sep 27, 2021 4:32 am
by howaboutme
rimai wrote:It is probably missing from before the code you posted
Weird because i don't recall getting any errors and the controller functioned as ordered. But it's been a few years. Thanks!