Opened 5 years ago
Last modified 3 years ago
#5590 new defect
Bad dynamic state selection leads to singular initialization
Reported by: | Francesco Casella | Owned by: | Karim Adbdelhak |
---|---|---|---|
Priority: | blocker | Milestone: | 1.19.0 |
Component: | Backend | Version: | |
Keywords: | Cc: |
Description
Consider ModelicaTest.MultiBody.Joints.RevolutePlanarLoopConstraint
. It currently fails at initialization because of a singularity.
The test model has four joints connected in a closed kinematic loop. Dymola chooses two dynamic state selection sets, one with two out of four joint angles, the other with two out of four joint angular velocities. It starts by selecting as states the angle and speed of joints 2 and 4, then later toggles the second speed state between joint 4 and joint 3.
OMC statically selects the joint angles 2 and 3 as states, which is probably wrong. It then selects two dynamic states, but I can't see which they are, because -d=bltdump
and -d=optdaedump
will crash OMEdit. The initialization problem is then singular, most likely due to a bad choice of states.
ModelicaTest.MultiBody.InitializationConversion.Joints
fails at initialization with the C++ runtime, probably for similar reasons, though I did not investigate further.
Change History (9)
comment:1 by , 5 years ago
Milestone: | 1.14.0 → 1.15.0 |
---|
comment:2 by , 4 years ago
Milestone: | 1.15.0 → 1.16.0 |
---|
Release 1.15.0 was scrapped, because replaceable support eventually turned out to be more easily implemented in 1.16.0. Hence, all 1.15.0 tickets are rescheduled to 1.16.0
comment:3 by , 4 years ago
Update, I just re-tried with the latest 1.16.0 nightly build. The good news is that -d=bltdump,optdaedump
no longer crash OMEdit, so I got this information:
Number of states: 4 ($STATESET1.x[2],$STATESET1.x[1],revolute3.phi,revolute2.phi) Generated StateSets: ======================================== StateSet "$STATESET1" (rang 2) state candidates (4) ======================================== 1: revolute4.w:DUMMY_STATE(start = 0.0 unit = "rad/s" stateSelect=StateSelect.prefer ) "First derivative of angle phi (relative angular velocity)"ModelicaTest.MultiBody.Joints.RevolutePlanarLoopConstraint, Modelica.Mechanics.MultiBody.Joints.Revolute type: Real 2: revolute3.w:DUMMY_STATE(start = 0.0 unit = "rad/s" fixed = true stateSelect=StateSelect.prefer ) "First derivative of angle phi (relative angular velocity)"ModelicaTest.MultiBody.Joints.RevolutePlanarLoopConstraint, Modelica.Mechanics.MultiBody.Joints.Revolute type: Real 3: revolute1.w:DUMMY_STATE(start = 0.0 unit = "rad/s" stateSelect=StateSelect.prefer ) "First derivative of angle phi (relative angular velocity)"ModelicaTest.MultiBody.Joints.RevolutePlanarLoopConstraint, Modelica.Mechanics.MultiBody.Joints.Revolute type: Real 4: revolute2.w:DUMMY_STATE(start = 6.283185307179586 unit = "rad/s" fixed = true stateSelect=StateSelect.prefer ) "First derivative of angle phi (relative angular velocity)"ModelicaTest.MultiBody.Joints.RevolutePlanarLoopConstraint, Modelica.Mechanics.MultiBody.Joints.Revolute type: Real
Dymola makes the following selection:
There are 2 sets of dynamic state selection. From set 1 there are 2 states to be selected from: revolute1.phi revolute2.phi revolute3.phi revolute4.phi From set 2 there are 2 states to be selected from: revolute1.w revolute2.w revolute3.w revolute4.w
I wonder whether the fixed choice of revolute2.phi
and revolute3.phi
is sound, since we get a singularity when trying to compute the derivatives of the ODE system. Is there any way to double-check that?
comment:4 by , 4 years ago
I analyzed the problem and was able to produce the desired state selection. Unfortunately it breaks immediately afterwards since the subsequent code cannot work with my changes. It will be quite the work to get it running, but probably worth our while since it seems like it is a major mistake which probably caused many of our current problems with unstable simulations due to index reduction.
An attempt of a short summary:
- when working with models (especially mechanical ones) we oftentimes have index-3 models
- the first and second phase of index reduction depend on each other structurally
- in this model the first phase is the one with the angular velocities and the second is the one with the angles
- due to
df/dx = df'/dx'
huge parts of the jacobians are equal (rows representing all equations that have to be differentiated twice appear in both) - currently the second phase takes advantage of the first phase and takes all the equations used there and starts from that point. But that includes some equations that are not part of phase 2, therefore old decisions can be revoked
- that allowed
revolute2.phi
andrevolute3.phi
to be chosen in equations from phase 1, which contradicted choices made in phase 1 and lead to the singularity
I removed the dependency on the old state selection, but the equation and variable mapping is now incorrect (since it has fewer variables and equations). Also all following functions want the full system.
There is a quick and ugly version to fix this (patchworking the old and new stuff together and keep most of the pipeline) and a correct but time demanding version. I also do want to use information from phase 1 in phase 2 (and subsequent phases if needed), but that needs an entirely different attempt.
I will try and fiddle a bit with the ugly version to get a feeling for what is needed, but i will definitely go for the correct version in the long run. As i said, this could be the cause for many of our problems so we want to get this right.
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2.
This issue, previously marked as blocker for 1.14.0, is rescheduled to 1.15.0