Neptune Apex Programming Tutorials, Part 5: Virtual Outputs

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,251
Location
Oregon
Rating - 0%
0   0   0
Seawitch submitted a new Article:

Neptune Apex Programming Tutorials, Part 5: Virtual Outputs

Note From the Editor:

This article is Part 5 of a series. Feel free to go back and read Part 1, Part 2, Part 3, or Part 4.

This article and several future ones by the same author were originally part of several presentations made to a local aquarium club on programming your Neptune Apex Controller. The article is reprinted with permission from the author.

Because this topic will be of great interest to some readers but no interest to others who have not automated their systems, R2R will run these programming articles every Friday until we come to the end of the series.

Photos, images, and diagrams included in this article below are all courtesy of the author, @SuncrestReef ©2019, All Rights Reserved.

For inspiration, here's a spectacular macro photo from the author's reef tank.
r2rsuncrestmacro.png


And here's an interesting photo of how the author shoots photos.
r2rsuncrest.jpg


~~~~~~~~~~~~~~~~~~~~~~

Virtual Outputs


So far in this series we have focused a lot on programming outputs that turn on or turn off devices plugged into Energy Bars. These outputs are physical, tangible electrical outlets that have power cords plugged in. Virtual outputs are imaginary outputs that we can use to create more complex programming than would normally be available given the Apex programming limitations. Virtual outputs can be used for a variety of reasons:
  • Providing a master On/Off switch to easily turn off a number of devices with a single click.
  • Providing enhanced control of alarm programming.
  • Determining if one condition AND another condition are true, then applying the result of that comparison in an IF command on a physical output programming.
  • Automating Feed modes
  • Customizing lighting schedules
This is not an exhaustive list, as you can be creative with the use of virtual outputs.

Creating a virtual output

Virtual outputs are created from the Outputs screen:
  1. Click the Advanced (gear icon) at the top of the Fusion dashboard to expand the list of icons
    image6-1.png
  2. Click the Outputs icon
    image6-2.png
  3. Click the Add/Delete (gear icon) at the upper right, then click Add a virtual output
    image6-3.png
  4. Enter a descriptive name for the new output. You are limited to 12 characters, and the name must be unique within your list of outputs, inputs, and module names.
    image6-4.png
  5. Once the new output has been created, Fusion will indicate that a new tile is available. Click the padlock icon to access the Unused Tiles screen.
    image6-5.png
  6. Scroll right to left to get to the newly added output, then drag it to your dashboard, then click the padlock icon again to close the Unused Tiles screen.
    image6-6.png
  7. Click the gear icon above the new output to configure it.
    image6-7.png
  8. I always recommend enabling the Log checkbox so you’ll have a record of any time the output was turned on or off.
    image6-8.png

    New virtual outputs always default to a single line of code: Set OFF
What you do with the output from here is totally up to you. I’ll provide a few examples of how I use them:

Maintenance master On/Off switch

When I conduct major maintenance in my sump, such as cleaning my return pump or emptying and cleaning out the sump, I normally turn off a number of devices:
  • Return pump
  • Skimmer
  • Heaters (x2)
  • Refugium pump
  • ATO
  • Dosing pumps (x2)
  • Auto water change pumps (x2)
  • Sump powerhead
  • UV sterilizer
Rather than clicking 12 separate output tiles on my dashboard, I just click my Maintenance output, and have programming on all the other devices to turn them off for me:

Return Pump:

Fallback ON
Set 100
If LkCrpt CLOSED Then OFF
If LkSump CLOSED Then OFF
If SMP_Lo OPEN Then OFF
If Output Maintenance = ON Then OFF
If FeedA 000 Then 1
If FeedB 000 Then 1


Heaters:

Fallback OFF
If Tmp < 78.0 Then ON
If Tmp > 78.0 Then OFF
If Output Maintenance = ON Then OFF
Defer 001:00 Then ON
Defer 000:15 Then OFF


and so on with the other devices. Just that single line of If Output Maintenance = ON Then OFF is all that’s needed. Remember to place that line below any line of code that may turn the device on because the code is processed from top to bottom, as covered in our Introduction tutorial.

Since the Maintenance virtual output doesn’t actually run any program (other than its default Set OFF command), the only way to activate Maintenance mode is to manually move the slider to the ON position:

image6-9.png

When you complete your maintenance, move the slider to the OFF position:

image6-10.png

Since this output doesn’t have any programming, I prefer to always leave it in the manual OFF position rather than AUTO, even though in this particular example it doesn’t make a difference. My reasoning is that it’s easier to see at a glance when the slider is in the OFF position than seeing it in the AUTO position and then needing to look more closely above the slider to see if it says “On” or “Off” in a smaller font.

This master On/Off switch is by far the simplest usage for virtual outputs. Next, let’s look at some examples that involve a bit more programming.


Providing enhanced control of alarm programming

Virtual outputs provide a way to trigger alerts for certain conditions beyond the simple “If this then ON” commands in the Email Alarm output. My favorite example is a warning if my ATO hasn’t run recently. Under normal circumstances my ATO runs every 30 minutes due to evaporation, or perhaps every 60 or 90 minutes if I happened to add a little excess water to my sump. But it should NEVER wait over 2 hours to run, so if it does I’d like to know. I use a virtual output named Alert_ATO to keep track of this for me:

Set OFF
If ATK_LO OPEN Then ON
Defer 120:00 Then ON


Then in my Email_Alarm output, I added this line:

If Output Alert_ATO = ON Then ON

If you recall from the ATK Troubleshooting tutorial, the lower optical sensor in my sump is named ATK_LO, and when it reports OPEN then the ATK_PMUP output is turned on to refill the sump. This Alert_ATO virtual output is instructed to turn ON when ATK_LO is OPEN, but the Defer 120:00 forces the virtual output to wait for 2 hours before finally changing state to ON, as discussed in the Timers tutorial. If during that 2 hour timer the sump is refilled and ATK_LO changes to CLOSED, then the Defer timer is reset. But if the pump doesn’t run and the 2 hour timer finally reaches zero, the Alert_ATO virtual output finally changes state to ON, and the Email_Alarm is then triggered. Pretty slick!

Once the Email_Alert output is on, it will send text and email messages once per hour until the situation is corrected or the output is manually turned off. For critical alarms this is fine, but sometimes the alarms are not really critical and maybe you don’t want to get up at 2am for something trivial. In those situations, a virtual output can be used to trigger the alarm, but then turn itself off so the alarm doesn’t repeat every hour.

(wow, I just got an alarm about my 2-part container being low…perfect timing to describe an example of a non-critical alarm that doesn’t need to nag me every hour)

image6-11.jpg

Here’s how to program a one-time alert using a virtual output named Alert_2Part:

Set OFF
If ALK_LO OPEN Then ON
If CAL_LO OPEN Then ON
If Time 23:00 To 07:00 Then OFF
Defer 001:00 Then ON
When On > 010:00 Then OFF


This single virtual output is checking both my alkalinity container and calcium container. If either one is low, the output is triggered.

image6-12.png

This is an example of an OR comparison. In the next example I’ll show an AND comparison.

Recalling from our Timers tutorial, the Defer timer is used to prevent false alarms due to ripples on the liquid surface inadvertently triggering the optical sensor (in my case, if I accidentally bump the container when it’s nearly low, but not quite at the sensor yet). Once the liquid is below the sensor for at least 1 continuous minute, the output finally changes state to ON, unless it's between 11pm - 7am when I'm sleeping. In my Email_Alarm output, I added this line:

If Output Alert_2Part = ON Then ON

This triggers the actual email and text message. However, instead of getting a repeated alert every hour, the When command on the virtual output turns the output OFF after 10 minutes, which cancels the Email_Alert. Remember the When command is a failsafe that moves the output tile slider to the manual OFF position, so it will no longer run the program until you move it back to AUTO:

image6-13.png

Once I finish typing up this tutorial, I’ll go refill my 2-part containers and then set the Alert_2Part virtual output back to AUTO.

AND comparisons

Sometimes you might want an output to turn on only if two or more conditions are true. This is considered an AND comparison. Here’s an example where I use a virtual output to determine if my Radion lights should simulate moon lighting, but only if the moon is visible, and only if my normal lighting schedule is off:

Set OFF
If Moon 000/000 Then ON
If Time 07:00 to 21:00 Then OFF


The Apex’s built in lunar schedule knows when the moon is above the horizon. Since moonrise varies day to day, sometimes it’s visible at night, but sometimes it’s during the day. In this example, the output register is set to ON if the moon is visible, but it’s turned OFF if the time is between 7am - 9pm. This is effectively saying “if the moon is up, AND the time is between 9pm to 7am, then turn ON”.

On my Radion outputs, I just add a line to switch to the moon lighting:

If Output vMoon = ON Then Moonlight

I will cover this topic in more detail in the upcoming Lunar Schedule and Lighting Profiles tutorial.

Virtual outputs are really useful! Hopefully this will get you started with creating some convenient automation for your setup.

In the next installment of this series I’ll go over Alarms in more detail. Stay tuned.

~~~~~~~~~~

We encourage all our readers to join the Reef2Reef forum. It’s easy to register, free, and reefkeeping is much easier and more fun in a community of fellow aquarists. We pride ourselves on a warm and family-friendly forum where everyone is welcome. You will also find lots of contests and giveaways with our sponsors.

~~~~~~~~~~~

Author Profile: @SuncrestReef

John Halsey is a reefing hobbyist who keeps a Red Sea Reefer XL 425 in his living room. He is new to reefing with just over one year of experience, but has been successful in keeping a healthy mixed reef by following best practices learned here on R2R as well as actively participating in his local aquarist club--PNWMAS--in Portland, Oregon. John retired from his 30-year career in IT support, and put that technical expertise to good use by automating much of his aquarium equipment with an extensive Neptune Apex system.

~~~~~~~~~~~
 

Sisterlimonpot

Effortless Perfection
View Badges
Joined
Jul 15, 2009
Messages
4,260
Reaction score
8,615
Location
Litchfield Park
Rating - 0%
0   0   0
VO's are my bread and butter. I have a long list of them, most of them use the "when on" statement for temporary light spectrum changes, water changes, basically anytime a particular maintenance event requires multiple outlets to be changed at once or something needs a 1 time event, I use a VO.
 
U

User1

Guest
View Badges
Good Job.

Virtual outlets are fun. I have a pair of Cor return pumps. Both are on a 1" sea swirl with the Cor 20 attached to the one with the longest or furthest plumbing line. Anyway I have a virtual outlet named Tide Timing. Basic I know but all it does is use the OSC function as:

OSC 000:00/360:00/360:00 Then ON

Then on either of the return pumps I use this code to simulate tides:

Fallback ON
Set 55
If Output TideTiming = ON Then 45

Now I can simulate high and low tides by alternating the Cor's output to simulate left, right flows without shutting them down over a 6 hour window. Seems to work pretty well once I balanced the sump level of course. The image below was when I used the basic wizard vs virtual outlet but concept / function is the same just not gradual.

upload_2019-7-9_14-24-30.png
 

bar|none

Well-Known Member
View Badges
Joined
Apr 15, 2019
Messages
576
Reaction score
632
Rating - 0%
0   0   0
Thx for this!. And awesome photos! Do you have a thread that describes the gear you are using (for photos) as pictured? I'm a seasoned amature photog but never done much macro or any tank photography and it is a different world, literally.
 

UCF Alum

Stick addict
View Badges
Joined
Oct 7, 2017
Messages
935
Reaction score
2,808
Location
Central Florida
Rating - 0%
0   0   0
A6234E2D-BA2E-4C95-8D25-F1655D83FD8C.png

@SuncrestReef

Thanks for the write up! How would I use a master switch to turn off my skimmer, wave pumps, ATO and return pump when doing a water change with the click of one button? I got the tile on my dash now labeled water change.
Here are the names of my equipment.
 
Last edited:
OP
OP
SuncrestReef

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,251
Location
Oregon
Rating - 0%
0   0   0
A6234E2D-BA2E-4C95-8D25-F1655D83FD8C.png

@SuncrestReef

Thanks for the write up! How would I use a master switch to turn off my skimmer, wave pumps, ATO and return pump when doing a water change with the click of one button?
Here are the names of my equipment.

Just create a single virtual Output, let’s call it WaterChange, then add this to each Output you want to turn off during the change:

If Output WaterChange = ON Then OFF
 

UCF Alum

Stick addict
View Badges
Joined
Oct 7, 2017
Messages
935
Reaction score
2,808
Location
Central Florida
Rating - 0%
0   0   0
92132407-9576-4EA0-B071-B56C4A4785FC.png

Just add ”If output waterchange=on them off” to each device I want to turn off under the “advanced” tab under configuration right? That’s it?
 
OP
OP
SuncrestReef

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,251
Location
Oregon
Rating - 0%
0   0   0
92132407-9576-4EA0-B071-B56C4A4785FC.png

Just add ”If output waterchange=on them off” to each device under the “advanced” tab right? That’s it?

Yes. Add the new virtual output WaterChange to your dashboard, then when you click it ON that will turn off any other outputs where you added the programming in the Advanced tab. Once you click WaterChange to OFF, the other outputs should resume their normal operation.
 
OP
OP
SuncrestReef

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,251
Location
Oregon
Rating - 0%
0   0   0

UCF Alum

Stick addict
View Badges
Joined
Oct 7, 2017
Messages
935
Reaction score
2,808
Location
Central Florida
Rating - 0%
0   0   0
914A090D-823B-46DC-B185-0AC636732CB7.png

Can I safely add it to line 4 without messing up line three’s programming? In other words line 3 programming will not be interrupted by what I put on line 4 if its something completely different. ...
(The above pic is my return pump)
 
Last edited:
OP
OP
SuncrestReef

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,251
Location
Oregon
Rating - 0%
0   0   0
914A090D-823B-46DC-B185-0AC636732CB7.png

Can I safely add it to line 4 without messing up line three’s programming? In other words line 3 programming will not be interrupted by what I put on line 4 if its something completely different. ...
(The above pic is my return pump)

Yes. Apex programming is evaluated from top to bottom, as explained in section 1 of my tutorials, so the last line that evaluates True will set the state of the output. See: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-1.685/
 
Last edited:

conix67

New Member
View Badges
Joined
Mar 18, 2020
Messages
17
Reaction score
33
Rating - 0%
0   0   0
Looks like virtual output is not available through Apex Fusion on Apex Classic? I thought Classic is pretty much the same as Wifi version in terms of features but there are several key features missing. One other being the power monitor feature which was also claimed supported on Apex Classic but useless. I guess they had to find a way for people to upgrade to the Wifi version even if you don't need the Wifi feature..
 
OP
OP
SuncrestReef

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,251
Location
Oregon
Rating - 0%
0   0   0
Looks like virtual output is not available through Apex Fusion on Apex Classic? I thought Classic is pretty much the same as Wifi version in terms of features but there are several key features missing. One other being the power monitor feature which was also claimed supported on Apex Classic but useless. I guess they had to find a way for people to upgrade to the Wifi version even if you don't need the Wifi feature..

Sorry, at the time I wrote these tutorials I did not have access to any older Apex models, so my instructions only showed the current model. Please see page 113 of Neptune's Apex Comprehensive Guide for instructions on how to create virtual outputs for the Apex Classic and older models: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf

Once the virtual outputs are created through the Classic Dashboard, you can manage and program them through Fusion as shown in my tutorial.
 

conix67

New Member
View Badges
Joined
Mar 18, 2020
Messages
17
Reaction score
33
Rating - 0%
0   0   0
Sorry, at the time I wrote these tutorials I did not have access to any older Apex models, so my instructions only showed the current model. Please see page 113 of Neptune's Apex Comprehensive Guide for instructions on how to create virtual outputs for the Apex Classic and older models: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf

Once the virtual outputs are created through the Classic Dashboard, you can manage and program them through Fusion as shown in my tutorial.

Thank you! Yes, I managed to find them and follow the rest of the tutorials after. I think it's more difficult to make these subtle differences in ApexFusion than just keep them the same across all Apex models. Although I do like the product, little things like these really disappoints..
 
Back
Top