fastoad.model_base.propulsion module

Base classes for propulsion components.

class fastoad.model_base.propulsion.IPropulsion[source]

Bases: ABC

Interface that should be implemented by propulsion models.

Using this class allows to delegate to the propulsion model the management of propulsion-related data when computing performances.

The performance model calls compute_flight_points() by providing one or several flight points. The method will feed these flight points with results of the model (e.g. thrust, SFC, ..).

The performance model will then be able to call get_consumed_mass() to know the mass consumption for each flight point.

Note:

If the propulsion model needs fields that are not among defined fields
of the :class`FlightPoint class`, these fields can be made authorized by
:class`FlightPoint class`. Please see part about extensibility in
:class`FlightPoint class` documentation.
abstract compute_flight_points(flight_points: Union[FlightPoint, DataFrame])[source]

Computes Specific Fuel Consumption according to provided conditions.

See FlightPoint for available fields that may be used for computation. If a DataFrame instance is provided, it is expected that its columns match field names of FlightPoint (actually, the DataFrame instance should be generated from a list of FlightPoint instances).

Note

About thrust_is_regulated, thrust_rate and thrust

thrust_is_regulated tells if a flight point should be computed using thrust_rate (when False) or thrust (when True) as input. This way, the method can be used in a vectorized mode, where each point can be set to respect a thrust order or a thrust rate order.

  • if thrust_is_regulated is not defined, the considered input will be the defined one between thrust_rate and thrust (if both are provided, thrust_rate will be used)

  • if thrust_is_regulated is True or False (i.e., not a sequence), the considered input will be taken accordingly, and should of course be defined.

  • if there are several flight points, thrust_is_regulated is a sequence or array, thrust_rate and thrust should be provided and have the same shape as thrust_is_regulated:code:. The method will consider for each element which input will be used according to thrust_is_regulated.

Parameters

flight_points – FlightPoint or DataFram instance

Returns

None (inputs are updated in-place)

abstract get_consumed_mass(flight_point: FlightPoint, time_step: float) float[source]

Computes consumed mass for provided flight point and time step.

This method should rely on FlightPoint fields that are generated by :meth: compute_flight_points.

Parameters
  • flight_point

  • time_step

Returns

the consumed mass in kg

class fastoad.model_base.propulsion.IOMPropulsionWrapper[source]

Bases: object

Interface for wrapping a IPropulsion subclass in OpenMDAO.

The implementation class defines the needed input variables for instantiating the IPropulsion subclass in setup() and use them for instantiation in get_model()

See OMRubberEngineWrapper for an example of implementation.

abstract setup(component: Component)[source]

Defines the needed OpenMDAO inputs for propulsion instantiation as done in get_model()

Use add_inputs and declare_partials methods of the provided component

Parameters

component

abstract static get_model(inputs) IPropulsion[source]

This method defines the used IPropulsion subclass instance.

Parameters

inputs – OpenMDAO input vector where the parameters that define the propulsion model are

Returns

the propulsion model instance

class fastoad.model_base.propulsion.BaseOMPropulsionComponent(**kwargs)[source]

Bases: ExplicitComponent, ABC

Base class for creating an OpenMDAO component from subclasses of IOMPropulsionWrapper.

Classes that implements this interface should add their own inputs in setup() and implement get_wrapper().

Store some bound methods so we can detect runtime overrides.

setup()[source]

Declare inputs and outputs.

Available attributes:

name pathname comm options

setup_partials()[source]

Declare partials.

This is meant to be overridden by component classes. All partials should be declared here since this is called after all size/shape information is known for all variables.

compute(inputs, outputs, discrete_inputs=None, discrete_outputs=None)[source]

Compute outputs given inputs. The model is assumed to be in an unscaled state.

Parameters
  • inputs (Vector) – Unscaled, dimensional input variables read via inputs[key].

  • outputs (Vector) – Unscaled, dimensional output variables read via outputs[key].

  • discrete_inputs (dict or None) – If not None, dict containing discrete input values.

  • discrete_outputs (dict or None) – If not None, dict containing discrete output values.

abstract static get_wrapper() IOMPropulsionWrapper[source]

This method defines the used IOMPropulsionWrapper instance.

Returns

an instance of OpenMDAO wrapper for propulsion model

class fastoad.model_base.propulsion.AbstractFuelPropulsion[source]

Bases: IPropulsion, ABC

Propulsion model that consume any fuel should inherit from this one.

In inheritors, compute_flight_points() is expected to define “sfc” and “thrust” in computed FlightPoint instances.

get_consumed_mass(flight_point: FlightPoint, time_step: float) float[source]

Computes consumed mass for provided flight point and time step.

This method should rely on FlightPoint fields that are generated by :meth: compute_flight_points.

Parameters
  • flight_point

  • time_step

Returns

the consumed mass in kg

class fastoad.model_base.propulsion.FuelEngineSet(engine: IPropulsion, engine_count)[source]

Bases: AbstractFuelPropulsion

Class for modelling an assembly of identical fuel engines.

Thrust is supposed equally distributed among them.

Parameters
  • engine – the engine model

  • engine_count

compute_flight_points(flight_points: Union[FlightPoint, DataFrame])[source]

Computes Specific Fuel Consumption according to provided conditions.

See FlightPoint for available fields that may be used for computation. If a DataFrame instance is provided, it is expected that its columns match field names of FlightPoint (actually, the DataFrame instance should be generated from a list of FlightPoint instances).

Note

About thrust_is_regulated, thrust_rate and thrust

thrust_is_regulated tells if a flight point should be computed using thrust_rate (when False) or thrust (when True) as input. This way, the method can be used in a vectorized mode, where each point can be set to respect a thrust order or a thrust rate order.

  • if thrust_is_regulated is not defined, the considered input will be the defined one between thrust_rate and thrust (if both are provided, thrust_rate will be used)

  • if thrust_is_regulated is True or False (i.e., not a sequence), the considered input will be taken accordingly, and should of course be defined.

  • if there are several flight points, thrust_is_regulated is a sequence or array, thrust_rate and thrust should be provided and have the same shape as thrust_is_regulated:code:. The method will consider for each element which input will be used according to thrust_is_regulated.

Parameters

flight_points – FlightPoint or DataFram instance

Returns

None (inputs are updated in-place)