/
epanet.m
10760 lines (10669 loc) · 434 KB
/
epanet.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
classdef epanet <handle
%epanet EPANET-Matlab Class: A Matlab Class for EPANET and EPANET-MSX
%
% How to run: d=epanet('Net1_Rossman2000.inp');
%
% EPANET is software that models water distribution piping systems
% developed by the US EPA and provided under a public domain licence.
% This Matlab Class serves as an interface between Matlab and
% EPANET/EPANET-MSX, to assist researchers and the industry when
% solving problems related with water distribution systems.
%
% EPANET and EPANET-MSX were developed by the Water Supply and Water
% Resources Division of the U.S. Environmental Protection Agency's
% National Risk Management Research Laboratory. EPANET is under the
% Public Domain and EPANET-MSX under GNU LGPL.
%
% The latest EPANET files can downloaded by the *unofficial* channel
% https://github.com/OpenWaterAnalytics/epanet which is the most
% updated libepanet of the software
%
% Some part of the EPANET-Matlab Class are based on the epanet-matlab
% wrappers prepared by Jim Uber
% (https://github.com/OpenWaterAnalytics/epanet-matlab)
%
% EPANET-Matlab Class Licence:
%
% Copyright 2013 KIOS Research Center for Intelligent Systems and
% Networks, University of Cyprus (www.kios.org.cy)
%
% Licensed under the EUPL, libepanet 1.1 or - as soon they will be
% approved by the European Commission - subsequent libepanets of the
% EUPL (the "Licence"); You may not use this work except in
% compliance with the Licence. You may obtain a copy of the Licence
% at:
%
% http://ec.europa.eu/idabc/eupl
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the Licence is distributed on an "AS IS" basis,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
% implied. See the Licence for the specific language governing
% permissions and limitations under the Licence.
properties
Msxlibepanet;
MsxlibepanetPath;
MsxConstantsNameID;
MsxConstantsValue;
MsxConstantsCount;
MsxConstantsIndex;
MsxParametersCount;
MsxPatternsCount;
MsxSpeciesCount;
MsxLinkInitqualValue;
MsxNodeInitqualValue;
MsxFile;
MsxTempFile;
MsxParametersNameID;
MsxParametersIndex;
MsxParametersPipesValue;
MsxParametersTanksValue;
MsxPatternsNameID;
MsxPatternsIndex;
MsxPatternsLengths;
MsxPattern;
MsxEquationsPipes;
MsxSources;
MsxSourceLevel;
MsxSourceNodeNameID;
MsxSourcePatternNameID;
MsxSourcePatternIndex;
MsxSourceType;
MsxSourceTypeCode;
MsxSpeciesATOL;
MsxSpeciesIndex;
MsxSpeciesNameID;
MsxSpeciesRTOL;
MsxSpeciesType;
MsxSpeciesUnits;
MsxEquationsTanks;
MsxEquationsTerms;
NodeCoordinates; % Coordinates for each node (long/lat & intermediate pipe coordinates)
NodeJunctionCount; %Number of junctions
NodeCount; % Number of nodes
NodeReservoirCount; %Number of reservoirs
NodeTankCount;% Number of tanks
NodeTankReservoirCount; %Number of tanks and reservoirs
NodeTankDiameterUnits; % Units for tank diameters
NodeElevationUnits; % Units for elevation
NodeEmitterCoefficientUnits; %Units for emitter coefficient
NodeBaseDemands; % Base demands of nodes
NodeDemandPatternIndex; % Index of demand patterns
NodeElevations;% Elevation of nodes
NodeEmitterCoeff; %Emmitter Coefficient of nodes
NodeIndex; %Index of nodes
NodeInitialQuality; %Initial quality of nodes
NodeJunctionIndex; %Index of node junctions
NodeJunctionNameID; %Name ID of node junctions
NodeNameID; %Name ID of all nodes
NodeReservoirIndex; %Index of reservoirs
NodeReservoirNameID;%Name ID of reservoirs
NodesConnectingLinksID; %Name IDs of nodes which connect links
NodesConnectingLinksIndex; %Indices of nodes which connect links
NodeSourcePatternIndex; %Index of pattern for node sources
NodeSourceQuality; %Quality of node sources
NodeSourceTypeIndex; %Index of source type
NodeType; %ID of node type
NodeTypeIndex; %Index of nodetype
NodeHeadUnits; % Nodal head units
NodeTankBulkReactionCoeff; %Bulk reaction coefficients in tanks
NodeTankDiameter; %Tank Diameters
NodeTankIndex; %Indices of Tanks
NodeTankInitialLevel; %Initial water level in tanks
NodeTankInitialWaterVolume; %Initial water volume in tanks
NodeTankMaximumWaterLevel; % Maximum water level in tanks
NodeTankMinimumFraction; % Fraction of the total tank volume devoted to the inlet/outlet compartment
NodeTankMinimumWaterLevel; % Minimum water level
NodeTankMinimumWaterVolume; % Minimum water volume
NodeTankMixingModelCode; % Code of mixing model (MIXED:0, 2COMP:1, FIFO:2, LIFO:3)
NodeTankMixingModelType; % Type of mixing model (MIXED, 2COMP, FIFO, or LIFO)
NodeTankMixZoneVolume; % Mixing zone volume
NodeTankNameID; % Name ID of Tanks
NodeTankVolumeCurveIndex; %Index of curve for tank volumes
NodeTankVolumeUnits; %Units for volume
NodePressureUnits; % PUnits for Pressure
LinkCount; % Number of links
LinkPipeCount;% Number of pipes
LinkPumpCount;%Number of pumps
LinkValveCount;% Number of valves
LinkPipeDiameterUnits; % Units for pipe diameters
LinkFrictionFactorUnits; %Units for friction factor
LinkLengthUnits; % Units of length
LinkBulkReactionCoeff; % Bulk reaction coefficient of each link
LinkDiameter; % Diameter of each link
LinkIndex; % Index of links
LinkInitialSetting; %Initial settings of links
LinkInitialStatus; %Initial status of links
LinkLength; % Length of links
LinkLengthsUnits; % Units of length
LinkMinorLossCoeff; %Minor loss coefficient of links
LinkNameID; % Name ID of links
LinkPipeIndex; % Index of pipe links
LinkPipeNameID; % Name ID of pipe links
LinkPumpIndex; % Index of pumps
LinkPumpNameID; % Name ID of pumps
LinkRoughnessCoeff; % Roughness coefficient of links
LinkType; %ID of link type
LinkTypeIndex; %Index of link type
LinkWallReactionCoeff; %Wall reaction coefficient of links
LinkMinorLossCoeffUnits; %Minor loss coefficient units
LinkPumpPowerUnits; %Units of power
LinkPipeRoughnessCoeffUnits; %Pipe roughness coefficient units
LinkFlowUnits; %Units of flow
LinkValveIndex; % Index of valves
LinkValveNameID; % ID name of valves
LinkStatus;
LinkVelocityUnits; % Units for velocity
ControlLevelValues; %The control level values
ControlLinkIndex; % Set of control types in links
ControlNodeIndex; % Set of control types in nodes
ControlSettings; % Settings for the controls
ControlTypes; % Set of control types
ControlTypesIndex; %Index of the control types
ControlRules; %Retrieves the parameters of all control statements
ControlRulesCount; % Number of controls
Controls;
CurveCount; % Number of curves
TimeRuleControlStep; % Time step for evaluating rule-based controls
PatternCount; % Number of patterns
PatternDemandsUnits; %Units for demands
PatternNameID; %ID of the patterns
PatternIndex; %Indices of the patterns
PatternLengths; %Length of the patterns
Pattern; % get all patterns
TimePatternStart; %Pattern start time
TimePatternStep; %Pattern Step
EnergyEfficiencyUnits; % Units for efficiency
EnergyUnits; %Units for energy
OptionsHeadloss; %Headloss formula (Hazen-Williams, Darcy-Weisbach or Chezy-Manning)
OptionsHydraulics; %Save or Use hydraulic soltion. *** Not implemented ***
OptionsViscosity; %*** Not implemented ***
OptionsSpecificGravity; %*** Not implemented ***
OptionsMaxTrials; % Maximum number of trials (40 is default)
OptionsAccuracyValue; %Convergence value (0.001 is default)
OptionsPattern; % *** Not implemented ***
OptionsPatternDemandMultiplier; %Multiply demand values (1 is default)
OptionsEmitterExponent; %Exponent of pressure at an emmiter node (0.5 is default)
OptionsQualityTolerance; %Tolerance for water quality (0.01 is default)
OptionsUnbalanced; %*** Not implemented ***
OptionsUnbalancedContinueN; % *** Not implemented ***
QualityCode; % Water quality analysis code (None:0/Chemical:1/Age:2/Trace:3)
QualityTraceNodeIndex; %Index of trace node (0 if QualityCode<3)
QualityType; % Water quality analysis type (None/Chemical/Age/Trace)
QualityReactionCoeffBulkUnits; % Bulk reaction coefficient units
QualityReactionCoeffWallUnits; % Wall reaction coefficient units
QualitySourceMassInjectionUnits; % Units for source mass injection
QualityWaterAgeUnits; %Units for water age
QualityUnits; %Units for quality concentration.
TimeHydraulicStep; %Hydraulic time step
TimeQualityStep; %Quality Step
TimeReportingPeriods; % Reporting periods
TimeReportingStart; %Start time for reporting
TimeReportingStep; %Reporting time step
TimeSimulationDuration; %Simulation duration
TimeStatisticsIndex; %Index of time series post-processing type ('NONE':0,'AVERAGE':1,'MINIMUM':2,'MAXIMUM':3, 'RANGE':4)
TimeStatisticsType; %Type of time series post-processing ('NONE','AVERAGE','MINIMUM','MAXIMUM', 'RANGE')
%%%%% New version dev2.1 %%%%%
TimeStartTime;
TimeHTime;
TimeHaltFlag;
TimeNextEvent; %find the lesser of the hydraulic time step length, or the time to next fill/empty
NodeTankMaxVolume;
CurvesInfo;
HeadCurveIndex;
LinkPumpPatternNameID;
LinkPumpPatternIndex;
NodeNumDemandCategories;
NodeDemandPatternNameID;
NodeDemandPatternsIndex;
LinkPumpTypeCode;
LinkPumpType;
RelativeError;
Iterations;
PatternAveragePatternValue;
QualityChemName;
QualityChemUnits;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
errcode; %Code for the EPANET error message
pathfile; % The path of the input file
inputfile; % Name of the input file
libepanet; %EPANET library dll
libepanetpath; %EPANET library dll path
Version; % EPANET version
SImetric;
UScustomary;
% Bin
Bin;
Bintempfile;
BinNodeJunctionNameID;
BinNodeReservoirNameID;
BinNodeTankNameID;
BinNodeNameID;
BinNodeType;
BinNodeReservoirIndex;
BinNodeTankIndex;
BinNodeJunctionIndex;
BinNodeElevations;
BinNodeTankElevation;
BinNodeTankInitLevel;
BinNodeTankMinLevel;
BinNodeTankMaxLevel;
BinNodeTankDiameter;
BinNodeTankMinVol;
BinNodeTankMixID;
BinNodeTankMixModel;
BinNodeTankMinimumFraction;
BinNodeReservoirElevation;
BinNodeJunctionElevation;
BinNodeResDemandPatternNameID;
BinNodeCount;
BinNodeJunctionCount;
BinNodeReservoirCount;
BinNodeTankCount;
BinNodeTankReservoirCount;
BinNodeSourceTypeCode;
BinNodeSourceType;
BinNodeSourcePatternIndex;
BinNodeSourcePatternNameID;
BinNodeSourceQuality;
BinNodeSourceTypeIndex;
BinNodeJunctionsBaseDemands;
BinNodeJunctionsBaseDemandsID;
BinNodeDemandPatternNameID;
BinNodeInitialQuality;
BinNodeCoordinates;
BinNodeBaseDemands;
BinPatternNameID;
BinPatternLengths;
BinPatternValue;
BinPatternMatrix;
BinPatternCount;
BinLinkNameID;
BinLinkType;
BinLinkPipeNameID;
BinLinkPumpNameID;
BinLinkValveNameID;
BinLinkInitialStatusNameID;
BinLinkInitialStatus;
BinLinkPumpPatterns;
BinLinkPumpCurveNameID;
BinLinkPipeIndex;
BinLinkPumpIndex;
BinLinkValveIndex;
BinLinkFromNode;
BinLinkToNode;
BinLinkCount;
BinLinkPipeCount;
BinLinkPumpCount;
BinLinkValveCount;
BinLinkPipeLengths;
BinLinkPipeDiameters;
BinLinkPipeRoughness;
BinLinkPipeMinorLoss;
BinLinkValveDiameters;
BinLinkValveType;
BinLinkValveSetting;
BinLinkValveMinorLoss;
BinLinkValveStatus;
BinLinkValveStatusNameID;
BinLinkPipeStatus;
BinLinkPumpStatusNameID;
BinLinkPumpStatus;
BinLinkPumpPower;
BinLinkPumpNameIDPower;
BinLinkSettings;
BinLinkDiameters;
BinLinkLengths;
BinLinkRoughnessCoeff;
BinLinkGlobalWallReactionCoeff;
BinLinkGlobalBulkReactionCoeff;
BinLinkWallReactionCoeff;
BinLinkBulkReactionCoeff;
BinCurveNameID; %ID name of curves
BinCurveXvalue; %X-value of curves
BinCurveYvalue; %Y-value of curves
BinCurveAllLines;
BinCurveTypes; % Type of curves
BinCurveCount; % Number of curves
BinControlsInfo;
BinControlLinksID;
BinControlNodesID;
BinControlRulesCount;
BinRulesControlsInfo;
BinRulesControlLinksID;
BinRulesControlNodesID;
BinRulesCount;
BinTimeSimulationDuration;
BinTimeHydraulicStep;
BinTimeQualityStep;
BinTimePatternStep;
BinTimePatternStart;
BinTimeReportingStep;
BinTimeReportingStart;
BinTimeStatisticsIndex;
BinTimeStatistics;
BinOptionsSpecificGravity;
BinOptionsViscosity;
BinOptionsMaxTrials;
BinOptionsAccuracyValue;
BinOptionsUnbalanced;
BinOptionsPattern;
BinOptionsPatternDemandMultiplier;
BinOptionsEmitterExponent;
BinQualityType;% Water quality analysis code (None:0/Chemical:1/Age:2/Trace:3)
BinQualityCode;
BinQualityTraceNodeIndex;
BinQualityTraceNodeID;
BinQualityUnits;
BinOptionsDiffusivity;
BincountStatuslines;
BincountInitialQualitylines;
BincountReactionlines;
BincountPatternlines;
BinSImetric;
BinUScustomary;
BinUnits;
BinLinkFlowUnits;
BinOptionsHeadloss;
BinOptionsQualityTolerance;
BinNodePressureUnits;
% EMC Version
emcversion;
end
properties (Constant = true)
TYPECONTROL={'LOWLEVEL','HIGHLEVEL', 'TIMER', 'TIMEOFDAY'}; % Constants for control: 'LOWLEVEL','HILEVEL', 'TIMER', 'TIMEOFDAY'
TYPECURVE={'PUMP','EFFICIENCY','VOLUME','HEADLOSS'}; % Constants for pump curves: 'PUMP','EFFICIENCY','VOLUME','HEADLOSS'
TYPELINK={'CVPIPE', 'PIPE', 'PUMP', 'PRV', 'PSV', 'PBV', 'FCV', 'TCV', 'GPV'}; % Constants for links: 'CVPIPE', 'PIPE', 'PUMP', 'PRV', 'PSV', 'PBV', 'FCV', 'TCV', 'GPV', 'VALVE'
TYPEMIXMODEL={'MIX1','MIX2', 'FIFO','LIFO'}; % Constants for mixing models: 'MIX1','MIX2', 'FIFO','LIFO'
TYPENODE={'JUNCTION','RESERVOIR', 'TANK'}; % Contants for nodes: 'JUNCTION','RESERVOIR', 'TANK'
TYPEPUMP={'CONSTANT_HORSEPOWER', 'POWER_FUNCTION', 'CUSTOM'}; % Constants for pumps: 'CONSTANT_HORSEPOWER', 'POWER_FUNCTION', 'CUSTOM'
TYPEQUALITY={'NONE', 'CHEM', 'AGE', 'TRACE', 'MULTIS'}; % Constants for quality: 'NONE', 'CHEM', 'AGE', 'TRACE', 'MULTIS'
TYPEREPORT={'YES','NO','FULL'}; % Constants for report: 'YES','NO','FULL'
TYPESOURCE={'CONCEN','MASS', 'SETPOINT', 'FLOWPACED'}; % Constants for sources: 'CONCEN','MASS', 'SETPOINT', 'FLOWPACED'
TYPESOURCEMSX={'NOSOURCE','CONCEN','MASS', 'SETPOINT', 'FLOWPACED'}; % Constants for sources: 'CONCEN','MASS', 'SETPOINT', 'FLOWPACED'
TYPESTATS={'NONE','AVERAGE','MINIMUM','MAXIMUM', 'RANGE'}; % Constants for statistics: 'NONE','AVERAGE','MINIMUM','MAXIMUM', 'RANGE'
TYPEUNITS={'CFS', 'GPM', 'MGD', 'IMGD', 'AFD', 'LPS', 'LPM', 'MLD', 'CMH', 'CMD'}; % Constants for units: 'CFS', 'GPM', 'MGD', 'IMGD', 'AFD', 'LPS', 'LPM', 'MLD', 'CMH', 'CMD'
MsxTYPEAREAUNITS={'FT2','M2','CM2'}; % sets the units used to express pipe wall surface area
MsxTYPERATEUNITS={'SEC','MIN','HR','DAY'}; % is the units in which all reaction rate terms are expressed
MsxTYPESOLVER={'EUL','RK5','ROS2'}; % is the choice of numerical integration method used to solve the reaction system
MsxTYPECOUPLING={'FULL','NONE'}; % is the choice of numerical integration method used to solve the reaction system
MsxTYPECOMPILER={'NONE','VC','GC'}; % is the choice of numerical integration method used to solve the reaction system
end
methods
function obj = epanet(varargin)
%Constructor of the EPANET Class
try unloadlibrary('epanet2');catch e; end
try unloadlibrary('epanetmsx');catch e; end
% DLLs
if strcmp(computer('arch'),'win64')% if no DLL is given, select one automatically
if exist('64bit')==7 % name is a folder.
obj.libepanetpath = [pwd,'\64bit\'];
else
warning('Folder "64bit" does not exit.');return;
end
elseif strcmp(computer('arch'),'win32')
if exist('32bit')==7
obj.libepanetpath = [pwd,'\32bit\'];
else
warning('Folder "32bit" does not exit.');return;
end
end
warning on;
obj.inputfile=varargin{1}; % Get name of INP file
% Bin functions
if nargin==2
if strcmp(upper(varargin{2}),'BIN')
obj.Bintempfile=[obj.inputfile(1:end-4),'_temp.inp'];
copyfile(obj.inputfile,obj.Bintempfile);
value=obj.getBinCurvesInfo;
if ~isempty(value.BinCurveNameID), obj.remAddBinCurvesID(obj.Bintempfile);end
obj.inputfile=obj.Bintempfile;
obj.Bin=0;
obj = BinUpdateClass(obj);
obj.saveBinInpFile;
return;
end
end
obj.Bin=1;
if nargin==2
if ~isempty(find(obj.inputfile==' '))
warning(['File "', obj.inputfile, '" is not a valid']);return;
end
obj.libepanet=varargin{2}; % Get DLL libepanet (e.g. epanet20012x86 for 32-bit)
warning off;
try loadlibrary([obj.libepanetpath,obj.libepanet],[obj.libepanetpath,obj.libepanet,'.h']);
catch e
warning on;
obj.errcode=-1;
warning(['File "', obj.libepanet, '" is not a valid win application.']);return;
end
warning on;
elseif nargin==1
obj.libepanet = 'epanet2';
if ~isempty(find(obj.inputfile==' '))
warning(['File "', obj.inputfile, '" is not a valid.']);return;
end
end
if ~exist(obj.inputfile,'file')
warning(['File "', obj.inputfile, '" does not exist in folder.']);return;
end
if strcmp(computer('arch'),'win64') || strcmp(computer('arch'),'win32')
%Load EPANET Library
warning off;
ENLoadLibrary(obj.libepanetpath,obj.libepanet);
warning on;
%Open the file
obj.errcode=ENopen(obj.inputfile,[obj.inputfile(1:end-4),'.txt'],[obj.inputfile(1:end-4),'.bin'],obj.libepanet);
if obj.errcode~=0
warning('Could not open the file, please check INP file.');return;
end
%Save the temporary input file
obj.Bintempfile=[obj.inputfile(1:end-4),'_temp.inp'];
obj.saveInputFile(obj.Bintempfile,1); %create a new INP file (Working Copy) using the SAVE command of EPANET
obj.closeNetwork; %ENclose; %Close input file
%Load temporary file
ENopen(obj.Bintempfile,[obj.inputfile(1:end-4),'_temp.txt'], [obj.inputfile(1:end-4),'_temp.bin'],obj.libepanet);
obj.pathfile='';
end
obj.emcversion='dev-2.1';
% Get type of the parameters
obj.LinkType=obj.getLinkType;
obj.NodeType=obj.getNodeType;
%Get all the countable network parameters
obj.NodeCount = obj.getNodeCount;
obj.NodeTankReservoirCount = obj.getNodeTankReservoirCount;
obj.LinkCount = obj.getLinkCount;
obj.PatternCount = obj.getPatternCount;
obj.CurveCount = obj.getCurveCount;
obj.ControlRulesCount = obj.getControlRulesCount;
obj.NodeReservoirCount = obj.getNodeReservoirCount;
obj.NodeTankCount = obj.getNodeTankCount;
obj.NodeJunctionCount = obj.getNodeJunctionCount;
obj.LinkPipeCount = obj.getLinkPipeCount;
obj.LinkPumpCount = obj.getLinkPumpCount;
obj.LinkValveCount = obj.getLinkValveCount;
%Get all the controls
obj.Controls = obj.getControls;
%Get the flow units
obj.LinkFlowUnits = obj.getFlowUnits;
%Get all the link data
obj.LinkNameID = obj.getLinkNameID;
obj.LinkIndex = obj.getLinkIndex;
obj.LinkTypeIndex = obj.getLinkTypeIndex;
obj.LinkPipeIndex = find(strcmp(obj.LinkType,'PIPE'));
obj.LinkPumpIndex = find(strcmp(obj.LinkType,'PUMP'));
obj.LinkValveIndex = find(obj.LinkTypeIndex>2);
obj.LinkDiameter = obj.getLinkDiameter;
obj.LinkLength = obj.getLinkLength;
obj.LinkRoughnessCoeff = obj.getLinkRoughnessCoeff;
obj.LinkMinorLossCoeff = obj.getLinkMinorLossCoeff;
obj.LinkInitialStatus = obj.getLinkInitialStatus;
obj.LinkInitialSetting = obj.getLinkInitialSetting;
obj.LinkBulkReactionCoeff = obj.getLinkBulkReactionCoeff;
obj.LinkWallReactionCoeff = obj.getLinkWallReactionCoeff;
obj.LinkPipeNameID = obj.LinkNameID(obj.LinkPipeIndex);
obj.LinkPumpNameID = obj.LinkNameID(obj.LinkPumpIndex);
obj.LinkValveNameID = obj.LinkNameID(obj.LinkValveIndex);
obj.LinkStatus = obj.getLinkStatus;
%Get all the node data
obj.NodesConnectingLinksIndex = obj.getLinkNodesIndex;
obj.NodesConnectingLinksID = obj.getNodesConnectingLinksID;
obj.NodeNameID = obj.getNodeNameID;
obj.NodeIndex = obj.getNodeIndex;
obj.NodeTypeIndex = obj.getNodeTypeIndex;
obj.NodeElevations = obj.getNodeElevations;
obj.NodeDemandPatternIndex = obj.getNodeDemandPatternIndex;
obj.NodeEmitterCoeff = obj.getNodeEmitterCoeff;
obj.NodeInitialQuality = obj.getNodeInitialQuality;
obj.NodeSourceQuality = obj.getNodeSourceQuality;
obj.NodeSourcePatternIndex = obj.getNodeSourcePatternIndex;
obj.NodeSourceTypeIndex = obj.NodeSourceTypeIndex;
obj.NodeReservoirIndex = find(strcmp(obj.NodeType,'RESERVOIR'));
obj.NodeTankIndex = find(strcmp(obj.NodeType,'TANK'));
obj.NodeJunctionIndex = find(strcmp(obj.NodeType,'JUNCTION'));
obj.NodeReservoirNameID=obj.NodeNameID(obj.NodeReservoirIndex);
obj.NodeTankNameID=obj.NodeNameID(obj.NodeTankIndex);
obj.NodeJunctionNameID=obj.NodeNameID(obj.NodeJunctionIndex);
%Get all tank data
obj.NodeTankInitialLevel = obj.getNodeTankInitialLevel;
obj.NodeTankMinimumWaterVolume = obj.getNodeTankInitialWaterVolume;
obj.NodeTankMixingModelCode = obj.getNodeTankMixingModelCode;
obj.NodeTankMixingModelType = obj.getNodeTankMixingModelType;
obj.NodeTankMixZoneVolume = obj.getNodeTankMixZoneVolume;
obj.NodeTankDiameter = obj.getNodeTankDiameter;
obj.NodeTankMinimumWaterVolume = obj.getNodeTankMinimumWaterVolume;
obj.NodeTankVolumeCurveIndex = obj.getNodeTankVolumeCurveIndex;
obj.NodeTankMinimumWaterLevel = obj.getNodeTankMinimumWaterLevel;
obj.NodeTankMaximumWaterLevel = obj.getNodeTankMaximumWaterLevel;
obj.NodeTankMinimumFraction = obj.getNodeTankMinimumFraction;
obj.NodeTankBulkReactionCoeff = obj.getNodeTankBulkReactionCoeff;
%Get all options
obj.OptionsMaxTrials = obj.getOptionsMaxTrials;
obj.OptionsAccuracyValue = obj.getOptionsAccuracyValue;
obj.OptionsQualityTolerance = obj.getOptionsQualityTolerance;
obj.OptionsEmitterExponent = obj.getOptionsEmitterExponent;
obj.OptionsPatternDemandMultiplier = obj.getOptionsPatternDemandMultiplier;
%Get pattern data
obj.PatternNameID = obj.getPatternNameID;
obj.PatternIndex = obj.getPatternIndex;
obj.PatternLengths = obj.getPatternLengths;
obj.Pattern = obj.getPattern;
%Get quality types
obj.QualityCode = obj.getQualityCode;
obj.QualityTraceNodeIndex = obj.getQualityTraceNodeIndex;
%Bug
obj.QualityType = obj.getQualityType;
% n = obj.getQualityInfo;
% obj.QualityChemUnits = n.QualityChemUnits;
% obj.QualityChemName= n.QualityChemUnits;
%Get time parameters
obj.TimeSimulationDuration = obj.getTimeSimulationDuration;
obj.TimeHydraulicStep = obj.getTimeHydraulicStep;
obj.TimeQualityStep = obj.getTimeQualityStep;
obj.TimePatternStep = obj.getTimePatternStep;
obj.TimePatternStart = obj.getTimePatternStart;
obj.TimeReportingStep = obj.getTimeReportingStep;
obj.TimeReportingStart = obj.getTimeReportingStart;
obj.TimeRuleControlStep = obj.getTimeRuleControlStep;
obj.TimeStatisticsIndex = obj.getTimeStatisticsIndex;
obj.TimeStatisticsType = obj.getTimeStatisticsType;
obj.TimeReportingPeriods = obj.getTimeReportingPeriods;
% Get EPANET version
obj.Version = obj.getVersion;
try%New version dev2.1.dll libepanet
obj.TimeStartTime = obj.getTimeStartTime;
obj.TimeHTime = obj.getTimeHTime;
obj.TimeHaltFlag = obj.getTimeHaltFlag;
obj.TimeNextEvent = obj.getTimeNextEvent;
obj.NodeTankMaxVolume = obj.getNodeTankMaxVolume;
if sum(strcmp(libfunctions(obj.libepanet),'ENgetbasedemand'))
obj.NodeBaseDemands = obj.getNodeBaseDemands;
obj.NodeNumDemandCategories = obj.getNodeNumDemandCategories;
else
obj.NodeBaseDemands={};
for i=1:obj.NodeCount
[obj.errcode, obj.NodeBaseDemands{i}] = ENgetnodevalue(i,1,obj.libepanet);
end
end
obj.PatternAveragePatternValue = obj.getPatternAveragePatternValue;
n = obj.getStatistic;
obj.RelativeError = n.RelativeError;
obj.Iterations = n.Iterations;
obj.NodeDemandPatternNameID = obj.getNodeDemandPatternNameID;
obj.NodeDemandPatternsIndex = obj.getNodeDemandPatternsIndex;
obj.HeadCurveIndex = obj.getHeadCurveIndex;
obj.LinkPumpPatternNameID = obj.getLinkPumpPatternNameID;
obj.LinkPumpPatternIndex = obj.getLinkPumpPatternIndex;
obj.LinkPumpTypeCode = obj.getLinkPumpTypeCode;
obj.LinkPumpType = obj.getLinkPumpType;
% obj.CurvesInfo = obj.getCurvesInfo; % New version dev2.1
%Get data from raw file (for information which cannot be
%accessed by the epanet library)
value=obj.getNodeCoordinates;
%Get coordinates
obj.NodeCoordinates{1} = value{1};
obj.NodeCoordinates{2} = value{2};
obj.NodeCoordinates{3} = value{3};
obj.NodeCoordinates{4} = value{4};
catch e
end
% US Customary - SI metric
switch char(obj.LinkFlowUnits)
case 'CFS'
obj.UScustomary=1;
case 'GPM'
obj.UScustomary=1;
case 'MGD'
obj.UScustomary=1;
case 'IMGD'
obj.UScustomary=1;
case 'AFD'
obj.UScustomary=1;
case 'LPS'
obj.SImetric=1;
case 'LPM'
obj.SImetric=1;
case 'MLD'
obj.SImetric=1;
case 'CMH'
obj.SImetric=1;
case 'CMD'
obj.SImetric=1;
end
if obj.UScustomary==1;
obj.NodePressureUnits='pounds per square inch';
obj.PatternDemandsUnits=obj.LinkFlowUnits;
obj.LinkPipeDiameterUnits='inches';
obj.NodeTankDiameterUnits='feet';
obj.EnergyEfficiencyUnits='percent';
obj.NodeElevationUnits='feet';
obj.NodeEmitterCoefficientUnits='flow units @ 1 psi drop';
obj.EnergyUnits='kwatt-hours';
obj.LinkFrictionFactorUnits='unitless';
obj.NodeHeadUnits='feet';
obj.LinkLengthsUnits='feet';
obj.LinkMinorLossCoeffUnits='unitless';
obj.LinkPumpPowerUnits='horsepower';
obj.QualityReactionCoeffBulkUnits='1/day (1st-order)';
obj.QualityReactionCoeffWallUnits='mass/sq-ft/day (0-order), ft/day (1st-order)';
obj.LinkPipeRoughnessCoeffUnits='millifeet(Darcy-Weisbach), unitless otherwise';
obj.QualitySourceMassInjectionUnits='mass/minute';
obj.LinkVelocityUnits='ft/sec';
obj.NodeTankVolumeUnits='cubic feet';
obj.QualityWaterAgeUnits='hours';
else % SI Metric
obj.NodePressureUnits='meters';
obj.PatternDemandsUnits=obj.LinkFlowUnits;
obj.LinkPipeDiameterUnits='millimeters';
obj.NodeTankDiameterUnits='meters';
obj.EnergyEfficiencyUnits='percent';
obj.NodeElevationUnits='meters';
obj.NodeEmitterCoefficientUnits='flow units @ 1 meter drop';
obj.EnergyUnits='kwatt-hours';
obj.LinkFrictionFactorUnits='unitless';
obj.NodeHeadUnits='meters';
obj.LinkLengthsUnits='meters';
obj.LinkMinorLossCoeffUnits='unitless';
obj.LinkPumpPowerUnits='kwatts';
obj.QualityReactionCoeffBulkUnits='1/day (1st-order)';
obj.QualityReactionCoeffWallUnits='mass/sq-m/day(0-order), meters/day (1st-order)';
obj.LinkPipeRoughnessCoeffUnits='mm(Darcy-Weisbach), unitless otherwise';
obj.QualitySourceMassInjectionUnits='mass/minute';
obj.LinkVelocityUnits='meters/sec';
obj.NodeTankVolumeUnits='cubic meters';
obj.QualityWaterAgeUnits='hours';
end
end % End of epanet class constructor
function errcode = LoadFile(obj,varargin)
[errcode] = ENopen(varargin{1},[varargin{1}(1:end-4),'.rpt'],[varargin{1}(1:end-4),'.bin'],obj.libepanet);
end
function [value] = plot(obj,varargin)
%Plots network in a new Matlab figure
%Arguments:
% 'nodes': yes/no
% 'links': yes/no
% 'line' : yes/no
% 'point': yes/no
% 'highlightnode': array of node IDs
% 'highlightlink': array of link IDs
% 'fontsize': number (px)
% 'colornode': array of node IDs
% 'colorlink': array of link id
% 'axes': axes coordinates
% 'linksindex': yes
% 'nodesindex': yes
% Example:
% d.plot('nodes','yes','links','yes','highlightnode',{'10','11'},'highlightlink',{'10'},'fontsize',8);
% d.plot('line','no');
% d.plot('point','no','linksindex','yes');
% d.plot('linksindex','yes','fontsize',8);
% d.plot('nodesindex','yes','fontsize',14);
[value] = ENplot(obj,'bin',0,varargin{:});
end
function value = getControls(obj)
%Retrieves the parameters of all control statements
cnt=obj.getControlRulesCount;
if cnt
obj.ControlTypes{cnt}=[];
obj.ControlTypesIndex(cnt)=NaN;
obj.ControlLinkIndex(cnt)=NaN;
obj.ControlSettings(cnt)=NaN;
obj.ControlNodeIndex(cnt)=NaN;
obj.ControlLevelValues(cnt)=NaN;
for i=1:cnt
[obj.errcode, obj.ControlTypesIndex(i),obj.ControlLinkIndex(i),obj.ControlSettings(i),obj.ControlNodeIndex(i),obj.ControlLevelValues(i)] = ENgetcontrol(i,obj.libepanet);
obj.ControlTypes(i)={obj.TYPECONTROL(obj.ControlTypesIndex(i)+1)};
value{i}={obj.ControlTypes{i},obj.ControlTypesIndex(i),obj.ControlLinkIndex(i),obj.ControlSettings(i),obj.ControlNodeIndex(i),obj.ControlLevelValues(i)};
end
else
value=-1;
end
end
function value = getNodeCount(obj)
% Retrieves the number of nodes
[obj.errcode, value] = ENgetcount(0,obj.libepanet);
end
function value = getNodeTankReservoirCount(obj)
% Retrieves the number of tanks
[obj.errcode, value] = ENgetcount(1,obj.libepanet);
end
function value = getLinkCount(obj)
% Retrieves the number of links
[obj.errcode, value] = ENgetcount(2,obj.libepanet);
end
function value = getPatternCount(obj)
% Retrieves the number of patterns
[obj.errcode, value] = ENgetcount(3,obj.libepanet);
end
function value = getCurveCount(obj)
% Retrieves the number of curves
[obj.errcode, value] = ENgetcount(4,obj.libepanet);
end
function value = getControlRulesCount(obj)
% Retrieves the number of controls
[obj.errcode, value] = ENgetcount(5,obj.libepanet);
end
function value = getNodeTankCount(obj)
% Retrieves the number of Tanks
value = sum(strcmp(obj.getNodeType,'TANK'));
end
function value = getNodeReservoirCount(obj)
% Retrieves the number of Reservoirs
value = sum(strcmp(obj.getNodeType,'RESERVOIR'));
end
function value = getNodeJunctionCount(obj)
% Retrieves the number of junction nodes
value = sum(strcmp(obj.getNodeType,'JUNCTION'));
end
function value = getLinkPipeCount(obj)
% Retrieves the number of pipes
value = sum(strcmp(obj.getLinkType,'PIPE'))+sum(strcmp(obj.getLinkType,'CVPIPE'));
end
function value = getLinkPumpCount(obj)
% Retrieves the number of pumps
value = sum(strcmp(obj.getLinkType,'PUMP'));
end
function value = getLinkValveCount(obj)
% Retrieves the number of valves
value = obj.getLinkCount - (obj.getLinkPipeCount + obj.getLinkPumpCount);
end
function errmssg = getError(obj,errcode)
%Retrieves the text of the message associated with a particular error or warning code.
[errmssg , errcode] = ENgeterror(errcode,obj.libepanet);
end
function value = getFlowUnits(obj)
%Retrieves flow units used to express all flow rates.
[obj.errcode, flowunitsindex] = ENgetflowunits(obj.libepanet);
obj.LinkFlowUnits=obj.TYPEUNITS(flowunitsindex+1);
value=obj.LinkFlowUnits;
end
function value = getLinkNameID(obj,varargin)
% Retrieves the ID label(s) of all links, or the IDs of an index set of links
if isempty(varargin)
value{obj.getLinkCount}=[];
for i=1:obj.getLinkCount
[obj.errcode, value{i}]=ENgetlinkid(i,obj.libepanet);
end
else
k=1;
if ~isempty(varargin{1})
value{length(varargin{1})}=[];
for i=varargin{1}
[obj.errcode, value{k}]=ENgetlinkid(i,obj.libepanet);
k=k+1;
end
else
value=[];
end
end
end
function value = getLinkPipeNameID(obj)
%Retrieves the pipe id
value=obj.getLinkNameID(obj.getLinkPipeIndex);
end
function value = getLinkPumpNameID(obj)
%Retrieves the pump id
value=obj.getLinkNameID(obj.getLinkPumpIndex);
end
function value = getLinkValveNameID(obj)
%Retrieves the valve id
value=obj.getLinkNameID(obj.getLinkValveIndex);
end
function value = getLinkIndex(obj,varargin)
%Retrieves the indices of all links, or the indices of an ID set of links
if isempty(varargin)
value=1:obj.getLinkCount;
elseif isa(varargin{1},'cell')
k=1;
for j=1:length(varargin{1})
[obj.errcode, value(k)] = ENgetlinkindex(varargin{1}{j},obj.libepanet);
k=k+1;
end
elseif isa(varargin{1},'char')
[obj.errcode, value] = ENgetlinkindex(varargin{1},obj.libepanet);
end
end
function value = getLinkPipeIndex(obj)
%Retrieves the pipe index
tmpLinkTypes=obj.getLinkType;
value = find(strcmp(tmpLinkTypes,'PIPE'));
% if isempty(value), value=-1; end
end
function value = getLinkPumpIndex(obj)
%Retrieves the pipe index
tmpLinkTypes=obj.getLinkType;
value = find(strcmp(tmpLinkTypes,'PUMP'));
% if isempty(value), value=-1; end
end
function value = getLinkValveIndex(obj)
%Retrieves the pipe index
value = obj.getLinkPipeCount+obj.getLinkPumpCount+1:obj.getLinkCount;
% if isempty(value), value=-1; end
end
function value = getLinkNodesIndex(obj)
%Retrieves the indexes of the from/to nodes of all links.
value(obj.getLinkCount,1:2)=[nan nan];
for i=1:obj.getLinkCount
[obj.errcode,linkFromNode,linkToNode] = ENgetlinknodes(i,obj.libepanet);
value(i,:)= [linkFromNode,linkToNode];
end
end
function value = getNodesConnectingLinksID(obj)
%Retrieves the id of the from/to nodes of all links.
obj.NodesConnectingLinksIndex=obj.getLinkNodesIndex;
if obj.getLinkCount
for i=1:obj.getLinkCount
value(i,1)=obj.getNodeNameID(obj.NodesConnectingLinksIndex(i,1));
value(i,2) = obj.getNodeNameID(obj.NodesConnectingLinksIndex(i,2));
end
else
value=-1;
end
end
function value = getLinkType(obj)
%Retrieves the link-type code for all links.
index=obj.getLinkTypeIndex;
for i=1:obj.getLinkCount
value(i)=obj.TYPELINK(index(i)+1);
end
end
function value = getLinkTypeIndex(obj)
%Retrieves the link-type code for all links.
for i=1:obj.getLinkCount
[obj.errcode,value(i)] = ENgetlinktype(i,obj.libepanet);
end
end
function value = getLinkDiameter(obj)
%Retrieves the value of all link diameters
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,0,obj.libepanet);
end
end
function value = getLinkLength(obj)
%Retrieves the value of all link lengths
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,1,obj.libepanet);
end
end
function value = getLinkRoughnessCoeff(obj)
%Retrieves the value of all link roughness
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,2,obj.libepanet);
end
end
function value = getLinkMinorLossCoeff(obj)
%Retrieves the value of all link minor loss coefficients
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,3,obj.libepanet);
end
end
function value = getLinkInitialStatus(obj)
%Retrieves the value of all link initial status
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,4,obj.libepanet);
end
end
function value = getLinkInitialSetting(obj)
%Retrieves the value of all link roughness for pipes or initial speed for pumps or initial setting for valves
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,5,obj.libepanet);
end
end
function value = getLinkBulkReactionCoeff(obj)
%Retrieves the value of all link bulk reaction coefficients
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,6,obj.libepanet);
end
end
function value = getLinkWallReactionCoeff(obj)
%Retrieves the value of all link wall reaction coefficients
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,7,obj.libepanet);
end
end
function value = getLinkFlows(obj)
%Retrieves the value of all computed link flow rates
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,8,obj.libepanet);
end
end
function value = getLinkVelocity(obj)
%Retrieves the value of all computed link velocities
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,9,obj.libepanet);
end
end
function value = getLinkHeadloss(obj)
%Retrieves the value of all computed link headloss
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,10,obj.libepanet);
end
end
function value = getLinkStatus(obj)
%Retrieves the value of all computed link status (0 = closed, 1 = open)
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,11,obj.libepanet);
end
end
function value = getLinkSettings(obj)
%Retrieves the value of all computed link roughness for pipes or actual speed for pumps or actual setting for valves
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,12,obj.libepanet);
end
end
function value = getLinkPumpEnergy(obj)
%Retrieves the value of all computed energy in kwatts
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,13,obj.libepanet);
end
end
function value = getLinkQuality(obj)
%New version dev2.1
value=zeros(1,obj.getLinkCount);
for i=1:obj.getLinkCount
[obj.errcode, value(i)] = ENgetlinkvalue(i,14,obj.libepanet);
end
end
function value = getLinkPumpPatternIndex(obj)