Skip to content

Commit 48a54ef

Browse files
committed
[ModelicaSystemDoE] rename variables
1 parent 59bce4d commit 48a54ef

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,8 +1893,8 @@ def run_doe():
18931893
resdir.mkdir(exist_ok=True)
18941894
18951895
doe_mod = OMPython.ModelicaSystemDoE(
1896-
fileName=model.as_posix(),
1897-
modelName="M",
1896+
model_name="M",
1897+
model_file=model.as_posix(),
18981898
parameters=param,
18991899
resultpath=resdir,
19001900
simargs={"override": {'stopTime': 1.0}},
@@ -1922,11 +1922,11 @@ def run_doe():
19221922
def __init__(
19231923
self,
19241924
# data to be used for ModelicaSystem
1925-
fileName: Optional[str | os.PathLike] = None,
1926-
modelName: Optional[str] = None,
1927-
lmodel: Optional[list[str | tuple[str, str]]] = None,
1925+
model_file: Optional[str | os.PathLike] = None,
1926+
model_name: Optional[str] = None,
1927+
libraries: Optional[list[str | tuple[str, str]]] = None,
19281928
commandLineOptions: Optional[list[str]] = None,
1929-
variableFilter: Optional[str] = None,
1929+
variable_filter: Optional[str] = None,
19301930
customBuildDirectory: Optional[str | os.PathLike] = None,
19311931
omhome: Optional[str] = None,
19321932
omc_process: Optional[OMCProcess] = None,
@@ -1943,6 +1943,8 @@ def __init__(
19431943
ModelicaSystem.simulate(). Additionally, the path to store the result files is needed (= resultpath) as well as
19441944
a list of parameters to vary for the Doe (= parameters). All possible combinations are considered.
19451945
"""
1946+
if model_name is None:
1947+
raise ModelicaSystemError("No model name provided!")
19461948

19471949
self._mod = ModelicaSystem(
19481950
commandLineOptions=commandLineOptions,
@@ -1951,13 +1953,13 @@ def __init__(
19511953
omc_process=omc_process,
19521954
)
19531955
self._mod.model(
1954-
model_file=fileName,
1955-
model_name=modelName,
1956-
libraries=lmodel,
1957-
variable_filter=variableFilter,
1956+
model_file=model_file,
1957+
model_name=model_name,
1958+
libraries=libraries,
1959+
variable_filter=variable_filter,
19581960
)
19591961

1960-
self._model_name = modelName
1962+
self._model_name = model_name
19611963

19621964
self._simargs = simargs
19631965
self._timeout = timeout

tests/test_ModelicaSystemDoE.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def test_ModelicaSystemDoE_local(tmp_path, model_doe, param_doe):
5454
tmpdir.mkdir(exist_ok=True)
5555

5656
doe_mod = OMPython.ModelicaSystemDoE(
57-
fileName=model_doe.as_posix(),
58-
modelName="M",
57+
model_file=model_doe.as_posix(),
58+
model_name="M",
5959
parameters=param_doe,
6060
resultpath=tmpdir,
6161
simargs={"override": {'stopTime': 1.0}},
@@ -73,8 +73,8 @@ def test_ModelicaSystemDoE_docker(tmp_path, model_doe, param_doe):
7373

7474
modelpath = omc.omcpath_tempdir()
7575
doe_mod = OMPython.ModelicaSystemDoE(
76-
fileName=model_doe.as_posix(),
77-
modelName="M",
76+
model_file=modelpath.as_posix(),
77+
model_name="M",
7878
parameters=param_doe,
7979
omc_process=omcp,
8080
resultpath=modelpath,
@@ -91,8 +91,8 @@ def test_ModelicaSystemDoE_WSL(tmp_path, model_doe, param_doe):
9191
tmpdir.mkdir(exist_ok=True)
9292

9393
doe_mod = OMPython.ModelicaSystemDoE(
94-
fileName=model_doe.as_posix(),
95-
modelName="M",
94+
model_file=model_doe.as_posix(),
95+
model_name="M",
9696
parameters=param_doe,
9797
resultpath=tmpdir,
9898
simargs={"override": {'stopTime': 1.0}},

0 commit comments

Comments
 (0)