# Optimization of water network, pump scheduling

25 views (last 30 days)
Hi,
Im currently trying to minimise the pumping costs of a water distribution network by linking matlab with simulation software called epanet via epanet toolbox.
Through the toolkit I can obtain my Q and H values required for my objective function and also can allocate a pump schedule back to epanet to see what effect this has on my objective function.
I am trying to use NLP search method.
Questions
1)if I am minimizing a function over 24 t periods can i use vectors in the objective function.
E.g if i want to minimize the function x(i)*COST(i)*(-HL_P(i))*(Q_P(i)) where x,COST,HL_P and Q_P are all 24x1 matrices.
and where x(number of pumps operating) is explicitly constrained 0<=x<=4 . (I also have a number of implicit constraints to do with maintaining pressure and reducing pump switching)
2)is there a method which ensures x can remain an integer.
3)how can I minimize iteratively so each time period i=1:24 I call my values required for the objective function and send a new pump schedule.
Thanks!

Demetrios Eliades on 18 Jul 2012
Edited: Demetrios Eliades on 18 Jul 2012
You can use the EPANET Matlab Toolkit http://www.mathworks.com/matlabcentral/fileexchange/25100-epanet-matlab-toolkit to analyze your network.
You can make a Matlab objective function which makes an internal call to the EPANET network simulation to evaluate different pump settings etc.
I would also recommend using "optimtool", where you can choose a suitable optimization algorithm and set the constraints as you desire.
In case the optimization produces non-integer solutions, a trick would be to make a small modification inside the objective function and use "round" or "floor" on the variables you change.
Demetris
Thankyou for your reply, yes I am currently using the matlab toolkit thanks! I am having trouble setting the pump schedule. I am using setdata('SET_PATTERN',pump1,38); where pump1 is a 24,1 matrix of 1's and 0's (38 is the pump node value), however it is not effecting the pattern in the .inp file, although no error is shown. Would it be preferable to use a different function than set_pattern or have i made a mistake in the function?

Paul Metcalf on 16 Jul 2012
Hi Adam, That sounds like an interesting problem. You certainly have quite a few requirements.
I know nothing about EPANET or the EPANET toolbox. But my gut feeling is that you will really struggle to satisfy all those requirements with your current setup.
For example, your constraints such as pump starting limits should really be coded into the problem directly. Also, given your problem will be multivariate and non-linear, I don't understand why you demand to solve it 'iteratively'.
How much is the solution to your problem potentially worth? How long would it take you to re-model the system in SimHydraulics?
Considering MATHWORKS already offers all of the functionality required to solve your problem, managing external interfaces will likely be slow and clunky. I'd consider asking MATHWORKS for a demonstration of the following software which I know could solve your problem:
• Sim Hydraulics (for network modelling)
• Global Optimisation Toolbox (for pattern searching methods)
• Stateflow (for modelling discrete control requirements)
• Parallel Toolbox (for faster optimisation)
• Plus all the prerequisites for these toolboxes
All that software 'aint going to be cheap, but MATHWORKS should let you demo on the condition that project success results in license agreement. Let me know how you go, I'd be happy to help you out.
Paul
Thankyou for your reply and your offer, I have been using EPANET and EPANET toolkit for the sim hydraulics and will stick with that. It is an easy way to obtain the necessary values and send them back to the .dll. Just having some trouble with the optimisation and coding..

### Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by