validation and KW Hammer Lastfälle

This commit is contained in:
Georg ´Brantegger
2022-09-27 15:31:36 +02:00
parent e1c7bc9d07
commit a951ea9b64
45 changed files with 1378443 additions and 1273749 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@
Messing Around/ Messing Around/
Messing Around/messy_nb.ipynb Messing Around/messy_nb.ipynb
Validation Data/raw data Tieferbach/*.txt Validation Data/raw data Tieferbach/*.txt
Druckrohrleitung/Gif Plots

View File

@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -22,7 +22,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -70,14 +70,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 = 10. # [s] target for total simulation time (will vary slightly to fit with Pip_dt)\n", "simTime_target = 3. # [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": 3, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -94,7 +94,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -111,7 +111,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -156,7 +156,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -164,7 +164,7 @@
"# Time loop\n", "# Time loop\n",
"\n", "\n",
"# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\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(3,1)\n", "fig1,axs1 = plt.subplots(3,1, figsize=(16,9))\n",
"fig1.suptitle(str(0) +' s / '+str(round(t_vec[-1],2)) + ' s' )\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_title('Pressure distribution in pipeline')\n",
"axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
@@ -195,7 +195,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -247,16 +247,24 @@
" lo_2, = axs1[2].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n", " lo_2, = axs1[2].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n",
" lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n", " lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
" lo_2max, = axs1[2].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n", " lo_2max, = axs1[2].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.suptitle(str(round(t_vec[it_pipe]-1,2))+ ' s / '+str(round(t_vec[-1]-1,2)) + ' s' )\n",
" fig1.canvas.draw()\n", " fig1.canvas.draw()\n",
" fig1.tight_layout()\n", " fig1.tight_layout()\n",
" fig1.show()\n", " fig1.show()\n",
" plt.pause(0.1) " " # if int(it_pipe/100) < 10:\n",
" # figname = 'GIF Plots\\ GIF00'+str(int(it_pipe/100))+'.png'\n",
" # elif int(it_pipe/100) < 100:\n",
" # figname = 'GIF Plots\\ GIF0'+str(int(it_pipe/100))+'.png'\n",
" # else:\n",
" # figname = 'GIF Plots\\ GIF'+str(int(it_pipe/100))+'.png'\n",
" # print(figname)\n",
" # fig1.savefig(fname=figname)\n",
" plt.pause(0.000001) "
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -292,7 +300,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "display_name": "Python 3.8.13 ('DT_Slot_3')",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@@ -311,7 +319,7 @@
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48"
} }
} }
}, },

View File

@@ -2,7 +2,28 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.4648308563541388\n",
"1.9761415556839106\n",
"0.4819009688403728\n"
]
}
],
"source": [
"print(level_vec[0]-np.min(level_vec))\n",
"print(level_vec[np.argmin(np.abs(t_vec-600))])\n",
"print(np.max(level_vec)-level_vec[0])"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -24,7 +45,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"i = 7\n",
"j = 2\n",
"\n",
"Kp_list = np.arange(0.1,2.1,0.1)\n",
"Area_list = np.arange(20.,140.,20.)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -48,14 +82,17 @@
" # for KW UL\n", " # for KW UL\n",
"UL_T1_Q_nenn = 3.75 # [m³/s] nominal flux of turbine \n", "UL_T1_Q_nenn = 3.75 # [m³/s] nominal flux of turbine \n",
"UL_T1_p_nenn = pressure_conversion(2.711,'bar',pUnit_calc) # [Pa] nominal pressure of turbine \n", "UL_T1_p_nenn = pressure_conversion(2.711,'bar',pUnit_calc) # [Pa] nominal pressure of turbine \n",
"UL_T1_closingTime = 80. # [s] closing time of turbine\n", "UL_T1_closingTime = 160. # [s] closing time of turbine\n",
"\n", "\n",
"UL_T2_Q_nenn = 3.75 # [m³/s] nominal flux of turbine \n", "UL_T2_Q_nenn = 3.75 # [m³/s] nominal flux of turbine \n",
"UL_T2_p_nenn = pressure_conversion(2.711,'bar',pUnit_calc) # [Pa] nominal pressure of turbine \n", "UL_T2_p_nenn = pressure_conversion(2.711,'bar',pUnit_calc) # [Pa] nominal pressure of turbine \n",
"UL_T2_closingTime = 80. # [s] closing time of turbine\n", "UL_T2_closingTime = 160. # [s] closing time of turbine\n",
"\n", "\n",
" # for PI controller\n", " # for PI controller\n",
"Con_targetLevel = 2. # [m]\n", "Con_targetLevel = 2. # [m]\n",
"Con_K_p = Kp_list[i] # [-] proportional constant of PI controller\n",
"Con_T_i = 200. # [s] timespan in which a steady state error is corrected by the intergal term\n",
"Con_deadbandRange = 0.00 # [m] Deadband range around targetLevel for which the controller does NOT intervene\n",
"\n", "\n",
" # for pipeline\n", " # for pipeline\n",
"Pip_length = 2300. # [m] length of pipeline\n", "Pip_length = 2300. # [m] length of pipeline\n",
@@ -74,7 +111,7 @@
"Pip_h_vec = np.arange(0,Pip_nn,1)*Pip_head/Pip_n_seg # [m] vector holding the vertival distance of each node from the upstream reservoir\n", "Pip_h_vec = np.arange(0,Pip_nn,1)*Pip_head/Pip_n_seg # [m] vector holding the vertival distance of each node from the upstream reservoir\n",
"\n", "\n",
" # for reservoir\n", " # for reservoir\n",
"Res_area_base = 100. # [m²] total base are of the cuboid reservoir \n", "Res_area_base = Area_list[j] # [m²] total base are of the cuboid reservoir \n",
"Res_area_out = Pip_area # [m²] outflux area of the reservoir, given by pipeline area\n", "Res_area_out = Pip_area # [m²] outflux area of the reservoir, given by pipeline area\n",
"Res_level_crit_lo = 0. # [m] for yet-to-be-implemented warnings\n", "Res_level_crit_lo = 0. # [m] for yet-to-be-implemented warnings\n",
"Res_level_crit_hi = np.inf # [m] for yet-to-be-implemented warnings\n", "Res_level_crit_hi = np.inf # [m] for yet-to-be-implemented warnings\n",
@@ -86,14 +123,14 @@
"# 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", "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", "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", "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": 26, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -127,12 +164,16 @@
"KW_UL.add_turbine(UL_T1)\n", "KW_UL.add_turbine(UL_T1)\n",
"KW_UL.add_turbine(UL_T2)\n", "KW_UL.add_turbine(UL_T2)\n",
"\n", "\n",
"KW_UL.set_steady_state_by_flux(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",
"\n",
"# level controller\n",
"level_control = PI_controller_class(Con_targetLevel,Con_deadbandRange,Con_K_p,Con_T_i,Pip_dt)\n",
"level_control.set_control_variable(UL_T1.get_current_LA(),display_warning=False)\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -177,10 +218,12 @@
" # manual input to modulate influx\n", " # manual input to modulate influx\n",
"OL_T1_LA_soll_vec = np.full_like(t_vec,OL_T1.get_current_LA()) # storing the target value for the guide van opening\n", "OL_T1_LA_soll_vec = np.full_like(t_vec,OL_T1.get_current_LA()) # storing the target value for the guide van opening\n",
"OL_T1_LA_soll_vec[np.argmin(np.abs(t_vec-100)):] = 0.\n", "OL_T1_LA_soll_vec[np.argmin(np.abs(t_vec-100)):] = 0.\n",
"OL_T1_LA_soll_vec[np.argmin(np.abs(t_vec-600)):] = 1.\n",
"\n", "\n",
"\n", "\n",
"OL_T2_LA_soll_vec = np.full_like(t_vec,OL_T2.get_current_LA()) # storing the target value for the guide van opening\n", "OL_T2_LA_soll_vec = np.full_like(t_vec,OL_T2.get_current_LA()) # storing the target value for the guide van opening\n",
"\n", "\n",
"\n",
"OL_T1_LA_ist_vec = np.zeros_like(t_vec) # storing the actual value of the guide vane opening\n", "OL_T1_LA_ist_vec = np.zeros_like(t_vec) # storing the actual value of the guide vane opening\n",
"OL_T1_LA_ist_vec[0] = OL_T1.get_current_LA() # storing the initial value of the guide vane opening\n", "OL_T1_LA_ist_vec[0] = OL_T1.get_current_LA() # storing the initial value of the guide vane opening\n",
"\n", "\n",
@@ -188,11 +231,11 @@
"OL_T2_LA_ist_vec[0] = OL_T2.get_current_LA() # storing the initial value of the guide vane opening\n", "OL_T2_LA_ist_vec[0] = OL_T2.get_current_LA() # storing the initial value of the guide vane opening\n",
"\n", "\n",
"# UL KW\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.zeros_like(t_vec) # storing the target value of the guide vane opening\n",
"UL_T1_LA_soll_vec[np.argmin(np.abs(t_vec-105)):] -= 0.25\n", "UL_T1_LA_soll_vec[0] = UL_T1.get_current_LA()\n",
"\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.zeros_like(t_vec) # storing the target value of the guide vane opening\n",
"UL_T2_LA_soll_vec[np.argmin(np.abs(t_vec-105)):] = 0.\n", "UL_T2_LA_soll_vec[0] = UL_T2.get_current_LA()\n",
"\n", "\n",
"UL_T1_LA_ist_vec = np.zeros_like(t_vec) # storing the actual value of the guide vane opening\n", "UL_T1_LA_ist_vec = np.zeros_like(t_vec) # storing the actual value of the guide vane opening\n",
"UL_T1_LA_ist_vec[0] = UL_T1.get_current_LA() # storing the initial value of the guide vane opening\n", "UL_T1_LA_ist_vec[0] = UL_T1.get_current_LA() # storing the initial value of the guide vane opening\n",
@@ -203,7 +246,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -225,49 +268,49 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"%matplotlib qt5\n", "%matplotlib qt5\n",
"# Time loop\n", "# Time loop\n",
"\n", "\n",
"# create a figure and subplots to display the velocity and pressure distribution across the pipeline in each pipeline step\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(3,1)\n", "# fig1,axs1 = plt.subplots(3,1)\n",
"fig1.suptitle(str(0) +' s / '+str(round(t_vec[-1],2)) + ' s' )\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_title('Pressure distribution in pipeline')\n",
"axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "# axs1[0].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
"axs1[0].set_ylabel(r'$p$ ['+pUnit_conv+']')\n", "# axs1[0].set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
"axs1[0].set_ylim([-2,50])\n", "# axs1[0].set_ylim([-2,50])\n",
"axs1[1].set_title('Pressure distribution in pipeline \\n Difference to t=0')\n", "# axs1[1].set_title('Pressure distribution in pipeline \\n Difference to t=0')\n",
"axs1[1].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "# axs1[1].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
"axs1[1].set_ylabel(r'$p$ ['+pUnit_conv+']')\n", "# axs1[1].set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
"axs1[1].set_ylim([-2,20])\n", "# axs1[1].set_ylim([-2,20])\n",
"axs1[2].set_title('Flux distribution in pipeline')\n", "# axs1[2].set_title('Flux distribution in pipeline')\n",
"axs1[2].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "# axs1[2].set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
"axs1[2].set_ylabel(r'$Q$ [$\\mathrm{m}^3 / \\mathrm{s}$]')\n", "# axs1[2].set_ylabel(r'$Q$ [$\\mathrm{m}^3 / \\mathrm{s}$]')\n",
"axs1[2].set_ylim([-1,10])\n", "# axs1[2].set_ylim([-1,10])\n",
"lo_0, = axs1[0].plot(Pip_x_vec,pressure_conversion(p_old,pUnit_calc, pUnit_conv),marker='.')\n", "# lo_0, = axs1[0].plot(Pip_x_vec,pressure_conversion(p_old,pUnit_calc, pUnit_conv),marker='.')\n",
"lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n", "# lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
"lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n", "# lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
"lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(p_old-p_0,pUnit_calc, pUnit_conv),marker='.')\n", "# lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(p_old-p_0,pUnit_calc, pUnit_conv),marker='.')\n",
"lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n", "# lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
"lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n", "# lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
"lo_2, = axs1[1].plot(Pip_x_vec,Q_old,marker='.')\n", "# lo_2, = axs1[1].plot(Pip_x_vec,Q_old,marker='.')\n",
"lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n", "# lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
"lo_2max, = axs1[2].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n", "# lo_2max, = axs1[2].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n",
"\n", "\n",
"# axs1[0].autoscale()\n", "# # axs1[0].autoscale()\n",
"# axs1[1].autoscale()\n", "# # axs1[1].autoscale()\n",
"\n", "\n",
"fig1.tight_layout()\n", "# fig1.tight_layout()\n",
"fig1.show()\n", "# fig1.show()\n",
"plt.pause(1)\n" "# plt.pause(1)\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -290,7 +333,11 @@
" for it_res in range(Res_nt):\n", " for it_res in range(Res_nt):\n",
" reservoir.timestep_reservoir_evolution() \n", " reservoir.timestep_reservoir_evolution() \n",
" level_vec[it_pipe] = reservoir.get_current_level() \n", " level_vec[it_pipe] = reservoir.get_current_level() \n",
" volume_vec[it_pipe] = reservoir.get_current_volume() \n", " volume_vec[it_pipe] = reservoir.get_current_volume() \n",
"\n",
" level_control.update_control_variable(level_vec[it_pipe])\n",
" UL_T1_LA_soll_vec[it_pipe] = level_control.get_current_control_variable() \n",
" UL_T2_LA_soll_vec[it_pipe] = level_control.get_current_control_variable() \n",
" \n", " \n",
" # change the guide vane opening based on the target value and closing time limitation\n", " # change the guide vane opening based on the target value and closing time limitation\n",
" KW_UL.update_LAs([UL_T1_LA_soll_vec[it_pipe],UL_T2_LA_soll_vec[it_pipe]])\n", " KW_UL.update_LAs([UL_T1_LA_soll_vec[it_pipe],UL_T2_LA_soll_vec[it_pipe]])\n",
@@ -322,115 +369,119 @@
" v_old = pipe.get_current_velocity_distribution()\n", " v_old = pipe.get_current_velocity_distribution()\n",
" Q_old = pipe.get_current_flux_distribution()\n", " Q_old = pipe.get_current_flux_distribution()\n",
"\n", "\n",
" # plot some stuff\n", " # # plot some stuff\n",
" # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n", " # # remove line-objects to autoscale axes (there is definetly a better way, but this works ¯\\_(ツ)_/¯ )\n",
" if it_pipe%50 == 0:\n", " # if it_pipe%50 == 0:\n",
" lo_0.remove()\n", " # lo_0.remove()\n",
" lo_0min.remove()\n", " # lo_0min.remove()\n",
" lo_0max.remove()\n", " # lo_0max.remove()\n",
" lo_1.remove()\n", " # lo_1.remove()\n",
" lo_1min.remove()\n", " # lo_1min.remove()\n",
" lo_1max.remove()\n", " # lo_1max.remove()\n",
" lo_2.remove()\n", " # lo_2.remove()\n",
" lo_2min.remove()\n", " # lo_2min.remove()\n",
" lo_2max.remove()\n", " # lo_2max.remove()\n",
" # plot new pressure and velocity distribution in the pipeline\n", " # # plot new pressure and velocity distribution in the pipeline\n",
" lo_0, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_current_pressure_distribution(),pUnit_calc,pUnit_conv),marker='.',c='blue')\n", " # lo_0, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_current_pressure_distribution(),pUnit_calc,pUnit_conv),marker='.',c='blue')\n",
" lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n", " # lo_0min, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red')\n",
" lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red') \n", " # lo_0max, = axs1[0].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node(),pUnit_calc,pUnit_conv),c='red') \n",
" lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_current_pressure_distribution()-p_0,pUnit_calc,pUnit_conv),marker='.',c='blue')\n", " # lo_1, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_current_pressure_distribution()-p_0,pUnit_calc,pUnit_conv),marker='.',c='blue')\n",
" lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n", " # lo_1min, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_lowest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
" lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n", " # lo_1max, = axs1[1].plot(Pip_x_vec,pressure_conversion(pipe.get_highest_pressure_per_node()-p_0,pUnit_calc,pUnit_conv),c='red')\n",
" lo_2, = axs1[2].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n", " # lo_2, = axs1[2].plot(Pip_x_vec,pipe.get_current_flux_distribution(),marker='.',c='blue')\n",
" lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n", " # lo_2min, = axs1[2].plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
" lo_2max, = axs1[2].plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n", " # lo_2max, = axs1[2].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.suptitle(str(round(t_vec[it_pipe],2))+ ' s / '+str(round(t_vec[-1],2)) + ' s' )\n",
" fig1.canvas.draw()\n", " # fig1.canvas.draw()\n",
" fig1.tight_layout()\n", " # fig1.tight_layout()\n",
" fig1.show()\n", " # fig1.show()\n",
" plt.pause(0.1) " " # plt.pause(0.1) "
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"fig2,axs2 = plt.subplots(1,1)\n", "# fig2,axs2 = plt.subplots(1,1)\n",
"axs2.set_title('Level and Volume reservoir')\n", "# axs2.set_title('Level and Volume reservoir')\n",
"axs2.plot(t_vec,level_vec,label='level')\n", "# axs2.plot(t_vec,level_vec,label='level')\n",
"axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n", "# axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"axs2.set_ylabel(r'$h$ [m]')\n", "# axs2.set_ylabel(r'$h$ [m]')\n",
"x_twin_00 = axs2.twinx()\n", "# x_twin_00 = axs2.twinx()\n",
"x_twin_00.set_ylabel(r'$V$ [$\\mathrm{m}^3$]')\n", "# x_twin_00.set_ylabel(r'$V$ [$\\mathrm{m}^3$]')\n",
"x_twin_00.plot(t_vec,volume_vec)\n", "# x_twin_00.plot(t_vec,volume_vec)\n",
"axs2.legend()\n", "# axs2.legend()\n",
"\n",
"fig2,axs2 = plt.subplots(1,1)\n",
"axs2.set_title('LA')\n",
"axs2.plot(t_vec,100*OL_T1_LA_soll_vec,label='OL_T1 Target',c='b')\n",
"axs2.scatter(t_vec[::200],100*OL_T1_LA_ist_vec[::200],label='OL_T1 Actual',c='b',marker='+')\n",
"axs2.plot(t_vec,100*OL_T2_LA_soll_vec,label='OL_T2 Target',c='g')\n",
"axs2.scatter(t_vec[::200],100*OL_T2_LA_ist_vec[::200],label='OL_T2 Actual',c='g',marker='+')\n",
"axs2.plot(t_vec,100*UL_T1_LA_soll_vec,label='UL_T1 Target',c='r')\n",
"axs2.scatter(t_vec[::200],100*UL_T1_LA_ist_vec[::200],label='UL_T1 Actual',c='r',marker='+')\n",
"axs2.plot(t_vec,100*UL_T2_LA_soll_vec,label='UL_T2 Target',c='k')\n",
"axs2.scatter(t_vec[::200],100*UL_T2_LA_ist_vec[::200],label='UL_T2 Actual',c='k',marker='+')\n",
"axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"axs2.set_ylabel(r'$LA$ [%]')\n",
"axs2.legend()\n",
"\n",
"fig2,axs2 = plt.subplots(1,1)\n",
"axs2.set_title('Pressure change vs t=0 at reservoir and turbine')\n",
"axs2.plot(t_vec,pressure_conversion(p_boundary_res-p_boundary_res[0],pUnit_calc, pUnit_conv),label='Reservoir')\n",
"axs2.plot(t_vec,pressure_conversion(p_boundary_tur-p_boundary_tur[0],pUnit_calc, pUnit_conv),label='Turbine')\n",
"axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"axs2.set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
"axs2.legend()\n",
"\n",
"fig2,axs2 = plt.subplots(1,1)\n",
"axs2.set_title('Fluxes')\n",
"axs2.plot(t_vec,Q_in_vec,label='Influx')\n",
"axs2.plot(t_vec,Q_boundary_res,label='Outflux')\n",
"axs2.scatter(t_vec[::200],Q_boundary_tur[::200],label='Flux Turbine',c='g',marker='+')\n",
"axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"axs2.set_ylabel(r'$Q$ [$\\mathrm{m}^3/\\mathrm{s}$]')\n",
"axs2.legend()\n",
"\n",
"fig2,axs2 = plt.subplots(1,1)\n",
"axs2.set_title('Min and Max Pressure')\n",
"axs2.plot(Pip_x_vec,pipe.get_lowest_pressure_per_node(disp_flag=True),c='red')\n",
"axs2.plot(Pip_x_vec,pipe.get_highest_pressure_per_node(disp_flag=True),c='red')\n",
"axs2.set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
"axs2.set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
"\n", "\n",
"# fig2,axs2 = plt.subplots(1,1)\n", "# fig2,axs2 = plt.subplots(1,1)\n",
"# axs2.set_title('Min and Max Fluxes')\n", "# axs2.set_title('LA')\n",
"# axs2.plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n", "# axs2.plot(t_vec,100*OL_T1_LA_soll_vec,label='OL_T1 Target',c='b')\n",
"# axs2.plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n", "# axs2.scatter(t_vec[::200],100*OL_T1_LA_ist_vec[::200],label='OL_T1 Actual',c='b',marker='+')\n",
"# axs2.set_xlabel(r'$x$ [$\\mathrm{m}$]')\n", "# axs2.plot(t_vec,100*OL_T2_LA_soll_vec,label='OL_T2 Target',c='g')\n",
"# axs2.scatter(t_vec[::200],100*OL_T2_LA_ist_vec[::200],label='OL_T2 Actual',c='g',marker='+')\n",
"# axs2.plot(t_vec,100*UL_T1_LA_soll_vec,label='UL_T1 Target',c='r')\n",
"# axs2.scatter(t_vec[::200],100*UL_T1_LA_ist_vec[::200],label='UL_T1 Actual',c='r',marker='+')\n",
"# axs2.plot(t_vec,100*UL_T2_LA_soll_vec,label='UL_T2 Target',c='k')\n",
"# axs2.scatter(t_vec[::200],100*UL_T2_LA_ist_vec[::200],label='UL_T2 Actual',c='k',marker='+')\n",
"# axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"# axs2.set_ylabel(r'$LA$ [%]')\n",
"# axs2.legend()\n",
"\n",
"# fig2,axs2 = plt.subplots(1,1)\n",
"# axs2.set_title('Pressure change vs t=0 at reservoir and turbine')\n",
"# axs2.plot(t_vec,pressure_conversion(p_boundary_res-p_boundary_res[0],pUnit_calc, pUnit_conv),label='Reservoir')\n",
"# axs2.plot(t_vec,pressure_conversion(p_boundary_tur-p_boundary_tur[0],pUnit_calc, pUnit_conv),label='Turbine')\n",
"# axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"# axs2.set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
"# axs2.legend()\n",
"\n",
"# fig2,axs2 = plt.subplots(1,1)\n",
"# axs2.set_title('Fluxes')\n",
"# axs2.plot(t_vec,Q_in_vec,label='Influx')\n",
"# axs2.plot(t_vec,Q_boundary_res,label='Outflux')\n",
"# axs2.scatter(t_vec[::200],Q_boundary_tur[::200],label='Flux Turbine',c='g',marker='+')\n",
"# axs2.set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"# axs2.set_ylabel(r'$Q$ [$\\mathrm{m}^3/\\mathrm{s}$]')\n", "# axs2.set_ylabel(r'$Q$ [$\\mathrm{m}^3/\\mathrm{s}$]')\n",
"# axs2.legend()\n",
"\n",
"# fig2,axs2 = plt.subplots(1,1)\n",
"# axs2.set_title('Min and Max Pressure')\n",
"# axs2.plot(Pip_x_vec,pipe.get_lowest_pressure_per_node(disp_flag=True),c='red')\n",
"# axs2.plot(Pip_x_vec,pipe.get_highest_pressure_per_node(disp_flag=True),c='red')\n",
"# axs2.set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
"# axs2.set_ylabel(r'$p$ ['+pUnit_conv+']')\n",
"\n",
"# # fig2,axs2 = plt.subplots(1,1)\n",
"# # axs2.set_title('Min and Max Fluxes')\n",
"# # axs2.plot(Pip_x_vec,pipe.get_lowest_flux_per_node(),c='red')\n",
"# # axs2.plot(Pip_x_vec,pipe.get_highest_flux_per_node(),c='red')\n",
"# # axs2.set_xlabel(r'$x$ [$\\mathrm{m}$]')\n",
"# # axs2.set_ylabel(r'$Q$ [$\\mathrm{m}^3/\\mathrm{s}$]')\n",
"\n", "\n",
"\n", "\n",
"fig2.tight_layout()\n", "# fig2.tight_layout()\n",
"plt.show()" "# plt.show()"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"fig3,axs3 = plt.subplots(2,2)\n", "\n",
"fig3,axs3 = plt.subplots(2,2,figsize=(16,9))\n",
"fig3.suptitle('Fläche = '+str(Res_area_base)+'\\n'+'Kp = '+str(round(Con_K_p,1))+' Ti = '+str(Con_T_i) )\n",
"axs3[0,0].set_title('Level and Volume reservoir')\n", "axs3[0,0].set_title('Level and Volume reservoir')\n",
"axs3[0,0].plot(t_vec,level_vec,label='level')\n", "axs3[0,0].plot(t_vec,level_vec,label='level')\n",
"axs3[0,0].set_xlabel(r'$t$ [$\\mathrm{s}$]')\n", "axs3[0,0].set_xlabel(r'$t$ [$\\mathrm{s}$]')\n",
"axs3[0,0].set_ylabel(r'$h$ [m]')\n", "axs3[0,0].set_ylabel(r'$h$ [m]')\n",
"axs3[0,0].set_ylim(0,3.5)\n",
"x_twin_00 = axs3[0,0].twinx()\n", "x_twin_00 = axs3[0,0].twinx()\n",
"x_twin_00.set_ylabel(r'$V$ [$\\mathrm{m}^3$]')\n", "x_twin_00.set_ylabel(r'$V$ [$\\mathrm{m}^3$]')\n",
"x_twin_00.plot(t_vec,volume_vec)\n", "x_twin_00.plot(t_vec,volume_vec)\n",
"x_twin_00.set_ylim(0,3.5*Res_area_base)\n",
"axs3[0,0].legend()\n", "axs3[0,0].legend()\n",
"\n", "\n",
"axs3[0,1].set_title('LA')\n", "axs3[0,1].set_title('LA')\n",
@@ -462,30 +513,37 @@
"axs3[1,1].legend()\n", "axs3[1,1].legend()\n",
"\n", "\n",
"fig3.tight_layout()\n", "fig3.tight_layout()\n",
"plt.show()" "plt.show()\n",
"\n",
"figname = 'Simulation Hammer\\KW_Hammer_Fläche_'+str(Res_area_base)+'_Ti_'+str(Con_T_i)+'_Kp'+str(round(Con_K_p,1))+'.png'\n",
"fig3.savefig(figname)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"0.015478260869565217\n" "0.42240906887823404\n",
"1.9673287975884344\n",
"0.43120621785509305\n"
] ]
} }
], ],
"source": [ "source": [
"print(np.sin(Pip_angle))" "print(level_vec[0]-np.min(level_vec))\n",
"print(level_vec[np.argmin(np.abs(t_vec-600))])\n",
"print(np.max(level_vec)-level_vec[0])"
] ]
} }
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')", "display_name": "Python 3.8.13 ('DT_Slot_3')",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@@ -504,7 +562,7 @@
"orig_nbformat": 4, "orig_nbformat": 4,
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd" "hash": "4a28055eb8a3160fa4c7e4fca69770c4e0a1add985300856aa3fcf4ce32a2c48"
} }
} }
}, },

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -14,7 +14,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -37,7 +37,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -46,7 +46,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -56,7 +56,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -71,12 +71,13 @@
"UT_M1_p = UT_df['UL_T1_p'].to_numpy()\n", "UT_M1_p = UT_df['UL_T1_p'].to_numpy()\n",
"UT_M2_p = UT_df['UL_T2_p'].to_numpy()\n", "UT_M2_p = UT_df['UL_T2_p'].to_numpy()\n",
"UT_M1_LA = UT_df['UL_T1_LA'].to_numpy()\n", "UT_M1_LA = UT_df['UL_T1_LA'].to_numpy()\n",
"UT_M2_LA = UT_df['UL_T2_LA'].to_numpy()" "UT_M2_LA = UT_df['UL_T2_LA'].to_numpy()\n",
"UT_Ausl = UT_df['Ausl'].to_numpy()\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -85,7 +86,7 @@
"(1657542740.9878564, 1657553169.3173888)" "(1657542740.9878564, 1657553169.3173888)"
] ]
}, },
"execution_count": 21, "execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -116,30 +117,21 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 48, "execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"ename": "TypeError",
"evalue": "Cannot construct a dtype from an array",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mv:\\georg\\Documents\\Persönliche Dokumente\\Arbeit\\Kelag\\Coding\\Python\\DT_Slot_3\\Kelag_DT_Slot_3\\Validation Data\\consolidated pandas dataframes\\consolidate_validation_data.ipynb Cell 7\u001b[0m in \u001b[0;36m<cell line: 7>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/v%3A/georg/Documents/Pers%C3%B6nliche%20Dokumente/Arbeit/Kelag/Coding/Python/DT_Slot_3/Kelag_DT_Slot_3/Validation%20Data/consolidated%20pandas%20dataframes/consolidate_validation_data.ipynb#X10sZmlsZQ%3D%3D?line=4'>5</a>\u001b[0m fig \u001b[39m=\u001b[39m plt\u001b[39m.\u001b[39mfigure()\n\u001b[0;32m <a href='vscode-notebook-cell:/v%3A/georg/Documents/Pers%C3%B6nliche%20Dokumente/Arbeit/Kelag/Coding/Python/DT_Slot_3/Kelag_DT_Slot_3/Validation%20Data/consolidated%20pandas%20dataframes/consolidate_validation_data.ipynb#X10sZmlsZQ%3D%3D?line=5'>6</a>\u001b[0m plt\u001b[39m.\u001b[39mplot(UT_t_vec[mask_UT],TB_level[mask_UT])\n\u001b[1;32m----> <a href='vscode-notebook-cell:/v%3A/georg/Documents/Pers%C3%B6nliche%20Dokumente/Arbeit/Kelag/Coding/Python/DT_Slot_3/Kelag_DT_Slot_3/Validation%20Data/consolidated%20pandas%20dataframes/consolidate_validation_data.ipynb#X10sZmlsZQ%3D%3D?line=6'>7</a>\u001b[0m validation_data_UT \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39;49marray([UT_t_vec[mask_UT],UT_M1_LA[mask_UT],UT_M2_LA[mask_UT],UT_M1_p[mask_UT],UT_M2_p[mask_UT]],TB_level[mask_UT])\n\u001b[0;32m <a href='vscode-notebook-cell:/v%3A/georg/Documents/Pers%C3%B6nliche%20Dokumente/Arbeit/Kelag/Coding/Python/DT_Slot_3/Kelag_DT_Slot_3/Validation%20Data/consolidated%20pandas%20dataframes/consolidate_validation_data.ipynb#X10sZmlsZQ%3D%3D?line=7'>8</a>\u001b[0m validation_data_TB \u001b[39m=\u001b[39m np\u001b[39m.\u001b[39marray([TB_t_vec[mask_TB],TB_M1_LA[mask_TB],TB_M2_LA[mask_TB],TB_M1_p[mask_TB],TB_M2_p[mask_TB]])\n",
"\u001b[1;31mTypeError\u001b[0m: Cannot construct a dtype from an array"
]
}
],
"source": [ "source": [
"mask_UT = np.logical_and(t1<UT_t_vec,UT_t_vec <t2)\n", "mask_UT = np.logical_and(t1<UT_t_vec,UT_t_vec <t2)\n",
"mask_TB = np.logical_and(t1<TB_t_vec,TB_t_vec <t2)\n", "mask_TB = np.logical_and(t1<TB_t_vec,TB_t_vec <t2)\n",
"\n", "\n",
"\n", "\n",
"fig = plt.figure()\n", "\n",
"plt.plot(UT_t_vec[mask_UT],TB_level[mask_UT])\n", "validation_data_UT = UT_df[mask_UT]\n",
"validation_data_UT = np.array([UT_t_vec[mask_UT];UT_M1_LA[mask_UT];UT_M2_LA[mask_UT];UT_M1_p[mask_UT];UT_M2_p[mask_UT]];TB_level[mask_UT])\n", "validation_data_TB = TB_df[mask_TB]\n",
"validation_data_TB = np.array([TB_t_vec[mask_TB];TB_M1_LA[mask_TB];TB_M2_LA[mask_TB];TB_M1_p[mask_TB];TB_M2_p[mask_TB]])" "\n",
"validation_data_UT.to_csv('Validation_data_UT.csv')\n",
"validation_data_TB.to_csv('Validation_data_TB.csv')\n",
"\n"
] ]
} }
], ],

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,7 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"C:\\Users\\georg\\AppData\\Local\\Temp\\ipykernel_29732\\1290488230.py:2: ParserWarning: Length of header or names does not match length of data. This leads to a loss of data with index_col=False.\n", "C:\\Users\\georg\\AppData\\Local\\Temp\\ipykernel_24336\\3411177260.py:2: ParserWarning: Length of header or names does not match length of data. This leads to a loss of data with index_col=False.\n",
" raw_data = pd.read_csv(\"2015_08_25 15.20 M12 SS100%.csv\",sep=\";\",header=7,index_col=False)\n" " raw_data = pd.read_csv(\"2015_08_25 15.20 M12 SS100%.csv\",sep=\";\",header=7,index_col=False)\n"
] ]
} }
@@ -53,7 +53,7 @@
"df['M1-LA'] = pd.to_numeric(raw_data['M1-LA'])/100\n", "df['M1-LA'] = pd.to_numeric(raw_data['M1-LA'])/100\n",
"df['M2-LA'] = pd.to_numeric(raw_data['M2-LA'])/100\n", "df['M2-LA'] = pd.to_numeric(raw_data['M2-LA'])/100\n",
"df['Druck'] = pd.to_numeric(raw_data['P-DRL'])\n", "df['Druck'] = pd.to_numeric(raw_data['P-DRL'])\n",
"df['Pegel'] = pd.to_numeric(raw_data['Pegel-UW'])\n", "df['Pegel'] = pd.to_numeric(raw_data['PEGEL-UW'])\n",
"\n", "\n",
"val_t_vec_raw = np.array(df['timestamp']-df['timestamp'][0])\n", "val_t_vec_raw = np.array(df['timestamp']-df['timestamp'][0])\n",
"val_LA1_vec_raw = np.array(df['M1-LA']) \n", "val_LA1_vec_raw = np.array(df['M1-LA']) \n",
@@ -501,7 +501,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"[<matplotlib.lines.Line2D at 0x1e74e242940>]" "[<matplotlib.lines.Line2D at 0x18a94bcf820>]"
] ]
}, },
"execution_count": 10, "execution_count": 10,

View File

@@ -21,7 +21,8 @@
"M1_p_df = pd.read_csv('M1_Druck.txt',delimiter=';')\n", "M1_p_df = pd.read_csv('M1_Druck.txt',delimiter=';')\n",
"M2_p_df = pd.read_csv('M2_Druck.txt',delimiter=';')\n", "M2_p_df = pd.read_csv('M2_Druck.txt',delimiter=';')\n",
"M1_LA_df = pd.read_csv('M1_LA.txt',delimiter=';')\n", "M1_LA_df = pd.read_csv('M1_LA.txt',delimiter=';')\n",
"M2_LA_df = pd.read_csv('M2_LA.txt',delimiter=';')" "M2_LA_df = pd.read_csv('M2_LA.txt',delimiter=';')\n",
"Ausl_df = pd.read_csv('AL_SeitAuslPos.txt',delimiter=';')"
] ]
}, },
{ {
@@ -34,7 +35,8 @@
"M1_p_df['Timestamp'] = M1_p_df['TIMESTAMP UNIX']+M1_p_df['TIMESTAMP MS']/1000.\n", "M1_p_df['Timestamp'] = M1_p_df['TIMESTAMP UNIX']+M1_p_df['TIMESTAMP MS']/1000.\n",
"M2_p_df['Timestamp'] = M2_p_df['TIMESTAMP UNIX']+M2_p_df['TIMESTAMP MS']/1000.\n", "M2_p_df['Timestamp'] = M2_p_df['TIMESTAMP UNIX']+M2_p_df['TIMESTAMP MS']/1000.\n",
"M1_LA_df['Timestamp'] = M1_LA_df['TIMESTAMP UNIX']+M1_LA_df['TIMESTAMP MS']/1000.\n", "M1_LA_df['Timestamp'] = M1_LA_df['TIMESTAMP UNIX']+M1_LA_df['TIMESTAMP MS']/1000.\n",
"M2_LA_df['Timestamp'] = M2_LA_df['TIMESTAMP UNIX']+M2_LA_df['TIMESTAMP MS']/1000." "M2_LA_df['Timestamp'] = M2_LA_df['TIMESTAMP UNIX']+M2_LA_df['TIMESTAMP MS']/1000.\n",
"Ausl_df['Timestamp'] = Ausl_df['TIMESTAMP UNIX']+Ausl_df['TIMESTAMP MS']/1000."
] ]
}, },
{ {
@@ -47,7 +49,8 @@
"M1_p_df.set_index('Timestamp',inplace=True)\n", "M1_p_df.set_index('Timestamp',inplace=True)\n",
"M2_p_df.set_index('Timestamp',inplace=True)\n", "M2_p_df.set_index('Timestamp',inplace=True)\n",
"M1_LA_df.set_index('Timestamp',inplace=True)\n", "M1_LA_df.set_index('Timestamp',inplace=True)\n",
"M2_LA_df.set_index('Timestamp',inplace=True)" "M2_LA_df.set_index('Timestamp',inplace=True)\n",
"Ausl_df.set_index('Timestamp',inplace=True)"
] ]
}, },
{ {
@@ -61,12 +64,14 @@
"M2_p_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n", "M2_p_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n",
"M1_LA_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n", "M1_LA_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n",
"M2_LA_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n", "M2_LA_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n",
"Ausl_df.drop(columns=['VARIABLE','TIMESTAMP UNIX', 'TIMESTAMP MS'],inplace=True)\n",
"\n", "\n",
"pegel_df.rename(columns={'VALUE': 'TB-Pegel'},inplace=True)\n", "pegel_df.rename(columns={'VALUE': 'TB-Pegel'},inplace=True)\n",
"M1_p_df.rename(columns={'VALUE': 'M1-Druck'},inplace=True)\n", "M1_p_df.rename(columns={'VALUE': 'M1-Druck'},inplace=True)\n",
"M2_p_df.rename(columns={'VALUE': 'M2-Druck'},inplace=True)\n", "M2_p_df.rename(columns={'VALUE': 'M2-Druck'},inplace=True)\n",
"M1_LA_df.rename(columns={'VALUE': 'M1-LA'},inplace=True)\n", "M1_LA_df.rename(columns={'VALUE': 'M1-LA'},inplace=True)\n",
"M2_LA_df.rename(columns={'VALUE': 'M2-LA'},inplace=True)\n" "M2_LA_df.rename(columns={'VALUE': 'M2-LA'},inplace=True)\n",
"Ausl_df.rename(columns={'VALUE': 'Ausl'},inplace=True)\n"
] ]
}, },
{ {
@@ -75,7 +80,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"UT_df = pegel_df.join([M1_LA_df,M1_p_df,M2_LA_df,M2_p_df],how='outer').sort_index()" "UT_df = pegel_df.join([M1_LA_df,M1_p_df,M2_LA_df,M2_p_df,Ausl_df],how='outer').sort_index()"
] ]
}, },
{ {