Skip to content

Commit c4ce6c9

Browse files
Include delay in blocks.
Note: it can be used the updated version of RTC-Tools where the delay handling is fixed.
1 parent b9d12fc commit c4ce6c9

File tree

2 files changed

+5
-16
lines changed
  • src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Hydraulic/Branches

2 files changed

+5
-16
lines changed

src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Hydraulic/Branches/IDZ.mo

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@ within Deltares.ChannelFlow.Hydraulic.Branches;
22

33
model IDZ
44
import SI = Modelica.Units.SI;
5-
extends PartialIDZ;
5+
extends Deltares.ChannelFlow.Hydraulic.Branches.Internal.PartialIDZ;
66

77
// Bed level
88
parameter SI.Position H_b_up;
99
parameter SI.Position H_b_down;
10-
parameter SI.Time Delay_in_hour = 0.0;
1110
parameter SI.Position length;
1211
parameter SI.Position width;
1312
parameter SI.VolumeFlowRate Q_nominal;
1413
parameter SI.Position H_nominal;
1514
parameter SI.Position friction_coefficient;
1615
parameter SI.Position side_slope;
17-
//parameter n_level_nodes = 2;
18-
1916
parameter Integer n_level_nodes = 2;
2017

2118
annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10})));

src/rtctools_channel_flow/modelica/Deltares/ChannelFlow/Hydraulic/Branches/Internal/PartialIDZ.mo

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ partial model PartialIDZ
77
extends Deltares.ChannelFlow.Internal.Reservoir;
88
input Real Q_upstream_delayed;
99
input Real Q_downstream_delayed;
10-
//output Real q_up_der;
10+
parameter SI.Duration Delay_in_hour;
11+
1112

1213
// States
1314
SI.Position[2] H(min = H_b_down);
@@ -26,19 +27,10 @@ equation
2627
Q[1] = HQUp.Q;
2728
Q[2] = HQDown.Q;
2829

29-
// Mass balance
30-
//der(V) = HQUp.Q + HQDown.Q + sum(QForcing) + sum(QLateral.Q);
31-
//idz_zero = 0.001;
32-
//der(HQDown.Q) = q_up_der;
33-
//der(HQDown.Q) = q_down_der;
34-
3530
der(HQDown.H) = Q_upstream_delayed / Ad + sum(QForcing) / Ad + sum(QLateral.Q) / Ad + p21 * der(Q_upstream_delayed)+ HQDown.Q / Ad + p22 * der(HQDown.Q);
3631
der(HQUp.H) = HQUp.Q / Au + sum(QForcing) / Au + sum(QLateral.Q) / Au + p11 * der(HQUp.Q)+ Q_downstream_delayed / Au + p12 * der(Q_downstream_delayed);
37-
Q_upstream_delayed = HQUp.Q;
38-
Q_downstream_delayed = HQDown.Q;
3932

40-
//Q_upstream_delayed + HQDown.Q = 0;
33+
Q_downstream_delayed = delay(HQDown.Q, Delay_in_hour);
34+
Q_upstream_delayed = delay(HQUp.Q, Delay_in_hour);
4135

42-
// Split outflow between turbine and spill flow
43-
HQDown.Q + Q_turbine + Q_spill = 0.0;
4436
end PartialIDZ;

0 commit comments

Comments
 (0)