Results 1 to 22 of 22

Thread: Water Barrel and ATO refill pail solenoid, with switch...

  1. #1
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585

    Water Barrel and ATO refill pail solenoid, with switch...

    Im a pretty good programmer for apex code, but this one is stumping me.
    I have a water barrel for new salt water and a pail for housing fresh water for and ATO, and a momentary switch. I have the barrel and pail connected directly to RO/DI with a 'tee'. When the barrel is empty, it automatically fills and when the barrel is full is stops. It does not fill again until empty. So if i use some for a water change, it will still not refill if its half full, unless I decide to flip a momentary switch to refill the barrel if it is under the full amount. The pail fills with RO/DI when required.
    What I want to do is if the barrel is filling, and the pail needs to fill, I want the barrel to pause its filling, essentially closing its solenoid until the pail is fill and its solenoid is turned back off, with having the barrel resume its filling if its in filling mode.

    Any ideas?

    Here is my code with my new programming to facilitate this action, yet it won't work like i want it to because the StMxRFswt will keep ON as soon as the top of the barrels optical in open again, so if a water change is done, it will want to fill right away.

    StMxRefill (barrel solenoid)
    Fallback OFF
    If SltMxE OPEN Then ON
    If Output StMxRFswt = ON Then ON
    If Output StMxRFswt = OFF Then OFF
    If Output FWsolenoid = ON Then OFF
    If Refill CLOSED Then ON
    If SltMxF CLOSED Then OFF
    Min Time 000:02 Then ON

    StMxRFswt (VO)
    Set On
    If SltMxF OPEN Then ON
    If SltMxF CLOSED Then OFF
    If Output StMxRefill = OFF Then OFF
    If SltMxE OPEN Then ON

    FWsolenoid (pail solenoid)
    Fallback OFF
    If FWmin OPEN Then ON
    If FWmax CLOSED Then OFF
    When On > 120:00 Then OFF
    Defer 000:10 Then OFF
    If FWleak CLOSED Then OFF


    SltMxE (bottom barrel optical)
    SltMxF (top barrel optical)
    Refill (momentary switch)

    Let me know if you require any more info. thanks in advance.
    Last edited by Geokiris; 12-20-2017 at 19:24. Reason: Forgot a line of code

  2. #2
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Rough timings on fill times for each?

    You might be an engineer if...You have no life and can prove it mathematically.

  3. #3
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Pail can be filled anywhere from 2 min to 2 hours. Barrel can be filled anywhere from 18-24 hours.

  4. #4
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Then I would say probably use a sequenced VO like this.

    StopBar
    Set OFF
    If Outlet StMxRefill = ON Then ON
    If Outlet FWsolenoid = OFF Then OFF
    Defer 120:00 Then OFF

    RestartBar
    Set OFF
    If Outlet StopBar = ON Then ON
    Defer 119:00 Then ON
    Defer 002:00 Then OFF


    Use these two lines in the barrel code and delete all lines related to what you tried before.

    If Outlet StopBar = ON Then OFF
    If Outlet RestartBar = ON Then ON


    This will stop the barrel filling for 2 hours anytime both the pail and barrel are on at the same time. The restart will turn the barrel back on for 1 minute following the stop to kick refill back on until full.


    You might be an engineer if...You have no life and can prove it mathematically.

  5. #5
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Zombie, thanks for the code. Id rather not use time if possible, as there are too many variables that can effect the fill rates.

    I tried this instead, and it seems to work. One extra VO

    Sltbldelay (Salt Mix Barrel Delay)
    If Output FWsolenoid = OFF Then OFF
    If Output FWsolenoid = ON Then ON
    Defer 000:07 Then OFF
    Defer 000:05 Then ON

    And added some code to existing outlets:

    StMxRefill (Barrel solenoid)
    Fallback OFF
    If SltMxE OPEN Then ON
    If Output StMxRFswt = ON Then ON
    If Output StMxRFswt = OFF Then OFF
    If Output Sltbldelay = ON Then OFF
    If Refill CLOSED Then ON
    If SltMxF CLOSED Then OFF
    Min Time 000:02 Then ON

    StMxRFswt (VO)
    Set ON
    If SltMxF CLOSED Then OFF
    If Output StMxRefill = OFF Then OFF
    If Output Sltbldelay = ON Then ON
    If SltMxE OPEN Then ON
    Defer 000:10 Then OFF

    So if Barrel is filling due to a low optical switch, it will do so until it reaches the top optical, yet if the pail needs to fill, it turns off the barrel. And then when the pail is full, the barrel resumes filling! Hurray!! And if the barrel fills to the top and some is used for a WC, it won't refill, unless I want it to with the momentary switch.

    Thanks again for your insight! And I hope this code can help others.


  6. #6
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Alright, after reviewing all scenarios throughout the day, this previous program wasn't working 100%. When the sw barrel's top optical was not activated (filled) it would want to turn on again. So here is a modified program that does work so far:

    StMxRefill (barrel solenoid)
    Fallback OFF
    If SltMxE OPEN Then ON
    If Output StMxRFswt = OFF Then OFF
    If Output Sltbldelay = OFF Then OFF
    If Output StMxRFswt = ON Then ON
    If Refill CLOSED Then ON
    If Output Sltbldelay = ON Then OFF
    If SltMxF CLOSED Then OFF
    Min Time 000:02 Then ON

    StMxRFswt (vo)
    Set ON
    If SltMxF CLOSED Then OFF
    If Output StMxRefill = ON Then ON
    If Output StMxRefill = OFF Then OFF
    If Output Sltbldelay = ON Then ON
    If SltMxE OPEN Then ON
    Defer 000:10 Then OFF
    Defer 000:08 Then ON


    FWsolenoid (pail solenoid)
    Fallback OFF
    If FWmin OPEN Then ON
    If FWmax CLOSED Then OFF
    When On > 120:00 Then OFF
    Defer 000:10 Then OFF
    If FWleak CLOSED Then OFF

    Sltbldelay (vo)
    If Output FWsolenoid = OFF Then OFF
    If Output FWsolenoid = ON Then ON
    Defer 000:07 Then OFF
    Defer 000:05 Then ON




    So Barrel will fill if empty, yet it will pause if pail requires topping off. Once pail is full barrel resumes. Once Barrel is full, it will no longer add anymore water. If a partial amount of water is used from the barrel, it will not refill, unless you hit the REFILL switch, which will top off the barrel. Again, if the pail requires filling, the barrel will pause.

    Regards and happy programming.

  7. #7
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Did you typo when showing this? The two lines used in the same outlet


    If Output Sltbldelay = OFF Then OFF

    If Output Sltbldelay = ON Then OFF


    Would turn the barrel off 100% of the time no matter what.

    You might be an engineer if...You have no life and can prove it mathematically.

  8. #8
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Quote Originally Posted by Geokiris View Post
    Zombie, thanks for the code. Id rather not use time if possible, as there are too many variables that can effect the fill rates.
    My code is actually independent of fill rate. The timing is just there to say "I will wait to restart the barrel until this amount of time elapses" if the pail hasn't finished filling by then, the two will be on simultaneously for the reset time (which you could make as low as 1 or 2 seconds) and reinitiate the sequence: pausing the barrel for the first defer length and then restarting again for the second.

    You might be an engineer if...You have no life and can prove it mathematically.

  9. #9
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    I personally would do this.

    StMxRefill (barrel solenoid)

    Fallback OFF

    If SltMxE OPEN Then ON

    If Refill CLOSED Then ON

    If SltMxF CLOSED Then OFF

    If Outlet RestartBar = ON Then ON

    If Outlet StopBar = ON Then OFF

    Min Time 000:02 Then ON

    StopBar (VO)

    Set OFF

    If Outlet StMxRefill = ON Then ON

    If Outlet FWsolenoid = OFF Then OFF

    Defer 030:00 Then OFF

    RestartBar (VO)

    Set OFF

    If Outlet StopBar = ON Then ON

    Defer 029:59 Then ON

    Defer 000:01 Then OFF

    You might be an engineer if...You have no life and can prove it mathematically.

  10. #10
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Quote Originally Posted by zombie View Post
    I personally would do this.

    StMxRefill (barrel solenoid)

    Fallback OFF

    If SltMxE OPEN Then ON

    If Refill CLOSED Then ON

    If SltMxF CLOSED Then OFF

    If Outlet RestartBar = ON Then ON

    If Outlet StopBar = ON Then OFF

    Min Time 000:02 Then ON

    StopBar (VO)

    Set OFF

    If Outlet StMxRefill = ON Then ON

    If Outlet FWsolenoid = OFF Then OFF

    Defer 030:00 Then OFF

    RestartBar (VO)

    Set OFF

    If Outlet StopBar = ON Then ON

    Defer 029:59 Then ON

    Defer 000:01 Then OFF

    You might be an engineer if...You have no life and can prove it mathematically.
    How does the FWsolenoid when on, activate the barrel solenoid off? Should there be a line be If Outlet FWsolenoid = On then On?
    And what does this mean when I would turn the momentary refill input switch on?

  11. #11
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Quote Originally Posted by zombie View Post
    Did you typo when showing this? The two lines used in the same outlet


    If Output Sltbldelay = OFF Then OFF

    If Output Sltbldelay = ON Then OFF


    Would turn the barrel off 100% of the time no matter what.

    You might be an engineer if...You have no life and can prove it mathematically.
    It works somehow...lol. I turned on the momentary input switch, and it started filling. When the Pail was filling, it was off. When the pail was done, it resumed. When the optical sensor was below water line, it stop filling the barrel. When the water was below the barrel after it was submerged, it didn't refill. And if the pail was filling even after the barrel was below the top level, it wouldn't restart the barrel.

  12. #12
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Quote Originally Posted by Geokiris View Post
    How does the FWsolenoid when on, activate the barrel solenoid off? Should there be a line be If Outlet FWsolenoid = On then On?
    And what does this mean when I would turn the momentary refill input switch on?
    In the StopBar virtual output it uses the workaround for AND logic described in my sticky about AND logic. When both are on at the same time and only then, the StopBar turns on for 30 minutes, which pauses the barrel fill while on. As soon as that 30 minutes has expired, RestartBar asserts for 2 seconds to turn the barrel back ON. If the pail hasn't filled yet, the process repeats until it's full. If the pail is full, the AND logic will no longer be true and reverts to original logic.

    The momentary switch overrides the low switch like normal and starts the cycle on demand unless StopBar is active. But since StopBar only turns on when the two are on simultaneously, it shouldn't effect the end result anyway.

    You might be an engineer if...You have no life and can prove it mathematically.

  13. #13
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Quote Originally Posted by zombie View Post
    In the StopBar virtual output it uses the workaround for AND logic described in my sticky about AND logic. When both are on at the same time and only then, the StopBar turns on for 30 minutes, which pauses the barrel fill while on. As soon as that 30 minutes has expired, RestartBar asserts for 2 seconds to turn the barrel back ON. If the pail hasn't filled yet, the process repeats until it's full. If the pail is full, the AND logic will no longer be true and reverts to original logic.

    The momentary switch overrides the low switch like normal and starts the cycle on demand unless StopBar is active. But since StopBar only turns on when the two are on simultaneously, it shouldn't effect the end result anyway.

    You might be an engineer if...You have no life and can prove it mathematically.
    Ok, Im gonna try it. Will let you know. Thanks very much!

  14. #14
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Works perfect!! This is like a gift to me
    Thank you so much, I might have to send you the rest of my code, I'm sure there is a lot of cleaning up to be done
    Merry Christmas!

    Quote Originally Posted by zombie View Post
    I personally would do this.

    StMxRefill (barrel solenoid)

    Fallback OFF

    If SltMxE OPEN Then ON

    If Refill CLOSED Then ON

    If SltMxF CLOSED Then OFF

    If Outlet RestartBar = ON Then ON

    If Outlet StopBar = ON Then OFF

    Min Time 000:02 Then ON

    StopBar (VO)

    Set OFF

    If Outlet StMxRefill = ON Then ON

    If Outlet FWsolenoid = OFF Then OFF

    Defer 030:00 Then OFF

    RestartBar (VO)

    Set OFF

    If Outlet StopBar = ON Then ON

    Defer 029:59 Then ON

    Defer 000:01 Then OFF

    You might be an engineer if...You have no life and can prove it mathematically.

  15. #15
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Quote Originally Posted by Geokiris View Post
    Works perfect!! This is like a gift to me
    Thank you so much, I might have to send you the rest of my code, I'm sure there is a lot of cleaning up to be done
    Merry Christmas!
    Hi Zombie,

    Code is failing at times for some reason? At times, it doesn’t restart barrel?

    Regards





    Sent from my iPhone using Tapatalk

  16. #16
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Try adding a second or two to the last defer on the restart. It's possible the system got overloaded at that time and wasn't able to send the on status to the barrel solenoid code before it turned back off.

    You might be an engineer if...You have no life and can prove it mathematically.

  17. #17
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Ok, I will try that. Thanks

    Quote Originally Posted by zombie View Post
    Try adding a second or two to the last defer on the restart. It's possible the system got overloaded at that time and wasn't able to send the on status to the barrel solenoid code before it turned back off.

    You might be an engineer if...You have no life and can prove it mathematically.

  18. #18
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Quote Originally Posted by Geokiris View Post
    Ok, I will try that. Thanks
    It’s been working perfect for the past day or so.

    TY Zombie


    Sent from my iPhone using Tapatalk

  19. #19
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    So i made a small change. Ive connected my RO directly to sump ATK with solenoid. However with the same coding, it is not working to restart the barrel after ATOsolenoid. It takes anywhere from 5mins or 25mins for ATOsolenoid to stop.

    StMxRefill
    Fallback OFF
    If SltMxE OPEN Then ON
    If Refill CLOSED Then ON
    If SltMxF CLOSED Then OFF
    If Output RestartBar = On Then On
    If Output StopBar = ON then Off
    Min Time 000:02 Then ON

    RestartBar
    Set OFF
    If Output StopBar = ON Then ON
    Defer 0029:59 Then ON
    Defer 000:02 Then OFF

    StopBar
    Set OFF
    If Output StMxRefill = ON Then ON
    If Output ATOsolenoid = OFF Then OFF
    Defer 0030:00 Then OFF


    Heres my ATO solenoid code

    Fallback OFF
    Set OFF
    If ATOMin OPEN Then ON
    If ATOmax CLOSED Then OFF
    When On > 025:00 Then OFF
    Defer 000:05 Then ON
    Defer 001:00 Then OFF
    Min Time 000:10 Then OFF

    Thanks in advance

  20. #20
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Hi,

    Zombie, could you help me again with this...im doing something wrong that its not working to keep my barrel restarting after the ATOsolenoid is off.

    Quote Originally Posted by Geokiris View Post
    So i made a small change. Ive connected my RO directly to sump ATK with solenoid. However with the same coding, it is not working to restart the barrel after ATOsolenoid. It takes anywhere from 5mins or 25mins for ATOsolenoid to stop.

    StMxRefill
    Fallback OFF
    If SltMxE OPEN Then ON
    If Refill CLOSED Then ON
    If SltMxF CLOSED Then OFF
    If Output RestartBar = On Then On
    If Output StopBar = ON then Off
    Min Time 000:02 Then ON

    RestartBar
    Set OFF
    If Output StopBar = ON Then ON
    Defer 0029:59 Then ON
    Defer 000:02 Then OFF

    StopBar
    Set OFF
    If Output StMxRefill = ON Then ON
    If Output ATOsolenoid = OFF Then OFF
    Defer 0030:00 Then OFF


    Heres my ATO solenoid code

    Fallback OFF
    Set OFF
    If ATOMin OPEN Then ON
    If ATOmax CLOSED Then OFF
    When On > 025:00 Then OFF
    Defer 000:05 Then ON
    Defer 001:00 Then OFF
    Min Time 000:10 Then OFF

    Thanks in advance

  21. #21
    Frequent Contributor zombie's Avatar
    Join Date
    Dec 2013
    Location
    Denver, CO
    Posts
    9,742
    Not sure. Try adding another second or two to the defer then OFF on the restart. Only thing I can think of is maybe your processing cycle is longer now.

    You might be an engineer if...You have no life and can prove it mathematically.

  22. #22
    Frequent Visitor
    Join Date
    May 2013
    Location
    Winnipeg, MB, Canada
    Posts
    585
    Ok thanks. Ill try that.
    thx man

    Quote Originally Posted by zombie View Post
    Not sure. Try adding another second or two to the defer then OFF on the restart. Only thing I can think of is maybe your processing cycle is longer now.

    You might be an engineer if...You have no life and can prove it mathematically.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •