Skip to content

Commit 9e1d0a8

Browse files
authored
Merge pull request #16 from OpenWaterAnalytics/emitter-backflow-option
Emitter backflow option
2 parents f43584a + 36f051e commit 9e1d0a8

11 files changed

+110
-28
lines changed

Diff for: epanet2w/Ddefault.pas

+15-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,13 @@ procedure TDefaultsForm.GetDefaults(const I: Integer);
171171
PropList[I].Add(DefProp[PIPES].Data[PIPE_ROUGH_INDEX]);
172172
end;
173173
2: begin
174-
for j := FLOW_UNITS_INDEX to STATUS_RPT_INDEX do
174+
for j := FLOW_UNITS_INDEX to EMITTER_EXP_INDEX do
175+
PropList[I].Add(Network.Options.Data[j]);
176+
PropList[I].Add(Network.Options.Data[EMITTER_BACK_INDEX]);
177+
PropList[I].Add(Network.Options.Data[STATUS_RPT_INDEX]);
178+
for j := HEAD_ERROR_INDEX to PRESSURE_EXP_INDEX do
179+
PropList[I].Add(Network.Options.Data[j]);
180+
for j := CHECK_FREQ_INDEX to DAMP_LIMIT_INDEX do
175181
PropList[I].Add(Network.Options.Data[j]);
176182
end;
177183
end;
@@ -213,8 +219,15 @@ procedure TDefaultsForm.SetDefaults;
213219
DefProp[PIPES].Data[PIPE_DIAM_INDEX] := PropList[1].Strings[5];
214220
DefProp[PIPES].Data[PIPE_ROUGH_INDEX] := PropList[1].Strings[6];
215221
DefProp[VALVES].Data[VALVE_DIAM_INDEX] := DefProp[PIPES].Data[PIPE_DIAM_INDEX];
216-
for j := FLOW_UNITS_INDEX to STATUS_RPT_INDEX do
222+
223+
for j := FLOW_UNITS_INDEX to EMITTER_EXP_INDEX do
217224
Network.Options.Data[j] := PropList[2].Strings[j-FLOW_UNITS_INDEX];
225+
Network.Options.Data[EMITTER_BACK_INDEX] := PropList[2].Strings[10];
226+
Network.Options.Data[STATUS_RPT_INDEX] := PropList[2].Strings[11];
227+
for j := HEAD_ERROR_INDEX to PRESSURE_EXP_INDEX do
228+
Network.Options.Data[j] := PropList[2].Strings[12+j-HEAD_ERROR_INDEX];
229+
for j := CHECK_FREQ_INDEX to DAMP_LIMIT_INDEX do
230+
Network.Options.Data[j] := PropList[2].Strings[18+j-CHECK_FREQ_INDEX];
218231

219232
Uinput.UpdateAllUnits;
220233

Diff for: epanet2w/Ddisclaimer.dfm

+30-12
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@ object DisclaimerForm: TDisclaimerForm
33
Top = 104
44
BorderStyle = bsDialog
55
Caption = 'EPANET Development Version Disclaimer'
6-
ClientHeight = 329
6+
ClientHeight = 480
77
ClientWidth = 377
88
Color = clBtnFace
99
Font.Charset = DEFAULT_CHARSET
1010
Font.Color = clWindowText
1111
Font.Height = -12
1212
Font.Name = 'Segoe UI'
1313
Font.Style = []
14-
OldCreateOrder = False
1514
Position = poMainFormCenter
16-
PixelsPerInch = 96
1715
TextHeight = 15
1816
object Panel1: TPanel
1917
Left = 24
2018
Top = 8
2119
Width = 337
22-
Height = 281
20+
Height = 433
2321
BevelInner = bvRaised
2422
BevelOuter = bvLowered
2523
TabOrder = 0
@@ -40,12 +38,12 @@ object DisclaimerForm: TDisclaimerForm
4038
IsControl = True
4139
end
4240
object Version: TLabel
43-
Left = 146
41+
Left = 106
4442
Top = 45
45-
Width = 74
43+
Width = 152
4644
Height = 14
4745
Alignment = taCenter
48-
Caption = '2023-04-20'
46+
Caption = 'GUI Version: 2024-03-01'
4947
Font.Charset = ANSI_CHARSET
5048
Font.Color = clWindowText
5149
Font.Height = -12
@@ -72,7 +70,7 @@ object DisclaimerForm: TDisclaimerForm
7270
end
7371
object Build: TLabel
7472
Left = 133
75-
Top = 65
73+
Top = 89
7674
Width = 102
7775
Height = 14
7876
Alignment = taCenter
@@ -85,6 +83,21 @@ object DisclaimerForm: TDisclaimerForm
8583
ParentFont = False
8684
IsControl = True
8785
end
86+
object Label1: TLabel
87+
Left = 86
88+
Top = 65
89+
Width = 172
90+
Height = 14
91+
Alignment = taCenter
92+
Caption = 'Engine Version: 2023-06-08'
93+
Font.Charset = ANSI_CHARSET
94+
Font.Color = clWindowText
95+
Font.Height = -12
96+
Font.Name = 'Tahoma'
97+
Font.Style = [fsBold]
98+
ParentFont = False
99+
IsControl = True
100+
end
88101
object Panel2: TPanel
89102
Left = 8
90103
Top = 8
@@ -213,9 +226,9 @@ object DisclaimerForm: TDisclaimerForm
213226
end
214227
object Memo1: TMemo
215228
Left = 9
216-
Top = 85
229+
Top = 120
217230
Width = 321
218-
Height = 185
231+
Height = 305
219232
BorderStyle = bsNone
220233
Color = clMenu
221234
Lines.Strings = (
@@ -234,13 +247,18 @@ object DisclaimerForm: TDisclaimerForm
234247
''
235248
'The developers of this software are not responsible for any '
236249
'damage or loss caused by the use of this development '
237-
'version.')
250+
'version.'
251+
''
252+
'Networks saved with a development version will not be'
253+
'compatible with the standard release of the software or'
254+
'with other development versions.')
255+
ReadOnly = True
238256
TabOrder = 1
239257
end
240258
end
241259
object Button1: TButton
242260
Left = 157
243-
Top = 295
261+
Top = 447
244262
Width = 75
245263
Height = 25
246264
Caption = 'OK'

Diff for: epanet2w/Ddisclaimer.pas

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ TDisclaimerForm = class(TForm)
1717
ProgramIcon: TImage;
1818
Button1: TButton;
1919
Memo1: TMemo;
20+
Label1: TLabel;
2021
private
2122
{ Private declarations }
2223
public

Diff for: epanet2w/Fmain.pas

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface
4141
MSG_NO_BACKDROP = 'Could not find backdrop file ';
4242
MSG_FIND_BACKDROP = '. Do you want to search for it?';
4343

44-
TXT_MAIN_CAPTION = 'EPANET [DEV 2023-04-20]';
44+
TXT_MAIN_CAPTION = 'EPANET [DEV 2024-03-01]';
4545
TXT_AUTOLENGTH = 'Auto-Length ';
4646
TXT_STATUS_REPORT = 'Status Report';
4747
TXT_SAVE_CHANGES = 'Save changes made to current project?';

Diff for: epanet2w/Uexport.pas

+2
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ procedure ExportDataBase(const Fname: String; const Withmap: Boolean);
336336
if (IOResult = 0) then
337337
try
338338

339+
Writeln(F,';INP saved using EPANET Development Preview version ',VERSIONDEV);
339340
Writeln(F,'[TITLE]');
340341
Writeln(F,Network.Options.Title);
341342
slist := Network.Options.Notes;
@@ -741,6 +742,7 @@ procedure ExportDataBase(const Fname: String; const Withmap: Boolean);
741742
end;
742743

743744
Writeln(F,' Emitter Exponent '#9,Data[EMITTER_EXP_INDEX]);
745+
Writeln(F,' Emitter Backflow '#9,Data[EMITTER_BACK_INDEX]);
744746
if UpperCase(Trim(Data[QUAL_PARAM_INDEX])) = 'TRACE' then
745747
Writeln(F,' Quality '#9'Trace ',Data[TRACE_NODE_INDEX])
746748
else

Diff for: epanet2w/Ufileio.pas

+7-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ procedure SaveProject(const Fname: String);
165165

166166
//Write file header.
167167
WriteString('<EPANET2>');
168-
WriteInteger(VERSIONID2);
168+
WriteInteger(VERSIONDEV);
169169

170170
//Write numbers of network components
171171
for i := JUNCS to CNTRLS do
@@ -436,7 +436,7 @@ function ReadNetFile(const Fname: String): Integer;
436436

437437
//Read version ID
438438
Version := ReadInteger;
439-
if (Version < VERSIONID1) or (Version > VERSIONID2) then
439+
if (Version < VERSIONID1) or (Version > VERSIONDEV) then
440440
begin
441441
raise EReadError.Create(MSG_READ_ERR);
442442
end;
@@ -465,6 +465,11 @@ function ReadNetFile(const Fname: String): Integer;
465465
Network.Options.Data[i] := DefOptions[i];
466466
end;
467467

468+
if (Version < VERSIONDEV) then
469+
begin
470+
Network.Options.Data[EMITTER_BACK_INDEX] := DefOptions[EMITTER_BACK_INDEX];
471+
end;
472+
468473
//Check if Quality Time Step is in hours instead of minutes
469474
with Network.Options do
470475
begin

Diff for: epanet2w/Uglobals.pas

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ TVertex = record
5353
//------------------
5454
VERSIONID1 = 20005;
5555
VERSIONID2 = 20201;
56+
VERSIONDEV = 20240301; //Compile date
57+
5658

5759
//------------------
5860
// Maximum limits
@@ -61,7 +63,7 @@ TVertex = record
6163
MAXINTERVALS = 4; //Max. color scale interval index
6264
MAXNODEPROPS = 26; //Max. index for node property array
6365
MAXLINKPROPS = 25; //Max. index for link property array
64-
MAXOPTIONS = 44; //Max. index for network options array
66+
MAXOPTIONS = 45; //Max. index for network options array
6567
MAXSERIES = 5; //Max. time series plots per graph
6668
MAXCOLS = 15; //Max. columns in a table
6769
MAXFILTERS = 10; //Max. filter conditions for table
@@ -273,6 +275,8 @@ TVertex = record
273275
REQ_PRESSURE_INDEX = 43; //Required service pressure
274276
PRESSURE_EXP_INDEX = 44; //Exponent in demand v. pressure function
275277

278+
EMITTER_BACK_INDEX = 45; //Emitter backflow
279+
276280
//-----------------
277281
// Graph-type codes
278282
//-----------------

Diff for: epanet2w/Uimport.pas

+6-2
Original file line numberDiff line numberDiff line change
@@ -1215,9 +1215,13 @@ function ReadOptionData: Integer;
12151215
else Network.Options.Data[DEMAND_MULT_INDEX] := TokList[2];
12161216
end;
12171217

1218-
// Emitter Exponent option
1218+
// Emitter Exponent or Emitter backflow option
12191219
9: if Ntoks >= 3 then
1220-
Network.Options.Data[EMITTER_EXP_INDEX] := TokList[2];
1220+
begin
1221+
if CompareText(TokList[1], 'EXPONENT') = 0
1222+
then Network.Options.Data[EMITTER_EXP_INDEX] := TokList[2]
1223+
else Network.Options.Data[EMITTER_BACK_INDEX] := TokList[2];
1224+
end;
12211225

12221226
3, //Rel. Viscosity
12231227
4, //Max Trials

Diff for: epanet2w/Uinifile.pas

+28-2
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,23 @@ procedure ReadDefaults;
295295
IDPrefix[i] := ReadString('Labels',ObjectLabel[i],'');
296296

297297
// Retrieve default hydraulic analysis options
298-
for i := FLOW_UNITS_INDEX to STATUS_RPT_INDEX do
298+
for i := FLOW_UNITS_INDEX to EMITTER_EXP_INDEX do
299299
Network.Options.Data[i] := ReadString('Hydraulics',
300300
HydraulicProps[i].Name,Network.Options.Data[i]);
301301

302+
Network.Options.Data[EMITTER_BACK_INDEX] := ReadString('Hydraulics',
303+
HydraulicProps[10].Name,Network.Options.Data[EMITTER_BACK_INDEX]);
304+
Network.Options.Data[STATUS_RPT_INDEX] := ReadString('Hydraulics',
305+
HydraulicProps[11].Name,Network.Options.Data[STATUS_RPT_INDEX]);
306+
307+
for i := HEAD_ERROR_INDEX to PRESSURE_EXP_INDEX do
308+
Network.Options.Data[i] := ReadString('Hydraulics',
309+
HydraulicProps[12+i-HEAD_ERROR_INDEX].Name,Network.Options.Data[i]);
310+
311+
for i := CHECK_FREQ_INDEX to DAMP_LIMIT_INDEX do
312+
Network.Options.Data[i] := ReadString('Hydraulics',
313+
HydraulicProps[18+i-CHECK_FREQ_INDEX].Name,Network.Options.Data[i]);
314+
302315
// Retrieve specific default node properties
303316
DefProp[JUNCS].Data[JUNC_ELEV_INDEX] :=
304317
ReadString('Properties','Elevation',DefJunc[JUNC_ELEV_INDEX]);
@@ -346,9 +359,22 @@ procedure SaveDefaults;
346359
WriteString('Labels',ObjectLabel[i],IDPrefix[i]);
347360

348361
// Save default hydraulic analysis options
349-
for i := FLOW_UNITS_INDEX to STATUS_RPT_INDEX do
362+
for i := FLOW_UNITS_INDEX to EMITTER_EXP_INDEX do
350363
WriteString('Hydraulics',HydraulicProps[i].Name,
351364
Network.Options.Data[i]);
365+
366+
WriteString('Hydraulics',HydraulicProps[10].Name,
367+
Network.Options.Data[EMITTER_BACK_INDEX]);
368+
WriteString('Hydraulics',HydraulicProps[11].Name,
369+
Network.Options.Data[STATUS_RPT_INDEX]);
370+
371+
for i := HEAD_ERROR_INDEX to PRESSURE_EXP_INDEX do
372+
WriteString('Hydraulics',HydraulicProps[12+i-HEAD_ERROR_INDEX].Name,
373+
Network.Options.Data[i]);
374+
375+
for i := CHECK_FREQ_INDEX to DAMP_LIMIT_INDEX do
376+
WriteString('Hydraulics',HydraulicProps[18+i-CHECK_FREQ_INDEX].Name,
377+
Network.Options.Data[i]);
352378

353379
// Save specific default node properties
354380
WriteString('Properties','Elevation',DefProp[JUNCS].Data[JUNC_ELEV_INDEX]);

Diff for: epanet2w/Uinput.pas

+9-4
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,12 @@ procedure EditOptions(const Index: Integer);
646646
begin
647647
case Index of
648648
0: begin
649-
for k := FLOW_UNITS_INDEX to STATUS_RPT_INDEX do //Hydraulics
649+
for k := FLOW_UNITS_INDEX to EMITTER_EXP_INDEX do //Hydraulics
650650
PropList.Add(Data[k]);
651+
652+
PropList.Add(Data[EMITTER_BACK_INDEX]);
653+
PropList.Add(Data[STATUS_RPT_INDEX]);
654+
651655
for k := HEAD_ERROR_INDEX to PRESSURE_EXP_INDEX do
652656
PropList.Add(Data[k]);
653657
for k := CHECK_FREQ_INDEX to DAMP_LIMIT_INDEX do
@@ -1499,9 +1503,10 @@ function ValidOption(I: Integer; var S: String): Boolean;
14991503
k := I;
15001504
// Convert from editor index I to property index k
15011505
case EditorIndex of
1502-
0: if I < 11 then k := I //HYDRAULICS
1503-
else if I < 17 then k := HEAD_ERROR_INDEX + (I - 11)
1504-
else k := CHECK_FREQ_INDEX + (I - 17);
1506+
0: if I < 10 then k := I //HYDRAULICS
1507+
else if I = 10 then k := EMITTER_BACK_INDEX
1508+
else if I < 17 then k := HEAD_ERROR_INDEX + (I - 12)
1509+
else k := CHECK_FREQ_INDEX + (I - 18);
15051510

15061511
1: k := QUAL_PARAM_INDEX + I; //QUALITY
15071512
2: k := BULK_ORDER_INDEX + I; //REACTIONS

Diff for: epanet2w/consts.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const
204204
(Name:'Meter ID'; Style:esEdit; Mask:emNoSpace; Length:MAXID),
205205
(Name:'Font'; Style:esButton; Mask:emNone));
206206

207-
HydraulicProps: array [0..19] of TPropRecord =
207+
HydraulicProps: array [0..20] of TPropRecord =
208208
((Name:'Flow Units'; Style:esComboList; Mask:emNone; Length:0;
209209
List:'CFS'#13'GPM'#13'MGD'#13'IMGD'#13'AFD'#13 +
210210
'LPS'#13'LPM'#13'MLD'#13'CMH'#13'CMD'#13'CMS'),
@@ -219,6 +219,8 @@ const
219219
(Name:'Default Pattern'; Style:esEdit; Mask:emNoSpace; Length:MAXID),
220220
(Name:'Demand Multiplier'; Style:esEdit; Mask:emPosNumber),
221221
(Name:'Emitter Exponent'; Style:esEdit; Mask:emPosNumber),
222+
(Name:'Emitter Backflow'; Style:esComboList; Mask:emNone; Length:0;
223+
List:'Yes'#13'No'),
222224
(Name:'Status Report'; Style:esComboList; Mask:emNone; Length:0;
223225
List:'No'#13'Yes'#13'Full'),
224226

@@ -395,7 +397,9 @@ const
395397
'DDA', {41-Demand Model}
396398
'0', {42-Minimum Pressure}
397399
'0.1', {43-Required Pressure}
398-
'0.5'); {44-Pressure Exponent}
400+
'0.5', {44-Pressure Exponent}
401+
402+
'Yes'); {45-Emitter Backflow}
399403

400404
//Node reporting variables
401405
// Name = name of variable

0 commit comments

Comments
 (0)