From 479bfa7bc9769d8c9ea6a5319b4353c55a164499 Mon Sep 17 00:00:00 2001 From: jue-hu Date: Tue, 2 Jan 2024 16:57:29 +0800 Subject: [PATCH] update --- mikeplus/engines/__init__.py | 3 +-- mikeplus/engines/engine1d.py | 2 +- mikeplus/engines/epanet.py | 12 ++++-------- mikeplus/engines/swmm.py | 12 ++++-------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/mikeplus/engines/__init__.py b/mikeplus/engines/__init__.py index e2f1804..93d95c8 100644 --- a/mikeplus/engines/__init__.py +++ b/mikeplus/engines/__init__.py @@ -8,8 +8,7 @@ clr.AddReference("DHI.Amelia.DataModule.Interface") clr.AddReference("DHI.Amelia.Infrastructure.Interface") clr.AddReference("DHI.Amelia.GlobalUtility") -clr.AddReference("DHI.Amelia.DomainServices") -clr.AddReference("DHI.Amelia.DomainServices.Interface") +clr.AddReference("DHI.Amelia.Tools.EngineTool") from .engine1d import Engine1D from .epanet import EPANET diff --git a/mikeplus/engines/engine1d.py b/mikeplus/engines/engine1d.py index b4b4248..6bb86d7 100644 --- a/mikeplus/engines/engine1d.py +++ b/mikeplus/engines/engine1d.py @@ -25,7 +25,7 @@ def run(self, -------- >>>data_access = DataTableAccess(muppOrSqlite) >>>data_access.open_database() - >>>engine = Egnine1D(data_access.datatables) + >>>engine = Engine1D(data_access.datatables) >>>engine.run() >>>data_access.close_database() """ diff --git a/mikeplus/engines/epanet.py b/mikeplus/engines/epanet.py index 2301a6a..d9a076b 100644 --- a/mikeplus/engines/epanet.py +++ b/mikeplus/engines/epanet.py @@ -1,6 +1,5 @@ import os.path -from DHI.Amelia.DomainServices.Services import AmeliaEngineService -from DHI.Amelia.DomainServices.Services import AmeliaDataService +from DHI.Amelia.Tools.EngineTool import EngineTool from DHI.Amelia.GlobalUtility.DataType import MUSimulationOption from DHI.Amelia.DataModule.Interface.Services import IMwProjectTable from System.Threading import CancellationTokenSource @@ -38,14 +37,11 @@ def run_engine_epanet(self, print("Simulation id can't be none.") return print("Simulation id is " + simMuid) - data_service = AmeliaDataService() - data_service.DataTables = self._dataTables - engine_service = AmeliaEngineService() - engine_service.DataTables = self._dataTables - engine_service.DataService = data_service + engine_tool = EngineTool() + engine_tool.DataTables = self._dataTables cancel_source = CancellationTokenSource() msg = List[str]() - success = engine_service.RunEngine_AllEpanet(MUSimulationOption.WD_EPANET, cancel_source.Token, msg, None, None, None, simMuid, None, None) + success = engine_tool.RunEngine_AllEpanet(MUSimulationOption.WD_EPANET, cancel_source.Token, msg, None, None, None, simMuid, None, None) if self._result_file is None: self._result_file = self._get_result_file(simMuid) dir = os.path.dirname(os.path.abspath(self._result_file)) diff --git a/mikeplus/engines/swmm.py b/mikeplus/engines/swmm.py index 79a52b2..b9c5452 100644 --- a/mikeplus/engines/swmm.py +++ b/mikeplus/engines/swmm.py @@ -1,6 +1,5 @@ import os.path -from DHI.Amelia.DomainServices.Services import AmeliaEngineService -from DHI.Amelia.DomainServices.Services import AmeliaDataService +from DHI.Amelia.Tools.EngineTool import EngineTool from DHI.Amelia.DataModule.Interface.Services import IMProjectTable from System.Threading import CancellationTokenSource from System.Collections.Generic import List @@ -37,14 +36,11 @@ def run(self, print("Simulation id can't be none.") return print("Simulation id is " + simMuid) - data_service = AmeliaDataService() - data_service.DataTables = self._dataTables - engine_service = AmeliaEngineService() - engine_service.DataTables = self._dataTables - engine_service.DataService = data_service + engine_tool = EngineTool() + engine_tool.DataTables = self._dataTables cancel_source = CancellationTokenSource() msg = List[str]() - success = engine_service.RunEngine_AllSWMM(cancel_source.Token, msg, None, None, None, simMuid, None, None) + success = engine_tool.RunEngine_AllSWMM(cancel_source.Token, msg, None, None, None, simMuid, None, None) if self._result_file is None: self._result_file = self._get_result_file(simMuid) dir = os.path.dirname(os.path.abspath(self._result_file))