Tidal Effect Simulation

Share you PDE file with our community
User avatar
Posts: 5343
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed May 20, 2015 8:20 pm
I don't think the same code can be used with DCPump. I think you could just set the Speed to the result and Mode to Constant.

Then I'd flip the channels based on Tide.isIncoming();

Code: Select all
if (Tide.isIncoming()) {
  ReefAngel.DCPump.ActinicChannel=None;
  ReefAngel.DCPump.StandardChannel=Sync;
} else {
  ReefAngel.DCPump.ActinicChannel=Sync;
  ReefAngel.DCPump.StandardChannel=None;
}


Another thing you could do is set the AntiSyncOffset. Below 100 will reduce the Anti-Sync channel, above 100 will raise the Anti-Sync channel.

Code: Select all
ReefAngel.DCPump.Speed=Tide.CalcSpeed();
if (Tide.isIncoming()) {
  ReefAngel.DCPump.ActinicOffset=150;
} else {
  ReefAngel.DCPump.ActinicOffset=50;
}


Your main compiling issue though is you have -1Tide.isIncoming() which should be -1*Tide.isIncoming()

Posts: 138
Joined: Mon Oct 15, 2012 7:21 pm
Location: Albany, GA
PostPosted: Thu May 21, 2015 7:51 am
Thanks lnevo,
Will try this out tonight after work.

Sent from my Samsung Galaxy Note 3

Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Wed Jul 22, 2015 5:38 pm
lnevo wrote:I don't think the same code can be used with DCPump. I think you could just set the Speed to the result and Mode to Constant.

Then I'd flip the channels based on Tide.isIncoming();

Code: Select all
if (Tide.isIncoming()) {
  ReefAngel.DCPump.ActinicChannel=None;
  ReefAngel.DCPump.StandardChannel=Sync;
} else {
  ReefAngel.DCPump.ActinicChannel=Sync;
  ReefAngel.DCPump.StandardChannel=None;
}




This is actually what I'm looking for I believe although I'm not 100% sure(still reading the various threads). I used the arduino wizard to finally get the two RW 4's I have running and the code is below. However, when I try and add in the tide code I am running into some compile issues. One issue I think I saw is that my code is referencing DaylightChannel and ActinicChannel. The code above is using ActinicChannel and StandardChannel. I swapped to match what I have running still no luck. Also when it says =None I would probably want to change that to be Sync and AntiSync so they are both running. Let the night mode slow them down?


All I should have to do is load in the Tide.h header to access the functions or is there something else that I'm not understanding yet? The compile error is below so I'm sure it is something I'm not doing correctly.

sketch_wavemodule.cpp: In function 'void loop()':
sketch_wavemodule:98: error: expected primary-expression before '.' token
sketch_wavemodule:121: error: expected `}' at end of input

Here is the code that is currently controlling the two RW-4's and I'd like to see if I can use the tide/moon patterns. Just missing something.

ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( ReefCrest,55,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
User avatar
Posts: 5343
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Jul 23, 2015 4:24 pm
Your error is coming from somewhere else. It's a syntax error. Whats the tide code your trying to add? Post your before and after code in full.

Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Thu Jul 23, 2015 7:58 pm
lnevo wrote:Your error is coming from somewhere else. It's a syntax error. Whats the tide code your trying to add? Post your before and after code in full.


Yeah, it is a compile or type-o on my part for sure. I removed it and added a if statement to slow them down after lights out. That appeared to work ok. At this point and time it is more of a learning / reading threads to understand how the libraries work that I want to use. I see the tidal simulation and also found the weather pattern based on location. Both of which sound super cool but not sure how to implement :)

Also am trying to understand what the various power head modes do. I have reef crest implemented now and saw a graph somewhere, not sure where now, but it looked cool. Not sure how the sync anti-sync work though. My original post was to make them alternate so they don't always go the same direction - thus tide/high/low. Does the library automatically sync-anti-sync or change directions based on a set time?

Anyway - they are working now and slow down at night. That was the first hurdle. Now it is just playing and learning. Like why Daylight is 41% vs. Actinic at 69% (they change all the time) but I have power set to 55%? Even if it is plus 10, I am over and seen it higher.

Thanks - searching and reading :) Good stuff and love the additions.

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>
#include <Tide.h>  // testing for tide control

////// Place global variable code below here
Tide tide;  // testing for tide control

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


void setup()
{
 // This must be the first line
 ReefAngel.Init(); //Initialize controller
 ReefAngel.Use2014Screen(); // Let's use 2014 Screen
 ReefAngel.AddPHExpansion(); // pH Expansion Module
 // Ports toggled in Feeding Mode
 ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
 // Ports toggled in Water Change Mode
 ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
 // Ports toggled when Lights On / Off menu entry selected
 ReefAngel.LightsOnPorts = 0;
 // Ports turned off when Overheat temperature exceeded
 ReefAngel.OverheatShutoffPorts = Port2Bit;
 // Use T1 probe as temperature and overheat functions
 ReefAngel.TempProbe = T1_PROBE;
 ReefAngel.OverheatProbe = T1_PROBE;
 // Set the Overheat temperature setting
 InternalMemory.OverheatTemp_write( 869 );

 // Feeeding and Water Change mode speed
 ReefAngel.DCPump.FeedingSpeed=0;
 ReefAngel.DCPump.WaterChangeSpeed=0;

 // Ports that are always on
 ReefAngel.Relay.On( Port1 );  // skimmer
 // ReefAngel.Relay.On( Port4 );  // LED Fans
 ReefAngel.Relay.On( Port5 );  // RW 4 left side facing tank
 ReefAngel.Relay.On( Port6 );  // RW 4 right side facing tank

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


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

void loop()
{
 ReefAngel.StandardLights( Port2,9,0,21,0 ); // power to LED power supply
 ReefAngel.StandardLights( Port4,9,0,21,0 ); // LED fans
// ReefAngel.WavemakerRandom( Port5,5,90 ); // Not sure what these are for now
// ReefAngel.WavemakerRandom( Port6,5,90 ); // Not sure what these are for now
// ReefAngel.StandardLights( Port7,9,0,21,0 );
// ReefAngel.StandardLights( Port8,9,0,21,0 );

// Channel 0 (1000mA max) - 5 Neutral White
// Channel 1 (1000mA max) - 6 Royal Blue + 5 Blue
// Channel 2 (700mA max) - 12 Lime
// Channel 3 (700mA max) - 5 Violet UV + 4 Deep Red (660nm)
 ReefAngel.PWM.SetChannel( 0, PWMParabola(10,0,21,0,0,65,0) );
 ReefAngel.PWM.SetChannel( 1, PWMParabola(10,0,21,0,0,75,0) );
 ReefAngel.PWM.SetChannel( 2, PWMParabola(10,0,21,0,0,65,0) );
 ReefAngel.PWM.SetChannel( 3, PWMParabola(10,0,21,0,0,65,0) );

 ReefAngel.DCPump.UseMemory = false;
 // ReefAngel.DCPump.SetMode( ReefCrest,55,10 );
 
 ReefAngel.DCPump.DaylightChannel = Sync;
 ReefAngel.DCPump.ActinicChannel = AntiSync;

// ReefAngel.DCPump.ExpansionChannel[0] = None;
// ReefAngel.DCPump.ExpansionChannel[1] = None;
// ReefAngel.DCPump.ExpansionChannel[2] = None;
// ReefAngel.DCPump.ExpansionChannel[3] = None;
// ReefAngel.DCPump.ExpansionChannel[4] = None;
// ReefAngel.DCPump.ExpansionChannel[5] = None;
 
 ////// Place your custom code below here

if (hour()>=21 || hour()<10)
{
 // Sleep mode - slow things down
 ReefAngel.DCPump.SetMode( ReefCrest,25,10 );
}
else
{
// Normal power
 ReefAngel.DCPump.SetMode( ReefCrest,55,10 );
}

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

 // This should always be the last line
 ReefAngel.Portal( "saf1" );
 ReefAngel.DDNS( "saf1-dns.myreefangel.com" ); // Your DDNS is saf1-saf1-dns.myreefangel.com.myreefangel.com
 ReefAngel.ShowInterface();
}
Previous

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 3 guests

cron