Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3672 closed defect (invalid)

Block connection including an array

Reported by: hackbarde23@… Owned by: Adeel Asghar
Priority: high Milestone: never
Component: OMEdit Version: v1.9.3
Keywords: connection array Cc:

Description

Hello guys,

I have two Blocks, A and B and I want to connect both of them (graphicly) and the data (array) from block A should be transfered to block B.

Here I small example

block A
  extends Modelica.Blocks.Interfaces.MO;
  parameter Real a[:] = {5.0, 2.0};
  equation
  y = a;
end A;

block B
  extends Modelica.Blocks.Interfaces.MIMO;
  equation
  y = u;
end A;

So far so fine, but now comes the connection (graphical) in the connection editor. I connect A with B, now I have to enter the indices, for A.y[index] to B.u[index]. I am not able to use the hole vector of A to connect to B, only 1 scalar of A can be connected to B (input and output of must set to 1).

equation
  connect(A.y[2], B.u[1]) annotation(Line(points = {{-63, 40}, {-10, 40}, {-10, 32}, {-10, 32}}, color = {0, 0, 127}));

I solved this problem with a for loop to connect the hole array A to B

for i in 1:2 loop
  connect(mV_Test1.y[i], pS_Test1.u[i]) annotation(Line(points = {{-63, 40}, {-10, 40}, {-10, 32}, {-10, 32}}, color = {0, 0, 127}));
  end for;

The simulation works fine, the result of Block B is y[1]=5 and y[2]=2
BUT now I have no more graphical connection line in the connection Editor between A and B :-(

Some one who can help?

Change History (2)

comment:1 by Adeel Asghar, 9 years ago

Resolution: invalid
Status: newclosed

You can connect two arrays together. In the create connection dialog do not specify any index value, just press OK. Note that the both arrays should have same size for this to work fine.

As for not getting the graphical connection line, I have created a new ticket #3680. The problem is that the API getConnectionCount doesn't count the connection defined within for loops so the editor thinks that there are no connections to draw.

comment:2 by Dietmar Winkler, 9 years ago

Milestone: Futurenever
Note: See TracTickets for help on using tickets.