From 3a22decfb481e5cb8147c937490885bf0cc221c6 Mon Sep 17 00:00:00 2001 From: Brantegger Georg Date: Thu, 9 Feb 2023 15:11:36 +0100 Subject: [PATCH] updated KW steady state test --- .../Druckrohrleitung_test_steady_state.ipynb | 2 +- Kraftwerk/Kraftwerk_test_steady_state.ipynb | 72 +++---------------- 2 files changed, 10 insertions(+), 64 deletions(-) diff --git a/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb b/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb index 15cecdb..65a78aa 100644 --- a/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb +++ b/Druckrohrleitung/Druckrohrleitung_test_steady_state.ipynb @@ -73,7 +73,7 @@ " # for general simulation\n", "flux_init = Tur_Q_nenn/1.1 # [m³/s] initial flux through whole system for steady state initialization \n", "level_init = Con_targetLevel # [m] initial water level in upstream reservoir for steady state initialization\n", - "simTime_target = 600. # [s] target for total simulation time (will vary slightly to fit with Pip_dt)\n", + "simTime_target = 1200. # [s] target for total simulation time (will vary slightly to fit with Pip_dt)\n", "nt = int(simTime_target//Pip_dt) # [1] Number of timesteps of the whole system\n", "t_vec = np.arange(0,nt+1,1)*Pip_dt # [s] time vector. At each step of t_vec the system parameters are stored\n" ] diff --git a/Kraftwerk/Kraftwerk_test_steady_state.ipynb b/Kraftwerk/Kraftwerk_test_steady_state.ipynb index 3f4bf1a..8ac8b90 100644 --- a/Kraftwerk/Kraftwerk_test_steady_state.ipynb +++ b/Kraftwerk/Kraftwerk_test_steady_state.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -95,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -136,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -208,40 +208,7 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%matplotlib qt5\n", - "# Con_T_ime loop\n", - "\n", - "# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\n", - "fig1,axs1 = plt.subplots(2,1)\n", - "fig1.suptitle(str(0) +' s / '+str(round(t_vec[-1],2)) + ' s' )\n", - "axs1[0].set_title('Pressure distribution in pipeline')\n", - "axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", - "axs1[0].set_ylabel(r'$p$ ['+pUnit_conv+']')\n", - "axs1[1].set_title('Flux distribution in pipeline')\n", - "axs1[1].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", - "axs1[1].set_ylabel(r'$Q$ [$\\mathrm{m}^3 / \\mathrm{s}$]')\n", - "lo_p, = axs1[0].plot(Pip_x_vec,pressure_conversion(p_old,pUnit_calc, pUnit_conv),marker='.')\n", - "lo_q, = axs1[1].plot(Pip_x_vec,Q_old,marker='.')\n", - "lo_pmin, = axs1[0].plot(Pip_x_vec,pipe.get_lowest_pressure_per_node(disp_flag=True),c='red')\n", - "lo_pmax, = axs1[0].plot(Pip_x_vec,pipe.get_highest_pressure_per_node(disp_flag=True),c='red')\n", - "lo_qmin, = axs1[1].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n", - "lo_qmax, = axs1[1].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n", - "\n", - "axs1[0].autoscale()\n", - "axs1[1].autoscale()\n", - "\n", - "fig1.tight_layout()\n", - "fig1.show()\n", - "plt.pause(1)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -296,37 +263,16 @@ " # prepare for next loop\n", " p_old = pipe.get_current_pressure_distribution()\n", " v_old = pipe.get_current_velocity_distribution()\n", - " Q_old = pipe.get_current_flux_distribution()\n", - "\n", - " # plot some stuff\n", - " # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n", - " if it_pipe%50 == 0:\n", - " lo_p.remove()\n", - " lo_pmin.remove()\n", - " lo_pmax.remove()\n", - " lo_q.remove()\n", - " lo_qmin.remove()\n", - " lo_qmax.remove()\n", - " # plot new pressure and velocity distribution in the pipeline\n", - " lo_p, = axs1[0].plot(Pip_x_vec,pipe.get_current_pressure_distribution(disp_flag=True),marker='.',c='blue')\n", - " lo_pmin, = axs1[0].plot(Pip_x_vec,pipe.get_lowest_pressure_per_node(disp_flag=True),c='red')\n", - " lo_pmax, = axs1[0].plot(Pip_x_vec,pipe.get_highest_pressure_per_node(disp_flag=True),c='red')\n", - " lo_q, = axs1[1].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n", - " lo_qmin, = axs1[1].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n", - " lo_qmax, = axs1[1].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n", - " fig1.suptitle(str(round(t_vec[it_pipe],2))+ ' s / '+str(round(t_vec[-1],2)) + ' s' )\n", - " fig1.canvas.draw()\n", - " fig1.tight_layout()\n", - " fig1.show()\n", - " plt.pause(0.000001) " + " Q_old = pipe.get_current_flux_distribution()\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ + "%matplotlib qt5\n", "fig2,axs2 = plt.subplots(1,1)\n", "axs2.set_title('Level and Volume reservoir')\n", "axs2.plot(t_vec,level_vec,label='level')\n", @@ -389,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [