OpenModelica / OMPython

A Python interface to OpenModelica communicating via CORBA or ZeroMQ
Other
107 stars 58 forks source link

can't get linearize() to work #209

Closed martinscripts closed 6 months ago

martinscripts commented 6 months ago

Description

I am trying to get the A Matrix of a linearization of my model.

If I run model.linearize() I get a zero matrix (24 by 24).

Steps to Reproduce

I am trying to run an MWE like this:

from OMPython import ModelicaSystem

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

from OMPython import ModelicaSystem

mod=ModelicaSystem(model_path + "VanDerPol.mo","VanDerPol")

mod.linearize()

it returns

[[[0, 1], [0, 0]], [], [], []],

Is this correct? It might be.

Expected Behavior

Get a linearizes (state space) representation of my model or at least the A matrix.

Version and OS

Additional Context

This might be a lack of understanding on my side. At least the linearize() function did not behave as I expect. If so, maybe you have a hint for me?

martinscripts commented 6 months ago

I did some more testing, I do get other models, similar to mine, to work. So the problems seems to be in my model somewhere. I will close this issue and see where I went wrong.