def _get_data(self): self._get_coefficients() self.Nz = 1.5 * self.ac.designGoals.loadFactor # ultimate load factor self.Wdg = convert.kg_to_lb(self.ac.designGoals.grossMass) self.Nl = self.ac.designGoals.loadFactorLanding self.Wt = self.Wdg self.Wl = self.Wdg self.Ne = self.ac.propulsion.numberOfEngines self.T = convert.kgf_to_lbf(self.ac.propulsion.totalThrust) self.mUav = convert.kg_to_lb(self.ac.designGoals.avionicsMass) Vi = self.ac.designGoals.fuelMass/self.fuelProp['kerosene'] self.Vi = convert.cubm_to_gal(Vi)
def bot_convert(value, unit): #Not only will this change the value to be able to be calculated, it will detect whether or #not "value" is a number. Will raise ValueError if not. value = float(value) print("Value is a number!") print("Start conversion...") if unit == "cm": converted = convert.cm_to_inches(value) conv_unit = "inches" #If the total amount of inches is larger than 12, convert it so that it will be #shown as feet and inches (e.g 58 inches -> 4'10) if converted > 12: feet,inches = convert.feet_and_inches(converted) converted = str(feet) + "'" + str(inches) + "''" conv_unit = "feet and inches" elif unit == "inches" or unit == "inch": converted = convert.inches_to_cm(value) conv_unit = "cm" elif unit == "lb": converted = convert.lb_to_kg(value) conv_unit = "kg" elif unit == "kg": converted = convert.kg_to_lb(value) conv_unit = "lb" elif unit == "fahrenheit": converted = convert.f_to_c(value) conv_unit = "°C" elif unit == "celsius": converted = convert.c_to_f(value) conv_unit = "°F" else: raise InvalidUnitError print("Conversion has been successful!") converted = str(converted) return converted, conv_unit
def run_test5(): import convert ac = load('X47B') mis = mission_profile.load('profile3') wf = ac.get_mission_fuel(mis) wTO = ac.get_mass() wE = ac.get_mass_empty() print convert.kg_to_lb(wf) print convert.kg_to_lb(wTO) print convert.kg_to_lb(wE)
def _mass_engine_section(self): cg = self.emptyMass.get_item_cg_by_name('engine') We = convert.kg_to_lb(self.ac.propulsion.engine.mass) m = 0.01*We**0.717*self.Ne*self.Nz self._add_mass1('engine section',m,cg)