Control for pump with intermittent duty cycle

Gp!

Well-Known Member
View Badges
Joined
May 19, 2017
Messages
631
Reaction score
434
Rating - 0%
0   0   0
I have a pump with a 50% duty cycle. I am using it to move water from a storage tank to my mix tank. I have a toggle switch hooked up to a break out box that I want to use to turn it on.

I have created virtual outlet "MIX_FW_ON" to be ON when the toggle switch is flipped up and OFF when flipped down.

I have created virtual outlet "MIX_FULL" to be ON when the water level is as high as it can be without overflowing.

I have created virtual outlet "FW_EMPTY" to be on when the storage tank is empty.

I want outlet "MIX_FW_PUMP" to be on when outlet "MIX_FW_ON" is ON and "MIX_FULL" is OFF. However, I want the pump to cycle between ON and OFF every 5 minutes. Otherwise, I want the pump to be off.

Does this look right?

Code:
Fallback OFF
Set OFF
If Output MIX_FW_ON = ON Then ON
OSC 000:00/005:00/005:00 Then OFF
If Output FW_EMPTY = On Then OFF
If Output MIX_FULL = On Then OFF
 

Tastee

Valuable Member
View Badges
Joined
Oct 19, 2018
Messages
1,124
Reaction score
891
Location
Sydney, Australia
Rating - 0%
0   0   0
I don’t think your code will work the way you want. Don’t forget the Apex is a state machine and at the end of parsing the code the state will be either ON or OFF. The OSC command doesn’t care what the prior state was, it just sets a state of ON and OFF based on a defined cycle. So anything you put before it is overridden (e.g. your If Output MIX_FW_ON = ON Then ON).

The commands after the OSC can however change the state further. So the way to do this is to set a default state using the OSC command and then other commands to take other factors into account and change this default state.

I think below will do what you want.

Fallback OFF
Set OFF
OSC 000:00/005:00/005:00 Then ON
If Output MIX_FW_ON = OFF Then OFF
If Output FW_EMPTY = ON Then OFF
If Output MIX_FULL = ON Then OFF
 
OP
OP
G

Gp!

Well-Known Member
View Badges
Joined
May 19, 2017
Messages
631
Reaction score
434
Rating - 0%
0   0   0
The OSC command doesn’t care what the prior state was, it just sets a state of ON and OFF based on a defined cycle. So anything you put before it is overridden (e.g. your If Output MIX_FW_ON = ON Then ON).

Are you saying that the line OSC 000:00/005:00/005:00 Then OFF sets the state to "ON" even though the assignment is "OFF"?
 
OP
OP
G

Gp!

Well-Known Member
View Badges
Joined
May 19, 2017
Messages
631
Reaction score
434
Rating - 0%
0   0   0
I think below will do what you want.

Thanks btw! Haven't done much with advanced programming before. You got me going and I added a momentary button for forcing the pump to fill when I want a touch more
 

More than just hot air: Is there a Pufferfish in your aquarium?

  • There is currently a pufferfish in my aquarium.

    Votes: 30 17.8%
  • There is not currently a pufferfish in my aquarium, but I have kept one in the past.

    Votes: 27 16.0%
  • There has never been a pufferfish in my aquarium, but I plan to keep one in the future.

    Votes: 32 18.9%
  • I have no plans to keep a pufferfish in my aquarium.

    Votes: 72 42.6%
  • Other.

    Votes: 8 4.7%

New Posts

Back
Top