Code for Doser based on Schedule

Do you have a question on how to do something.
Ask in here.
Post Reply
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Code for Doser based on Schedule

Post 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!
Jack
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for Doser based on Schedule

Post 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
Roberto.
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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!
Jack
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for Doser based on Schedule

Post by lnevo »

I think it will do 11
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for Doser based on Schedule

Post by rimai »

If you also need the 10am, you need to change the >=10 to only >10.
Roberto.
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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.
Jack
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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.
Jack
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for Doser based on Schedule

Post by lnevo »

14.96 ml
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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?
Jack
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for Doser based on Schedule

Post 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 :)
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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.
Jack
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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!
Jack
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for Doser based on Schedule

Post by rimai »

It is probably missing from before the code you posted
Roberto.
howaboutme
Posts: 246
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: Code for Doser based on Schedule

Post 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!
Jack
Post Reply