-
Notifications
You must be signed in to change notification settings - Fork 0
Add hydraulic structures #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| Internal | ||
| Linear | ||
| HomotopicVolume | ||
| HomotopicPower |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures.Orifice; | ||
|
|
||
| model Orifice "Orifice that only allows flow when HQDown.H < HQUp.H" | ||
| extends Deltares.ChannelFlow.Hydraulic.Structures.DischargeControlledStructure(Q(min=0.0)); | ||
| parameter Modelica.Units.SI.Length dH_max = 10.0; | ||
| parameter Modelica.Units.SI.Area area = 1.0; | ||
| parameter Real discharge_coefficient = 0.61; | ||
| end Orifice; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures; | ||
|
|
||
| package Orifice | ||
| end Orifice; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Orifice |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||
| within Deltares.ChannelFlow.HydraulicStructures.PumpingStation; | ||||||
|
|
||||||
| partial model Pump "Pump with QHP relationship" | ||||||
| extends Deltares.ChannelFlow.Hydraulic.Structures.Pump; | ||||||
|
|
||||||
| // Increasing row number is increasing H power (staring at 0th power). | ||||||
| // Increasing column number is increasing Q power (staring at 0th power). | ||||||
|
||||||
| // Increasing column number is increasing Q power (staring at 0th power). | |
| // Increasing column number is increasing Q power (starting at 0th power). |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple parameters (power_coefficients, speed_coefficients, working_area, working_area_direction) are declared but never used in the model equations. These parameters appear to define pump characteristics but are not incorporated into any hydraulic or performance calculations.
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple parameters (power_coefficients, speed_coefficients, working_area, working_area_direction) are declared but never used in the model equations. These parameters appear to define pump characteristics but are not incorporated into any hydraulic or performance calculations.
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple parameters (power_coefficients, speed_coefficients, working_area, working_area_direction) are declared but never used in the model equations. These parameters appear to define pump characteristics but are not incorporated into any hydraulic or performance calculations.
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameters minimum_on and minimum_off are declared but never used in any equations or constraints. These timing constraints are not enforced in the model.
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameters for start-up and shut-down energy and costs are declared but never used in any equations. These operational costs are not incorporated into the model.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures.PumpingStation; | ||
|
|
||
| model PumpingStation | ||
| extends Deltares.ChannelFlow.Internal.HQTwoPort; | ||
| import SI = Modelica.Units.SI; | ||
| parameter Integer n_pumps = 0; | ||
|
|
||
| // FIXME: For some reason JModelica/CasADi returns {1, 2} for the expression | ||
| // 1:3 if we store it as an Integer, whereas it returns {1, 2, 3} if we | ||
| // store it as a Real. The weird thing is that JModelica does not complain | ||
| // about any size mismatches. Furthermore, transposes also do not seem to | ||
| // work well. | ||
| // To work around these issues, we detect the -999 default array, and | ||
| // overwrite it in Python with the correct one. | ||
| parameter Integer pump_switching_matrix[n_pumps, n_pumps] = fill(-999, n_pumps, n_pumps); | ||
| parameter Integer pump_switching_constraints[n_pumps, 2] = fill(-999, n_pumps, 2); | ||
|
|
||
| SI.VolumeFlowRate Q; | ||
| equation | ||
| // Discharge | ||
| Q = HQUp.Q; | ||
|
|
||
| HQUp.M = -HQDown.M; | ||
|
|
||
| // TODO: Annotation / pretty picture. Currently inheriting TwoPort. | ||
| end PumpingStation; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures.PumpingStation; | ||
|
|
||
| // TODO: Negative flows (from down to up) are not supported. Do we want to support them? | ||
| model Resistance "Quadratic resistance of form dH=C*Q^2" | ||
| extends Deltares.ChannelFlow.Internal.HQTwoPort; | ||
|
|
||
| parameter Real C = 0.0; | ||
|
||
|
|
||
| // Head loss | ||
| input Modelica.Units.SI.Distance dH; | ||
| equation | ||
| // Head | ||
| HQDown.H = HQUp.H - dH; | ||
|
|
||
| // Discharge | ||
| HQUp.Q + HQDown.Q = 0; | ||
|
|
||
| // Substances | ||
| HQUp.M = -HQDown.M; | ||
|
|
||
| // TODO: Annotation / pretty picture. Currently inheriting TwoPort. | ||
| end Resistance; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures; | ||
|
|
||
| package PumpingStation | ||
| end PumpingStation; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Resistance | ||
| PumpingStation | ||
| Pump |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures.Weir; | ||
|
|
||
| model Weir | ||
| import SI = Modelica.Units.SI; | ||
| extends Deltares.ChannelFlow.Internal.HQTwoPort; | ||
|
|
||
| // Inputs | ||
| input SI.VolumeFlowRate Q; | ||
|
|
||
| // Parameters | ||
| parameter SI.Length width "Width of the weir"; | ||
| parameter SI.VolumeFlowRate q_min "Minimum flow of the weir; has to be positive"; | ||
| parameter SI.VolumeFlowRate q_max "Maximum flow of the weir. Should be as low as possible."; | ||
| parameter SI.Length hw_min "Minimum height of the weir"; | ||
| parameter SI.Length hw_max "Maximum height of the weir"; | ||
| parameter Real weir_coef=0.61 "Weir discharge coefficient"; | ||
|
Comment on lines
+11
to
+16
|
||
| equation | ||
| HQUp.Q + HQDown.Q = 0; // Negative comes in, positive out, so in a branch positive goes in | ||
| HQUp.Q = Q; | ||
| annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Polygon(visible = true, origin = {0, -16.667}, fillColor = {255, 128, 0}, fillPattern = FillPattern.Solid, lineThickness = 2, points = {{0, 66.667}, {-50, -33.333}, {50, -33.333}})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}))); | ||
| end Weir; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| within Deltares.ChannelFlow.HydraulicStructures; | ||
|
|
||
| package Weir | ||
| end Weir; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Weir |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| within Deltares.ChannelFlow; | ||
|
|
||
| package HydraulicStructures | ||
| end HydraulicStructures; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| Reservoir | ||
| Reservoir_turbine_out | ||
| Reservoir_turbine_out | ||
| Reservoir_multi_io |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ Interfaces | |
| Internal | ||
| SimpleRouting | ||
| Hydraulic | ||
| HydraulicStructures | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'staring' to 'starting'.