Skip to content

Commit de3ca14

Browse files
committed
[ModelicaSystem] define convertFmu2Mo() as entry point like definition()
* rename fmuName => fmu
1 parent 2b5d938 commit de3ca14

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ def convertMo2Fmu(
16401640
# to convert FMU to Modelica model
16411641
def convertFmu2Mo(
16421642
self,
1643-
fmuName: os.PathLike,
1643+
fmu: os.PathLike,
16441644
) -> pathlib.Path:
16451645
"""
16461646
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
@@ -1650,7 +1650,7 @@ def convertFmu2Mo(
16501650
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16511651
"""
16521652

1653-
fmu_path = pathlib.Path(fmuName)
1653+
fmu_path = pathlib.Path(fmu)
16541654

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

1662+
self.model(
1663+
name=f"{fmu_path.stem}_me_FMU",
1664+
file=filepath,
1665+
)
1666+
16621667
return filepath
16631668

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

0 commit comments

Comments
 (0)