fastoad.models.propulsion.propulsion module¶
Base module for propulsion models.
-
class
fastoad.models.propulsion.propulsion.BaseOMPropulsionComponent(**kwargs)[source]¶ Bases:
openmdao.core.explicitcomponent.ExplicitComponent,abc.ABCBase class for OpenMDAO wrapping of subclasses of
IEngineForOpenMDAO.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.
- Parameters
**kwargs (dict of keyword arguments) – Keyword arguments that will be mapped into the Component options.
-
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() → fastoad.models.propulsion.propulsion.IOMPropulsionWrapper[source]¶ This method defines the used
IOMPropulsionWrapperinstance.- Returns
an instance of OpenMDAO wrapper for propulsion model
-
class
fastoad.models.propulsion.propulsion.IOMPropulsionWrapper[source]¶ Bases:
objectInterface for wrapping a
IPropulsionsubclass in OpenMDAO.The implementation class defines the needed input variables for instantiating the
IPropulsionsubclass insetup()and use them for instantiation inget_model()see
OMRubberEngineWrapperfor an example of implementation.-
abstract static
get_model(inputs) → fastoad.models.propulsion.propulsion.IPropulsion[source]¶ This method defines the used
IPropulsionsubclass instance.- Parameters
inputs – OpenMDAO input vector where the parameters that define the propulsion model are
- Returns
the propulsion model instance
-
abstract
setup(component: openmdao.core.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
-
class
fastoad.models.propulsion.propulsion.IPropulsion[source]¶ Bases:
abc.ABCInterface 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` by putting such command before defining the class:: >>> # Simply adds the fields: >>> AddKeyAttributes(["ion_drive_power", "warp"])(FlightPoint) >>> # Adds the fields with associated default values: >>> AddKeyAttributes({"ion_drive_power":110., "warp":9.0})(FlightPoint)-
abstract
compute_flight_points(flight_points: Union[fastoad.base.flight_point.FlightPoint, pandas.core.frame.DataFrame])[source]¶ Computes Specific Fuel Consumption according to provided conditions.
See
FlightPointfor 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_regulatedtells if a flight point should be computed usingthrust_rate(when False) orthrust(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_regulatedis not defined, the considered input will be the defined one betweenthrust_rateandthrust(if both are provided,thrust_ratewill be used)if
thrust_is_regulatedisTrueorFalse(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_regulatedis a sequence or array,thrust_rateandthrustshould be provided and have the same shape asthrust_is_regulated:code:. The method will consider for each element which input will be used according tothrust_is_regulated.
- Parameters
flight_points – FlightPoint or DataFram instance
- Returns
None (inputs are updated in-place)
-
abstract
get_consumed_mass(flight_point: fastoad.base.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
-
abstract