New DCPump Modes - How to code???

Do you have a question on how to do something.
Ask in here.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

I uncommented the GyreModes and uploaded your code to one of my RA+ units. I manually changed the time to 1400 and 1900 and it worked both times.

The only thing I can recommend is doing an un-install/re-install of the the RA software on your computer. Maybe you have a corrupted library.

--Colin
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

The only potential problem I see is that between 1400 and 1500 you have both pumps set to sync. That means they will both be on for 10 minutes and off for 10 minutes at the same time.

--Colin
Paul_Velasco
Posts: 127
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Ok I will change sync

Will try to do a clean install
Image
Paul_Velasco
Posts: 127
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Reinstall did not work?
Is there something in the registry to delete?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New DCPump Modes - How to code???

Post by rimai »

Upload this code and see what you get:

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.AddStandardMenu();  // Add Standard Menu

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    // Ports that are always on

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ////// Place your custom code below here
      
    ReefAngel.PWM.SetDaylight (GyreMode(40,100,10,true) ); // Short pulse at 60% with 200m
    ReefAngel.PWM.SetActinic(GyreMode(40,100,10,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.ShowInterface();
}

It worked for me.
Roberto.
Paul_Velasco
Posts: 127
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

To Close this out:

Uninstalled and resinstalled Arduino application, did this twice. Then reinstalled once again last night and it worked?? No idea why it just worked.
Image
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

cosmith71 wrote:They're easy if you're using the DCPump libraries already.

Code: Select all

ReefAngel.DCPump.SetMode(Else,midpoint,offset);
Generates a random flow from midpoint-offset to midpoint+offset. For example, if you use:

Code: Select all

ReefAngel.DCPump.SetMode(Else,50,20);
You'll get a random flow that ranges between 30 and 70.

Code: Select all

ReefAngel.DCPump.SetMode(Gyre,speed,duration,threshold);
Generates a long, slow sine wave. Speed is the max speed, duration (in minutes), and threshold is the minimum speed. If you leave off threshold it will use 30 (or whatever you have set with DCPump.Threshold).

I'm not familiar with Sine. Maybe someone else can chime in.

--Colin
Are these DCPump codes meant for a single pump? How do I code for 2 pumps connected to the Actinic and DayLight channels?

Dr Davaraj
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

You will have lines like this in the setup section of your code

ReefAngel.DCPump.ActinicChannel = Sync;
ReefAngel.DCPump.DaylightChannel = AntiSync;

If you want to disable one channel you can set it to None.

If you want both pumps to do the same thing then set them both to Sync.
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

lnevo wrote:You will have lines like this in the setup section of your code

ReefAngel.DCPump.ActinicChannel = Sync;
ReefAngel.DCPump.DaylightChannel = AntiSync;

If you want to disable one channel you can set it to None.

If you want both pumps to do the same thing then set them both to Sync.
I have recoded like this. I do have

ReefAngel.DCPump.ActinicChannel = Sync
ReefAngel.DCPump.DaylightChannel = AntiSync

In the setup section.

///////Place your custom code below here

if (hour()>=4 && hour()<8)
{
ReefAngel.DCPump.SetMode(Sine, 30, 40);
}
else if (hour()>=8 && hour()<12)
{
ReefAngel.DCPump.SetMode(TidalSwell, 55); // TidalSwell at 55%
}
else if (hour()>=12 && hour()<16)
{
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);
}
else if (hour()>=16 && hour()<19)
{
ReefAngel.DCPump.SetMode(LongPulse, 0, 50, 10); // Long pulse at 0% to 50% with 10s pulse
}
else if (hour()>=19 && hour()<23)
{
ReefAngel.DCPump.SetMode(Else, 40, 10); // ElseMode 40 +/- 10%
}
else
{
ReefAngel.DCPump.SetMode(Gyre, 30, 50, 10); //GyreMode from 30% to 50% for 10 minutes
}

////// Place your custom code above here

When I run 'verify' code it compiles, except for:

ReefAngel.DCPump.SetMode(TidalSwell, 55); and
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);

When I insert this:
ReefAngel.DCPump.SetMode(TidalSwell, 55, true); it compiles for this mode. However 'millis' gives errors. How do I code for millis (standing wave like W1 in Jebao controller)?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

ReefAngel.DCPump.SetMode(TidalSwell 55); and
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);
You need 3 arguments to SetMode separated by a comma. Mode Speed and Duration. The first only has 2 and no comma and the second, that code block represents one argument and it represents a speed.

Try this:

ReefAngel.DCPump.SetMode(TidalSwell,55,0);

ReefAngel.DCPump.SetMode(Constant,millis();1200>750?50:0,0);
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

You could also use ShortPulse mode. It's like LongPulse but with duration in ms.

--Colin
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

lnevo wrote:
ReefAngel.DCPump.SetMode(TidalSwell 55); and
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);
You need 3 arguments to SetMode separated by a comma. Mode Speed and Duration. The first only has 2 and no comma and the second, that code block represents one argument and it represents a speed.

Try this:

ReefAngel.DCPump.SetMode(TidalSwell,55,0);

ReefAngel.DCPump.SetMode(Constant,millis();1200>750?50:0,0);
Lee,

I realised I had missed the comma in all the wave settings when I posted this on the forum. In my laptop the commas are there. I'll insert codes for TidalSwell and millis and let you know how it compiles and runs the pumps.

Thank you very much.

Dr Davaraj
Image
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

lnevo wrote:
ReefAngel.DCPump.SetMode(TidalSwell 55); and
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);
You need 3 arguments to SetMode separated by a comma. Mode Speed and Duration. The first only has 2 and no comma and the second, that code block represents one argument and it represents a speed.

Try this:

ReefAngel.DCPump.SetMode(TidalSwell,55,0);

ReefAngel.DCPump.SetMode(Constant,millis();1200>750?50:0,0);
Lee,

ReefAngel.DCPump.SetMode(Constant,millis();1200>750?50:0,0); gives error, but
ReefAngel.DCPump.SetMode(Constant,millis()%1200>750?50:0,0); compiles without error.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

Should be millis()% i copied and pasted and didnt notice the mistake. Good catch
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

I have this code set for Else mode.

ReefAngel.DCPump.SetMode(Else,50,20);

So the pump should ramp up and down from 30% to 70%, randomly. However, mine goes from 30% to 90% . Is there something wrong with the code or is that how the pump will work?

Dr Davaraj
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New DCPump Modes - How to code???

Post by rimai »

Are you using memory settings set to true or false?
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

The DCPump defaults for ElseMode is going to be equal to the speed. So for 50 it will be 50. For anything greater than 50, the speed will be 100-speed.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

case Else:
{
int offset = DCPump.Speed;
if (DCPump.Speed > 50) offset = 100 - DCPump.Speed;


SyncSpeed=ElseMode(DCPump.Speed,offset,true);
AntiSyncSpeed=ElseMode(DCPump.Speed,offset,false);
break;
}
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

That's not really how it's intended to work. The range should be speed plus or minus offset.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

AlanM added ElseMode to the libraries. And yes, I agree with you Colin. What do you think would be a good defaults for ElseMode in the libraries? We can easily modify this.
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

rimai wrote:Are you using memory settings set to true or false?
ReefAngel.DCPump.UseMemory=false;
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

lnevo wrote:AlanM added ElseMode to the libraries. And yes, I agree with you Colin. What do you think would be a good defaults for ElseMode in the libraries? We can easily modify this.
I've got a fix for it. I'll submit it shortly.

--Colin
Smotz
Posts: 412
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: New DCPump Modes - How to code???

Post by Smotz »

Anyone have any follow up on this? I am having this same problem.
Post Reply