Exemple #1
0
    def setup(self):
        self.add_subsystem(
            "passenger_seats_weight",
            RegisterSubmodel.get_submodel(SERVICE_PASSENGER_SEATS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "food_water_weight",
            RegisterSubmodel.get_submodel(SERVICE_FOOD_WATER_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "security_kit_weight",
            RegisterSubmodel.get_submodel(SERVICE_SECURITY_KIT_MASS, ""),
            promotes=["*"],
        )
        self.add_subsystem("toilets_weight",
                           RegisterSubmodel.get_submodel(SERVICE_TOILETS_MASS),
                           promotes=["*"])

        weight_sum = om.AddSubtractComp()
        weight_sum.add_equation(
            "data:weight:furniture:mass",
            [
                "data:weight:furniture:passenger_seats:mass",
                "data:weight:furniture:food_water:mass",
                "data:weight:furniture:security_kit:mass",
                "data:weight:furniture:toilets:mass",
            ],
            units="kg",
            desc="Mass of aircraft furniture",
        )

        self.add_subsystem("furniture_weight_sum", weight_sum, promotes=["*"])
Exemple #2
0
    def setup(self):
        # Engine have to be computed before pylons
        self.add_subsystem(
            "engines_weight", RegisterSubmodel.get_submodel(SERVICE_ENGINE_MASS), promotes=["*"]
        )
        self.add_subsystem(
            "fuel_lines_weight",
            RegisterSubmodel.get_submodel(SERVICE_FUEL_LINES_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "unconsumables_weight",
            RegisterSubmodel.get_submodel(SERVICE_UNCONSUMABLES_MASS),
            promotes=["*"],
        )

        weight_sum = om.AddSubtractComp()
        weight_sum.add_equation(
            "data:weight:propulsion:mass",
            [
                "data:weight:propulsion:engine:mass",
                "data:weight:propulsion:fuel_lines:mass",
                "data:weight:propulsion:unconsumables:mass",
            ],
            units="kg",
            desc="Mass of the propulsion system",
        )

        self.add_subsystem("propulsion_weight_sum", weight_sum, promotes=["*"])
Exemple #3
0
 def setup(self):
     self.add_subsystem(
         "cg_ratio_empty",
         RegisterSubmodel.get_submodel(SERVICE_EMPTY_AIRCRAFT_CG),
         promotes=["*"],
     )
     self.add_subsystem(
         "cg_ratio_load_cases",
         RegisterSubmodel.get_submodel(SERVICE_LOAD_CASES_CG),
         promotes=["*"],
     )
     self.add_subsystem("cg_ratio_max", ComputeMaxCGratio(), promotes=["*"])
Exemple #4
0
 def setup(self):
     self.add_subsystem(
         "cg",
         RegisterSubmodel.get_submodel(SERVICE_CENTERS_OF_GRAVITY),
         promotes=["*"])
     self.add_subsystem(
         "mass_breakdown",
         RegisterSubmodel.get_submodel(
             SERVICE_MASS_BREAKDOWN,
             {PAYLOAD_FROM_NPAX: self.options[PAYLOAD_FROM_NPAX]}),
         promotes=["*"],
     )
Exemple #5
0
 def setup(self):
     self.add_subsystem(
         "compute_oswald_coeff",
         RegisterSubmodel.get_submodel(SERVICE_OSWALD_COEFFICIENT),
         promotes=["*"],
     )
     self.add_subsystem(
         "compute_induced_drag_coeff",
         RegisterSubmodel.get_submodel(SERVICE_INDUCED_DRAG_COEFFICIENT),
         promotes=["*"],
     )
     self.add_subsystem(
         "comp_re", RegisterSubmodel.get_submodel(SERVICE_REYNOLDS_COEFFICIENT), promotes=["*"]
     )
     self.add_subsystem(
         "initialize_cl", RegisterSubmodel.get_submodel(SERVICE_INITIALIZE_CL), promotes=["*"]
     )
     self.add_subsystem("cd0_wing", RegisterSubmodel.get_submodel(SERVICE_CD0), promotes=["*"])
     self.add_subsystem(
         "cd_comp", RegisterSubmodel.get_submodel(SERVICE_CD_COMPRESSIBILITY), promotes=["*"]
     )
     self.add_subsystem(
         "cd_trim", RegisterSubmodel.get_submodel(SERVICE_CD_TRIM), promotes=["*"]
     )
     self.add_subsystem(
         "get_polar", RegisterSubmodel.get_submodel(SERVICE_POLAR), promotes=["*"]
     )
Exemple #6
0
    def setup(self):
        landing_flag_option = {"landing_flag": False}
        self.add_subsystem(
            "delta_cl_cd",
            RegisterSubmodel.get_submodel(SERVICE_HIGH_LIFT,
                                          landing_flag_option),
            promotes=["*"],
        )

        polar_type_option = {"polar_type": PolarType.TAKEOFF}
        self.add_subsystem("polar",
                           RegisterSubmodel.get_submodel(
                               SERVICE_POLAR, polar_type_option),
                           promotes=["*"])
Exemple #7
0
    def setup(self):
        self.add_subsystem(
            "mach_reynolds",
            RegisterSubmodel.get_submodel(SERVICE_LANDING_MACH_REYNOLDS),
            promotes=["*"],
        )

        if self.options["use_xfoil"]:
            start = self.options["xfoil_alpha_min"]
            end = self.options["xfoil_alpha_max"]
            iter_limit = self.options["xfoil_iter_limit"]
            xfoil_options = {
                OPTION_ALPHA_START: start,
                OPTION_ALPHA_END: end,
                OPTION_ITER_LIMIT: iter_limit,
                OPTION_XFOIL_EXE_PATH: self.options[OPTION_XFOIL_EXE_PATH],
            }
            self.add_subsystem(
                "xfoil_run",
                RegisterSubmodel.get_submodel(SERVICE_XFOIL, xfoil_options),
                promotes=["data:geometry:wing:thickness_ratio"],
            )

        self.add_subsystem(
            "CL_2D_to_3D",
            RegisterSubmodel.get_submodel(SERVICE_LANDING_MAX_CL_CLEAN),
            promotes=["*"],
        )

        landing_flag_option = {"landing_flag": True}
        self.add_subsystem(
            "delta_cl_landing",
            RegisterSubmodel.get_submodel(SERVICE_HIGH_LIFT, landing_flag_option),
            promotes=["*"],
        )

        self.add_subsystem(
            "compute_max_cl_landing",
            RegisterSubmodel.get_submodel(SERVICE_LANDING_MAX_CL),
            promotes=["*"],
        )

        if self.options["use_xfoil"]:
            self.connect("data:aerodynamics:aircraft:landing:mach", "xfoil_run.xfoil:mach")
            self.connect("data:aerodynamics:wing:landing:reynolds", "xfoil_run.xfoil:reynolds")
            self.connect(
                "xfoil_run.xfoil:CL_max_2D", "data:aerodynamics:aircraft:landing:CL_max_clean_2D"
            )
Exemple #8
0
    def setup(self):

        # We add in our group all the components for declared services that provide CG ratio
        # for specific load_cases
        for load_case_count in count():
            try:
                system = RegisterSubmodel.get_submodel(
                    f"{SERVICE_LOAD_CASE_CG_PREFIX}.{load_case_count + 1}")
            except FastNoSubmodelFoundError:
                break
            self.add_subsystem(f"cg_ratio_lc{load_case_count + 1}",
                               system,
                               promotes_inputs=["*"])

        cg_ratio_aggregator = self.add_subsystem(
            "cg_ratio_aggregator",
            om.MuxComp(vec_size=load_case_count),
            promotes=["data:weight:aircraft:load_cases:CG:MAC_position"],
        )

        # This part aggregates all CG ratios values in one vector variable.
        cg_ratio_aggregator.add_var(
            "data:weight:aircraft:load_cases:CG:MAC_position",
            shape=(1, ),
            axis=0)
        for i in range(load_case_count):
            self.connect(
                f"cg_ratio_lc{i + 1}.data:weight:aircraft:load_case_{i + 1}:CG:MAC_position",
                f"cg_ratio_aggregator.data:weight:aircraft:load_cases:CG:MAC_position_{i}",
            )

        self.add_subsystem("compute_max",
                           MaxCGRatiosForLoadCases(),
                           promotes=["*"])
    def load(self, conf_file):
        """
        Reads the problem definition

        :param conf_file: Path to the file to open or a file descriptor
        """

        self._conf_file = pth.abspath(conf_file)  # for resolving relative paths
        conf_dirname = pth.dirname(self._conf_file)

        if pth.splitext(self._conf_file)[-1] == ".toml":
            self._serializer = _TOMLSerializer()
            _LOGGER.warning(
                "TOML-formatted configuration files are deprecated. Please use YAML format."
            )
        else:
            self._serializer = _YAMLSerializer()
        self._serializer.read(self._conf_file)

        # Syntax validation
        with open_text(resources, JSON_SCHEMA_NAME) as json_file:
            json_schema = json.loads(json_file.read())
        validate(self._serializer.data, json_schema)
        # Issue a simple warning for unknown keys at root level
        for key in self._serializer.data:
            if key not in json_schema["properties"].keys():
                _LOGGER.warning('Configuration file: "%s" is not a FAST-OAD key.', key)

        # Looking for modules to register
        module_folder_paths = self._serializer.data.get(KEY_FOLDERS)
        if isinstance(module_folder_paths, str):
            module_folder_paths = [module_folder_paths]
        if module_folder_paths:
            for folder_path in module_folder_paths:
                folder_path = pth.join(conf_dirname, str(folder_path))
                if not pth.exists(folder_path):
                    _LOGGER.warning("SKIPPED %s: it does not exist.", folder_path)
                else:
                    RegisterOpenMDAOSystem.explore_folder(folder_path)

        # Settings submodels
        RegisterSubmodel.cancel_submodel_deactivations()
        submodel_specs = self._serializer.data.get(KEY_SUBMODELS, {})
        for submodel_requirement, submodel_id in submodel_specs.items():
            RegisterSubmodel.active_models[submodel_requirement] = submodel_id
Exemple #10
0
    def setup(self):
        # Airframe
        self.add_subsystem("loads",
                           RegisterSubmodel.get_submodel(SERVICE_GUST_LOADS),
                           promotes=["*"])
        self.add_subsystem("wing_weight",
                           RegisterSubmodel.get_submodel(SERVICE_WING_MASS),
                           promotes=["*"])
        self.add_subsystem(
            "fuselage_weight",
            RegisterSubmodel.get_submodel(SERVICE_FUSELAGE_MASS),
            promotes=["*"])
        self.add_subsystem(
            "empennage_weight",
            RegisterSubmodel.get_submodel(SERVICE_EMPENNAGE_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "flight_controls_weight",
            RegisterSubmodel.get_submodel(SERVICE_FLIGHT_CONTROLS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "landing_gear_weight",
            RegisterSubmodel.get_submodel(SERVICE_LANDING_GEARS_MASS),
            promotes=["*"],
        )
        self.add_subsystem("pylons_weight",
                           RegisterSubmodel.get_submodel(SERVICE_PYLONS_MASS),
                           promotes=["*"])
        self.add_subsystem("paint_weight",
                           RegisterSubmodel.get_submodel(SERVICE_PAINT_MASS),
                           promotes=["*"])

        weight_sum = om.AddSubtractComp()
        weight_sum.add_equation(
            "data:weight:airframe:mass",
            [
                "data:weight:airframe:wing:mass",
                "data:weight:airframe:fuselage:mass",
                "data:weight:airframe:horizontal_tail:mass",
                "data:weight:airframe:vertical_tail:mass",
                "data:weight:airframe:flight_controls:mass",
                "data:weight:airframe:landing_gear:main:mass",
                "data:weight:airframe:landing_gear:front:mass",
                "data:weight:airframe:pylon:mass",
                "data:weight:airframe:paint:mass",
            ],
            units="kg",
            desc="Mass of airframe",
        )

        self.add_subsystem("airframe_weight_sum", weight_sum, promotes=["*"])
Exemple #11
0
    def setup(self):
        if self.options[PAYLOAD_FROM_NPAX]:
            self.add_subsystem(
                "payload",
                RegisterSubmodel.get_submodel(SERVICE_PAYLOAD_MASS),
                promotes=["*"])
        self.add_subsystem("owe",
                           RegisterSubmodel.get_submodel(SERVICE_OWE),
                           promotes=["*"])
        self.add_subsystem("update_mzfw_and_mlw",
                           UpdateMLWandMZFW(),
                           promotes=["*"])

        # Solvers setup
        self.nonlinear_solver = om.NonlinearBlockGS()
        self.nonlinear_solver.options["iprint"] = 0
        self.nonlinear_solver.options["maxiter"] = 50

        self.linear_solver = om.LinearBlockGS()
        self.linear_solver.options["iprint"] = 0
Exemple #12
0
 def setup(self):
     low_speed_option = {"low_speed_aero": self.options["low_speed_aero"]}
     self.add_subsystem(
         "cd0_wing",
         RegisterSubmodel.get_submodel(SERVICE_CD0_WING, low_speed_option),
         promotes=["*"],
     )
     self.add_subsystem(
         "cd0_fuselage",
         RegisterSubmodel.get_submodel(SERVICE_CD0_FUSELAGE, low_speed_option),
         promotes=["*"],
     )
     self.add_subsystem(
         "cd0_ht",
         RegisterSubmodel.get_submodel(SERVICE_CD0_HORIZONTAL_TAIL, low_speed_option),
         promotes=["*"],
     )
     self.add_subsystem(
         "cd0_vt",
         RegisterSubmodel.get_submodel(SERVICE_CD0_VERTICAL_TAIL, low_speed_option),
         promotes=["*"],
     )
     self.add_subsystem(
         "cd0_nac_pylons",
         RegisterSubmodel.get_submodel(SERVICE_CD0_NACELLES_PYLONS, low_speed_option),
         promotes=["*"],
     )
     self.add_subsystem(
         "cd0_total",
         RegisterSubmodel.get_submodel(SERVICE_CD0_SUM, low_speed_option),
         promotes=["*"],
     )
Exemple #13
0
 def setup(self):
     self.add_subsystem(
         "fuselage_cnbeta",
         RegisterSubmodel.get_submodel(SERVICE_FUSELAGE_CNBETA),
         promotes=["*"],
     )
     self.add_subsystem("vt_aspect_ratio",
                        ComputeVTDistance(),
                        promotes=["*"])
     self.add_subsystem("vt_clalpha", ComputeVTClalpha(), promotes=["*"])
     self.add_subsystem("vt_chords", ComputeVTChords(), promotes=["*"])
     self.add_subsystem("vt_mac", ComputeVTMAC(), promotes=["*"])
     self.add_subsystem("vt_sweep", ComputeVTSweep(), promotes=["*"])
Exemple #14
0
    def setup(self):
        # Propulsion should be done before airframe, because it drives pylon mass.
        self.add_subsystem(
            "propulsion_weight",
            RegisterSubmodel.get_submodel(SERVICE_PROPULSION_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "airframe_weight",
            RegisterSubmodel.get_submodel(SERVICE_AIRFRAME_MASS),
            promotes=["*"])
        self.add_subsystem("systems_weight",
                           RegisterSubmodel.get_submodel(SERVICE_SYSTEMS_MASS),
                           promotes=["*"])
        self.add_subsystem(
            "furniture_weight",
            RegisterSubmodel.get_submodel(SERVICE_FURNITURE_MASS),
            promotes=["*"],
        )
        self.add_subsystem("crew_weight",
                           RegisterSubmodel.get_submodel(SERVICE_CREW_MASS),
                           promotes=["*"])

        weight_sum = om.AddSubtractComp()
        weight_sum.add_equation(
            "data:weight:aircraft:OWE",
            [
                "data:weight:airframe:mass",
                "data:weight:propulsion:mass",
                "data:weight:systems:mass",
                "data:weight:furniture:mass",
                "data:weight:crew:mass",
            ],
            units="kg",
            desc="Mass of crew",
        )

        self.add_subsystem("OWE_sum", weight_sum, promotes=["*"])
Exemple #15
0
    def setup(self):
        self.add_subsystem(
            "power_systems_weight",
            RegisterSubmodel.get_submodel(SERVICE_POWER_SYSTEMS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "life_support_systems_weight",
            RegisterSubmodel.get_submodel(SERVICE_LIFE_SUPPORT_SYSTEMS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "navigation_systems_weight",
            RegisterSubmodel.get_submodel(SERVICE_NAVIGATION_SYSTEMS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "transmission_systems_weight",
            RegisterSubmodel.get_submodel(SERVICE_TRANSMISSION_SYSTEMS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "fixed_operational_systems_weight",
            RegisterSubmodel.get_submodel(SERVICE_FIXED_OPERATIONAL_SYSTEMS_MASS),
            promotes=["*"],
        )
        self.add_subsystem(
            "flight_kit_weight",
            RegisterSubmodel.get_submodel(SERVICE_FLIGHT_KIT_MASS),
            promotes=["*"],
        )

        weight_sum = om.AddSubtractComp()
        weight_sum.add_equation(
            "data:weight:systems:mass",
            [
                "data:weight:systems:power:auxiliary_power_unit:mass",
                "data:weight:systems:power:electric_systems:mass",
                "data:weight:systems:power:hydraulic_systems:mass",
                "data:weight:systems:life_support:insulation:mass",
                "data:weight:systems:life_support:air_conditioning:mass",
                "data:weight:systems:life_support:de-icing:mass",
                "data:weight:systems:life_support:cabin_lighting:mass",
                "data:weight:systems:life_support:seats_crew_accommodation:mass",
                "data:weight:systems:life_support:oxygen:mass",
                "data:weight:systems:life_support:safety_equipment:mass",
                "data:weight:systems:navigation:mass",
                "data:weight:systems:transmission:mass",
                "data:weight:systems:operational:radar:mass",
                "data:weight:systems:operational:cargo_hold:mass",
                "data:weight:systems:flight_kit:mass",
            ],
            units="kg",
            desc="Mass of aircraft systems",
        )

        self.add_subsystem("systems_weight_sum", weight_sum, promotes=["*"])
Exemple #16
0
    def setup(self):

        self.add_subsystem(
            "ht_cg",
            RegisterSubmodel.get_submodel(SERVICE_HORIZONTAL_TAIL_CG),
            promotes=["*"])
        self.add_subsystem(
            "vt_cg",
            RegisterSubmodel.get_submodel(SERVICE_VERTICAL_TAIL_CG),
            promotes=["*"])
        self.add_subsystem("compute_cg_wing",
                           RegisterSubmodel.get_submodel(SERVICE_WING_CG),
                           promotes=["*"])
        self.add_subsystem(
            "compute_cg_control_surface",
            RegisterSubmodel.get_submodel(SERVICE_FLIGHT_CONTROLS_CG),
            promotes=["*"],
        )
        self.add_subsystem("compute_cg_tanks",
                           RegisterSubmodel.get_submodel(SERVICE_TANKS_CG),
                           promotes=["*"])
        self.add_subsystem("compute_cg_others",
                           RegisterSubmodel.get_submodel(SERVICE_OTHERS_CG),
                           promotes=["*"])
        self.add_subsystem("compute_cg",
                           RegisterSubmodel.get_submodel(SERVICE_GLOBAL_CG),
                           promotes=["*"])
        self.add_subsystem("update_mlg",
                           RegisterSubmodel.get_submodel(SERVICE_MLG_CG),
                           promotes=["*"])
        self.add_subsystem("aircraft",
                           RegisterSubmodel.get_submodel(SERVICE_AIRCRAFT_CG),
                           promotes=["*"])

        # Solvers setup
        self.nonlinear_solver = om.NonlinearBlockGS()
        self.nonlinear_solver.options["iprint"] = 0
        self.nonlinear_solver.options["maxiter"] = 200

        self.linear_solver = om.LinearBlockGS()
        self.linear_solver.options["iprint"] = 0
Exemple #17
0
    def setup(self):
        low_speed_option = {"low_speed_aero": True}

        self.add_subsystem(
            "compute_low_speed_aero",
            RegisterSubmodel.get_submodel(SERVICE_LOW_SPEED_CL_AOA),
            promotes=["*"],
        )
        ivc = om.IndepVarComp("data:aerodynamics:aircraft:takeoff:mach", val=0.2)
        self.add_subsystem("mach_low_speed", ivc, promotes=["*"])

        self.add_subsystem(
            "compute_oswald_coeff",
            RegisterSubmodel.get_submodel(SERVICE_OSWALD_COEFFICIENT, low_speed_option),
            promotes=["*"],
        )
        self.add_subsystem(
            "compute_induced_drag_coeff",
            RegisterSubmodel.get_submodel(SERVICE_INDUCED_DRAG_COEFFICIENT, low_speed_option),
            promotes=["*"],
        )
        self.add_subsystem(
            "comp_re",
            RegisterSubmodel.get_submodel(SERVICE_REYNOLDS_COEFFICIENT, low_speed_option),
            promotes=["*"],
        )
        self.add_subsystem(
            "initialize_cl",
            RegisterSubmodel.get_submodel(SERVICE_INITIALIZE_CL, low_speed_option),
            promotes=["*"],
        )
        self.add_subsystem(
            "cd0_wing", RegisterSubmodel.get_submodel(SERVICE_CD0, low_speed_option), promotes=["*"]
        )
        self.add_subsystem(
            "cd_trim",
            RegisterSubmodel.get_submodel(SERVICE_CD_TRIM, low_speed_option),
            promotes=["*"],
        )
        polar_type_option = {"polar_type": PolarType.LOW_SPEED}
        self.add_subsystem(
            "get_polar",
            RegisterSubmodel.get_submodel(SERVICE_POLAR, polar_type_option),
            promotes=["*"],
        )
Exemple #18
0
    def setup(self):

        if self.options[CABIN_SIZING_OPTION]:
            self.add_subsystem(
                "compute_fuselage",
                RegisterSubmodel.get_submodel(
                    SERVICE_FUSELAGE_GEOMETRY_WITH_CABIN_SIZING),
                promotes=["*"],
            )
        else:
            self.add_subsystem(
                "compute_fuselage",
                RegisterSubmodel.get_submodel(SERVICE_FUSELAGE_GEOMETRY_BASIC),
                promotes=["*"],
            )

        self.add_subsystem(
            "compute_wing",
            RegisterSubmodel.get_submodel(SERVICE_WING_GEOMETRY),
            promotes=["*"])
        self.add_subsystem(
            "compute_engine_nacelle",
            RegisterSubmodel.get_submodel(SERVICE_NACELLE_PYLON_GEOMETRY),
            promotes=["*"],
        )
        self.add_subsystem(
            "compute_ht",
            RegisterSubmodel.get_submodel(SERVICE_HORIZONTAL_TAIL_GEOMETRY),
            promotes=["*"],
        )
        self.add_subsystem(
            "compute_vt",
            RegisterSubmodel.get_submodel(SERVICE_VERTICAL_TAIL_GEOMETRY),
            promotes=["*"],
        )
        self.add_subsystem(
            "compute_total_area",
            RegisterSubmodel.get_submodel(SERVICE_AIRCRAFT_WETTED_AREA),
            promotes=["*"],
        )
        self.add_subsystem(
            "compute_aero_center",
            RegisterSubmodel.get_submodel(SERVICE_AIRCRAFT_AERODYNAMIC_CENTER),
            promotes=["*"],
        )
 def setup(self):
     self.add_subsystem("f", RegisterSubmodel.get_submodel(SERVICE_FUNCTION_F), promotes=["*"])
     self.add_subsystem("g1", RegisterSubmodel.get_submodel(SERVICE_FUNCTION_G1), promotes=["*"])
     self.add_subsystem("g2", RegisterSubmodel.get_submodel(SERVICE_FUNCTION_G2), promotes=["*"])