@@ -7,69 +7,99 @@ package TestPipe
77 extends Modelica.Icons.Example;
88 //
99 inner OpenHPL.Data data(Vdot_0 = 0.0 , p_a = 0.0 , p_eps = 0.0 ) annotation(
10- Placement(transformation(origin = {-72, 80 }, extent = {{-10, -10}, {10, 10}})));
10+ Placement(transformation(origin = {-70, 70 }, extent = {{-10, -10}, {10, 10}})));
1111 //
1212 parameter Modelica.Units.SI.Length Ln = 1000 .;
1313 parameter Modelica.Units.SI.Length Dn = sqrt (A* 4 / Modelica.Constants.pi);
1414 Real error;
1515 OpenHPL.Waterway.Reservoir Upstream(h_0 = 100 , constantLevel = true ) annotation(
16- Placement(transformation(origin = {-54, 32 }, extent = {{-10, -10}, {10, 10}})));
16+ Placement(transformation(origin = {-50, 30 }, extent = {{-10, -10}, {10, 10}})));
1717 OpenHPL.Waterway.Reservoir Downstream(constantLevel = true , h_0 = 0 ) annotation(
18- Placement(transformation(origin = {72 , 10}, extent = {{10, -10}, {-10, 10}}, rotation = -0 )));
18+ Placement(transformation(origin = {70 , 10}, extent = {{10, -10}, {-10, 10}})));
1919 protected
2020 constant Modelica.Units.SI.Area A = 0.1 ;
2121 end AbstractTest;
2222
2323 model Test01
2424 extends AbstractTest;
25- OpenHPL.Waterway.Pipe pipe1(H = 0 , L = Ln, D_i = 0.8 * Dn, D_o = 1.2 * Dn, SteadyState = true ) annotation(
26- Placement(transformation(origin = {2, 68 }, extent = {{-10, -10}, {10, 10}})));
27- OpenHPL.Waterway.Pipe pipe2(H = 0 , L = Ln, D_i = Dn, D_o = Dn, SteadyState = true ) annotation(
28- Placement(transformation(origin = {2, 40 }, extent = {{-10, -10}, {10, 10}})));
29- OpenHPL.Waterway.Pipe pipe3(H = 0 , L = Ln, D_i = 1.2 * Dn, D_o = 0.8 * Dn, SteadyState = true ) annotation(
30- Placement(transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}})));
25+ OpenHPL.Waterway.Pipe pipe1(H = 0 , L = Ln, D_i = 0.8 * Dn, D_o = 1.2 * Dn) annotation(
26+ Placement(transformation(origin = {0, 60 }, extent = {{-10, -10}, {10, 10}})));
27+ OpenHPL.Waterway.Pipe pipe2(H = 0 , L = Ln, D_i = Dn, D_o = Dn) annotation(
28+ Placement(transformation(origin = {0, 30 }, extent = {{-10, -10}, {10, 10}})));
29+ OpenHPL.Waterway.Pipe pipe3(H = 0 , L = Ln, D_i = 1.2 * Dn, D_o = 0.8 * Dn) annotation(
30+ Placement(transformation(extent = {{-10, -10}, {10, 10}})));
3131 equation
3232 error= sqrt ((pipe1.mdot- pipe2.mdot)^ 2 + (pipe2.mdot- pipe3.mdot)^ 2 + (pipe3.mdot- pipe1.mdot)^ 2 );
33- connect (Upstream.o, pipe1.i) annotation(
34- Line(points = {{-44, 32 }, {-34, 32 }, {-34, 68 }, {-8, 68 }}, color = {0, 128, 255}));
35- connect (pipe1.o, Downstream .o) annotation(
36- Line(points = {{12, 68 }, {38, 68}, {38, 10}, {62, 10 }}, color = {0, 128, 255}));
37- connect (pipe2 .o, Downstream.o ) annotation(
38- Line(points = {{12, 40 }, {26, 40 }, {26, 10 }, {62, 10 }}, color = {0, 128, 255}));
39- connect (pipe3 .o, Downstream.o) annotation(
40- Line(points = {{10, 8 }, {20, 8 }, {20 , 10}, {62 , 10}}, color = {0, 128, 255}));
41- connect (Upstream .o, pipe2.i ) annotation(
42- Line(points = {{-44, 32 }, {-26, 32 }, {-26, 40 }, {-8, 40 }}, color = {0, 128, 255}));
43- connect (Upstream .o, pipe3.i ) annotation(
44- Line(points = {{-44, 32 }, {-32, 32 }, {-32, 8 }, {-10, 8 }}, color = {0, 128, 255}));
33+ connect (Upstream.o, pipe1.i) annotation(
34+ Line(points = {{-40, 30 }, {-20, 30 }, {-20, 60 }, {-10, 60 }}, color = {0, 128, 255}));
35+ connect (pipe2.i, Upstream .o) annotation(
36+ Line(points = {{-10, 30 }, {-40, 30 }}, color = {0, 128, 255}));
37+ connect (Upstream .o, pipe3.i ) annotation(
38+ Line(points = {{-40, 30 }, {-20, 30 }, {-20, 0 }, {-10, 0 }}, color = {0, 128, 255}));
39+ connect (pipe1 .o, Downstream.o) annotation(
40+ Line(points = {{10, 60 }, {50, 60 }, {50 , 10}, {60 , 10}}, color = {0, 128, 255}));
41+ connect (pipe2 .o, Downstream.o ) annotation(
42+ Line(points = {{10, 30 }, {50, 30 }, {50, 10 }, {60, 10 }}, color = {0, 128, 255}));
43+ connect (pipe3 .o, Downstream.o ) annotation(
44+ Line(points = {{10, 0 }, {50, 0 }, {50, 10 }, {60, 10 }}, color = {0, 128, 255}));
4545 annotation(
4646 experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002));
4747end Test01;
4848
4949 model Test02
50- extends AbstractTest;
51- OpenHPL.Waterway.Pipe pipe1(H = 0 , L = Ln, D_i = 0.8 * Dn, D_o = 1.2 * Dn) annotation(
52- Placement(transformation(origin = {2, 68}, extent = {{-10, -10}, {10, 10}})));
53- OpenHPL.Waterway.Pipe pipe2(H = 0 , L = Ln, D_i = Dn, D_o = Dn) annotation(
54- Placement(transformation(origin = {2, 40}, extent = {{-10, -10}, {10, 10}})));
55- OpenHPL.Waterway.Pipe pipe3(H = 0 , L = Ln, D_i = 1.2 * Dn, D_o = 0.8 * Dn) annotation(
56- Placement(transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}})));
50+ extends OpenHPLTest.TestPipe.Test01(data(SteadyState = true ));
5751 equation
58- error= sqrt ((pipe1.mdot- pipe2.mdot)^ 2 + (pipe2.mdot- pipe3.mdot)^ 2 + (pipe3.mdot- pipe1.mdot)^ 2 );
59- connect (Upstream.o, pipe1.i) annotation(
60- Line(points = {{-44, 32}, {-34, 32}, {-34, 68}, {-8, 68}}, color = {0, 128, 255}));
61- connect (pipe1.o, Downstream.o) annotation(
62- Line(points = {{12, 68}, {38, 68}, {38, 10}, {62, 10}}, color = {0, 128, 255}));
63- connect (pipe2.o, Downstream.o) annotation(
64- Line(points = {{12, 40}, {26, 40}, {26, 10}, {62, 10}}, color = {0, 128, 255}));
65- connect (pipe3.o, Downstream.o) annotation(
66- Line(points = {{10, 8}, {20, 8}, {20, 10}, {62, 10}}, color = {0, 128, 255}));
67- connect (Upstream.o, pipe2.i) annotation(
68- Line(points = {{-44, 32}, {-26, 32}, {-26, 40}, {-8, 40}}, color = {0, 128, 255}));
69- connect (Upstream.o, pipe3.i) annotation(
70- Line(points = {{-44, 32}, {-32, 32}, {-32, 8}, {-10, 8}}, color = {0, 128, 255}));
52+
53+ end Test02;
54+
55+ model Test03
56+ extends AbstractTest(data(SteadyState = true ));
57+
58+ OpenHPL.Waterway.Pipe pipe1(H = 0 , L = Ln, D_i = Dn) annotation(
59+ Placement(transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}})));
60+ OpenHPL.Waterway.Pipe pipe2(H = 0 , L = Ln, D_i = Dn) annotation(
61+ Placement(transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}})));
62+ OpenHPL.Waterway.Pipe pipe3(H = 0 , L = Ln, D_i = Dn) annotation( Placement(transformation(extent = {{-10, -10}, {10, 10}})));
63+ OpenHPL.Waterway.Valve valve1(ValveCapacity = false , H_n = 100 , Vdot_n = 1 ) annotation(
64+ Placement(transformation(origin = {30, 60}, extent = {{-10, -10}, {10, 10}})));
65+ OpenHPL.Waterway.Valve valve2(ValveCapacity = false , H_n = 100 , Vdot_n = 1 ) annotation(
66+ Placement(transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}})));
67+ OpenHPL.Waterway.Valve valve3(ValveCapacity = false , H_n = 100 , Vdot_n = 1 ) annotation(
68+ Placement(transformation(origin = {30, 0}, extent = {{-10, 10}, {10, -10}})));
69+ Modelica.Blocks.Sources.Ramp ramp1(height = 1 , duration = 5 , offset = 0 , startTime = 2 ) annotation(
70+ Placement(transformation(origin = {80, 80}, extent = {{10, -10}, {-10, 10}}, rotation = -0)));
71+ Modelica.Blocks.Sources.Ramp ramp2(duration = 5 , height = 0.5 , offset = 0.5 , startTime = 2 ) annotation(
72+ Placement(transformation(origin = {80, 50}, extent = {{10, -10}, {-10, 10}})));
73+ Modelica.Blocks.Sources.Ramp ramp3(duration = 5 , height = - 1 , offset = 1 , startTime = 2 ) annotation(
74+ Placement(transformation(origin = {80, -20}, extent = {{10, -10}, {-10, 10}})));
75+ equation
76+ error= sqrt ((pipe1.mdot- pipe2.mdot)^ 2 + (pipe2.mdot- pipe3.mdot)^ 2 + (pipe3.mdot- pipe1.mdot)^ 2 );
77+ connect (pipe1.o, valve1.i) annotation(
78+ Line(points = {{10, 60}, {20, 60}}, color = {0, 128, 255}));
79+ connect (pipe2.o, valve2.i) annotation(
80+ Line(points = {{10, 30}, {20, 30}}, color = {0, 128, 255}));
81+ connect (pipe3.o, valve3.i) annotation(
82+ Line(points = {{10, 0}, {20, 0}}, color = {0, 128, 255}));
83+ connect (ramp1.y, valve1.opening) annotation(
84+ Line(points = {{69, 80}, {30, 80}, {30, 68}}, color = {0, 0, 127}));
85+ connect (valve1.o, Downstream.o) annotation(
86+ Line(points = {{40, 60}, {52, 60}, {52, 10}, {62, 10}}, color = {0, 128, 255}));
87+ connect (valve2.o, Downstream.o) annotation(
88+ Line(points = {{40, 30}, {52, 30}, {52, 10}, {62, 10}}, color = {0, 128, 255}));
89+ connect (ramp3.y, valve3.opening) annotation(
90+ Line(points = {{69, -20}, {30, -20}, {30, -8}}, color = {0, 0, 127}));
91+ connect (valve3.o, Downstream.o) annotation(
92+ Line(points = {{40, 0}, {52, 0}, {52, 10}, {62, 10}}, color = {0, 128, 255}));
93+ connect (valve2.opening, ramp2.y) annotation(
94+ Line(points = {{30, 38}, {30, 50}, {70, 50}}, color = {0, 0, 127}));
95+ connect (Upstream.o, pipe2.i) annotation(
96+ Line(points = {{-40, 30}, {-10, 30}}, color = {0, 128, 255}));
97+ connect (Upstream.o, pipe1.i) annotation(
98+ Line(points = {{-40, 30}, {-20, 30}, {-20, 60}, {-10, 60}}, color = {0, 128, 255}));
99+ connect (Upstream.o, pipe3.i) annotation(
100+ Line(points = {{-40, 30}, {-20, 30}, {-20, 0}, {-10, 0}}, color = {0, 128, 255}));
71101 annotation(
72- experiment(StartTime = 0, StopTime = 20 , Tolerance = 1e-06, Interval = 0.004 ));
73- end Test02 ;
102+ experiment(StartTime = 0, StopTime = 30 , Tolerance = 1e-06, Interval = 0.001 ));
103+ end Test03 ;
74104
75- end TestPipe;
105+ end TestPipe;
0 commit comments