Results 1 to 4 of 4

Thread: UPC Code to Control a Pump Pumping from a Small Tank to a Large Tank

  1. #1

    Join Date
    Jan 2017
    Posts
    1

    UPC Code to Control a Pump Pumping from a Small Tank to a Large Tank

    I have a problem where I need to write the UPC code for a pump that fills a large tank from a very small tank. The large tank
    suppies water to the reticulation system of a small tourist town.
    When the small tank is empty, it calls water from a water treatment plant that produces water at a rate of 5 l/s. Once the small
    tank is full the water treatment plant pauses. The pump from the small tank to the large tank pumps at a rate of 8 l/s.
    Consequently, the small tank goes through a number of fill-empty cycles before the large tank can be filled.
    The graph of the filling and emptying of the large tank should have a rising limb that resembles a staircase, with horizontal
    step-treads and sloping risers, as the filling of the large tank pauses every time the small tank is emptied. Once the large
    tank is filled to its pump-off level it should then drain down to its pump-on level without the pump coming on.
    The graph of the filling and empting of the small tank should resemble a horizontal saw-tooth.
    I suspect the UPC code for this scenario will involve nested do-loops with the loop for the operation of the small tank being
    contained within the loop for the operation of the large tank.
    This scenario must be fairly common.

  2. #2
    Forum Moderator

    Innovyze Employee



    Join Date
    May 2015
    Posts
    339
    Peter,

    I'll leave this post open in case someone has any suggested code for you, but this forum is mostly for hydraulic modeling type questions and your audience with experience for Universal Pump Control programming may be limited.

    This type of condition can also be a little challenging to complete within a hydraulic model as well as it can be difficult to write controls such that the larger pump will stay off the entire time while the smaller tank fills. While making a quick example model of this it can also take a long time for the large tank to fill if the system demand that drains the large tank approaches the fill rate of the small pump or if the small tank is so small that the cycling limits the fill time the pump filling the large tank has to fill.

    But perhaps there may be a few users that can provide suggestions for the code you need, but you may also want to post this on other boards that have more PLC type programming users who might be able to provide better suggestions for you.

    Patrick Moore

  3. #3
    I was looking through the forum for any examples of UPCs scripts for InfoWorks WS and came across this old post without a solution and thought it was an interesting problem.

    To switch between the WTW filling the small tank and pumping into the larger tank we can user a timer to start when the tank is empty and restart when it is full. This way when the timer is zero we know the tank is full and the pump can be turned on which will again trip the timer when it empties the tank which will turn off the pump and tell the valve at the WTW to open up to fill up the tank. This loops over and over.

    There is a secondary timer that keep track of the big tank and see if its is in its filling or draining cycle, we can then link the pump on condition with this secondary timer to only turn on when the tank depth has dropped to a set level.

    These scripts don't take into account the initial values of your model, so you may have to add some extra code in to either initialize the valve or pump to do what you want at time step 00:00. Also you may need to look directly at the sim time depending on what your initalizing as per this blog post:
    http://blog.innovyze.com/2015/02/16/...s-upc-scripts/


    SmallTankToBigTank.jpg

    GLOBAL UPC SCRIPT
    CON LargeTankFull = RES LargeTank DEPTH >= 2.8
    CON LargeTankEmpty = RES LargeTank DEPTH <= 2


    TIMER StartFillOfLargeTank START LargeTankEmpty RESET LargeTankFull


    CON SmallTankFull = RES SmallTank DEPTH >= 2
    CON SmallTankEmpty = RES SmallTank DEPTH <= 0.1


    TIMER SwitchBetweenFillAndDrain START SmallTankEmpty RESET SmallTankFull


    CON TurnOnPump = SwitchBetweenFillAndDrain = 0 AND StartFillOfLargeTank > 0


    Valve D/S of WTW UPC

    RULE FillSmallTank


    IF SmallTankFull THEN
    VALVE WTW.1.1 OPENING = 0
    ELSEIF SmallTankEmpty THEN
    LINK 1.2.1 FLOW = 5 USING UPSTREAM VALVE WTW.1.1
    ENDIF


    Pump D/S of Small Tank UPC
    RULE StartPump


    IF TurnOnPump THEN


    LINK TWP-DS.3.1 FLOW = 8 USING UPSTREAM PST TWP-US.TWP-DS.1 AND
    PST TWP-US.TWP-DS.1 PUMP = ON


    ELSE


    PST TWP-US.TWP-DS.1 PUMP = OFF
    ENDIF

  4. #4
    Forum Moderator

    Innovyze Employee



    Join Date
    May 2015
    Posts
    339
    Luke,

    Thank you for posting your suggestions for this user on how someone might script this in UPC type script.

    Excellent response and nice of you to include screenshots in your response.

    Patrick Moore

Posting Permissions

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