Should this code work?

Neptune

Andy D

New Member
View Badges
Joined
Apr 7, 2021
Messages
9
Reaction score
5
Location
Manchester
As i apply ozone via my skimmer, if the skimmer is turned off due to a full waste container say, i dont want ozone leaking into my front room. Also i want to manage orp levels.
Thanks
C2F10824-7832-419D-91CD-A596A9998365.png
 
Top Shelf Aquatics

SuncrestReef

That Apex guy
View Badges
Marketplace Rating
Joined
Jan 18, 2018
Messages
3,557
Reaction score
7,919
Location
Oregon
As i apply ozone via my skimmer, if the skimmer is turned off due to a full waste container say, i dont want ozone leaking into my front room. Also i want to manage orp levels.
Thanks
C2F10824-7832-419D-91CD-A596A9998365.png
Your code won't work as written because the Apex evaluates each line from top to bottom, and the last line that's True sets the output state. In the case of checking the skimmer's status, the following line "If ORP < 370 Then ON" would turn on the Ozone even if the skimmer is off, since that line would be the last line that's True.

You have two options to work around this:

1. Move the Skimmer condition below the ORP lines. This will override the ORP conditions when the skimmer is off. However, once the skimmer turns back on, you'll have to wait until ORP drops below 370 again before ozone will turn back on.

Fallback OFF
If ORP < 370 Then ON
If ORP > 440 Then OFF
If Output Skimmer = OFF Then OFF

- or -

2. If you really want to maintain a range for the ORP, use a virtual output to evaluate the lower and upper ORP values, then use the status of that virtual output to control the Ozone output, plus override it when the skimmer is off. This would turn on the ozone if ORP < 370, turn it off if ORP > 440, turn off ozone when the skimmer is off, but once the skimmer turns back on, it will turn ozone back on even if it hadn't yet dropped below 370 and hasn't yet reached 440.

[Low_ORP] -- virtual output
If ORP < 370 Then ON
If ORP > 440 Then OFF

[Ozone]
Fallback OFF
Set OFF
If Output Low_ORP = ON Then ON
If Output Skimmer = OFF Then OFF

Notice in both of these options, I'm not checking if the skimmer is ON. If you're checking that it's OFF, there's no need to also check if it's ON because the first check will obviously be False. The other lines of code above the Skimmer check will handle turning ozone back ON.

If you're not familiar with virtual outputs, see my tutorial here:
 
OP
Andy D

Andy D

New Member
View Badges
Joined
Apr 7, 2021
Messages
9
Reaction score
5
Location
Manchester
Your code won't work as written because the Apex evaluates each line from top to bottom, and the last line that's True sets the output state. In the case of checking the skimmer's status, the following line "If ORP < 370 Then ON" would turn on the Ozone even if the skimmer is off, since that line would be the last line that's True.

You have two options to work around this:

1. Move the Skimmer condition below the ORP lines. This will override the ORP conditions when the skimmer is off. However, once the skimmer turns back on, you'll have to wait until ORP drops below 370 again before ozone will turn back on.

Fallback OFF
If ORP < 370 Then ON
If ORP > 440 Then OFF
If Output Skimmer = OFF Then OFF

- or -

2. If you really want to maintain a range for the ORP, use a virtual output to evaluate the lower and upper ORP values, then use the status of that virtual output to control the Ozone output, plus override it when the skimmer is off. This would turn on the ozone if ORP < 370, turn it off if ORP > 440, turn off ozone when the skimmer is off, but once the skimmer turns back on, it will turn ozone back on even if it hadn't yet dropped below 370 and hasn't yet reached 440.

[Low_ORP] -- virtual output
If ORP < 370 Then ON
If ORP > 440 Then OFF

[Ozone]
Fallback OFF
Set OFF
If Output Low_ORP = ON Then ON
If Output Skimmer = OFF Then OFF

Notice in both of these options, I'm not checking if the skimmer is ON. If you're checking that it's OFF, there's no need to also check if it's ON because the first check will obviously be False. The other lines of code above the Skimmer check will handle turning ozone back ON.

If you're not familiar with virtual outputs, see my tutorial here:
Thanks for that!!! I did try to google apex code priority but i guess my wording was off , you have easily exceeded what i was expecting for an answer too, thanks again
 
OP
Andy D

Andy D

New Member
View Badges
Joined
Apr 7, 2021
Messages
9
Reaction score
5
Location
Manchester
Your code won't work as written because the Apex evaluates each line from top to bottom, and the last line that's True sets the output state. In the case of checking the skimmer's status, the following line "If ORP < 370 Then ON" would turn on the Ozone even if the skimmer is off, since that line would be the last line that's True.

You have two options to work around this:

1. Move the Skimmer condition below the ORP lines. This will override the ORP conditions when the skimmer is off. However, once the skimmer turns back on, you'll have to wait until ORP drops below 370 again before ozone will turn back on.

Fallback OFF
If ORP < 370 Then ON
If ORP > 440 Then OFF
If Output Skimmer = OFF Then OFF

- or -

2. If you really want to maintain a range for the ORP, use a virtual output to evaluate the lower and upper ORP values, then use the status of that virtual output to control the Ozone output, plus override it when the skimmer is off. This would turn on the ozone if ORP < 370, turn it off if ORP > 440, turn off ozone when the skimmer is off, but once the skimmer turns back on, it will turn ozone back on even if it hadn't yet dropped below 370 and hasn't yet reached 440.

[Low_ORP] -- virtual output
If ORP < 370 Then ON
If ORP > 440 Then OFF

[Ozone]
Fallback OFF
Set OFF
If Output Low_ORP = ON Then ON
If Output Skimmer = OFF Then OFF

Notice in both of these options, I'm not checking if the skimmer is ON. If you're checking that it's OFF, there's no need to also check if it's ON because the first check will obviously be False. The other lines of code above the Skimmer check will handle turning ozone back ON.

If you're not familiar with virtual outputs, see my tutorial here:
I seem to be unable to add the virtual outlet? I dont see the tab?
7D657ABB-95CD-40EF-B296-E4308B688F10.png
 

SuncrestReef

That Apex guy
View Badges
Marketplace Rating
Joined
Jan 18, 2018
Messages
3,557
Reaction score
7,919
Location
Oregon
I seem to be unable to add the virtual outlet? I dont see the tab?
7D657ABB-95CD-40EF-B296-E4308B688F10.png
You must have an Apex Classic or older model, which requires you to create the virtual outputs from the Classic Dashboard.

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.
 
AS
Neptune

Have you ever had aquarium equipment damaged by livestock?

  • YES (tell us in the thread)

    Votes: 30 16.0%
  • NO

    Votes: 142 75.9%
  • Maybe now that you mention it

    Votes: 12 6.4%
  • Other (please explain)

    Votes: 3 1.6%
www.LeviathanAutomation.com
Top