Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2386 closed defect (fixed)

Erroneous constant evaluation of condition in assert relating to connectors

Reported by: carlj@… Owned by: Per Östlund
Priority: high Milestone: 1.9.1
Component: Frontend Version: trunk
Keywords: Cc: Peter Aronsson

Description

The model instantiated bug_connect.main below

package bug_connect
  model main
    inner Modelica.Mechanics.MultiBody.World world;
    Hub hub;
    Modelica.Mechanics.MultiBody.Parts.BodyBox bodybox(animation=false, r={1.0,0.0,0.0});
  equation
      connect(hub.revolute.frame_b,bodybox.frame_a);
  end main;

  model Hub
    outer Modelica.Mechanics.MultiBody.World world;
    Modelica.Mechanics.MultiBody.Joints.Revolute revolute(animation=false);
  equation
      connect(world.frame_b,revolute.frame_a);
  end Hub;
end bug_connect;

gets, when instantiating:

  assert(true,"Connector frame_a of revolute joint is not connected");
  assert(false,"Connector frame_b of revolute joint is not connected");

from the following Modelica code in Modelica.Mechanics.MultiBody.Joints.Revolute:

  assert(cardinality(frame_a) > 0, "Connector frame_a of revolute joint is not connected");
  assert(cardinality(frame_b) > 0, "Connector frame_b of revolute joint is not connected");

even though revolute.frame_b IS connected and the equations from the connect seem to be generated, one can e.g. find

  hub.revolute.frame_b.t[1] + bodybox.frame_a.t[1] = 0.0;
  hub.revolute.frame_b.t[2] + bodybox.frame_a.t[2] = 0.0;
  hub.revolute.frame_b.t[3] + bodybox.frame_a.t[3] = 0.0;
  hub.revolute.frame_b.f[1] + bodybox.frame_a.f[1] = 0.0;
  hub.revolute.frame_b.f[2] + bodybox.frame_a.f[2] = 0.0;
  hub.revolute.frame_b.f[3] + bodybox.frame_a.f[3] = 0.0;

in the instantiated model.

Change History (6)

comment:1 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:2 by Adrian Pop, 11 years ago

Cc: Peter Aronsson added
Owner: changed from somebody to Adrian Pop
Status: newaccepted

This is a problem with evaluation of cardinality operator when connections happen in a different scope.

comment:3 by Adrian Pop, 11 years ago

Owner: changed from Adrian Pop to Per Östlund
Status: acceptedassigned

I'll assign this to Per as he changed cardinality today and he can probably fix it faster.

in reply to:  3 comment:4 by Per Östlund, 11 years ago

Resolution: fixed
Status: assignedclosed

Replying to adrpo:

I'll assign this to Per as he changed cardinality today and he can probably fix it faster.

It seems like my changes to cardinality actually fixed this, I get no asserts related to connects in the given model anymore.

comment:5 by Adrian Pop, 11 years ago

I got an:

  assert(false,\"Connector frame_b of revolute joint is not connected\");

but I might need to run make clean :)

comment:6 by Adrian Pop, 11 years ago

Forget it, it works fine now. I used another older omc. It works as expected now.

Note: See TracTickets for help on using tickets.