first attempt at involving a Pegelregler in the system
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 47,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -32,38 +32,38 @@
|
||||
"rho = 1000. # density of water [kg/m³]\n",
|
||||
"\n",
|
||||
"# pipeline\n",
|
||||
"L = 535.+478. # length of pipeline [m]\n",
|
||||
"D = 0.9 # pipe diameter [m]\n",
|
||||
"L = 535.+478. # length of pipeline [m]\n",
|
||||
"D = 0.9 # pipe diameter [m]\n",
|
||||
"A_pipe = D**2/4*np.pi # pipeline area\n",
|
||||
"h_pipe = 105 # hydraulic head without reservoir [m] \n",
|
||||
"alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n",
|
||||
"n = 50 # number of pipe segments in discretization\n",
|
||||
"n = 50 # number of pipe segments in discretization\n",
|
||||
"# consider replacing Q0 with a vector be be more flexible in initial conditions\n",
|
||||
"Q0 = Q_nenn # initial flow in whole pipe [m³/s]\n",
|
||||
"v0 = Q0/A_pipe # initial flow velocity [m/s]\n",
|
||||
"# Q0 = Q_nenn # initial flow in whole pipe [m³/s]\n",
|
||||
"# v0 = Q0/A_pipe # initial flow velocity [m/s]\n",
|
||||
"f_D = 0.014 # Darcy friction factor\n",
|
||||
"c = 500. # propagation velocity of the pressure wave [m/s]\n",
|
||||
"# consider prescribing a total simulation time and deducting the number of timesteps from that\n",
|
||||
"nt = 2000 # number of time steps after initial conditions\n",
|
||||
"nt = 3000 # number of time steps after initial conditions\n",
|
||||
"\n",
|
||||
"# derivatives of the pipeline constants\n",
|
||||
"dx = L/n # length of each pipe segment\n",
|
||||
"dt = dx/c # timestep according to method of characterisitics\n",
|
||||
"nn = n+1 # number of nodes\n",
|
||||
"initial_level = 8. # water level in upstream reservoir [m]\n",
|
||||
"p0 = rho*g*initial_level-v0**2*rho/2\n",
|
||||
"initial_level = 8. # water level in upstream reservoir [m]\n",
|
||||
"# p0 = rho*g*initial_level-v0**2*rho/2\n",
|
||||
"pl_vec = np.arange(0,nn*dx,dx) # pl = pipe-length. position of the nodes on the pipeline\n",
|
||||
"t_vec = np.arange(0,nt+1)*dt # time vector\n",
|
||||
"h_vec = np.arange(0,n+1)*h_pipe/n # hydraulic head of pipeline at each node \n",
|
||||
"v_init = np.full(nn,Q0/(D**2/4*np.pi)) # initial velocity distribution in pipeline\n",
|
||||
"p_init = (rho*g*(initial_level+h_vec)-v_init**2*rho/2)-(f_D*pl_vec/D*rho/2*v_init**2) # ref Wikipedia: Darcy Weisbach\n",
|
||||
"# v_init = np.full(nn,Q0/(D**2/4*np.pi)) # initial velocity distribution in pipeline\n",
|
||||
"# p_init = (rho*g*(initial_level+h_vec)-v_init**2*rho/2)-(f_D*pl_vec/D*rho/2*v_init**2) # ref Wikipedia: Darcy Weisbach\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# reservoir\n",
|
||||
"# replace influx by vector\n",
|
||||
"initial_influx = 0. # initial influx of volume to the reservoir [m³/s]\n",
|
||||
"initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n",
|
||||
"initial_pipeline_pressure = p0 # Initial condition for the static pipeline pressure at the reservoir (= hydrostatic pressure - dynamic pressure) \n",
|
||||
"initial_influx = Q_nenn/1.1 # initial influx of volume to the reservoir [m³/s]\n",
|
||||
"# initial_outflux = Q0 # initial outflux of volume from the reservoir to the pipeline [m³/s]\n",
|
||||
"# initial_pipeline_pressure = p0 # Initial condition for the static pipeline pressure at the reservoir (= hydrostatic pressure - dynamic pressure) \n",
|
||||
"initial_pressure_unit = 'Pa' # DO NOT CHANGE! for pressure conversion in print statements and plot labels \n",
|
||||
"conversion_pressure_unit = 'bar' # for pressure conversion in print statements and plot labels\n",
|
||||
"area_base = 74. # total base are of the cuboid reservoir [m²] \n",
|
||||
@@ -97,27 +97,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 48,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# create objects\n",
|
||||
"\n",
|
||||
"V = Ausgleichsbecken_class(area_base,area_outflux,critical_level_low,critical_level_high,simulation_timestep)\n",
|
||||
"V.set_initial_level(initial_level) \n",
|
||||
"V.set_influx(initial_influx)\n",
|
||||
"V.set_outflux(initial_outflux)\n",
|
||||
"V.set_pressure(initial_pipeline_pressure,initial_pressure_unit,conversion_pressure_unit)\n",
|
||||
"V.set_steady_state(initial_influx,initial_level,initial_pressure_unit,conversion_pressure_unit)\n",
|
||||
"\n",
|
||||
"pipe = Druckrohrleitung_class(L,D,n,alpha,f_D)\n",
|
||||
"pipe.set_pressure_propagation_velocity(c)\n",
|
||||
"pipe.set_number_of_timesteps(nt)\n",
|
||||
"pipe.set_initial_pressure(p_init,initial_pressure_unit,conversion_pressure_unit)\n",
|
||||
"pipe.set_initial_flow_velocity(v_init)\n",
|
||||
"pipe.set_steady_state(initial_influx,V.level,pl_vec,h_vec,initial_pressure_unit,conversion_pressure_unit)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"T1 = Francis_Turbine(Q_nenn,p_nenn)\n",
|
||||
"T1.set_LA(1.)\n",
|
||||
"T1.set_steady_state(initial_influx,pipe.p0[-1])\n",
|
||||
"T1.set_closing_time(30)\n",
|
||||
"\n",
|
||||
"# display the attributes of the created reservoir and pipeline object\n",
|
||||
@@ -127,15 +123,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 49,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# initialization for timeloop\n",
|
||||
"\n",
|
||||
"# prepare the vectors in which the pressure and velocity distribution in the pipeline from the previous timestep are stored\n",
|
||||
"v_old = v_init.copy()\n",
|
||||
"p_old = p_init.copy()\n",
|
||||
"v_old = pipe.v0.copy()\n",
|
||||
"p_old = pipe.p0.copy()\n",
|
||||
"\n",
|
||||
"# prepare the vectors in which the temporal evolution of the boundary conditions are stored\n",
|
||||
" # keep in mind, that the velocity at the turbine and the pressure at the reservoir are set manually and\n",
|
||||
@@ -147,7 +143,7 @@
|
||||
"p_boundary_tur = np.empty_like(t_vec)\n",
|
||||
"\n",
|
||||
"# prepare the vectors that store the temporal evolution of the level in the reservoir\n",
|
||||
"level_vec = np.full(nt+1,initial_level) # level at the end of each pipeline timestep\n",
|
||||
"level_vec = np.full(nt+1,V.level) # level at the end of each pipeline timestep\n",
|
||||
"level_vec_2 = np.empty([nt_eRK4]) # level throughout each reservoir timestep-used for plotting and overwritten afterwards\n",
|
||||
"\n",
|
||||
"# set the boundary conditions for the first timestep\n",
|
||||
@@ -156,15 +152,15 @@
|
||||
"p_boundary_res[0] = p_old[0]\n",
|
||||
"p_boundary_tur[0] = p_old[-1]\n",
|
||||
"\n",
|
||||
"LA_soll_vec = np.zeros_like(t_vec)\n",
|
||||
"LA_soll_vec[0] = 1\n",
|
||||
"LA_soll_vec[1000:] = 1\n",
|
||||
"LA_soll_vec = np.full_like(t_vec,T1.LA)\n",
|
||||
"LA_soll_vec[1500:]= 0\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 50,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -197,7 +193,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 51,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -247,7 +243,7 @@
|
||||
" fig1.canvas.draw()\n",
|
||||
" fig1.tight_layout()\n",
|
||||
" fig1.show()\n",
|
||||
" plt.pause(0.00001) \n",
|
||||
" plt.pause(0.1) \n",
|
||||
"\n",
|
||||
" # prepare for next loop\n",
|
||||
" p_old = pipe.p_old\n",
|
||||
@@ -259,7 +255,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 52,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -294,7 +290,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
|
||||
"display_name": "Python 3.8.13 ('DT_Slot_3')",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -313,7 +309,7 @@
|
||||
"orig_nbformat": 4,
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
|
||||
"hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user