Skip to content

Commit efd6775

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

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

OMPython/modelica_system_abc.py

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

0 commit comments

Comments
 (0)