fastoad.models.performances.mission.mission_definition.mission_builder.input_definition module

Management of mission input definitions.

class fastoad.models.performances.mission.mission_definition.mission_builder.input_definition.InputDefinition(parameter_name: str, input_value: ~typing.Optional[~typing.Union[~numbers.Number, ~typing.Iterable, str]], input_unit: ~typing.Optional[str] = None, default_value: ~numbers.Number = nan, is_relative: bool = False, part_identifier: str = '', shape: ~typing.Optional[~typing.Tuple[int]] = None, shape_by_conn: bool = False, variable_name: ~dataclasses.InitVar = <property object>, use_opposite: ~typing.Optional[~dataclasses.InitVar] = None)[source]

Bases: object

Class for managing definition of mission inputs.

It stores and processes input definition from mission files:
  • provides values to be used for mission computation (management of units and variables)

  • provides information for OpenMDAO declaration

parameter_name: str

The parameter this input is defined for.

input_value: Optional[Union[Number, Iterable, str]]

Value, matching input_unit. At instantiation, it can also be the variable name.

input_unit: Optional[str] = None

Unit used for self.input_value.

default_value: Number = nan

Default value. Used if value is a variable name.

is_relative: bool = False

True if variable is defined as relative.

part_identifier: str = ''

Prefix used when generating variable name because “~” was used in variable name input.

output_unit: Optional[str] = None

Unit used for self.value. Automatically determined from self.parameter_name, mainly from unit definition for FlightPoint class.

shape: Optional[Tuple[int]] = None

Value of the “shape” openMDAO flag for input declaration.

shape_by_conn: bool = False

Value of the “shape_by_conn” openMDAO flag for input declaration.

use_opposite: InitVar = None

Used only for tests

property value

Value of variable in DEFAULT unit (unit used by mission calculation), or None if input is a variable and set_variable_input() has NOT been called, or the unchanged value if it is not a number.



classmethod from_dict(parameter_name, definition_dict: dict, part_identifier=None)[source]

Instantiates InputDefinition from definition_dict.

definition_dict[“value”] is used as input_value in instantiation. It can be an actual value or a variable name.

  • parameter_name – used if definition_dict[“value”] == “~” (or “-~”)

  • definition_dict – dict with keys (“value”, “unit”, “default”). “unit” and “default” are optional.

  • part_identifier – used if “~” is in definition_dict[“value”]

set_variable_value(inputs: Mapping)[source]

Sets numerical value from OpenMDAO inputs.

OpenMDAO value is assumed to be provided with unit self.input_unit.



get_input_definition() Optional[Variable][source]

Provides information for input definition in OpenMDAO.


Variable instance with input definition, or None if no variable name was defined.

property variable_name

Used only for tests