Need programming help - Apex and dosing/feeding

TexanCanuck

Active Member
View Badges
Joined
Feb 10, 2021
Messages
277
Reaction score
259
Location
Dallas, TX
Rating - 0%
0   0   0
Hey there,

I've recently started dosing ReefEnergy AB+ and I'm trying to setup a recurring program for it through my Apex and DOS.

I've written the code but don't think it's right and could use a second set of eyes.

Objective - I want to dose ReefEnergy twice a day (at 11:29am and 11:29pm), and when I do I want the following sequence of events to occur:
1) shut off the return pumps, skimmer, and reactor
2) set the WAVs to 1%
3) wait 1 minute
4) Dose 12ml of ReefEnergy
5) wait 30 mins and turn the return pumps back on and return the WAVs to their regular program
6) wait another 60 mins and turn back on the skimmer and reactor

NOTE: While it would be straight forward to setup the dosing schedule through the DOS task and then program the other devices based on the same schedule, I'd really like all this to run off a single Virtual Outlet that I can add to Fusion so that I can selectively choose to disable and enable the whole program as required (for example, if I choose to target feed my coral, I don't want it to also dose ReefEnergy in the same 12 hour period ... so by simply moving the virtual outlet from "Auto" to "off", I can disable it).

I'm using a set of virtual outlets to drive all of this ... here's my code:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

RE_Timer (Virtual outlet that I add to my Fusion home page)
Set OFF
If Time 11:29 to 11:59 Then ON
If Time 23:29 to 23:59 Then ON

RE_Start (Virtual Outlet)
Set OFF
If Output RE_Timer = ON Then ON
Defer 001:00 Then ON

RE_Stop (Virtual Outlet)
Set OFF
If Output RE_Timer = ON Then ON
Defer 090:00 Then OFF

Return_Left (also same program as Return_Right)
Fallback ON
tdata 00:00:00,0,0,75,0,0,0,0,0,0,0,0,0,0
tdata 23:59:00,0,0,75,0,0,0,0,0,0,0,0,0,0
If Output RE_Timer = ON Then OFF

Skimmer
Fallback OFF
Set ON
If Output RE_Stop = ON Then OFF

Reactor
Set ON
Fallback OFF
If Output RE_Stop = ON Then OFF

WAV_Left (same program as WAV_Right)
Fallback OFF
tdata 00:00:00,0,0,5,7,0,0,0,0,0,0,0,0,0
tdata 04:00:00,0,0,10,7,0,0,0,0,0,0,0,0,0
tdata 06:00:00,0,0,25,7,0,0,0,0,0,0,0,0,0
tdata 18:00:00,0,0,25,7,0,0,0,0,0,0,0,0,0
tdata 21:00:00,0,0,10,7,0,0,0,0,0,0,0,0,0
tdata 23:59:00,0,0,5,7,0,0,0,0,0,0,0,0,0
If Output RE_Timer = ON Then 1

RE_DOS (my DOS unit with ReefEnergy)
Fallback OFF
If Output RE_Start = ON Then Dos12

Dos12 (a profile)
Dose 12 mL ONCE

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

What I'm concerned about is the code to actually dose 12 ml ... my concern is that while the profile says dose 12 ml ONCE, the code for RE_DOS calls that profile as long as the RE_Start virtual outlet is ON ... and it is ON for 30 mins at a time! So taken together, will it dose only once? Or will it keep trying to dose for 30 mins straight?

Are there any other errors in my code?

Thanks in advance for the help!
 
Last edited:

blaxsun

10K Club member
View Badges
Joined
Dec 15, 2020
Messages
26,709
Reaction score
31,146
Location
The Abyss
Rating - 0%
0   0   0
You might need another virtual outlet:

RE_Energy
Set OFF
If Time 11:29 to 11:30 Then ON
If Time 23:29 to 23:30 Then ON

RE_DOS
Fallback OFF
If Output RE_Energy = ON Then Dos12

I'd give it a trial run with some water to ensure it's dosing correctly.
 
OP
OP
TexanCanuck

TexanCanuck

Active Member
View Badges
Joined
Feb 10, 2021
Messages
277
Reaction score
259
Location
Dallas, TX
Rating - 0%
0   0   0
But if I did that, then I'd have to add both the RE_Energy and the RE_timer outlets to my Fusion Dashboard, right?

Otherwise, if I just disabled one of them, then the other devices would still follow the program.

It seems to me there should be a better way .... what if I changed the interval on the RE_Tinmer outlet to 1 minute only, and then added DEFER OFF statements to the RE_Start outlet?
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,217
Location
Oregon
Rating - 0%
0   0   0
When programming is used to apply a DOS profile, the DOS will deliver the volume specified in that profile and then sit idle until you either apply a different profile or resume a scheduled interval. So your virtual output could be on for 30 minutes or 12 hours and it would make no difference in the volume of liquid delivered.

The only change required in your code above is for your DOS output. Add a Set OFF command so the DOS will remain off at all times except for when the profile is active, otherwise the DOS will resume any scheduled intervals once the virtual output turns off. The DOS defaults to having a single scheduled interval which cannot be deleted.

[RE_DOS]
Fallback OFF
Set OFF
If Output RE_Start = ON Then Dos12

Don’t confuse Fallback OFF with Set OFF. They each do completely separate things. Fallback only tells the output how to behave when the module can’t communicate with the Apex base unit, while Set tells the output the default state when no other conditions evaluate True.

One last observation: Your RE_Timer will remain on for 31 minutes, not 30 minutes. The values in If Time are inclusive, so it will remain on while the minute hand of the clock is still 11:59, then turn off when it reaches 12:00. If you really want exactly 30 minutes, then reduce the ending time by 1 minute:

[RE_Timer]
Set OFF
If Time 11:29 to 11:58 Then ON
If Time 23:29 to 23:58 Then ON

Hope this helps.
 
Last edited:

chiefifd

Active Member
View Badges
Joined
Mar 1, 2014
Messages
272
Reaction score
165
Location
Michigan
Rating - 0%
0   0   0
Here's an Apex Dosing Calculator that figures out the program for dosing. I found it here on Reef2Reef I'm pretty sure, just passing it along.
 

Creating a strong bulwark: Did you consider floor support for your reef tank?

  • I put a major focus on floor support.

    Votes: 36 42.9%
  • I put minimal focus on floor support.

    Votes: 20 23.8%
  • I put no focus on floor support.

    Votes: 26 31.0%
  • Other.

    Votes: 2 2.4%
Back
Top