Apex Code Review

Joboo

Member
Hi all,

I'm in the process of preparing for a Biocube 29g HQI build and would like a second set of eyes to review the Apex programming code I will be using to manage my system. Please feel free to tear it apart as I am open to all criticism. ;)

Keep in mind the portion of code that refers to dosing is conceptual at this point since I may need to tweak it based on bio-load. Thanks in advance!

[Heater]
Fallback OFF
If Temp < 79.8 Then ON
If Temp > 80.0 Then OFF

[MainPump]
Fallback ON
Set ON
If Power Apex Off 000 Then OFF
If Power EB8_3 Off 000 Then OFF

[Skimmer]
Fallback ON
Set OFF
If Main Pump = ON Then ON
Defer 005:00 Then ON

[PowerHead] Will be used to provide more flow
Fallback ON
Set ON
If FeedA 000 Then Off

[HQI]
Fallback OFF
If Sun 000/000 Then ON
If Temp > 82.0 Then OFF
Min Time 030:00 Then OFF

[MoonLight]
Fallback OFF
If Moon 000/000 Then ON

[RefugeLight]
Fallback OFF
Set OFF
If HQI = OFF Then ON

[float virtual outlet sump_low]
If Switch1 OPEN Then OFF
If Switch1 CLOSED Then ON
Defer 003:00 Then ON

[float virtual outlet sump_high]
If Switch2 OPEN Then ON
If Switch2 CLOSED Then OFF
Min Time 030:00 Then OFF

[float virtual outlet FreshWater_low]
If Switch3 OPEN THEN OFF
If Switch3 CLOSED THEN ON
Defer 003:00 Then ON

[Aqualifter]
Fallback OFF
Set OFF
If Outlet Sump_Low = ON Then ON
If Outlet Sump_High = ON Then OFF
If Outlet FreshWater_low = ON Then OFF

[DosingPumps]
Fallback OFF
Set OFF
OSC 179:00/1:00/0 Then ON
If pH > 8.40 Then OFF

[SndWrn_I7]
Set Off
If Temp > 82 Then ON
If Temp < 77 Then ON
If pH < 8.00 Then ON
IF pH > 8.45 Then ON
Defer 002:00 Then ON

[SndAlm_I6]
Set Off
If Temp > 84.0 Then ON
If Temp < 76.5 Then ON
If pH > 8.50 Then ON
If pH < 7.95 Then ON
If Virtual outlet sump_High = ON Then ON
Defer 000:10 Then ON

[EmailAlm_I5]
Set Off
If Temp > 84.0 Then ON
If Temp < 76.5 Then ON
If pH > 8.50 Then ON
If pH < 7.95 Then ON
If Power Apex OFF 000 Then ON
If Power EB8_3 OFF 000 Then ON
If Virtual outlet sump_High = ON Then ON
Defer 000:10 Then ON
 
[Heater]
Fallback OFF
If Temp < 79.8 Then ON
If Temp > 80.0 Then OFF
If Temp <70 Then OFF

The last line is a fail-safe to prevent the heater from cooking your tank if the temp probe fails.


[Skimmer]
Fallback ON
Set OFF
If Main Pump = ON Then ON

Change the last line to exactly match the MainPump outlet name (without the space):
If MainPump = ON Then ON


[EmailAlm_I5]
Set Off
If Power Apex OFF 000 Then ON
If Power EB8_3 OFF 000 Then ON

Change both lines to use a 001 instead of 000.
 
Wow. Thanks for the quick reply Russ!

Based on your recommendations I have updated the code accordingly.
 
My pleasure!

Something doesn't "feel' quite right to me with the ATO & float switch virtual outlets programming, but I cannot pinpoint what's bothering me. Perhaps Swearint can review that part... he's a wiz in that regard.
 
Ok thanks. The virtual outlets/ato code was compiled from research I did on RC so it definitely is an area I am unfamiliar with. Theoretically I know what I want to happen, however translating it into code is the challenge.
 
My pleasure!

Something doesn't "feel' quite right to me with the ATO & float switch virtual outlets programming, but I cannot pinpoint what's bothering me. Perhaps Swearint can review that part... he's a wiz in that regard.
Looks pretty good to me, though I might reverse the operation of the Freshwater outlet. I assume this is a reservoir. In the event the float is disconnected, the switch will default to OPEN => reservoir is full. Slightly safer response would be OPEN => reservoir is empty. Only other thing is that 'If virtual outlet...' is not proper syntax, delete 'virtual'.

Russ did not elaborate, but the 'If Power...' command is really most useful with some form of power backup. By adding the 001, the condition will still be true for 1 minute after power is restored and will send you an email. That's fine if it only drops out for a few minutes, but it's better to know immediately rather than after the fact. Alan's New User Guide has a good section on power backup strategies.

Todd
 
Thanks Swearint. Your feedback is greatly appreciated. I will be reversing the resevoir float functionality as recommended. I will also be adding a small UPS to the system to take advantage of the enhanced Power fail capablities.

Thanks Again!
 
[Heater]
[Skimmer]
Fallback ON
Set OFF
If Main Pump = ON Then ON

Change the last line to exactly match the MainPump outlet name (without the space):
If MainPump = ON Then ON

i did my skimmer like this and it worked.

fallback on
set off
if outlet mainpump = on then on
if feedD 005 then off
 
Back
Top