Re: My Jebao "Else" mode
Posted: Fri Aug 09, 2013 9:15 am
So if you pick reefcrest it automatically runs them in anti sync mode ?
Community discussion about Reef Angel Controllers and reefing related subjects
https://forum.reefangel.com/
The setting under Internal Memory in the Portal are only Mode, Speed and Duration. You can't change anything else through the portal.cjrudy wrote:Can the portal set anti sync modes ?
I don't think so. How can it do an anti sync if you only have 1 pump?cjrudy wrote:So if you pick reefcrest it automatically runs them in anti sync mode ?
Code: Select all
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = Sync;
cosmith71 wrote:Call with ElseMode( MidPoint, Offset, Sync );
Where Midpoint is the middle of the range you want, and Offset is the +/- range. Sync and anti-sync are opposites (true for sync or false for anti-sync) For example, ElseMode ( 70, 30, true ) will return values from 40% to 100%. The speed changes every 0.5 to 5 seconds and can be anywhere in between MidPoint +/- Offset.
What Steve said.cjrudy wrote:So if both mine are set at 70, 30 then they're really not running up to 100% ??
How does this work ?
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 <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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen // Ports toggled in Feeding Mode ReefAngel.FeedingModePorts = Port6Bit; // Ports toggled in Water Change Mode ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port8Bit; // Ports toggled when Lights On / Off menu entry selected ReefAngel.LightsOnPorts = 0; // Ports turned off when Overheat temperature exceeded ReefAngel.OverheatShutoffPorts = Port1Bit; // Use T1 probe as temperature and overheat functions ReefAngel.TempProbe = T1_PROBE; ReefAngel.OverheatProbe = T1_PROBE; // Set the Overheat temperature setting InternalMemory.OverheatTemp_write( 270 );
// Feeeding and Water Change mode speed ReefAngel.DCPump.FeedingSpeed=0; ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on ReefAngel.Relay.On( Port2 ); ReefAngel.Relay.On( Port3 ); ReefAngel.Relay.On( Port4 ); ReefAngel.Relay.On( Port5 ); ReefAngel.Relay.On( Port6 ); ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here }
void loop() { ReefAngel.StandardHeater( Port1,250,254 ); ReefAngel.StandardLights( Port7,17,0,20,0 ); ReefAngel.DCPump.UseMemory = true; ReefAngel.DCPump.SetMode( ReefCrest,100,10 ); ReefAngel.DCPump.DaylightChannel = Sync; ReefAngel.DCPump.ActinicChannel = Sync; ////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line ReefAngel.Portal( "anderzon_" ); ReefAngel.ShowInterface(); }
After this line. Can someone else chime in on the DCPump stuff? I don't use it. I really should break down and get the WiFi unit for this tank.anderzon_ wrote:Hi
Ive tried to get this work but it doesn't work. Where in the code should I paste the code.
Here is my code:
Code: Select all
// This should always be the last line ReefAngel.Portal( "anderzon_" ); ReefAngel.ShowInterface(); }
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 <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.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port4Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port6 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port1,775,780 );
ReefAngel.StandardLights( Port2,21,30,12,0 );
ReefAngel.StandardLights( Port3,12,0,21,30 );
ReefAngel.MHLights( Port4,14,0,20,30,5 );
ReefAngel.SingleATO( true,Port7,300,0 );
ReefAngel.StandardLights( Port8,12,0,21,45 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( ReefCrest,75,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
////// Place your custom code below here
if (hour()>=11 && hour()<20)
{
ReefAngel.PWM.SetDaylight( ElseMode(70,20,true) ); // ReefCrest at 70% +/- 20% on sync mode
}
else if (hour()>=20 && hour()<23)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(40,80,200,true) ); // Nutrient Transport 40%minspeed - 80%maxspeed - 200ms
}
else if (hour()>=23 && hour()<11)
{
ReefAngel.PWM.SetDaylight( ElseMode(45,15,true) ); // ReefCrest at 45% +/- 15% on sync mode
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "ReEfnWrX" );
ReefAngel.ShowInterface();
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}
Remove this stuff:ReEfnWrX wrote:By remove it, you are saying to remove the line #include <DCPump.H>
?
Also, I just uploaded the code, I changed the current time on the controller to 9am and the Daylight dimming shows it slowly fluctuating between 80-90 so far does not seem like Else mode at all... This does not seem to be working correctly since it should be 45% with a 15% swing.
Code: Select all
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( ReefCrest,75,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
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 <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.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port4Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port6 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port1,775,780 );
ReefAngel.StandardLights( Port2,21,30,12,0 );
ReefAngel.StandardLights( Port3,12,0,21,30 );
ReefAngel.MHLights( Port4,14,0,20,30,5 );
ReefAngel.SingleATO( true,Port7,300,0 );
ReefAngel.StandardLights( Port8,12,0,21,45 );
////// Place your custom code below here
if (hour()>=11 && hour()<20)
{
ReefAngel.PWM.SetDaylight( ElseMode(70,20,true) ); // ReefCrest at 70% +/- 20% on sync mode
}
else if (hour()>=20 && hour()<23)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(40,80,200,true) ); // Nutrient Transport 40%minspeed - 80%maxspeed - 200ms
}
else if (hour()>=23 && hour()<11)
{
ReefAngel.PWM.SetDaylight( ElseMode(45,15,true) ); // ReefCrest at 45% +/- 15% on sync mode
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "ReEfnWrX" );
ReefAngel.ShowInterface();
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}
Change this:ReEfnWrX wrote:Ok, so when the controller is inbetween 11pm-11am (Slower speed Else) it stops adjusting the pumps speed.
If I change controller time to after 11am for Else(Faster speed) it works properly.
Code: Select all
else if (hour()>=23 && hour()<11)
Code: Select all
else if (hour()>=23 || hour()<11)
Thx, Do I need this in my custom code:cosmith71 wrote:After this line. Can someone else chime in on the DCPump stuff? I don't use it. I really should break down and get the WiFi unit for this tank.anderzon_ wrote:Hi
Ive tried to get this work but it doesn't work. Where in the code should I paste the code.
Here is my code:
Code: Select all
// This should always be the last line ReefAngel.Portal( "anderzon_" ); ReefAngel.ShowInterface(); }
--Colin
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 <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.SetTemperatureUnit( Celsius ); // set to Celsius
Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit |
Port4Bit | Port6Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 270 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port3 );
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port6 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port1,250,254 );
ReefAngel.StandardLights( Port7,17,0,20,0 );
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.SetMode( ReefCrest,100,10 ); R
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = Sync;
////// Place your custom code below here
if (ReefAngel.DCPump.Mode==Custom)
{
ReefAngel.PWM.SetDaylight( ElseMode(70,30,true )); // ElseMode on sync mode, 70 +/- 30%
ReefAngel.DCPump.UseMemory = false;
} else {
ReefAngel.DCPump.UseMemory = true;
}
static time_t StartFeeding=0;
if (ReefAngel.DisplayedMenu==FEEDING_MODE)
StartFeeding=now(); // if we entered feeding mode, register what time it was.
if (now()-StartFeeding > 1800 && now()-StartFeeding < 5400) // if feeding started between 1800 and 5400 seconds
ReefAngel.PWM.SetActinic(100);
else
ReefAngel.PWM.SetActinic(45);
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "anderzon_" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph( 5, 5 );
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}
Code: Select all
Call with ElseMode( MidPoint, Offset, Sync )
Code: Select all
ReefAngel.PWM.SetActinic( ElseMode(37,7,true)); // ElseMode on sync mode, 37 +/- 7%