Opened 15 years ago

Last modified 14 years ago

#1220 closed defect (worksforme)

PointGravityWithPointMasses and PointGravityWithPointMasses2 has assertions with false condidion in the flat code.

Reported by: Peter Aronsson Owned by: Peter Aronsson
Priority: blocker Milestone:
Component: Version:
Keywords: Cc: Peter Aronsson,

Description

This is clearly wrong:

{{{OpenModelica/testsuite/libraries/multibody/elementary
$ grep assert\(false *.mos
PointGravityWithPointMasses.mos:// assert(false,"
PointGravityWithPointMasses.mos:// assert(false,"
PointGravityWithPointMasses2.mos:// assert(false,"
PointGravityWithPointMasses2.mos:// assert(false,"
PointGravityWithPointMasses2.mos:// assert(false,"
PointGravityWithPointMasses2.mos:// assert(false,"
PointGravityWithPointMasses2.mos:// assert(false,"
PointGravityWithPointMasses2.mos:// assert(false,"}}}

I do not know why this occur, but it originates from
{{{ if Connections.isRoot(frame_a.R) then

assert(cardinality(frame_a)==0, "

A Modelica.Mechanics.MultiBody.Parts.PointMass model is connected in
a way, so that no equations are present to compute frame_a.R
(the orientation object in the connector). Setting frame_a.R to
an arbitrary value in the PointMass model, might lead to a wrong
overall model, depending on how the PointMass model is used.

You can avoid this message, by providing equations that

compute the orientation object, e.g., by using the
Modelica.Mechanics.MultiBody.Joints.FreeMotion joint.

If a PointMass model is not connected at all, the

orientation object is set to a unit rotation. But this is
the only case where this is done.
");

frame_a.R = Frames.nullRotation();

else

frame_a.t = zeros(3);

end if;}}}

So my guess is that it has something to do with either cardinality or connection breaking, or both!

Change History (2)

comment:1 by Adrian Pop, 15 years ago

I only have:

//   if false then
// assert(false," ...

and no other assert(false, ...).

That means they will never be selected\\

comment:2 by Peter Aronsson, 15 years ago

Really strange, our kernel returns:
{{{ if true then
assert(false,"
A Modelica.Mechanics.MultiBody.Parts.PointMass model is connected in
a way, so that no equations are present to compute frame_a.R
(the orientation object in the connector). Setting frame_a.R to
an arbitrary value in the PointMass model, might lead to a wrong
overall model, depending on how the PointMass model is used.

You can avoid this message, by providing equations that

compute the orientation object, e.g., by using the
Modelica.Mechanics.MultiBody.Joints.FreeMotion joint.

If a PointMass model is not connected at all, the

orientation object is set to a unit rotation. But this is
the only case where this is done.
");}}}

I will look more into why and reopen the ticket if it still is a bug in OMC

Note: See TracTickets for help on using tickets.