Skip to content

Commit 9a41bef

Browse files
committed
Merge branch 'ModelicaSystem_rewrite_set_functions' into merge_me
2 parents 8b1d39c + 0a89151 commit 9a41bef

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,29 +1212,25 @@ def _set_method_helper(
12121212
dict() which stores the new override variables list,
12131213
"""
12141214

1215-
inputdata_status: dict[str, bool] = {}
12161215
for key, val in inputdata.items():
12171216
if key not in classdata:
12181217
raise ModelicaSystemError("Unhandled case in setMethodHelper.apply_single() - "
12191218
f"{repr(key)} is not a {repr(datatype)} variable")
12201219

1221-
status = False
12221220
if datatype == "parameter" and not self.isParameterChangeable(key):
1223-
logger.debug(f"It is not possible to set the parameter {repr(key)}. It seems to be "
1224-
"structural, final, protected, evaluated or has a non-constant binding. "
1225-
"Use sendExpression(...) and rebuild the model using buildModel() API; example: "
1226-
"sendExpression(\"setParameterValue("
1227-
f"{self._model_name}, {key}, {val if val is not None else '<?value?>'}"
1228-
")\") ")
1229-
else:
1230-
classdata[key] = val
1231-
if overwritedata is not None:
1232-
overwritedata[key] = val
1233-
status = True
1234-
1235-
inputdata_status[key] = status
1221+
raise ModelicaSystemError(f"It is not possible to set the parameter {repr(key)}. It seems to be "
1222+
"structural, final, protected, evaluated or has a non-constant binding. "
1223+
"Use sendExpression(...) and rebuild the model using buildModel() API; "
1224+
"command to set the parameter before rebuilding the model: "
1225+
"sendExpression(\"setParameterValue("
1226+
f"{self._model_name}, {key}, {val if val is not None else '<?value?>'}"
1227+
")\").")
1228+
1229+
classdata[key] = val
1230+
if overwritedata is not None:
1231+
overwritedata[key] = val
12361232

1237-
return all(inputdata_status.values())
1233+
return True
12381234

12391235
def isParameterChangeable(
12401236
self,

0 commit comments

Comments
 (0)