small change to the convergence and set steady state method

This commit is contained in:
Brantegger Georg
2022-08-09 13:53:09 +02:00
parent 7394d6c964
commit 43483dc959
2 changed files with 21 additions and 14 deletions

View File

@@ -78,6 +78,8 @@ class Francis_Turbine:
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):
@@ -113,22 +115,26 @@ class Francis_Turbine:
f"Nominal pressure = {round(p_n,3):<10} {self.pressure_unit_disp}{new_line}"
f"Nominal LA = {self.LA_n*100:<10} {self.LA_unit_disp} {new_line}"
f"Closing time = {self.t_c:<10} {self.time_unit_disp} {new_line}"
f"Current flux = {self.Q:<10} {self.flux_unit_disp} {new_line}"
f"Current flux = {round(self.Q,3):<10} {self.flux_unit_disp} {new_line}"
f"Current pipe pressure = {round(p,3):<10} {self.pressure_unit_disp} {new_line}"
f"Current LA = {self.LA*100:<10} {self.LA_unit_disp} {new_line}"
f"Current LA = {round(self.LA,4)*100:<10} {self.LA_unit_disp} {new_line}"
f"Simulation timestep = {self.dt:<10} {self.time_unit_disp} {new_line}"
f"----------------------------- {new_line}")
else:
# :<10 pads the self.value to be 10 characters wide
print_str = (f"The current attributes are: {new_line}"
f"----------------------------- {new_line}"
f"Current flux = {self.Q:<10} {self.flux_unit_disp} {new_line}"
f"Current flux = {round(self.Q,3):<10} {self.flux_unit_disp} {new_line}"
f"Current pipe pressure = {round(p,3):<10} {self.pressure_unit_disp} {new_line}"
f"Current LA = {self.LA*100:<10} {self.LA_unit_disp} {new_line}"
f"Current LA = {round(self.LA,4)*100:<10} {self.LA_unit_disp} {new_line}"
f"----------------------------- {new_line}")
print(print_str)
def get_Q_n(self):
# needed for Kraftwerk_class
return self.Q_n
# update methods
def update_LA(self,LA_soll):
# update the Leitappartöffnung and consider the restrictions of the closing time of the turbine
@@ -182,4 +188,4 @@ class Francis_Turbine:
print('did not converge')
break
# print(i)
self.Q = Q_new
# self.get_current_Q()

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -23,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -74,14 +74,14 @@
" # 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 = 100. # [s] target for total simulation time (will vary slightly to fit with Pip_dt)\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",
"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"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -149,12 +149,13 @@
"LA_soll_vec = np.full_like(t_vec,turbine.get_current_LA())\n",
"LA_ist_vec = np.full_like(t_vec,turbine.get_current_LA())\n",
"\n",
"LA_soll_vec2 = np.full_like(t_vec,turbine_in.get_current_LA())\n"
"LA_soll_vec2 = np.full_like(t_vec,turbine_in.get_current_LA())\n",
"# LA_soll_vec2[100:] = 0\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -187,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -267,7 +268,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [