fastoad.models.performances.mission.openmdao.mission_wrapper module

Mission wrapper.

class fastoad.models.performances.mission.openmdao.mission_wrapper.MissionWrapper(mission_definition: str | PathLike | MissionDefinition, *, propulsion: IPropulsion = None, reference_area: float = None, mission_name: str | None = None, variable_prefix: str = 'data:mission', force_all_block_fuel_usage: bool = False)[source]

Bases: MissionBuilder

Wrapper around MissionBuilder for using with OpenMDAO.

Unlike its parent class, the mission_name argument is mandatory at instantiation, unless there is only one mission in the definition file.

Parameters:
  • mission_definition – a file path or MissionDefinition instance

  • propulsion – if not provided, the property propulsion must be set before calling build()

  • reference_area – if not provided, the property reference_area must be set before calling build()

  • mission_name – name of chosen mission. Can be omitted if definition file contains only one mission.

  • variable_prefix – prefix for auto-generated variable names.

  • force_all_block_fuel_usage – if True and if mission_name is provided, the mission definition will be modified to set the target fuel consumption to variable “~:block_fuel”

force_all_block_fuel_usage()[source]

Modifies mission definition to set block fuel as target fuel consumption.

setup(component: ExplicitComponent)[source]

To be used during setup() of provided OpenMDAO component.

It adds input and output variables deduced from mission definition file.

Parameters:

component – the OpenMDAO component where the setup is done.

compute(start_flight_point: FlightPoint, inputs: Vector, outputs: Vector) DataFrame[source]

To be used during compute() of an OpenMDAO component.

Builds the mission from input file, and computes it. outputs vector is filled with duration, burned fuel and covered ground distance for each part of the flight.

Parameters:
  • start_flight_point – starting point of mission

  • inputs – the input vector of the OpenMDAO component

  • outputs – the output vector of the OpenMDAO component

Returns:

a pandas DataFrame where column names match fields of FlightPoint

get_reserve_variable_name() str[source]
Returns:

the name of OpenMDAO variable for fuel reserve. This name is among the declared outputs in setup().

build(inputs: Mapping | None = None, mission_name: str = None) Mission

Builds the flight sequence from definition file.

Parameters:
  • inputs – if provided, any input parameter that is a string which matches a key of inputs will be replaced by the corresponding value

  • mission_name – mission name (can be omitted if only one mission is defined or if mission has been defined)

Returns:

property definition: MissionDefinition

The mission definition instance.

If it is set as a file path, then the matching file will be read and interpreted.

get_input_variables(mission_name=None) VariableList

Identify variables for a defined mission.

Parameters:

mission_name – mission name (can be omitted if only one mission is defined or if mission has been defined)

Returns:

a VariableList instance.

get_input_weight_variable_name(mission_name: str = None) str | None

Search the mission structure for a segment that has a target absolute mass defined and returns the associated variable name.

Parameters:

mission_name – mission name (can be omitted if only one mission is defined or if mission has been defined)

Returns:

The variable name, or None if no target mass found.

get_reserve(flight_points: DataFrame, mission_name: str = None) float

Computes the reserve fuel according to definition in mission input file.

Parameters:
  • flight_points – the dataframe returned by compute_from() method of the instance returned by build()

  • mission_name – mission name (can be omitted if only one mission is defined or if mission has been defined)

Returns:

the reserve fuel mass in kg, or 0.0 if no reserve is defined.

get_route_names(mission_name: str = None) List[str]
Parameters:

mission_name

Returns:

a list with names of all routes in the mission, in order.

get_route_ranges(inputs: Mapping | None = None, mission_name: str = None) List[float]
Parameters:
  • inputs – if provided, any input parameter that is a string which matches a key of inputs will be replaced by the corresponding value

  • mission_name – mission name (can be omitted if only one mission is defined or if mission has been defined)

Returns:

list of flight ranges for each element of the flight sequence that is a route

get_unique_mission_name() str

Provides mission name if only one mission is defined in mission file.

Returns:

the mission name, if only one mission is defined

Raises:

FastMissionFileMissingMissionNameError – if several missions are defined in mission file

property mission_name

The mission name, in case it has been specified, or if it is unique in the file.

property propulsion: IPropulsion

Propulsion model for performance computation.

property reference_area: float

Reference area for aerodynamic polar.

property variable_prefix

The prefix for auto-generated variable names.