fastoad.models.performances.mission.segments.base module

Base classes for simulating flight segments.

class fastoad.models.performances.mission.segments.base.SegmentDefinitions(value=<no_arg>, names=None, module=None, type=None, start=1, boundary=None)[source]

Bases: aenum.Enum

Class that associates segment names (mission file keywords) and their implementation.

classmethod add_segment(segment_name: str, segment_class: type)[source]

Adds a segment definition.

Parameters
  • segment_name – segment names (mission file keyword)

  • segment_class – segment implementation (derived of FlightSegment)

classmethod get_segment_class(segment_name) type[source]

Provides the segment implementation for provided name.

Parameters

segment_name

Returns

the segment implementation (derived of FlightSegment)

altitude_change = <class 'fastoad.models.performances.mission.segments.altitude_change.AltitudeChangeSegment'>
optimal_cruise = <class 'fastoad.models.performances.mission.segments.cruise.OptimalCruiseSegment'>
cruise = <class 'fastoad.models.performances.mission.segments.cruise.ClimbAndCruiseSegment'>
breguet = <class 'fastoad.models.performances.mission.segments.cruise.BreguetCruiseSegment'>
speed_change = <class 'fastoad.models.performances.mission.segments.speed_change.SpeedChangeSegment'>
holding = <class 'fastoad.models.performances.mission.segments.hold.HoldSegment'>
taxi = <class 'fastoad.models.performances.mission.segments.taxi.TaxiSegment'>
transition = <class 'fastoad.models.performances.mission.segments.transition.DummyTransitionSegment'>
class fastoad.models.performances.mission.segments.base.FlightSegment(target: fastoad.model_base.flight_point.FlightPoint, propulsion: fastoad.model_base.propulsion.IPropulsion, polar: fastoad.models.performances.mission.polar.Polar, reference_area: float, time_step: float = 0.2, engine_setting: fastoad.constants.EngineSetting = EngineSetting.CLIMB, altitude_bounds: tuple = (- 500.0, 40000.0), mach_bounds: tuple = (0.0, 5.0), name: str = '', interrupt_if_getting_further_from_target: bool = True)[source]

Bases: fastoad.models.performances.mission.base.IFlightPart

Base class for flight path segment.

As a dataclass, attributes can be set at instantiation.

When subclassing this class, the attribute “mission_file_keyword” can be set, so that the segment can be used in mission file definition with this keyword:

>>> class NewSegment(FlightSegment, mission_file_keyword="new_segment")
>>>     ...

Then in mission definition:

phases:
    my_phase:
        parts:
            - segment: new_segment
target: fastoad.model_base.flight_point.FlightPoint

A FlightPoint instance that provides parameter values that should all be reached at the end of compute_from(). Possible parameters depend on the current segment. A parameter can also be set to CONSTANT_VALUE to tell that initial value should be kept during all segment.

propulsion: fastoad.model_base.propulsion.IPropulsion

A IPropulsion instance that will be called at each time step.

polar: fastoad.models.performances.mission.polar.Polar

The Polar instance that will provide drag data.

reference_area: float

The reference area, in m**2.

time_step: float = 0.2

Used time step for computation (actual time step can be lower at some particular times of the flight path).

engine_setting: fastoad.constants.EngineSetting = 2

The EngineSetting value associated to the segment. Can be used in the propulsion model.

altitude_bounds: tuple = (-500.0, 40000.0)

Minimum and maximum authorized altitude values. If computed altitude gets beyond these limits, computation will be interrupted and a warning message will be issued in logger.

mach_bounds: tuple = (0.0, 5.0)

Minimum and maximum authorized mach values. If computed Mach gets beyond these limits, computation will be interrupted and a warning message will be issued in logger.

name: str = ''

The name of the current flight sequence.

interrupt_if_getting_further_from_target: bool = True

If True, computation will be interrupted if a parameter stops getting closer to target between two iterations (which can mean the provided thrust rate is not adapted).

CONSTANT_VALUE = 'constant'

Using this value will tell to keep the associated parameter constant.

compute_from(start: fastoad.model_base.flight_point.FlightPoint) pandas.core.frame.DataFrame[source]

Computes the flight path segment from provided start point.

Computation ends when target is attained, or if the computation stops getting closer to target. For instance, a climb computation with too low thrust will only return one flight point, that is the provided start point.

Parameters

start – the initial flight point, defined for altitude, mass and speed (true_airspeed, equivalent_airspeed or mach). Can also be defined for time and/or ground_distance.

Returns

a pandas DataFrame where columns names match fields of FlightPoint()

compute_next_flight_point(flight_points: List[fastoad.model_base.flight_point.FlightPoint], time_step: float) fastoad.model_base.flight_point.FlightPoint[source]

Computes time, altitude, speed, mass and ground distance of next flight point.

Parameters
  • flight_points – previous flight points

  • time_step – time step for computing next point

Returns

the computed next flight point

complete_flight_point(flight_point: fastoad.model_base.flight_point.FlightPoint)[source]

Computes data for provided flight point.

Assumes that it is already defined for time, altitude, mass, ground distance and speed (TAS, EAS, or Mach).

Parameters

flight_point – the flight point that will be completed in-place

abstract get_distance_to_target(flight_points: List[fastoad.model_base.flight_point.FlightPoint]) float[source]

Computes a “distance” from last flight point to target.

Computed does not need to have a real meaning. The important point is that it must be signed so that algorithm knows on which “side” of the target we are. And of course, it should be 0. if flight point is on target.

Parameters

flight_points – list of all currently computed flight_points

Returns

  1. if target is attained, a non-null value otherwise

abstract compute_propulsion(flight_point: fastoad.model_base.flight_point.FlightPoint)[source]

Computes propulsion data.

Provided flight point is modified in place.

Generally, this method should end with:

self.propulsion.compute_flight_points(flight_point)
Parameters

flight_point

abstract get_gamma_and_acceleration(flight_point: fastoad.model_base.flight_point.FlightPoint) Tuple[float, float][source]

Computes slope angle (gamma) and acceleration.

Parameters

flight_point – parameters after propulsion model has been called (i.e. mass, thrust and drag are available)

Returns

slope angle in radians and acceleration in m**2/s

class fastoad.models.performances.mission.segments.base.ManualThrustSegment(target: fastoad.model_base.flight_point.FlightPoint, propulsion: fastoad.model_base.propulsion.IPropulsion, polar: fastoad.models.performances.mission.polar.Polar, reference_area: float, time_step: float = 0.2, engine_setting: fastoad.constants.EngineSetting = EngineSetting.CLIMB, altitude_bounds: tuple = (- 500.0, 40000.0), mach_bounds: tuple = (0.0, 5.0), name: str = '', interrupt_if_getting_further_from_target: bool = True, thrust_rate: float = 1.0)[source]

Bases: fastoad.models.performances.mission.segments.base.FlightSegment, abc.ABC

Base class for computing flight segment where thrust rate is imposed.

Variables

thrust_rate – used thrust rate. Can be set at instantiation using a keyword argument.

thrust_rate: float = 1.0
compute_propulsion(flight_point: fastoad.model_base.flight_point.FlightPoint)[source]

Computes propulsion data.

Provided flight point is modified in place.

Generally, this method should end with:

self.propulsion.compute_flight_points(flight_point)
Parameters

flight_point

class fastoad.models.performances.mission.segments.base.RegulatedThrustSegment(target: fastoad.model_base.flight_point.FlightPoint, propulsion: fastoad.model_base.propulsion.IPropulsion, polar: fastoad.models.performances.mission.polar.Polar, reference_area: float, time_step: float = 60.0, engine_setting: fastoad.constants.EngineSetting = EngineSetting.CLIMB, altitude_bounds: tuple = (- 500.0, 40000.0), mach_bounds: tuple = (0.0, 5.0), name: str = '', interrupt_if_getting_further_from_target: bool = True)[source]

Bases: fastoad.models.performances.mission.segments.base.FlightSegment, abc.ABC

Base class for computing flight segment where thrust rate is adjusted on drag.

time_step: float = 60.0

Used time step for computation (actual time step can be lower at some particular times of the flight path).

compute_propulsion(flight_point: fastoad.model_base.flight_point.FlightPoint)[source]

Computes propulsion data.

Provided flight point is modified in place.

Generally, this method should end with:

self.propulsion.compute_flight_points(flight_point)
Parameters

flight_point

get_gamma_and_acceleration(flight_point: fastoad.model_base.flight_point.FlightPoint) Tuple[float, float][source]

Computes slope angle (gamma) and acceleration.

Parameters

flight_point – parameters after propulsion model has been called (i.e. mass, thrust and drag are available)

Returns

slope angle in radians and acceleration in m**2/s

class fastoad.models.performances.mission.segments.base.FixedDurationSegment(target: fastoad.model_base.flight_point.FlightPoint, propulsion: fastoad.model_base.propulsion.IPropulsion, polar: fastoad.models.performances.mission.polar.Polar, reference_area: float, time_step: float = 60.0, engine_setting: fastoad.constants.EngineSetting = EngineSetting.CLIMB, altitude_bounds: tuple = (- 500.0, 40000.0), mach_bounds: tuple = (0.0, 5.0), name: str = '', interrupt_if_getting_further_from_target: bool = True)[source]

Bases: fastoad.models.performances.mission.segments.base.FlightSegment, abc.ABC

Class for computing phases where duration is fixed.

Target duration is provide as target.time. When using compute_from(), if start.time is not 0, end time will be start.time + target.time.

time_step: float = 60.0

Used time step for computation (actual time step can be lower at some particular times of the flight path).

compute_from(start: fastoad.model_base.flight_point.FlightPoint) pandas.core.frame.DataFrame[source]

Computes the flight path segment from provided start point.

Computation ends when target is attained, or if the computation stops getting closer to target. For instance, a climb computation with too low thrust will only return one flight point, that is the provided start point.

Parameters

start – the initial flight point, defined for altitude, mass and speed (true_airspeed, equivalent_airspeed or mach). Can also be defined for time and/or ground_distance.

Returns

a pandas DataFrame where columns names match fields of FlightPoint()

get_distance_to_target(flight_points: List[fastoad.model_base.flight_point.FlightPoint]) float[source]

Computes a “distance” from last flight point to target.

Computed does not need to have a real meaning. The important point is that it must be signed so that algorithm knows on which “side” of the target we are. And of course, it should be 0. if flight point is on target.

Parameters

flight_points – list of all currently computed flight_points

Returns

  1. if target is attained, a non-null value otherwise