{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Tutorial 15 - Vehicle\n", "Welcome to this tutorial outlining the Vehicle creation process in RCAIDE. This guide will walk you through the code, explain its components, and highlight where modifications can be made to customize the simulation for different vehicle designs. It is a further refinement of tutorial 1 for the purposes of an optimization problem. The reader is encouraged to subsequently refer to tutorial 01 for the full context and the oterh tutorials in Optimize for more information on optimization problems. \n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Header and Imports\n", "\n", "\n", "The **Imports** section is divided into two parts: general-purpose Python libraries and simulation-specific libraries. Note the specific imports used vehcile design including design_turbofan, wing_planform, and segment_properties. \n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import RCAIDE\n", "from RCAIDE.Framework.Core import Units \n", "from RCAIDE.Library.Methods.Powertrain.Propulsors.Turbofan import design_turbofan\n", "from RCAIDE.Library.Methods.Geometry.Planform import wing_planform, segment_properties\n", "from RCAIDE.Library.Plots import * \n", "\n", "# python imports \n", "import numpy as np \n", "from copy import deepcopy\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def setup():\n", " \n", " base_vehicle = vehicle_setup()\n", " configs = configs_setup(base_vehicle)\n", " \n", " return configs" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Vehicle Setup\n", "\n", "The **`vehicle_setup`** function defines the baseline configuration of the aircraft. This section builds the vehicle step-by-step by specifying its components, geometric properties, and high-level parameters. This tutorial models an Embraer E190AR aircraft. \n", "\n", "---\n", "\n", "## 1. Creating the Vehicle Instance\n", "\n", "The setup begins by creating a vehicle instance and assigning it a **tag**. The tag is a unique string identifier used to reference the vehicle during analysis or in post-processing steps.\n", "\n", "---\n", "\n", "## 2. Defining High-Level Vehicle Parameters\n", "\n", "The high-level parameters describe the aircraft’s key operational characteristics, such as:\n", "\n", "- **Maximum Takeoff Weight**: The heaviest allowable weight of the aircraft for safe flight.\n", "- **Operating Empty Weight**: The aircraft weight without fuel, passengers, or payload.\n", "- **Payload**: The weight of cargo and passengers.\n", "- **Max Zero Fuel Weight**: The maximum weight of the aircraft excluding fuel.\n", "- **Flight Envelope**: These values are used to define the standard conditions the aircraft will operate under. These values are also used in certain analyses, for instance weight.\n", "\n", "Units for these parameters can be converted automatically using the `Units` module to ensure consistency and reduce errors.\n", "\n", "---\n", "\n", "## 3. Main Wing Setup\n", "\n", "The main wing is added using the **`Main_Wing`** class. This designation ensures that the primary lifting surface is recognized correctly by the analysis tools. Key properties of the wing include:\n", "\n", "- **Area**: The total wing surface area.\n", "- **Span**: The length of the wing from tip to tip.\n", "- **Aspect Ratio**: A ratio of span to average chord, determining wing efficiency.\n", "- **Segments**: Divisions of the wing geometry (e.g., root and tip sections).\n", "- **Control Surfaces**: High-lift devices like flaps and ailerons, defined by span fractions and deflections.\n", "\n", "Different segments are defined for the wing, which allows the user to define the wing geometry in a more detailed manner, for instance wing sweep that is dependent on percent of span. Most of the wing segemtn parameters are based on percentage of span or chord. This allows for the aircraft to be easily scaled by changing the driving parameters, such as wing span and root chord length. Segemnts are created and added with the following steps:\n", "\n", "- Create the segment component\n", "- Define segment properties including span percentage, sweep, twist, and dihedral, and chord.\n", "- Add the segment to the wing using the **`append_component`** method.\n", "\n", "---\n", "\n", "## 4. Horizontal and Vertical Stabilizers\n", "\n", "The stabilizers provide stability and control for the aircraft:\n", "\n", "- **Horizontal Stabilizer**: Defined using the `Horizontal_Tail` class. It follows a similar setup to the main wing but acts as a stabilizing surface.\n", "- **Vertical Stabilizer**: Defined using the `Vertical_Tail` class, with an additional option to designate the tail as a **T-tail** for weight calculations.\n", "\n", "Segments are added to the stabilizers in a similar manner to the main wing. \n", "\n", "---\n", "\n", "## 6. Fuselage Definition\n", "\n", "The fuselage is modeled by specifying its geometric parameters, such as:\n", "\n", "- **Length**: The overall length of the aircraft body.\n", "- **Width**: The widest part of the fuselage cross-section.\n", "- **Height**: The height of the fuselage.\n", "\n", "These values influence drag calculations and overall structural weight.\n", "\n", "Segments are again added to the fuselage in a similar manner to the main wing. \n", "\n", "---\n", "\n", "## 7. Energy Network: Turbofan Engine\n", "\n", "The **energy network** models the propulsion system, in this case, a turbofan engine. The turbofan network determines the engine’s thrust, bypass ratio, and fuel type. These parameters are essential for performance and fuel efficiency analyses.\n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def vehicle_setup():\n", " \n", " #------------------------------------------------------------------------------------------------------------------------------------\n", " # ################################################# Vehicle-level Properties ######################################################## \n", " #------------------------------------------------------------------------------------------------------------------------------------\n", " vehicle = RCAIDE.Vehicle()\n", " vehicle.tag = 'Embraer_E190AR'\n", " \n", " # mass properties (http://www.embraercommercialaviation.com/AircraftPDF/E190_Weights.pdf)\n", " vehicle.mass_properties.max_takeoff = 51800. # kg\n", " vehicle.mass_properties.operating_empty = 27837. # kg\n", " vehicle.mass_properties.takeoff = 51800. # kg\n", " vehicle.mass_properties.max_zero_fuel = 40900. # kg\n", " vehicle.mass_properties.max_payload = 13063. # kg\n", " vehicle.mass_properties.max_fuel = 12971. # kg\n", " vehicle.mass_properties.cargo = 0.0 # kg\n", "\n", " vehicle.mass_properties.center_of_gravity = [[16.8, 0, 1.6]]\n", " vehicle.mass_properties.moments_of_inertia.tensor = [[10 ** 5, 0, 0],[0, 10 ** 6, 0,],[0,0, 10 ** 7]] \n", "\n", " # envelope properties\n", " vehicle.flight_envelope.ultimate_load = 3.5\n", " vehicle.flight_envelope.positive_limit_load = 1.5\n", "\n", " # basic parameters\n", " vehicle.reference_area = 92.\n", " vehicle.passengers = 106\n", " vehicle.systems.control = \"fully powered\"\n", " vehicle.systems.accessories = \"medium range\"\n", "\n", "\n", " #------------------------------------------------------------------------------------------------------------------------------------\n", " # ######################################################## Wings #################################################################### \n", " #------------------------------------------------------------------------------------------------------------------------------------\n", " # ------------------------------------------------------------------\n", " # Main Wing\n", " # ------------------------------------------------------------------\n", " wing = RCAIDE.Library.Components.Wings.Main_Wing()\n", " wing.tag = 'main_wing'\n", " wing.areas.reference = 92.0\n", " wing.aspect_ratio = 8.4\n", " wing.chords.root = 6.2\n", " wing.chords.tip = 1.44\n", " wing.sweeps.quarter_chord = 23.0 * Units.deg\n", " wing.thickness_to_chord = 0.11\n", " wing.taper = 0.28\n", " wing.dihedral = 5.00 * Units.deg\n", " wing.spans.projected = 28.72\n", " wing.origin = [[13.0,0,-1.]]\n", " wing.vertical = False\n", " wing.symmetric = True \n", " wing.high_lift = True\n", " wing.areas.exposed = 0.80 * wing.areas.wetted \n", " wing.twists.root = 2.0 * Units.degrees\n", " wing.twists.tip = 0.0 * Units.degrees \n", " wing.dynamic_pressure_ratio = 1.0\n", " \n", " \n", " segment = RCAIDE.Library.Components.Wings.Segments.Segment()\n", " segment.tag = 'root'\n", " segment.percent_span_location = 0.0\n", " segment.twist = 4. * Units.deg\n", " segment.root_chord_percent = 1.\n", " segment.thickness_to_chord = .11\n", " segment.dihedral_outboard = 5. * Units.degrees\n", " segment.sweeps.quarter_chord = 20.6 * Units.degrees\n", " wing.append_segment(segment) \n", " \n", " segment = RCAIDE.Library.Components.Wings.Segments.Segment()\n", " segment.tag = 'yehudi'\n", " segment.percent_span_location = 0.348\n", " segment.twist = (4. - segment.percent_span_location*4.) * Units.deg\n", " segment.root_chord_percent = 0.60\n", " segment.thickness_to_chord = .11\n", " segment.dihedral_outboard = 4 * Units.degrees\n", " segment.sweeps.quarter_chord = 24.1 * Units.degrees\n", " wing.append_segment(segment)\n", " \n", " segment = RCAIDE.Library.Components.Wings.Segments.Segment()\n", " segment.tag = 'section_2'\n", " segment.percent_span_location = 0.961\n", " segment.twist = (4. - segment.percent_span_location*4.) * Units.deg\n", " segment.root_chord_percent = 0.25\n", " segment.thickness_to_chord = .11\n", " segment.dihedral_outboard = 70. * Units.degrees\n", " segment.sweeps.quarter_chord = 40. * Units.degrees\n", " wing.append_segment(segment)\n", "\n", " segment = RCAIDE.Library.Components.Wings.Segments.Segment() \n", " segment.tag = 'Tip'\n", " segment.percent_span_location = 1.\n", " segment.twist = (4. - segment.percent_span_location*4.) * Units.deg\n", " segment.root_chord_percent = 0.070\n", " segment.thickness_to_chord = .11\n", " segment.dihedral_outboard = 0.\n", " segment.sweeps.quarter_chord = 0.\n", " wing.append_segment(segment) \n", " \n", " # Fill out more segment properties automatically\n", " wing = segment_properties(wing) \n", " \n", " # Add flap\n", " flap = RCAIDE.Library.Components.Wings.Control_Surfaces.Flap() \n", " flap.tag = 'flap' \n", " flap.span_fraction_start = 0.108\n", " flap.span_fraction_end = 0.63\n", " flap.deflection = 0.0 * Units.deg \n", " flap.chord_fraction = 0.18 \n", " flap.configuration_type = 'single_slotted'\n", " wing.append_control_surface(flap) \n", "\n", " wing = wing_planform(wing)\n", " \n", " wing.areas.exposed = 0.80 * wing.areas.wetted\n", " wing.twists.root = 2.0 * Units.degrees\n", " wing.twists.tip = 0.0 * Units.degrees \n", " wing.dynamic_pressure_ratio = 1.0 \n", "\n", " # add to vehicle\n", " vehicle.append_component(wing)\n", " \n", " # ------------------------------------------------------------------\n", " # Horizontal Stabilizer\n", " # ------------------------------------------------------------------\n", "\n", " wing = RCAIDE.Library.Components.Wings.Horizontal_Tail()\n", " wing.tag = 'horizontal_stabilizer'\n", " wing.areas.reference = 26.0\n", " wing.aspect_ratio = 5.5\n", " wing.sweeps.quarter_chord = 34.5 * Units.deg\n", " wing.thickness_to_chord = 0.11\n", " wing.taper = 0.2\n", " wing.dihedral = 8.4 * Units.degrees\n", " wing.origin = [[31,0,1.5]]\n", " wing.vertical = False\n", " wing.symmetric = True \n", " wing.high_lift = False \n", " wing = wing_planform(wing)\n", " wing.areas.exposed = 0.9 * wing.areas.wetted \n", " wing.twists.root = 2.0 * Units.degrees\n", " wing.twists.tip = 2.0 * Units.degrees \n", " wing.dynamic_pressure_ratio = 0.90\n", "\n", " # add to vehicle\n", " vehicle.append_component(wing)\n", "\n", " # ------------------------------------------------------------------\n", " # Vertical Stabilizer\n", " # ------------------------------------------------------------------\n", "\n", " wing = RCAIDE.Library.Components.Wings.Vertical_Tail()\n", " wing.tag = 'vertical_stabilizer'\n", " wing.areas.reference = 16.0\n", " wing.aspect_ratio = 1.7\n", " wing.sweeps.quarter_chord = 35. * Units.deg\n", " wing.thickness_to_chord = 0.11\n", " wing.taper = 0.31\n", " wing.dihedral = 0.00\n", " wing.origin = [[30.4,0,1.675]]\n", " wing.vertical = True\n", " wing.symmetric = False \n", " wing.high_lift = False\n", " wing = wing_planform(wing)\n", " wing.areas.exposed = 0.9 * wing.areas.wetted\n", " wing.twists.root = 0.0 * Units.degrees\n", " wing.twists.tip = 0.0 * Units.degrees \n", " wing.dynamic_pressure_ratio = 1.00\n", " \n", " # add to vehicle\n", " vehicle.append_component(wing)\n", " \n", " # ------------------------------------------------------------------\n", " # Fuselage\n", " # ------------------------------------------------------------------\n", "\n", " fuselage = RCAIDE.Library.Components.Fuselages.Tube_Fuselage() \n", " fuselage.origin = [[0,0,0]]\n", " fuselage.number_coach_seats = vehicle.passengers\n", " fuselage.seats_abreast = 4\n", " fuselage.seat_pitch = 30. * Units.inches\n", "\n", " fuselage.fineness.nose = 1.28\n", " fuselage.fineness.tail = 3.48\n", "\n", " fuselage.lengths.nose = 6.0\n", " fuselage.lengths.tail = 9.0\n", " fuselage.lengths.cabin = 21.24\n", " fuselage.lengths.total = 36.24\n", " fuselage.lengths.fore_space = 0.\n", " fuselage.lengths.aft_space = 0.\n", "\n", " fuselage.width = 3.01 * Units.meters\n", "\n", " fuselage.heights.maximum = 3.35 \n", " fuselage.heights.at_quarter_length = 3.35 \n", " fuselage.heights.at_three_quarters_length = 3.35 \n", " fuselage.heights.at_wing_root_quarter_chord = 3.35 \n", "\n", " fuselage.areas.side_projected = 239.20\n", " fuselage.areas.wetted = 327.01\n", " fuselage.areas.front_projected = 8.0110\n", "\n", " fuselage.effective_diameter = 3.18\n", "\n", " fuselage.differential_pressure = 10**5 * Units.pascal # Maximum differential pressure \n", " \n", "\n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment() \n", " segment.tag = 'segment_0' \n", " segment.percent_x_location = 0.0000\n", " segment.percent_z_location = -0.00144 \n", " segment.height = 0.0100 \n", " segment.width = 0.0100 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment() \n", " segment.tag = 'segment_1' \n", " segment.percent_x_location = 0.00576 \n", " segment.percent_z_location = -0.00144 \n", " segment.height = 0.7500\n", " segment.width = 0.6500\n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_2' \n", " segment.percent_x_location = 0.02017 \n", " segment.percent_z_location = 0.00000 \n", " segment.height = 1.52783 \n", " segment.width = 1.20043 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_3' \n", " segment.percent_x_location = 0.03170 \n", " segment.percent_z_location = 0.00000 \n", " segment.height = 1.96435 \n", " segment.width = 1.52783 \n", " fuselage.append_segment(segment) \n", "\n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_4' \n", " segment.percent_x_location = 0.04899 \t\n", " segment.percent_z_location = 0.00431 \n", " segment.height = 2.72826 \n", " segment.width = 1.96435 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_5' \n", " segment.percent_x_location = 0.07781 \n", " segment.percent_z_location = 0.00861 \n", " segment.height = 3.49217 \n", " segment.width = 2.61913 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_6' \n", " segment.percent_x_location = 0.10375 \n", " segment.percent_z_location = 0.01005 \n", " segment.height = 3.70130 \n", " segment.width = 3.05565 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_7' \n", " segment.percent_x_location = 0.16427 \n", " segment.percent_z_location = 0.01148 \n", " segment.height = 3.92870 \n", " segment.width = 3.71043 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_8' \n", " segment.percent_x_location = 0.22478 \n", " segment.percent_z_location = 0.01148 \n", " segment.height = 3.92870 \n", " segment.width = 3.92870 \n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_9' \n", " segment.percent_x_location = 0.69164 \n", " segment.percent_z_location = 0.01292\n", " segment.height = 3.81957\n", " segment.width = 3.81957\n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_10' \n", " segment.percent_x_location = 0.71758 \n", " segment.percent_z_location = 0.01292\n", " segment.height = 3.81957\n", " segment.width = 3.81957\n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_11' \n", " segment.percent_x_location = 0.78098 \n", " segment.percent_z_location = 0.01722\n", " segment.height = 3.49217\n", " segment.width = 3.71043\n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_12' \n", " segment.percent_x_location = 0.85303\n", " segment.percent_z_location = 0.02296\n", " segment.height = 3.05565\n", " segment.width = 3.16478\n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_13' \n", " segment.percent_x_location = 0.91931 \n", " segment.percent_z_location = 0.03157\n", " segment.height = 2.40087\n", " segment.width = 1.96435\n", " fuselage.append_segment(segment) \n", " \n", " # Segment \n", " segment = RCAIDE.Library.Components.Fuselages.Segments.Segment()\n", " segment.tag = 'segment_14' \n", " segment.percent_x_location = 1.00 \n", " segment.percent_z_location = 0.04593\n", " segment.height = 1.09130\n", " segment.width = 0.21826\n", " fuselage.append_segment(segment) \n", "\n", " # add to vehicle\n", " vehicle.append_component(fuselage) \n", "\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Landing Gear\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " main_gear = RCAIDE.Library.Components.Landing_Gear.Main_Landing_Gear()\n", " main_gear.tire_diameter = 1.12000 * Units.m\n", " main_gear.strut_length = 1.8 * Units.m \n", " main_gear.units = 2 # Number of main landing gear\n", " main_gear.wheels = 2 # Number of wheels on the main landing gear\n", " vehicle.append_component(main_gear) \n", "\n", " nose_gear = RCAIDE.Library.Components.Landing_Gear.Nose_Landing_Gear() \n", " nose_gear.tire_diameter = 0.6858 * Units.m\n", " nose_gear.units = 1 # Number of nose landing gear\n", " nose_gear.wheels = 2 # Number of wheels on the nose landing gear\n", " nose_gear.strut_length = 1.3 * Units.m \n", " vehicle.append_component(nose_gear)\n", "\n", " \n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Fuel Network\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " #initialize the fuel network\n", " net = RCAIDE.Framework.Networks.Fuel() \n", " \n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Fuel Distrubition Line \n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " fuel_line = RCAIDE.Library.Components.Powertrain.Distributors.Fuel_Line() \n", " \n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Fuel Tank & Fuel\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " fuel_tank = RCAIDE.Library.Components.Powertrain.Sources.Fuel_Tanks.Fuel_Tank()\n", " fuel_tank.origin = [[13.0,0,-1.]] \n", " fuel = RCAIDE.Library.Attributes.Propellants.Jet_A() \n", " fuel.mass_properties.mass = vehicle.mass_properties.max_takeoff-vehicle.mass_properties.max_fuel\n", " fuel.origin = [[13.0,0,-1.]] \n", " fuel.mass_properties.center_of_gravity = [[13.0,0,-1.]]\n", " fuel.internal_volume = fuel.mass_properties.mass/fuel.density \n", " fuel_tank.fuel = fuel\n", " fuel_line.fuel_tanks.append(fuel_tank) \n", " \n", "\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Propulsor\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " turbofan = RCAIDE.Library.Components.Powertrain.Propulsors.Turbofan() \n", " turbofan.tag = 'starboard_propulsor'\n", " turbofan.length = 2.71 \n", " turbofan.bypass_ratio = 5.4 \n", " turbofan.design_altitude = 35000.0*Units.ft\n", " turbofan.design_mach_number = 0.78 \n", " turbofan.design_thrust = 37278.0* Units.N/2 \n", " \n", " # Nacelle \n", " nacelle = RCAIDE.Library.Components.Nacelles.Body_of_Revolution_Nacelle()\n", " nacelle.diameter = 2.05\n", " nacelle.length = 2.71\n", " nacelle.tag = 'nacelle_1'\n", " nacelle.inlet_diameter = 2.0\n", " nacelle.origin = [[12.0,4.38,-2.1]] \n", " nacelle.areas.wetted = 1.1*np.pi*nacelle.diameter*nacelle.length\n", " nacelle_airfoil = RCAIDE.Library.Components.Airfoils.NACA_4_Series_Airfoil()\n", " nacelle_airfoil.NACA_4_Series_code = '2410'\n", " nacelle.append_airfoil(nacelle_airfoil)\n", " turbofan.nacelle = nacelle\n", " \n", " # fan \n", " fan = RCAIDE.Library.Components.Powertrain.Converters.Fan() \n", " fan.tag = 'fan'\n", " fan.polytropic_efficiency = 0.93\n", " fan.pressure_ratio = 1.7 \n", " turbofan.fan = fan \n", " \n", " # working fluid \n", " turbofan.working_fluid = RCAIDE.Library.Attributes.Gases.Air() \n", " ram = RCAIDE.Library.Components.Powertrain.Converters.Ram()\n", " ram.tag = 'ram' \n", " turbofan.ram = ram \n", " \n", " # inlet nozzle \n", " inlet_nozzle = RCAIDE.Library.Components.Powertrain.Converters.Compression_Nozzle()\n", " inlet_nozzle.tag = 'inlet nozzle'\n", " inlet_nozzle.polytropic_efficiency = 0.98\n", " inlet_nozzle.pressure_ratio = 0.98 \n", " turbofan.inlet_nozzle = inlet_nozzle\n", "\n", "\n", " # low pressure compressor \n", " low_pressure_compressor = RCAIDE.Library.Components.Powertrain.Converters.Compressor() \n", " low_pressure_compressor.tag = 'lpc'\n", " low_pressure_compressor.polytropic_efficiency = 0.91\n", " low_pressure_compressor.pressure_ratio = 1.9 \n", " turbofan.low_pressure_compressor = low_pressure_compressor\n", "\n", " # high pressure compressor \n", " high_pressure_compressor = RCAIDE.Library.Components.Powertrain.Converters.Compressor() \n", " high_pressure_compressor.tag = 'hpc'\n", " high_pressure_compressor.polytropic_efficiency = 0.91\n", " high_pressure_compressor.pressure_ratio = 10.0 \n", " turbofan.high_pressure_compressor = high_pressure_compressor\n", "\n", " # low pressure turbine \n", " low_pressure_turbine = RCAIDE.Library.Components.Powertrain.Converters.Turbine() \n", " low_pressure_turbine.tag ='lpt'\n", " low_pressure_turbine.mechanical_efficiency = 0.99\n", " low_pressure_turbine.polytropic_efficiency = 0.93 \n", " turbofan.low_pressure_turbine = low_pressure_turbine\n", " \n", " # high pressure turbine \n", " high_pressure_turbine = RCAIDE.Library.Components.Powertrain.Converters.Turbine() \n", " high_pressure_turbine.tag ='hpt'\n", " high_pressure_turbine.mechanical_efficiency = 0.99\n", " high_pressure_turbine.polytropic_efficiency = 0.93 \n", " turbofan.high_pressure_turbine = high_pressure_turbine \n", " \n", " # combustor \n", " combustor = RCAIDE.Library.Components.Powertrain.Converters.Combustor() \n", " combustor.tag = 'Comb'\n", " combustor.efficiency = 0.99 \n", " combustor.alphac = 1.0 \n", " combustor.turbine_inlet_temperature = 1500\n", " combustor.pressure_ratio = 0.95\n", " combustor.fuel_data = RCAIDE.Library.Attributes.Propellants.Jet_A() \n", " turbofan.combustor = combustor\n", " \n", " # core nozzle \n", " core_nozzle = RCAIDE.Library.Components.Powertrain.Converters.Expansion_Nozzle() \n", " core_nozzle.tag = 'core nozzle'\n", " core_nozzle.polytropic_efficiency = 0.95\n", " core_nozzle.pressure_ratio = 0.99 \n", " core_nozzle.diameter = 0.92 \n", " turbofan.core_nozzle = core_nozzle\n", " \n", " # fan nozzle \n", " fan_nozzle = RCAIDE.Library.Components.Powertrain.Converters.Expansion_Nozzle() \n", " fan_nozzle.tag = 'fan nozzle'\n", " fan_nozzle.polytropic_efficiency = 0.95\n", " fan_nozzle.pressure_ratio = 0.99 \n", " fan_nozzle.diameter = 1.659\n", " turbofan.fan_nozzle = fan_nozzle \n", " \n", " # design turbofan\n", " design_turbofan(turbofan) \n", " \n", " # append propulsor to network\n", " net.propulsors.append(turbofan)\n", "\n", "\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Port Propulsor\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " \n", " # copy turbofan\n", " turbofan_2 = deepcopy(turbofan)\n", " turbofan_2.tag = 'port_propulsor' \n", " turbofan_2.origin = [[12.0,-4.38,-1.1]] # change origin \n", " turbofan_2.nacelle.origin = [[12.0,-4.38,-2.1]] \n", " \n", " # append propulsor to network\n", " net.propulsors.append(turbofan_2)\n", "\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Assign propulsors to fuel line \n", " fuel_line.assigned_propulsors = [[turbofan.tag, turbofan_2.tag]]\n", "\n", " #------------------------------------------------------------------------------------------------------------------------------------ \n", " # Append fuel line to fuel line to network \n", " net.fuel_lines.append(fuel_line) \n", " \n", " # Append energy network to aircraft \n", " vehicle.append_energy_network(net) \n", " \n", " return vehicle" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Configurations Setup\n", "\n", "The **`configs_setup`** function defines the different vehicle configurations (referred to as **configs**) used during the simulation. Configurations allow for modifications to the baseline vehicle, such as altering control surface settings, without redefining the entire vehicle.\n", "\n", "---\n", "\n", "## 1. Base Configuration\n", "\n", "The **base configuration** serves as the foundation for all other configurations. It is defined to match the baseline vehicle created in the `vehicle_setup` function. Configurations in RCAIDE are created as **containers** using **RCAIDE Data classes**. These classes provide additional functionality, such as the ability to **append** new configurations or modifications.\n", "\n", "---\n", "\n", "## 2. Cruise Configuration\n", "\n", "The **cruise configuration** demonstrates that new configurations can inherit properties directly from existing configurations (e.g., the base config). This avoids redundancy and ensures consistency across configurations.\n", "\n", "- The cruise configuration typically reflects the clean flight condition, with no high-lift devices like flaps or slats deployed.\n", " \n", "---\n", "\n", "## 3. Takeoff Configuration\n", "\n", "The **takeoff configuration** is the first configuration that introduces changes to the baseline vehicle. It shows how specific vehicle parameters, such as flap and slat settings, can be modified. For example:\n", "\n", "- **Flap Deflection**: Flaps are deployed to increase lift during takeoff.\n", "- **Slat Deployment**: Slats may also be deployed to improve low-speed aerodynamic performance.\n", "\n", "This highlights the flexibility of vehicle configurations for different phases of flight.\n", "\n", "---\n", "\n", "## 4. Remaining Configurations\n", "\n", "The remaining configurations, such as **climb**, **approach**, and **landing**, follow a similar pattern:\n", "\n", "- **Climb**: Partial deployment of flaps/slats to optimize lift and drag during ascent.\n", "- **Approach**: Greater flap and slat deployment for low-speed descent.\n", "- **Landing**: Maximum flap and slat deflection for increased lift and drag, enabling a controlled descent and touchdown.\n", "\n", "Each configuration is built upon the previous one or the base configuration, ensuring modularity and easy customization.\n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "\n", "def configs_setup(vehicle):\n", " \n", " \n", " # ------------------------------------------------------------------\n", " # Initialize Configurations\n", " # ------------------------------------------------------------------\n", "\n", " configs = RCAIDE.Library.Components.Configs.Config.Container() \n", " base_config = RCAIDE.Library.Components.Configs.Config(vehicle)\n", " base_config.tag = 'base' \n", " configs.append(base_config)\n", "\n", " # ------------------------------------------------------------------\n", " # Cruise Configuration\n", " # ------------------------------------------------------------------\n", "\n", " config = RCAIDE.Library.Components.Configs.Config(base_config)\n", " config.tag = 'cruise'\n", " configs.append(config)\n", "\n", "\n", " # ------------------------------------------------------------------\n", " # Takeoff Configuration\n", " # ------------------------------------------------------------------\n", "\n", " config = RCAIDE.Library.Components.Configs.Config(base_config)\n", " config.tag = 'takeoff' \n", " config.networks.fuel.propulsors['starboard_propulsor'].fan.angular_velocity = 3470. * Units.rpm\n", " config.networks.fuel.propulsors['port_propulsor'].fan.angular_velocity = 3470. * Units.rpm \n", " configs.append(config)\n", "\n", " \n", " # ------------------------------------------------------------------\n", " # Cutback Configuration\n", " # ------------------------------------------------------------------\n", "\n", " config = RCAIDE.Library.Components.Configs.Config(base_config)\n", " config.tag = 'cutback' \n", " config.networks.fuel.propulsors['starboard_propulsor'].fan.angular_velocity = 2780. * Units.rpm\n", " config.networks.fuel.propulsors['port_propulsor'].fan.angular_velocity = 2780. * Units.rpm \n", " configs.append(config) \n", " \n", " \n", " \n", " # ------------------------------------------------------------------\n", " # Landing Configuration\n", " # ------------------------------------------------------------------\n", "\n", " config = RCAIDE.Library.Components.Configs.Config(base_config)\n", " config.tag = 'landing' \n", " config.networks.fuel.propulsors['starboard_propulsor'].fan.angular_velocity = 2030. * Units.rpm\n", " config.networks.fuel.propulsors['port_propulsor'].fan.angular_velocity = 2030. * Units.rpm\n", " config.landing_gears.main_gear.gear_extended = True\n", " config.landing_gears.nose_gear.gear_extended = True \n", " configs.append(config) \n", " \n", " # ------------------------------------------------------------------\n", " # Short Field Takeoff Configuration\n", " # ------------------------------------------------------------------ \n", " config = RCAIDE.Library.Components.Configs.Config(base_config)\n", " config.tag = 'short_field_takeoff' \n", " config.networks.fuel.propulsors['starboard_propulsor'].fan.angular_velocity = 3470. * Units.rpm\n", " config.networks.fuel.propulsors['port_propulsor'].fan.angular_velocity = 3470. * Units.rpm\n", " config.landing_gears.main_gear.gear_extended = True\n", " config.landing_gears.nose_gear.gear_extended = True \n", " configs.append(config) \n", "\n", " # done!\n", " return configs\n", "\n", " " ] } ], "metadata": { "kernelspec": { "display_name": ".rcaideenv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.6" } }, "nbformat": 4, "nbformat_minor": 2 }