Skip to content

Commit d37ec0b

Browse files
committed
[ModelicaSystem*] add timeout argument
1 parent 4c89099 commit d37ec0b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

OMPython/ModelicaSystem.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ def __init__(
337337
work_directory: Optional[str | os.PathLike] = None,
338338
omhome: Optional[str] = None,
339339
omc_process: Optional[OMCProcess] = None,
340+
timeout: float = 10.0,
340341
) -> None:
341342
"""Create a ModelicaSystem instance. To define the model use model() or convertFmu2Mo().
342343
@@ -350,6 +351,7 @@ def __init__(
350351
omhome: path to OMC to be used when creating the OMC session (see OMCSessionZMQ).
351352
omc_process: definition of a (local) OMC process to be used. If
352353
unspecified, a new local session will be created.
354+
timeout: float value to define the timeout; if nothing is defined, a default value of 10s is used
353355
"""
354356

355357
self._quantities: list[dict[str, Any]] = []
@@ -379,7 +381,7 @@ def __init__(
379381
if omc_process is not None:
380382
self._session = OMCSessionZMQ(omc_process=omc_process)
381383
else:
382-
self._session = OMCSessionZMQ(omhome=omhome)
384+
self._session = OMCSessionZMQ(omhome=omhome, timeout=timeout)
383385

384386
# set commandLineOptions using default values or the user defined list
385387
if command_line_options is None:
@@ -1968,10 +1970,10 @@ def __init__(
19681970
work_directory: Optional[str | os.PathLike] = None,
19691971
omhome: Optional[str] = None,
19701972
omc_process: Optional[OMCProcess] = None,
1973+
timeout: float = 10.0,
19711974
# simulation specific input
19721975
# TODO: add more settings (simulation options, input options, ...)
19731976
simargs: Optional[dict[str, Optional[str | dict[str, str] | numbers.Number]]] = None,
1974-
timeout: Optional[int] = None,
19751977
# DoE specific inputs
19761978
resultpath: Optional[str | os.PathLike] = None,
19771979
parameters: Optional[dict[str, list[str] | list[int] | list[float]]] = None,
@@ -1989,6 +1991,7 @@ def __init__(
19891991
work_directory=work_directory,
19901992
omhome=omhome,
19911993
omc_process=omc_process,
1994+
timeout=timeout,
19921995
)
19931996
self._mod.model(
19941997
model_file=model_file,

0 commit comments

Comments
 (0)