• No se han encontrado resultados

Análise e optimização de sistemas de abastecimento de água

N/A
N/A
Protected

Academic year: 2021

Share "Análise e optimização de sistemas de abastecimento de água"

Copied!
86
0
0

Texto completo

(1)

2013

Bruno Daniel

Cordeiro Pereira

Análise e optimização de sistemas de

(2)
(3)

2013

Bruno Daniel

Cordeiro Pereira

Análise e optimização de sistemas de

abasteimento de água

DissertaçãoapresentadaàUniversidadedeAveiroparaumprimentodos

req-uisitosneessáriosàobtençãodograudeMestradoemEngenhariaMeânia,

realizada sob orientação ientía de António GilD'Orey de Andrade

(4)
(5)

Uni-Presidente/ President DoutoraMónia Sandra Abrantes de OliveiraCorreia

Professora AuxiliardaUniversidadede Aveiro

Vogais / Committee Doutora Ana Maria Pinto de Moura

Professora AuxiliardaUniversidadede Aveiro

Doutor António Gil D'Oreyde Andrade Campos

(6)
(7)

Aknowledgements Doutor António Gil D'Orey de Andrade Campos e ao meu o-orientador,

Professor Doutor José Paulo de Oliveira Santos, pela orientação, apoio e

motivação prestados durante arealizaçãodesta dissertação.

Gostariadeagradeerde modo espeialàminha família,partiularmenteao

meu pai, Rogério, sem o qual esta aminhada não seriapossível,e aomeu

irmão,Marelo,peloapoioe ompanheirismo.

Um agradeimento aos amigos que ontinuam aareditar em mim e a dar

forçae apoio.

(8)
(9)

Abasteimentode água;

Resumo Osresentesonsumosdeáguagerampreoupaçõesrelaionadasomasua

distribuição. Aneessidade de fazer hegara água a entrospopulaionais

impliaelevadosustosenergétiosenaneiros,poisnãoexisteontrolo

so-breobombeamentodeáguaparatorresdeabasteimentooureservatórios,a

partirdas quaissedisponibilizaáguaaumapopulação,serviçosouindústria.

Aadaptação do bombeamento de águaàs tarifasenergétiaspode permitir

poupanças avultadas a quem exeuta esse bombeamento. Este trabalho é

parte integrante de um projeto de desenvolvimentode um software apaz

de, através de modelação hidráulia e ferramentasmatemátias, minimizar

os ustos de bombeamento e ontrolar as bombas do sistema de

abaste-imento de água. Nesta dissertação foram implementados e testados dois

algoritmos de optimização para omparar a apaidade de minimização de

ustosrelaionadosomobombeamentodaágua. Osmétodosde

optimiza-ção seleionadosforamoalgoritmoL-BFGS-B (Limitedmemory algorithm

for bound onstrained optimisation), um método de optimização lássio,

e o algoritmo

ε

DE (epsilon onstrained DierentialEvolution), um método metaheurístio. Os algoritmosseleionados foram testados emfunções de

teste, tendo o algoritmo

ε

DE obtido bons resultados em todas as funções testadas, enquanto queo algoritmoL-BFGS-B inorreuem diuldades em

funçõesmais omplexas. Os doisalgoritmos foram testados em duasredes

benhmark distintas. Uma rede,denominada Rede Básia, denida apenas

pelos elementos esseniais e uma rede malhada denominada rede Walski

489, mais omplexa, que inlui duas bombas. Em ambas as redes

benh-mark testadas foram obtidas reduções de ustos por ambos os algoritmos

implementados. O algoritmo L-BFGS-B provou ser o mais rápido dos

al-goritmos implementados,enquanto queo algoritmo

ε

DE obteve resultados superiorespara aredemaisomplexa(redeWalski). Estealgoritmo,devido

aofatodetestaraviolaçãodasrestriçõesemprimeirolugarestetemmaior

(10)
(11)

Abstrat Inreasing water onsumptiongenerates growing onern mainly related to

its distribution. The need to get the water to population entres implies

high energy onsumptions and osts, beause there is no ontrol over the

pumping of water to supply water towers and reservoirs, fromwhih water

is distributed to the population and other servies or industry. Suiting the

pumping of water havinginto aountenergetitariswouldallowforhigh

nanial savings to those who pump water. The present work is part of a

urrent eort to develop a software to ahieve the alter, through

modula-tionofaWaterSupplySystemandmathematialtools,minimizingpumping

osts via ontrol of the pumps of the so alled Water Supply System. In

this dissertationwere implemented and tested two optimisation algorithms

toomparetheability tominimizethe ostsassoiatedwithpumpingwater.

The seleted optimisation methods were the L-BFGS-B (Limited memory

algorithmforboundonstrainedoptimisation),alassialoptimisation

algo-rithm, and the

ε

DE (epsilon onstrained DierentialEvolution), aheuristi method. Both algorithms were tested in benhmarked funtions, with the

ε

DE ableto provide good resultsin allfuntions,while the L-BFGS-B algo-rithm inferredproblems with the moreomplex funtions. Both algorithms

were tested in pre-existent benhmarked water networks. One of the

net-works,denominatedBasiNetwork,simpleinnatureandwithonlyonepump.

Theother network, denominated Walski Network, moreomplex, and with

2 water pumps. Costredutions were attained with both methodsin both

benhmarked water networks. TheL-BFGS-B algorithmwas the fastest of

the ompared algorithms, while the

ε

DE algorithm obtained better results than the L-BFGS-Bin theWalskiNetwork. The

ε

DE algorithmis themore assuringto respet the onstrainsimposed tothe networks, as ittestesthe

(12)
(13)

List of Tables iii

List of Figures vi

Symbols and Aronyms vii

I Guidelines 1

1 Introdution 3

1.1 Context . . . 3

1.2 Objetives . . . 4

1.3 Outline ofthethesis . . . 4

2 State-of-the-Art Review 5 2.1 Introdution . . . 5

2.2 Water distributionsystems . . . 6

2.2.1 Frition losses . . . 7

2.3 Hydrauli simulation . . . 8

2.4 Mathematial optimisation. . . 9

2.4.1 Classialalgorithms . . . 10

2.4.2 Modernalgorithms . . . 11

2.5 HumanMahine Interfae . . . 12

2.5.1 Historial review . . . 12

2.5.2 Graphial User Interfae Development . . . 12

2.5.3 Charateristis . . . 13

II Methods and Development 15 3 Proposedsolution 17 3.1 Optimisation problemformulation . . . 18

3.2 EPANEThydrauli simulator . . . 20

3.2.1 Gradient Methodfor thesolution ofhydrauli systems . . . 20

3.3 Seletedoptimisation algorithms . . . 22

(14)

3.3.2

ε

Constrained Dierential Evolution . . . 24

3.4 Optimisation variablesaggregation . . . 26

3.5 HMI . . . 26

3.6 Developed Graphial User Interfae (GUI) . . . 28

III Results 33 4 NumerialResults 35 4.1 Benhmarks . . . 35 4.1.1 Test Funtions . . . 35 4.1.2 BenhmarkResults . . . 40 4.2 BasiNetwork. . . 49 4.2.1 NetworkModelling . . . 49 4.2.2 Results Comparison . . . 50 4.3 Walski Network . . . 55 4.3.1 NetworkModelling . . . 55 4.3.2 Results Comparison . . . 57 5 FinalRemarks 63 5.1 Conlusions . . . 63 5.2 Future work . . . 64 Referenes 66

(15)

2.1 Pipe head lossFormulas for Full Flow . . . 8

4.1 optimisation results of DeJong's funtion. . . 42

4.2 optimisation results of Axisparallel hyper-ellipsoidfuntion. . . 43

4.3 optimisation results of Rosenbrok'sfuntion. . . 44

4.4 optimisation results of Easom'sfuntion. . . 45

4.5 optimisation results of Rastriginfuntion. . . 46

4.6 optimisation results of Akley'sfuntion. . . 47

4.7 optimisation results of Shwefel'sfuntion. . . 48

4.8 optimisation results of Mihalewiz's funtion. . . 49

4.9 Initialvalues ofenergy and ost for theBasi Network . . . 50

4.10 optimisation results of Basinetwork benhmark. . . 52

4.11 Initialvalues ofenergy and ost for theWalskiNetwork . . . 55

(16)
(17)

2.1 Branhed network model . . . 6

2.2 Loopnetwork model . . . 7

2.3 Shematidisplay ofthe proessesinvolved inthea blak-boxoptimisation. 9 2.4 Multiple loalminima andmaxima funtion representation. . . 10

3.1 Shematidisplay ofthe proessesinvolved intheproposedsolution. . . . 18

3.2 Mok-up ofthe initial sreen of theGUI . . . 27

3.3 Mok-up ofthepump ontrol sreen of theGUI . . . 27

3.4 Mok-up ofthe waterlevelsreen of theGUI . . . 28

3.5 Mok-up ofthenal resultssreen of theGUI . . . 28

3.6 InterfaeStarting page . . . 29

3.7 InterfaePump ontrol page . . . 30

3.8 InterfaeWaterlevelpage . . . 30

3.9 InterfaeEstimated savings page . . . 31

4.1 3Drepresentation of the DeJong funtion . . . 36

4.2 3Drepresentation of the Axisparallel hyper-ellipsoidfuntion . . . 36

4.3 3Drepresentation of theRosenbrokvalleyproblem. . . 37

4.4 3Drepresentation of Easom's funtion . . . 38

4.5 3Drepresentation of the Rastrigin Funtion . . . 39

4.6 3Drepresentation of the Akley's Funtion . . . 39

4.7 3Drepresentation of the Shwefel's Funtion . . . 40

4.8 3Drepresentation of the Mihalewiz's Funtion . . . 41

4.9 DeJong's funtion optimisation with

ε

DE algorithm . . . 42

4.10 Axisparallel hyper-ellipsoidfuntion optimisation with

ε

DE algorithm . . 43

4.11 Rosenbrok'svalleyfuntion optimisation with

ε

DE algorithm . . . 44

4.12 Easom's funtionoptimisation with

ε

DE algorithm . . . 45

4.13 Rastrigin funtion optimisation with

ε

DE algorithm . . . 46

4.14 Akley'sfuntion optimisation with

ε

DE algorithm . . . 47

4.15 Shwefel's funtion optimisation with

ε

DE algorithm . . . 48

4.16 Mihalewiz's funtion optimisation with

ε

DE algorithm . . . 49

4.17 Shemeof Basinetwork. . . 50

4.18 Consumption patternassoiated withBasiNetwork. . . 51

4.19 Energy tari(

e

) assoiated withBasiNetwork. . . 51

4.20 Charateristi urveof the pump. . . 51

4.21 Costfuntion optimisation evolution forBasi Network. . . 53

(18)

4.23 Pump ontrolsafter optimisation bythe

ε

DE method. . . 54

4.24 Pump owand tanklevelvariation afteroptimisation byL-BFGS-B . . . 54

4.25 Pump ontrolsafter optimisation bytheL-BFGS-Bmethod.. . . 55

4.26 Shemeof the Walski network,drawn withEPANET software. . . 56

4.27 Energy tari(

e

) assoiated withWalski Network. . . 56

4.28 Consumption patternsassoiatedwithWalskiNetwork. . . 56

4.29 Charateristi urveof thepump. . . 57

4.30 Costfuntion optimisation evolution forWalskiNetwork. . . 59

4.31 Pump owand tanklevelvariation afteroptimisation by

ε

DE . . . 59

4.32 Pump ontrolsafter optimisation bythe

ε

DE method. . . 60

4.33 Pump owand tanklevelvariation afteroptimisation byL-BFGS-B . . . 60

(19)

WSS WaterSupply System

ε

DE

ε

Constrained Dierential Evolution DE Dierential Evolution

3D Three Dimensions

GA Geneti Algorithm

HMI Human Mahine Interfae

GUI Graphial User Interfae

CLI Command LineInterfae

NLS oN-LineSystem

WYSIWYG What YouSee Is What You Get

PC PersonalComputer

IDE IntegratedDevelopment Environment

LGPL Library GeneralPubli Liene

WPF Windows Presentation Foundation

RDPA Redued DynamiProgramming Algorithm

DP Dynami Programming

UI User Interfae

XML Extensible MarkupLanguage

XSLT Extensible Stylesheet LanguageTransformations

HTML HyperText Markup Language

XHTML Extensible HyperText MarkupLanguage

CSS Casading Style Sheets

(20)
(21)
(22)
(23)

Introdution

1.1 Context

Wateristhedrivingforeofall

nature.

LeonardodaVini

Water withdrawals around the world reahed an estimated 3900 km 3

/year [1℄ eah

year. Asthe majorityof the population live inurban entres, thatgenerallydon't have

natural water resoures, it beomes neessary to provide water from outer resoures.

Therefore,water networksareusedto ondut waterto this highonsumption entres.

In Portugal, water demands are estimated at 7500 Million m 3

/year with

5%

being

des-tined to urban onsumption. However, the estimated osts of water use assoiated to

the urban onsumption are of

46%

of the total osts [2℄. Currently, in water supply

systems,itis alsoneessary toexpend energyon a regular basisto aumulate water in

theformofpotential energy anduseitwhenneessary. Themost immediateexampleis

the useof water towers to reate pressure on thenetwork or water tanks to supply the

population. Inthelatterexample,thewaterissent toahigher levelbymeans ofpumps.

Current systems aretaken asimperative to guarantee aminimumlevelof water for any

eventuality. Thus, inthe urrent landsape water is pumped into the towers or supply

tanks when the water tank level reahes a minimum value. However, this ation does

not takeinto aount thattheenergy ost isdependent ontheyle time. Additionally,

the ontrol of pumps is done loally and depends solely on the level sensors. There is

no reord of running pumps or deposit levels. Costs of these ations an be minimized

taking in aount the energy ost variation during the day. Energy an be minimized

by optimizing the pumping system. When the water supply system ontains only one

water tank,the taskis ofsmall diulty beause thesystem behavesalmost asa linear

systemandthenumberofvariablestooptimizeisofreduednumber. However,whenthe

systemfeaturesbranhesand pumpingequipment andtanksmultiply,theminimization

of energy resoures presents itself as a highly omplex task. This is due to the large

number of variables to optimize, to the non-linear behaviour of the pumpsand need of

the systemto ontrol all organs (pumps, valves, tanks, ow rates in pipes, et. ). The

main onern of researh in this area is reduing theenergy onsumption and/or osts

(24)

1.2 Objetives

Water supplysystems present highenergy onsumption values due to thepumping

sys-tems high energy requirements, neessary to ensure water for the population. On the

present situation, thepumping systemsare atuated when water levels on water towers

reah predened minimum values. Thisproedure does not take into aount the time

of dayand the variableostof energy duringtheday. Theoptimisation of thepumping

proedure, typeofpump,management andlogistirelatingenergyost,depositand

pip-ingsystemdimensionsouldredueoperating ostsofwatersupplysystemsinadrasti

way. Thisthesisispartofaurrenteorttodevelopasoftwarethat,throughmodulation

of a Water Supply System andmathematial tools,an predit onsumptions, optimize

pump ontrols, reduing energy osts and ontrol the pumps of Water Supply System.

Themain goal ofthe present work is to reah ost redutions onwaterdistribution

sys-tems through pumping sheduleoptimisation. The present work aimsalso to develop a

softwareable todisplay the resultsof theoptimisation proessesto a user.

1.3 Outline of the thesis

Thepresent workisdividedinthreemain parts. Therstpart, "Guidelines",isdivided

intwo hapters. The rsthapterpresentsan introdution to thetheme of workof this

projet, as well as desribe the objetives of said projet. The seond hapter of the

rst part is a bibliographial review of themes relevant to this projet. Thishapter is

dividedinvesetions. Intherstispresentedareviewofpreviousworksonthesubjet.

The seond setion presents information about Water Supply Systems, while the third

setion gives information about the hydrauli simulation of said Water Supply System.

Thefourthsetionisareviewonmathematial optimisation ,and thefth setiongives

a reviewof Human Mahine Interfae development. In the seond part of this projet,

alled "Methods and Development", detailed information of the solution used in this

projetis presented. This partis divided inthree hapters, therst one presenting the

solutionusedtomodelWaterSupplySystem. Theseondhapterdividedintwosetions,

presents the seleted algorithms to use in the Water Supply System optimisation, and

thelasthapterpresentsthesolutionusedtodeveloptheHumanMahineInterfae. The

third part of this projet is dividedin two hapters. The rst hapter, divided inthree

setions,displaystheobtainedresultsoftheprojet. Therstsetionpresentstheresults

of optimisation of mathematial benhmarks, while the seond setion presents results

for Water Supply System benhmarks and the third setion presents the nal Human

MahineInterfae. Ontheseond hapter of this partonlusionsfrom this projet are

(25)

State-of-the-Art Review

2.1 Introdution

Water Supply System (WSS) need to ensure the onsumption requirements of various

setorsofsoiety. Thesemajorostsofthesesystemsareusuallyassoiatedwithpumping

osts [3℄, leaving room to improvement on ost eieny with pump sheduling. To

obtain the ostsof thevariations ofpump sheduling, the usageof hydrauli modelling

software is advised, as this type of modelling is more omplex and able to reprodue

the behaviourof WSSmore aurately. Water SupplySystem and hydrauli simulation

reviews are addressed in this hapter. The optimisation proess of the WSS needs to

guarantee ow and pressure onditions in order to satisfy onsumers, while reahing

pumpsheduling ontrolsthatminimizeostassoiatedwithenergyoststhatoftenare

assoiated withtime ofday. Thework of Bagirov etal. [4℄ introdued the useof pump

start/endruntimesasontinuousvariables,developinganewalgorithm forthesolution.

The solution is ompared to the work of Van Zyl et al. [3 ℄ obtaining improvement

over the previous paper results. The work of Van Zyl et al.[3 ℄ addresses the use of

Geneti Algorithm (GA)inWSS . They usedsuessfully anhybrid GA ombined with

the Hooke and Jeeves Hill-limber Method[5℄ improving onvergene speed and quality

of solutions ompared to pure GA methods. Both the work of Bagirov et al. [4℄ and

Van Zylet al.[3 ℄ usedEPANET softwarewith thesame test WSS to evaluate solutions.

Thework ofWang etal.[6 ℄ sheduled the pumping of ground-water taking into aount

an eo-aware approah to ground-water pumping, sheduling pumping while trying to

avoid ground subsidene. Time intervals are represented as real-number arrays instead

ofbinaries,allowing representation offrationsoftimeintervals. Thehydrauliproblem

usedto testthe proposedsolution isformulated asadisrete-aseoptimisation problem.

The work of Zhuan & Xia[7 ℄ analysed theproblem of multiple pumps witha Redued

Dynami Programming Algorithm (RDPA) formulation, reduing omputational time

omparing to Dynami Programming (DP ) formulation, and being ableto redue osts

assoiated with pumps. To display the data obtained from the optimisation proess to

the user of the software projeted at theoverall projet exist the need of development

of interfae between the mahine and theuser(Human MahineInterfae). A reviewof

(26)

2.2 Water distribution systems

Water distribution systems are of great importane asthey provide a vital assetto the

population. Therefore,itsimportantto present theharateristisofWSS. Water

distri-bution systemsanhave branhtype layouts, looplayouts ora mixof thetwo types. In

water networksof the branhed type the water ows in a singlediretion, from tank to

the last onsumption node. A model of this network an be seen in gure 2.1. Looped

networksnodesareonneted makingagridandareharaterized byenablingthewater

to ow in both diretions in pipes between nodes. Water ows depend on thedemand

in eah node. A modelof this network an be seen in gure2.2 . Another advantage of

this type of network is thelowerwater veloity ineah pipe onsidering that there are

multiple pipesleading to eah node[8℄.

Figure 2.1: Branhed network model. In this type of network, the water is distributed

throughout the various nodessequentially.

Awater distribution systemtypially inludes:

1. Reservoirs

(a) Of variable level, also alledtanks. An example of these reservoirs arewater

towers. These are man made and their water level has signiant variations

during thetime ofstudy.

(b) Ofxed level. Thisategory inlude rivers, lakesor dams. Theseare usually

natural reservoirs, with the exeptions of dams or man made lakes. Their

water level does not have signiant variations and, onsequently, these are

(27)

Figure 2.2: Loop network model. In this type of network, the water is distributed

throughout the various nodesbya gridof pipes.

2. Pumps. These equipments are used to boost the head at some loations in the

networkinordertooveromepipingheadlossesand/ortosurpassphysialelevation

dierenes (like pumping water to anelevated tank). Two types of pumpsan be

usedinwater distribution networks, suhas:

(a) Fixedspeed pumps. Themotor of thepumpremainsat axed speed

regard-lessof external fators.

(b) Variablespeed pumps. Themotor isonnetedto avariablespeed ontroller,

whihontrolstherotationofthepump. Thistypeofpumpsaremoreexible,

beingusedinmore appliations.

3. Valves. Those allow the water to ow in a given diretion, ontrolling water ow

and pressure ina distribution network. Canbe usedto shut-down entire portions

of the networks.

4. Nodes. Juntion points, usuallyonneting two or morepipes. Canbea dead-end

of a single pipe. Apart from the juntion use, nodesan have onsumption rates

assoiated orinjet inows (also referredasnegativedemands).

5. Piping. Join the nodesof thenetwork together and ontains waterow.

2.2.1 Frition losses

During thepassage of water through thepipes, the fritionbetween water and thepipe

(28)

approahespresented:

Hazen-Williams formula, for head loss in pressure systems. It is the most used formula,however itisonly validfor water and wasdevelopedfor turbulent ow.

Dary-Weisbah formula,usable inall liquidsand owregimes.

Chézy-Manning formula, usable onopen ondutproblems.

Theformulaefor the alulationof eahapproahis presented intable2.1.

Table 2.1: Pipe head loss Formulas for Full Flow (head lossin meters and ow rate in

ubi metersperseond) [8℄.

Formula Headlossdueto frition

Hazen-Williams

hL

= 10

.

7

C

1

.

852

d

4

.

871

LQ

1

.

852

Dary-Weisbah

hL

= 0

.

083

f

(

ε, d, Q

)

d

5

LQ

2

Chézy-Manning

h

L

= 10

.

3

n

2

d

5.33

LQ

2

Notes:

C

=

Hazen-Williamsroughness oeient

ε

=

Dary-Weisbah roughnessoeient

f

=

frition fatordependent of

ε

,

d

and

Q

n

=

Manning roughnessoeient

d

=

pipe diameterin

m

L

=

pipelength in

m

Q

=

owrate in

m

3

/s

2.3 Hydrauli simulation

Simulationsoftwareonsistofomputerbasedprogramsthatallowmodelling,simulation

andanalysisofsteady-state andtransientsystems,thusallowingtoobserveanoperation

without atually performing it. Hydrauli simulators model thesystem and its

ompo-nents. These are of great importane for water distribution systems management, as

they make possible the study of the systemprevious to its installation. It ispossible to

asertain the best option or layout for a piping system, pumping stations or reservoirs

easierandquiker,reduingprojettimeandostandensurethefeasibilityoftheprojet.

Theseallowalso theimprovement of existingsystems,providingpossibleimprovements,

and area important toolwhile studyingthebehaviourof thesystem.

Thehydraulimodelofa simulation isan aggregationof hydrauli omponents,

rep-resented as nodes, whih form a network representation of the system being modelled.

Thephysialphenomenaarebasedinmarosopiparameters,whihinludebutarenot

limitedto:

height of node;

distaneto node;

(29)

It's possible to represent omplete networks with this approah, enabling a thorough

understanding of thehydrauli system.

Allof these harateristis prove ofgreat relevane asthey endow:

optimisation of hydrauli networks, when undertakingprojetdesign;

assessment of performane of anexistingnetwork, helping to ndproblems.

2.4 Mathematial optimisation

Nowadaysinengineeringitisofuttermostimportanetoonsiderostandenergy

redu-tion whenprojeting aproess. Toimprove these redutions,optimisation methods an

beapplied.

Optimisation proesses onsist of obtainingthe best onditions to operate a proess, in

order to obtain the best results possible. On the present days, optimisation proesses

are used ina broadrange of appliations, suh asmehanis, eonomis and ontrol of

industry operations.

Optimisationproblemsoftenonsistofanattempttomaximizeorminimizea

mathemat-ial funtion,alledinoptimisation theoryasobjetivefuntion. Theobjetive funtion

andependofoneormorevariables. Insomeasesthemathematial funtionassoiated

witha proess is unknown. These ases are usually assoiated with physial proesses,

and the mathematial funtion that represent them are omplex. These types of

prob-lemsarealledblak-boxproblems. Onthisase,reahingtheoptimalsolutionbeomes

harder asthe lakof alear mathematial funtion bloksaess to helpfulinformation.

Figure 2.3 displays a shemati of the proess followed byblak-boxoptimisation. The

optimisation algorithmsendsthe optimisation variables totheblak-boxsoftware. After

alulation of the objetive funtion and onstraints, the blak-box software sends the

objetivefuntion valueand onstraint valuesto theoptimisation algorithm. Thisyle

repeats until a dened stopping riteria isreahed.

Figure2.3: Shemati displayof theproesses involved inthea blak-boxoptimisation.

Objetive funtions an be linear or non-linear, and an be dierentiable or

non-dierentiable. In the latter, analysis is diult as dierentiable methods annot be

applied.

Toreahthe bestresult,variablesintheobjetivefuntionarehanged. Theseareknow

(30)

thresholdsorrequisitesthatmustbeveriedintheproessbeingoptimized. Thegeneral

optimisation problem anbe formulated by:

minimize

f

(

x

)

subjet to

h

(

x

) = 0

g

(

x

)

0

x

min

i

<

x

i

<

x

max

i

,

(2.1)

where

f

(

x

)

istheobjetivefuntion,

i

= 1

,

· · ·

, n

isthenumberofoptimisationvariables,

h

(

x

)

areequalityonstraints and

g

(

x

)

areinequalityonstraints, respetively.

2.4.1 Classial algorithms

Classialoptimisationmethodsan usedierentialalulus, usingthegradientofa

fun-tionto reahthe objetive. Thistype oflassialalgorithmsofoptimisation anonly be

usedto ndthe optimalsolutionof ontinuousanddierentiable funtions. Solutionsof

unknown funtions(blak-boxproblems) or of not dierentiable funtionsareharder to

solve withthese methods.

Thesemethodsguaranteethatthesolutionfoundisexat,butdoesn'tguaranteethat

the solutionis thebest. Asexample, gure 2.4is ageneri representation of a funtion

whihhasthreeloalmaximums(pointsA,CandE)andtwo loalminimums(pointsB

and D), being point Ca global maximum and point D a global minimum. When using

a gradient-based algorithm and using a starting point between A and B, the minimum

found will be point B, that is only a loal minimum. Additionally, the use of dierent

starting pointsinmultiplerunsof thealgorithm an leadto dierent results. Therefore,

theuseof thesemethods innon-onvexfuntionsis hard toimplement and disouraged.

Figure 2.4: Representation of a multiple loal minima and maxima funtion. Thistype

(31)

2.4.2 Modern algorithms

Metaheuristialgorithmsaredenedasomputationalmethodsthatuseiterationsto

im-prove a solution. Although itdoes not guarantee an optimal solution, the introdution

of arandomelement allows thesearhfor theoptimalsolution throughoutthewhole

so-lution spaes. Some metaheuristimethods implement formsof stohastioptimisation.

In the example of gure 2.4 , for a starting point between point A and point B, on the

seond iteration the solution tested an be between point C and D (asan example). In

thease ofa better solution, theprevious iterationis disarded. Metaheuristi methods

areusedto solveomplexoptimisationproblems. Thesemethodsarereognizedassome

ofthemostpratialapproahestoomplexproblems,espeiallyfor real-worldproblems

that are ombinatorial in nature [9 ℄. Thesemethods are useful in situations where the

spae of the solution is very large and the approximate solution is not known. Most

metaheuristimethodsarebasedinaombinationoftherandomsearhmethodandthe

stohastihill-limbingmethod[10℄. Therandomsearhmethodstrategyistotrya

solu-tionfromthesolutionsearhspaeusingauniformprobabilitydistribution. Thestrategy

usedbythestohastihill-limbingmethodisrandomlyseleting aneighbour andidate

solution and aepting it only if the result is an improvement [11 ℄. Dierent types of

metaheuristi methods exist, with the searh proess varying to eah one. Stohasti

algorithms arebased on probabilisti and stohasti proesses. Stohastiproesses are

those whose behaviour isnon-deterministi, i.e. randomness is assoiated withthe nal

output. A deterministi modelwill always produe thesame output from agiven

start-ing ondition or initial state. The dierene between Stohasti Algorithms and other

algorithms basedonprobabilisti andstohastiproessesis thatStohastiAlgorithms

don't have inspiring systems nor metaphorial explanations. These algorithms generate

and userandom variables.

Evolutionaryalgorithmsareinspiredinbiologialevolution,andusesmehanismsrelated

to itinorder to approah a solution. Thismehanisms inlude mutation, reprodution,

seletion and reombination. Solutions are obtained using the mentioned mehanisms

andevaluatingatness funtion. Another metaheuristioptimisation method,the

phys-ial algorithmsareinspiredinphysial proesses,ranging fromsystemsfrommetallurgy,

musi, interplay between ulture and evolution and omplex dynami systems suh as

avalanhes[11℄. Probabilisti Algorithmsarethosethatuseprobabilist modelstomodel

problems orto searh problemspaes. Thesealgorithms usetheresultofarandom

dei-sion based on probabilisti distribution insteadof alulating thebest solution. Swarm

algorithms are adaptive strategies inspired in olletive intelligene. Colletive

intelli-geneappearsasathe ooperationofmultipleindividualagentstoreahaommongoal.

Eah of the agents is able to sense both itself as its surroundings The aggregation of

agentsforms a swarm.

Immune algorithms are a part ofthe Artiial Immune Systemsstudy, whih is a lass

of omputational intelligent systems inspired by the proess and mehanisms of the

bi-ologial immune system (primarily mammalian immunology). Neural algorithms make

use of artiial neural networks, with are omposed of proessing elements, alled

ar-tiial neurons. Artiialneural networksan have omplex global behaviours,as they

areaeted bytheonnetions between theproessing elementsof thenetwork and the

element parameters. The neural algorithm adapts the weights of onnetions between

(32)

2.5 Human Mahine Interfae

A Human Mahine Interfae (HMI) is what allows interation between a human and a

mahine. Their useiswidespread from industrialuse, asinthesreensof mahinery, to

dailypersonaluse,like theinput buttonsofa mobilephone. Two typesoffuntionsan

bepresent:

theinputfromthehumanusertothemahine,toallowadjustmentstothemahine or to request outputs;

thedisplayof outputfromthemahineto theuser, to,asanexample, allow infor-mationfrom the mahineto bevisible to theuser.

2.5.1 Historial review

Human mahine interfaes start in history as a neessity of the users to interat with

theinitial digital omputer. At therst timesof omputerusage, omputingpowerwas

very limited and expensive. For this mahines, interfaes were rudimentary, onsisting

of punhed ards or equivalent asinputand line printers asan output. The interation

between user and mahine waslimited to the systemoperator onsole. The rst bath

systems assigned one job to the entire omputer, whih ould take hours or even days

[12 ℄. CommandLineInterfaes(CLIs)appearedasanevolutionfrombathmonitorsthat

wereonneted to thesystemonsole. Thismodel interatedwiththemahinethrough

seriesofrequest-responsetransationsusingspeializedlanguageto expresstherequests

to the mahine. The time of proess for this type of interation dropped signiantly

from the previous results withthe bath system[12 ℄. From theappearane of oN-Line

System (NLS ) witha mouse ursor and multiple windows of hypertext (1968) [13℄ and

therstGUI developed at XeroxPARC, whihusedwindows,ions, andpop-upmenus

[14 ℄,andwhoseworkinluded thedevelopment oftheGypsy,therstbitmapWhatYou

See Is What You Get (WYSIWYG).

Applepikedupthe workfromXeroxPARCanddevelopedAppleLisa,in1979,therst

personalomputeroering aGUIthat wasdiretedat individual businessusers.

With the introdution of 32-bit hardware allowed further development of GUI design.

The Mirosoft Windows beneted gratly with this development, and introdued their

development overtheir Windows 1.0(1985) and Windows 2.0(1987) withtheWindows

3.0 (1990)[15℄. The mainstream use of omputers started in the 1990s reated a fast

growing market that allowed a high level of ompetition for ommerial development,

leading to the appearane of the Windows 95 and the Ma OS, the preursors of the

modern GUI present in Personal Computers (PC s). The urrent development fous is

on portable devies and touh-sreen interfaes, related with the inreasing use of ell

phones and tablets seen in the last years. Another area of development is the gesture

interfae, allowing the userto interat without touhingthedevie.

2.5.2 GUI Development

TheGUIdevelopment isusually aidedbytheuseofinterfae builders(orGUIbuilders),

whih aresoftware development tools thatease the proess of reation. These software

tools give the designer a drag and drop WYSIWYG editor, whih in turn allow for a

(33)

the interfae must be built by ode. This methods does not give visual feedbak until

theode isexeuted, impairingdesign on lessexperienedprogrammers.

Someoptions of softwarefor GUI development inlude:

Visual Studio

VisualstudioisanIntegratedDevelopmentEnvironment(IDE )fromMirosoft. An

IDEisasoftwarethatprovidestoolsforsoftwaredevelopment,normallyonsisting

of soure ode editors, build automation tools and debuggers. Interpreters and

ompilers are part of some IDE as well. Visual Studio is used to develop onsole

and GUIappliations, aswellas Windows Form appliations andweb sites,

appli-ationsandservies. ItanalsodevelopWindowsPresentationFoundation(WPF )

appliations. Visual Studio supports a wide range of programming languages,

with C/C++, VB.NET, C# and F# being built-in. It supports XML/XSLT ,

HTML /XHTML, Javasript and CSS as well. Visual Studio is distributed as a

Freeware with the "Express" versions of its omponents, or as a Trialware on its

ProfessionalEditions.

GTK+

GTK+, also knowasGIMP[16 ℄ toolkit,isa multi-platformtoolkit usedto reate

GUIs. The + was added to distinguish between theoriginal version of GTK and

thenew version[17 ℄. Itsupports a wide rangeof programming languages, suh as

Perl and Python. The GTK+ software is free and is a part of theGNU Projet,

allowing usebydevelopers,inluding to developproprietarysoftware[18 ℄.

Qt

Qt is a multi-platform appliation and User Interfae (UI) framework from Digia

for developersthatusesC++ orQML. Itis widelyusedto develop software

appli-ationswithGUIs andalso to developnon-GUI appliations withfeatureslikele

handling, database aess, Extensible Markup Language (XML) parsing, thread

management andnetwork support[19 ℄. Qtanbeusedunderopensoure(Library

General Publi Liene (LGPL )v2.1)or ommerial terms[20 ℄.

wxWidgets

wxWidgetsisafreeandopen-souremulti-platformC++library,withbindingsfor

multiple programming languages, suh asPython,Perl and Ruby[21 ℄. wxWidgets

isurrently liensedunderthe"wxWindows Liene". The wxWindowsLiene is

essentiallytheLGPL ,withanexeption statingthatderivedworksinbinaryform

maybe distributedonthe user's own terms[22 ℄.

2.5.3 Charateristis

ThedesignofaGUIishallengingasithassomeimportantharaterististhatitshould

attendtosuhasfuntionality,aessibility,pleasuretouseandmustbelogialtoprovide

quiklearningtonewusers. ApoorGUIanundermineagoodwork,renderingituseless

or unsatisfying ifitsinterfae is frustrating to the user.

To reah a good interfae design, a number of harateristis should be taken into

onsideration [23 ℄. Itshould belear to new usersaswell asfrequent users. If theusers

an't understand how to work withtheinterfae, it beomes impratial. The interfae

(34)

interfae. The interfae should pleasant to theeye and still simple. While hallenging,

if sueeded it makes the whole experiene of the user more enjoyable. The interfae

should be ableto handlemistakes,bothfrom theuser andthesoftware. And nallythe

interfae should be a way for the user to aomplish their tasks instead of being a list

of possible funtionsto beused, meaning theinterfae should be eient inthegoals it

(35)
(36)
(37)

Proposed solution

The present thesis intends to ahieve ost redutions assoiated withwater pumping in

WaterSupply System. The general optimisation problem assoiated with thisobjetive

an bedesribed as: minimize

f

(

x

)

,

subjet to

h

(

x

) = 0

,

g

(

x

)

0

,

x

min

i

<

x

i

<

x

max

i

,

(3.1)

where

f

(

x

)

istheobjetivefuntion,

i

= 1

,

· · ·

, n

isthenumberofoptimisationvariables and

h

(

x

)

and

g

(

x

)

areequalityand inequalityonstraints, respetively.

Inorderto ahieve this objetive,the proposed solutioninludes:

the EPANET software, that produes the hydrauli simulationof theinitial ase, basedon dataretrieved by aprevious study ofthenetwork;

the use of an optimisation algorithm to improve the pumpoperation osts, using EPANET to, at eah algorithm iteration, produe thenew simulation and obtain

thenew resultsfor operatingosts;

Use a HMI to give the user all informations onerning the hanges made to the pump shedule and operation osts, as well as generi informations from the

net-work,suh aswaterlevelat tanks.

A shemati of the proess an be seen in gure 3.1. The proess starts with a le

ontainingthenetworkharateristis. ThisleanbereatedbytheEPANETsoftware,

but is a proess prior to the optimisation. The data ontained in the le is stored in

thesoftware responsible for thesimulation. The EPANET simulation uses theprevious

data and runs theWSS simulation. The simulation ode produes information sent to

the optimisation. This data is the value of the objetive funtion and the onstraints

information fromthelatestsimulation. Aftertheoptimisationproess,thenewvariables

produed aresent to thestored dataused bythe EPANET simulation. This yleruns

(38)

Figure3.1: Shemati displayof the proessesinvolved intheproposedsolution.

3.1 Optimisation problem formulation

Onthepresentworktheoptimisationproblemonsistsintheredutionofostsassoiated

with water pumping in Water Supply System, thus being the objetive funtion. The

optimisation variables are the pump ontrols for a full day. The pumps onsidered are

of variable speed and the onsidered time step for the ontrols is of 1 hour. The total

numberofvariablesis48foreahpump,i.e.,foreahtime-steptwooptimisationvariables

are assoiated to eah pump, orresponding to the pump speed and theoperation time.

The objetive funtion is alulated using the software EPANET. As there isno aess

to the funtion from EPANET that alulates the osts, the optimisation problem is a

blak-boxproblem.

Theoptimisation probleman berepresentedby:

minimize

f

(

x

) =

Energy ost

,

subjet to

h

(

x

) = 0

,

g

(

x

)

0

,

x

min

i

<

x

i

<

x

max

i

,

(3.2)

where

f

(

x

)

is the objetive funtion,

i

= 1

,

· · ·

, n

is the number of optimisation variables,thatinludethepumptimefrationandtherelativeveloityofthepump,

h

(

x

)

areequalityonstraintsand

g

(

x

)

areinequalityonstraints. TheEnergy ostfuntionis alulated as: Energy ost

=

totalsteps

X

i=1

totalpumps

X

j=1

Energy

i,j

×

Prie

i

+

FixedCost

,

(3.3)

where the Energy for eah time step,

i

= 1

,

· · ·

, totalsteps

and for eah pump

j

=

1

,

· · ·

, totalpumps

,isalulated as:

Energy

i,j

=

P

i,j

×

t

i

,

(3.4)

with

P

beingthe powerat theorrespondent timestepfor pump

j

and

t

thedurationof thepumpativation. The powerisalulated with:

Pi,j

=

ρgHi,j

Qi,j

(39)

being

ρ

thewaterdensity,

g

the standard gravity,

H

thepumphead attheurrent time step (in meters),

Q

the ow rate and

η

is the pump eieny for pump

j

. The xed ostsof the energy ostfuntion isalulated with:

Fixedost

=

totalpumps

X

j=1

Pj

,max

×

Demand harge

,

(3.6)

withthedemandhargebeingthe additionalenergyhargepermaximumkilowattusage.

Thepumphead is alulatedusing:

H

=

A

BQ

C

,

(3.7)

where

A

,

B

and

C

are onstants related with the pump and

Q

is the ow rate. With variablespeed pumpsthe head valuesare shiftedaordingto:

Q

1

Q

2

=

N

1

N

2

H

1

H

2

=

N

1

N

2

2

,

(3.8)

with

N1

and

N2

thestandardandthenewspeed,respetively. Theoptimisationvariables areonstrained by

0

<

x

i

<

1

.

For thevariables of time, thepump timefration isdened at eah time step. For this

variable,0orrespondstopumpworkingfor 0minutesand1tothepumpworkingfor60

minutes. The values between 0 and 1 an be transformed to minutes following a linear

equation:

time

=

x

i

×

60

.

For thevariablesofpumpspeed,0orrespondsto pumprelativeveloityof

ω

= 0

.

5

and 1orresponds to

ω

= 2

. The values between 0and 1 an betransformed to therelative speed of the pumpbythefollowing linearequation:

ω

= 0

.

5 + (

x

i

×

1

.

5)

.

Theoptimisation problemis subjeted to the following equalityonstraint:

h

(

x

j

) =

L

j,f inal

L

j,initial

= 0

j

= 1

, . . . , t,

(3.9) withL

initial

beingthe initial water level andL

f inal

thenalwater levelofeah tank

j

.

Theoptimisation problemis subjeted to thefollowing inequalityonstraint:

g

1(

x

j

) =

L

j

L

j,max

0

j

= 1

, . . . , t,

(3.10)

g

2(

x

j

) =

L

j

L

j,min

0

j

= 1

, . . . , t,

(3.11) with

L

j

being the urrent water level,

L

j,max

the maximum admitted level and

L

j,min

theminimumadmitted level for eahtank

j

.

(40)

3.2 EPANET hydrauli simulator

The alulation of the objetive funtion of the problem formulated at 3.2 is made by

EPANET.EPANETisan hydrauli andwater qualitysimulationsoftware developed by

the United States Environment Protetion Ageny (EPA) and released in 1993. This

softwareallows thesimulationof extendedperiod simulations, both statiand dynami.

EPANET traks water ow in pipes, pressure in nodes and height of water in tanks

during thesimulationperiod[24 ℄. EPANET an be usedasa standalone program or as

a library (.dll)to beinluded in otherprograms.

EPANET ismade ofa state-of-the-art hydrauli analysisengine,and isable to[24 ℄:

model networkswithnosize restrition;

model onstant or variablespeed pumpswith anassoiated urve of funtion;

model various typesof valves;

inlude minor head losses for bends, ttings,et;

allowvariations ofdiameter withheight instoragetanks;

assoiate demandpatternsto eah individualnode;

alulate pumping energy andost;

alulatesystemoperationsbasedonsimpletanklevelortimerontrolsorbaseon omplex rulebased ontrols;

alulate frition headloss using the Hazen-Williams, Dary-Weisbah or Chezy-Manningformulas.

To obtain the solutions for the heads and ows at eah time the hydrauli system

needs the solving of the equation for the onservation of ow at eah juntion and the

headloss aross eah link of the water network. These equations gives the hydrauli

balane of the network at a given time. EPANET hydrauli simulation model employs

a gradient method in order to solve the non-linear equations involved in the hydrauli

balane.

3.2.1 Gradient Method for the solution of hydrauli systems

EPANETusesanapproah fromTodiniandPilati(1988)[25 ℄ tosolvetheequationsthat

haraterize the hydrauli balaneof thenetwork. Thisapproahis presented next.

Theow-headlossrelation ina dened pipebetween thenodesiand jisgiven by:

Hi

Hj

=

hij

=

rQ

n

ij

+

mQ

2

ij

,

(3.12) where

H

is the nodal head,

h

is the headloss,

r

is the resistane oeient,

Q

is the ow rate,

n

is the ow exponent and

m

is the minor loss oeient. The value of the resistane oeient is dependant of the frition headloss formulabeing used. The

headloss for pumpsan be representedby

hij

=

ω

2

(

h0

r

(

Qij

ω

)

n

)

,

(41)

inwhih

h0

is thehead of shut-o for thepump,

ω

isa relative speed setting, and

r

and

n

arethe pumpurve oeients.

To attain the hydrauli balane, another set of equations must be satised. These

arethe owontinuityequations for allnodes:

X

j

Qij

Di

= 0

for

i

= 1

, . . . N,

(3.14)

in whih

D

i

is the ow demand in the node

i

. By onvention, the ow into a node is positive. The objetive of the balane is to nd heads

Hi

and ows

Qij

that satisfy equations 3.12 and3.14.

Thegradientmethodstartswitharstestimateofowsinpipesthatmaynotsatisfy

owontinuity. Fromeahiterationthenewnodalheadsareobtainedsolvingthematrix

equation:

AH

=

F

,

(3.15)

whereAisan

(

N

×

N

)

Jaobian matrix,Hisan

(

N

×

1)

vetor ofunknownnodalheads and Fisan

(

N

×

1)

vetor of right hand sideterms.

Thediagonal elements oftheA matrix aregivenby:

Aii

=

X

j

pij

,

(3.16)

and thenon-zero o-diagonal elements aregiven by:

Aij

=

pij

,

(3.17)

where

p

ij

istheinversederivativeoftheheadlossinthelinkbetween therespetivenodes nodeswithrespetto ow. For pumps,

pij

isgiven by

p

ij

=

1

2

r

(

Qij

ω

)

n

1

,

(3.18)

whilefor pipes

pij

isgivenby

p

ij

=

1

nr

|

Qij

|

n

1

+ 2

m

|

Qij

|

.

(3.19) TheF vetor onsistsof netowimbalanes atthe node added to a ow orretion

fator:

F

i

=

X

j

Q

ij

D

i

+

X

j

y

ij

+

X

f

p

if

H

f

,

(3.20)

inwhihthe lastterm oftheequationappliesto anylinksthatonnetnode

i

toaxed grade node

f

. The ow orretion fator

yij

forpipes isgivenby:

yij

=

pij

r

|

Qij

|

n

+

m

|

Qij

|

2

sgn

(

Qij

)

,

(3.21) and for pumpsit isgivenby:

y

ij

=

p

ij

ω

2

h0

r

(

Q

ij

ω

)

n

,

(3.22)

(42)

where

sgn

(

Q

ij

)

is

1

when

Q

ij

is positive and

1

otherwise.

Q

ij

is always positive for pumps, hene this term is omitted in the equation of pumps. After the alulation of

new headsbysolvingequation 3.15thenew ows arealulated using:

Qij

=

Qij

(

yij

pij

(

Hi

Hj

))

.

(3.23) The results are tested against a pre-determined tolerane of the sum of absolute ow

relative to the totalowinalllinks. Ifthetoleraneis notrespeted, equation3.15and

3.23aresolved again.

Theimplementation ofthe methodinEPANET follows someessential steps,namely:

1. The linear systemof equations 3.15 is solved with useof a sparsematrix method

basedon nodere-ordering;

2. Attherstiteration,owinapipeisassumedtobeequaltotheoworresponding

to a veloity of 1 ft/se (30,48 m/se) and the ow in pumps is equal to the

design owspei ofthepump;

3. Theresistaneoeientforapipe(

r

)isalulatedbasedononeofthreedierent approahes, onretely:

Hazen-Williams formula.

Dary-Weisbah formula.

Chézy-Manning formula.

The equations for eah formulation are present in table 2.1, previously presented

insetion 2.2.1 .

4. The minor loss oeient dened in order of veloity head

K

is onverted to a ow-basedoeient withthefollowing equation:

m

=

0

.

02517

K

d

4

.

(3.24)

3.3 Seleted optimisation algorithms

Tosolvetheoptimisationproblemformulatedat3.2twodierentalgorithmsareproposed.

TheLimitedMemoryAlgorithmforBoundConstrainedoptimisation(L-BFGS-B),a

las-sialalgorithm andthe

ε

ConstrainedDierential Evolution (

ε

DE ),a modernalgorithm. Both algorithmsarepresentedinthenext two setions.

3.3.1 LimitedMemory AlgorithmforBound Constrainedoptimisation

The L-BFGS-B is a limited memory quasi-Newton algorithm, used to solve large

non-linearoptimisationproblems,inwhihtherearesimpleboundsontheproblemvariables

[26 ℄. The problemon thisalgorithm is formulated as

minimize

f

(

x

)

subjetto l

<

x

<

u

,

(43)

where

f

:

n

−→ ℜ

isanon-linearfuntionwithanavailablegradientfuntiong,inwhih

the vetorsl andu represent thelower andhigher boundsof thevariables,respetively,

and the number of variables,

n

, is assumed to be large. The gradient funtion g is ontinuous.

Theformulatedoptimisationproblemissubjetedtothefollowingequalityonstraint:

h

(

x

j

) =

L

j,f inal

L

j,initial

= 0

j

= 1

, . . . , t,

(3.26) with

L

initial

beingthe initial water level and

L

f inal

thenalwater level ofeah tank

j

.

Theoptimisation problemis subjeted to thefollowing inequalityonstraint:

g

1(

xj

) =

Lj

Lj,max

0

j

= 1

, . . . , t,

(3.27)

g

2(

xj

) =

Lj

Lj,min

0

j

= 1

, . . . , t,

(3.28) with

Lj

being the urrent water level,

Lj,max

the maximum admitted level and

Lj,min

theminimumadmitted level for eahtank

j

.

Themathematialdesriptionofthealgorithmwasdesribedbyit'sauthors,Rihard

H.Byrdetal. in1994[26 ℄. Forthisalgorithm,thegradientfuntiongisalulatedusing

a nitedierene methodalled the forward dierene, whih isrepresentedby:

h

[

f

](

x

) =

f

(

x

+

h

)

f

(

x

)

.

(3.29) Thederivative offuntion f at xisgiven by:

f

(

x

) = lim

h

+

f

(

x

+

h

)

f

(

x

)

h

.

(3.30)

For smallh and

h

6

= 0

theforward dierenemethodapproximatesthederivativeof

f

(

x

)

as:

f

(

x

)

f

(

x

+

h

)

f

(

x

)

h

=

h

[

f

](

x

)

h

.

(3.31)

Theonstraintsfromtheformulatedoptimisationproblemareaddedtothealgorithm

using theexteriorpenalties method,whih penalises theobjetive funtion using:

F

=

f

+

r

h

l

X

k

=1

(

h

k

(

X

))

2

+

r

g

m

X

j

=1

(max

{

0

, g

j

(

X

)

}

)

2

,

(3.32)

where

F

isthe objetive funtionafterpenalization,

f

istheobjetive funtionprior to penalization,

r

h

is theoeient for the equality onstraints and

rg

is theoeient for theinequality onstraints.

FortheimplementationofthisoptimisationalgorithmaC++ode,ontainingaround

2000 lineswasdeveloped [26℄. Besides the adaptation to the type of problem intended

to optimize in this work, one of the main dierenes introdued in the ode was the

implementation ofaonstraint handlingmethodbasedontheexteriorpenaltiesmethod,

referred above. Further inlusions in this ode inlude the gradient alulation for the

objetivefuntion,basedonthenitedierenemethodoftheforwarddierenes. These

(44)

3.3.2

ε

Constrained Dierential Evolution

Being a part of the Stohasti Diret Searh methods, Dierential Evolution (DE ) is

from a eld of Evolutionary Computation, being related withmethods suh asGeneti

Algorithms, Evolutionary Programming and Evolution Strategies.DE was designed for

non-linear, non-dierentiable ontinuousfuntion optimisation [11℄.

DE algorithmshave a population ofandidate solutions,whih areused trough

iter-ations of reombination, evaluation andseletion to ahieve theoptimal result.

Thereombinationofandidate solutions is basedintheweigheddierene between

two random seleted andidates (vetors b and ) added to a third andidate solution

(vetora). Theresultingandidateismutatedwitharossingvetori. Afterthisproess,

the reated andidate solutions are tested against the progenitor andidates. If better,

the hild andidate replaes the father in the population of andidate solutions. With

this method, while the population of andidates is spread out the variations made at

eah iteration will be high. As the solution onverges, the hanges beome smaller as

the distane between the andidates seleted for subtration (b and ) are smaller. To

noteaswellisthe fatthattheseletioninthismethodismadeafterthereombination

iterations makingthis asurvivalseletion insteadof having parent seletion.

Asimpleimplementation ofaDEisshowbelowinalgorithm1. Inthepresentedase

thepopulationistreated asavetor to improve learness oftheode.

The neessity of guaranteeing water level onstraints in the WSSproblems leads to

additionof onstraint manageto DEalgorithm. Thealgorithm proposedbyTakahama

andSakai[27 ℄,whihisusedinthiswork,addressesthisproblemaddingthe

ε

onstrained method to the standard DE algorithm. The

ε

ontrained method uses onstraint viola-tions,

φ

(

x

)

wihis given by[27℄

φ

(

x

) = max

{

max

{

0

, gj

(

x

)

}

,

max

|

hj

(

x

)

|}

,

(3.33)

φ

(

x

) =

X

j

k

max

{

0

, gj

(

x

)

} k

p

+

X

j

k

hj

(

x

)

k

p

,

(3.34)

with

p

being a positive number. The

ε

level omparison denes the order relation of a pair of objetive funtions, value and onstraint violation (

f

(

x

)

, φ

(

x

)

). The

ε

level omparison denestheorderofpreedeneof

φ

(

x

)

over

f

(

x

)

,beausethefeasibilityof

x

ismoreimportantthantheminimizationof

f

(

x

)

. For

f1, f2

and

φ1, φ2

beingthefuntion valuesand onstraint violations at thepoint

x1, x2

the

ε

level omparison for any

ε

0

the

<

ε

and

ε

between

(

f1, φ1

)

and

(

f2, φ2

)

aredened as:

(

f1

, φ1

)

(

f2, φ2

)

f1

< f2,

if

φ1, φ2

ε,

f1

< f2,

if

φ1

=

φ2,

φ1

< φ2,

otherwise

,

(3.35)

(

f1

, φ1

)

ε

(

f2, φ2

)

f1

f2,

if

φ1, φ2

ε,

f1

f2,

if

φ1

=

φ2,

φ1

< φ2,

otherwise. (3.36)

Fortheaseof

ε

= inf

theomparison isequivalenttoordinaryomparisons. For the ase of

ε

= 0

the omparison orders the onstraint violation

φ

(

x

)

preedes de funtion value

f

(

x

)

.

(45)

Algorithm 1 DE pseudo-ode

1:

α

mutation rate

Commonly between 0.5and 1.0,higher ismore explorative 2:

popsize

desiredpopulationsize

3:

P

← hi

Empty population(it's onvenient hereto treat itasa vetor),of length

popsize

4:

Q

1

Theparents. Eah parent

Qi

wasresponsiblefor reatingthehild

Pi

5: for

i

from 1to

popsize

do

6:

Pi

New random individual 7: end for

8:

Best

9: repeat

10: for eah individual

Pi

P

do 11: AssessFitness

(

P

i

)

12: if

Q

6

=

and

F itness

(

Qi

)

> F itness

(

Pi

)

then

13:

Pi

Qi

Retaintheparent, throwawaythekid

14: endif

15: if

Best

=

or

F itness

(

Pi

)

> F itness

(

Best

)

then

16:

Best

Pi

17: endif

18:

Q

P

19: foreah individual

Qi

Q

do

Wetreat individuals asvetorsbelow 20:

a

a opy of an individual other than

Q

i

, hosen at random with replaement fromQ

21:

b

aopyof anindividual otherthan

Qi

or

a

,hosenat random with

replaement fromQ

22:

c

a opy of an individual other than

Qi

,

a

or

b

, hosenat random withreplaement from Q

23:

d

← −

a

+

α

(

b

− −

c

)

Mutationis justa arithmetivetor 24:

P

i

one hildfrom

Crossover

(

d , Copy

(

Q

i

))

25: endfor

26: end for

27: until

Best

isthe idealsolution or we ran out oftime 28: return

b

(46)

In the appliation of the

ε

DE algorithm in thewater supply systems tested during the present work, violations arisefromthe non-observaneof theequation ofontinuity

of water level.

if

L

i,f inal

L

i,initial

6

= 0

v

1

i

=

L

i,f inal

L

i,initial

,

i

= 1

, . . . , t.

(3.37) Theviolation

v

1

isthedierenebetweentheinitiallevel

L

initial

andthenallevel

L

f inal

of eahtank

i

.

Violationsariseaswell fromdisrespetof maximum tanklevels:

if

L

i

L

i,max

>

0

v

2

i

=

L

i

L

i,max

,

i

= 1

, . . . , t.

(3.38) aswell asfromdisrespetofminimumtank levels:

if

Li

Li,min

<

0

v

3

i

=

Li

Li,min,

i

= 1

, . . . , t.

(3.39) The violations

v

2

and

v

3

are the dierene between the atual water level,

Li

, and themaximumlevel

L

i,max

orminimumlevel,

L

i,min

,respetively,foreah time-step

i

.

Thetotal violation for eah solution is the sum of the previous violations (equation

3.40).

vi

=

v

1

i

+

v

2

i

+

v

3

i,

i

= 1

, . . . , t.

(3.40) Fortheimplementationofthisoptimisation algorithm aC++ode,witharound900

linesofdevelopedode. ThedevelopedodewasbasedinaCodefromtheauthorofthe

algorithm [27℄. The odewaslinked to thehydrauli simulation using theEPANET

ex-ternallibraries, allowingthealulationofboththeobjetivefuntionandtheonstraint

violations neededto the optimisation bythis algorithm.

3.4 Optimisation variables aggregation

Inthepresentedmethodologyanewapproahwasfollowedinordertoreduethenumber

ofoptimisationvariables,simplifyingthe optimisationproblem. Thisapproahonsisted

inagglomerationoftheoptimisationvariablestakingintoaountthewaterdemandsand

the energy tari. During a ertainperiodontaining several time-steps, ifit isattested

thatboth waterdemandandenergytariremainonstant,thentheorrespondent

time-steps an be aggregatedinto onlyone. This means that, for example, iffour time-steps

are available for aggregation, instead of eight optimisation variables (four time-steps

with two optimisation variables per time-step and per pump) there will be onsiderate

only two variables (onetime-step withtwooptimisation variables pertime-step and per

pump).

3.5 HMI

To display the results obtained from the optimisation of the WSS it is proposed the

development ofanHMI. Thedevelopment oftheHMI,inthissituation aGUI,followed

3 dierent steps: idealization, mok-up design and nal design. The idea for this GUI

wastoreahatransparentandeasytounderstandinterfae. Learningtimefornewusers

(47)

other software to ease user experiene. To ahieve this, the solution found intended to

present results ina tabular sheme, eah tab presenting dierent data. With theuseof

softwareBalsamiq Mokups,theinitial mok-upsweredeveloped. Ingure3.2theinitial

sreenoftheGUIispresented. Inthissreen,theuserseletthetypeofoptimisationand

the network to optimize. The user gives theorder to start theoptimisation by liking

thebutton start.

Figure3.2: Mok-up oftheinitial sreen of theGUI

Ingure3.3thepumpontrolsreenoftheGUIispresented. Inthissreen,theuser

is ableto readinformation, graphially,about the ontrol ofthepumps.

Figure3.3: Mok-up ofthe pumpontrol sreen of theGUI

Ingure3.4the pumpontrolsreenoftheGUIispresented. Inthissreen,theuser

is able to read information, graphially, about the evolution of water level inthe tanks,

(48)

Figure3.4: Mok-upof the waterlevel sreen oftheGUI

Ingure3.4the pumpontrolsreenoftheGUIispresented. Inthissreen,theuser

is ableto readinformation about theostredutions reahed bythealgorithm used.

Figure3.5: Mok-upof thenalresults sreen oftheGUI

3.6 Developed GUI

To develop the GUI, the software used was Visual Studio 2010. The seletion of this

software was based on the vast array of funtionalities it possesses and it's use would

easeonnetion withthe algorithms ode,whih wasdeveloped usingthesame software.

Basedonthemok-upspreviouslymade,presentedinsetion3.5 ,theGUIdeveloped

(49)

PAGE). The user selets the type of optimisation and the network to optimize with

a ombo box. After both are seleted, the START button at the enter of the GUI

beomes ative. After the user presses the start button, the optimisation takes plae.

Thisproess an be stopped at anytime pressing the buttonat thebottom right of the

GUI. Atthesameloation,existsaprogressbar,allowingtheusertoaesstheprogress

of the optimisation.

Figure 3.6: InterfaeStarting page

Aftertheoptimisationisnished,thetabsPUMPCONTROLS(gure3.7 ),WATER

LEVEL (gure3.8 ) andESTIMATED SAVINGS (gure3.9). ThebuttonSAVE,whih

allows the user to save the results to a text le and the button EPANET REPORT,

whihopensthe reportle reatebyEPANET also beomeative.

Figure3.7showsthe tabPUMP CONTROLS, wheretwobar plotsdisplaytheusage

of the pump, both with usage time and pump veloity. The existene of more pumps

reates moretabs, one for eahpump.

Figure3.8showsthetabWATERLEVEL,wherethewaterlevelofatankisdisplayed

throughtheuseofahart. Theexisteneofmoretanksreatesmoretabs, one foreah

tanks.

Figure 3.9 shows thelast tab, ESTIMATED SAVINGS. In this tab theuser is

pre-sented with the ost value of the network prior to optimisation and after optimisation,

(50)

Figure 3.7: Interfae Pump ontrol page

(51)

Figure3.9: Interfae Estimated savingspage

Theuseranstartanotheroptimisation,bysimplyseletinganotheroptionatSTART

(52)
(53)
(54)

Referencias

Documento similar