APEX Code

Discussion in 'Filters, Pumps, etc..' started by APC, May 21, 2013.

to remove this notice and enjoy 3reef content with less ads. 3reef membership is free.

  1. APC

    APC Gigas Clam

    Joined:
    May 23, 2005
    Messages:
    850
    Location:
    Atlanta, GA
    Does anyone have an example of APEX code that you can post that turns a plug on for x amount of time.

    So something like If Switch = Open Than turn plug 8 on for 30 seconds.
     
  2. Click Here!

  3. evolved

    evolved Wrasse Freak

    Joined:
    Feb 26, 2010
    Messages:
    4,257
    Location:
    Phoenix, AZ
    Your two statements give me conflicting ideas regarding what you might want this outlet to do.

    So let's start there. What are you trying to accomplish with this outlet?
     
  4. APC

    APC Gigas Clam

    Joined:
    May 23, 2005
    Messages:
    850
    Location:
    Atlanta, GA
    A very simple ATO...basically if the float switch in my sump is closed, I want it to turn on the ATO pump and let it run for 30 seconds, and then turn off. Today, I have it set up where when the switch closes, it e-mails me, and I turn the pump on manually using my iphone.

    I realize this is kind of low tech...but I travel for work multiple days a week...all across the country...so I like having the semi-manual aspect to this. My tank is about 290 gallons total volume with the sump...I lose about 10 gallons every 3 days...I have a 12 gallon resevoir with top off water...and the system is large enough to absorb that entire amount if it were to get pumped in all at once (both in salinty impact (not catastrophic anyway), and not causing an overflow)...and I have a back up kill switch/float if the top off tank gets too low.
     
  5. MatroxD

    MatroxD Plankton

    Joined:
    May 15, 2013
    Messages:
    14
    This it's mine for my magnesium. It is set by day of week but you can easily substitute that with for example:

    If Switch 1 = Open Then ON
    If Switch 1 = Closed Then OFF

    The "if time to" in the command is what determines the total timeframe. In my case,2 minutes. Then with the Defer statement, whatever time you set, the Defer causes it to subtract the Defer time from the total time. In my case:
    10:30 to 10:31(2 minutes)- Defer 1:49
    So, 2:00 mins-1:49 mins= 11 seconds on

    [​IMG]


    Then, if you wanted, you can add a Min Time statement to make sure that it doesn't repeat itself for a certain specified time.
    Example: Min Time 005:00

    This means for my program,it will run 11 seconds and then will not turn on again for 5 minutes. Fir such as an ato switch, it will run your top off for 11 seconds, then it will count down 5 minutes, then the program will run again, so that it will actually be 6 minutes 49 seconds before it comes on for another 11 seconds, etc.

    I think this is what your asking correct? If so, hope it helps.
     
    Last edited: May 21, 2013
  6. evolved

    evolved Wrasse Freak

    Joined:
    Feb 26, 2010
    Messages:
    4,257
    Location:
    Phoenix, AZ
    Ah, an ATO. But simple isn't necessarily the best approach to take here; it needs some failsafes. Failing on or off could lead to bad consequences. On that note, always consider a switch will fail in the "open" position. You don't want anything bad happening if a switch was stuck open.

    So here's my code for my ATO:

    Switch1 is the main switch, switch2 is the high-water failsafe switch.

    [ ATO-Pump_3_1 ] ( 3_1 )
    Program:
    Fallback OFF
    Set OFF
    If Outlet Sump_Low = ON Then ON
    If Switch2 OPEN Then OFF
    If Outlet ATO_No_Pump = ON Then OFF
    Min Time 020:00 Then OFF

    The "Min Time" won't allow the pump to turn back on unless 20 min has elapsed.

    And the virtual outlets referenced above:

    [ Sump_Low ] ( Cntl_A1 )
    Program:
    Set OFF
    If Switch1 CLOSED Then ON
    Defer 001:30 Then ON


    The defer statement keeps any oscillations in the return chamber from falsely trigger the ATO.

    [ ATO_No_Pump ] ( Cntl_A6 )
    Program:
    Set OFF
    If Outlet ATO-Pump_3_1 = ON Then ON
    Defer 000:20 Then ON


    This outlet keeps the ATO pump from running a maximum of 20 seconds. It's mainly there for when the ATO reservoir is empty. If this outlet turns on, I know it's empty. :)