From 1aee8debc47cf4011e1462ce8fe5315cf2594774 Mon Sep 17 00:00:00 2001 From: Brantegger Georg Date: Tue, 2 Aug 2022 11:31:26 +0200 Subject: [PATCH] for pictures --- .../Ausgleichsbecken_test_steady_state.ipynb | 24 +------- .../Druckrohrleitung_test_steady_state.ipynb | 55 +++++++++++++++---- Regler/Pegelregler_test.ipynb | 27 +++++---- Untertweng.ipynb | 50 ++++++++--------- Untertweng_mit_Pegelregler.ipynb | 24 ++++---- 5 files changed, 99 insertions(+), 81 deletions(-) diff --git a/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb b/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb index 5e144d4..21f7409 100644 --- a/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb +++ b/Ausgleichsbecken/Ausgleichsbecken_test_steady_state.ipynb @@ -146,31 +146,11 @@ "\n", "fig1.tight_layout() " ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "10.1" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "V.get_current_level()" - ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 ('DT_Slot_3')", + "display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "language": "python", "name": "python3" }, @@ -189,7 +169,7 @@ "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" + "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" } } }, diff --git a/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb b/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb index fd468bd..1ae1ddd 100644 --- a/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb +++ b/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb @@ -35,8 +35,8 @@ "L = 1000. # length of pipeline [m]\n", "D = 0.9 # pipe diameter [m]\n", "h_res = 10. # water level in upstream reservoir [m]\n", - "n = 50 # number of pipe segments in discretization\n", - "nt = 1000 # number of time steps after initial conditions\n", + "n = 50 # number of pipe segments in discretization\n", + "nt = 9000 # number of time steps after initial conditions\n", "f_D = 0.01 # Darcy friction factor\n", "c = 400. # propagation velocity of the pressure wave [m/s]\n", "h_pipe = 105. # hydraulic head without reservoir [m] \n", @@ -44,8 +44,8 @@ "\n", "\n", "# preparing the discretization and initial conditions\n", - "initial_flux = 0.8 # m³/s\n", - "initial_level = h_res # m\n", + "initial_flux = 0.8 # m³/s\n", + "initial_level = h_res # m\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", @@ -57,13 +57,13 @@ "# define constants reservoir\n", "conversion_pressure_unit = 'mWS'\n", "\n", - "area_base = 75. # m²\n", + "area_base = 75. # m²\n", "area_pipe = (D/2)**2*np.pi # m²\n", "critical_level_low = 0. # m\n", "critical_level_high = 100. # m\n", "\n", "# make sure e-RK4 method of reservoir has a small enough timestep to avoid runaway numerical error\n", - "nt_eRK4 = 1 # number of simulation steps of reservoir in between timesteps of pipeline \n", + "nt_eRK4 = 100 # number of simulation steps of reservoir in between timesteps of pipeline \n", "simulation_timestep = dt/nt_eRK4" ] }, @@ -164,9 +164,42 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[1;32my:\\KELAG\\KS\\KS-PW\\04 Digitalisierung\\KSPWDEV Server\\Digital Trainee Projekt\\DT_Slot_3_Project_Repo\\Druckrohrleitung\\Druckrohrleitung_test_steady_state.ipynb Cell 7\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 35\u001b[0m lo_01, \u001b[39m=\u001b[39m axs1[\u001b[39m1\u001b[39m]\u001b[39m.\u001b[39mplot(pl_vec,v_old,marker\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39m.\u001b[39m\u001b[39m'\u001b[39m,c\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mblue\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m 37\u001b[0m fig1\u001b[39m.\u001b[39msuptitle(\u001b[39mstr\u001b[39m(\u001b[39mround\u001b[39m(t_vec[it_pipe],\u001b[39m2\u001b[39m)) \u001b[39m+\u001b[39m \u001b[39m'\u001b[39m\u001b[39m/\u001b[39m\u001b[39m'\u001b[39m \u001b[39m+\u001b[39m \u001b[39mstr\u001b[39m(\u001b[39mround\u001b[39m(t_vec[\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m],\u001b[39m2\u001b[39m)))\n\u001b[1;32m---> 38\u001b[0m fig1\u001b[39m.\u001b[39;49mcanvas\u001b[39m.\u001b[39;49mdraw()\n\u001b[0;32m 39\u001b[0m fig1\u001b[39m.\u001b[39mtight_layout()\n\u001b[0;32m 40\u001b[0m plt\u001b[39m.\u001b[39mpause(\u001b[39m0.000001\u001b[39m)\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\backends\\backend_agg.py:436\u001b[0m, in \u001b[0;36mFigureCanvasAgg.draw\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 432\u001b[0m \u001b[39m# Acquire a lock on the shared font cache.\u001b[39;00m\n\u001b[0;32m 433\u001b[0m \u001b[39mwith\u001b[39;00m RendererAgg\u001b[39m.\u001b[39mlock, \\\n\u001b[0;32m 434\u001b[0m (\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtoolbar\u001b[39m.\u001b[39m_wait_cursor_for_draw_cm() \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtoolbar\n\u001b[0;32m 435\u001b[0m \u001b[39melse\u001b[39;00m nullcontext()):\n\u001b[1;32m--> 436\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mfigure\u001b[39m.\u001b[39;49mdraw(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mrenderer)\n\u001b[0;32m 437\u001b[0m \u001b[39m# A GUI class may be need to update a window using this draw, so\u001b[39;00m\n\u001b[0;32m 438\u001b[0m \u001b[39m# don't forget to call the superclass.\u001b[39;00m\n\u001b[0;32m 439\u001b[0m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39mdraw()\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\artist.py:73\u001b[0m, in \u001b[0;36m_finalize_rasterization..draw_wrapper\u001b[1;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[39m@wraps\u001b[39m(draw)\n\u001b[0;32m 72\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mdraw_wrapper\u001b[39m(artist, renderer, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs):\n\u001b[1;32m---> 73\u001b[0m result \u001b[39m=\u001b[39m draw(artist, renderer, \u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n\u001b[0;32m 74\u001b[0m \u001b[39mif\u001b[39;00m renderer\u001b[39m.\u001b[39m_rasterizing:\n\u001b[0;32m 75\u001b[0m renderer\u001b[39m.\u001b[39mstop_rasterizing()\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\artist.py:50\u001b[0m, in \u001b[0;36mallow_rasterization..draw_wrapper\u001b[1;34m(artist, renderer)\u001b[0m\n\u001b[0;32m 47\u001b[0m \u001b[39mif\u001b[39;00m artist\u001b[39m.\u001b[39mget_agg_filter() \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 48\u001b[0m renderer\u001b[39m.\u001b[39mstart_filter()\n\u001b[1;32m---> 50\u001b[0m \u001b[39mreturn\u001b[39;00m draw(artist, renderer)\n\u001b[0;32m 51\u001b[0m \u001b[39mfinally\u001b[39;00m:\n\u001b[0;32m 52\u001b[0m \u001b[39mif\u001b[39;00m artist\u001b[39m.\u001b[39mget_agg_filter() \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\figure.py:2810\u001b[0m, in \u001b[0;36mFigure.draw\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 2807\u001b[0m \u001b[39m# ValueError can occur when resizing a window.\u001b[39;00m\n\u001b[0;32m 2809\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpatch\u001b[39m.\u001b[39mdraw(renderer)\n\u001b[1;32m-> 2810\u001b[0m mimage\u001b[39m.\u001b[39;49m_draw_list_compositing_images(\n\u001b[0;32m 2811\u001b[0m renderer, \u001b[39mself\u001b[39;49m, artists, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49msuppressComposite)\n\u001b[0;32m 2813\u001b[0m \u001b[39mfor\u001b[39;00m sfig \u001b[39min\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39msubfigs:\n\u001b[0;32m 2814\u001b[0m sfig\u001b[39m.\u001b[39mdraw(renderer)\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\image.py:132\u001b[0m, in \u001b[0;36m_draw_list_compositing_images\u001b[1;34m(renderer, parent, artists, suppress_composite)\u001b[0m\n\u001b[0;32m 130\u001b[0m \u001b[39mif\u001b[39;00m not_composite \u001b[39mor\u001b[39;00m \u001b[39mnot\u001b[39;00m has_images:\n\u001b[0;32m 131\u001b[0m \u001b[39mfor\u001b[39;00m a \u001b[39min\u001b[39;00m artists:\n\u001b[1;32m--> 132\u001b[0m a\u001b[39m.\u001b[39;49mdraw(renderer)\n\u001b[0;32m 133\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 134\u001b[0m \u001b[39m# Composite any adjacent images together\u001b[39;00m\n\u001b[0;32m 135\u001b[0m image_group \u001b[39m=\u001b[39m []\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\artist.py:50\u001b[0m, in \u001b[0;36mallow_rasterization..draw_wrapper\u001b[1;34m(artist, renderer)\u001b[0m\n\u001b[0;32m 47\u001b[0m \u001b[39mif\u001b[39;00m artist\u001b[39m.\u001b[39mget_agg_filter() \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 48\u001b[0m renderer\u001b[39m.\u001b[39mstart_filter()\n\u001b[1;32m---> 50\u001b[0m \u001b[39mreturn\u001b[39;00m draw(artist, renderer)\n\u001b[0;32m 51\u001b[0m \u001b[39mfinally\u001b[39;00m:\n\u001b[0;32m 52\u001b[0m \u001b[39mif\u001b[39;00m artist\u001b[39m.\u001b[39mget_agg_filter() \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axes\\_base.py:3082\u001b[0m, in \u001b[0;36m_AxesBase.draw\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 3079\u001b[0m a\u001b[39m.\u001b[39mdraw(renderer)\n\u001b[0;32m 3080\u001b[0m renderer\u001b[39m.\u001b[39mstop_rasterizing()\n\u001b[1;32m-> 3082\u001b[0m mimage\u001b[39m.\u001b[39;49m_draw_list_compositing_images(\n\u001b[0;32m 3083\u001b[0m renderer, \u001b[39mself\u001b[39;49m, artists, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mfigure\u001b[39m.\u001b[39;49msuppressComposite)\n\u001b[0;32m 3085\u001b[0m renderer\u001b[39m.\u001b[39mclose_group(\u001b[39m'\u001b[39m\u001b[39maxes\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m 3086\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mstale \u001b[39m=\u001b[39m \u001b[39mFalse\u001b[39;00m\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\image.py:132\u001b[0m, in \u001b[0;36m_draw_list_compositing_images\u001b[1;34m(renderer, parent, artists, suppress_composite)\u001b[0m\n\u001b[0;32m 130\u001b[0m \u001b[39mif\u001b[39;00m not_composite \u001b[39mor\u001b[39;00m \u001b[39mnot\u001b[39;00m has_images:\n\u001b[0;32m 131\u001b[0m \u001b[39mfor\u001b[39;00m a \u001b[39min\u001b[39;00m artists:\n\u001b[1;32m--> 132\u001b[0m a\u001b[39m.\u001b[39;49mdraw(renderer)\n\u001b[0;32m 133\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 134\u001b[0m \u001b[39m# Composite any adjacent images together\u001b[39;00m\n\u001b[0;32m 135\u001b[0m image_group \u001b[39m=\u001b[39m []\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\artist.py:50\u001b[0m, in \u001b[0;36mallow_rasterization..draw_wrapper\u001b[1;34m(artist, renderer)\u001b[0m\n\u001b[0;32m 47\u001b[0m \u001b[39mif\u001b[39;00m artist\u001b[39m.\u001b[39mget_agg_filter() \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 48\u001b[0m renderer\u001b[39m.\u001b[39mstart_filter()\n\u001b[1;32m---> 50\u001b[0m \u001b[39mreturn\u001b[39;00m draw(artist, renderer)\n\u001b[0;32m 51\u001b[0m \u001b[39mfinally\u001b[39;00m:\n\u001b[0;32m 52\u001b[0m \u001b[39mif\u001b[39;00m artist\u001b[39m.\u001b[39mget_agg_filter() \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axis.py:1170\u001b[0m, in \u001b[0;36mAxis.draw\u001b[1;34m(self, renderer, *args, **kwargs)\u001b[0m\n\u001b[0;32m 1163\u001b[0m tick\u001b[39m.\u001b[39mdraw(renderer)\n\u001b[0;32m 1165\u001b[0m \u001b[39m# scale up the axis label box to also find the neighbors, not\u001b[39;00m\n\u001b[0;32m 1166\u001b[0m \u001b[39m# just the tick labels that actually overlap note we need a\u001b[39;00m\n\u001b[0;32m 1167\u001b[0m \u001b[39m# *copy* of the axis label box because we don't want to scale\u001b[39;00m\n\u001b[0;32m 1168\u001b[0m \u001b[39m# the actual bbox\u001b[39;00m\n\u001b[1;32m-> 1170\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_update_label_position(renderer)\n\u001b[0;32m 1172\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mlabel\u001b[39m.\u001b[39mdraw(renderer)\n\u001b[0;32m 1174\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axis.py:2352\u001b[0m, in \u001b[0;36mYAxis._update_label_position\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 2348\u001b[0m \u001b[39mreturn\u001b[39;00m\n\u001b[0;32m 2350\u001b[0m \u001b[39m# get bounding boxes for this axis and any siblings\u001b[39;00m\n\u001b[0;32m 2351\u001b[0m \u001b[39m# that have been set by `fig.align_ylabels()`\u001b[39;00m\n\u001b[1;32m-> 2352\u001b[0m bboxes, bboxes2 \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_get_tick_boxes_siblings(renderer\u001b[39m=\u001b[39;49mrenderer)\n\u001b[0;32m 2354\u001b[0m x, y \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mlabel\u001b[39m.\u001b[39mget_position()\n\u001b[0;32m 2355\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mlabel_position \u001b[39m==\u001b[39m \u001b[39m'\u001b[39m\u001b[39mleft\u001b[39m\u001b[39m'\u001b[39m:\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axis.py:1880\u001b[0m, in \u001b[0;36mAxis._get_tick_boxes_siblings\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 1878\u001b[0m \u001b[39mfor\u001b[39;00m ax \u001b[39min\u001b[39;00m grouper\u001b[39m.\u001b[39mget_siblings(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39maxes):\n\u001b[0;32m 1879\u001b[0m axis \u001b[39m=\u001b[39m \u001b[39mgetattr\u001b[39m(ax, \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00maxis_name\u001b[39m}\u001b[39;00m\u001b[39maxis\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m-> 1880\u001b[0m ticks_to_draw \u001b[39m=\u001b[39m axis\u001b[39m.\u001b[39;49m_update_ticks()\n\u001b[0;32m 1881\u001b[0m tlb, tlb2 \u001b[39m=\u001b[39m axis\u001b[39m.\u001b[39m_get_tick_bboxes(ticks_to_draw, renderer)\n\u001b[0;32m 1882\u001b[0m bboxes\u001b[39m.\u001b[39mextend(tlb)\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axis.py:1053\u001b[0m, in \u001b[0;36mAxis._update_ticks\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1051\u001b[0m tick\u001b[39m.\u001b[39mset_label1(label)\n\u001b[0;32m 1052\u001b[0m tick\u001b[39m.\u001b[39mset_label2(label)\n\u001b[1;32m-> 1053\u001b[0m minor_locs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mget_minorticklocs()\n\u001b[0;32m 1054\u001b[0m minor_labels \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mminor\u001b[39m.\u001b[39mformatter\u001b[39m.\u001b[39mformat_ticks(minor_locs)\n\u001b[0;32m 1055\u001b[0m minor_ticks \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mget_minor_ticks(\u001b[39mlen\u001b[39m(minor_locs))\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axis.py:1282\u001b[0m, in \u001b[0;36mAxis.get_minorticklocs\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1280\u001b[0m \u001b[39m\"\"\"Return this Axis' minor tick locations in data coordinates.\"\"\"\u001b[39;00m\n\u001b[0;32m 1281\u001b[0m \u001b[39m# Remove minor ticks duplicating major ticks.\u001b[39;00m\n\u001b[1;32m-> 1282\u001b[0m major_locs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mmajor\u001b[39m.\u001b[39;49mlocator()\n\u001b[0;32m 1283\u001b[0m minor_locs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mminor\u001b[39m.\u001b[39mlocator()\n\u001b[0;32m 1284\u001b[0m transform \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_scale\u001b[39m.\u001b[39mget_transform()\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\ticker.py:2114\u001b[0m, in \u001b[0;36mMaxNLocator.__call__\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 2112\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__call__\u001b[39m(\u001b[39mself\u001b[39m):\n\u001b[0;32m 2113\u001b[0m vmin, vmax \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39maxis\u001b[39m.\u001b[39mget_view_interval()\n\u001b[1;32m-> 2114\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mtick_values(vmin, vmax)\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\ticker.py:2122\u001b[0m, in \u001b[0;36mMaxNLocator.tick_values\u001b[1;34m(self, vmin, vmax)\u001b[0m\n\u001b[0;32m 2119\u001b[0m vmin \u001b[39m=\u001b[39m \u001b[39m-\u001b[39mvmax\n\u001b[0;32m 2120\u001b[0m vmin, vmax \u001b[39m=\u001b[39m mtransforms\u001b[39m.\u001b[39mnonsingular(\n\u001b[0;32m 2121\u001b[0m vmin, vmax, expander\u001b[39m=\u001b[39m\u001b[39m1e-13\u001b[39m, tiny\u001b[39m=\u001b[39m\u001b[39m1e-14\u001b[39m)\n\u001b[1;32m-> 2122\u001b[0m locs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_raw_ticks(vmin, vmax)\n\u001b[0;32m 2124\u001b[0m prune \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_prune\n\u001b[0;32m 2125\u001b[0m \u001b[39mif\u001b[39;00m prune \u001b[39m==\u001b[39m \u001b[39m'\u001b[39m\u001b[39mlower\u001b[39m\u001b[39m'\u001b[39m:\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\ticker.py:2061\u001b[0m, in \u001b[0;36mMaxNLocator._raw_ticks\u001b[1;34m(self, vmin, vmax)\u001b[0m\n\u001b[0;32m 2059\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_nbins \u001b[39m==\u001b[39m \u001b[39m'\u001b[39m\u001b[39mauto\u001b[39m\u001b[39m'\u001b[39m:\n\u001b[0;32m 2060\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39maxis \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m-> 2061\u001b[0m nbins \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39mclip(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49maxis\u001b[39m.\u001b[39;49mget_tick_space(),\n\u001b[0;32m 2062\u001b[0m \u001b[39mmax\u001b[39m(\u001b[39m1\u001b[39m, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_min_n_ticks \u001b[39m-\u001b[39m \u001b[39m1\u001b[39m), \u001b[39m9\u001b[39m)\n\u001b[0;32m 2063\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 2064\u001b[0m nbins \u001b[39m=\u001b[39m \u001b[39m9\u001b[39m\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\axis.py:2524\u001b[0m, in \u001b[0;36mYAxis.get_tick_space\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 2523\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mget_tick_space\u001b[39m(\u001b[39mself\u001b[39m):\n\u001b[1;32m-> 2524\u001b[0m ends \u001b[39m=\u001b[39m mtransforms\u001b[39m.\u001b[39;49mBbox\u001b[39m.\u001b[39;49mfrom_bounds(\u001b[39m0\u001b[39;49m, \u001b[39m0\u001b[39;49m, \u001b[39m1\u001b[39;49m, \u001b[39m1\u001b[39;49m)\n\u001b[0;32m 2525\u001b[0m ends \u001b[39m=\u001b[39m ends\u001b[39m.\u001b[39mtransformed(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39maxes\u001b[39m.\u001b[39mtransAxes \u001b[39m-\u001b[39m\n\u001b[0;32m 2526\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mfigure\u001b[39m.\u001b[39mdpi_scale_trans)\n\u001b[0;32m 2527\u001b[0m length \u001b[39m=\u001b[39m ends\u001b[39m.\u001b[39mheight \u001b[39m*\u001b[39m \u001b[39m72\u001b[39m\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\transforms.py:820\u001b[0m, in \u001b[0;36mBbox.from_bounds\u001b[1;34m(x0, y0, width, height)\u001b[0m\n\u001b[0;32m 813\u001b[0m \u001b[39m@staticmethod\u001b[39m\n\u001b[0;32m 814\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mfrom_bounds\u001b[39m(x0, y0, width, height):\n\u001b[0;32m 815\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 816\u001b[0m \u001b[39m Create a new `Bbox` from *x0*, *y0*, *width* and *height*.\u001b[39;00m\n\u001b[0;32m 817\u001b[0m \n\u001b[0;32m 818\u001b[0m \u001b[39m *width* and *height* may be negative.\u001b[39;00m\n\u001b[0;32m 819\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 820\u001b[0m \u001b[39mreturn\u001b[39;00m Bbox\u001b[39m.\u001b[39;49mfrom_extents(x0, y0, x0 \u001b[39m+\u001b[39;49m width, y0 \u001b[39m+\u001b[39;49m height)\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\transforms.py:839\u001b[0m, in \u001b[0;36mBbox.from_extents\u001b[1;34m(minpos, *args)\u001b[0m\n\u001b[0;32m 822\u001b[0m \u001b[39m@staticmethod\u001b[39m\n\u001b[0;32m 823\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mfrom_extents\u001b[39m(\u001b[39m*\u001b[39margs, minpos\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m):\n\u001b[0;32m 824\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 825\u001b[0m \u001b[39m Create a new Bbox from *left*, *bottom*, *right* and *top*.\u001b[39;00m\n\u001b[0;32m 826\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 837\u001b[0m \u001b[39m scales where negative bounds result in floating point errors.\u001b[39;00m\n\u001b[0;32m 838\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 839\u001b[0m bbox \u001b[39m=\u001b[39m Bbox(np\u001b[39m.\u001b[39;49mreshape(args, (\u001b[39m2\u001b[39;49m, \u001b[39m2\u001b[39;49m)))\n\u001b[0;32m 840\u001b[0m \u001b[39mif\u001b[39;00m minpos \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 841\u001b[0m bbox\u001b[39m.\u001b[39m_minpos[:] \u001b[39m=\u001b[39m minpos\n", + "File \u001b[1;32mc:\\ProgramData\\Anaconda3\\envs\\Georg_DT_Slot3\\lib\\site-packages\\matplotlib\\transforms.py:775\u001b[0m, in \u001b[0;36mBbox.__init__\u001b[1;34m(self, points, **kwargs)\u001b[0m\n\u001b[0;32m 768\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 769\u001b[0m \u001b[39mParameters\u001b[39;00m\n\u001b[0;32m 770\u001b[0m \u001b[39m----------\u001b[39;00m\n\u001b[0;32m 771\u001b[0m \u001b[39mpoints : ndarray\u001b[39;00m\n\u001b[0;32m 772\u001b[0m \u001b[39m A 2x2 numpy array of the form ``[[x0, y0], [x1, y1]]``.\u001b[39;00m\n\u001b[0;32m 773\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[0;32m 774\u001b[0m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39m\u001b[39m__init__\u001b[39m(\u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m--> 775\u001b[0m points \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39;49masarray(points, \u001b[39mfloat\u001b[39;49m)\n\u001b[0;32m 776\u001b[0m \u001b[39mif\u001b[39;00m points\u001b[39m.\u001b[39mshape \u001b[39m!=\u001b[39m (\u001b[39m2\u001b[39m, \u001b[39m2\u001b[39m):\n\u001b[0;32m 777\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39m'\u001b[39m\u001b[39mBbox points must be of the form \u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m 778\u001b[0m \u001b[39m'\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m[[x0, y0], [x1, y1]]\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m.\u001b[39m\u001b[39m'\u001b[39m)\n", + "\u001b[1;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], "source": [ "\n", "for it_pipe in range(1,nt):\n", @@ -214,7 +247,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -250,7 +283,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 ('DT_Slot_3')", + "display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "language": "python", "name": "python3" }, @@ -269,7 +302,7 @@ "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" + "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" } } }, diff --git a/Regler/Pegelregler_test.ipynb b/Regler/Pegelregler_test.ipynb index 081cd94..057a1dd 100644 --- a/Regler/Pegelregler_test.ipynb +++ b/Regler/Pegelregler_test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -23,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +41,7 @@ "# define controller constants\n", "target_level = 8. # m\n", "Kp = 0.01\n", - "Ti = 3600.\n", + "Ti = 200.\n", "deadband_range = 0.05 # m\n", "\n", "# reservoir\n", @@ -70,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -87,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -101,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -219,8 +219,13 @@ " if np.mod(i,1e4) == 0:\n", " print(t_vec[i])\n", "\n", - " if i == 0.4*(nt+1):\n", + " if i == 0.2*(nt+1):\n", " V.set_influx(0.)\n", + " elif i == 0.5*(nt+1):\n", + " V.set_influx(0.5*Q_nenn)\n", + " elif i == 0.8*(nt+1):\n", + " V.set_influx(Q_nenn)\n", + "\n", "\n", " p = V.get_current_pressure()\n", " Pegelregler.update_control_variable(V.level)\n", @@ -243,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -274,16 +279,16 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[]" + "[]" ] }, - "execution_count": 7, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } diff --git a/Untertweng.ipynb b/Untertweng.ipynb index bbd030a..b3199fa 100644 --- a/Untertweng.ipynb +++ b/Untertweng.ipynb @@ -40,9 +40,9 @@ "alpha = np.arcsin(h_pipe/L) # Höhenwinkel der Druckrohrleitung \n", "n = 50 # number of pipe segments in discretization # 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", + "c = 400. # 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 = 2500 # number of time steps after initial conditions\n", + "nt = 9000 # number of time steps after initial conditions\n", "\n", "# derivatives of the pipeline constants\n", "dx = L/n # length of each pipe segment\n", @@ -126,7 +126,7 @@ "p_boundary_tur[0] = p_old[-1]\n", "\n", "LA_soll_vec = np.full_like(t_vec,T1.LA)\n", - "LA_soll_vec[500:]= 0\n", + "# LA_soll_vec[500:]= 0\n", "LA_ist_vec = np.full_like(t_vec,T1.LA)\n", "\n", "\n" @@ -169,8 +169,8 @@ "# loop through time steps of the pipeline\n", "for it_pipe in range(1,pipe.nt+1):\n", "\n", - " if it_pipe == 250:\n", - " V.set_influx(0.)\n", + " # if it_pipe == 250:\n", + " # V.set_influx(0.)\n", "\n", "# for each pipeline timestep, execute nt_eRK4 timesteps of the reservoir code\n", " # set initial conditions for the reservoir time evolution calculted with e-RK4\n", @@ -185,7 +185,7 @@ " T1.update_LA(LA_soll_vec[it_pipe])\n", " T1.set_pressure(p_old[-1])\n", "\n", - " LA_ist_vec[it_pipe] = T1.LA\n", + " LA_ist_vec[it_pipe] = T1.get_current_LA()\n", "\n", " # set boundary conditions for the next timestep of the characteristic method\n", " p_boundary_res[it_pipe] = V.get_current_pressure()\n", @@ -231,7 +231,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "0.0\n" + "0.7727272727272726\n" ] } ], @@ -296,28 +296,28 @@ "----------------------------- \n", "Base area = 74.0 m² \n", "Outflux area = 0.636 m² \n", - "Current level = 7.875725956447418 m\n", + "Current level = 8.020201323491174 m\n", "Critical level low = 0.0 m \n", "Critical level high = inf m \n", "Volume in reservoir = -- m³ \n", - "Current influx = 0.0 m³/s \n", - "Current outflux = -0.1415386124341686 m³/s \n", - "Current outflux vel = -0.222 m/s \n", - "Current pipe pressure = 0.772 bar \n", - "Simulation timestep = 0.0004052 s \n", + "Current influx = 0.7727272727272726 m³/s \n", + "Current outflux = -3.529572535198196 m³/s \n", + "Current outflux vel = -5.548 m/s \n", + "Current pipe pressure = 0.479 bar \n", + "Simulation timestep = 0.0005065 s \n", "Density of liquid = 1000 kg/m³ \n", "----------------------------- \n", "\n", - "9.22707730779877\n", - "10.57842865915012\n", - "11.92978001050147\n", - "13.281131361852822\n", - "14.632482713204173\n", - "15.983834064555523\n", - "17.335185415906874\n", - "18.686536767258225\n", - "20.037888118609576\n", - "21.389239469960927\n" + "9.47597527926513\n", + "10.931749235039087\n", + "12.387523190813043\n", + "13.843297146587\n", + "15.299071102360957\n", + "16.75484505813491\n", + "18.210619013908868\n", + "19.666392969682825\n", + "21.12216692545678\n", + "22.577940881230738\n" ] } ], @@ -332,7 +332,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 ('DT_Slot_3')", + "display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "language": "python", "name": "python3" }, @@ -351,7 +351,7 @@ "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" + "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" } } }, diff --git a/Untertweng_mit_Pegelregler.ipynb b/Untertweng_mit_Pegelregler.ipynb index 3d20588..3c81bc4 100644 --- a/Untertweng_mit_Pegelregler.ipynb +++ b/Untertweng_mit_Pegelregler.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -48,10 +48,10 @@ "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", - "f_D = 0.014 # Darcy friction factor\n", - "c = 500. # propagation velocity of the pressure wave [m/s]\n", + "f_D = 0.014 # Darcy friction factor\n", + "c = 400. # 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 = 4500 # number of time steps after initial conditions\n", + "nt = 12000 # number of time steps after initial conditions\n", "\n", "# derivatives of the pipeline constants\n", "dx = L/n # length of each pipe segment\n", @@ -83,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -112,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -152,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -180,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -247,7 +247,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -292,7 +292,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 ('DT_Slot_3')", + "display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "language": "python", "name": "python3" }, @@ -311,7 +311,7 @@ "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48" + "hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" } } },