Skip to content

Examples from Modelica.Fluids (e.g. PumpingSystem and others) translation error when calling from python #397

@Ulfsen

Description

@Ulfsen

Description

When I start Modelica.Fluid.Examples.PumpingSystem and other ((Fluid.Examples.Tanks.ThreeTanks, Fluid.Examples.Tanks.TanksWithOverflow, Fluid.Examples.Tanks.EmptyTanks) from OmEdit it simulates, but when I call the same model from python, I get an error:

`[OMC log for 'sendExpression(buildModel(Modelica.Fluid.Examples.PumpingSystem, variableFilter="."), True)']: [symbolic:warning:7017] The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts.
...
OMPython.OMCSession.OMCSessionException: [OMC log for 'sendExpression(buildModel(Modelica.Fluid.Examples.PumpingSystem, variableFilter=".
"), True)']: [translation:error:7024] Jacobian A contains non-linear components. This indicates a singular system or internal generation errors.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "mnt/c/test.py", line 12, in
mod = ModelicaSystem(modelName="Modelica.Fluid.Examples.PumpingSystem")
File "/mnt/c/venv_wsl/lib/python3.14/site-packages/OMPython/ModelicaSystem.py", line 468, in init
self.buildModel(variableFilter)
~~~~~~~^^^^^^^^^^^^^^^^
File "/mnt/c/venv_wsl/lib/python3.14/site-packages/OMPython/ModelicaSystem.py", line 546, in buildModel
buildModelResult = self._requestApi(apiName="buildModel", entity=self._model_name, properties=var_filter)
File "/mnt/c/venv_wsl/lib/python3.14/site-packages/OMPython/ModelicaSystem.py", line 579, in _requestApi
return self.sendExpression(exp)
~~~~~~~~~~~~~^^^^^
File "/mnt/c/venv_wsl/lib/python3.14/site-packages/OMPython/ModelicaSystem.py", line 556, in sendExpression
raise ModelicaSystemError(f"Error executing {repr(expr)}") from ex
OMPython.ModelicaSystem.ModelicaSystemError: Error executing 'buildModel(Modelica.Fluid.Examples.PumpingSystem, variableFilter=".*")'`

Steps to Reproduce

Install a python environment with OMPython an run the following python code:
import sys
from OMPython import OMCSessionZMQ
from OMPython import ModelicaSystem
omc = OMCSessionZMQ()
mod = ModelicaSystem(modelName="Modelica.Fluid.Examples.PumpingSystem")
mod.simulate()

Expected Behavior

The model should simulate when called from python.

Version and OS

Tested with nightly 1.26 (in wsl) and 1.25.3 native on windows with different python-versions (3.12 and 3.14).

Additional Informations

Possibly duplicate or related to #283

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions