Skip to content

Commit 6d1a0e2

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

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
@@ -1624,7 +1624,7 @@ def convertMo2Fmu(
16241624
# to convert FMU to Modelica model
16251625
def convertFmu2Mo(
16261626
self,
1627-
fmuName: os.PathLike,
1627+
fmu: os.PathLike,
16281628
) -> pathlib.Path:
16291629
"""
16301630
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
@@ -1634,7 +1634,7 @@ def convertFmu2Mo(
16341634
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16351635
"""
16361636

1637-
fmu_path = pathlib.Path(fmuName)
1637+
fmu_path = pathlib.Path(fmu)
16381638

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

1646+
self.model(
1647+
name=f"{fmu_path.stem}_me_FMU",
1648+
file=filepath,
1649+
)
1650+
16461651
return filepath
16471652

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

0 commit comments

Comments
 (0)