fastga_he.powertrain_builder.powertrain module

Module for the construction of all the groups necessary for the proper interaction of the power train module with the aircraft sizing modules from FAST-OAD-GA based on the power train file.

class fastga_he.powertrain_builder.powertrain.FASTGAHEPowerTrainConfigurator(power_train_file_path=None)[source]

Bases: object

Class for the configuration of the components necessary for the performances and sizing of the power train.

Parameters:

power_train_file_path – if provided, power train will be read directly from it

load(power_train_file)[source]

Reads the power train definition

Parameters:

power_train_file – Path to the file to open.

get_watcher_file_path()[source]

Returns the path to where the performance watch file will be. If name is not absolute we complete it.

get_component_distance(references)[source]

Calculate the shortest distance from each component to the nearest reference component(s) of a certain type or type class.

Parameters:

references – Component type class or component type of reference component(s). Can be a single string or a list of type string entries. Each string should match a registered component type or component type class.

Returns:

A dictionary mapping each component name to its minimum distance to any of the reference components. Distance is measured as the number of edges in the shortest path.

reorder_components(*lists)[source]

Reorders components by their distance from the nearest propeller and assigns proper sequential indices. Takes multiple property lists where the first list contains component names/keys, and reorders all lists according to the distance-based mapping. This improves robustness by ensuring that variables are updated in a correct order for each run.

Parameters:

*lists

Variable number of property lists to be reordered. The first list should

contain component names/keys that correspond to keys in the distance_from_propulsor dictionary. All subsequent lists will be reordered according to the same mapping.

Returns:

tuple: All input lists reordered according to distance from propulsor, maintaining

the same order and count as input lists.

check_sspc_states(declared_state)[source]
get_sizing_element_lists() tuple[source]

Returns the list of parameters necessary to create the sizing group based on what is inside the power train file.

get_performances_element_lists() tuple[source]

Returns the list of parameters necessary to create the performances group based on what is inside the power train file.

get_slipstream_element_lists() tuple[source]

Returns the list of parameters necessary to create the slipstream group based on what is inside the power train file.

get_performances_to_slipstream_element_lists() tuple[source]

Returns the list of variable to promote from the performances component to the slipstream component.

get_control_parameter_list() List[str][source]

Returns the list of control parameters of the components inside the powertrain.

static enforce_sspc_last(components_name: list, components_name_id: list, components_om_type: list, components_options: list, components_promotes: list) Tuple[list, list, list, list, list][source]

It turns out that the SSPC can cause a bit of a mess when connected to cable, because, as one side is computed and the other not, this might create huge current which will more often than not prevent the code from converging. A solution found was to make it so that the SSPC are always computed last in the performances. So far it works.

Parameters:

components_name – list that contains the name of the component as it will be found

in the input/output file :param components_name_id: list that contains the name of the options used to provide the names in self._components_name :param components_om_type: list that contains the suffix of the component added to Performances and Sizing :param components_options: list that contains the options of the components :param components_promotes: list that contains the list of aircraft inputs that are necessary to promote in the performances modules for the code to work

get_mass_element_lists() list[source]

Returns the list of OpenMDAO variables necessary to create the component which computes the mass of the power train.

get_cg_element_lists() list[source]

Returns the list of OpenMDAO variables necessary to create the component which computes the center of gravity of the power train.

get_drag_element_lists() Tuple[list, list][source]

Returns the list of OpenMDAO variables necessary to create the component which computes the drag of the power train. Will return both the name of high speed and low speed drag as they are meant to be used once in the same component

get_thrust_element_list() list[source]

Returns the list of OpenMDAO variables necessary to create the component which computes the repartition of thrust among propellers.

get_propulsive_element_list() tuple[source]

Returns the list of OpenMDAO variables necessary to create the component which computes the ratio between the required power and the max available power on propulsive loads.

get_energy_consumption_list() list[source]

Returns the list of OpenMDAO variables necessary to create the component which sum the contribution of each source to the global energy consumption.

get_fuel_tank_list() Tuple[list, list][source]

Returns the list of components inside the power train which may cause the CG to shift during flight because of a varying mass (but a constant position)

get_generator_list() list[source]

Returns the list of generator component(s) in the powertrain architecture.

get_fuel_tank_list_and_fuel() Tuple[list, list, list][source]

Returns the list of components inside the power train which contain fuel and what type of fuel they contain. To do so we’ll analyse the source they are connected to.

get_electricity_storage_list() Tuple[list, list][source]

Returns the list of electricity storage components inside the power train.

get_residuals_watcher_elements_list() tuple[source]

Returns the list of OpenMDAO variables that are interesting to monitor in the residuals watcher.

get_performance_watcher_elements_list() tuple[source]

Returns the list of OpenMDAO variables that are to be registered by the performances watcher.

get_slipstream_performance_watcher_elements_list() tuple[source]

Returns the list of OpenMDAO variables used in the computation of the slipstream effects that are to be registered by the performances watcher.

get_wing_punctual_mass_element_list() Tuple[list, list, list][source]

This function returns a list of the components that are to be considered as punctual masses acting on the wing due to their positions as defined in the powertrain file

get_wing_punctual_fuel_element_list() Tuple[list, list, list][source]

This function returns a list of the components that are to be considered as punctual fuel tanks acting on the wing due to their positions as defined in the powertrain file

get_wing_distributed_mass_element_list() Tuple[list, list, list][source]

This function returns a list of the components that are to be considered as distributed masses acting on the wing due to their positions as defined in the powertrain file

get_wing_distributed_fuel_element_list() Tuple[list, list, list][source]

This function returns a list of the components that are to be considered as distributed fuel tanks acting on the wing due to their positions as defined in the powertrain file

will_aircraft_mass_vary()[source]

This function returns a boolean telling whether or not there are components in the powertrain that will make the aircraft mass vary during the flight (like burning fuel or certain types of batteries). For now, will only be used in the initial guess.

has_fuel_non_consumable_energy_source()[source]

This function returns a boolean telling whether or not there are energy sources in the powertrain that will not make the aircraft vary (like batteries). For now is only used to provide smart initial guess.

get_connection_graph() list[source]

This function returns a graph of connection inside the powertrain without doubling the components like what get_graphs_connected_voltage() does

get_graphs_connected_voltage() list[source]

This function returns a list of graphs of connected PT components that have more or less the same imposed voltage. What is meant by that is that since some component impose the voltage on the circuit while other have independent I/O in terms of voltage e.g the DC/DC converter this will make it so that there might some subgraph of the architecture with different connected voltage.

check_voltage_coherence(inputs, number_of_points: int)[source]

Check that all the sub graphs of independent voltage are compatible, meaning that if there is more than one component that sets the voltage, they have the same target voltage.

Parameters:

inputs – inputs vector, in the OpenMDAO format, which contains the value of the

voltages to check :param number_of_points: number of points in the data to check

get_voltage_to_set(inputs, number_of_points: int) List[dict][source]

Returns a list of the dict of voltage variable names and the value they should be set at for each of the subgraph. Dict will be empty if there is no voltage to set. The voltage to set are defined in the registered_components.py file. Note that this function was coded based on the assumption that the voltage coherence checker was ran before hand. It also assumes that all the voltage setter are RMS value when the voltage to set is an AC voltage.

Parameters:

inputs – inputs vector, in the OpenMDAO format, which contains the value of the

voltages to check :param number_of_points: number of points in the data to check

static get_number_of_cell_in_series(component_name: str, component_type: str, inputs) float[source]

This function returns the number of cell in series inside a battery module. Was put there because there is quite a process to extract the value and we will need it twice at least.

Parameters:
  • component_name – name of the battery pack

  • component_type – type of battery pack, for now there is only one but who knows

  • inputs – inputs vector, in the OpenMDAO format

get_directed_graph_sub_propulsion_chain()[source]

This function returns a list of directed graphs of connected PT sub propulsion chain. As a prevision for next step all component will be split between their inputs and outputs to allow to include efficiency.

are_propulsor_connected_to_source()[source]

This function returns a dictionary which contains, for each propulsor, a boolean which tells whether the propulsor can be actuated (meaning its connected to a source).

static fuel_system_power_inputs(inputs, components_name: str, power_output: ndarray) dict[source]

Computes the power at each input of the fuel system, depending on the mode the power at the output and the splitting decided

Parameters:
  • inputs – OpenMDAO vector containing the value of inputs

  • components_name – the name of the fuel system in question

  • power_output – the power at the output of the fuel system

splitter_power_inputs(inputs, components_name: str, power_output: ndarray) Tuple[ndarray, ndarray][source]

Computes the power at each input of the splitter, depending on the mode the power at the output

Parameters:
  • inputs – OpenMDAO vector containing the value of inputs

  • components_name – the name of the splitter in question

  • power_output – the power at the output of the splitter

gearbox_power_inputs(inputs, components_name: str, power_output: ndarray) Tuple[ndarray, ndarray][source]

Computes the power at each input of the gearbox, depending on the mode the power at the output

Parameters:
  • inputs – OpenMDAO vector containing the value of inputs

  • components_name – the name of the gearbox in question

  • power_output – the power at the output of the gearbox

get_power_to_set(inputs, propulsive_power_dict: dict) Tuple[dict, dict][source]

Returns a list of the power at each nodes of each subgraph. Also returns a list of the dict of current variable names and the value they should be set at for each of the subgraph. Dict will be empty if there is no power to set. The power to set are defined in the registered_components.py file.

Parameters:

inputs – inputs vector, in the OpenMDAO format, which contains the value of the

voltages to check :param propulsive_power_dict: dictionary with the propulsive power of each propulsor

get_network_elements_list() tuple[source]

Returns the name of the components and their connections for the visualisation of the power train as a network graph.

produce_simplified_pt_file_copy()[source]

This function was created after the observation that the more components there are in the powertrain, the longer it takes to run (duh). It is even more striking when running the optimization to find a new wing area (it can takes minutes). However, for that particular observation the whole propulsion chain is not needed. We indeed only need the propulsors to compute the slipstream effect and the propulsive load to check that the power rate is below 1. Consequently, and only for that particular application, we will produce a simplified powertrain file which contains only the required elements.

get_current_to_set(inputs, propulsive_power_dict: dict, number_of_points: int) dict[source]

Returns a list of the dict of current variable names and the value they should be set at for each of the subgraph. Dict will be empty if there is no current to set. The current to set are defined in the registered_components.py file.

Parameters:

inputs – inputs vector, in the OpenMDAO format, which contains the value of the

voltages to check :param propulsive_power_dict: dictionary with the propulsive power of each propulsor :param number_of_points: number of points in the data to check

get_battery_list() Tuple[list, list][source]

Returns the list of components inside the power train that are batteries. This function is used to see where the electricity is stored in the powertrain for the LCA. For now, it tests the id of the component, but it should be more generic in the future for components like super-capacitors and others.

get_lca_production_element_list() Dict[source]
get_lca_use_phase_element_list() Tuple[Dict, List][source]
get_lca_manufacturing_phase_element_list() Tuple[Dict, List][source]

Get a dict with all the lines to add to the LCA configuration file for the manufacturing phase. Theoretically, the manufacturing contains the assembly of the airframe plus tests plus the construction of the assembly plant. In our case, the assembly plant will be discarded and because we lack data, the assembly of the airframe has been aggregated in the production. So all that remains are the line tests, which will be very similar to the use phase. Except we won’t attribute emission to each component (which means not adding the custom attributes), however we’ll need to differentiate each CO2, NOx emissions … so we’ll tag them with component name.

get_lca_distribution_phase_element_list() Tuple[Dict, List][source]

Get a dict with all the lines to add to the LCA configuration file for the distribution phase. Will be computed all the time but won’t be used if the delivery method is the train.

Lots of commonality with get_lca_manufacturing_phase_element_list # TODO: Refactor ? Refactor !

static belongs_to_custom_attribute_definition(line, line_idx, lines_to_inspect) bool[source]

Utility function to detect if the line is part of the definition of a custom attribute.

fastga_he.powertrain_builder.powertrain.format_to_array(input_array: ndarray, number_of_points: int) ndarray[source]

Takes an inputs which is either a one-element array or a multi-element array and formats it.