UV programming question

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

VJV

Valuable Member
View Badges
Joined
Jan 28, 2015
Messages
1,476
Reaction score
751
Location
Portugal, Europe
Rating - 0%
0   0   0
Hi, I would like to have my UV turning off if temp gets above 26C and back on only when temp gets below 25,5. This is to make sure that ot is not constantly turning on and off. Any ideas how to do it?

the first part seems very obvious but what would the second sentence be?


if Temp > 26 Then Off
...?

Thanks!!
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,225
Location
Oregon
Rating - 0%
0   0   0
Please post the code your UV is currently using. That will factor in when proposing a solution.
 

bearpeidog

New Member
View Badges
Joined
Jan 1, 2021
Messages
13
Reaction score
12
Location
VT
Rating - 0%
0   0   0
Are you using an Apex? If so, the defer command is your friend to prevent rapid cycling of an outlet.

 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,225
Location
Oregon
Rating - 0%
0   0   0
If your UV already has programming to turn on and off based on other conditions, such as when the pump is off or based on a flow sensor, then you'd need to create a virtual output to monitor the temperature range and add that virtual output's status as another condition on the UV. Example:

[UV]
Set ON
If Output Pump = OFF Then OFF
If Flow < 100 Then OFF
If Output High_Temp = ON Then OFF

[High_Temp] -- virtual output
If Temp > 26.0 Then ON
If Temp < 25.5 Then OFF

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

VJV

Valuable Member
View Badges
Joined
Jan 28, 2015
Messages
1,476
Reaction score
751
Location
Portugal, Europe
Rating - 0%
0   0   0
If your UV already has programming to turn on and off based on other conditions, such as when the pump is off or based on a flow sensor, then you'd need to create a virtual output to monitor the temperature range and add that virtual output's status as another condition on the UV. Example:

[UV]
Set ON
If Output Pump = OFF Then OFF
If Flow < 100 Then OFF
If Output High_Temp = ON Then OFF

[High_Temp] -- virtual output
If Temp > 26.0 Then ON
If Temp < 25.5 Then OFF

If you're not familiar with virtual outputs, see my tutorial here:
Thank you very much Suncrestreef! Much appreciated. Yes, my outlet already has a bunch of programming. In fact, I will post it below and if you spot some errors please shout.
One question: why can’t I simply right the temp lines into the UV outlet? And also, what will the Apex assume when the temp is hogher than 25,5 but lower than 26? (I fuess those were two questions after all ).

Many thanks
 
Last edited:
OP
OP
VJV

VJV

Valuable Member
View Badges
Joined
Jan 28, 2015
Messages
1,476
Reaction score
751
Location
Portugal, Europe
Rating - 0%
0   0   0
Here is the current programming!

1622315698895.png
1622315698895.png
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,225
Location
Oregon
Rating - 0%
0   0   0
Thank you very much Suncrestreef! Much appreciates. Yes, my outlet already has a bunch of programming. In fact, I will post it below and if you spot some errors please shout.
One question: why can’t I simply right the temp lines into the UV outlet? And also, what will the Apex assume when the temp is hogher than 25,5 but lower than 26? (I fuess those were two questions after all ).

Many thanks
It's a bit difficult to explain. The Apex evaluates the code from top to bottom, and the last line that's True will set the output on or off. When you have multiple conditions that are True, the last one in the list that's True will win. In your current code, the Set ON statement at the top is always True (it's not a decision to evaluate, it's a statement), so unless something below that line is True, the UV will always be on.

But let's walk through the scenario from your original question: You want it to turn off when the temperature is over 26C, and remain off until it drops below 25.5. The Set ON command turns on the UV, and when your temperature exceeds 26.0 it turns off. But the moment the temperature drops to 26.0 the Set ON command will turn it back on because that condition is no longer True, so the Set ON wins.

By moving the temperature evaluation to a separate output, you can maintain a range from 26.0 down to 25.5. In this scenario, the Set ON turns on the UV. When the temperature exceeds 26.0, the virtual output turn on, and then the "If Output High_Temp = ON" is True, so that turns off the UV. The virtual output will remain on until the temperature drops below 25.5, then the virtual output turns off. So now the UV's Set ON command will turn the UV back on, but not until the temperature drops to 25.5.

Another side effect from this logic is that your Feed modes, Maintenance output, and return pump output that turn off the UV will not be able to override the High_Temp output to inadvertently turn the UV back on when any of them have turned off the UV. If the temperature still hasn't dropped below 25.5, the UV will remain off even after the Feed mode is complete.

To answer your second question about what happens when the temperature is higher than 25.5 but lower than 26.0. This will depend on the current state of the High_Temp output. Once the temperature exceeds 26.0 and turns on the High_Temp output, the UV will remain off as the temperature cools down to 25.5. But once the High_Temp output turns off because of that temperature reduction, it will remain off as the temperature build back up towards 26.0 so the UV will be on. I hope that makes sense.

Here's what I recommend you change in your coding:

[UV]
Fallback OFF
Set ON
If Time 11:00 to 12:00 Then OFF
If FeedA 000 Then OFF
If FeedB 000 Then OFF
If Output Maintenance = ON Then OFF
If Output ReturnPu_2_3 = OFF Then OFF
If Output High_Temp = ON Then OFF

[High_Temp]
If Tmp > 26.0 Then ON
If Tmp < 25.5 Then OFF

I'm not sure why you had the Min Time 010:00 Then OFF and don't really see a reason for it, so I removed that line.
 
OP
OP
VJV

VJV

Valuable Member
View Badges
Joined
Jan 28, 2015
Messages
1,476
Reaction score
751
Location
Portugal, Europe
Rating - 0%
0   0   0
It's a bit difficult to explain. The Apex evaluates the code from top to bottom, and the last line that's True will set the output on or off. When you have multiple conditions that are True, the last one in the list that's True will win. In your current code, the Set ON statement at the top is always True (it's not a decision to evaluate, it's a statement), so unless something below that line is True, the UV will always be on.

But let's walk through the scenario from your original question: You want it to turn off when the temperature is over 26C, and remain off until it drops below 25.5. The Set ON command turns on the UV, and when your temperature exceeds 26.0 it turns off. But the moment the temperature drops to 26.0 the Set ON command will turn it back on because that condition is no longer True, so the Set ON wins.

By moving the temperature evaluation to a separate output, you can maintain a range from 26.0 down to 25.5. In this scenario, the Set ON turns on the UV. When the temperature exceeds 26.0, the virtual output turn on, and then the "If Output High_Temp = ON" is True, so that turns off the UV. The virtual output will remain on until the temperature drops below 25.5, then the virtual output turns off. So now the UV's Set ON command will turn the UV back on, but not until the temperature drops to 25.5.

Another side effect from this logic is that your Feed modes, Maintenance output, and return pump output that turn off the UV will not be able to override the High_Temp output to inadvertently turn the UV back on when any of them have turned off the UV. If the temperature still hasn't dropped below 25.5, the UV will remain off even after the Feed mode is complete.

To answer your second question about what happens when the temperature is higher than 25.5 but lower than 26.0. This will depend on the current state of the High_Temp output. Once the temperature exceeds 26.0 and turns on the High_Temp output, the UV will remain off as the temperature cools down to 25.5. But once the High_Temp output turns off because of that temperature reduction, it will remain off as the temperature build back up towards 26.0 so the UV will be on. I hope that makes sense.

Here's what I recommend you change in your coding:

[UV]
Fallback OFF
Set ON
If Time 11:00 to 12:00 Then OFF
If FeedA 000 Then OFF
If FeedB 000 Then OFF
If Output Maintenance = ON Then OFF
If Output ReturnPu_2_3 = OFF Then OFF
If Output High_Temp = ON Then OFF

[High_Temp]
If Tmp > 26.0 Then ON
If Tmp < 25.5 Then OFF

I'm not sure why you had the Min Time 010:00 Then OFF and don't really see a reason for it, so I removed that line.
Again, thank you so much! The Min Time sentence I simply copied from what the Apex uses in an Putput that is set to “Light” and then it asks you if you want to turn that outlet off above a certain temperature. When Inwent into the “Advanced” I noticed it added that Min Time statement which I assumed was to delay the outlet to turn ON for 10min. It was a work around before asking the question here.
 

Just grow it: Have you ever added CO2 to your reef tank?

  • I currently use a CO2 with my reef tank.

    Votes: 2 3.4%
  • I don’t currently use CO2 with my reef tank, but I have in the past.

    Votes: 2 3.4%
  • I have never used CO2 with my reef tank, but I plan to in the future.

    Votes: 5 8.5%
  • I have never used CO2 with my reef tank and have no plans to in the future.

    Votes: 47 79.7%
  • Other.

    Votes: 3 5.1%
Back
Top