Skip to content

imports loaded in package.mo not found when trying to load a model #199

@martinscripts

Description

@martinscripts

Description

This may be connected to #133.
I am trying to load a model which uses the dynawo library
There are several packages loaded inside the package.mo of dynawo:

encapsulated package Dynawo "Dynawo models library"
  // generic import commands
  import Complex "Complex numbers foundation class";
  import Modelica;
  import Modelica.ComplexMath "Complex numbers operators (+, - , *, exp, abs...)";
  import Modelica.Icons;
  import Dynawo;
  import Dynawo.AdditionalIcons;
  import Dynawo.Electrical.SystemBase;
  import Dynawo.Types "Standard Dynawo variable types";

which can't be found when loading a model through ModelicaSystem() in OMPython.

Maybe I am just missing something?

Thank you in advance :)

Steps to reproduce

from OMPython import ModelicaSystem
DYNAWO_PACKAGE_PATH = "[path-to-dynawo]/dynawo/sources/Models/Modelica/Dynawo/package.mo"
mod = ModelicaSystem(DYNAWO_PACKAGE_PATH, "Dynawo.Examples.SMIB.SMIBStepPm", ["Modelica"])

returns the error Error: Function ComplexMath.'abs' not found in scope GeneratorSynchronous.

Expected behavior

It should be loaded properly because ComplexMath is loaded in dynawo's package.mo, as pasted above.
And in OMEdit it runs.

writing mod = ModelicaSystem(DYNAWO_PACKAGE_PATH, "Dynawo.Examples.SMIB.SMIBStepPm", ["Modelica", "Modelica.ComplexMath"]) did not change it.

Version and OS

  • Python Version 3.10.11
  • OMPython Version 3.3.0
  • OpenModelica Version 1.18.0
  • OS: Windows 10, 64 bit

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