Fix inp for DDA
This commit is contained in:
@@ -49,11 +49,32 @@ def inp_in_option(section: list[str]) -> str:
|
|||||||
def inp_out_option(name: str) -> list[str]:
|
def inp_out_option(name: str) -> list[str]:
|
||||||
lines = []
|
lines = []
|
||||||
objs = read_all(name, f"select * from options")
|
objs = read_all(name, f"select * from options")
|
||||||
|
|
||||||
|
is_dda = False
|
||||||
|
|
||||||
|
for obj in objs:
|
||||||
|
if obj['key'] == 'DEMAND MODEL':
|
||||||
|
is_dda = obj['value'] == 'DDA'
|
||||||
|
|
||||||
|
dda_ignore = [
|
||||||
|
'HEADERROR', # TODO: default is 0 which is conflict with PDA
|
||||||
|
'FLOWCHANGE', # TODO: default is 0 which is conflict with PDA
|
||||||
|
'MINIMUM PRESSURE',
|
||||||
|
'REQUIRED PRESSURE',
|
||||||
|
'PRESSURE EXPONENT'
|
||||||
|
]
|
||||||
|
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
key = obj['key']
|
key = obj['key']
|
||||||
|
# why write this ?
|
||||||
|
if key == 'PRESSURE':
|
||||||
|
continue
|
||||||
# release version does not support new keys and has error message
|
# release version does not support new keys and has error message
|
||||||
if key == 'HTOL' or key == 'QTOL' or key == 'RQTOL':
|
if key == 'HTOL' or key == 'QTOL' or key == 'RQTOL':
|
||||||
continue
|
continue
|
||||||
|
# ignore some weird settings for DDA
|
||||||
|
if is_dda and key in dda_ignore:
|
||||||
|
continue
|
||||||
value = obj['value']
|
value = obj['value']
|
||||||
if str(value).strip() != '':
|
if str(value).strip() != '':
|
||||||
lines.append(f'{key} {value}')
|
lines.append(f'{key} {value}')
|
||||||
|
|||||||
Reference in New Issue
Block a user