def compute_next_flight_point( self, flight_points: List[FlightPoint], time_step: float ) -> FlightPoint: """ Computes time, altitude, speed, mass and ground distance of next flight point. :param flight_points: previous flight points :param time_step: time step for computing next point :return: the computed next flight point """ start = flight_points[0] previous = flight_points[-1] next_point = FlightPoint() next_point.mass = previous.mass - self.propulsion.get_consumed_mass(previous, time_step) next_point.time = previous.time + time_step next_point.ground_distance = ( previous.ground_distance + previous.true_airspeed * time_step * np.cos(previous.slope_angle) ) self._compute_next_altitude(next_point, previous) if self.target.true_airspeed == "constant": next_point.true_airspeed = previous.true_airspeed elif self.target.equivalent_airspeed == "constant": next_point.equivalent_airspeed = start.equivalent_airspeed elif self.target.mach == "constant": next_point.mach = start.mach else: next_point.true_airspeed = previous.true_airspeed + time_step * previous.acceleration # The naming is not done in complete_flight_point for not naming the start point next_point.name = self.name return next_point
def _complete_speed_values(flight_point: FlightPoint): """ Computes consistent values between TAS, EAS and Mach, assuming one of them is defined. """ atm = AtmosphereSI(flight_point.altitude) if flight_point.true_airspeed is None: if flight_point.mach is not None: flight_point.true_airspeed = flight_point.mach * atm.speed_of_sound elif flight_point.equivalent_airspeed is not None: flight_point.true_airspeed = atm.get_true_airspeed( flight_point.equivalent_airspeed) else: raise FastFlightSegmentIncompleteFlightPoint( "Flight point should be defined for true_airspeed, " "equivalent_airspeed, or mach.") if flight_point.mach is None: flight_point.mach = flight_point.true_airspeed / atm.speed_of_sound if flight_point.equivalent_airspeed is None: flight_point.equivalent_airspeed = atm.get_equivalent_airspeed( flight_point.true_airspeed)