small change to the convergence and set steady state method
This commit is contained in:
@@ -78,6 +78,8 @@ class Francis_Turbine:
|
|||||||
if ss_LA < 0 or ss_LA > 1:
|
if ss_LA < 0 or ss_LA > 1:
|
||||||
raise Exception('LA out of range [0;1]')
|
raise Exception('LA out of range [0;1]')
|
||||||
self.set_LA(ss_LA,display_warning=False)
|
self.set_LA(ss_LA,display_warning=False)
|
||||||
|
self.set_pressure(ss_pressure)
|
||||||
|
self.get_current_Q()
|
||||||
|
|
||||||
#getter - get attributes
|
#getter - get attributes
|
||||||
def get_current_Q(self):
|
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 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"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"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 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"Simulation timestep = {self.dt:<10} {self.time_unit_disp} {new_line}"
|
||||||
f"----------------------------- {new_line}")
|
f"----------------------------- {new_line}")
|
||||||
else:
|
else:
|
||||||
# :<10 pads the self.value to be 10 characters wide
|
# :<10 pads the self.value to be 10 characters wide
|
||||||
print_str = (f"The current attributes are: {new_line}"
|
print_str = (f"The current attributes are: {new_line}"
|
||||||
f"----------------------------- {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 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}")
|
f"----------------------------- {new_line}")
|
||||||
|
|
||||||
print(print_str)
|
print(print_str)
|
||||||
|
|
||||||
|
def get_Q_n(self):
|
||||||
|
# needed for Kraftwerk_class
|
||||||
|
return self.Q_n
|
||||||
|
|
||||||
# update methods
|
# update methods
|
||||||
def update_LA(self,LA_soll):
|
def update_LA(self,LA_soll):
|
||||||
# update the Leitappartöffnung and consider the restrictions of the closing time of the turbine
|
# 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')
|
print('did not converge')
|
||||||
break
|
break
|
||||||
# print(i)
|
# print(i)
|
||||||
self.Q = Q_new
|
# self.get_current_Q()
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 2,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -74,14 +74,14 @@
|
|||||||
" # for general simulation\n",
|
" # for general simulation\n",
|
||||||
"flux_init = Tur_Q_nenn/1.1 # [m³/s] initial flux through whole system for steady state initialization \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",
|
"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",
|
"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"
|
"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",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 4,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -149,12 +149,13 @@
|
|||||||
"LA_soll_vec = np.full_like(t_vec,turbine.get_current_LA())\n",
|
"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",
|
"LA_ist_vec = np.full_like(t_vec,turbine.get_current_LA())\n",
|
||||||
"\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",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 5,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -187,7 +188,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 6,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
@@ -267,7 +268,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 7,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
|||||||
Reference in New Issue
Block a user