ATO if PH is less than 8.5 and Res is full

Do you have a question on how to do something.
Ask in here.
Post Reply
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

ATO if PH is less than 8.5 and Res is full

Post by Smotz »

All - will this work?

I want to ensure that I have at least 15% water in my reservoir AND PH is less than 8.5 for the ATO to activate. More importantly, I want the ATO to stop if PH hits 8.5

Code: Select all

// Main Top Off
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 15 && ReefAngel.Params.PH<850) // Ensure there is 15% of water in the Top Off reservoir and PH is less than 8.5
    {      
      if ( ReefAngel.WaterLevel.GetLevel(1) <= 80 )  ReefAngel.Relay.On(Topoff);
      if ( ReefAngel.WaterLevel.GetLevel(1) >= 100 ) ReefAngel.Relay.Off(Topoff);
    }
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO if PH is less than 8.5 and Res is full

Post by rimai »

No :(
But almost there. You got the idea, you just missed one detail.
You need to make sure you turn off the relay should the level go below 15% or ph is greater than 8.5

Code: Select all

// Main Top Off
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 15 && ReefAngel.Params.PH<850) // Ensure there is 15% of water in the Top Off reservoir and PH is less than 8.5
    {      
      if ( ReefAngel.WaterLevel.GetLevel(1) <= 80 )  ReefAngel.Relay.On(Topoff);
      if ( ReefAngel.WaterLevel.GetLevel(1) >= 100 ) ReefAngel.Relay.Off(Topoff);
    }
    else
    {
      ReefAngel.Relay.Off(Topoff);
    }
Roberto.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: ATO if PH is less than 8.5 and Res is full

Post by Smotz »

Much appreciated, sir. I assumed that since the relay is set off in the setup area it is by default. But, no harm specifying it!
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO if PH is less than 8.5 and Res is full

Post by rimai »

Well, setup section only happens when your controller boots up, but if you code like this, it would work just as well.

Code: Select all

// Main Top Off
    ReefAngel.Relay.Off(Topoff);
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 15 && ReefAngel.Params.PH<850) // Ensure there is 15% of water in the Top Off reservoir and PH is less than 8.5
    {      
      if ( ReefAngel.WaterLevel.GetLevel(1) <= 80 )  ReefAngel.Relay.On(Topoff);
      if ( ReefAngel.WaterLevel.GetLevel(1) >= 100 ) ReefAngel.Relay.Off(Topoff);
    }
Roberto.
Post Reply