Page 1 of 1
Help Code Alternating Tunze Pumps
Posted: Tue Feb 26, 2013 8:53 am
by jayclaire
Please help me alter current code to run 2 Tunze pump at alternating mode
Roberto wrote this for me to run 1 Tunze pump at 75% from 2pm to 12am then from 12am to 2pm at 25%
////// Place your custom code below here
if (hour()>14)
{
ReefAngel.PWM.SetDaylight (75);
ReefAngel.PWM.SetActinic (75);
}
else
{
ReefAngel.PWM.SetDaylight (25);
ReefAngel.PWM.SetActinic (25);
}
////// Place your custom code above here
New settings:
2 Tunze pumps to run at 75% from 12pm -12am at 75% alternating every 60 seconds then from 12am-12pm at 25%
Thank you
~JaY
Re: Help Code Alternating Tunze Pumps
Posted: Tue Feb 26, 2013 10:13 am
by rimai
Try this:
Code: Select all
////// Place your custom code below here
if (hour()>14)
{
ReefAngel.PWM.SetDaylight (now()%(120)<60?25:75);
ReefAngel.PWM.SetActinic (now()%(120)<60?75:25);
}
else
{
ReefAngel.PWM.SetDaylight (25);
ReefAngel.PWM.SetActinic (25);
}
////// Place your custom code above here
Re: Help Code Alternating Tunze Pumps
Posted: Tue Feb 26, 2013 10:18 am
by jayclaire
Thank you for the fast respond - I'll give this a try.
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 11:16 am
by jayclaire
Hey Roberto can you please change the alternate time to every 2 hours instead of every 60 seconds.
Thanks - JaY
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 11:18 am
by rimai
Come on man... you can do it

Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 11:59 am
by jayclaire
Is this correct?
////// Place your custom code below here
if (hour()>14)
{
ReefAngel.PWM.SetDaylight (now()%(10)<2?25:75);
ReefAngel.PWM.SetActinic (now()%(10)<2?75:25);
}
else
{
ReefAngel.PWM.SetDaylight (25);
ReefAngel.PWM.SetActinic (25);
}
////// Place your custom code above here
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 12:05 pm
by lnevo
I think you need to % 14400 with the remainder < 7200 (so modulus the day by 4 hours (14400) and remainder less than 2 hours (7200)
Previously it was modulus 2 minutes (120) with the remainder being less than 1 minutes (60)
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 12:07 pm
by rimai
The code uses seconds and not hours.
120 seconds = total cycle
60 seconds = time to switch from 1st half to 2nd half of cycle
You can even make asymmetric waves... If you make total cycle 120 and switch 20, you will have 1st cycle duration at 20seconds and 2nd half at 100s.
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 12:22 pm
by jayclaire
Okay how about this?
////// Place your custom code below here
if (hour()>14)
{
ReefAngel.PWM.SetDaylight (now()%(4*60*60)<(2*60*60)?25:75);
ReefAngel.PWM.SetActinic (now()%(4*60*60)<(2*60*60)?75:25);
}
else
{
ReefAngel.PWM.SetDaylight (25);
ReefAngel.PWM.SetActinic (25);
}
////// Place your custom code above here
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 12:28 pm
by rimai
There you go
Not too difficult, right?
Re: Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 12:48 pm
by jayclaire
lnevo wrote:I think you need to % 14400 with the remainder < 7200 (so modulus the day by 4 hours (14400) and remainder less than 2 hours (7200)
Previously it was modulus 2 minutes (120) with the remainder being less than 1 minutes (60)
Thanks lnevo - Are u the same lnevo in MR?
Help Code Alternating Tunze Pumps
Posted: Wed Mar 06, 2013 2:01 pm
by lnevo
Yep
