-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.py
More file actions
74 lines (58 loc) · 3.17 KB
/
input.py
File metadata and controls
74 lines (58 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from dataclasses import dataclass
import data_parse
@dataclass
class Station:
name: str
eta: float = None # Isentropic efficiency
pi: float = None # Pressure ratio
tau: float = None # Temperature ratio
e: float = None # Adiabatic efficiency
var = int(input())
if var == 1:
input_data = data_parse.read_input_json('Turbojet_Afterburner_input.json')
if var == 2:
input_data = data_parse.read_input_json('Turbofan_Mixed_Exhaust_input.json')
# ---- Constants ----
Constants = input_data['Constants']
Other_constants = input_data['Other_inputs']
GAMMA_C = Constants['GAMMA_C'] # Ratio of specific heats for air
GAMMA_T = Constants["GAMMA_T"] # Ratio of specific heats for combustion gases
GAMMA_AB = Constants["GAMMA_AB"] # Ratio of specific heats for afterburner gases
GAMMA_m = Constants["GAMMA_M"] # Ratio of specific heats for mixer gases
R = 287 # Specific gas constant for air in J/(kg·K)
CP_C = Constants["CP_C"] # Specific heat at constant pressure for air in J/(kg·K)
CP_T = Constants["CP_T"] # Specific heat at constant pressure for combustion gases in J/(kg·K)
CP_AB = Constants["CP_AB"] # Specific heat at constant pressure for afterburner gases in J/(kg·K)
CP_M = Constants["CP_M"] # Specific heat at constant pressure for mixer gases
QR = Constants["QR"] # Heat release from fuel in J/kg
QR_AB = Constants["QR_AB"] # Heat release from afterburner fuel in J/kg
"""Needs to be extracted from json file data"""
Freestream = Station("Freestream")
Inlet = Station("Inlet")
Compressor = Station("Compressor")
Burner = Station("Burner")
Turbine = Station("Turbine")
Nozzle = Station("Nozzle")
Mixer = Station("Mixer")
Afterburner = Station("Afterburner")
Fan = Station("Fan")
station_tuple = (Freestream, Inlet, Compressor, Burner, Turbine, Nozzle, Mixer, Afterburner, Fan)
for s in station_tuple:
s.eta, s.pi, s.tau, s.e = input_data['Stations'][s.name].values()
# ---- Input Conditions ----
M0 = Other_constants["M0"] # Freestream Mach number
T0 = Other_constants["T0"] # Freestream temperature in K
P0 = Other_constants["P0"] # Freestream pressure in Pa
tau_lambda_input = Other_constants["tau_lambda"] # Burner outlet and freestream temperature ratio
f_input = Other_constants["f"] # Fuel-to-air ratio
Burner_outlet_temp = Other_constants["Burner_outlet_temp"] # Burner outlet temperature in K
eta_m = Other_constants["Turbine_mechanical_efficiency"] # Mechanical efficiency of turbine
tau_lambda_ab = Other_constants["tau_lambda_ab"] # Afterburner fuel-to-air temperature ratio
f_ab_input = Other_constants["f_ab"] # Afterburner fuel-to-air ratio
Afterburner_outlet_temp = Other_constants["Afterburner_outlet_temp"] # Afterburner outlet temperature in K
pi_fd = Other_constants["pi_fd"] # Mixer fan pressure ratio
M5 = Other_constants["M5"] # Mixer cold stream Mach number
M15 = Other_constants["M15"] # Mixer hot stream Mach number
pi_Mf = Other_constants["pi_fd"] # Mixer fan pressure ratio
p_ratio = Other_constants["p_ratio"] # P9 / P0
NPR = Other_constants["NPR"] # Nozzle pressure ratio Pt7/P0