def calculate(self, prop, p1, pe): try: self.calc_prop = prop self.p1 = p1/14.696 #converting psi to atm self.pe = pe/14.696 ppp.init() self.p = ppp.FrozenPerformance() self.calc_prop_var = [0]*len(self.calc_prop) list_tuple = [] self.prop_weight = 0 self.propellant_list = [] for i in range(0, len(self.calc_prop)): self.propellant_list.append(self.calc_prop[i][0]) self.calc_prop_var[i] = ppp.PROPELLANTS[self.calc_prop[i][0]] self.prop_weight += float(self.calc_prop[i][1]) list_tuple.append((self.calc_prop_var[i], float(self.calc_prop[i][1]))) self.p.add_propellants_by_mass(list_tuple) self.p.set_state(P = float(self.p1), Pe = float(self.pe)) self.calculate_button.config(state = 'disabled') self.display_button.config(state = 'active') self.reset_button.grid(column = 2, row = 7, columnspan = 2, rowspan = 2, sticky = 'n') self.validation_label.configure(text = "Total Weight: " + str(self.prop_weight), fg = 'white', bg = "#222831") #self.validation_label.configure(text = "Sucess :)", bg = 'green', fg = 'white', font = ("Garamond", 20)) propellant_calculations.prop_variable = self.p global outsidep outsidep = self.p except Exception as e: print("ERROR") self.validation_label.configure(text = "System Error :/", fg = 'white', bg = 'red')
def test_frozen_performance(pypropep): p = pypropep.FrozenPerformance() lh2 = pypropep.PROPELLANTS['HYDROGEN (CRYOGENIC)'] lox = pypropep.PROPELLANTS['OXYGEN (LIQUID)'] # The below is from Sutton pg. 181 OF = 5.551 N_lh2 = 1.0 / lh2.mw N_lox = OF / lox.mw p.add_propellants([(lh2, N_lh2), (lox, N_lox)]) p.set_state(P=53.317*0.986923, Ae_At=25.) #assert p.performance.cstar == pytest.approx(2332.1, 1e-2) assert p.properties[0].T == pytest.approx(3389, 1e-2) assert p.composition['exit'][0][1] > 0.1 assert len(p.composition_condensed['exit']) == 0 print(p)
def test_properties(pypropep): p = pypropep.FrozenPerformance() ps = pypropep.ShiftingPerformance() e = pypropep.Equilibrium() lh2 = pypropep.PROPELLANTS['RP-1 (RPL)'] lox = pypropep.PROPELLANTS['OXYGEN (LIQUID)'] OF = 0.13 p.add_propellants_by_mass([(lh2, 1.0), (lox, OF)]) p.set_state(P=30, Ae_At=25.) ps.add_propellants_by_mass([(lh2, 1.0), (lox, OF)]) ps.set_state(P=30, Ae_At=25.) e.add_propellants_by_mass([(lh2, 1.0), (lox, OF)]) e.set_state(P=30, type='HP') assert p.properties[0].T == pytest.approx(ps.properties[0].T, 1e-2) assert p.properties[0].Cp == pytest.approx(ps.properties[0].Cp, 1e-2) assert p.properties[0].Isex == pytest.approx(ps.properties[0].Isex, 1e-2) assert p.properties[0].Cv == pytest.approx(ps.properties[0].Cv, 1e-2) assert p.properties[0].T == pytest.approx(e.properties.T, 1e-2) assert p.properties[0].Cp == pytest.approx(e.properties.Cp, 1e-2) assert p.properties[0].Isex == pytest.approx(e.properties.Isex, 1e-2) assert p.properties[0].Cv == pytest.approx(e.properties.Cv, 1e-2)
rc('xtick', labelsize='small') rc('ytick', labelsize='small') li = ppp.PROPELLANTS['LITHIUM (PURE CRYSTALINE)'] f2 = ppp.PROPELLANTS['FLUORINE (LIQUID)'] h2 = ppp.PROPELLANTS['HYDROGEN (GASEOUS)'] Pt = 70. Pe = .01 OF = np.linspace(2, 4) C = np.zeros([len(OF), 2]) T = np.zeros_like(OF) for i in range(len(OF)): fp = ppp.FrozenPerformance() m_f2 = 0.2 m_h2 = OF[i] m_Li = 0.3 fp.add_propellants([(li, m_Li), (h2, m_h2), (f2, m_f2)]) fp.set_state(P=Pt, Pe=Pe) T[i] = fp.properties[0].T C[i] = fp.performance.Isp f = plt.figure() plt.title('Lithium/Fluorine/Hydrogen System')