Allow to read EPANET3 curve

This commit is contained in:
WQY\qiong
2023-03-02 20:01:51 +08:00
parent 2f395986c3
commit 406d88a6b8

View File

@@ -122,10 +122,14 @@ def delete_curve(name: str, cs: ChangeSet) -> ChangeSet:
#--------------------------------------------------------------
# [EPANET2][IN][OUT]
# [EPA2][IN][OUT]
# ;type: desc
# id x y
#--------------------------------------------------------------
# [EPA3][IN][OUT]
# id type
# id x y
#--------------------------------------------------------------
def inp_in_curve(section: list[str]) -> ChangeSet:
types = {}
descs = {}
@@ -146,6 +150,12 @@ def inp_in_curve(section: list[str]) -> ChangeSet:
continue
tokens = section[i].split()
# for EPA3
if tokens[1] == 'PUMP' or tokens[1] == 'EFFICIENCY' or tokens[1] == 'VOLUME' or tokens[1] == 'HEADLOSS':
types[tokens[0]] = tokens[1]
continue
if tokens[0] not in curves:
curves[tokens[0]] = []
curves[tokens[0]].append({'x': float(tokens[1]), 'y': float(tokens[2])})