Skip to content

mod.linearize() returns wrong matrix on second call #212

Description

@martinscripts

Description

If two models are loaded and linearized, only the first call of linearize() returns the correct result. All following calls will return the first call's result.

Steps to Reproduce

from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
model_path=omc.sendExpression("getInstallationDirectoryPath()") + "/share/doc/omc/testmodels/"
from OMPython import ModelicaSystem

mod1 = ModelicaSystem(model_path + "BouncingBall.mo","BouncingBall")
mod1.linearize()
# returns [[[0, 1], [0, 0]], [], [], []]

mod2 = ModelicaSystem(model_path + "VanDerPol.mo","VanDerPol")
mod2.linearize()
# returns [[[0, 1], [0, 0]], [], [], []]

Expected Behavior

The result of the second linearization (mod2.linearize) should be [[[0, 1], [-0.730936067860485, -0.248180066111424]], [], [], []] but it only returns that after a kernel restart and when mod2 is executed first.

Version and OS

  • Python Version 3.10.11
  • OMPython Version 3.5.1
  • OpenModelica Version 1.22.2
  • OS: win10

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