Skip to content

Commit 49c6fc0

Browse files
authored
Update epamodule.py
Following the release of epanet 2.2 version and new API functions available, two functions were added to epamodule.py : 1) ENsettitle 2) ENsetflowunits
1 parent 05d33cb commit 49c6fc0

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

epanet-module/epamodule.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,33 @@ def ENopen(nomeinp, nomerpt='', nomebin=''):
7070
if ierr!=0:
7171
raise ENtoolkitError(ierr)
7272

73+
def ENsettitle(title):
74+
"""Set inp file title
75+
76+
Arguments:
77+
title: inp title"""
78+
ierr = _lib.ENsettitle(ctypes.c_char_p(title.encode()),'','')
79+
if ierr!=0: raise ENtoolkitError(ierr)
80+
81+
82+
def ENsetflowunits(units_code):
83+
"""Set flow units
84+
85+
Arguments:
86+
units_code: int code for unit type:
87+
EN_CFS 0 cubic feet per second
88+
EN_GPM 1 gallons per minute
89+
EN_MGD 2 million gallons per day
90+
EN_IMGD 3 Imperial mgd
91+
EN_AFD 4 acre-feet per day
92+
EN_LPS 5 liters per second
93+
EN_LPM 6 liters per minute
94+
EN_MLD 7 million liters per day
95+
EN_CMH 8 cubic meters per hour
96+
EN_CMD 9 cubic meters per day
97+
"""
98+
ierr = _lib.ENsetflowunits(ctypes.c_int(units_code))
99+
if ierr != 0: raise ENtoolkitError(ierr)
73100

74101
def ENclose():
75102
"""Closes down the Toolkit system (including all files being processed)"""

0 commit comments

Comments
 (0)