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

Modelica Fluid...lots of problem

Modelica Fluid...lots of problem

Hi,
I'm new to Modelica and I was used to Matlab and Simulink/SimHydraulics. For external reasons I have to use OpenModelica and Modelica.fluid library. After installing all the suite I had spent sometime to have some of the examples running...why putting example that needs not trivial modifications for beginning user?

I didn't find any good step-by-step tutorial, do someone as some good resource to learn OpenModelica? The documentation provided with the library is not detailed and inadequate for beginners.

Now I'm trying to run a model with a pump, two pipes and two linear valves...for some reasons it doesn't work. Can someone help me? the code is the following:

Code:

model WaterCircuitProportionalValves

  replaceable package Medium = Modelica.Media.Water.StandardWaterOnePhase constrainedby Modelica.Media.Interfaces.PartialMedium;
  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium, allowFlowReversal = true, diameter(displayUnit = "mm") = 0.01, length = 3) annotation(Placement(visible = true, transformation(origin = {-14, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveLinear valveLinear1(redeclare package Medium = Medium, allowFlowReversal = true, dp_nominal = 10000, dp_start = 1.03, m_flow_nominal = 100) annotation(Placement(visible = true, transformation(origin = {16, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  Modelica.Fluid.Machines.ControlledPump pump(redeclare package Medium = Medium, allowFlowReversal = true, checkValve = true, control_m_flow = true, m_flow_nominal = 10, p_a_nominal = 10000000, p_b_nominal = 15000000, use_m_flow_set = true) annotation(Placement(visible = true, transformation(origin = {-68, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium, allowFlowReversal = true, diameter(displayUnit = "mm") = 0.01, length = 3) annotation(Placement(visible = true, transformation(origin = {-16, 36}, extent = {{-10, 10}, {10, -10}}, rotation = 180)));
  Modelica.Fluid.Valves.ValveLinear valveLinear2(redeclare package Medium = Medium, allowFlowReversal = true, dp_nominal = 10000, dp_start = 1.03, m_flow_nominal = 100) annotation(Placement(visible = true, transformation(origin = {76, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  inner Modelica.Fluid.System system(allowFlowReversal = false, m_flow_start = 0, use_eps_Re = true) annotation(Placement(visible = true, transformation(origin = {72, -86}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 100) annotation(Placement(visible = true, transformation(origin = {-52, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Medium, crossArea = 0.01, height = 2, level_start = 1, massDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts = 2, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.01), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.01)}, use_T_start = true) annotation(Placement(visible = true, transformation(origin = {-120, 66}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const1(k = 1) annotation(Placement(visible = true, transformation(origin = {-18, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const2(k = 1) annotation(Placement(visible = true, transformation(origin = {48, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(valveLinear2.opening, const2.y) annotation(Line(points = {{68, 0}, {58, 0}, {58, 0}, {60, 0}}, color = {0, 0, 127}));
  connect(valveLinear1.opening, const1.y) annotation(Line(points = {{8, 0}, {-8, 0}, {-8, 0}, {-6, 0}}, color = {0, 0, 127}));
  connect(pump.port_a, tank.ports[1]) annotation(Line(points = {{-78, -50}, {-78, -49.625}, {-120, -49.625}, {-120, 46}}, color = {0, 127, 255}));
  connect(pipe1.port_b, tank.ports[2]) annotation(Line(points = {{-26, 36}, {-60, 36}, {-60, 46}, {-120, 46}}, color = {0, 127, 255}));
  connect(pipe.port_a, pump.port_b) annotation(Line(points = {{-24, -44}, {-35, -44}, {-35, -50}, {-58, -50}}, color = {0, 127, 255}));
  connect(const.y, pump.m_flow_set) annotation(Line(points = {{-41, 10}, {-73, 10}, {-73, -42}}, color = {0, 0, 127}));
  connect(pipe1.port_a, valveLinear1.port_b) annotation(Line(points = {{-6, 36}, {16, 36}, {16, 10}}, color = {0, 127, 255}));
  connect(valveLinear1.port_a, pipe.port_b) annotation(Line(points = {{16, -10}, {16, -44}, {-4, -44}}, color = {0, 127, 255}));
  connect(pipe1.port_a, valveLinear2.port_b) annotation(Line(points = {{-6, 36}, {76, 36}, {76, 10}, {76, 10}}, color = {0, 127, 255}));
  connect(valveLinear2.port_a, pipe.port_b) annotation(Line(points = {{76, -10}, {76, -44}, {-4, -44}}, color = {0, 127, 255}));
  annotation(uses(Modelica(version = "3.2.2")), Diagram);
end WaterCircuitProportionalValves;

There are 0 guests and 0 other users also viewing this topic
You are here: