• Nenhum resultado encontrado

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

(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

abaste imento de água

DissertaçãoapresentadaàUniversidadedeAveiropara umprimentodos

req-uisitosne essáriosàobtençãodograudeMestradoemEngenhariaMe âni a,

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

(4)
(5)

Uni-Presidente/ President DoutoraMóni a 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)

A knowledgements 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.

Gostariadeagrade erde modo espe ialàminha família,parti ularmenteao

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

irmão,Mar elo,peloapoioe ompanheirismo.

Um agrade imento aos amigos que ontinuam aa reditar em mim e a dar

forçae apoio.

(8)
(9)

Abaste imentode água;

Resumo Os res entes onsumosdeáguagerampreo upaçõesrela ionadas omasua

distribuição. Ane essidade de fazer hegara água a entrospopula ionais

impli aelevados ustosenergéti osenan eiros,poisnãoexiste ontrolo

so-breobombeamentodeáguaparatorresdeabaste imentooureservatórios,a

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

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

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

parte integrante de um proje to de desenvolvimentode um software apaz

de, através de modelação hidráuli a e ferramentasmatemáti as, 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 apa idade de minimização de

ustosrela ionados omobombeamentodaágua. Osmétodosde

optimiza-ção sele ionadosforamoalgoritmoL-BFGS-B (Limitedmemory algorithm

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

e o algoritmo

ε

DE (epsilon onstrained DierentialEvolution), um método metaheurísti o. Os algoritmossele ionados foram testados emfunções de

teste, tendo o algoritmo

ε

DE obtido bons resultados em todas as funções testadas, enquanto queo algoritmoL-BFGS-B in orreuem di uldades em

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

ben hmark distintas. Uma rede,denominada Rede Bási a, denida apenas

pelos elementos essen iais e uma rede malhada denominada rede Walski

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

ben h-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 aredemais omplexa(redeWalski). Estealgoritmo,devido

aofa todetestaraviolaçãodasrestriçõesemprimeirolugarestetemmaior

(10)
(11)

Abstra t In reasing water onsumptiongenerates growing on ern mainly related to

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

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

pumping of water to supply water towers and reservoirs, fromwhi h water

is distributed to the population and other servi es or industry. Suiting the

pumping of water havinginto a ountenergeti tariswouldallowforhigh

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

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

modula-tionofaWaterSupplySystemandmathemati altools,minimizingpumping

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

this dissertationwere implemented and tested two optimisation algorithms

to omparetheability tominimizethe ostsasso iatedwithpumpingwater.

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

algorithmforbound onstrainedoptimisation),a lassi aloptimisation

algo-rithm, and the

ε

DE (epsilon onstrained DierentialEvolution), aheuristi method. Both algorithms were tested in ben hmarked fun tions, with the

ε

DE ableto provide good resultsin allfun tions,while the L-BFGS-B algo-rithm inferredproblems with the more omplex fun tions. Both algorithms

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

net-works,denominatedBasi Network,simpleinnatureandwithonlyonepump.

Theother network, denominated Walski Network, more omplex, and with

2 water pumps. Costredu tions were attained with both methodsin both

ben hmarked 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 respe t the onstrainsimposed tothe networks, as ittestesthe

(12)
(13)

List of Tables iii

List of Figures vi

Symbols and A ronyms vii

I Guidelines 1

1 Introdu tion 3

1.1 Context . . . 3

1.2 Obje tives . . . 4

1.3 Outline ofthethesis . . . 4

2 State-of-the-Art Review 5 2.1 Introdu tion . . . 5

2.2 Water distributionsystems . . . 6

2.2.1 Fri tion losses . . . 7

2.3 Hydrauli simulation . . . 8

2.4 Mathemati al optimisation. . . 9

2.4.1 Classi alalgorithms . . . 10

2.4.2 Modernalgorithms . . . 11

2.5 HumanMa hine Interfa e . . . 12

2.5.1 Histori al review . . . 12

2.5.2 Graphi al User Interfa e Development . . . 12

2.5.3 Chara teristi s . . . 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 Sele tedoptimisation algorithms . . . 22

(14)

3.3.2

ε

Constrained Dierential Evolution . . . 24

3.4 Optimisation variablesaggregation . . . 26

3.5 HMI . . . 26

3.6 Developed Graphi al User Interfa e (GUI) . . . 28

III Results 33 4 Numeri alResults 35 4.1 Ben hmarks . . . 35 4.1.1 Test Fun tions . . . 35 4.1.2 Ben hmarkResults . . . 40 4.2 Basi Network. . . 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 Con lusions . . . 63 5.2 Future work . . . 64 Referen es 66

(15)

2.1 Pipe head lossFormulas for Full Flow . . . 8

4.1 optimisation results of DeJong's fun tion. . . 42

4.2 optimisation results of Axisparallel hyper-ellipsoidfun tion. . . 43

4.3 optimisation results of Rosenbro k'sfun tion. . . 44

4.4 optimisation results of Easom'sfun tion. . . 45

4.5 optimisation results of Rastriginfun tion. . . 46

4.6 optimisation results of A kley'sfun tion. . . 47

4.7 optimisation results of S hwefel'sfun tion. . . 48

4.8 optimisation results of Mi halewi z's fun tion. . . 49

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

4.10 optimisation results of Basi network ben hmark. . . 52

4.11 Initialvalues ofenergy and ost for theWalskiNetwork . . . 55

(16)
(17)

2.1 Bran hed network model . . . 6

2.2 Loopnetwork model . . . 7

2.3 S hemati display ofthe pro essesinvolved inthea bla k-boxoptimisation. 9 2.4 Multiple lo alminima andmaxima fun tion representation. . . 10

3.1 S hemati display ofthe pro essesinvolved intheproposedsolution. . . . 18

3.2 Mo k-up ofthe initial s reen of theGUI . . . 27

3.3 Mo k-up ofthepump ontrol s reen of theGUI . . . 27

3.4 Mo k-up ofthe waterlevels reen of theGUI . . . 28

3.5 Mo k-up ofthenal resultss reen of theGUI . . . 28

3.6 Interfa eStarting page . . . 29

3.7 Interfa ePump ontrol page . . . 30

3.8 Interfa eWaterlevelpage . . . 30

3.9 Interfa eEstimated savings page . . . 31

4.1 3Drepresentation of the DeJong fun tion . . . 36

4.2 3Drepresentation of the Axisparallel hyper-ellipsoidfun tion . . . 36

4.3 3Drepresentation of theRosenbro kvalleyproblem. . . 37

4.4 3Drepresentation of Easom's fun tion . . . 38

4.5 3Drepresentation of the Rastrigin Fun tion . . . 39

4.6 3Drepresentation of the A kley's Fun tion . . . 39

4.7 3Drepresentation of the S hwefel's Fun tion . . . 40

4.8 3Drepresentation of the Mi halewi z's Fun tion . . . 41

4.9 DeJong's fun tion optimisation with

ε

DE algorithm . . . 42

4.10 Axisparallel hyper-ellipsoidfun tion optimisation with

ε

DE algorithm . . 43

4.11 Rosenbro k'svalleyfun tion optimisation with

ε

DE algorithm . . . 44

4.12 Easom's fun tionoptimisation with

ε

DE algorithm . . . 45

4.13 Rastrigin fun tion optimisation with

ε

DE algorithm . . . 46

4.14 A kley'sfun tion optimisation with

ε

DE algorithm . . . 47

4.15 S hwefel's fun tion optimisation with

ε

DE algorithm . . . 48

4.16 Mi halewi z's fun tion optimisation with

ε

DE algorithm . . . 49

4.17 S hemeof Basi network. . . 50

4.18 Consumption patternasso iated withBasi Network. . . 51

4.19 Energy tari(

e

) asso iated withBasi Network. . . 51

4.20 Chara teristi urveof the pump. . . 51

4.21 Costfun tion 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 S hemeof the Walski network,drawn withEPANET software. . . 56

4.27 Energy tari(

e

) asso iated withWalski Network. . . 56

4.28 Consumption patternsasso iatedwithWalskiNetwork. . . 56

4.29 Chara teristi urveof thepump. . . 57

4.30 Costfun tion 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 Ma hine Interfa e

GUI Graphi al User Interfa e

CLI Command LineInterfa e

NLS oN-LineSystem

WYSIWYG What YouSee Is What You Get

PC PersonalComputer

IDE IntegratedDevelopment Environment

LGPL Library GeneralPubli Li en e

WPF Windows Presentation Foundation

RDPA Redu ed Dynami Programming Algorithm

DP Dynami Programming

UI User Interfa e

XML Extensible MarkupLanguage

XSLT Extensible Stylesheet LanguageTransformations

HTML HyperText Markup Language

XHTML Extensible HyperText MarkupLanguage

CSS Cas ading Style Sheets

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

Introdu tion

1.1 Context

Wateristhedrivingfor eofall

nature.

LeonardodaVin i

Water withdrawals around the world rea hed an estimated 3900 km 3

/year [1℄ ea h

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

natural water resour es, it be omes ne essary to provide water from outer resour es.

Therefore,water networksareusedto ondu t waterto this high onsumption 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 asso iated to

the urban onsumption are of

46%

of the total osts [2℄. Currently, in water supply systems,itis alsone essary toexpend energyon a regular basisto a umulate water in

theformofpotential energy anduseitwhenne essary. 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 lands ape water is pumped into the towers or supply

tanks when the water tank level rea hes a minimum value. However, this a tion does

not takeinto a ount thattheenergy ost isdependent onthe y le time. Additionally,

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

no re ord of running pumps or deposit levels. Costs of these a tions an be minimized

taking in a ount 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 di ulty be ause thesystem behavesalmost asa linear

systemandthenumberofvariablestooptimizeisofredu ednumber. However,whenthe

systemfeaturesbran hesand pumpingequipment andtanksmultiply,theminimization

of energy resour es 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 on ern of resear h in this area is redu ing theenergy onsumption and/or osts

(24)

1.2 Obje tives

Water supplysystems present highenergy onsumption values due to thepumping

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

present situation, thepumping systemsare a tuated when water levels on water towers

rea h predened minimum values. Thispro edure does not take into a ount the time

of dayand the variable ostof energy duringtheday. Theoptimisation of thepumping

pro edure, typeofpump,management andlogisti relatingenergy ost,depositand

pip-ingsystemdimensions ouldredu eoperating ostsofwatersupplysystemsinadrasti

way. Thisthesisispartofa urrenteorttodevelopasoftwarethat,throughmodulation

of a Water Supply System andmathemati al tools, an predi t onsumptions, optimize

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

Themain goal ofthe present work is to rea h ost redu tions onwaterdistribution

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

softwareable todisplay the resultsof theoptimisation pro essesto a user.

1.3 Outline of the thesis

Thepresent workisdividedinthreemain parts. Therstpart, "Guidelines",isdivided

intwo hapters. The rst hapterpresentsan introdu tion to thetheme of workof this

proje t, as well as des ribe the obje tives of said proje t. The se ond hapter of the

rst part is a bibliographi al review of themes relevant to this proje t. This hapter is

dividedinvese tions. Intherstispresentedareviewofpreviousworksonthesubje t.

The se ond se tion presents information about Water Supply Systems, while the third

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

Thefourthse tionisareviewonmathemati al optimisation ,and thefth se tiongives

a reviewof Human Ma hine Interfa e development. In the se ond part of this proje t,

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

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

solutionusedtomodelWaterSupplySystem. These ond hapterdividedintwose tions,

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

thelast hapterpresentsthesolutionusedtodeveloptheHumanMa hineInterfa e. The

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

se tions,displaystheobtainedresultsoftheproje t. Therstse tionpresentstheresults

of optimisation of mathemati al ben hmarks, while the se ond se tion presents results

for Water Supply System ben hmarks and the third se tion presents the nal Human

Ma hineInterfa e. Onthese ond hapter of this part on lusionsfrom this proje t are

(25)

State-of-the-Art Review

2.1 Introdu tion

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

se torsofso iety. Thesemajor ostsofthesesystemsareusuallyasso iatedwithpumping

osts [3℄, leaving room to improvement on ost e ien y with pump s heduling. To

obtain the ostsof thevariations ofpump s heduling, the usageof hydrauli modelling

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

the behaviourof WSSmore a urately. Water SupplySystem and hydrauli simulation

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

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

pumps heduling ontrolsthatminimize ostasso iatedwithenergy oststhatoftenare

asso iated withtime ofday. Thework of Bagirov etal. [4℄ introdu ed the useof pump

start/endruntimesas ontinuousvariables,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 usedsu essfully anhybrid GA ombined with

the Hooke and Jeeves Hill- limber Method[5℄ improving onvergen e 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 ℄ s heduled the pumping of ground-water taking into a ount

an e o-aware approa h to ground-water pumping, s heduling pumping while trying to

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

ofbinaries,allowing representation offra tionsoftimeintervals. Thehydrauli problem

usedto testthe proposedsolution isformulated asadis rete- aseoptimisation problem.

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

Dynami Programming Algorithm (RDPA) formulation, redu ing omputational time

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

asso iated with pumps. To display the data obtained from the optimisation pro ess to

the user of the software proje ted at theoverall proje t exist the need of development

of interfa e between the ma hine and theuser(Human Ma hineInterfa e). A reviewof

(26)

2.2 Water distribution systems

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

population. Therefore,itsimportantto present the hara teristi sofWSS. Water

distri-bution systems anhave bran htype layouts, looplayouts ora mixof thetwo types. In

water networksof the bran hed type the water ows in a singledire tion, from tank to

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

networksnodesare onne ted makingagridandare hara terized byenablingthewater

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

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

this type of network is thelowerwater velo ity inea h pipe onsidering that there are

multiple pipesleading to ea h node[8℄.

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

throughout the various nodessequentially.

Awater distribution systemtypi ally in ludes:

1. Reservoirs

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

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

during thetime ofstudy.

(b) Ofxed level. This ategory in lude rivers, lakesor dams. Theseare usually

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

water level does not have signi ant 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 lo ations in the

networkinordertoover omepipingheadlossesand/ortosurpassphysi alelevation

dieren es (like pumping water to anelevated tank). Two types of pumps an be

usedinwater distribution networks, su has:

(a) Fixedspeed pumps. Themotor of thepumpremainsat axed speed

regard-lessof external fa tors.

(b) Variablespeed pumps. Themotor is onne tedto avariablespeed ontroller,

whi h ontrolstherotationofthepump. Thistypeofpumpsaremoreexible,

beingusedinmore appli ations.

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

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

of the networks.

4. Nodes. Jun tion points, usually onne ting two or morepipes. Canbea dead-end

of a single pipe. Apart from the jun tion use, nodes an have onsumption rates

asso iated orinje t inows (also referredasnegativedemands).

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

2.2.1 Fri tion losses

During thepassage of water through thepipes, the fri tionbetween water and thepipe

(28)

approa hespresented:

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

Dar y-Weisba h formula,usable inall liquidsand owregimes.

Chézy-Manning formula, usable onopen ondu tproblems.

Theformulaefor the al ulationof ea happroa his presented intable2.1.

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

ubi metersperse ond) [8℄.

Formula Headlossdueto fri tion

Hazen-Williams

h

L

= 10.7C

−1

.852

d

−4

.871

LQ

1

.852

Dar y-Weisba h

h

L

= 0.083f (ε, d, Q)d

−5

LQ

2

Chézy-Manning

h

L

= 10.3n

2

d

−5.33

LQ

2

Notes:

C =

Hazen-Williamsroughness oe ient

ε =

Dar y-Weisba h roughness oe ient

f =

fri tion fa tordependent of

ε

,

d

and

Q

n =

Manning roughness oe ient

d =

pipe diameterin

m

L =

pipelength in

m

Q =

owrate in

m

3

/s

2.3 Hydrauli simulation

Simulationsoftware onsistof omputerbasedprogramsthatallowmodelling,simulation

andanalysisofsteady-state andtransientsystems,thusallowingtoobserveanoperation

without a tually performing it. Hydrauli simulators model thesystem and its

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

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

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

easierandqui ker,redu ingproje ttimeand ostandensurethefeasibilityoftheproje t.

Theseallowalso theimprovement of existingsystems,providingpossibleimprovements,

and area important toolwhile studyingthebehaviourof thesystem.

Thehydrauli modelofa simulation isan aggregationof hydrauli omponents,

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

Thephysi alphenomenaarebasedinma ros opi parameters,whi hin ludebutarenot

limitedto:

height of node;

distan eto node;

(29)

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

understanding of thehydrauli system.

Allof these hara teristi s prove ofgreat relevan e asthey endow:

optimisation of hydrauli networks, when undertakingproje tdesign;

assessment of performan e of anexistingnetwork, helping to ndproblems.

2.4 Mathemati al optimisation

Nowadaysinengineeringitisofuttermostimportan eto onsider ostandenergy

redu -tion whenproje ting apro ess. Toimprove these redu tions,optimisation methods an

beapplied.

Optimisation pro esses onsist of obtainingthe best onditions to operate a pro ess, in

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

are used ina broadrange of appli ations, su h asme hani s, e onomi s and ontrol of

industry operations.

Optimisationproblemsoften onsistofanattempttomaximizeorminimizea

mathemat-i al fun tion, alledinoptimisation theoryasobje tivefun tion. Theobje tive fun tion

andependofoneormorevariables. Insome asesthemathemati al fun tionasso iated

witha pro ess is unknown. These ases are usually asso iated with physi al pro esses,

and the mathemati al fun tion that represent them are omplex. These types of

prob-lemsare alledbla k-boxproblems. Onthis ase,rea hingtheoptimalsolutionbe omes

harder asthe la kof a lear mathemati al fun tion blo ksa ess to helpfulinformation.

Figure 2.3 displays a s hemati of the pro ess followed bybla k-boxoptimisation. The

optimisation algorithmsendsthe optimisation variables tothebla k-boxsoftware. After

al ulation of the obje tive fun tion and onstraints, the bla k-box software sends the

obje tivefun tion valueand onstraint valuesto theoptimisation algorithm. This y le

repeats until a dened stopping riteria isrea hed.

Figure2.3: S hemati displayof thepro esses involved inthea bla k-boxoptimisation.

Obje tive fun tions an be linear or non-linear, and an be dierentiable or

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

applied.

Torea hthe bestresult,variablesintheobje tivefun tionare hanged. Theseareknow

(30)

thresholdsorrequisitesthatmustbeveriedinthepro essbeingoptimized. Thegeneral

optimisation problem anbe formulated by:

minimize

f (

x

)

subje t to

h(

x

) = 0

g(

x

) ≤ 0

x

min

i

<

x

i

<

x

max

i

,

(2.1)

where

f (

x

)

istheobje tivefun tion,

i = 1, · · · , n

isthenumberofoptimisationvariables,

h(

x

)

areequality onstraints and

g(

x

)

areinequality onstraints, respe tively.

2.4.1 Classi al algorithms

Classi aloptimisationmethods an usedierential al ulus, usingthegradientofa

fun -tionto rea hthe obje tive. Thistype of lassi alalgorithmsofoptimisation anonly be

usedto ndthe optimalsolutionof ontinuousanddierentiable fun tions. Solutionsof

unknown fun tions(bla k-boxproblems) or of not dierentiable fun tionsareharder to

solve withthese methods.

Thesemethodsguaranteethatthesolutionfoundisexa t,butdoesn'tguaranteethat

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

whi hhasthreelo almaximums(pointsA,CandE)andtwo lo alminimums(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 lo al minimum. Additionally, the use of dierent

starting pointsinmultiplerunsof thealgorithm an leadto dierent results. Therefore,

theuseof thesemethods innon- onvexfun tionsis hard toimplement and dis ouraged.

Figure 2.4: Representation of a multiple lo al minima and maxima fun tion. Thistype

(31)

2.4.2 Modern algorithms

Metaheuristi algorithmsaredenedas omputationalmethodsthatuseiterationsto

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

of arandomelement allows thesear hfor theoptimalsolution throughoutthewhole

so-lution spa es. Some metaheuristi methods implement formsof sto hasti optimisation.

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

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

the ase ofa better solution, theprevious iterationis dis arded. Metaheuristi methods

areusedto solve omplexoptimisationproblems. Thesemethodsarere ognizedassome

ofthemostpra ti alapproa hesto omplexproblems,espe iallyfor real-worldproblems

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

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

metaheuristi methodsarebasedina ombinationoftherandomsear hmethodandthe

sto hasti hill- limbingmethod[10℄. Therandomsear hmethodstrategyistotrya

solu-tionfromthesolutionsear hspa eusingauniformprobabilitydistribution. Thestrategy

usedbythesto hasti hill- limbingmethodisrandomlysele ting aneighbour andidate

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

metaheuristi methods exist, with the sear h pro ess varying to ea h one. Sto hasti

algorithms arebased on probabilisti and sto hasti pro esses. Sto hasti pro esses are

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

output. A deterministi modelwill always produ e thesame output from agiven

start-ing ondition or initial state. The dieren e between Sto hasti Algorithms and other

algorithms basedonprobabilisti andsto hasti pro essesis thatSto hasti Algorithms

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

and userandom variables.

Evolutionaryalgorithmsareinspiredinbiologi alevolution,andusesme hanismsrelated

to itinorder to approa h a solution. Thisme hanisms in lude mutation, reprodu tion,

sele tion and re ombination. Solutions are obtained using the mentioned me hanisms

andevaluatingatness fun tion. Another metaheuristi optimisation method,the

phys-i al algorithmsareinspiredinphysi al pro esses,ranging fromsystemsfrommetallurgy,

musi , interplay between ulture and evolution and omplex dynami systems su h as

avalan hes[11℄. Probabilisti Algorithmsarethosethatuseprobabilist modelstomodel

problems orto sear h problemspa es. Thesealgorithms usetheresultofarandom

de i-sion based on probabilisti distribution insteadof al ulating thebest solution. Swarm

algorithms are adaptive strategies inspired in olle tive intelligen e. Colle tive

intelli-gen eappearsasathe ooperationofmultipleindividualagentstorea ha ommongoal.

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

agentsforms a swarm.

Immune algorithms are a part ofthe Arti ial Immune Systemsstudy, whi h is a lass

of omputational intelligent systems inspired by the pro ess and me hanisms of the

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

use of arti ial neural networks, wit h are omposed of pro essing elements, alled

ar-ti ial neurons. Arti ialneural networks an have omplex global behaviours,as they

areae ted bythe onne tions between thepro essing elementsof thenetwork and the

element parameters. The neural algorithm adapts the weights of onne tions between

(32)

2.5 Human Ma hine Interfa e

A Human Ma hine Interfa e (HMI) is what allows intera tion between a human and a

ma hine. Their useiswidespread from industrialuse, asinthes reensof ma hinery, to

dailypersonaluse,like theinput buttonsofa mobilephone. Two typesoffun tions an

bepresent:

theinputfromthehumanusertothema hine,toallowadjustmentstothema hine or to request outputs;

thedisplayof outputfromthema hineto theuser, to,asanexample, allow infor-mationfrom the ma hineto bevisible to theuser.

2.5.1 Histori al review

Human ma hine interfa es start in history as a ne essity of the users to intera t with

theinitial digital omputer. At therst timesof omputerusage, omputingpowerwas

very limited and expensive. For this ma hines, interfa es were rudimentary, onsisting

of pun hed ards or equivalent asinputand line printers asan output. The intera tion

between user and ma hine waslimited to the systemoperator onsole. The rst bat h

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

[12 ℄. CommandLineInterfa es(CLIs)appearedasanevolutionfrombat hmonitorsthat

were onne ted to thesystem onsole. Thismodel intera tedwiththema hinethrough

seriesofrequest-responsetransa tionsusingspe ializedlanguageto expresstherequests

to the ma hine. The time of pro ess for this type of intera tion dropped signi antly

from the previous results withthe bat h system[12 ℄. From theappearan e of oN-Line

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

therstGUI developed at XeroxPARC, whi husedwindows,i ons, andpop-upmenus

[14 ℄,andwhoseworkin luded thedevelopment oftheGypsy,therstbitmapWhatYou

See Is What You Get (WYSIWYG).

Applepi kedupthe workfromXeroxPARCanddevelopedAppleLisa,in1979,therst

personal omputeroering aGUIthat wasdire tedat individual businessusers.

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

The Mi rosoft Windows beneted gratly with this development, and introdu ed 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 ommer ial development,

leading to the appearan e of the Windows 95 and the Ma OS, the pre ursors of the

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

on portable devi es and tou h-s reen interfa es, related with the in reasing use of ell

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

interfa e, allowing the userto intera t without tou hingthedevi e.

2.5.2 GUI Development

TheGUIdevelopment isusually aidedbytheuseofinterfa e builders(orGUIbuilders),

whi h aresoftware development tools thatease the pro ess of reation. These software

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

(33)

the interfa e must be built by ode. This methods does not give visual feedba k until

the ode isexe uted, impairingdesign on lessexperien edprogrammers.

Someoptions of softwarefor GUI development in lude:

Visual Studio

VisualstudioisanIntegratedDevelopmentEnvironment(IDE )fromMi rosoft. An

IDEisasoftwarethatprovidestoolsforsoftwaredevelopment,normally onsisting

of sour e 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 GUIappli ations, aswellas Windows Form appli ations andweb sites,

appli- ationsandservi es. It analsodevelopWindowsPresentationFoundation(WPF )

appli ations. 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, Javas ript 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, su h as

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

allowing usebydevelopers,in luding to developproprietarysoftware[18 ℄.

Qt

Qt is a multi-platform appli ation and User Interfa e (UI) framework from Digia

for developersthatusesC++ orQML. Itis widelyusedto develop software

appli- ationswithGUIs andalso to developnon-GUI appli ations withfeatureslikele

handling, database a ess, Extensible Markup Language (XML) parsing, thread

management andnetwork support[19 ℄. Qt anbeusedunderopensour e(Library

General Publi Li en e (LGPL )v2.1)or ommer ial terms[20 ℄.

wxWidgets

wxWidgetsisafreeandopen-sour emulti-platformC++library,withbindingsfor

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

is urrently li ensedunderthe"wxWindows Li en e". The wxWindowsLi en e is

essentiallytheLGPL ,withanex eption statingthatderivedworksinbinaryform

maybe distributedonthe user's own terms[22 ℄.

2.5.3 Chara teristi s

ThedesignofaGUIis hallengingasithassomeimportant hara teristi sthatitshould

attendtosu hasfun tionality,a essibility,pleasuretouseandmustbelogi altoprovide

qui klearningtonewusers. ApoorGUI anundermineagoodwork,renderingituseless

or unsatisfying ifitsinterfa e is frustrating to the user.

To rea h a good interfa e design, a number of hara teristi s should be taken into

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

an't understand how to work withtheinterfa e, it be omes impra ti al. The interfa e

(34)

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

if su eeded it makes the whole experien e of the user more enjoyable. The interfa e

should be ableto handlemistakes,bothfrom theuser andthesoftware. And nallythe

interfa e should be a way for the user to a omplish their tasks instead of being a list

of possible fun tionsto beused, meaning theinterfa e should be e ient inthegoals it

(35)
(36)
(37)

Proposed solution

The present thesis intends to a hieve ost redu tions asso iated withwater pumping in

WaterSupply System. The general optimisation problem asso iated with thisobje tive

an bedes ribed as: minimize

f (x),

subje t to

h(

x

) = 0,

g(

x

) ≤ 0,

x

min

i

<

x

i

<

x

max

i

,

(3.1)

where

f (

x

)

istheobje tivefun tion,

i = 1, · · · , n

isthenumberofoptimisationvariables and

h(

x

)

and

g(x)

areequalityand inequality onstraints, respe tively.

Inorderto a hieve this obje tive,the proposed solutionin ludes:

the EPANET software, that produ es 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 ea h algorithm iteration, produ e thenew simulation and obtain

thenew resultsfor operating osts;

Use a HMI to give the user all informations on erning the hanges made to the pump s hedule and operation osts, as well as generi informations from the

net-work,su h aswaterlevelat tanks.

A s hemati of the pro ess an be seen in gure 3.1. The pro ess starts with a le

ontainingthenetwork hara teristi s. Thisle anbe reatedbytheEPANETsoftware,

but is a pro ess 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 produ es information sent to

the optimisation. This data is the value of the obje tive fun tion and the onstraints

information fromthelatestsimulation. Aftertheoptimisationpro ess,thenewvariables

produ ed aresent to thestored dataused bythe EPANET simulation. This y leruns

(38)

Figure3.1: S hemati displayof the pro essesinvolved intheproposedsolution.

3.1 Optimisation problem formulation

Onthepresentworktheoptimisationproblem onsistsintheredu tionof ostsasso iated

with water pumping in Water Supply System, thus being the obje tive fun tion. 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

numberofvariablesis48forea hpump,i.e.,forea htime-steptwooptimisationvariables

are asso iated to ea h pump, orresponding to the pump speed and theoperation time.

The obje tive fun tion is al ulated using the software EPANET. As there isno a ess

to the fun tion from EPANET that al ulates the osts, the optimisation problem is a

bla k-boxproblem.

Theoptimisation problem an berepresentedby:

minimize

f (

x

) =

Energy ost

,

subje t to

h(

x

) = 0,

g(

x

) ≤ 0,

x

min

i

<

x

i

<

x

max

i

,

(3.2)

where

f (

x

)

is the obje tive fun tion,

i = 1, · · · , n

is the number of optimisation variables,thatin ludethepumptimefra tionandtherelativevelo ityofthepump,

h(

x

)

areequality onstraintsand

g(

x

)

areinequality onstraints. TheEnergy ostfun tionis al ulated as: Energy ost

=

totalsteps

X

i=1

totalpumps

X

j=1



Energy

i,j

×

Pri e

i

 +

FixedCost

,

(3.3)

where the Energy for ea h time step,

i = 1, · · · , totalsteps

and for ea h pump

j =

1, · · · , totalpumps

,is al ulated as: Energy

i,j

= P

i,j

× t

i

,

(3.4)

with

P

beingthe powerat the orrespondent timestepfor pump

j

and

t

thedurationof thepumpa tivation. The poweris al ulated with:

P

i,j

=

ρgH

i,j

Q

i,j

η

i,j

(39)

being

ρ

thewaterdensity,

g

the standard gravity,

H

thepumphead atthe urrent time step (in meters),

Q

the ow rate and

η

is the pump e ien y for pump

j

. The xed ostsof the energy ostfun tion is al ulated with:

Fixed ost

=

totalpumps

X

j=1

P

j

,max

×

Demand harge

,

(3.6)

withthedemand hargebeingthe additionalenergy hargepermaximumkilowattusage.

Thepumphead is al ulatedusing:

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 shifteda ordingto:

Q

1

Q

2

=

N

1

N

2

H

1

H

2

=



N

1

N

2



2

,

(3.8)

with

N

1

and

N

2

thestandardandthenewspeed,respe tively. Theoptimisationvariables are onstrained by

0 <

x

i

< 1.

For thevariables of time, thepump timefra tion isdened at ea h time step. For this

variable,0 orrespondstopumpworkingfor 0minutesand1tothepumpworkingfor60

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

equation:

time

=

x

i

× 60.

For thevariablesofpumpspeed,0 orrespondsto pumprelativevelo ityof

ω = 0.5

and 1 orresponds to

ω = 2

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

ω = 0.5 + (

x

i

× 1.5).

Theoptimisation problemis subje ted to the following equality onstraint:

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 levelofea h tank

j

. Theoptimisation problemis subje ted to thefollowing inequality onstraint:

g1(

x

j

) = L

j

− L

j,max

≤ 0

j = 1, . . . , t,

(3.10)

g2(

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 ea htank

j

.

(40)

3.2 EPANET hydrauli simulator

The al ulation of the obje tive fun tion of the problem formulated at 3.2 is made by

EPANET.EPANETisan hydrauli andwater qualitysimulationsoftware developed by

the United States Environment Prote tion Agen y (EPA) and released in 1993. This

softwareallows thesimulationof extendedperiod simulations, both stati and dynami .

EPANET tra ks 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 bein luded in otherprograms.

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

model networkswithnosize restri tion;

model onstant or variablespeed pumpswith anasso iated urve of fun tion;

model various typesof valves;

in lude minor head losses for bends, ttings,et ;

allowvariations ofdiameter withheight instoragetanks;

asso iate demandpatternsto ea h individualnode;

al ulate pumping energy and ost;

al ulatesystemoperationsbasedonsimpletanklevelortimer ontrolsorbaseon omplex rulebased ontrols;

al ulate fri tion headloss using the Hazen-Williams, Dar y-Weisba h or Chezy-Manningformulas.

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

needs the solving of the equation for the onservation of ow at ea h jun tion and the

headloss a ross ea h link of the water network. These equations gives the hydrauli

balan e 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

balan e.

3.2.1 Gradient Method for the solution of hydrauli systems

EPANETusesanapproa h fromTodiniandPilati(1988)[25 ℄ tosolvetheequationsthat

hara terize the hydrauli balan eof thenetwork. Thisapproa his presented next.

Theow-headlossrelation ina dened pipebetween thenodesiand jisgiven by:

H

i

− H

j

= h

ij

= rQ

n

ij

+ mQ

2

ij

,

(3.12)

where

H

is the nodal head,

h

is the headloss,

r

is the resistan e oe ient,

Q

is the ow rate,

n

is the ow exponent and

m

is the minor loss oe ient. The value of the resistan e oe ient is dependant of the fri tion headloss formulabeing used. The

headloss for pumps an be representedby

h

ij

= −ω

2

(h

0

− r(

Q

ij

ω

)

n

),

(41)

inwhi h

h

0

is thehead of shut-o for thepump,

ω

isa relative speed setting, and

r

and

n

arethe pump urve oe ients.

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

arethe ow ontinuityequations for allnodes:

X

j

Q

ij

− D

i

= 0

for

i = 1, . . . N,

(3.14)

in whi h

D

i

is the ow demand in the node

i

. By onvention, the ow into a node is positive. The obje tive of the balan e is to nd heads

H

i

and ows

Q

ij

that satisfy equations 3.12 and3.14.

Thegradientmethodstartswitharstestimateofowsinpipesthatmaynotsatisfy

ow ontinuity. Fromea hiterationthenewnodalheadsareobtainedsolvingthematrix

equation:

AH

=

F

,

(3.15)

whereAisan

(N × N )

Ja obian matrix,Hisan

(N × 1)

ve tor ofunknownnodalheads and Fisan

(N × 1)

ve tor of right hand sideterms.

Thediagonal elements oftheA matrix aregivenby:

A

ii

=

X

j

p

ij

,

(3.16)

and thenon-zero o-diagonal elements aregiven by:

A

ij

= −p

ij

,

(3.17)

where

p

ij

istheinversederivativeoftheheadlossinthelinkbetween therespe tivenodes nodeswithrespe tto ow. For pumps,

p

ij

isgiven by

p

ij

=

1

2

r(

Q

ij

ω

)

n−1

,

(3.18)

whilefor pipes

p

ij

isgivenby

p

ij

=

1

nr|Q

ij

|

n−1

+ 2m|Q

ij

|

.

(3.19)

TheF ve tor onsistsof netowimbalan es atthe node added to a ow orre tion

fa tor:

F

i

=

X

j

Q

ij

− D

i

+

X

j

y

ij

+

X

f

p

if

H

f

,

(3.20)

inwhi hthe lastterm oftheequationappliesto anylinksthat onne tnode

i

toaxed grade node

f

. The ow orre tion fa tor

y

ij

forpipes isgivenby:

y

ij

= p

ij

r|Q

ij

|

n

+ m|Q

ij

|

2



sgn

(Q

ij

),

(3.21)

and for pumpsit isgivenby:

y

ij

= −p

ij

ω

2



h

0

− 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, hen e this term is omitted in the equation of pumps. After the al ulation of

new headsbysolvingequation 3.15thenew ows are al ulated using:

Q

ij

= Q

ij

− (y

ij

− p

ij

(H

i

− H

j

)) .

(3.23)

The results are tested against a pre-determined toleran e of the sum of absolute ow

relative to the totalowinalllinks. Ifthetoleran eis notrespe ted, 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,owinapipeisassumedtobeequaltotheow orresponding

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

design owspe i ofthepump;

3. Theresistan e oe ientforapipe(

r

)is al ulatedbasedononeofthreedierent approa hes, on retely:

Hazen-Williams formula.

Dar y-Weisba h formula.

Chézy-Manning formula.

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

inse tion 2.2.1 .

4. The minor loss oe ient dened in order of velo ity head

K

is onverted to a ow-based oe ient withthefollowing equation:

m =

0.02517K

d

4

.

(3.24)

3.3 Sele ted optimisation algorithms

Tosolvetheoptimisationproblemformulatedat3.2twodierentalgorithmsareproposed.

TheLimitedMemoryAlgorithmforBoundConstrainedoptimisation(L-BFGS-B),a

las-si alalgorithm andthe

ε

ConstrainedDierential Evolution (

ε

DE ),a modernalgorithm. Both algorithmsarepresentedinthenext two se tions.

3.3.1 LimitedMemory AlgorithmforBound Constrainedoptimisation

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

non-linearoptimisationproblems,inwhi htherearesimpleboundsontheproblemvariables

[26 ℄. The problemon thisalgorithm is formulated as

minimize

f (

x

)

subje tto l

<

x

<

u

,

(43)

where

f : ℜ

n

−→ ℜ

isanon-linearfun tionwithanavailablegradientfun tiong,inwhi h

the ve torsl andu represent thelower andhigher boundsof thevariables,respe tively,

and the number of variables,

n

, is assumed to be large. The gradient fun tion g is ontinuous.

Theformulatedoptimisationproblemissubje tedtothefollowingequality onstraint:

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 ofea h tank

j

. Theoptimisation problemis subje ted to thefollowing inequality onstraint:

g1(x

j

) = L

j

− L

j,max

≤ 0

j = 1, . . . , t,

(3.27)

g2(x

j

) = L

j

− L

j,min

≥ 0

j = 1, . . . , t,

(3.28)

with

L

j

being the urrent water level,

L

j,max

the maximum admitted level and

L

j,min

theminimumadmitted level for ea htank

j

.

Themathemati aldes riptionofthealgorithmwasdes ribedbyit'sauthors,Ri hard

H.Byrdetal. in1994[26 ℄. Forthisalgorithm,thegradientfun tiongis al ulatedusing

a nitedieren e method alled the forward dieren e, whi h isrepresentedby:

h

[f ](

x

) = f (

x

+ h) − f (

x

).

(3.29)

Thederivative offun tion f at xisgiven by:

f

(

x

) = lim

h→+∞

f (

x

+ h) − f (

x

)

h

.

(3.30)

For smallh and

h 6= 0

theforward dieren emethodapproximatesthederivativeof

f (

x

)

as:

f

(

x

) ≈

f (

x

+ h) − f (

x

)

h

=

h

[f ](

x

)

h

.

(3.31)

The onstraintsfromtheformulatedoptimisationproblemareaddedtothealgorithm

using theexteriorpenalties method,whi h penalises theobje tive fun tion 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 obje tive fun tionafterpenalization,

f

istheobje tive fun tionprior to penalization,

r

h

is the oe ient for the equality onstraints and

r

g

is the oe ient 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 dieren es introdu ed in the ode was the

implementation ofa onstraint handlingmethodbasedontheexteriorpenaltiesmethod,

referred above. Further in lusions in this ode in lude the gradient al ulation for the

obje tivefun tion,basedonthenitedieren emethodoftheforwarddieren es. These

(44)

3.3.2

ε

Constrained Dierential Evolution

Being a part of the Sto hasti Dire t Sear h methods, Dierential Evolution (DE ) is

from a eld of Evolutionary Computation, being related withmethods su h asGeneti

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

non-linear, non-dierentiable ontinuousfun tion optimisation [11℄.

DE algorithmshave a population of andidate solutions,whi h areused trough

iter-ations of re ombination, evaluation andsele tion to a hieve theoptimal result.

There ombinationof andidate solutions is basedintheweigheddieren e between

two random sele ted andidates (ve tors b and ) added to a third andidate solution

(ve tora). Theresulting andidateismutatedwitha rossingve tori. Afterthispro ess,

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

the hild andidate repla es the father in the population of andidate solutions. With

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

ea h iteration will be high. As the solution onverges, the hanges be ome smaller as

the distan e between the andidates sele ted for subtra tion (b and ) are smaller. To

noteaswellisthe fa tthatthesele tioninthismethodismadeafterthere ombination

iterations makingthis asurvivalsele tion insteadof having parent sele tion.

Asimpleimplementation ofaDEisshowbelowinalgorithm1. Inthepresented ase

thepopulationistreated asave tor to improve learness ofthe ode.

The ne essity of guaranteeing water level onstraints in the WSSproblems leads to

addi tionof onstraint manageto DEalgorithm. Thealgorithm proposedbyTakahama

andSakai[27 ℄,whi hisusedinthiswork,addressesthisproblemaddingthe

ε

onstrained method to the standard DE algorithm. The

ε

ontrained method uses onstraint viola-tions,

φ(x)

wi his given by[27℄

φ(x) = max {max {0, g

j

(x)} , max |h

j

(x)|} ,

(3.33)

φ(x) =

X

j

k max {0, g

j

(x)} k

p

+

X

j

kh

j

(x)k

p

,

(3.34)

with

p

being a positive number. The

ε

level omparison denes the order relation of a pair of obje tive fun tions, value and onstraint violation (

f (x), φ(x)

). The

ε

level omparison denestheorderofpre eden eof

φ(x)

over

f (x)

,be ausethefeasibilityof

x

ismoreimportantthantheminimizationof

f (x)

. For

f

1

, f

2

and

φ

1

, φ

2

beingthefun tion valuesand onstraint violations at thepoint

x

1

, x

2

the

ε

level omparison for any

ε ≥ 0

the

<

ε

and

ε

between

(f

1

, φ

1

)

and

(f

2

, φ

2

)

aredened as:

(f

1

, φ

1

) <

ε

(f

2

, φ

2

) ⇔

f

1

< f

2

,

if

φ

1

, φ

2

≤ ε,

f

1

< f

2

,

if

φ

1

= φ

2

,

φ

1

< φ

2

,

otherwise

,

(3.35)

(f

1

, φ

1

) ≤

ε

(f

2

, φ

2

) ⇔

f

1

≤ f

2

,

if

φ

1

, φ

2

≤ ε,

f

1

≤ f

2

,

if

φ

1

= φ

2

,

φ

1

< φ

2

,

otherwise. (3.36)

Forthe aseof

ε = inf

the omparison isequivalenttoordinary omparisons. For the ase of

ε = 0

the omparison orders the onstraint violation

φ(x)

pre edes de fun tion 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 ve tor),of length

popsize

4:

Q1 ← 

Theparents. Ea h parent

Q

i

wasresponsiblefor reatingthe hild

P

i

5: for

i

from 1to

popsize

do

6:

P

i

New random individual 7: end for

8:

Best ← 

9: repeat

10: for ea h individual

P

i

∈ P

do 11: AssessFitness

(P

i

)

12: if

Q 6= 

and

F itness(Q

i

) > F itness(P

i

)

then

13:

P

i

← Q

i

Retaintheparent, throwawaythekid

14: endif

15: if

Best = 

or

F itness(P

i

) > F itness(Best)

then

16:

Best ← P

i

17: endif

18:

Q ← P

19: forea h individual

Q

i

∈ Q

do

Wetreat individuals asve torsbelow 20:

a ←

a opy of an individual other than

Q

i

, hosen at random with repla ement fromQ

21:

b ←

a opyof anindividual otherthan

Q

i

or

a

, hosenat random with

repla ement fromQ

22:

c ←

a opy of an individual other than

Q

i

,

a

or

b

, hosenat random withrepla ement from Q

23:

d ← −

a + α(

b − −

c )

Mutationis justa arithmeti ve tor 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 appli ation of the

ε

DE algorithm in thewater supply systems tested during the present work, violations arisefromthe non-observan eof theequation of ontinuity

of water level.

if

L

i,f inal

− L

i,initial

6= 0 ⇒ v1

i

= L

i,f inal

− L

i,initial

, ∀i = 1, . . . , t.

(3.37) Theviolation

v1

isthedieren ebetweentheinitiallevel

L

initial

andthenallevel

L

f inal

of ea htank

i

.

Violationsariseaswell fromdisrespe tof maximum tanklevels:

if

L

i

− L

i,max

> 0 ⇒ v2

i

= L

i

− L

i,max

, ∀i = 1, . . . , t.

(3.38) aswell asfromdisrespe tofminimumtank levels:

if

L

i

− L

i,min

< 0 ⇒ v3

i

= L

i

− L

i,min

, ∀i = 1, . . . , t.

(3.39) The violations

v2

and

v3

are the dieren e between the a tual water level,

L

i

, and themaximumlevel

L

i,max

orminimumlevel,

L

i,min

,respe tively,forea h time-step

i

.

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

3.40).

v

i

= v1

i

+ v2

i

+ v3

i

, ∀i = 1, . . . , t.

(3.40) Fortheimplementationofthisoptimisation algorithm aC++ ode,witharound900

linesofdeveloped ode. Thedeveloped odewasbasedinaC odefromtheauthorofthe

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

ex-ternallibraries, allowingthe al ulationofboththeobje tivefun tionandthe onstraint

violations neededto the optimisation bythis algorithm.

3.4 Optimisation variables aggregation

Inthepresentedmethodologyanewapproa hwasfollowedinordertoredu ethenumber

ofoptimisationvariables,simplifyingthe optimisationproblem. Thisapproa h onsisted

inagglomerationoftheoptimisationvariablestakingintoa ountthewaterdemandsand

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

thatboth waterdemandandenergytariremain onstant,thenthe orrespondent

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, mo k-up design and nal design. The idea for this GUI

wastorea hatransparentandeasytounderstandinterfa e. Learningtimefornewusers

(47)

other software to ease user experien e. To a hieve this, the solution found intended to

present results ina tabular s heme, ea h tab presenting dierent data. With theuseof

softwareBalsamiq Mo kups,theinitial mo k-upsweredeveloped. Ingure3.2theinitial

s reenoftheGUIispresented. Inthiss reen,theusersele tthetypeofoptimisationand

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

thebutton start.

Figure3.2: Mo k-up oftheinitial s reen of theGUI

Ingure3.3thepump ontrols reenoftheGUIispresented. Inthiss reen,theuser

is ableto readinformation, graphi ally,about the ontrol ofthepumps.

Figure3.3: Mo k-up ofthe pump ontrol s reen of theGUI

Ingure3.4the pump ontrols reenoftheGUIispresented. Inthiss reen,theuser

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

(48)

Figure3.4: Mo k-upof the waterlevel s reen oftheGUI

Ingure3.4the pump ontrols reenoftheGUIispresented. Inthiss reen,theuser

is ableto readinformation about the ostredu tions rea hed bythealgorithm used.

Figure3.5: Mo k-upof thenalresults s reen oftheGUI

3.6 Developed GUI

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

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

ease onne tion withthe algorithms ode,whi h wasdeveloped usingthesame software.

Basedonthemo k-upspreviouslymade,presentedinse tion3.5 ,theGUIdeveloped

(49)

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

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

be omes a tive. After the user presses the start button, the optimisation takes pla e.

Thispro ess an be stopped at anytime pressing the buttonat thebottom right of the

GUI. Atthesamelo ation,existsaprogressbar,allowingtheusertoa esstheprogress

of the optimisation.

Figure 3.6: Interfa eStarting page

Aftertheoptimisationisnished,thetabsPUMPCONTROLS(gure3.7 ),WATER

LEVEL (gure3.8 ) andESTIMATED SAVINGS (gure3.9). ThebuttonSAVE,whi h

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

whi hopensthe reportle reatebyEPANET also be omea tive.

Figure3.7showsthe tabPUMP CONTROLS, wheretwobar plotsdisplaytheusage

of the pump, both with usage time and pump velo ity. The existen e of more pumps

reates moretabs, one for ea hpump.

Figure3.8showsthetabWATERLEVEL,wherethewaterlevelofatankisdisplayed

throughtheuseofa hart. Theexisten eofmoretanks reatesmoretabs, one forea h

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: Interfa e Pump ontrol page

(51)

Figure3.9: Interfa e Estimated savingspage

Theuser anstartanotheroptimisation,bysimplysele tinganotheroptionatSTART

(52)
(53)
(54)

Imagem

Figure 2.1: Branhed network model. In this type of network, the water is distributed
Figure 2.2: Loop network model. In this type of network, the water is distributed
Figure 2.4: Representation of a multiple loal minima and maxima funtion. This type
Figure 3.1: Shemati display of the proesses involved in the proposed solution.
+7

Referências

Documentos relacionados

Ousasse apontar algumas hipóteses para a solução desse problema público a partir do exposto dos autores usados como base para fundamentação teórica, da análise dos dados

didático e resolva as ​listas de exercícios (disponíveis no ​Classroom​) referentes às obras de Carlos Drummond de Andrade, João Guimarães Rosa, Machado de Assis,

Na hepatite B, as enzimas hepáticas têm valores menores tanto para quem toma quanto para os que não tomam café comparados ao vírus C, porém os dados foram estatisticamente

 Managers involved residents in the process of creating the new image of the city of Porto: It is clear that the participation of a resident designer in Porto gave a

“A diferença de juízo entre Sócrates e Górgias sobre o poder da retórica mostra como, do ponto de vista da construção das personagens, elas possuem valores absolutamente

Alguns ensaios desse tipo de modelos têm sido tentados, tendo conduzido lentamente à compreensão das alterações mentais (ou psicológicas) experienciadas pelos doentes

Além disso, o Facebook também disponibiliza várias ferramentas exclusivas como a criação de eventos, de publici- dade, fornece aos seus utilizadores milhares de jogos que podem