Support run epa3

This commit is contained in:
Joey Wang
2023-03-22 13:36:57 +08:00
parent a73cd3deba
commit 9a65990278
3 changed files with 13 additions and 7 deletions

View File

@@ -227,17 +227,21 @@ def dump_output(path: str) -> str:
return json.dumps(data)
def run_project(name: str) -> str:
def run_project(name: str, version: str = '3') -> str:
if version != '3' and version != '2':
version = '2'
if not project.have_project(name):
raise Exception(f'Not found project [{name}]')
dir = os.path.abspath(os.getcwd())
db_inp = os.path.join(os.path.join(dir, 'db_inp'), name + '.db.inp')
inp_out.dump_inp(name, db_inp)
inp_out.dump_inp(name, db_inp, version)
input = name + '.db'
exe = os.path.join(os.path.join(dir, 'epanet'), 'runepanet.exe')
program = 'runepanet.exe' if version == '2' else 'run-epanet3.exe'
exe = os.path.join(os.path.join(dir, 'epanet'), program)
inp = os.path.join(os.path.join(dir, 'db_inp'), input + '.inp')
rpt = os.path.join(os.path.join(dir, 'temp'), input + '.rpt')
opt = os.path.join(os.path.join(dir, 'temp'), input + '.opt')