diff --git a/api/s23_options.py b/api/s23_options.py index aca00a4..f1a372c 100644 --- a/api/s23_options.py +++ b/api/s23_options.py @@ -49,11 +49,32 @@ def inp_in_option(section: list[str]) -> str: def inp_out_option(name: str) -> list[str]: lines = [] 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: key = obj['key'] + # why write this ? + if key == 'PRESSURE': + continue # release version does not support new keys and has error message if key == 'HTOL' or key == 'QTOL' or key == 'RQTOL': continue + # ignore some weird settings for DDA + if is_dda and key in dda_ignore: + continue value = obj['value'] if str(value).strip() != '': lines.append(f'{key} {value}')