Should this code work?

Andy D

New Member
View Badges
Joined
Apr 7, 2021
Messages
11
Reaction score
5
Location
Manchester
Rating - 0%
0   0   0
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
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,216
Location
Oregon
Rating - 0%
0   0   0
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
OP
Andy D

Andy D

New Member
View Badges
Joined
Apr 7, 2021
Messages
11
Reaction score
5
Location
Manchester
Rating - 0%
0   0   0
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
OP
Andy D

Andy D

New Member
View Badges
Joined
Apr 7, 2021
Messages
11
Reaction score
5
Location
Manchester
Rating - 0%
0   0   0
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
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,216
Location
Oregon
Rating - 0%
0   0   0
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.
 

Rock solid aquascape: Does the weight of the rocks in your aquascape matter?

  • The weight of the rocks is a key factor.

    Votes: 10 8.1%
  • The weight of the rocks is one of many factors.

    Votes: 43 34.7%
  • The weight of the rocks is a minor factor.

    Votes: 39 31.5%
  • The weight of the rocks is not a factor.

    Votes: 31 25.0%
  • Other.

    Votes: 1 0.8%
Back
Top