code cleanup:
consistenly use getter and setter methods commenting etc
This commit is contained in:
19
Kraftwerk/Kraftwerk_class_file.py
Normal file
19
Kraftwerk/Kraftwerk_class_file.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#importing Druckrohrleitung
|
||||
import sys
|
||||
import os
|
||||
current = os.path.dirname(os.path.realpath('Main_Programm.ipynb'))
|
||||
parent = os.path.dirname(current)
|
||||
sys.path.append(parent)
|
||||
from functions.pressure_conversion import pressure_conversion
|
||||
from Turbinen.Turbinen_class_file import Francis_Turbine
|
||||
|
||||
class Kraftwerk_class:
|
||||
def __init__(self):
|
||||
self.turbines = []
|
||||
|
||||
def add_turbine(self,turbine):
|
||||
self.turbines.append(turbine)
|
||||
|
||||
def print_info(self):
|
||||
for turbine in self.turbines:
|
||||
turbine.get_info(full=True)
|
||||
105
Kraftwerk/Kraftwerk_class_test.ipynb
Normal file
105
Kraftwerk/Kraftwerk_class_test.ipynb
Normal file
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"import os\n",
|
||||
"from Kraftwerk_class_file import Kraftwerk_class\n",
|
||||
"\n",
|
||||
"current = os.path.dirname(os.path.realpath('Main_Programm.ipynb'))\n",
|
||||
"parent = os.path.dirname(current)\n",
|
||||
"sys.path.append(parent)\n",
|
||||
"from functions.pressure_conversion import pressure_conversion\n",
|
||||
"from Turbinen.Turbinen_class_file import Francis_Turbine"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[<Turbinen.Turbinen_class_file.Francis_Turbine object at 0x0000018A94FDDE80>, <Turbinen.Turbinen_class_file.Francis_Turbine object at 0x0000018A94FDDEE0>]\n",
|
||||
"Turbine has the following attributes: \n",
|
||||
"----------------------------- \n",
|
||||
"Type = Francis \n",
|
||||
"Nominal flux = 0.85 m³/s \n",
|
||||
"Nominal pressure = 108.09 mWS\n",
|
||||
"Nominal LA = 100.0 % \n",
|
||||
"Closing time = 500 s \n",
|
||||
"Current flux = -1.0 m³/s \n",
|
||||
"Current pipe pressure = -1.0 mWS \n",
|
||||
"Current LA = -1.0 % \n",
|
||||
"Simulation timestep = -1.0 s \n",
|
||||
"----------------------------- \n",
|
||||
"\n",
|
||||
"Turbine has the following attributes: \n",
|
||||
"----------------------------- \n",
|
||||
"Type = Francis \n",
|
||||
"Nominal flux = 0.85 m³/s \n",
|
||||
"Nominal pressure = 108.09 mWS\n",
|
||||
"Nominal LA = 100.0 % \n",
|
||||
"Closing time = 500 s \n",
|
||||
"Current flux = -1.0 m³/s \n",
|
||||
"Current pipe pressure = -1.0 mWS \n",
|
||||
"Current LA = -1.0 % \n",
|
||||
"Simulation timestep = -1.0 s \n",
|
||||
"----------------------------- \n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"#Turbine\n",
|
||||
"Q_nenn = 0.85 # m³/s\n",
|
||||
"p_nenn = pressure_conversion(10.6,'bar','Pa')\n",
|
||||
"closing_time = 500 #s\n",
|
||||
"\n",
|
||||
"T1 = Francis_Turbine(Q_nenn,p_nenn,closing_time)\n",
|
||||
"T2 = Francis_Turbine(Q_nenn,p_nenn,closing_time)\n",
|
||||
"\n",
|
||||
"KW = Kraftwerk_class()\n",
|
||||
"KW.add_turbine(T1)\n",
|
||||
"KW.add_turbine(T2)\n",
|
||||
"\n",
|
||||
"print(KW.turbines)\n",
|
||||
"\n",
|
||||
"KW.print_info()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.8.13 ('Georg_DT_Slot3')",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.13"
|
||||
},
|
||||
"orig_nbformat": 4,
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "84fb123bdc47ab647d3782661abcbe80fbb79236dd2f8adf4cef30e8755eb2cd"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user