Example #1
0
    def __init__(self,
                 selected_cp_air_model='ideal',
                 selected_gamma_air_model='ideal'):
        """
        Initializes IsentropicGas. Switches between RealGas or IdealGas from air_model.py depending on the inputs:
        + Inputs:
        ---------
            selected_cp_air_model: 'ideal' or any real model defined at air_model.RealGas
            selected_gamma_air_model: 'ideal' or any real model defined at air_model.RealGas
         
        """
        if type(selected_cp_air_model) == str:
            if selected_cp_air_model.lower() == 'ideal':
                self.selected_cp_air_model = 'ideal'
                if selected_gamma_air_model != 'ideal':
                    print('Gamma_air model switched to ideal')
                self.selected_cp_air_model = 'ideal'

                self.air_data = IdealGas()

            else:
                am = RealGas()
                available_cp_functions = am.cp_air_functions.keys()
                if selected_cp_air_model.lower() in available_cp_functions:
                    self.selected_cp_air_model = selected_cp_air_model.lower()

                    available_gamma_functions = am.gamma_air_functions.keys()
                    if selected_gamma_air_model.lower(
                    ) in available_gamma_functions:
                        self.selected_gamma_air_model = selected_gamma_air_model.lower(
                        )
                        self.air_data = RealGas(
                            cp_option=self.selected_cp_air_model,
                            gamma_option=selected_gamma_air_model)
                    else:
                        print('Gamma_air model switched to default')
                        self.air_data = RealGas(
                            cp_option=self.selected_cp_air_model)
                else:
                    print(
                        'Unknown selected cp real gas model. Switching to Ideal Gas'
                    )
                    self.air_data = IdealGas()
        else:
            print('Unknown selected cp model. Switching to ideal gas...')

            self.selected_cp_air_model = 'ideal'
            self.selected_gamma_air_model = 'ideal'
            self.air_data = IdealGas()

        # Specific gas constant:
        self.R_gas = self.air_data.R_air
Example #2
0
"""
# Archivo de defición de un generador de gas
# Se define comrpesor, cámara de combustión y turbina 
"""

from air_model import RealGas
from isentropic_gas import IsentropicGas

# Carga de funciones:
air = RealGas(cp_option='naca', gamma_option='standard')
gas = IsentropicGas(selected_cp_air_model='naca',
                    selected_gamma_air_model='standard')

# Datos Cámara de combustión
rend_comb = 0.95  # rendimiento de la combustión
heating_value = 42e6  # J. poder calorífico del combustible
f = 0.02  # dosado = c/G
pi_comb = 0.95  # relación de presiones tras la cámara de combustión


# Función rendimiento de la turbina
def rend_turb(x):
    if x < 1000:
        return 0.88
    elif x > 2000:
        return 0.95
    else:
        return ((x - 1000) * 0.1 / 1000) + 0.88


# Función rendimiento compresor
Example #3
0
pyturb
air_model.py tests

M Rodriguez
"""


from air_model import RealGas, IdealGas


ig = IdealGas()
print(ig.cp_air())
print(ig.cv_air())
print(ig.gamma_air())

rg = RealGas(cp_option='naca', gamma_option='naca')
print(rg.cp_air(273),  rg.gamma_air(273), rg.cv_air(273))

rg = RealGas(cp_option='nasa', gamma_option='naca')
print(rg.cp_air(273),  rg.gamma_air(273), rg.cv_air(273))

rg = RealGas('nasa', 'standard')
print(rg.cp_air(2000), rg.gamma_air(2000))

rg = RealGas('low-pressure')
print(rg.cp_air(273))

rg = RealGas('aaa', 'bbb')
print(rg.cp_air(273), rg.gamma_air(273))

print(rg.R_air)