fastoad.models.performances.mission.segments.macro_segments module

Base for macro-segments.

class fastoad.models.performances.mission.segments.macro_segments.MacroSegmentBase(name: str = '', target: ~fastoad.model_base.flight_point.FlightPoint = <object object>, _target: ~fastoad.model_base.flight_point.FlightPoint = None)[source]

Bases: FlightSequence

Base class for macro-segments.

A macro-segment is a sequence of flight segments. Parameters of the macro-segment drive the parameters of aggregated segments.

A field value will be applied to all segments that have the concerned field. The exception is the target field, that is applied only on last segment.

This class is expected to be used through MacroSegmentMeta. It sets the basic mechanism for aggregating flight segments.

Derived classes are expected to have dataclass fields that match dataclass fields of aggregated segment classes.

target: FlightPoint = <object object>

Target flight point for end of takeoff

cls_sequence = []

List of segment classes that will compose this macro-segment.

build_sequence()[source]

Instantiates all segments, using dataclass field values of this macro-segment.

Since only target of the last segment is set (using target of this macro-segment), derived classes should overload this method to manage at least targets of intermediate segments.

Note: this method is called each time a dataclass field value is modified.

append(flight_part: IFlightPart)

Append flight part to the end of the sequence.

clear()

Remove all parts from flight sequence.

compute_from(start: FlightPoint) DataFrame

Computes a flight sequence from 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 column names match fields of FlightPoint

consumed_mass_before_input_weight: float = 0.0

Consumed mass between sequence start and target mass, if any defined

extend(seq)

Extend flight sequence by appending elements from the iterable.

index(*args, **kwargs)

Return first index of value (see list.index()).

name: str = ''
part_flight_points: List[pd.DataFrame]
class fastoad.models.performances.mission.segments.macro_segments.MacroSegmentMeta(cls_name, bases, attrs, *, cls_sequence=None)[source]

Bases: ABCMeta

Metaclass for macro-segments.

It should be used with

>>> class TakeOffSequence( metaclass=MacroSegmentMeta,
>>>                        cls_sequence=[...],
>>>                      ):

It will make so that the created class will have dataclass fields that match dataclass fields of all classes in ‘cls_sequence’.

mro()

Return a type’s method resolution order.

register(subclass)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.