Multiple on/off times

Do you have a question on how to do something.
Ask in here.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Multiple on/off times

Post by Sacohen »

Lee;

I've forgot how my code for the denitrification chamber is set up.

I want to change the amount of time that the pump is on from 20 min to 10 min.

This is the original code...

Code: Select all

// DeNitrate Routine
  int DeNit_Offset=3600; 
  int DeNit_Repeat=21600;
  int DeNit_Doser_Offset=1200;
  int DeNit_Doser_Runtime=1200;
  int DeNit_Pump_Runtime=1200;
  int DeNit_ATO_Offtime=1500;

  // Pump comes on first
  ReefAngel.Relay.Set(DeNit_Pump,(now()-3600)%21600<1200);       // Runs for 1200s every 21600 seconds  
  // Doser comes on second
  ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
  
Do I change it at the DeNit_Doser Runtime or in this line...

Code: Select all

// Doser comes on second
  ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
To this....

Code: Select all

// Doser comes on second
  ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<600); // Runs for 600s every 21600 seconds with 1200s offset
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple on/off times

Post by lnevo »

First off why don't we confirm that we're talking about the carbon source dosing pump and not the chamber fill/flush pump. Is yours like DrThompson? Are you dosing methanol?

Finally I believe you got it perfect it. What you should do now is change it ALSO in the Denit_Doser_Runtime and then at some point replace the numbers defined with the variable names so next time or for someone else who comes along you/them just need to change the variables.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Multiple on/off times

Post by Sacohen »

I'm talking about changing the time on the dosing pump.
Yes it is like DrThompsons. I have an actual denitrification chamber and pump from NatuReef and am switching from the Nitragone that they sell to a 50% Methanol/RODI mix, like he runs.

So it would be like this...

Code: Select all

// DeNitrate Routine
  int DeNit_Offset=3600; 
  int DeNit_Repeat=21600;
  int DeNit_Doser_Offset=1200;
  int DeNit_Doser_Runtime=600;
  int DeNit_Pump_Runtime=1200;
  int DeNit_ATO_Offtime=1500;

  // Pump comes on first
  ReefAngel.Relay.Set(DeNit_Pump,(now()-3600)%21600<1200);       // Runs for 1200s every 21600 seconds  
  // Doser comes on second
  ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<600); // Runs for 600s every 21600 seconds with 1200s offset
 
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple on/off times

Post by lnevo »

Yes, but let's use this finally...

Code: Select all

// DeNitrate Routine
int DeNit_Offset=3600; 
int DeNit_Repeat=21600;
int DeNit_Doser_Offset=1200;
int DeNit_Doser_Runtime=600;
int DeNit_Pump_Runtime=1200;
int DeNit_ATO_Offtime=1500;

// Pump comes on first
ReefAngel.Relay.Set(DeNit_Pump,(now()-DeNit_Offset)%DeNit_Repeat<DeNit_Pump_Runtime);  // Runs denitrator pump
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-DeNit_Offset)-DeNit_Doser_Offset)%DeNit_Repeat<DeNit_Doser_Runtime); // Runs denitrator doser
And replace the DeNit_ATO_Offtime wherever you have that as well so you can just use the variables moving forward. You'll be less confused and you'll see what each number means.
Post Reply