Opened 8 years ago

Last modified 7 years ago

#3957 assigned defect

Simulation errors with hierarchical state machines in Modelica 3.3

Reported by: tpv9292@… Owned by: Bernhard Thiele
Priority: high Milestone: Future
Component: Backend Version: v1.10.0-dev-nightly
Keywords: state machines Cc:

Description

Hello all,

I am currently doing my Master's thesis and I am building a simple hierarchical state machines with parallel states (see code below) but I have problems when trying to simulate. I get these two errors:

Translation Error
[c:/dev/OpenModelica/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 4490:9-4490:145]: Internal error function createSingleWhenEqnCode failed. When equations currently only supported on form v = ...

Translation Error
[c:/dev/OpenModelica/OMCompiler/Compiler/SimCode/SimCodeUtil.mo: 479:5-479:146]: Internal error function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]

Does anyone know where is the problem? Any help will be appreciated.

Thanks for your time and help.

Attachments (4)

PickPlace.mo (6.1 KB ) - added by anonymous 8 years ago.
PickPlace.2.mo (5.8 KB ) - added by Bernhard Thiele 8 years ago.
Revised version (still buggy)
PickPlace.3.mo (5.8 KB ) - added by Bernhard Thiele 8 years ago.
Revised version (still buggy)
PickPlace.4.mo (4.6 KB ) - added by tpv9292@… 8 years ago.

Download all attachments as: .zip

Change History (12)

by anonymous, 8 years ago

Attachment: PickPlace.mo added

comment:1 by Adrian Pop, 8 years ago

Component: OMEditBackend
Milestone: 1.9.x1.10.0
Owner: changed from Adeel Asghar to Bernhard Thiele
Status: newassigned
Type: taskdefect

comment:2 by Bernhard Thiele, 8 years ago

The state machine is already rather large. I recommend that you build it up more in a step by step fashion.

I get another error from OpenModelica when trying to run it ("Error: Currently, only equations in state machines with a LHS component reference, e.g., x=.., are supported").

I spotted a few errors:

  • Variables have been declared as parameters (parameters cannot change during simulation!)
  • Multiple transitions from the same state have not been assigned priorities, see
    • VerActDyn.standingstill
    • HorActDyn.standingstill

I fixed these errors (see attachment), but I keep getting the same error message. Currently, I don't understand why this error is thrown. Maybe I can change the compiler to give better error diagnostics.

However, I also tried it with the Dymola tool and it doesn't work either, but gives instead the error:

The problem is structurally singular.
It has 192 scalar unknowns and 195 scalar equations.
The Real part has 16 unknowns and 16 equations.
The Integer part has 47 unknowns and 45 equations.
The Boolean part has 129 unknowns and 134 equations.

So it seems that there are a few modelling issues in your example. I suppose the best way to get forward is if you start with a very simple state machine which works and then you keep adding additional states and transitions until it doesn't work any more.

Last edited 8 years ago by Bernhard Thiele (previous) (diff)

by Bernhard Thiele, 8 years ago

Attachment: PickPlace.2.mo added

Revised version (still buggy)

by Bernhard Thiele, 8 years ago

Attachment: PickPlace.3.mo added

Revised version (still buggy)

by tpv9292@…, 8 years ago

Attachment: PickPlace.4.mo added

comment:3 by anonymous, 8 years ago

I have changed the code in some ways and now I get the following errors when trying to simulate:

[1] 16:33:54 Symbolic Error
Too many equations, over-determined system. The model has 302 equation(s) and 301 variable(s).

[2] 16:33:54 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

I have been looking a lot and I can't really find the equation that should be deleted but what I am really wondering is what is the second error. Does anyone know a solution to that?

Thank you very much for your time and help.

comment:4 by Bernhard Thiele, 8 years ago

You should consider starting from a small working model and incrementally add details and states. The error diagnostic for state machines is unfortunately not very good. There are more problems in the model than just a missing equation.

One problem is a wrong type in Line 119 outer input Real count; (should be Integer). But this doesn't fix it either. Taking the diagnostics by Dymola one gets

The problem is structurally singular.
It has 180 scalar unknowns and 181 scalar equations.
The Real part has 20 unknowns and 16 equations.
The Integer part has 44 unknowns and 44 equations.
The Boolean part has 116 unknowns and 121 equations.
The String part has 0 unknowns and 0 equations.

So maybe there are some more typing errors?

The reason for the higher number of equations in OpenModelica is that OpenModelica also counts the equations introduced due to the state machine semantics (these are equations which are added by the tool, not by the modeller).

comment:5 by anonymous, 8 years ago

I am very sure that all the declared variables have the right type in their respective declarations. I also look at the instantiate model and the class seams to be 100% right.

I am going to look a little bit more at the code but I am not sure what it is really going wrong. I don't think that the equations introduced due to the state machine semantics are the problem here either.

Maybe I will just have to try to build it step by step.

Thank you very much for your help.

comment:6 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:7 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:8 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

Note: See TracTickets for help on using tickets.