It is cycling between the modes! It didnt go into night mode though. It seems pretty sharp, maybe the reefcrest and lagoon just havent been called much.
Thanks Lee
Graphing PWM on Relay Box
Graphing PWM on Relay Box
Lets see over a longer duration and I'll double check the night mode..
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: Graphing PWM on Relay Box
Quick question....
If I make changes in the portal for the modes such as duration to make the short pulse longer will those changes reflect when I activate our random mode again?
It's kind of hard to grasp how it's cycling when the portal graph is updating every five minutes... Ntp and short pulse seem the same since Ntp never peaks within the hour.
I'm getting a good amount of ramping up and down, but it seems to mostly switch 30/70 the majority of cycles. I'm hoping for more ramping than pulsing. What could I change?
If I make changes in the portal for the modes such as duration to make the short pulse longer will those changes reflect when I activate our random mode again?
It's kind of hard to grasp how it's cycling when the portal graph is updating every five minutes... Ntp and short pulse seem the same since Ntp never peaks within the hour.
I'm getting a good amount of ramping up and down, but it seems to mostly switch 30/70 the majority of cycles. I'm hoping for more ramping than pulsing. What could I change?
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: Graphing PWM on Relay Box
Could I do this for the night mode???
if (hour() >=21 || hour() < 10)
ReefAngel.PWM.SetDaylight(45);
Just trying to fix it.....
if (hour() >=21 || hour() < 10)
ReefAngel.PWM.SetDaylight(45);
Just trying to fix it.....
Re: Graphing PWM on Relay Box
No i see the problem. Change the && in my statement to ||
Or your commands would work too but without :30 in the time. Your logic helped me realize what was wrong.
Or your commands would work too but without :30 in the time. Your logic helped me realize what was wrong.
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: Graphing PWM on Relay Box
Is there anyway to limit the random modes to certian modes? I see that they are number 1-6, but how would I know which mode is tied to which number, and how would I write it?
// Add random mode if we set to Mode to 12
if ((now()%SECS_PER_HOUR==0) && mode==12) {
mode=random(1,2,3,5,6); // Change the mode once per hour to modes 0-6
}
// Add random mode if we set to Mode to 12
if ((now()%SECS_PER_HOUR==0) && mode==12) {
mode=random(1,2,3,5,6); // Change the mode once per hour to modes 0-6
}
Re: Graphing PWM on Relay Box
I'm doing exactly that. Take a look at the RFCustom function in my INO for an example.
-
- Posts: 288
- Joined: Wed Jan 23, 2013 12:36 pm
Re: Graphing PWM on Relay Box
Im going to start an INO thread for myself...Im at work now so Im just gonna stick a few thing I would like here until I get my code from home.
I think this is what I need from your INO
void SetRF() {
int ntmDelay=InternalMemory.read(Mem_B_NTMDelay)*60;
int ntmTime=InternalMemory.read(Mem_B_NTMTime)*60;
static time_t t;
vtMode=InternalMemory.RFMode_read();
vtSpeed=InternalMemory.RFSpeed_read();
vtDuration=InternalMemory.RFDuration_read();
if (now()-t > ntmDelay && now()-t < ntmTime+ntmDelay) {
// Post feeding mode
vtMode=Smart_NTM;
vtSpeed=InternalMemory.read(Mem_B_NTMSpeed);
vtDuration=InternalMemory.read(Mem_B_NTMDuration);
} else if (!sun.IsDaytime() && InternalMemory.read(Mem_B_NightRF)) {
vtMode=Night;
vtSpeed=InternalMemory.read(Mem_B_NightSpeed);
vtDuration=InternalMemory.read(Mem_B_NightDuration);
} else {
if (vtMode!=Night && ReefAngel.RF.Mode==Night)
ReefAngel.RF.SetMode(Night_Stop,0,0);
}
if (ReefAngel.DisplayedMenu==FEEDING_MODE && InternalMemory.read(Mem_B_FeedingRF)) {
t=now(); // Run post feeding mode when this counter stops
} else {
(vtMode==Custom) ? RFCustom() : ReefAngel.RF.SetMode(vtMode,vtSpeed,vtDuration);
}
}
void RFCustom() {
static boolean changeMode, firstTime=true;
byte rcSpeed, rcSpeedAS;
byte tideSpeed=tide.CalcTide();
byte tideMin=InternalMemory.read(Mem_B_TideMin);
byte tideMax=InternalMemory.read(Mem_B_TideMax);
byte tideMode=InternalMemory.read(Mem_B_TideMode);
float pumpOffset=(float) InternalMemory.read(Mem_B_PumpOffset)/100;
byte RandomModes[]={ ReefCrest, TidalSwell, Smart_NTM, Lagoon, ShortPulse, LongPulse };
if (now()%SECS_PER_DAY!=0) changeMode=true;
if ((now()%SECS_PER_DAY==0 && changeMode) || firstTime) {
tideMode=random(100)%sizeof(RandomModes);
InternalMemory.write(Mem_B_TideMode,tideMode);
changeMode=false;
firstTime=false;
}
ReefAngel.CustomVar[Var_TideMode]=tideMode+1;
switch (RandomModes[tideMode]) {
case ReefCrest: {
rcSpeed=ReefCrestMode(tideSpeed,tideMin,true);
rcSpeedAS=ReefCrestMode(tideSpeed,tideMin ,false);
break;
}
case TidalSwell: {
rcSpeed=TidalSwellMode(tideSpeed+tideMin,true);
rcSpeedAS=TidalSwellMode(tideSpeed+tideMin,false);
break;
}
case Smart_NTM: {
vtDuration=InternalMemory.read(Mem_B_NTMDuration);
rcSpeed=NutrientTransportMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,true);
rcSpeedAS=NutrientTransportMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,false);
break;
}
case Lagoon: {
rcSpeed=SineMode(tideSpeed-tideMin,tideSpeed+tideMin,vtDuration*60,true);
rcSpeedAS=SineMode(tideSpeed-tideMin,tideSpeed+tideMin,vtDuration*60,false);
break;
}
case ShortPulse: {
vtDuration=InternalMemory.read(Mem_B_NTMDuration);
rcSpeed=ShortPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,true);
rcSpeedAS=ShortPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,false);
break;
}
case LongPulse: {
rcSpeed=LongPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration,true);
rcSpeedAS=LongPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration,false);
break;
}
}
ReefAngel.RF.SetMode(Custom,rcSpeedAS*pumpOffset,tide.isOutgoing());
ReefAngel.RF.SetMode(Custom,rcSpeed,tide.isIncoming());
}
AND THIS
void NextRFMode() {
vtMode++;
if (vtMode > 12) {
vtMode=0;
vtSpeed=50; // Constant
} else if (vtMode == 1) {
vtSpeed=40; // Lagoon
} else if (vtMode == 2) {
vtSpeed=45; // Reef Crest
} else if (vtMode == 3) {
vtSpeed=55; vtDuration=10; // Short Pulse
} else if (vtMode == 4) {
vtSpeed=55; vtDuration=20; // Long Pulse
} else if (vtMode == 5) {
vtSpeed=InternalMemory.read(Mem_B_NTMSpeed);
vtDuration=InternalMemory.read(Mem_B_NTMDuration); // Smart_NTM
} else if (vtMode == 6) {
vtSpeed=50; vtDuration=10; // Smart_TSM
} else if (vtMode == 7) {
vtSpeed=InternalMemory.read(Mem_B_NightSpeed);
vtDuration=InternalMemory.read(Mem_B_NightDuration);
vtMode=9; // Night
} else if (vtMode == 10) {
vtSpeed=65; vtDuration=5; // Storm
} else if (vtMode == 11) {
vtSpeed=45; vtDuration=10; // Custom
}
if (vtMode!=InternalMemory.RFMode_read())
InternalMemory.RFMode_write(vtMode);
if (vtSpeed!=InternalMemory.RFSpeed_read())
InternalMemory.RFSpeed_write(vtSpeed);
if (vtDuration!=InternalMemory.RFDuration_read())
InternalMemory.RFDuration_write(vtDuration);
I would also like the controller to display the Vortec Mode.
I havent decided how to run the random, but my graph sure doesnt look like yours. It may be my offsets, but it mostly 70/30 and when its reefcrest it just swings right around 43 but does not rise or fall more then 5ish?!?!
I see you have the daily wave form randomiozed, I thik this is what I will run with....
Also could you explain wifi alert? Not sure what that means.
Thanks!!!
I think this is what I need from your INO
void SetRF() {
int ntmDelay=InternalMemory.read(Mem_B_NTMDelay)*60;
int ntmTime=InternalMemory.read(Mem_B_NTMTime)*60;
static time_t t;
vtMode=InternalMemory.RFMode_read();
vtSpeed=InternalMemory.RFSpeed_read();
vtDuration=InternalMemory.RFDuration_read();
if (now()-t > ntmDelay && now()-t < ntmTime+ntmDelay) {
// Post feeding mode
vtMode=Smart_NTM;
vtSpeed=InternalMemory.read(Mem_B_NTMSpeed);
vtDuration=InternalMemory.read(Mem_B_NTMDuration);
} else if (!sun.IsDaytime() && InternalMemory.read(Mem_B_NightRF)) {
vtMode=Night;
vtSpeed=InternalMemory.read(Mem_B_NightSpeed);
vtDuration=InternalMemory.read(Mem_B_NightDuration);
} else {
if (vtMode!=Night && ReefAngel.RF.Mode==Night)
ReefAngel.RF.SetMode(Night_Stop,0,0);
}
if (ReefAngel.DisplayedMenu==FEEDING_MODE && InternalMemory.read(Mem_B_FeedingRF)) {
t=now(); // Run post feeding mode when this counter stops
} else {
(vtMode==Custom) ? RFCustom() : ReefAngel.RF.SetMode(vtMode,vtSpeed,vtDuration);
}
}
void RFCustom() {
static boolean changeMode, firstTime=true;
byte rcSpeed, rcSpeedAS;
byte tideSpeed=tide.CalcTide();
byte tideMin=InternalMemory.read(Mem_B_TideMin);
byte tideMax=InternalMemory.read(Mem_B_TideMax);
byte tideMode=InternalMemory.read(Mem_B_TideMode);
float pumpOffset=(float) InternalMemory.read(Mem_B_PumpOffset)/100;
byte RandomModes[]={ ReefCrest, TidalSwell, Smart_NTM, Lagoon, ShortPulse, LongPulse };
if (now()%SECS_PER_DAY!=0) changeMode=true;
if ((now()%SECS_PER_DAY==0 && changeMode) || firstTime) {
tideMode=random(100)%sizeof(RandomModes);
InternalMemory.write(Mem_B_TideMode,tideMode);
changeMode=false;
firstTime=false;
}
ReefAngel.CustomVar[Var_TideMode]=tideMode+1;
switch (RandomModes[tideMode]) {
case ReefCrest: {
rcSpeed=ReefCrestMode(tideSpeed,tideMin,true);
rcSpeedAS=ReefCrestMode(tideSpeed,tideMin ,false);
break;
}
case TidalSwell: {
rcSpeed=TidalSwellMode(tideSpeed+tideMin,true);
rcSpeedAS=TidalSwellMode(tideSpeed+tideMin,false);
break;
}
case Smart_NTM: {
vtDuration=InternalMemory.read(Mem_B_NTMDuration);
rcSpeed=NutrientTransportMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,true);
rcSpeedAS=NutrientTransportMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,false);
break;
}
case Lagoon: {
rcSpeed=SineMode(tideSpeed-tideMin,tideSpeed+tideMin,vtDuration*60,true);
rcSpeedAS=SineMode(tideSpeed-tideMin,tideSpeed+tideMin,vtDuration*60,false);
break;
}
case ShortPulse: {
vtDuration=InternalMemory.read(Mem_B_NTMDuration);
rcSpeed=ShortPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,true);
rcSpeedAS=ShortPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration*100,false);
break;
}
case LongPulse: {
rcSpeed=LongPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration,true);
rcSpeedAS=LongPulseMode(tideSpeed-tideMax,tideSpeed+tideMin,vtDuration,false);
break;
}
}
ReefAngel.RF.SetMode(Custom,rcSpeedAS*pumpOffset,tide.isOutgoing());
ReefAngel.RF.SetMode(Custom,rcSpeed,tide.isIncoming());
}
AND THIS
void NextRFMode() {
vtMode++;
if (vtMode > 12) {
vtMode=0;
vtSpeed=50; // Constant
} else if (vtMode == 1) {
vtSpeed=40; // Lagoon
} else if (vtMode == 2) {
vtSpeed=45; // Reef Crest
} else if (vtMode == 3) {
vtSpeed=55; vtDuration=10; // Short Pulse
} else if (vtMode == 4) {
vtSpeed=55; vtDuration=20; // Long Pulse
} else if (vtMode == 5) {
vtSpeed=InternalMemory.read(Mem_B_NTMSpeed);
vtDuration=InternalMemory.read(Mem_B_NTMDuration); // Smart_NTM
} else if (vtMode == 6) {
vtSpeed=50; vtDuration=10; // Smart_TSM
} else if (vtMode == 7) {
vtSpeed=InternalMemory.read(Mem_B_NightSpeed);
vtDuration=InternalMemory.read(Mem_B_NightDuration);
vtMode=9; // Night
} else if (vtMode == 10) {
vtSpeed=65; vtDuration=5; // Storm
} else if (vtMode == 11) {
vtSpeed=45; vtDuration=10; // Custom
}
if (vtMode!=InternalMemory.RFMode_read())
InternalMemory.RFMode_write(vtMode);
if (vtSpeed!=InternalMemory.RFSpeed_read())
InternalMemory.RFSpeed_write(vtSpeed);
if (vtDuration!=InternalMemory.RFDuration_read())
InternalMemory.RFDuration_write(vtDuration);
I would also like the controller to display the Vortec Mode.
I havent decided how to run the random, but my graph sure doesnt look like yours. It may be my offsets, but it mostly 70/30 and when its reefcrest it just swings right around 43 but does not rise or fall more then 5ish?!?!
I see you have the daily wave form randomiozed, I thik this is what I will run with....
Also could you explain wifi alert? Not sure what that means.
Thanks!!!