Opened 12 years ago
Closed 12 years ago
#2024 closed defect (fixed)
Problem with connects and array components
Reported by: | Christian Schubert | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Frontend | Version: | trunk |
Keywords: | connect array components | Cc: | Adrian Pop, Jens Frenkel |
Description
Hi,
I tried to write a simple pendulum model in a very dense form
model Pendulum_N_MultiBody constant Integer N = 2 "Number of individual elements"; inner Modelica.Mechanics.MultiBody.World world(enableAnimation=false); Modelica.Mechanics.MultiBody.Joints.Revolute revolute[N]; Modelica.Mechanics.MultiBody.Parts.BodyCylinder bodyCylinder[N](each r={1,0,0}); equation connect(world.frame_b, revolute[1].frame_a); connect(revolute.frame_b, bodyCylinder.frame_a); connect(bodyCylinder[1:N-1].frame_b, revolute[2:N].frame_a); end Pendulum_N_MultiBody;
It seems, however, that there is a problem with the connect-statements, as the model is unbalanced. If the second and third connect is written for each individual component, then it works fine:
connect(revolute[1].frame_b, bodyCylinder[1].frame_a); connect(revolute[2].frame_b, bodyCylinder[2].frame_a); connect(bodyCylinder[1].frame_b, revolute[2].frame_a);
A closer look at the equations reveals, that omc thinks that none of the connections to bodyCylinder[1] exists as
bodyCylinder[1].frame_a.t[:] = 0.0 bodyCylinder[1].frame_a.f[:] = 0.0 bodyCylinder[1].frame_b.t[:] = 0.0 bodyCylinder[1].frame_b.f[:] = 0.0 bodyCylinder[2].frame_a.t[:] = 0.0 bodyCylinder[2].frame_a.f[:] = 0.0
These quantities are also missing from the flow-balances they are supposed to be in.
which are the superflous equations.
I attached both models:
- Pendulum_N_MultiBody -> Array-Connects
- Pendulum_N_MultiBody -> Flat-Connects
Attachments (2)
Change History (3)
by , 12 years ago
Attachment: | Pendulum_N_MultiBody.mo added |
---|
by , 12 years ago
Attachment: | Pendulum_2_MultiBody.mo added |
---|
comment:1 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in r14813. Expansion of crefs didn't handle the case where a part of a qualified cref was a scalar with subscripts, so the connections weren't expanded properly.