Jump to content

SuncrestReef's Week of Apex Programming


SuncrestReef

Recommended Posts

  • 3 months later...
10 hours ago, SuncrestReef said:

My Apex tutorial series on Reef2Reef has now exceeded 20,000 views!

Thanks to all of you at PNWMAS for the encouragement as I was writing the original articles here before R2R picked it up.

As always, if any of you have Apex questions, don't hesitate to ask.

That is awesome John and also well deserved.  It is a very well thought out and presented series and glad we got to reveal it as part of PNWMAS before it hit R2R.  Great to have such knowledgable and helpful members here.

  • Like 2
Link to comment
Share on other sites

@SuncrestReef I also wanted to say thank you for this, it's been super helpful as I get started setting up my apex!  And thanks for replying to my post on the neptune forum about my broken WXM, you clearly have a passion for this.  If you don't mind, I might ask for your general opinions on my configuration at some point later when I've got it set up how I like...just now learning how to configure my 0-10v pumps, starting to think about using virtual outlets...I also have a programming background, the possibilities are exciting

  • Thanks 1
Link to comment
Share on other sites

12 minutes ago, GreenJeans said:

@SuncrestReef I also wanted to say thank you for this, it's been super helpful as I get started setting up my apex!  And thanks for replying to my post on the neptune forum about my broken WXM, you clearly have a passion for this.  If you don't mind, I might ask for your general opinions on my configuration at some point later when I've got it set up how I like...just now learning how to configure my 0-10v pumps, starting to think about using virtual outlets...I also have a programming background, the possibilities are exciting

I'm glad the tutorials helped.  When you're ready for review of your setup, you can add my account (SuncrestReef) to your Fusion dashboard with read-only access.  Then I can see your programming, inputs, outputs, and profiles.

It's funny, sometimes I think having a background in programming is a disadvantage since Neptune's programming model and syntax is so much different than most popular programming languages! 🤣

Link to comment
Share on other sites

Honestly, that's part of the fun! Programming is interesting to me because it always seems there's something new to learn, and this is so drastically different from what I'm used to that it's exciting to see how it's put together. It's a double-edge sword, it's hard to trust such a "small time" architecture with the health of my tank...but they've been around long enough now to instill confidence.  If you haven't, I'd recommend checking out the games from Zachtronics - tis-100, space chem, human resource department...all interesting "programming approaches" http://www.zachtronics.com/

 

I'll absolutely take you up on the dashboard review! Thanks for the offer.

  • Like 1
Link to comment
Share on other sites

I seriously need some programming help. I need to set up ATK with use of doser to supply water over long distance of 60. My salt and r/o reservoir are in garage 65gallons each.  I want to program ATK to turn on separate doser during times AWC dosers not on.  
There’s no issues moving the water through 1/4” . Doser lines have been primed.  

Thank you


Equipment=
Apex
Trident
3 apex dosers
ATK
65 gallon Saltwater 
65 gallon R/O

Link to comment
Share on other sites

12 minutes ago, Thurman340 said:

I seriously need some programming help. I need to set up ATK with use of doser to supply water over long distance of 60. My salt and r/o reservoir are in garage 65gallons each.  I want to program ATK to turn on separate doser during times AWC dosers not on.  
There’s no issues moving the water through 1/4” . Doser lines have been primed.  

Thank you


Equipment=
Apex
Trident
3 apex dosers
ATK
65 gallon Saltwater 
65 gallon R/O

Just to clarify, you want a Neptune DOS to act as your ATO pump?  If so, it's really easy.  On the DOS head that's drawing water from your RO/DI reservoir, add this code under the DOS Advanced tab:

(you'll need to substitute the names of your ATK low water and high water sensors)

Set OFF
If ATK_LO OPEN Then ON
If ATK_HI CLOSED Then OFF
When On > 005:00 Then OFF
Defer 000:10 Then ON
Defer 000:04 Then OFF
Min Time 060:00 Then OFF

This is basically the same code that's normally used on the ATK for the Neptune PMUP pump.  But the same principle applies...Leave the DOS off until the low sensor is dry, then turn on the DOS.  Once the low sensor detects water, it turn the DOS off.  If for some reason the low sensor fails and allows it to continue running, then the high sensor also tries to turn it off.  Lastly, if both sensors fail, the WHEN timer forces it to turn off after 5 minutes (adjust this value to be appropriate for your size tank).  Lastly, it will only run every hour (due to the Min Time) to avoid repeatedly turning on and off as the water level changes.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Along with that what settings/programming do you recommend for the AWC on/off cycle during the ATO cycles. Thank you for quick replying so quickly. 

My apex was turned off for a while and now I’m updating all tech to be modernized as well.  I’ll take any info you have and programs.  I only have fish in my tank.  Levels are all stable for now. 
 

Tubing(water) from Doser goes on ato or just into tank?

Add’l tank info:

525xl

(3) radion xl 30

(2) MP 40

(1)gyre

(1) Kessil  h80 with controller

(1) M2 return pump 

 

 

Link to comment
Share on other sites

I'm sorry, but you need to explain more clearly what you're trying to accomplish, and where your pumps and tubing is connected.  From your original post, it sounded to me like you want to use a DOS in place of a traditional ATK, so I assume the DOS is pumping water from a RO/DI reservoir into your sump whenever the sump water level is low.

Separately, you're asking about auto water changes.  Are you doing these changes where water is first drained and then later refilled, or using the built-in AWC task where old water is removed at the exact same time when new water is added?  The latter is the normal method using the DOS AWC task, so in that situation the ATO functions as normal since the water level only changes due to evaporation and no separate scheduling is required.

I want to help, but you need to be 100% explicit in what you're trying to accomplish.

  • Like 1
Link to comment
Share on other sites

Ok sorry I have lots going on in my brain. 
 

Task 1: AWC using DOS to sump from 65gallon salt reservoir. This concept I understand. Just curious of scheduling alongside with ATO.   

Task 2: Auto top off using DOS with or without existing apex ato. Does water tubing connect to ato near float valve or just drop into sump? This is for replacing evaporated water using 65gallon r/o reservoir. 
 

I have 3 DOS machine total. I understand one  FULL DOS is for AWC, then one head on another machine for ATO.  That leaves me 3 DOS heads for other stuff. 

Both 65 gallon reservoir are located 60 feet away.  No issues with DOS’s pulling that far. 

Link to comment
Share on other sites

On 2/19/2020 at 8:02 PM, SuncrestReef said:

I'm sorry, but you need to explain more clearly what you're trying to accomplish, and where your pumps and tubing is connected.  From your original post, it sounded to me like you want to use a DOS in place of a traditional ATK, so I assume the DOS is pumping water from a RO/DI reservoir into your sump whenever the sump water level is low.

Separately, you're asking about auto water changes.  Are you doing these changes where water is first drained and then later refilled, or using the built-in AWC task where old water is removed at the exact same time when new water is added?  The latter is the normal method using the DOS AWC task, so in that situation the ATO functions as normal since the water level only changes due to evaporation and no separate scheduling is required.

I want to help, but you need to be 100% explicit in what you're trying to accomplish.

Ok sorry I have lots going on in my brain. 
 

Task 1: AWC using DOS to sump from 65gallon salt reservoir. This concept I understand. Just curious of scheduling alongside with ATO.   

Task 2: Auto top off using DOS with or without existing apex ato. Does water tubing connect to ato near float valve or just drop into sump? This is for replacing evaporated water using 65gallon r/o reservoir. 
 

I have 3 DOS machine total. I understand one  FULL DOS is for AWC, then one head on another machine for ATO.  That leaves me 3 DOS heads for other stuff. 

Both 65 gallon reservoir are located 60 feet away.  No issues with DOS’s pulling that far. 

Link to comment
Share on other sites

What's the consensus on running two heaters from the apex?

I know to have the switching for temp control done at the heater controller (not the apex power bar), but should I have the two heaters alternate cycles or leave one heater forever off as a backup with the other always on?  That is, set up Heater A to run 00:00 - 11:59, and Heater B to run 12:00 - 23:59, or else have heater A on and set heater B on at a lower temp?  Wear one controller and not the other, or wear them both equally?

Link to comment
Share on other sites

Another question - can I use Mintime and Defer together?

I want to create a two-step feed cycle, based on a physical button.

vFeedFish - turn on for 5 minutes when the button is pressed

Set OFF
If BtRt CLOSED Then ON
Min Time 005:00 Then ON

vFishNTTM - wait 5 minutes then turn on for 5 minutes

Set OFF
If BtRt CLOSED Then ON
Defer 005:00 Then ON
Min Time 005:00 Then ON


Vortech pump it's controlling

...
If Output vFeedFish = ON Then MP_Const10
If Output vFishNTTM = ON Then MP_NTM40
...


This doesn't seem to be working, the NTTM doesn't run. Do I just need to change the Mintime statement to 010 instead of 005?

Sent from my Pixel 3 XL using Tapatalk

Link to comment
Share on other sites

  • 4 weeks later...

I had the not so fun task of moving a very large APEX system over to a new controller.  This guide was invaluable, I find it easier to use than the APEX documentation.  I am a 26 year active software engineer veteran and things such as how to do a simple 'AND' throw me off in the crazy APEX language.

 

HUGE THANKS @SuncrestReef

  • Thanks 1
Link to comment
Share on other sites

2 minutes ago, TheClark said:

I had the not so fun task of moving a very large APEX system over to a new controller.  This guide was invaluable, I find it easier to use than the APEX documentation.  I am a 26 year active software engineer veteran and things such as how to do a simple 'AND' throw me off in the crazy APEX language.

 

HUGE THANKS @SuncrestReef

So glad to hear it helped!

Over at Reef2Reef the tutorial series has now had over 26,000 views.  It's a great feeling to know the effort of writing these topics has helped so many people, including reefers right here on PNWMAS.  Thanks for the kind words.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

Here is a reference guide for all of the Neptune Apex programming commands. All of this information is publicly available, but is scattered amongst several Neptune documents and posts in the Neptune Community Forums. My goal is to consolidate all of this information into a single reference document.

Documentation Conventions
Before presenting the list of commands, here is an overview of the documentation conventions for parameters:

Input, Output, and Profile names are shown in bold italics.

Examples:
If Temp > 80 Then OFF
If Flow1 < 100 Then OFF
If pH > 6.80 Then ON
If Output Return_Pump = OFF Then OFF
If FeedA 000 Then Slow_Mode

Various parameters are listed in square brackets, separated by a slash: [ON/OFF/Profile_Name/%]

Examples:
If Time 08:00 To 10:00 Then [ON/OFF/Profile_Name/%] includes the following possible uses:

If Time 08:00 To 10:00 Then ON (turns the output ON)
If Time 08:00 To 10:00 Then OFF (turns the output OFF)
If Time 08:00 To 10:00 Then Morning_Mode (sets the output to use the Morning_Mode profile)
If Time 08:00 To 10:00 Then 25 (sets the output to 25%)

Note: Profiles can only be used on specific output types. For example, a Pump profile only works on 0-10v variable outputs, DOS profiles only work on DOS outputs, Radion profiles only work on Radion outputs, etc.

Note: Only certain types of outputs support percentages. For details, see this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming

Operators are also listed in square brackets, separated by a slash: [>/<]

Examples:

If Input_name [>/<] ### Then [ON/OFF/Profile_Name/%] includes the following possible uses:

If Temp > 80.0 Then OFF
If Temp < 76.0 Then ON

### represents a numeric value, which may or may not include a decimal point.

Times are specified in hours, minutes, and seconds represented by H, M, and S respectively. Some commands use hours & minutes, some use minutes only, and others use minutes & seconds.

Examples:

If Time HH:MM To HH:MM Then [ON/OFF/Profile_Name/%]
OSC MMM:SS/MMM:SS/MMM:SS Then [ON/OFF/Profile_Name]
Defer MMM:SS Then [ON/OFF]

Apex Programming Command Reference

Set [ON/OFF/Profile_Name/%]


Set is used to unconditionally set an output state, and is commonly used as the first command in a program to set the default state prior to applying various conditions that would override that initial state.

For more details on the Set command, see: https://forum.neptunesystems.com/sh...d-This-Thread!&p=114462&viewfull=1#post114462

If Time HH:MM To HH:MM Then [ON/OFF/Profile_Name/%]

If Time is used to set an output state between a set of fixed times, inclusive of the start and end time.

For more details of the If Time command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/

If DOW [SMTWTFS] Then [ON/OFF/Profile_Name/%]

The DOW command is used to set an output state based on the day of week. Each day is represented by a letter placeholder starting with Sunday and ending with Saturday. If a letter is listed, the command will evaluate True for that day. If a dash is substituted for a day, the command will evaluate False for that day.

Example:
If DOW SMT-TFS Then ON

This will turn the output ON each day of the week except for Wednesday, since Wednesday's placeholder is listed with a dash.

For more details of the DOW command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/

If Input_Name [>/<] ### Then [ON/OFF/Profile_Name/%]

This command is used to measure the reading of a probe, including temperature, pH, ORP, salinity, dissolved oxygen, flow sensor, PAR sensor, Trident alkalinity, Trident calcium, or Trident magnesium.

If Output Output_Name = [ON/OFF] Then [ON/OFF/Profile_Name/%]

This command is used to react to the current state of an output, whether physical or virtual.

If Switch_Name [OPEN/CLOSED] Then [ON/OFF/Profile_Name/%]

This command is used to react to either an optical sensor, leak sensor, or a switch connected to a Breakout Box port.

If [FeedA/FeedB/FeedC/FeedD] MMM Then [ON/OFF/Profile_Name/%]

This command sets an output state when a Feed Cycle is activated. The MMM delay extends the output state for a number of minutes beyond the set time of the selected Feed Cycle.

For more details on If Feed, see my tutorial on Apex Feed Cycles: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-7-feed-cycles.715/

If Temp [>/<] RT+[-] [###] Then [ON/OFF/PROFILE/%]

This command is used to set an output state based on the regional temperature defined in the Apex seasonal tables.

For more details on If Temp, see page 65 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf

If Sun [+/-] [MMM] / [+/-] [MMM] Then [ON/OFF/Profile_Name/%]

This command is used to set an output state based on the sunrise or sunset cycles defined in the Apex seasonal tables. The first timer is relative to sunrise, and the second timer is relative to sunset. A positive number delays the action to after the event, and a negative number proceeds the event.

For more details on If Sun, see page 66 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf

If Moon [+/-] [MMM] / [+/-] [MMM] Then [ON/OFF/Profile_Name/%]

This command is used to set an output state based on the moonrise or moonset cycles defined in the Apex seasonal tables. The first timer is relative to moonrise, and the second timer is relative to moonset. A positive number delays the action to after the event, and a negative number proceeds the event.

For more details on If Moon, see page 67 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
For an example of If Moon usage, see my tutorial on Apex Lunar Schedule and Lighting Profiles: https://www.reef2reef.com/ams/neptu...sion-lunar-schedule-and-lighting-profiles.717

If Output Output_Name [Amps/Watts] [>/<] ### Then [ON/OFF/Profile_Name/%]

This command is used to react to the Amps or Watts currently consumed by an EB832 output. This does not apply to the older EB4, EB6, EB8, or the DC24 accessory outputs of the EB832.

For more details about the Amps/Watts programming, see my tutorial on Apex Power Monitoring: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-4-power-monitoring.698/

If Power [Power Probe] [ON/OFF] [###] Then [ON/OFF/Profile_Name/%]

This command is used to set an output state based on the detection of a power failure. The [Power Probe] is either the Apex or the name of an attached Energy bar.

For more details on If Power and instructions on how to integrate the Apex with a UPS backup battery, see my tutorial on Apex Power Monitoring: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-4-power-monitoring.698/

OSC MMM:SS/MMM:SS/MMM:SS Then [ON/OFF/Profile]

OSC is used to control an output on a repeating schedule. There are 3 timers:

  • Initial delay in minutes and seconds
  • minutes and seconds of actual run time
  • minutes and seconds of trailing delay

For details and examples of the OSC command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/

Defer MMM:SS Then [ON/OFF]

Defer delays switching an output from ON to OFF, or from OFF to ON. This command applies to the output after all the conditions have been evaluated. Only one Defer ON and one Defer OFF command can be used on an output. When the output changes from ON to OFF, only the Defer OFF timer is applied. When the output changes from OFF to ON, only the Defer ON timer is applied.

For details and examples of Defer, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/

Min Time MMM:SS Then [ON/OFF]

Min Time forces an output to remain ON or OFF for a minimum amount of time regardless of the conditions evaluated in the programming. If the output is ON, only the Min Time Then ON timer is applied. If the output is OFF, only the Min Time Then OFF timer is applied.

For more details and examples of Min Time, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/

When [ON/OFF] > MMM:SS Then [ON/OFF]

When is used to switch an output’s tile from AUTO to OFF or ON if a condition is met. This is the only command in the Apex programming language that can physically move an output tile's slider position on the dashboard, and once moved, manual intervention is required to set it back to AUTO before the programming will be resumed.

For more details and examples of When, see https://forum.neptunesystems.com/sh...e-%91When%92-statement
Also see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/

If Error Output_Name Then [ON/OFF]

The If Error command will evaluate True if the When timer described above is exceeded. For details about If Error, see https://forum.neptunesystems.com/sh...e-%91When%92-statement

Fallback [ON/OFF/Profile_Name/%]

Fallback is used to set the output state in an AquaBus module when that module loses communications with the Apex.

For more details on Fallback, see https://forum.neptunesystems.com/showthread.php?8510-All-About-FALLBACK
 

Link to comment
Share on other sites

On 2/14/2020 at 5:17 PM, SuncrestReef said:

It's funny, sometimes I think having a background in programming is a disadvantage since Neptune's programming model and syntax is so much different than most popular programming languages! 🤣

I agree. I've been able to accomplish what I wanted to with the Apex, but man, it'd sure be easier if they just included some of the basic elements present in every other language I've used. Cmon, Neptune, just give me some kind of loop!

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...