Skip to content

Commit 24f65a9

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

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,16 +1616,17 @@ def convertMo2Fmu(
16161616
# to convert FMU to Modelica model
16171617
def convertFmu2Mo(
16181618
self,
1619-
fmuName: os.PathLike,
1619+
fmu: os.PathLike,
16201620
) -> pathlib.Path:
16211621
"""
1622-
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
1622+
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
1623+
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
16231624
Currently, it only supports Model Exchange conversion.
16241625
usage
16251626
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16261627
"""
16271628

1628-
fmu_path = pathlib.Path(fmuName)
1629+
fmu_path = pathlib.Path(fmu)
16291630

16301631
filename = self._requestApi(apiName='importFMU', entity=fmu_path.as_posix())
16311632
filepath = pathlib.Path(filename)
@@ -1634,6 +1635,11 @@ def convertFmu2Mo(
16341635
if not filepath.is_file():
16351636
raise ModelicaSystemError(f"Missing file {filepath.as_posix()}")
16361637

1638+
self.model(
1639+
name=f"{fmu_path.stem}_me_FMU",
1640+
file=filepath,
1641+
)
1642+
16371643
return filepath
16381644

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

0 commit comments

Comments
 (0)