Skip to content

Commit 7a47311

Browse files
committed
Fixing the Examples
1 parent 1424c67 commit 7a47311

11 files changed

Lines changed: 75 additions & 75 deletions

OpenHPL/Examples/BranchingPipes.mo

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
within OpenHPL.Examples;
22
model BranchingPipes "Model of branching pipes"
33
extends Modelica.Icons.Example;
4-
Waterway.Reservoir reservoir annotation (
4+
Waterway.Reservoir reservoir(fixElevation = true, z_0 = 3) annotation (
55
Placement(transformation(extent = {{-80, -10}, {-60, 10}})));
66
Waterway.Pipe mainPipe(D_i = 6, H = 1, L = 100) annotation (
77
Placement(transformation(extent = {{-52, -10}, {-32, 10}})));
88
Waterway.Reservoir reservoir1 annotation (
99
Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {70, 0})));
1010
Waterway.Pipe branch1(D_i = 3, H = 1, L = 100, Vdot_0 = data.Vdot_0/2) annotation (
1111
Placement(transformation(extent = {{-10, 10}, {10, 30}})));
12-
Waterway.Pipe branch2(D_i = 3, H = 1, L = 100, Vdot_0 = data.Vdot_0/2) annotation (
12+
Waterway.Pipe branch2(D_i = 3, H = 1, L = 100, Vdot_0 = data.Vdot_0/2) annotation(
1313
Placement(transformation(extent = {{-10, -30}, {10, -10}})));
1414
Waterway.Pipe mainPipeOut(D_i = 5, H = 1, L = 100) annotation (
1515
Placement(transformation(extent = {{30, -10}, {50, 10}})));
1616
inner Data data(SteadyState = true, Vdot_0 = 75) annotation (
1717
Placement(transformation(extent = {{-100, 80}, {-80, 100}})));
1818
equation
19-
connect(reservoir.o, mainPipe.i) annotation (
19+
connect(reservoir.o, mainPipe.i) annotation(
2020
Line(points = {{-60, 0}, {-52, 0}}, color = {28, 108, 200}));
21-
connect(branch1.i, mainPipe.o) annotation (
21+
connect(branch1.i, mainPipe.o) annotation(
2222
Line(points = {{-10, 20}, {-20, 20}, {-20, 0}, {-32, 0}}, color = {28, 108, 200}));
23-
connect(mainPipe.o, branch2.i) annotation (
23+
connect(mainPipe.o, branch2.i) annotation(
2424
Line(points = {{-32, 0}, {-20, 0}, {-20, -20}, {-10, -20}}, color = {28, 108, 200}));
25-
connect(branch2.o, mainPipeOut.i) annotation (
25+
connect(branch2.o, mainPipeOut.i) annotation(
2626
Line(points = {{10, -20}, {20, -20}, {20, 0}, {30, 0}}, color = {28, 108, 200}));
27-
connect(branch1.o, mainPipeOut.i) annotation (
27+
connect(branch1.o, mainPipeOut.i) annotation(
2828
Line(points = {{10, 20}, {20, 20}, {20, 0}, {30, 0}}, color = {28, 108, 200}));
29-
connect(mainPipeOut.o, reservoir1.o) annotation (
29+
connect(mainPipeOut.o, reservoir1.o) annotation(
3030
Line(points = {{50, 0}, {60, 0}}, color = {0, 128, 255}));
3131
annotation (
3232
experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4));
33-
end BranchingPipes;
33+
end BranchingPipes;

OpenHPL/Examples/DetailedTurbine.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ within OpenHPL.Examples;
22
model DetailedTurbine "Hydropower system using KP scheme based penstock"
33
extends SimpleTurbine(
44
redeclare Waterway.PenstockKP penstock);
5-
annotation (experiment(StopTime=1000));
6-
end DetailedTurbine;
5+
annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2));
6+
end DetailedTurbine;

OpenHPL/Examples/Gate.mo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Examples;
22
model Gate "Usage of the tainter gate"
33
extends Modelica.Icons.Example;
4-
inner Data data(SteadyState = true, Vdot_0 = 75) annotation (
4+
inner Data data(SteadyState = true, Vdot_0 = 75, showElevation = false) annotation (
55
Placement(transformation(extent = {{-100, 80}, {-80, 100}})));
66
Modelica.Blocks.Sources.Ramp gateOpening(
77
height=0,
@@ -12,7 +12,7 @@ model Gate "Usage of the tainter gate"
1212
constantLevel=false,
1313
useLevel=true,
1414
L=10,
15-
W=10) annotation (Placement(transformation(extent={{-40,40},{-20,60}})));
15+
W=10, fixElevation = true) annotation (Placement(transformation(extent={{-40,40},{-20,60}})));
1616
Waterway.Reservoir downstream(
1717
h_0=4,
1818
constantLevel=false,
@@ -32,7 +32,7 @@ model Gate "Usage of the tainter gate"
3232
constantLevel=false,
3333
useLevel=true,
3434
L=10,
35-
W=10) annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
35+
W=10, fixElevation = true) annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
3636
Waterway.Reservoir downstream1(
3737
h_0=4,
3838
constantLevel=false,
@@ -51,7 +51,7 @@ model Gate "Usage of the tainter gate"
5151
constantLevel=false,
5252
useLevel=true,
5353
L=10,
54-
W=10) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
54+
W=10, fixElevation = true) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
5555
Waterway.Reservoir downstream2(
5656
h_0=4,
5757
constantLevel=false,
@@ -91,4 +91,4 @@ equation
9191
connect(upstream2.level, up_level.y) annotation (Line(points={{-42,-44},{-52,-44},{-52,0},{-59,0}}, color={0,0,127}));
9292
annotation (
9393
experiment(StopTime=2000, Interval=0.4));
94-
end Gate;
94+
end Gate;

OpenHPL/Examples/Pipes.mo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ model Pipes "Example of contracting, contstant and expanding pipe diameters"
55
inner OpenHPL.Data data annotation (
66
Placement(transformation(origin={-90,90}, extent={{-10,-10},{10,10}})));
77
parameter SI.Diameter Dn=0.3568 "Nominal Diameter";
8-
Waterway.Reservoir Upstream(h_0 = 100.0, constantLevel=true)
8+
Waterway.Reservoir Upstream(h_0 = 100.0, constantLevel=true, fixElevation = true, z_0 = 50)
99
annotation (
1010
Placement(transformation(origin={-50,0}, extent={{-10,-10},{10,10}})));
11-
Waterway.Reservoir Downstream(h_0 = 0.0, constantLevel=true)
11+
Waterway.Reservoir Downstream(h_0 = 0.0, constantLevel=true, z_0 = 30, fixElevation = true)
1212
annotation (
1313
Placement(transformation(origin={50,0}, extent={{10,-10},{-10,10}}, rotation = -0)));
1414
OpenHPL.Waterway.Pipe pipeExpanding(
1515
D_i=0.8*Dn,
1616
D_o=1.2*Dn,
17-
H=0,
17+
H= 10,
1818
L=1000) annotation (Placement(transformation(origin={0,20}, extent={{-10,-10},{10,10}})));
1919
OpenHPL.Waterway.Pipe pipeConstant(
2020
D_i=Dn,
2121
D_o=Dn,
22-
H=0,
22+
H= 20,
2323
L=1000) annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
2424
OpenHPL.Waterway.Pipe pipeContracting(
2525
D_i=1.2*Dn,
2626
D_o=0.8*Dn,
27-
H=0,
27+
H= 30,
2828
L=1000) annotation (Placement(transformation(origin={0,-20}, extent={{-10,-10},{10,10}})));
2929

3030
equation
@@ -36,4 +36,4 @@ equation
3636
connect(pipeContracting.o, Downstream.o) annotation (Line(points={{10,-20},{30,-20},{30,0},{40,0}}, color={0,128,255}));
3737
annotation (
3838
experiment(StartTime = 0, StopTime = 100, Tolerance = 1e-06, Interval = 0.02));
39-
end Pipes;
39+
end Pipes;

OpenHPL/Examples/SimpleGen.mo

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
within OpenHPL.Examples;
22
model SimpleGen "Model of a hydropower system with a simple turbine turbine and generator"
33
extends SimpleTurbine(
4-
turbine(
5-
enable_nomSpeed=false,
6-
enable_P_out=true));
4+
turbine(enable_nomSpeed = false, enable_P_out = true), reservoir(fixElevation = true, z_0 = 100));
75
ElectroMech.Generators.SimpleGen simpleGen annotation (Placement(transformation(extent={{20,50},{40,70}})));
86
Modelica.Blocks.Math.Gain loadLevel(k=1) annotation (Placement(transformation(extent={{72,70},{52,90}})));
97
equation
@@ -12,5 +10,5 @@ equation
1210
connect(simpleGen.flange, turbine.flange) annotation (Line(
1311
points={{30,60},{30,10}},
1412
color={0,0,0}));
15-
annotation (experiment(StopTime=1000));
16-
end SimpleGen;
13+
annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2));
14+
end SimpleGen;

OpenHPL/Examples/SimpleGenFrancis.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Examples;
22
model SimpleGenFrancis "Model of a hydropower system with Francis turbine model"
33
extends Modelica.Icons.Example;
4-
Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(
4+
Waterway.Reservoir reservoir(h_0 = 48, fixElevation = true) annotation (Placement(transformation(
55
origin={-90,50},
66
extent={{-10,-10},{10,10}})));
77
Modelica.Blocks.Sources.Ramp control(
@@ -57,7 +57,7 @@ model SimpleGenFrancis "Model of a hydropower system with Francis turbine model"
5757
annotation (Placement(transformation(
5858
origin={30,0},
5959
extent={{-10,-10},{10,10}})));
60-
inner OpenHPL.Data data(Vdot_0=4.54) annotation (Placement(transformation(
60+
inner OpenHPL.Data data(SteadyState = false) annotation (Placement(transformation(
6161
origin={-90,90},
6262
extent={{-10,-10},{10,10}})));
6363
Waterway.Fitting fitting(
@@ -86,5 +86,5 @@ equation
8686
Line(points={{80,6.66134e-16},{80,0},{70,0}}, color = {28, 108, 200}));
8787
connect(penstock.o, fitting.i) annotation (
8888
Line(points={{-20,0},{-12,0}}, color = {28, 108, 200}));
89-
annotation (experiment(StopTime=1000));
90-
end SimpleGenFrancis;
89+
annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2));
90+
end SimpleGenFrancis;

OpenHPL/Examples/SimpleTurbine.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Examples;
22
model SimpleTurbine "Model of a hydropower system with a simple turbine turbine"
33
extends Modelica.Icons.Example;
4-
OpenHPL.Waterway.Reservoir reservoir(h_0=10) annotation (Placement(transformation(
4+
OpenHPL.Waterway.Reservoir reservoir(h_0 = 10, fixElevation = true, z_0 = 100) annotation (Placement(transformation(
55
origin={-90,30},
66
extent={{-10,-10},{10,10}})));
77
Modelica.Blocks.Sources.Ramp control(
@@ -45,5 +45,5 @@ equation
4545
Line(points={{-50,30},{-40,30}}, color = {28, 108, 200}));
4646
connect(surgeTank.o, penstock.i) annotation (Line(points={{-20,30},{-10,30}}, color={28,108,200}));
4747
connect(discharge.o, tail.o) annotation (Line(points={{70,0},{80,0}}, color={28,108,200}));
48-
annotation (experiment(StopTime=1000));
49-
end SimpleTurbine;
48+
annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2));
49+
end SimpleTurbine;

OpenHPL/Examples/SimpleValve.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Examples;
22
model SimpleValve "Model of a hydropower system with a simple turbine turbine"
33
extends Modelica.Icons.Example;
4-
OpenHPL.Waterway.Reservoir reservoir(h_0=10) annotation (Placement(transformation(
4+
OpenHPL.Waterway.Reservoir reservoir(h_0 = 10, fixElevation = true, z_0 = 100) annotation (Placement(transformation(
55
origin={-90,30},
66
extent={{-10,-10},{10,10}})));
77
Modelica.Blocks.Sources.Ramp control(
@@ -46,10 +46,10 @@ equation
4646
connect(penstock.o, valve.i) annotation (Line(points={{10,30},{20,30}}, color={0,128,255}));
4747
connect(valve.o, discharge.i) annotation (Line(points={{40,30},{50,30}}, color={0,128,255}));
4848
connect(control.y, valve.opening) annotation (Line(points={{1,70},{30,70},{30,38}}, color={0,0,127}));
49-
annotation (experiment(StopTime=1000), Documentation(info="<html>
49+
annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2), Documentation(info="<html>
5050
<p>
5151
Simple model of a water way with only a valve component.
5252
This can be used to investigate the effect of different opening and closing times in the waterway.
5353
</p>
5454
</html>"));
55-
end SimpleValve;
55+
end SimpleValve;

OpenHPL/Examples/SimpleValveWithCreek.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ within OpenHPL.Examples;
22
model SimpleValveWithCreek
33
"Model of a hydropower system with a simple turbine turbine"
44
extends Modelica.Icons.Example;
5-
Waterway.Reservoir reservoir(h_0 = 10, constantLevel = false) annotation(
5+
Waterway.Reservoir reservoir(h_0 = 10, constantLevel = false, fixElevation = true, z_0 = 110) annotation(
66
Placement(transformation(origin = {-90, 30}, extent = {{-10, -10}, {10, 10}})));
77
Modelica.Blocks.Sources.Ramp control(duration = 30, height = 0.5, offset = 0, startTime = 500e6) annotation(
88
Placement(transformation(origin={-10,0}, extent = {{-10, -10}, {10, 10}})));
@@ -15,7 +15,7 @@ model SimpleValveWithCreek
1515
replaceable Waterway.Pipe penstock(D_i = 3, D_o = 3, H = 80, L = 200, vertical = true)
1616
constrainedby Interfaces.TwoContacts annotation(
1717
Placement(transformation(origin={60,30}, extent = {{-10, -10}, {10, 10}})));
18-
Waterway.SurgeTank creekIntake(H = 25, L = 30, h_0 = 20, useCreekIntake = true) annotation(
18+
Waterway.SurgeTank creekIntake(H = 25, L = 30, h_0 = 20) annotation(
1919
Placement(transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}})));
2020
inner Data data(Vdot_0 = 0) annotation(
2121
Placement(transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}})));
@@ -49,11 +49,11 @@ equation
4949
connect(penstock.o, valve.i) annotation (Line(points={{70,30},{80,30},{80,10},
5050
{8,10},{8,-20},{20,-20}}, color={0,128,255}));
5151
annotation(
52-
experiment(StopTime = 1000),
52+
experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2),
5353
Documentation(info = "<html>
5454
<p>
5555
Simple model of a water way with one creek intake.
5656
This can be used to investigate the effects of a creek intake.
5757
</p>
5858
</html>"));
59-
end SimpleValveWithCreek;
59+
end SimpleValveWithCreek;

OpenHPL/Examples/VolumeFlowSource.mo

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ within OpenHPL.Examples;
22
model VolumeFlowSource "Example demonstrating the use of VolumeFlowSource"
33
extends Modelica.Icons.Example;
44
OpenHPL.Waterway.Reservoir tail1 annotation (Placement(transformation(extent={{60,30},{40,50}})));
5-
inner OpenHPL.Data data annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
6-
OpenHPL.Waterway.VolumeFlowSource volumeFlowConstant annotation (Placement(transformation(extent={{-50,30},{-30,50}})));
5+
inner OpenHPL.Data data(SteadyState = false, Vdot_0 = 1, showElevation = false) annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
6+
OpenHPL.Waterway.VolumeFlowSource volumeFlowConstant(fixElevation = true) annotation (Placement(transformation(extent={{-50,30},{-30,50}})));
77
Waterway.Pipe pipe1(H=0) annotation (Placement(transformation(extent={{-10,30},{10,50}})));
88
Waterway.Pipe pipe2(H=0) annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
99
OpenHPL.Waterway.Reservoir tail2 annotation (Placement(transformation(extent={{60,-10},{40,10}})));
10-
OpenHPL.Waterway.VolumeFlowSource volumeFlowInput(useInput=true, useFilter=false) annotation (Placement(transformation(extent={{-48,-10},{-28,10}})));
11-
Modelica.Blocks.Sources.Sine sine(f=0.01) annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
12-
Modelica.Blocks.Sources.CombiTimeTable logdata(table=[1,0.256342739; 2,0.245221436; 3,0.266113698; 4,0.249561667; 5,0.525063097; 6,0.479064316; 7,0.494991362; 8,0.489708632; 9,0.50391084; 10,0.492354929; 11,0.509279788; 12,0.495274216; 13,0.493877858; 14,0.520679474; 15,0.499932915; 16,0.494227827; 17,0.472558141; 18,0.441845328; 19,0.398698032; 20,0.369865984; 21,0.341512531; 22,0.317958236; 23,0.300121665; 24,0.283421665; 25,0.271103382; 26,0.29000932; 27,0.276437521; 28,0.279719085; 29,0.273819894;
10+
OpenHPL.Waterway.VolumeFlowSource volumeFlowInput(useInput=true, useFilter= false, fixElevation = true) annotation (Placement(transformation(extent={{-48,-10},{-28,10}})));
11+
Modelica.Blocks.Sources.Sine sine(f = 0.01, offset = 1) annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
12+
Modelica.Blocks.Sources.CombiTimeTable logdata(table=[1, 1; 2,0.245221436; 3,0.266113698; 4,0.249561667; 5,0.525063097; 6,0.479064316; 7,0.494991362; 8,0.489708632; 9,0.50391084; 10,0.492354929; 11,0.509279788; 12,0.495274216; 13,0.493877858; 14,0.520679474; 15,0.499932915; 16,0.494227827; 17,0.472558141; 18,0.441845328; 19,0.398698032; 20,0.369865984; 21,0.341512531; 22,0.317958236; 23,0.300121665; 24,0.283421665; 25,0.271103382; 26,0.29000932; 27,0.276437521; 28,0.279719085; 29,0.273819894;
1313
30,0.530646265; 31,0.494690746; 32,0.668753743; 33,0.748319328; 34,1.156479597; 35,1.622769237; 36,1.455329537; 37,1.440503478; 38,1.388660312; 39,1.321571827; 40,1.428969026; 41,1.335716724; 42,1.240077496; 43,1.147016048; 44,1.046641827; 45,0.957466781; 46,0.877434254; 47,0.760209978; 48,0.685476542; 49,0.611937046; 50,0.5434497; 51,0.486470848; 52,0.437200874; 53,0.387043357; 54,0.346913666; 55,0.321531206; 56,0.3025949; 57,0.289946347; 58,0.76049149; 59,1.301532745; 60,1.66047287; 61,
1414
1.468578339; 62,1.445258141; 63,1.381029367; 64,1.308333635; 65,1.429936647; 66,1.324193954; 67,1.215524554; 68,1.132795691; 69,1.039966226; 70,0.957139969; 71,0.881121516; 72,0.764806509; 73,0.679720461; 74,1.153712869; 75,1.617045045; 76,1.342065096; 77,1.21108222; 78,1.097126365; 79,0.956687152; 80,0.846820831; 81,0.726776063; 82,0.637088716; 83,0.566960931; 84,0; 85,0.081746899; 86,0.287258357; 87,0.440648884; 88,0.623197138; 89,0.745818675; 90,0.877141893; 91,1.14376235; 92,1.091307402;
1515
93,1.166081309; 94,1.204966307; 95,1.155335188; 96,1.090149403; 97,1.023901701; 98,0.955312788; 99,0.895717919; 100,0.781589091; 101,0.711237729; 102,0.642216742; 103,0.592425168; 104,0.53075856; 105,0.470919639; 106,0.424907953; 107,0.379154414; 108,0.341206133; 109,0.313439339; 110,0.291419089; 111,0.282484144], extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint)
1616
annotation (Placement(transformation(extent={{-80,-50},{-60,-30}})));
1717
Waterway.Pipe pipe3(H=0) annotation (Placement(transformation(extent={{-10,-50},{10,-30}})));
1818
Waterway.Reservoir tail3 annotation (Placement(transformation(extent={{60,-50},{40,-30}})));
19-
Waterway.VolumeFlowSource volumeFlowFiltered(useInput=true, useFilter=true) annotation (Placement(transformation(extent={{-48,-50},{-28,-30}})));
19+
Waterway.VolumeFlowSource volumeFlowFiltered(useInput=true, useFilter=true, fixElevation = true) annotation (Placement(transformation(extent={{-48,-50},{-28,-30}})));
2020
equation
2121
connect(pipe1.o, tail1.o) annotation (Line(points={{10,40},{40,40}}, color={0,128,255}));
2222
connect(volumeFlowConstant.o, pipe1.i) annotation (Line(points={{-30,40},{-10,40}}, color={0,128,255}));
@@ -28,4 +28,4 @@ equation
2828
color={0,128,255}));
2929
connect(volumeFlowFiltered.outFlow, logdata.y[1]) annotation (Line(points={{-50,-40},{-59,-40}}, color={0,0,127}));
3030
annotation (experiment(StopTime=120));
31-
end VolumeFlowSource;
31+
end VolumeFlowSource;

0 commit comments

Comments
 (0)