forked from ngloria1/PropSim
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved HybridModel out of Integration.m
- Loading branch information
Showing
3 changed files
with
102 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; Name diameter(mm) Length(mm) delay propellant_weight(kg) mass(kg) | ||
O6900-I 143 2438 P 3.85 15.79 SSI | ||
0.010 1320.418 | ||
0.200 1561.631 | ||
0.400 1546.229 | ||
0.590 1531.306 | ||
0.790 1516.129 | ||
0.980 1500.406 | ||
1.180 1482.341 | ||
1.370 1466.933 | ||
1.570 1451.104 | ||
1.760 1434.491 | ||
1.960 1417.684 | ||
2.150 1401.527 | ||
2.350 1384.385 | ||
2.540 1368.230 | ||
2.740 1352.983 | ||
2.930 1337.996 | ||
3.130 1322.032 | ||
3.320 1307.148 | ||
3.520 1290.261 | ||
3.710 1275.134 | ||
3.910 1259.703 | ||
4.100 1245.385 | ||
4.300 1230.102 | ||
4.490 1215.732 | ||
4.690 1200.258 | ||
4.880 490.540 | ||
5.080 428.407 | ||
5.270 376.835 | ||
5.470 329.905 | ||
5.655 0.000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
function x_dot = HybridModel(time,x,inputs,mode) | ||
% Model engine physics for a hybrid motor, provide state vector derivative | ||
|
||
%% Initialization of State Properties | ||
state = HybridStateVector.FromColumnVector(x, inputs, mode); | ||
|
||
state_dot = HybridStateVector(); | ||
|
||
%% Calculate Injector Mass Flow Rate | ||
[m_dot_lox, m_dot_gox, m_dot_oxtank_press, T_dot_drain, p_crit, m_dot_ox_crit] = ... | ||
N2OTankMDot(inputs, state, time); | ||
[m_dot_vap, T_dot_vap] = N2OTankEquilibrium(inputs, state); | ||
|
||
state_dot.m_lox = -m_dot_lox - m_dot_vap; | ||
state_dot.m_gox = -m_dot_gox + m_dot_vap; | ||
state_dot.m_oxtank_press = -m_dot_oxtank_press; | ||
state_dot.T_oxtank = T_dot_drain + T_dot_vap; | ||
|
||
m_dot_ox = m_dot_lox + m_dot_gox; | ||
|
||
%% Combustion Dynamics | ||
if mode.combustion_on % for hot fire only | ||
[m_dot_f, r_dot] = HybridMdotFuel(inputs, state, m_dot_ox); | ||
|
||
[F_thrust, OF, M_e, p_exit, p_shock, m_cc_dot, M_cc_dot, ... | ||
gamma_cc_dot, T_cc_dot] = CombustionChamber(inputs, state, m_dot_ox, m_dot_f); | ||
else % no combustion (cold flow) | ||
m_dot_f = 0; | ||
r_dot = 0; | ||
|
||
F_thrust = 0; | ||
OF = 0; | ||
M_e = 0; | ||
p_exit = inputs.p_amb; | ||
p_shock = 0; | ||
m_cc_dot = 0; | ||
M_cc_dot = 0; | ||
gamma_cc_dot = 0; | ||
T_cc_dot = 0; | ||
end | ||
state_dot.m_fuel = -m_dot_f; | ||
state_dot.m_cc = m_cc_dot; | ||
state_dot.M_cc = M_cc_dot; | ||
state_dot.gamma_cc = gamma_cc_dot; | ||
state_dot.T_cc = T_cc_dot; | ||
|
||
%% Pressurant Flow | ||
if inputs.ox_pressurant.active | ||
[T_dot_press, m_dot_press] = PressurantFlow(state.p_oxpresstank, ... | ||
state.T_oxpresstank, state.p_oxtank, state.T_oxtank, ... | ||
state.oxtank_m_cv, inputs.ox_pressurant); | ||
else | ||
T_dot_press = 0; | ||
m_dot_press = 0; | ||
end | ||
state_dot.T_oxtank = state_dot.T_oxtank + T_dot_press; | ||
state_dot.m_oxtank_press = m_dot_press; | ||
state_dot.m_oxpresstank = -m_dot_press; | ||
|
||
%% Generate column vector | ||
x_dot = state_dot.ColumnVector; | ||
HybridRecord(time, state, state_dot, F_thrust, p_crit, ... | ||
m_dot_ox_crit, M_e, p_exit, p_shock); | ||
|
||
% fprintf('time: %.3f \n', time) | ||
% fprintf('%.3g\t', x_dot) | ||
% fprintf('\n') | ||
% fprintf('%% (Ptank - Pvap)/Pvap: %.1f\n', 100*(state.p_gox - state.N2O_properties.Pvap)/state.N2O_properties.Pvap) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters