I'm new to Modelica and want to design a basic fluidic system. It includes a tank as a reservoir and pressure reference. I plan to pump water from the tank through a pipe back into the same tank, inspired by an example in OpenModelica: PumpingSystem
model Model02
replaceable package Medium = Modelica.Media.Water.StandardWaterOnePhase constrainedby Modelica.Media.Interfaces.PartialMedium;
inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial) annotation(
Placement(transformation(origin = {82, -85}, extent = {{-12, -11}, {12, 11}})));
Modelica.Fluid.Vessels.OpenTank tank(
crossArea = 50,
level_start = 2.2,
height = 3,
nPorts = 2, portsData = {
Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.3), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.3, height=2)},
redeclare package Medium = Medium) annotation(
Placement(transformation(origin = {-80, 42}, extent = {{-14, -14}, {14, 14}})));
Modelica.Fluid.Pipes.StaticPipe pipe_1(length = 100, height_ab = 0, diameter = 0.3, redeclare package Medium = Medium) annotation(
Placement(transformation(origin = {-85, -8}, extent = {{-7, -8}, {7, 8}}, rotation = -90)));
Modelica.Fluid.Pipes.StaticPipe pipe_2(length = 100, height_ab = 2, diameter = 0.3, redeclare package Medium = Medium) annotation(
Placement(transformation(origin = {77.5, -4.5}, extent = {{-7.5, -8.5}, {7.5, 8.5}}, rotation = 90)));
Modelica.Fluid.Machines.PrescribedPump pump(
redeclare package Medium = Medium,
use_N_in = true,
redeclare function flowCharacteristic = Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow (
V_flow_nominal={0,0.25,0.5}, head_nominal={100,60,0}),
N_nominal = 0,
V = 0.05,
N(start = 1200),
N_const = 1200
)
annotation(
Placement(transformation(origin = {-42, -40}, extent = {{-10, -10}, {10, 10}})));
Modelica.Fluid.Valves.ValveLinear valveLinear(allowFlowReversal = false, dp_nominal = 200000, m_flow_nominal = 400, redeclare package Medium = Medium) annotation(
Placement(transformation(origin = {-22, -10}, extent = {{58, -38}, {74, -22}})));
Modelica.Fluid.Sensors.RelativePressure relative_tank_Pressure(redeclare package Medium = Medium) annotation(
Placement(transformation(origin = {2, -40}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Logical.OnOffController controller(bandwidth=4000,
pre_y_start=false) annotation (Placement(transformation(origin = {10, 20}, extent = {{-40, 60}, {-20, 80}})));
Modelica.Blocks.Logical.TriggeredTrapezoid PumpRPMGenerator(
rising=3,
falling=3,
amplitude=1200,
offset=0.001) annotation (Placement(transformation(origin = {6, 20}, extent = {{0, 60}, {20, 80}})));
Modelica.Blocks.Continuous.FirstOrder PT1(
T=2,
initType=Modelica.Blocks.Types.Init.InitialState,
y_start=0)
annotation (Placement(transformation(origin = {2, 20}, extent = {{40, 60}, {60, 80}})));
Modelica.Blocks.Sources.Constant RelativePressureSetpoint(k = 2e4) annotation(
Placement(transformation(origin = {-68, 96}, extent = {{-8, -8}, {8, 8}})));
Modelica.Blocks.Sources.Step ValveOpening(startTime = 20, offset = 1e-6) annotation(
Placement(transformation(origin = {23, -7}, extent = {{-7, -7}, {7, 7}})));
equation
connect(controller.y, PumpRPMGenerator.u) annotation(
Line(points = {{-8, 90}, {4, 90}}, color = {255, 0, 255}));
connect(PumpRPMGenerator.y, PT1.u) annotation(
Line(points = {{27, 90}, {40, 90}}, color = {0, 0, 127}));
connect(RelativePressureSetpoint.y, controller.reference) annotation(
Line(points = {{-59, 96}, {-32, 96}}, color = {0, 0, 127}));
connect(ValveOpening.y, valveLinear.opening) annotation(
Line(points = {{31, -7}, {44, -7}, {44, -34}}, color = {0, 0, 127}));
connect(pump.port_b, relative_tank_Pressure.port_a) annotation(
Line(points = {{-32, -40}, {-8, -40}}, color = {0, 127, 255}));
connect(relative_tank_Pressure.port_b, valveLinear.port_a) annotation(
Line(points = {{12, -40}, {36, -40}}, color = {0, 127, 255}));
connect(pipe_2.port_a, valveLinear.port_b) annotation(
Line(points = {{78, -12}, {52, -12}, {52, -40}}, color = {0, 127, 255}));
connect(pipe_1.port_b, pump.port_a) annotation(
Line(points = {{-85, -15}, {-52, -15}, {-52, -40}}, color = {0, 127, 255}));
connect(tank.ports[1], pipe_1.port_a) annotation(
Line(points = {{-80, 28}, {-84, 28}, {-84, 0}}, color = {0, 127, 255}));
connect(tank.ports[2], pipe_2.port_b) annotation(
Line(points = {{-80, 28}, {78, 28}, {78, 4}}, color = {0, 127, 255}));
connect(relative_tank_Pressure.p_rel, controller.u) annotation(
Line(points = {{2, -48}, {2, 0}, {-40, 0}, {-40, 82.6875}, {-32, 82.6875}, {-32, 84}}, color = {0, 0, 127}));
connect(PT1.y, pump.N_in) annotation(
Line(points = {{64, 90}, {73, 90}, {73, 78}, {72, 78}, {72, 30}, {-42, 30}, {-42, -30}}, color = {0, 0, 127}));
annotation(
Diagram);
end Model02;
I'm not quite sure about the issue here. I can't find the mistakes in my logic or values. Even when I run the system without the controller, there seems to be a problem with the pump. How should I configure the pump in this case?
I would appreciate your help!