#2386 closed defect (fixed)
Erroneous constant evaluation of condition in assert relating to connectors
Reported by: | carlj@… | Owned by: | perost |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | petar |
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 Changed 11 years ago by sjoelund.se
- Milestone changed from 1.9.0 to 1.9.1
comment:2 Changed 10 years ago by adrpo
- Cc petar added
- Owner changed from somebody to adrpo
- Status changed from new to accepted
This is a problem with evaluation of cardinality operator when connections happen in a different scope.
comment:3 follow-up: ↓ 4 Changed 10 years ago by adrpo
- Owner changed from adrpo to perost
- Status changed from accepted to assigned
I'll assign this to Per as he changed cardinality today and he can probably fix it faster.
comment:4 in reply to: ↑ 3 Changed 10 years ago by perost
- Resolution set to fixed
- Status changed from assigned to 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 Changed 10 years ago by adrpo
I got an:
assert(false,\"Connector frame_b of revolute joint is not connected\");
but I might need to run make clean :)
comment:6 Changed 10 years ago by adrpo
Forget it, it works fine now. I used another older omc. It works as expected now.
Postponed until 1.9.1