Skip to content

Commit 5af506b

Browse files
committed
WiP WiP-check2
1 parent a7dbf39 commit 5af506b

6 files changed

Lines changed: 298 additions & 146 deletions

File tree

.github/workflows/Test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
timeout-minutes: 30
1515
strategy:
1616
matrix:
17-
python-version: ['3.10', '3.12', '3.13']
17+
python-version: ['3.13']
1818
os: ['ubuntu-latest', 'windows-latest']
19-
omc-version: ['stable', 'nightly']
19+
omc-version: ['stable']
2020

2121
steps:
2222
- uses: actions/checkout@v6

OMPython/ModelicaSystem.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@
2121
import numpy as np
2222

2323
from OMPython.OMCSession import (
24-
ModelExecutionData,
2524
ModelExecutionException,
26-
27-
OMCPath,
28-
OMCSession,
29-
OMCSessionDummy,
30-
OMCSessionException,
25+
ModelExecutionData,
26+
PathBase,
27+
SessionBase,
28+
SessionRunner,
3129
OMCSessionLocal,
30+
OMCSessionException,
3231
)
3332

33+
OMCPath = PathBase
34+
OMCSession = SessionBase
35+
3436
# define logger using the current module name as ID
3537
logger = logging.getLogger(__name__)
3638

@@ -1665,8 +1667,6 @@ def buildModel(self, variableFilter: Optional[str] = None):
16651667
def sendExpression(self, expr: str, parsed: bool = True) -> Any:
16661668
"""
16671669
Wrapper for OMCSession.sendExpression().
1668-
1669-
TODO: rename expr => command
16701670
"""
16711671
try:
16721672
retval = self._session.sendExpression(command=expr, parsed=parsed)
@@ -2244,8 +2244,6 @@ def prepare(self) -> int:
22442244
build_dir.mkdir()
22452245
self._mod.setWorkDirectory(work_directory=build_dir)
22462246

2247-
# TODO: check omc_mod
2248-
22492247
sim_param_structure = {}
22502248
for idx_structure, pk_structure in enumerate(param_structure.keys()):
22512249
sim_param_structure[pk_structure] = pc_structure[idx_structure]
@@ -2423,7 +2421,6 @@ def worker(worker_id, task_queue):
24232421
def get_doe_solutions(
24242422
self,
24252423
var_list: Optional[list] = None,
2426-
# TODO: omc_mod
24272424
) -> Optional[tuple[str] | dict[str, dict[str, np.ndarray]]]:
24282425
"""
24292426
Get all solutions of the DoE run. The following return values are possible:
@@ -2453,8 +2450,6 @@ def get_doe_solutions(
24532450
if len(self._doe_def) == 0:
24542451
raise ModelicaSystemError("No result files available - all simulations did fail?")
24552452

2456-
# TODO: check omc_mod
2457-
24582453
sol_dict: dict[str, dict[str, Any]] = {}
24592454
for resultfilename in self._doe_def:
24602455
resultfile = self._resultpath / resultfilename
@@ -2495,12 +2490,12 @@ class ModelicaSystemRunner(ModelicaSystemBase):
24952490
def __init__(
24962491
self,
24972492
work_directory: Optional[str | os.PathLike] = None,
2498-
session: Optional[OMCSession] = None,
2493+
session: Optional[SessionBase] = None,
24992494
) -> None:
25002495
if session is None:
2501-
session = OMCSessionDummy()
2496+
session = SessionRunner()
25022497

2503-
if not isinstance(session, OMCSessionDummy):
2498+
if not isinstance(session, SessionRunner):
25042499
raise ModelicaSystemError("Only working if OMCsessionDummy is used!")
25052500

25062501
super().__init__(

0 commit comments

Comments
 (0)