Skip to content

Commit e4cf36f

Browse files
committed
[ModelicaSystemABC] check OM version - force the version used by the model executable
1 parent f3e1b81 commit e4cf36f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

OMPython/modelica_system_abc.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ def _xmlparse(self, xml_file: OMPathABC):
215215
root = tree.getroot()
216216
if root is None:
217217
raise ModelicaSystemError(f"Cannot read XML file: {xml_file}")
218+
# check OM version - force the version used by the model executable
219+
if 'generationTool' in root.attrib:
220+
generation_tool_version = self._parse_om_version(version=root.attrib['generationTool'])
221+
if self._version != generation_tool_version:
222+
logger.warning(f"Mismatch in OpenModelica version: {self._version!r} (OMSession) "
223+
f"vs. {generation_tool_version!r} (model executable) "
224+
f"- using {generation_tool_version!r}!")
225+
self._version = generation_tool_version
226+
218227
for attr in root.iter('DefaultExperiment'):
219228
for key in ("startTime", "stopTime", "stepSize", "tolerance",
220229
"solver", "outputFormat"):

0 commit comments

Comments
 (0)