Apex users I have some programming questions

Apex users I have some programming questions

On a side note, just as a matter of clean code, you don't really need the SET OFF for the Sump_Drain pump. The OSC line below it will always set the outlet to on or off so SET off will always be overridden, since lower commands win.

Additionally you don't need the FALLBACK OFF command for the virtual outlet. The fallback command tells the EB8 what state the outlet should be in if the Apex brain gets disconnected for some reason. Since the virtual outlet only exists in the apex brain and there is no physical outlet associated with it, then the fallback command will do nothing.

Having those commands there won't hurt anything, but they are extra and not necessary.
 
Ok, here's how the program should look to allow the ATO pump to top off right before the AWC runs:

ATO_Pump:

Fallback OFF
Set OFF
If ATO_NL CLOSED Then ON
If Time 11:46 to 11:56 Then OFF
If Time 11:57 to 11:59 Then ON
If SumpHi CLOSED Then OFF
If Time 12:00 to 12:01 Then OFF
Defer 002:00 Then ON
Min Time 010:00 Then OFF


Ok, this is kind of a weird one with all those if times. But we are working around the min time and defer commands. As I said above, defer applies to the whole outlet and not just one command and min time is the same.

First, the Min Time command is there so that once the ATO runs it will need to be off for at least 10 minutes before it can be triggered again. This will keep it from starting and stopping frequently which could be bad for the pump. But, since we want it to turn on at a specific time we need to have it turned off for at least 10 minutes before that time to satisfy the Min Time command. That's what the first If Time command does.

The defer command is there to ensure that the ATO_NL float must be closed for two minutes before the ATO pump is triggered. This is to keep the pump from conning on for a second if there is a wave or something that triggers the float switch for just a second. Again, you want to make sure that it really needs water to keep the pump from running for just a short time frequently. But like I said above, the defer command applies to the whole outlet, so in this case it needs to be turned on for two minutes before it actually will turn on the pump. That's what the second if Time command does. It turns it on for 3 minutes. The pump will stay off for the first two minutes until the defer command is satisfied, then run for up to one minute after that. However, since I moved the IF Sump_Hi CLOSED Then OFF to after that command and lower commands take priority then it will run the ATO pump for one minute at 11:59 until the Sump_Hi float is triggered.

The last if Time command is the one we discussed above to keep the ATO off during the AWC.
 
For the most part everything looks good, but you'll need to make some changes to the above.

First, you should take out the last three lines.

There is no need to put the if output NSW_E_Delay in there for your ATO pump. That will cause your ATO to turn off whenever your NSW reservoir is empty. That shouldn't happen

Additionally, you should take out the if output Sump_Drain and of output Sump_fill lines. Those will turn off the ATO when the AWC change pumps are running, but only when they are running.

The way the AWC is set up now the drain pump will turn on for 10 seconds at noon, then 50 seconds later the fill pump will turn on until it's full. With the program you have above the ATO could turn on during that 50 second period when the sump is drained and both pumps are off.

Instead replace those three lines with:

If Time 12:00 to 12:02 then OFF

That will keep the ATO off for the entire time the AWC is doing its thing. (And by removing the last line, allow the ATO to run even when the NSW reservoir is empty)

I'll spend some more time later today trying to come up with an option to top off the tank with freshwater before the AWC runs.

Lol I had to read that three times to understand but I got it now. I wasn't counting on the 50 seconds of time when the sump will be low.
 
Ok, here's how the program should look to allow the ATO pump to top off right before the AWC runs:

ATO_Pump:

Fallback OFF
Set OFF
If ATO_NL CLOSED Then ON
If Time 11:46 to 11:56 Then OFF
If Time 11:57 to 11:59 Then ON
If SumpHi CLOSED Then OFF
If Time 12:00 to 12:01 Then OFF
Defer 002:00 Then ON
Min Time 010:00 Then OFF


Ok, this is kind of a weird one with all those if times. But we are working around the min time and defer commands. As I said above, defer applies to the whole outlet and not just one command and min time is the same.

First, the Min Time command is there so that once the ATO runs it will need to be off for at least 10 minutes before it can be triggered again. This will keep it from starting and stopping frequently which could be bad for the pump. But, since we want it to turn on at a specific time we need to have it turned off for at least 10 minutes before that time to satisfy the Min Time command. That's what the first If Time command does.

The defer command is there to ensure that the ATO_NL float must be closed for two minutes before the ATO pump is triggered. This is to keep the pump from conning on for a second if there is a wave or something that triggers the float switch for just a second. Again, you want to make sure that it really needs water to keep the pump from running for just a short time frequently. But like I said above, the defer command applies to the whole outlet, so in this case it needs to be turned on for two minutes before it actually will turn on the pump. That's what the second if Time command does. It turns it on for 3 minutes. The pump will stay off for the first two minutes until the defer command is satisfied, then run for up to one minute after that. However, since I moved the IF Sump_Hi CLOSED Then OFF to after that command and lower commands take priority then it will run the ATO pump for one minute at 11:59 until the Sump_Hi float is triggered.

The last if Time command is the one we discussed above to keep the ATO off during the AWC.

Ok I'm going to have to read this too a few times to fully understand.
 
When you're reading apex programming it really helps to start at the bottom and go up, since lower commands take priority, so reversing this one we have the following:

Min Time 010:00 Then OFF

This one just says that it needs to be off for 10 minutes before it will turn on again.

Defer 002:00 Then ON

This one says that it won't turn on until the triggers have been in the ON condition for two minutes.

If Time 12:00 to 12:01 Then OFF

This says that if the time is between 12:00:00 (12:00 and 0 seconds) and 12:01:59 (12:01 and 59 seconds) then it will be OFF. If it is between those times, then this is the lowest active command and you don't need to go any further. The outlet will be OFF no matter what anything above it says. If it is not between those times, then this line does nothing and you can read on.

If SumpHi CLOSED Then OFF

This causes the outlet to turn off if SumpHi is closed. If this is the case, then there's no need to read further as it takes priority over everything above it and the outlet will be off no matter what is above it. If sumphi is open, then this line does nothing and you can read on.

If Time 11:57 to 11:59 Then ON

This says that if the time is between 11:57:00 and 11:59:59 then it will be ON. If it is between those times, then this is the lowest active command and you don't need to go any further. The outlet will be ON no matter what anything above it says. If it is not between those times, then this line does nothing and you can read on.

If Time 11:46 to 11:56 Then OFF

This says that if the time is between 11:46:00 and 11:56:59 then it will be OFF. If it is between those times, then this is the lowest active command and you don't need to go any further. The outlet will be OFF no matter what anything above it says. If it is not between those times, then this line does nothing and you can read on.

If ATO_NL CLOSED Then ON

This causes the outlet to turn on it ATO_NL is closed. If this is the case, then there's no need to read further as it takes priority over everything above it and the outlet will be on no matter what is above it. If ato_nl is open, then this line does nothing and you can read on.

SET OFF

This causes the outlet to be off no matter what. Anything above it will be overridden. So if you get up here then none of the conditions below apply and the outlet will be off.

FALLBACK OFF

As I said above, this is a safety command in the case of the apex going offline. If the eb8 is still online it will follow the fallback command and in this case turn the outlet off until the apex comes back online and takes over.
 
When you're reading apex programming it really helps to start at the bottom and go up, since lower commands take priority, so reversing this one we have the following:

Min Time 010:00 Then OFF

This one just says that it needs to be off for 10 minutes before it will turn on again.

Defer 002:00 Then ON

This one says that it won't turn on until the triggers have been in the ON condition for two minutes.

If Time 12:00 to 12:01 Then OFF

This says that if the time is between 12:00:00 (12:00 and 0 seconds) and 12:01:59 (12:01 and 59 seconds) then it will be OFF. If it is between those times, then this is the lowest active command and you don't need to go any further. The outlet will be OFF no matter what anything above it says. If it is not between those times, then this line does nothing and you can read on.

If SumpHi CLOSED Then OFF

This causes the outlet to turn off if SumpHi is closed. If this is the case, then there's no need to read further as it takes priority over everything above it and the outlet will be off no matter what is above it. If sumphi is open, then this line does nothing and you can read on.

If Time 11:57 to 11:59 Then ON

This says that if the time is between 11:57:00 and 11:59:59 then it will be ON. If it is between those times, then this is the lowest active command and you don't need to go any further. The outlet will be ON no matter what anything above it says. If it is not between those times, then this line does nothing and you can read on.

If Time 11:46 to 11:56 Then OFF

This says that if the time is between 11:46:00 and 11:56:59 then it will be OFF. If it is between those times, then this is the lowest active command and you don't need to go any further. The outlet will be OFF no matter what anything above it says. If it is not between those times, then this line does nothing and you can read on.

If ATO_NL CLOSED Then ON

This causes the outlet to turn on it ATO_NL is closed. If this is the case, then there's no need to read further as it takes priority over everything above it and the outlet will be on no matter what is above it. If ato_nl is open, then this line does nothing and you can read on.

SET OFF

This causes the outlet to be off no matter what. Anything above it will be overridden. So if you get up here then none of the conditions below apply and the outlet will be off.

FALLBACK OFF

As I said above, this is a safety command in the case of the apex going offline. If the eb8 is still online it will follow the fallback command and in this case turn the outlet off until the apex comes back online and takes over.


Thank you that makes 100% total sense.
 
Wow even after having my apex for 4 years and having some pretty complex code, Even I learned something!

Thanks BrettDS!! :thumbsup:
 
Ok I had an issue with this today. The sump level was pretty high and I’m not sure the drain actually came on.

I’m going to copy our exactly as I have it now maybe I typed something incorrctly
____________________________
Inputs:

SumpHi
SumpLo
NSW_Lo (new salt water container almost empty)
ATO_NL (normal sump water level)
____________________
Outputs: (all default open)

NSW_E_Delay (virtual outlet)
Sump_Fill
Sump_Drain
ATO_Pump
__________________________
ATO_Pump output code:

Fallback OFF
Set OFF
If ATO_NL CLOSED Then ON
If Time 11:46 to 11:56 Then OFF
If Time 11:57 to 11:59 Then ON
If SumpHi CLOSED Then OFF
If Time 12:00 to 12:01 Then OFF
Defer 002:00 Then ON
Min Time 010:00 Then OFF
____________________________________
Sump_Drain output code:

Fallback OFF
Set OFF
OSC 000:00/000:10/000:50 Then ON
If Time 12:01 to 11:59 Then OFF
If NSW_Lo CLOSED Then OFF
If SumpLo CLOSED Then OFF
If Output ATO_Pump = ON Then OFF
______________________________________
Sump_Fill output code:

Fallback OFF
Set OFF
If Time 12:01 to 12:02 Then ON
If ATO_NL OPEN Then OFF
If SumpHi CLOSED Then OFF
If NSW_Lo CLOSED Then OFF
If Output ATO_Pump = ON Then OFF
If Output NSW_E_Delay = ON Then OFF
_______________________________________
NSW_E_Delay output code: (Virtual Outlet)

Fallback OFF
Set OFF
If NSW_Lo CLOSED Then ON
Defer 001:00 Then ON
___________________________________


That’s everything as it is now. See anything that could be the culprit?
 
Ok I've figured it out. It's not the code....I'm having a mechanical issue.

In the past when I did manual water changes I used to have to turn a ball valve and then turn the sump fill pump on. I had to do this because if I left the gate valve open, the contents of the container would siphon into the sump.

I drilled a hole in the top of the fitting on the inside of the container as a siphon break, inserted a fitting and ran some hose out of it. Apparently this isn't working, for reasons I'm not quite aware of.

Any ideas how I can fix this so I can keep the gate valve open?

Here's a pic of where the water level in the container siphoned down to. I had it full up to the cordt hole in the back of the container. It had siphoned down to the level you see on its own with the gate valve open.
 

Attachments

  • 30DEEBE6-1D6F-4C04-A9A9-1540FEBC8FCC.jpg
    30DEEBE6-1D6F-4C04-A9A9-1540FEBC8FCC.jpg
    43.8 KB · Views: 2
The easiest thing to do is to make sure the exit of the fill tube is higher than the water level in the reservoir. That way it can never start to siphon. Depending on the heights of the water in the sump and the reservoir this may be easier said than done.

If the reservoir is considerably higher than the sump one option would be to make the end of the fill tube higher than the sump, but have it run into a larger tube to take the water down into the sump. So if you're using 1/2 inch tube for your fill tube, make sure that the end of the 1/2 inch tube is higher than the water level of the reservoir and put the end of the 1/2 inch tube an inch or so down into a 1 inch tube that runs down to your sump. Make sure that there is an air gap around the 1/2 tube so it can't start to siphon.
 
The easiest thing to do is to make sure the exit of the fill tube is higher than the water level in the reservoir. That way it can never start to siphon. Depending on the heights of the water in the sump and the reservoir this may be easier said than done.

If the reservoir is considerably higher than the sump one option would be to make the end of the fill tube higher than the sump, but have it run into a larger tube to take the water down into the sump. So if you're using 1/2 inch tube for your fill tube, make sure that the end of the 1/2 inch tube is higher than the water level of the reservoir and put the end of the 1/2 inch tube an inch or so down into a 1 inch tube that runs down to your sump. Make sure that there is an air gap around the 1/2 tube so it can't start to siphon.

It's not that much higher. I would think that the maximum water level of the container is maybe two feet higher than the sump?

So I guess the best thing to do would be to cut the plumbing and put a tall bend in it?
 
It's more than just running the plumbing up... air needs to be able to get in at the high point. Obviously you also need to make sure that water can't get out where the air gets in, so that's why I suggested running a smaller tube into a larger tube, but if you can figure out another way to run the plumbing up and allow air to enter at the high point then that would work too.
 
It’s more than just running the plumbing up... air needs to be able to get in at the high point. Obviously you also need to make sure that water can’t get out where the air gets in, so that’s why I suggested running a smaller tube into a larger tube, but if you can figure out another way to run the plumbing up and allow air to enter at the high point then that would work too.

I wonder why the way I have it set up now isn’t working?

That is the current high point.
 
The exit for the air inlet tube is higher than the water line...



It will only be able to suck air in to a tube below the water line like that if the water is moving fast enough to create a Venturi. And it will only stop the siphon if it can suck enough air in through the tube. Just a small amount of air may not be enough to stop it.
 
It will only be able to suck air in to a tube below the water line like that if the water is moving fast enough to create a Venturi. And it will only stop the siphon if it can suck enough air in through the tube. Just a small amount of air may not be enough to stop it.

Ahhhhhh that makes sense.

So would it maybe fix it if I took the black elbow off that's in the pic, ran more PVC so that it was higher than the water line and then hooked the pump up to that?

Something like the crappy finger painting I attached?
 

Attachments

  • 40F022DA-E95F-42CA-8F98-135B8F1051D4.jpg
    40F022DA-E95F-42CA-8F98-135B8F1051D4.jpg
    24.7 KB · Views: 2
Apex users I have some programming questions

Ahhhhhh that makes sense.



So would it maybe fix it if I took the black elbow off that's in the pic, ran more PVC so that it was higher than the water line and then hooked the pump up to that?



Something like the crappy finger painting I attached?



Yes, that would work, but as I said above, there would need to be an opening so that air could get in at the highest part to stop the siphon and you would need to make sure that water wasn't able to get out the air hole. If there is a long plumbing run after that high point then the pressure needed to push water down the pipe would be enough to also push it out the air hole.

That's why I suggested putting the air gap toward the end of the run. The water can come out of the small tube and into a larger tube right above the sump and gravity will just take it the rest of the way down.
 
Yes, that would work, but as I said above, there would need to be an opening so that air could get in at the highest part to stop the siphon and you would need to make sure that water wasn’t able to get out the air hole. If there is a long plumbing run after that high point then the pressure needed to push water down the pipe would be enough to also push it out the air hole.

That’s why I suggested putting the air gap toward the end of the run. The water can come out of the small tube and into a larger tube right above the sump and gravity will just take it the rest of the way down.

Alright roger that, that’s what I’ll do.

Thanks for all the help btw

Oh and if I wanted to increase the amount of water drained out of the sump I would just make the osc 000:00/000:15/000:45 right?

Edit:

I’m also kind of concerned about the ATO pump code.

ATO_Pump output code:

Fallback OFF
Set OFF
If ATO_NL CLOSED Then ON
If Time 11:46 to 11:56 Then OFF
If Time 11:57 to 11:59 Then ON
If SumpHi CLOSED Then OFF
If Time 12:00 to 12:01 Then OFF
Defer 002:00 Then ON
Min Time 010:00 Then OFF
____________________________

Will the line in red ignore the ATO_NL float status and just pump freshwater into the sump for two minutes? If not why?
 
Last edited:
Oh and if I wanted to increase the amount of water drained out of the sump I would just make the osc 000:00/000:15/000:45 right?

That's correct. That would run the pump for 15 seconds instead of 10 seconds.

ATO_Pump output code:

Fallback OFF
Set OFF
If ATO_NL CLOSED Then ON
If Time 11:46 to 11:56 Then OFF
If Time 11:57 to 11:59 Then ON
If SumpHi CLOSED Then OFF
If Time 12:00 to 12:01 Then OFF
Defer 002:00 Then ON
Min Time 010:00 Then OFF
____________________________

Will the line in red ignore the ATO_NL float status and just pump freshwater into the sump for two minutes? If not why?


Yes, it will run the freshwater pump for one minute (because of the defer) or until the sumphi float switch is closed, but looking over this thread it seems like that's not correct... you want it to stop once ATO_NL is open. If that's the case you should modify the code as follows:

Fallback OFF
Set OFF
If ATO_NL CLOSED Then ON
If Time 11:46 to 11:56 Then OFF
If Time 11:57 to 11:59 Then ON
If ATO_NL OPEN Then OFF
If SumpHi CLOSED Then OFF
If Time 12:00 to 12:01 Then OFF
Defer 002:00 Then ON
Min Time 010:00 Then OFF
 
Back
Top