Help Code Alternating Tunze Pumps

Do you have a question on how to do something.
Ask in here.
Post Reply
jayclaire
Posts: 24
Joined: Tue Jan 29, 2013 11:15 am

Help Code Alternating Tunze Pumps

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

Re: Help Code Alternating Tunze Pumps

Post 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
Roberto.
jayclaire
Posts: 24
Joined: Tue Jan 29, 2013 11:15 am

Re: Help Code Alternating Tunze Pumps

Post by jayclaire »

Thank you for the fast respond - I'll give this a try.
jayclaire
Posts: 24
Joined: Tue Jan 29, 2013 11:15 am

Re: Help Code Alternating Tunze Pumps

Post by jayclaire »

Hey Roberto can you please change the alternate time to every 2 hours instead of every 60 seconds.

Thanks - JaY
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help Code Alternating Tunze Pumps

Post by rimai »

Come on man... you can do it :)
Roberto.
jayclaire
Posts: 24
Joined: Tue Jan 29, 2013 11:15 am

Re: Help Code Alternating Tunze Pumps

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

Re: Help Code Alternating Tunze Pumps

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

Re: Help Code Alternating Tunze Pumps

Post 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.
Roberto.
jayclaire
Posts: 24
Joined: Tue Jan 29, 2013 11:15 am

Re: Help Code Alternating Tunze Pumps

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

Re: Help Code Alternating Tunze Pumps

Post by rimai »

There you go :mrgreen:
Not too difficult, right?
Roberto.
jayclaire
Posts: 24
Joined: Tue Jan 29, 2013 11:15 am

Re: Help Code Alternating Tunze Pumps

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

Help Code Alternating Tunze Pumps

Post by lnevo »

Yep :)
Post Reply