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: Optional[fastoad.model_base.flight_point.FlightPoint] = None)[source]

Bases: fastoad.models.performances.mission.base.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: fastoad.model_base.flight_point.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.

class fastoad.models.performances.mission.segments.macro_segments.MacroSegmentMeta(cls_name, bases, attrs, *, cls_sequence=None)[source]

Bases: abc.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’.