Ticket #4024: PumpingSystem.mo

File PumpingSystem.mo, 7.4 KB (added by anonymous, 10 years ago)
Line 
1within Modelica.Fluid.Examples;
2model PumpingSystem "Model of a pumping system for drinking water"
3 extends Modelica.Icons.Example;
4
5 replaceable package Medium = Modelica.Media.Water.StandardWaterOnePhase
6 constrainedby Modelica.Media.Interfaces.PartialMedium;
7 //replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater
8 // constrainedby Modelica.Media.Interfaces.PartialMedium;
9
10 Modelica.Fluid.Sources.FixedBoundary source(
11 nPorts = 1,
12 use_T=true,
13 T=Modelica.SIunits.Conversions.from_degC(20),
14 p=system.p_ambient,
15 redeclare package Medium = Medium)
16 annotation (Placement(transformation(extent={{-100,-80},{-80,-60}})));
17
18 Modelica.Fluid.Pipes.StaticPipe pipe(
19 allowFlowReversal=true,
20 length=100,
21 height_ab=50,
22 diameter=0.3,
23 redeclare package Medium = Medium)
24 annotation (Placement(transformation(
25 origin={-30,-51},
26 extent={{-9,-10},{11,10}},
27 rotation=90)));
28
29 Machines.PrescribedPump pumps(
30 checkValve=true,
31 N_nominal=1200,
32 redeclare function flowCharacteristic =
33 Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow (
34 V_flow_nominal={0,0.25,0.5}, head_nominal={100,60,0}),
35 use_N_in=true,
36 nParallel=1,
37 energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
38 V(displayUnit="l") = 0.05,
39 massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
40 redeclare package Medium = Medium,
41 p_b_start=600000,
42 T_start=system.T_start)
43 annotation (Placement(transformation(extent={{-68,-80},{-48,-60}})));
44
45 Modelica.Fluid.Vessels.OpenTank reservoir(
46 T_start=Modelica.SIunits.Conversions.from_degC(20),
47 use_portsData=true,
48 crossArea=50,
49 level_start=2.2,
50 height=3,
51 nPorts=3,
52 portsData={Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.3),
53 Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.3),
54 Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.01)},
55 redeclare package Medium = Medium)
56 annotation (Placement(transformation(extent={{-20,-16},{0,4}})));
57
58 Modelica.Fluid.Valves.ValveLinear userValve(
59 allowFlowReversal=false,
60 dp_nominal=200000,
61 m_flow_nominal=400,
62 redeclare package Medium = Medium)
63 annotation (Placement(transformation(extent={{58,-38},{74,-22}})));
64 Modelica.Fluid.Sources.FixedBoundary sink(
65 p=system.p_ambient,
66 T=system.T_ambient,
67 nPorts=2,
68 redeclare package Medium = Medium)
69 annotation (Placement(transformation(extent={{100,-40},{80,-20}})));
70 Modelica.Blocks.Sources.Step valveOpening(startTime=200, offset=1e-6)
71 annotation (Placement(transformation(extent={{56,0},{76,20}})));
72 Modelica.Blocks.Sources.Constant RelativePressureSetPoint(k=2e4)
73 annotation (Placement(transformation(extent={{-100,60},{-80,80}})));
74 Modelica.Blocks.Logical.OnOffController controller(bandwidth=4000,
75 pre_y_start=false)
76 annotation (Placement(transformation(extent={{-40,60},{
77 -20,80}})));
78 Modelica.Blocks.Logical.TriggeredTrapezoid PumpRPMGenerator(
79 rising=3,
80 falling=3,
81 amplitude=1200,
82 offset=0.001) annotation (Placement(transformation(extent={{0,60},{20,80}})));
83 Modelica.Fluid.Sensors.RelativePressure reservoirPressure(redeclare package
84 Medium = Medium)
85 annotation (Placement(transformation(extent={{10,-12},{30,-32}})));
86 Modelica.Blocks.Continuous.FirstOrder PT1(
87 T=2,
88 initType=Modelica.Blocks.Types.Init.InitialState,
89 y_start=0)
90 annotation (Placement(transformation(extent={{40,60},{60,80}})));
91
92 inner Modelica.Fluid.System system(energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
93 annotation (Placement(transformation(extent=
94 {{60,-96},{80,-76}})));
95equation
96 connect(userValve.port_b, sink.ports[1]) annotation (Line(points={{74,-30},
97 {77,-30},{77,-28},{80,-28}},
98 color={0,127,255}));
99 connect(source.ports[1], pumps.port_a) annotation (Line(points={{-80,-70},{
100 -74,-70},{-68,-70}}, color={0,127,255}));
101 connect(valveOpening.y, userValve.opening) annotation (Line(points={{77,10},{
102 98,10},{98,-12},{66,-12},{66,-23.6}}, color={0,0,127}));
103 connect(RelativePressureSetPoint.y, controller.reference)
104 annotation (Line(points={{
105 -79,70},{-60,70},{-60,76},{-42,76}}, color={0,0,127}));
106 connect(controller.y, PumpRPMGenerator.u)
107 annotation (Line(points={{-19,70},{-2,70}}, color={255,0,255}));
108 connect(reservoirPressure.p_rel, controller.u) annotation (Line(points={{20,
109 -13},{20,50},{-52,50},{-52,64},{-42,64}}, color={0,0,127}));
110 connect(reservoirPressure.port_b, sink.ports[2]) annotation (Line(
111 points={{30,-22},{44,-22},{44,-48},{80,-48},{80,-32}},
112 color={0,127,255},
113 pattern=LinePattern.Dot));
114 connect(PumpRPMGenerator.y, PT1.u)
115 annotation (Line(points={{21,70},{38,70}}, color={0,0,127}));
116 connect(PT1.y, pumps.N_in) annotation (Line(points={{61,70},{74,70},{74,30},{
117 -58,30},{-58,-60}}, color={0,0,127}));
118 connect(pipe.port_a, pumps.port_b) annotation (Line(points={{-30,-60},
119 {-30,-70},{-48,-70}}, color={0,127,255}));
120 connect(reservoir.ports[1], pipe.port_b) annotation (Line(
121 points={{-12.6667,-16},{-12.6667,-30},{-30,-30},{-30,-40}},
122 color={0,127,255}));
123 connect(reservoir.ports[3], reservoirPressure.port_a) annotation (Line(
124 points={{-7.33333,-16},{-7,-16},{-7,-22},{10,-22}},
125 color={0,127,255},
126 pattern=LinePattern.Dot));
127 connect(reservoir.ports[2], userValve.port_a) annotation (Line(
128 points={{-10,-16},{-10,-30},{58,-30}},
129 color={0,127,255}));
130 annotation (
131 Documentation(info="<html>
132<p>
133Water is pumped from a source by a pump (fitted with check valves), through a pipe whose outlet is 50 m higher than the source, into a reservoir. The users are represented by an equivalent valve, connected to the reservoir.
134</p>
135<p>
136The water controller is a simple on-off controller, regulating on the gauge pressure measured at the base of the tower; the output of the controller is the rotational speed of the pump, which is represented by the output of a first-order system. A small but nonzero rotational speed is used to represent the standby state of the pumps, in order to avoid singularities in the flow characteristic.
137</p>
138<p>
139Simulate for 2000 s. When the valve is opened at time t=200, the pump starts turning on and off to keep the reservoir level around 2 meters, which roughly corresponds to a gauge pressure of 200 mbar.
140</p>
141<p>
142If using Dymola, turn off \"Equidistant time grid\" to avoid numerical errors.
143</p>
144
145<img src=\"modelica://Modelica/Resources/Images/Fluid/Examples/PumpingSystem.png\" border=\"1\"
146 alt=\"PumpingSystem.png\">
147</html>", revisions="<html>
148<ul>
149<li><i>Jan 2009</i>
150 by R&uuml;diger Franke:<br>
151 Reduce diameters of pipe and reservoir ports; use separate port for measurement of reservoirPressure, avoiding disturbances due to pressure losses.</li>
152<li><i>1 Oct 2007</i>
153 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
154 Parameters updated.</li>
155<li><i>2 Nov 2005</i>
156 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
157 Created.</li>
158</ul>
159</html>"),
160 experiment(
161 StopTime=2000,
162 Interval=0.4,
163 Tolerance=1e-006));
164end PumpingSystem;