Skip to content

Commit 5d67225

Browse files
authored
Adding build as argument to ModelicaSystem constructor (#285)
1 parent 00f894c commit 5d67225

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

OMPython/ModelicaSystem.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def __init__(
117117
variableFilter: Optional[str] = None,
118118
customBuildDirectory: Optional[str | os.PathLike] = None,
119119
omhome: Optional[str] = None,
120-
session: Optional[OMCSessionBase] = None
120+
session: Optional[OMCSessionBase] = None,
121+
build: Optional[bool] = True
121122
):
122123
"""Initialize, load and build a model.
123124
@@ -146,6 +147,9 @@ def __init__(
146147
session.
147148
session: OMC session to be used. If unspecified, a new session
148149
will be created.
150+
build: Boolean controlling whether or not the model should be
151+
built when constructor is called. If False, the constructor
152+
simply loads the model without compiling.
149153
150154
Examples:
151155
mod = ModelicaSystem("ModelicaModel.mo", "modelName")
@@ -217,7 +221,8 @@ def __init__(
217221
elif fileName is None and modelName is not None:
218222
self.loadLibrary(lmodel=self.lmodel)
219223

220-
self.buildModel(variableFilter)
224+
if build:
225+
self.buildModel(variableFilter)
221226

222227
def setCommandLineOptions(self, commandLineOptions: str):
223228
# set commandLineOptions if provided by users

0 commit comments

Comments
 (0)