Skip to content

Commit

Permalink
Merge pull request #9 from DHI/updateEngineTool
Browse files Browse the repository at this point in the history
update domain service to engine tool
  • Loading branch information
wuwwen authored Jan 2, 2024
2 parents 74f3e48 + 479bfa7 commit 1ec4266
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
3 changes: 1 addition & 2 deletions mikeplus/engines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mikeplus/engines/engine1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
"""
Expand Down
12 changes: 4 additions & 8 deletions mikeplus/engines/epanet.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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))
Expand Down
12 changes: 4 additions & 8 deletions mikeplus/engines/swmm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 1ec4266

Please sign in to comment.