def climb(self, tas, alt, roc): """Calculate thrust during the climb. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude(ft) roc (float or ndarray): Vertical rate (ft/min). Returns: float or ndarray: Total thrust (unit: N). """ roc = np.abs(roc) h = alt * aero.ft tas = np.where(tas < 10, 10, tas) mach = aero.tas2mach(tas * aero.kts, h) vcas = aero.tas2cas(tas * aero.kts, h) P = aero.pressure(h) P10 = aero.pressure(10000 * aero.ft) Pcr = aero.pressure(self.cruise_alt * aero.ft) # approximate thrust at top of climb (REF 2) Fcr = self.eng_cruise_thrust * self.eng_number vcas_ref = aero.mach2cas(self.cruise_mach, self.cruise_alt * aero.ft) # segment 3: alt > 30000: d = self._dfunc(mach / self.cruise_mach) b = (mach / self.cruise_mach)**(-0.11) ratio_seg3 = d * np.log(P / Pcr) + b # segment 2: 10000 < alt <= 30000: a = (vcas / vcas_ref)**(-0.1) n = self._nfunc(roc) ratio_seg2 = a * (P / Pcr)**(-0.355 * (vcas / vcas_ref) + n) # segment 1: alt <= 10000: F10 = Fcr * a * (P10 / Pcr)**(-0.355 * (vcas / vcas_ref) + n) m = self._mfunc(vcas / vcas_ref, roc) ratio_seg1 = m * (P / Pcr) + (F10 / Fcr - m * (P10 / Pcr)) ratio = np.where(alt > 30000, ratio_seg3, np.where(alt > 10000, ratio_seg2, ratio_seg1)) F = ratio * Fcr return F
def takeoff(self, tas, alt=None): """Calculate thrust during the takeoff. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude of the runway (ft). Defaults to 0. Returns: float or ndarray: Total thrust (unit: N). """ mach = aero.tas2mach(tas*aero.kts, 0) eng_bpr = self.eng_bpr G0 = 0.0606 * self.eng_bpr + 0.6337 if alt is None: # at sea level ratio = 1 - 0.377 * (1+eng_bpr) / np.sqrt((1+0.82*eng_bpr)*G0) * mach \ + (0.23 + 0.19 * np.sqrt(eng_bpr)) * mach**2 else: # at certain altitude P = aero.pressure(alt * aero.ft) dP = P / aero.p0 A = -0.4327 * dP**2 + 1.3855 * dP + 0.0472 Z = 0.9106 * dP**3 - 1.7736 * dP**2 + 1.8697 * dP X = 0.1377 * dP**3 - 0.4374 * dP**2 + 1.3003 * dP ratio = A - 0.377 * (1+eng_bpr) / np.sqrt((1+0.82*eng_bpr)*G0) * Z * mach \ + (0.23 + 0.19 * np.sqrt(eng_bpr)) * X * mach**2 F = ratio * self.eng_max_thrust * self.eng_number return F