Skip to content

Commit 70e2241

Browse files
committed
[ModelicaSystem] replace pathlib by OMCPath
1 parent 8cfb475 commit 70e2241

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ def convertMo2Fmu(
15801580
fmuType: str = "me_cs",
15811581
fileNamePrefix: Optional[str] = None,
15821582
includeResources: bool = True,
1583-
) -> pathlib.Path:
1583+
) -> OMCPath:
15841584
"""Translate the model into a Functional Mockup Unit.
15851585
15861586
Args:
@@ -1617,7 +1617,7 @@ def convertMo2Fmu(
16171617
def convertFmu2Mo(
16181618
self,
16191619
fmu: os.PathLike,
1620-
) -> pathlib.Path:
1620+
) -> OMCPath:
16211621
"""
16221622
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
16231623
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -1626,7 +1626,10 @@ def convertFmu2Mo(
16261626
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16271627
"""
16281628

1629-
fmu_path = pathlib.Path(fmu)
1629+
fmu_path = self._getconn.omcpath(fmu)
1630+
1631+
if not fmu_path.is_file():
1632+
raise ModelicaSystemError(f"Missing FMU file: {fmu_path.as_posix()}")
16301633

16311634
filename = self._requestApi(apiName='importFMU', entity=fmu_path.as_posix())
16321635
filepath = self._work_dir / filename

0 commit comments

Comments
 (0)