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

3 tanks model modified

3 tanks model modified

the model pass the check but simulation has non graphic results, Compilation process finished successfully.  Report simulation process on this image http://i.imgur.com/SQeSgEB.jpg

model T5 "Demonstrating the usage of SimpleTank"
  import Modelica.Fluid;
  // replaceable package Medium = Modelica.Fluid.Media.Water.ConstantPropertyLiquidWater extends
  // replaceable package Medium = Modelica.Media.Water.StandardWaterOnePhase extends
  // replaceable package Medium = Modelica.Media.Incompressible.Examples.Glycol47 extends
  replaceable package Medi = Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium "Medium in the component" annotation(choicesAllMatching = true);
  Modelica.Fluid.Vessels.OpenTank tank1(redeclare package Medium = Medi, crossArea = 1, height = 12, level_start = 12, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, use_portsData = true) annotation(Placement(visible = true, transformation(extent = {{-100, 60}, {-60, 100}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank tank2(redeclare package Medium = Medi, crossArea = 1, height = 12, level_start = 2, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, use_portsData = true) annotation(Placement(visible = true, transformation(extent = {{-24, 60}, {16, 100}}, rotation = 0)));
  inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial) annotation(Placement(visible = true, transformation(extent = {{106, 70}, {126, 90}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank tank3(crossArea = 1, redeclare package Medium = Medi, use_portsData = true, height = 12, level_start = 3, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}) annotation(Placement(visible = true, transformation(extent = {{40, 60}, {80, 100}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medi, allowFlowReversal = true, height_ab = 2, length = 2, diameter = 0.1) annotation(Placement(visible = true, transformation(origin = {-80, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Pipes.StaticPipe pipe2(redeclare package Medium = Medi, allowFlowReversal = true, height_ab = 2, length = 2, diameter = 0.1) annotation(Placement(visible = true, transformation(origin = {-4, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Pipes.StaticPipe pipe3(redeclare package Medium = Medi, allowFlowReversal = true, height_ab = -1, length = 2, diameter = 0.1) annotation(Placement(visible = true, transformation(origin = {60, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Pipes.StaticPipe pipe4(redeclare package Medium = Medi, diameter = 0.1, length = 10) annotation(Placement(visible = true, transformation(origin = {-80, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Pipes.StaticPipe pipe5(redeclare package Medium = Medi, diameter = 0.1, length = 10) annotation(Placement(visible = true, transformation(origin = {-4, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Pipes.StaticPipe pipe6(redeclare package Medium = Medi, diameter = 0.1, length = 10) annotation(Placement(visible = true, transformation(origin = {60, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Valves.ValveDiscrete valveDiscrete1(redeclare package Medium = Medi, dp_nominal = 1000, m_flow_nominal = 1, opening_min = 0.1) annotation(Placement(visible = true, transformation(origin = {-80, -16}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
  Modelica.Blocks.Sources.BooleanStep booleanStep1(startTime = 10) annotation(Placement(visible = true, transformation(origin = {-56, -16}, extent = {{8, -8}, {-8, 8}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveDiscrete valveDiscrete2(redeclare package Medium = Medi, dp_nominal = 1000, m_flow_nominal = 1, opening_min = 0) annotation(Placement(visible = true, transformation(origin = {-4, -14}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
  Modelica.Blocks.Sources.BooleanStep booleanStep2(startTime = 30) annotation(Placement(visible = true, transformation(origin = {20, -14}, extent = {{8, -8}, {-8, 8}}, rotation = 0)));
  Modelica.Blocks.Sources.BooleanStep booleanStep3(startTime = 60) annotation(Placement(visible = true, transformation(origin = {88, -12}, extent = {{8, -8}, {-8, 8}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveDiscrete valveDiscrete3(redeclare package Medium = Medi, dp_nominal = 2000, m_flow_nominal = 1) annotation(Placement(visible = true, transformation(origin = {60, -12}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
  Modelica.Blocks.Sources.Step step1(height = 100, startTime = 20) annotation(Placement(visible = true, transformation(origin = {-41, -37}, extent = {{-9, -9}, {9, 9}}, rotation = -90)));
  Modelica.Fluid.Sources.MassFlowSource_T source1(redeclare package Medium = Medi,m_flow = 10, nPorts = 1)  annotation(Placement(visible = true, transformation(origin = {-54, -86}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(pipe5.port_a, source1.ports[1]) annotation(Line(points = {{-4, -60}, {-6, -60}, {-6, -86}, {-44, -86}, {-44, -86}}, color = {0, 127, 255}));
  connect(pipe5.port_a, pipe4.port_a) annotation(Line(points = {{-4, -60}, {-80, -60}, {-80, -60}, {-80, -60}}, color = {0, 127, 255}));
  connect(booleanStep3.y, valveDiscrete3.open) annotation(Line(points = {{79, -12}, {66, -12}}, color = {255, 0, 255}));
  connect(valveDiscrete3.port_b, pipe6.port_b) annotation(Line(points = {{60, -20}, {60, -20}, {60, -40}, {60, -40}}, color = {0, 127, 255}));
  connect(pipe3.port_a, valveDiscrete3.port_a) annotation(Line(points = {{60, 14}, {60, 14}, {60, -4}, {60, -4}}, color = {0, 127, 255}));
  connect(valveDiscrete3.port_b, pipe6.port_b) annotation(Line(points = {{60, -22}, {60, -22}, {60, -40}, {60, -40}}, color = {0, 127, 255}));
  connect(valveDiscrete3.port_a, pipe3.port_a) annotation(Line(points = {{60, -6}, {60, -6}, {60, 14}, {60, 14}}, color = {0, 127, 255}));
  connect(valveDiscrete1.open, booleanStep1.y) annotation(Line(points = {{-74, -16}, {-65, -16}}, color = {255, 0, 255}));
  connect(booleanStep2.y, valveDiscrete2.open) annotation(Line(points = {{11, -14}, {2, -14}}, color = {255, 0, 255}));
  connect(valveDiscrete2.port_b, pipe5.port_b) annotation(Line(points = {{-4, -22}, {-4, -22}, {-4, -40}, {-4, -40}}, color = {0, 127, 255}));
  connect(valveDiscrete2.port_a, pipe2.port_a) annotation(Line(points = {{-4, -6}, {-4, -6}, {-4, 14}, {-4, 14}}, color = {0, 127, 255}));
  connect(valveDiscrete1.port_b, pipe4.port_b) annotation(Line(points = {{-80, -24}, {-80, -24}, {-80, -40}, {-80, -40}}, color = {0, 127, 255}));
  connect(valveDiscrete1.port_a, pipe1.port_a) annotation(Line(points = {{-80, -8}, {-80, -8}, {-80, 14}, {-80, 14}}, color = {0, 127, 255}));
  connect(pipe5.port_a, pipe6.port_a) annotation(Line(points = {{-4, -60}, {60, -60}, {60, -60}, {60, -60}}, color = {0, 127, 255}));
  connect(pipe2.port_b, tank2.ports[1]) annotation(Line(points = {{-4, 34}, {-4, 60}}, color = {0, 127, 255}));
  connect(pipe3.port_b, tank3.ports[1]) annotation(Line(points = {{60, 34}, {60, 60}}, color = {0, 127, 255}));
  connect(pipe1.port_b, tank1.ports[1]) annotation(Line(points = {{-80, 34}, {-80, 60}}, color = {0, 127, 255}));
  annotation(experiment(StopTime = 200), __Dymola_Commands(file = "modelica://Modelica/Resources/Scripts/Dymola/Fluid/ThreeTanks/plot level and port.m_flow.mos" "plot level and port.m_flow"), Documentation(info = "<html>

<img src=\"modelica://Modelica/Resources/Images/Fluid/Examples/ThreeTanks.png\" border=\"1\"
   alt=\"ThreeTanks.png\">
</html>"), uses(Modelica(version = "3.2.2")));
end T5;

Re: 3 tanks model modified

This seems to be a modeling error.
Your tank1 has height = 12, level_start = 12 which means that the tank1.level starts already at maximmum and if it goes beyond that an assertion in the Modelica code for the Tank is triggering and the simulation is failing. Are you sure you want to start the level at 12? If I change the tank1.level = 6 for example then the simulation works fine.

Edited by: adrpo - Dec-27-16 21:13:49
There are 0 guests and 0 other users also viewing this topic