end of day commit - working on turbine class

This commit is contained in:
Brantegger Georg
2022-07-19 15:51:57 +02:00
parent 5654a41d48
commit 7e67979a82
9 changed files with 1149 additions and 230 deletions

View File

@@ -1,19 +1,30 @@
def turbine_flux(p,LA,p_exp,cubic_coeff,quadratic_coeff,linear_coeff,const_coeff):
return (p*1e-5)**p_exp*(cubic_coeff*LA**3+quadratic_coeff*LA**2+linear_coeff*LA+const_coeff)
from matplotlib.pyplot import fill
import numpy as np
from scipy.interpolate import interp2d
#importing pressure conversion function
import sys
import os
current = os.path.dirname(os.path.realpath(__file__))
parent = os.path.dirname(current)
sys.path.append(parent)
from functions.pressure_conversion import pressure_conversion
class Francis_turbine_class:
def __init__(self):
pass
def __init__(self,CSV_name='Durchflusskennlinie.csv'):
self.raw_csv = np.genfromtxt(CSV_name,delimiter=',')
def extract_csv(self,CSV_pressure_unit='bar'):
self.raw_ps_vec,_ = pressure_conversion(self.raw_csv[0,1:],CSV_pressure_unit,'Pa')
self.raw_LA_vec = self.raw_csv[1:,0]
self.raw_Qs_mat = self.raw_csv[1:,1:]
def get_Q_fun(self):
Q_fun = interp2d(self.raw_ps_vec,self.raw_LA_vec,self.raw_Qs_mat,bounds_error=False,fill_value=None)
return Q_fun
def set_turbine_flux_parameters(self,p_exp,cubic_coeff,quadratic_coeff,linear_coeff,const_coeff):
# extracted from the Muschelkurve of the Turbine and used to calculate the turbine flux for a given pressure
self.p_exp = p_exp
self.cubic_coeff = cubic_coeff
self.quadratic_coeff = quadratic_coeff
self.linear_coeff = linear_coeff
self.const_coeff = const_coeff
def get_turbine_flux(self,pressure,Leitapparatöffnung):
self.flux = turbine_flux(pressure,Leitapparatöffnung,self.p_exp,self.cubic_coeff,self.quadratic_coeff,self.linear_coeff,self.const_coeff)
return self.flux