Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » AndiO
  • » Profile

Posts

Posts

Feb-09-16 15:51:55
Category: Programming

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

Code:


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).

Code:

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

Code:


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?

Jan-05-16 11:50:31
Looking for a multiple regression block

Hello,

I want to import data from an external file and with this data i want to do a multiple regression. Is there a block in the libary wich can handle this?

Best wishes and thx a lot
Andi

  • Index
  • » Users
  • » AndiO
  • » Profile
You are here: