Help - Search - Members - Calendar
Full Version: Replacing Connect-Statement by equations???
Modelica Forum > Modelica > Modelica
RungeZipperer
Hello,

I´m just trying to understand some very basic characteristics of Modelica (and also Dymola). This is my first question (out of a few...):

Look at this example. There is a constant torque connected to a inertia. I´ve used the

connect(constantTorque.flange, inertia.flange_a)

for the model on top and then I wanted to replace this by

constantTorque1.flange.phi=inertia1.flange_a.phi;
constantTorque1.flange.tau+inertia1.flange_a.tau=0;


which is not possible. I can leave out one of these equations but I still get the error that "The Real part has 26 unknowns and 27 equations." What is so special about the connection? There must be a way to write equations instead of connect()!?

Can you give me some hints?

CODE

model ConnectTest  
  annotation (Diagram);
  Modelica.Mechanics.Rotational.Inertia inertia
    annotation (extent=[0,50; 20,70]);
  Modelica.Mechanics.Rotational.ConstantTorque constantTorque
    annotation (extent=[-40,50; -20,70]);
  Modelica.Mechanics.Rotational.Inertia inertia1
    annotation (extent=[0,-20; 20,0]);
  Modelica.Mechanics.Rotational.ConstantTorque constantTorque1
    annotation (extent=[-40,-20; -20,0]);
equation
  connect(constantTorque.flange, inertia.flange_a)
    annotation (points=[-20,60; 0,60], style(color=0, rgbcolor={0,0,0}));
  constantTorque1.flange.phi=inertia1.flange_a.phi;
//  constantTorque1.flange.tau+inertia1.flange_a.tau=0;
end ConnectTest;


Click to view attachment
Roland
Hello RungeZipperer,

QUOTE(RungeZipperer @ Jun 12 2009, 07:18 AM) *
What is so special about the connection?


The connector "Modelica.Mechanics.Rotational.Interfaces.Flange_x" has the flow variable "tau" as member. In Modelica the sum of the flow variables of all connected connectors is automatically set to 0. In your case, the equation is

CODE
constantTorque.flange.tau + inertia.flange_a.tau = 0;


If you do not use the connect statement the sum is still set to 0 - the difference is just, that there is only one variable in the equation. E.g.:

CODE
constantTorque1.flange.tau = 0;


Therefore you can not connect the tau by hand.

QUOTE(RungeZipperer @ Jun 12 2009, 07:18 AM) *
There must be a way to write equations instead of connect()!?


Why? I can see no reason why you would have to avoid the connect statement.

Regards,
Roland
RungeZipperer
QUOTE(Roland @ Jun 15 2009, 02:39 PM) *

Therefore you can not connect the tau by hand.


I should have known that. Thanks!

QUOTE(Roland @ Jun 15 2009, 02:39 PM) *

Why? I can see no reason why you would have to avoid the connect statement.


I´m trying to find a way to build a variable structure system. As far as I know this is not possible with Modelica at present. I just wanted to experiment with the language to go more into detail.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.