#2386 closed defect (fixed)
Erroneous constant evaluation of condition in assert relating to connectors
Reported by: | 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 , 11 years ago
Milestone: | 1.9.0 → 1.9.1 |
---|
comment:2 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → accepted |
This is a problem with evaluation of cardinality operator when connections happen in a different scope.
follow-up: 4 comment:3 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | accepted → assigned |
I'll assign this to Per as he changed cardinality today and he can probably fix it faster.
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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 , 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 , 11 years ago
Forget it, it works fine now. I used another older omc. It works as expected now.
Postponed until 1.9.1