Skip to content

Commit a60a304

Browse files
committed
[ModelicaSystemDoE] session => omc_process
1 parent b2b7817 commit a60a304

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,9 +2003,9 @@ def __init__(
20032003
self._timeout = timeout
20042004

20052005
if resultpath is None:
2006-
self._resultpath = self.session().omcpath_tempdir()
2006+
self._resultpath = self.get_omc_process().omcpath_tempdir()
20072007
else:
2008-
self._resultpath = self.session().omcpath(resultpath)
2008+
self._resultpath = self.get_omc_process().omcpath(resultpath)
20092009
if not self._resultpath.is_dir():
20102010
raise ModelicaSystemError("Argument resultpath must be set to a valid path within the environment used "
20112011
f"for the OpenModelica session: {resultpath}!")
@@ -2018,7 +2018,7 @@ def __init__(
20182018
self._doe_def: Optional[dict[str, dict[str, Any]]] = None
20192019
self._doe_cmd: Optional[dict[str, OMCProcessRunData]] = None
20202020

2021-
def session(self) -> OMCSessionZMQ:
2021+
def get_omc_process(self) -> OMCSessionZMQ:
20222022
"""
20232023
Return the OMC session used for this class.
20242024
"""
@@ -2061,7 +2061,7 @@ def prepare(self) -> int:
20612061

20622062
pk_value = pc_structure[idx_structure]
20632063
if isinstance(pk_value, str):
2064-
pk_value_str = self.session().escape_str(pk_value)
2064+
pk_value_str = self.get_omc_process().escape_str(pk_value)
20652065
expression = f"setParameterValue({self._model_name}, {pk_structure}, \"{pk_value_str}\")"
20662066
elif isinstance(pk_value, bool):
20672067
pk_value_bool_str = "true" if pk_value else "false"
@@ -2183,12 +2183,12 @@ def worker(worker_id, task_queue):
21832183
raise ModelicaSystemError("Missing simulation definition!")
21842184

21852185
resultfile = cmd_definition.cmd_result_path
2186-
resultpath = self.session().omcpath(resultfile)
2186+
resultpath = self.get_omc_process().omcpath(resultfile)
21872187

21882188
logger.info(f"[Worker {worker_id}] Performing task: {resultpath.name}")
21892189

21902190
try:
2191-
returncode = self.session().run_model_executable(cmd_run_data=cmd_definition)
2191+
returncode = self.get_omc_process().run_model_executable(cmd_run_data=cmd_definition)
21922192
logger.info(f"[Worker {worker_id}] Simulation {resultpath.name} "
21932193
f"finished with return code: {returncode}")
21942194
except ModelicaSystemError as ex:

0 commit comments

Comments
 (0)