diff --git a/KW Hammer.ipynb b/KW Hammer.ipynb index e125a32..47cf47a 100644 --- a/KW Hammer.ipynb +++ b/KW Hammer.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 41, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -83,7 +83,8 @@ "Res_dt = Pip_dt/Res_nt # [s] harmonised timestep of reservoir time evolution\n", "\n", " # for general simulation\n", - "flux_init = (OL_T1_Q_nenn+OL_T2_Q_nenn) # [m³/s] initial flux through whole system for steady state initialization \n", + "# flux_init = (OL_T1_Q_nenn+OL_T2_Q_nenn) # [m³/s] initial flux through whole system for steady state initialization \n", + "OL_LAs_init = [1.,0.3] # [vec] initial guide vane openings of OL-KW\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", "nt = int(simTime_target//Pip_dt) # [1] Number of timesteps of the whole system\n", @@ -92,20 +93,12 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "# create objects\n", "\n", - "# Upstream reservoir\n", - "reservoir = Ausgleichsbecken_class(Res_area_base,Res_area_out,Res_dt,pUnit_conv,Res_level_crit_lo,Res_level_crit_hi,rho)\n", - "reservoir.set_steady_state(flux_init,level_init)\n", - "\n", - "# pipeline\n", - "pipe = Druckrohrleitung_class(Pip_length,Pip_dia,Pip_head,Pip_n_seg,Pip_f_D,Pip_pw_vel,Pip_dt,pUnit_conv,rho)\n", - "pipe.set_steady_state(flux_init,reservoir.get_current_pressure())\n", - "\n", "# influx setting turbines\n", "OL_T1 = Francis_Turbine(OL_T1_Q_nenn,OL_T1_p_nenn,OL_T1_closingTime,Pip_dt,pUnit_conv)\n", "OL_T2 = Francis_Turbine(OL_T2_Q_nenn,OL_T2_p_nenn,OL_T2_closingTime,Pip_dt,pUnit_conv)\n", @@ -114,7 +107,17 @@ "KW_OL.add_turbine(OL_T1)\n", "KW_OL.add_turbine(OL_T2)\n", "\n", - "KW_OL.set_steady_state(flux_init,OL_T1_p_nenn)\n", + "KW_OL.set_steady_state_by_LA(OL_LAs_init,OL_T1_p_nenn)\n", + "\n", + "flux_init = KW_OL.get_current_Q()\n", + "\n", + "# Upstream reservoir\n", + "reservoir = Ausgleichsbecken_class(Res_area_base,Res_area_out,Res_dt,pUnit_conv,Res_level_crit_lo,Res_level_crit_hi,rho)\n", + "reservoir.set_steady_state(flux_init,level_init)\n", + "\n", + "# pipeline\n", + "pipe = Druckrohrleitung_class(Pip_length,Pip_dia,Pip_head,Pip_n_seg,Pip_f_D,Pip_pw_vel,Pip_dt,pUnit_conv,rho)\n", + "pipe.set_steady_state(flux_init,reservoir.get_current_pressure())\n", "\n", "# downstream turbines\n", "UL_T1 = Francis_Turbine(UL_T1_Q_nenn,UL_T1_p_nenn,UL_T1_closingTime,Pip_dt,pUnit_conv)\n", @@ -124,12 +127,12 @@ "KW_UL.add_turbine(UL_T1)\n", "KW_UL.add_turbine(UL_T2)\n", "\n", - "KW_UL.set_steady_state(flux_init,pipe.get_current_pressure_distribution()[-1])\n" + "KW_UL.set_steady_state_by_flux(flux_init,pipe.get_current_pressure_distribution()[-1])\n" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -186,7 +189,7 @@ "\n", "# UL KW\n", "UL_T1_LA_soll_vec = np.full_like(t_vec,UL_T1.get_current_LA()) # storing the target value of the guide vane opening\n", - "UL_T1_LA_soll_vec[np.argmin(np.abs(t_vec-105)):] -= 0.1\n", + "UL_T1_LA_soll_vec[np.argmin(np.abs(t_vec-105)):] -= 0.25\n", "\n", "UL_T2_LA_soll_vec = np.full_like(t_vec,UL_T2.get_current_LA()) # storing the target value of the guide vane opening\n", "UL_T2_LA_soll_vec[np.argmin(np.abs(t_vec-105)):] = 0.\n", @@ -200,7 +203,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -222,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -264,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -350,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 31, "metadata": {}, "outputs": [], "source": [ @@ -416,7 +419,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -464,7 +467,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 33, "metadata": {}, "outputs": [ { diff --git a/Kraftwerk/Kraftwerk_class_file.py b/Kraftwerk/Kraftwerk_class_file.py index dfd5b7d..aa1ad86 100644 --- a/Kraftwerk/Kraftwerk_class_file.py +++ b/Kraftwerk/Kraftwerk_class_file.py @@ -24,10 +24,14 @@ class Kraftwerk_class: for i in range(self.n_turbines): self.turbines[i].set_pressure(pressure) - def set_steady_state(self,ss_flux,ss_pressure): + def set_steady_state_by_flux(self,ss_flux,ss_pressure): self.identify_Q_proportion() for i in range(self.n_turbines): - self.turbines[i].set_steady_state(ss_flux*self.Q_prop[i],ss_pressure) + self.turbines[i].set_steady_state_by_flux(ss_flux*self.Q_prop[i],ss_pressure) + + def set_steady_state_by_LA(self,LA_vec,ss_pressure): + for i in range(self.n_turbines): + self.turbines[i].set_steady_state_by_LA(LA_vec[i],ss_pressure) # getter def get_current_Q(self): diff --git a/Turbinen/Turbinen_class_file.py b/Turbinen/Turbinen_class_file.py index 3156722..de4db09 100644 --- a/Turbinen/Turbinen_class_file.py +++ b/Turbinen/Turbinen_class_file.py @@ -71,7 +71,7 @@ class Francis_Turbine: # set pressure in front of the turbine self.p = pressure - def set_steady_state(self,ss_flux,ss_pressure): + def set_steady_state_by_flux(self,ss_flux,ss_pressure): # calculate and set steady state LA, that allows the flow of ss_flux at ss_pressure through the # turbine at the steady state LA ss_LA = self.LA_n*ss_flux/self.Q_n*np.sqrt(self.p_n/ss_pressure) @@ -81,6 +81,14 @@ class Francis_Turbine: self.set_pressure(ss_pressure) self.get_current_Q() + def set_steady_state_by_LA(self,ss_LA,ss_pressure): + # set the turbine to a steady state defined by the pressure and the guide vane opening (LeitApparatöffnung) + if ss_LA < 0 or ss_LA > 1: + raise Exception('LA out of range [0;1]') + self.set_LA(ss_LA,display_warning=False) + self.set_pressure(ss_pressure) + self.get_current_Q() + #getter - get attributes def get_current_Q(self): # return the flux through the turbine, based on the current pressure in front @@ -193,4 +201,3 @@ class Francis_Turbine: if i == 1e6: print('did not converge') break - # print(i) \ No newline at end of file