Skip to content

Commit 781e508

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

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
@@ -1583,16 +1583,17 @@ def convertMo2Fmu(
15831583
# to convert FMU to Modelica model
15841584
def convertFmu2Mo(
15851585
self,
1586-
fmuName: os.PathLike,
1586+
fmu: os.PathLike,
15871587
) -> pathlib.Path:
15881588
"""
1589-
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".
1589+
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
1590+
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
15901591
Currently, it only supports Model Exchange conversion.
15911592
usage
15921593
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
15931594
"""
15941595

1595-
fmu_path = pathlib.Path(fmuName)
1596+
fmu_path = pathlib.Path(fmu)
15961597

15971598
filename = self._requestApi(apiName='importFMU', entity=fmu_path.as_posix())
15981599
filepath = pathlib.Path(filename)
@@ -1601,6 +1602,11 @@ def convertFmu2Mo(
16011602
if not filepath.is_file():
16021603
raise ModelicaSystemError(f"Missing file {filepath.as_posix()}")
16031604

1605+
self.definition(
1606+
model=f"{fmu_path.stem}_me_FMU",
1607+
file=filepath,
1608+
)
1609+
16041610
return filepath
16051611

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

0 commit comments

Comments
 (0)