forked from ngloria1/PropSim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SimulateLiquid.m
155 lines (110 loc) · 3.83 KB
/
SimulateLiquid.m
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
%% Run Performance Code
addpath(fullfile(pwd, 'Supporting Functions'))
clear
close all
% Unit Conversion
psi_to_Pa = 6894.75729; % 1 psi in Pa
in_to_m = 0.0254; % 1 in in m
mm_to_m = 1e-3; % 1 mm in m
lbf_to_N = 4.44822162; % 1 lbf in N
lbm_to_kg = 0.453592; % 1 lbm in kg
atm_to_Pa = 101325; % 1 atm in Pa
L_to_m3 = 1e-3; % 1 L in m^3
%% Options
test_data.test_plots_on = 0; % Import tests data and plot against simulation data
test_data.test_data_file = '5_13_18_data.mat'; % File from which to import test data
test_data.t_offset = 0; % Time offset of test data wrt simulation data [s]
% 1: simulate combustion (hot fire), 0: no combustion (cold flow)
mode.combustion_on = 1;
% 1: simulate flight conditions (i.e. acceleration head), 0: ground test
% conditions
mode.flight_on = 0;
% 'hybrid' for solid fuel, liquid oxidizer, 'liquid' for liquid fuel and
% oxidizer
mode.type = 'liquid';
%% Input Parameters
inputs.CombustionData = fullfile('Combustion Data', 'CombustionData_T1_N2O.mat');
%-------Gases-----------------------
helium = Gas();
helium.c_v = 3.12; % J/kg*K
helium.molecular_mass = 4.0026e-3; % kg/mol
nitrogen = Gas();
nitrogen.c_v = 0.743e3; % J/kg*K
nitrogen.molecular_mass = 2*14.0067e-3; % kg/mol
%-------Injector Properties----------
%Injector Exit Area
inputs.ox.injector_area = 27.3*mm_to_m^2;
inputs.fuel.injector_area = 2.1*mm_to_m^2;
% Ball Valve Time to Injector Area (s)
inputs.dt_valve_open = 0.01;
%Discharge Coefficient
inputs.ox.Cd_injector = 1;
inputs.fuel.Cd_injector = 1;
%-------Rocket Properties--------
%Rocket Dry Mass
inputs.mass_dry_rocket = 50*lbm_to_kg;
%-------Oxidizer Properties--------
%Tank Volume
inputs.ox.V_tank = 6.63*L_to_m3;
%Nitrous Volume
inputs.ox.V_l = 0.66*6.03*L_to_m3;
%Tank Inner Diameter
inputs.ox.tank_id = 3.75*in_to_m;
%Distance from Bottom of Tank to Injector
inputs.ox.h_offset_tank = 0*in_to_m;
%Main Flow Line Diameter
inputs.ox.d_flowline = .25*in_to_m;
%Tank Temperature (K)
inputs.ox.T_tank = 287.99043;
%-------Oxidizer Pressurant Properties--------
inputs.ox_pressurant = Pressurant('oxidizer');
inputs.ox_pressurant.gas_properties = helium;
inputs.ox_pressurant.set_pressure = 700*psi_to_Pa;
inputs.ox_pressurant.storage_initial_pressure = 4500*psi_to_Pa;
inputs.ox_pressurant.tank_volume = 3.5*L_to_m3;
inputs.ox_pressurant.flow_CdA = 8*mm_to_m^2;
%Are You Supercharging? (0 for 'NO' 1 for 'YES')
inputs.ox_pressurant.active = 0;
%-------Fuel Properties--------
%Tank Volume
inputs.fuel.V_tank = 1.88*L_to_m3;
%Fuel Volume
inputs.fuel.V_l = 0.66*1.00*L_to_m3;
%Tank Inner Diameter
inputs.fuel.tank_id = 3.75*in_to_m;
%Distance from Bottom of Tank to Injector
inputs.fuel.h_offset_tank = 24*in_to_m;
%Main Flow Line Diameter(in)
inputs.fuel.d_flowline = .25*in_to_m;
inputs.fuel.rho = 795; %Kg/m^3
%-------Fuel Pressurant Properties--------
inputs.fuel_pressurant = Pressurant('fuel');
inputs.fuel_pressurant.gas_properties = nitrogen;
inputs.fuel_pressurant.set_pressure = 650*psi_to_Pa;
inputs.fuel_pressurant.storage_initial_pressure = 4500*psi_to_Pa;
inputs.fuel_pressurant.tank_volume = 0.0*L_to_m3;
inputs.fuel_pressurant.flow_CdA = 8*mm_to_m^2;
%Are You Supercharging? (0 for 'NO' 1 for 'YES')
inputs.fuel_pressurant.active = 1;
%-------Other Properties--------
%Combustion chamber dimensions
inputs.length_cc = 4*in_to_m;
inputs.d_cc = 3.75*in_to_m;
%Estimated nozzle efficiency
inputs.nozzle_efficiency = 0.95;
inputs.nozzle_correction_factor = 0.9830;
%Estimated combustion efficiency
inputs.c_star_efficiency = 0.85;
%Nozzle Throat diameter
inputs.d_throat = 2.388e-2;
%Expansion Ratio
inputs.exp_ratio = 3.5;
%Ambient Temperature
inputs.T_amb = 280;
%Ambient Pressure
inputs.p_amb = 12.5*psi_to_Pa;
% Load Combustion Data
inputs.comb_data = load(inputs.CombustionData);
inputs.comb_data = inputs.comb_data.CombData;
%% Run Performance Code
PerformanceCode(inputs, mode, test_data);