Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ModelicaSystem] define convertFmu2Mo() as entry point like definition()
* rename fmuName => fmu
  • Loading branch information
syntron committed Nov 13, 2025
commit 3bbf782c74b4b0eeaabee32c5d2f89253c018e4e
9 changes: 7 additions & 2 deletions OMPython/ModelicaSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ def convertMo2Fmu(
# to convert FMU to Modelica model
def convertFmu2Mo(
self,
fmuName: os.PathLike,
fmu: os.PathLike,
) -> pathlib.Path:
"""
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
Expand All @@ -1679,7 +1679,7 @@ def convertFmu2Mo(
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
"""

fmu_path = pathlib.Path(fmuName)
fmu_path = pathlib.Path(fmu)

filename = self._requestApi(apiName='importFMU', entity=fmu_path.as_posix())
filepath = pathlib.Path(filename)
Expand All @@ -1688,6 +1688,11 @@ def convertFmu2Mo(
if not filepath.is_file():
raise ModelicaSystemError(f"Missing file {filepath.as_posix()}")

self.model(
name=f"{fmu_path.stem}_me_FMU",
file=filepath,
)

return filepath

def optimize(self) -> dict[str, Any]:
Expand Down