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

Fluid

Fluid

Hello,

I tried to biuld a simple example "empty tanks" by myself. I coded it exactly the same way as  the example in the library and when I try to test the code it says everything is ok. But then wehen I try to simulate it there's always the message" too many equations". And I have no idea why.
Here's my code:


model Test123




Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, length = 5, diameter = 0.1, height_ab = -1) annotation(Placement(visible = true, transformation(origin = {-20,0}, extent = {{-10,-10},{10,10}}, rotation = 0)));



Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, nPorts = 1, height = 10, crossArea = 1, level_start = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}) annotation(Placement(visible = true, transformation(origin = {-60,40}, extent = {{-10,-10},{10,10}}, rotation = 0)));




  Modelica.Fluid.Vessels.OpenTank opentank1(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, height = 10, crossArea = 2, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, level_start = 1e-010) annotation(Placement(visible = true, transformation(origin = {40,40}, extent = {{-10,-10},{10,10}}, rotation = 0)));


inner Modelica.Fluid.System system annotation(Placement(visible = true, transformation(origin = {-60,-60}, extent = {{-10,-10},{10,10}}, rotation = 0)));





equation
  connect(pipe.port_b,opentank1.ports[2]) annotation(Line(points = {{-10,0},{40.4348,0},{40.4348,30},{40.4348,30}}));
  connect(tank.ports[1],pipe.port_a) annotation(Line(points = {{-60,30},{-60.4348,30},{-60.4348,-1.30435},{-30,-1.30435},{-30,-1.30435}}));
  annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})), Diagram(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})));
end Test123;



I hope someone can help me. Thank You!!!!!

Re: Fluid

Hi,

model Test123

Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, length = 5, diameter = 0.1, height_ab = -1) annotation(Placement(visible = true, transformation(origin = {-20,0}, extent = {{-10,-10},{10,10}}, rotation = 0)));
Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, nPorts = 1, height = 10, crossArea = 1, level_start = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}) annotation(Placement(visible = true, transformation(origin = {-60,40}, extent = {{-10,-10},{10,10}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank opentank1(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, height = 10, crossArea = 2, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, level_start = 1e-010) annotation(Placement(visible = true, transformation(origin = {40,40}, extent = {{-10,-10},{10,10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(Placement(visible = true, transformation(origin = {-60,-60}, extent = {{-10,-10},{10,10}}, rotation = 0)));
equation
connect(tank.ports[1],pipe.port_a) annotation(Line(points = {{-60,30},{-60.4348,30},{-60.4348,-1.30435},{-30,-1.30435},{-30,-1.30435}}));
  connect(pipe.port_b,opentank1.ports[1]) annotation(Line(points = {{-10,0},{40.4348,0},{40.4348,30},{40.4348,30}}));

 
  annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})), Diagram(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})));
end Test123;

it works fine now.

There are 0 guests and 0 other users also viewing this topic