model.get_state_space_representation not correct

6 posts / 0 new
Last post
hanshell
Offline
Joined: 2015-10-07
model.get_state_space_representation not correct

Hi,

I updated my JModelica installation from svn -r 10214 --> svn -r 10313 (JM 2.1)

In the old version I used compiler_options = {'generate_ode_jacobian':True}, and everything was fine.
In version 10313 this option does not exist any longer, so the results of [a,b,c,d]=model.get_state_space_representation()  are not correct.

Can anybody tell me what is the corresponding new compiler_options   to obtain a correct result??

Thanks in advance for your help
johann

 

 

 

chria
Offline
Joined: 2009-07-29
Hi, The option to generate

Hi,

The option to generate the Jacobians has been moved to the Optimica Compiler Toolkit (http://www.modelon.com/products/optimica-compiler-toolkit/ ) and will be part of our commerical packaging of the platform.

Best

/Christian

linkkili
Offline
Joined: 2009-06-17
Argh!removal of useful

Argh!

removal of useful features from an open source project is nasty. 

What is your advise for Johann? To fork the whole project?

Best Kilian 

 

hubertus
Offline
Joined: 2009-04-24
Feature

Hi Kilian, 

Modelica is a fairly complex language if you support it fully. The previous support for Jacobians was fairly experimental and incomplete. A Jacobian support that covers the complete Modelica language is a lot of work and required a significant refactoring.and rewriting of the first prototype. Work for that is still ongoing. Removing an incomplete feature that fails in many cases and basically was at prototype level is fine even in an open source project. It may for sure have worked for you, true, but you were one of a lucky few then. 

Hubertus  

hanshell
Offline
Joined: 2015-10-07
get_state_space_representation

dear all,

thanks for your feedback.

Basically the finite_differnce algorithm implemented in get_state_space_representation works fine.

In one particular project, some month ago, the numerically derived eigenvalues were not correct. I checked with the symbolic approach, and get the expected results.

Now I tried to solve the same problem with OpenModelica (+generateSymbolicLinearization) and get the same discrepancy between symbolic and numeric calculation.

So it’s clear for me that this behavior has to do with the problem specification in Modelica. The order of the A matrix is 120, I’m using electrical components in per units system and mechanical/hydraulic components in absolute quantities. So I’m assuming my system is “not well conditioned” resulting in numerical problems.

best regards

Johann

hubertus
Offline
Joined: 2009-04-24
Linearization

Johann, 

This is a well-known issue for linearizations with many states. Symbolic derivatives are better than numerical ones, but may not even be sufficient. For hydraulic problems, SI units as used often in Modelica and MSL can be particularly unsuitable, and you might have to use scaled states, e.g. using MPa as pressure state instead of Pa. With properly scaled states, numerical linearization might still work btw. Basically, it is best practice to use scaled states with Magnitudes close to 1.0 for any linearization work with "many" states. "Many" could be as few as more than 10 for bad conditions.   

Hubertus

Login or register to post comments