Exemplo n.º 1
0
def main():
    #only do calculation for 747
    from Boeing_747 import vehicle_setup, configs_setup
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)

    Mach = np.array([0.198])

    segment = SUAVE.Analyses.Mission.Segments.Segment()
    segment.freestream = Data()
    segment.freestream.mach_number = Mach
    segment.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    altitude = 0.0 * Units.feet
    conditions = segment.atmosphere.compute_values(altitude / Units.km)
    segment.a = conditions.speed_of_sound
    segment.freestream.density = conditions.density
    segment.freestream.dynamic_viscosity = conditions.dynamic_viscosity
    segment.freestream.velocity = segment.freestream.mach_number * segment.a

    #Method Test
    cn_b = taw_cnbeta(vehicle, segment, configs.base)
    expected = 0.09427599  # Should be 0.184
    error = Data()
    error.cn_b_747 = (cn_b - expected) / expected

    print error
    for k, v in error.items():
        assert (np.abs(v) < 0.1)

    return
Exemplo n.º 2
0
def main():
    #only do calculation for 747
    from Boeing_747 import vehicle_setup, configs_setup
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    
    Mach                          = np.array([0.198])
    
    segment                              = SUAVE.Analyses.Mission.Segments.Segment()
    segment.freestream                   = Data()
    segment.freestream.mach_number       = Mach
    segment.atmosphere                   = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    altitude                             = 0.0 * Units.feet
    conditions                           = segment.atmosphere.compute_values(altitude / Units.km)
    segment.a                            = conditions.speed_of_sound
    segment.freestream.density           = conditions.density
    segment.freestream.dynamic_viscosity = conditions.dynamic_viscosity
    segment.freestream.velocity          = segment.freestream.mach_number * segment.a
  
    
    #Method Test
    cn_b = taw_cnbeta(vehicle,segment,configs.base)
    expected = 0.09427599 # Should be 0.184
    error = Data()
    error.cn_b_747 = (cn_b-expected)/expected

  
  
    
    print(error)
    for k,v in list(error.items()):
        assert(np.abs(v)<1e-6)

    return
Exemplo n.º 3
0
def main():
    #Parameters Required
        #Using values for a Boeing 747-200
    vehicle = SUAVE.Vehicle()
    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'main_wing'
    wing.areas.reference = 5500.0 * Units.feet**2
    wing.spans.projected = 196.0  * Units.feet
    wing.sweep           = 42.0   * Units.deg # Leading edge
    wing.chords.root     = 42.9   * Units.feet #54.5
    wing.chords.tip      = 14.7   * Units.feet
    wing.chords.mean_aerodynamic = 27.3 * Units.feet
    wing.taper           = wing.chords.tip / wing.chords.root
    wing.aspect_ratio    = wing.spans.projected**2/wing.areas.reference
    wing.symmetric       = True
    wing.origin          = np.array([58.6,0.,3.6]) * Units.feet  
    
    reference = SUAVE.Core.Container()
    vehicle.reference_area = wing.areas.reference
    vehicle.append_component(wing)

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'vertical_stabilizer'
    vertical = SUAVE.Components.Wings.Wing()
    vertical.spans.exposed = 32.4   * Units.feet
    vertical.chords.root   = 38.7 * Units.feet      # vertical.chords.fuselage_intersect
    vertical.chords.tip    = 13.4   * Units.feet
    vertical.sweep         = 50.0   * Units.deg # Leading Edge
    vertical.x_root_LE1    = 180.0  * Units.feet
    vertical.symmetric     = False
    vertical.exposed_root_chord_offset = 13.3   * Units.feet
    ref_vertical           = extend_to_ref_area(vertical)
    wing.areas.reference   = ref_vertical.areas.reference
    wing.spans.projected   = ref_vertical.spans.projected
    wing.chords.root       = ref_vertical.chords.root
    dx_LE_vert             = ref_vertical.root_LE_change
    wing.chords.tip        = vertical.chords.tip
    wing.aspect_ratio      = ref_vertical.aspect_ratio
    wing.sweep             = vertical.sweep
    wing.taper             = wing.chords.tip/wing.chords.root
    wing.origin            = np.array([vertical.x_root_LE1 + dx_LE_vert,0.,0.])
    wing.effective_aspect_ratio = 2.2
    wing.symmetric              = False
    wing.aerodynamic_center     = np.array([trapezoid_ac_x(wing),0.0,0.0])
    Mach                        = np.array([0.198])
    wing.CL_alpha = datcom(wing,Mach)
    vehicle.append_component(wing)

    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'fuselage'
    fuselage.areas.side_projected               = 4696.16 * Units.feet**2
    fuselage.lengths.total                      = 229.7   * Units.feet
    fuselage.heights.maximum                    = 26.9    * Units.feet
    fuselage.width                              = 20.9    * Units.feet
    fuselage.heights.at_quarter_length          = 26.0    * Units.feet
    fuselage.heights.at_three_quarters_length   = 19.7    * Units.feet
    fuselage.heights.at_wing_root_quarter_chord = 23.8    * Units.feet
    vehicle.append_component(fuselage)

    configuration = Data()
    configuration.mass_properties = Data()
    configuration.mass_properties.center_of_gravity = Data()
    configuration.mass_properties.center_of_gravity = np.array([112.2,0,6.8]) * Units.feet

    #segment            = SUAVE.Analyses.Mission.Segments.Base_Segment()
    segment            = SUAVE.Analyses.Mission.Segments.Segment()
    segment.freestream = Data()
    segment.freestream.mach_number = Mach[0]
    segment.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    
    conditions = segment.atmosphere.compute_values(altitude / Units.km)
    segment.a          = conditions.speed_of_sound
    segment.freestream.density   = conditions.density
    segment.freestream.dynamic_viscosity = conditions.dynamic_viscosity
    segment.freestream.velocity  = segment.freestream.mach_number * segment.a

    #Method Test
    cn_b = taw_cnbeta(vehicle,segment,configuration)
    expected = 0.10045 # Should be 0.184
    error = Data()
    error.cn_b_747 = (cn_b-expected)/expected

    #Parameters Required
    #Using values for a Beechcraft Model 99
    #MODEL DOES NOT ACCOUNT FOR DESTABILIZING EFFECTS OF PROPELLERS!
    """wing               = SUAVE.Components.Wings.Wing()
    wing.area          = 280.0 * Units.feet**2
    wing.span          = 46.0  * Units.feet
    wing.sweep_le      = 3.0   * Units.deg
    wing.z_position    = 2.2   * Units.feet
    wing.taper         = 0.46
    wing.aspect_ratio  = wing.span**2/wing.area
    wing.symmetric     = True

    fuselage           = SUAVE.Components.Fuselages.Fuselage()
    fuselage.side_area = 185.36 * Units.feet**2
    fuselage.length    = 44.0   * Units.feet
    fuselage.h_max     = 6.0    * Units.feet
    fuselage.w_max     = 5.4    * Units.feet
    fuselage.height_at_vroot_quarter_chord   = 2.9 * Units.feet
    fuselage.height_at_quarter_length        = 4.8 * Units.feet
    fuselage.height_at_three_quarters_length = 4.3 * Units.feet

    nacelle           = SUAVE.Components.Fuselages.Fuselage()
    nacelle.side_area = 34.45 * Units.feet**2
    nacelle.x_front   = 7.33  * Units.feet
    nacelle.length    = 14.13 * Units.feet
    nacelle.h_max     = 3.68  * Units.feet
    nacelle.w_max     = 2.39  * Units.feet
    nacelle.height_at_quarter_length        = 3.08 * Units.feet
    nacelle.height_at_three_quarters_length = 2.12 * Units.feet

    other_bodies      = [nacelle,nacelle]

    vertical              = SUAVE.Components.Wings.Wing()
    vertical.span         = 6.6  * Units.feet
    vertical.root_chord   = 8.2  * Units.feet
    vertical.tip_chord    = 3.6  * Units.feet
    vertical.sweep_le     = 47.0 * Units.deg
    vertical.x_root_LE1   = 34.8 * Units.feet
    vertical.symmetric    = False
    dz_centerline         = 2.0  * Units.feet
    ref_vertical          = extend_to_ref_area(vertical,dz_centerline)
    vertical.span         = ref_vertical.ref_span
    vertical.area         = ref_vertical.ref_area
    vertical.aspect_ratio = ref_vertical.ref_aspect_ratio
    vertical.x_root_LE    = vertical.x_root_LE1 + ref_vertical.root_LE_change
    vertical.taper        = vertical.tip_chord/ref_vertical.ref_root_chord
    vertical.effective_aspect_ratio = 1.57
    vertical.x_ac_LE      = trapezoid_ac_x(vertical)

    aircraft              = SUAVE.Vehicle()
    aircraft.wing         = wing
    aircraft.fuselage     = fuselage
    aircraft.other_bodies = other_bodies
    aircraft.vertical     = vertical
    aircraft.Mass_Props.pos_cg[0] = 17.2 * Units.feet

    segment            = SUAVE.Analyses.Mission.Segments.Base_Segment()
    segment.M          = 0.152
    segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
    segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
    segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
    segment.v_inf      = segment.M * segment.a

    #Method Test
    expected = 0.12
    print 'Beech 99 at M = {0} and h = {1} meters'.format(segment.M, altitude)
    cn_b = taw_cnbeta(aircraft,segment)

    print 'Cn_beta        = {0:.4f}'.format(cn_b)
    print 'Expected value = {}'.format(expected)
    print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
    print ' '


    #Parameters Required
    #Using values for an SIAI Marchetti S-211
    wing               = SUAVE.Components.Wings.Wing()
    wing.area          = 136.0 * Units.feet**2
    wing.span          = 26.3  * Units.feet
    wing.sweep_le      = 19.5  * Units.deg
    wing.z_position    = -1.1  * Units.feet
    wing.taper         = 3.1/7.03
    wing.aspect_ratio  = wing.span**2/wing.area

    fuselage           = SUAVE.Components.Fuselages.Fuselage()
    fuselage.side_area = 116.009 * Units.feet**2
    fuselage.length    = 30.9    * Units.feet
    fuselage.h_max     = 5.1     * Units.feet
    fuselage.w_max     = 5.9     * Units.feet
    fuselage.height_at_vroot_quarter_chord   = 4.1 * Units.feet
    fuselage.height_at_quarter_length        = 4.5 * Units.feet
    fuselage.height_at_three_quarters_length = 4.3 * Units.feet

    other_bodies       = []

    vertical              = SUAVE.Components.Wings.Wing()
    vertical.span         = 5.8   * Units.feet
    vertical.root_chord   = 5.7   * Units.feet
    vertical.tip_chord    = 2.0   * Units.feet
    vertical.sweep_le     = 40.2  * Units.deg
    vertical.x_root_LE1   = 22.62 * Units.feet
    vertical.symmetric    = False
    dz_centerline         = 2.9   * Units.feet
    ref_vertical          = extend_to_ref_area(vertical,dz_centerline)
    vertical.span         = ref_vertical.ref_span
    vertical.area         = ref_vertical.ref_area
    vertical.aspect_ratio = ref_vertical.ref_aspect_ratio
    vertical.x_root_LE    = vertical.x_root_LE1 + ref_vertical.root_LE_change
    vertical.taper        = vertical.tip_chord/ref_vertical.ref_root_chord
    vertical.effective_aspect_ratio = 2.65
    vertical.x_ac_LE      = trapezoid_ac_x(vertical)

    aircraft              = SUAVE.Vehicle()
    aircraft.wing         = wing
    aircraft.fuselage     = fuselage
    aircraft.other_bodies = other_bodies
    aircraft.vertical     = vertical
    aircraft.Mass_Props.pos_cg[0] = 16.6 * Units.feet

    segment            = SUAVE.Analyses.Mission.Segments.Base_Segment()
    segment.M          = 0.111
    segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
    segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
    segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
    segment.v_inf      = segment.M * segment.a

    #Method Test
    print 'SIAI Marchetti S-211 at M = {0} and h = {1} meters'.format(segment.M, altitude)

    cn_b = taw_cnbeta(aircraft,segment)

    expected = 0.160
    print 'Cn_beta        = {0:.4f}'.format(cn_b)
    print 'Expected value = {}'.format(expected)
    print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
    print ' '"""

    for k,v in error.items():
        assert(np.abs(v)<0.1)

    return
Exemplo n.º 4
0
def main():
    #Parameters Required
    #Using values for a Boeing 747-200
    vehicle = SUAVE.Vehicle()
    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'main_wing'
    wing.areas.reference = 5500.0 * Units.feet**2
    wing.spans.projected = 196.0 * Units.feet
    wing.sweep = 42.0 * Units.deg  # Leading edge
    wing.chords.root = 42.9 * Units.feet  #54.5
    wing.chords.tip = 14.7 * Units.feet
    wing.chords.mean_aerodynamic = 27.3 * Units.feet
    wing.taper = wing.chords.tip / wing.chords.root
    wing.aspect_ratio = wing.spans.projected**2 / wing.areas.reference
    wing.symmetric = True
    wing.origin = np.array([58.6, 0., 3.6]) * Units.feet

    reference = SUAVE.Core.Container()
    vehicle.reference_area = wing.areas.reference
    vehicle.append_component(wing)

    wing = SUAVE.Components.Wings.Wing()
    wing.tag = 'vertical_stabilizer'
    vertical = SUAVE.Components.Wings.Wing()
    vertical.spans.exposed = 32.4 * Units.feet
    vertical.chords.root = 38.7 * Units.feet  # vertical.chords.fuselage_intersect
    vertical.chords.tip = 13.4 * Units.feet
    vertical.sweep = 50.0 * Units.deg  # Leading Edge
    vertical.x_root_LE1 = 180.0 * Units.feet
    vertical.symmetric = False
    vertical.exposed_root_chord_offset = 13.3 * Units.feet
    ref_vertical = extend_to_ref_area(vertical)
    wing.areas.reference = ref_vertical.areas.reference
    wing.spans.projected = ref_vertical.spans.projected
    wing.chords.root = ref_vertical.chords.root
    dx_LE_vert = ref_vertical.root_LE_change
    wing.chords.tip = vertical.chords.tip
    wing.aspect_ratio = ref_vertical.aspect_ratio
    wing.sweep = vertical.sweep
    wing.taper = wing.chords.tip / wing.chords.root
    wing.origin = np.array([vertical.x_root_LE1 + dx_LE_vert, 0., 0.])
    wing.effective_aspect_ratio = 2.2
    wing.symmetric = False
    wing.aerodynamic_center = np.array([trapezoid_ac_x(wing), 0.0, 0.0])
    Mach = np.array([0.198])
    wing.CL_alpha = datcom(wing, Mach)
    vehicle.append_component(wing)

    fuselage = SUAVE.Components.Fuselages.Fuselage()
    fuselage.tag = 'fuselage'
    fuselage.areas.side_projected = 4696.16 * Units.feet**2
    fuselage.lengths.total = 229.7 * Units.feet
    fuselage.heights.maximum = 26.9 * Units.feet
    fuselage.width = 20.9 * Units.feet
    fuselage.heights.at_quarter_length = 26.0 * Units.feet
    fuselage.heights.at_three_quarters_length = 19.7 * Units.feet
    fuselage.heights.at_wing_root_quarter_chord = 23.8 * Units.feet
    vehicle.append_component(fuselage)

    configuration = Data()
    configuration.mass_properties = Data()
    configuration.mass_properties.center_of_gravity = Data()
    configuration.mass_properties.center_of_gravity = np.array([112.2, 0, 6.8
                                                                ]) * Units.feet

    #segment            = SUAVE.Analyses.Mission.Segments.Base_Segment()
    segment = SUAVE.Analyses.Mission.Segments.Segment()
    segment.freestream = Data()
    segment.freestream.mach_number = Mach
    segment.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
    altitude = 0.0 * Units.feet

    conditions = segment.atmosphere.compute_values(altitude / Units.km)
    segment.a = conditions.speed_of_sound
    segment.freestream.density = conditions.density
    segment.freestream.dynamic_viscosity = conditions.dynamic_viscosity
    segment.freestream.velocity = segment.freestream.mach_number * segment.a

    #Method Test
    cn_b = taw_cnbeta(vehicle, segment, configuration)
    expected = 0.08122837  # Should be 0.184
    error = Data()
    error.cn_b_747 = (cn_b - expected) / expected

    #Parameters Required
    #Using values for a Beechcraft Model 99
    #MODEL DOES NOT ACCOUNT FOR DESTABILIZING EFFECTS OF PROPELLERS!
    """wing               = SUAVE.Components.Wings.Wing()
    wing.area          = 280.0 * Units.feet**2
    wing.span          = 46.0  * Units.feet
    wing.sweep_le      = 3.0   * Units.deg
    wing.z_position    = 2.2   * Units.feet
    wing.taper         = 0.46
    wing.aspect_ratio  = wing.span**2/wing.area
    wing.symmetric     = True

    fuselage           = SUAVE.Components.Fuselages.Fuselage()
    fuselage.side_area = 185.36 * Units.feet**2
    fuselage.length    = 44.0   * Units.feet
    fuselage.h_max     = 6.0    * Units.feet
    fuselage.w_max     = 5.4    * Units.feet
    fuselage.height_at_vroot_quarter_chord   = 2.9 * Units.feet
    fuselage.height_at_quarter_length        = 4.8 * Units.feet
    fuselage.height_at_three_quarters_length = 4.3 * Units.feet

    nacelle           = SUAVE.Components.Fuselages.Fuselage()
    nacelle.side_area = 34.45 * Units.feet**2
    nacelle.x_front   = 7.33  * Units.feet
    nacelle.length    = 14.13 * Units.feet
    nacelle.h_max     = 3.68  * Units.feet
    nacelle.w_max     = 2.39  * Units.feet
    nacelle.height_at_quarter_length        = 3.08 * Units.feet
    nacelle.height_at_three_quarters_length = 2.12 * Units.feet

    other_bodies      = [nacelle,nacelle]

    vertical              = SUAVE.Components.Wings.Wing()
    vertical.span         = 6.6  * Units.feet
    vertical.root_chord   = 8.2  * Units.feet
    vertical.tip_chord    = 3.6  * Units.feet
    vertical.sweep_le     = 47.0 * Units.deg
    vertical.x_root_LE1   = 34.8 * Units.feet
    vertical.symmetric    = False
    dz_centerline         = 2.0  * Units.feet
    ref_vertical          = extend_to_ref_area(vertical,dz_centerline)
    vertical.span         = ref_vertical.ref_span
    vertical.area         = ref_vertical.ref_area
    vertical.aspect_ratio = ref_vertical.ref_aspect_ratio
    vertical.x_root_LE    = vertical.x_root_LE1 + ref_vertical.root_LE_change
    vertical.taper        = vertical.tip_chord/ref_vertical.ref_root_chord
    vertical.effective_aspect_ratio = 1.57
    vertical.x_ac_LE      = trapezoid_ac_x(vertical)

    aircraft              = SUAVE.Vehicle()
    aircraft.wing         = wing
    aircraft.fuselage     = fuselage
    aircraft.other_bodies = other_bodies
    aircraft.vertical     = vertical
    aircraft.Mass_Props.pos_cg[0] = 17.2 * Units.feet

    segment            = SUAVE.Analyses.Mission.Segments.Base_Segment()
    segment.M          = 0.152
    segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
    segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
    segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
    segment.v_inf      = segment.M * segment.a

    #Method Test
    expected = 0.12
    print 'Beech 99 at M = {0} and h = {1} meters'.format(segment.M, altitude)
    cn_b = taw_cnbeta(aircraft,segment)

    print 'Cn_beta        = {0:.4f}'.format(cn_b)
    print 'Expected value = {}'.format(expected)
    print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
    print ' '


    #Parameters Required
    #Using values for an SIAI Marchetti S-211
    wing               = SUAVE.Components.Wings.Wing()
    wing.area          = 136.0 * Units.feet**2
    wing.span          = 26.3  * Units.feet
    wing.sweep_le      = 19.5  * Units.deg
    wing.z_position    = -1.1  * Units.feet
    wing.taper         = 3.1/7.03
    wing.aspect_ratio  = wing.span**2/wing.area

    fuselage           = SUAVE.Components.Fuselages.Fuselage()
    fuselage.side_area = 116.009 * Units.feet**2
    fuselage.length    = 30.9    * Units.feet
    fuselage.h_max     = 5.1     * Units.feet
    fuselage.w_max     = 5.9     * Units.feet
    fuselage.height_at_vroot_quarter_chord   = 4.1 * Units.feet
    fuselage.height_at_quarter_length        = 4.5 * Units.feet
    fuselage.height_at_three_quarters_length = 4.3 * Units.feet

    other_bodies       = []

    vertical              = SUAVE.Components.Wings.Wing()
    vertical.span         = 5.8   * Units.feet
    vertical.root_chord   = 5.7   * Units.feet
    vertical.tip_chord    = 2.0   * Units.feet
    vertical.sweep_le     = 40.2  * Units.deg
    vertical.x_root_LE1   = 22.62 * Units.feet
    vertical.symmetric    = False
    dz_centerline         = 2.9   * Units.feet
    ref_vertical          = extend_to_ref_area(vertical,dz_centerline)
    vertical.span         = ref_vertical.ref_span
    vertical.area         = ref_vertical.ref_area
    vertical.aspect_ratio = ref_vertical.ref_aspect_ratio
    vertical.x_root_LE    = vertical.x_root_LE1 + ref_vertical.root_LE_change
    vertical.taper        = vertical.tip_chord/ref_vertical.ref_root_chord
    vertical.effective_aspect_ratio = 2.65
    vertical.x_ac_LE      = trapezoid_ac_x(vertical)

    aircraft              = SUAVE.Vehicle()
    aircraft.wing         = wing
    aircraft.fuselage     = fuselage
    aircraft.other_bodies = other_bodies
    aircraft.vertical     = vertical
    aircraft.Mass_Props.pos_cg[0] = 16.6 * Units.feet

    segment            = SUAVE.Analyses.Mission.Segments.Base_Segment()
    segment.M          = 0.111
    segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
    altitude           = 0.0 * Units.feet
    segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
    segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
    segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
    segment.v_inf      = segment.M * segment.a

    #Method Test
    print 'SIAI Marchetti S-211 at M = {0} and h = {1} meters'.format(segment.M, altitude)

    cn_b = taw_cnbeta(aircraft,segment)

    expected = 0.160
    print 'Cn_beta        = {0:.4f}'.format(cn_b)
    print 'Expected value = {}'.format(expected)
    print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
    print ' '"""

    for k, v in error.items():
        assert (np.abs(v) < 0.1)

    return
Exemplo n.º 5
0
    def __call__(self, conditions):
        """ process vehicle to setup geometry, condititon and configuration
            
            Inputs:
                conditions - DataDict() of aerodynamic conditions
                results - DataDict() of 
                
            Outputs:

                
            Assumptions:

                
        """

        # unpack
        configuration = self.configuration
        geometry = self.geometry
        stability_model = self.stability_model

        q = conditions.freestream.dynamic_pressure
        Sref = geometry.reference_area
        mach = conditions.freestream.mach_number
        velocity = conditions.freestream.velocity
        density = conditions.freestream.density
        Span = geometry.wings['main_wing'].spans.projected
        mac = geometry.wings['main_wing'].chords.mean_aerodynamic
        aero = conditions.aerodynamics

        # set up data structures
        static_stability = Data()
        dynamic_stability = Data()

        # Calculate CL_alpha
        if not conditions.has_key('lift_curve_slope'):
            conditions.lift_curve_slope = datcom(geometry.wings['main_wing'],
                                                 mach)

        # Calculate change in downwash with respect to change in angle of attack
        for surf in geometry.wings:
            sref = surf.areas.reference
            span = (surf.aspect_ratio * sref)**0.5
            surf.CL_alpha = datcom(surf, mach)
            surf.ep_alpha = Supporting_Functions.ep_alpha(
                surf.CL_alpha, sref, span)

        # Static Stability Methods
        static_stability.cm_alpha = taw_cmalpha(geometry, mach, conditions,
                                                configuration)
        static_stability.cn_beta = taw_cnbeta(geometry, conditions,
                                              configuration)

        # Dynamic Stability
        if np.count_nonzero(
                configuration.mass_properties.moments_of_inertia.tensor) > 0:
            # Dynamic Stability Approximation Methods - valid for non-zero I tensor

            # Derivative of yawing moment with respect to the rate of yaw
            cDw = aero.drag_breakdown.parasite[
                'main_wing'].parasite_drag_coefficient  # Might not be the correct value
            l_v = geometry.wings['vertical_stabilizer'].origin[
                0] + geometry.wings['vertical_stabilizer'].aerodynamic_center[
                    0] - geometry.wings['main_wing'].origin[
                        0] - geometry.wings['main_wing'].aerodynamic_center[0]
            dynamic_stability.cn_r = Supporting_Functions.cn_r(
                cDw, geometry.wings['vertical_stabilizer'].areas.reference,
                Sref, l_v, span,
                geometry.wings['vertical_stabilizer'].dynamic_pressure_ratio,
                geometry.wings['vertical_stabilizer'].CL_alpha)

            # Derivative of rolling moment with respect to roll rate
            dynamic_stability.cl_p = 0  # Need to see if there is a low fidelity way to calculate cl_p

            # Derivative of roll rate with respect to sideslip (dihedral effect)
            dynamic_stability.cl_beta = 0  # Need to see if there is a low fidelity way to calculate cl_beta

            # Derivative of pitching moment with respect to pitch rate
            l_t = geometry.wings['horizontal_stabilizer'].origin[
                0] + geometry.wings['horizontal_stabilizer'].aerodynamic_center[
                    0] - geometry.wings['main_wing'].origin[
                        0] - geometry.wings['main_wing'].aerodynamic_center[
                            0]  #Need to check this is the length of the horizontal tail moment arm
            dynamic_stability.cm_q = Supporting_Functions.cm_q(
                conditions.lift_curve_slope, l_t,
                mac)  # Need to check Cm_i versus Cm_alpha

            # Derivative of pitching rate with respect to d(alpha)/d(t)
            dynamic_stability.cm_alpha_dot = Supporting_Functions.cm_alphadot(
                static_stability.cm_alpha,
                geometry.wings['horizontal_stabilizer'].ep_alpha, l_t,
                mac)  # Need to check Cm_i versus Cm_alpha

            # Derivative of Z-axis force with respect to angle of attack
            dynamic_stability.cz_alpha = Supporting_Functions.cz_alpha(
                aero.drag_coefficient, conditions.lift_curve_slope)

            stability_model.dutch_roll = Approximations.dutch_roll(
                velocity, static_stability.cn_beta, Sref, density, Span,
                configuration.mass_properties.moments_of_inertia.tensor[2][2],
                dynamic_stability.cn_r)

            if dynamic_stability.cl_p != 0:
                stability_model.roll_tau = Approximations.roll(
                    configuration.mass_properties.momen[2][2], Sref, density,
                    velocity, Span, dynamic_stability.cl_p)
                dynamic_stability.cy_phi = Supporting_Functions.cy_phi(
                    aero.lift_coefficient)
                dynamic_stability.cl_r = Supporting_Functions.cl_r(
                    aero.lift_coefficient)  # Will need to be changed
                stability_model.spiral_tau = Approximations.spiral(
                    conditions.weights.total_mass, velocity, density, Sref,
                    dynamic_stability.cl_p, static_stability.cn_beta,
                    dynamic_stability.cy_phi, dynamic_stability.cl_beta,
                    dynamic_stability.cn_r, dynamic_stability.cl_r)
            stability_model.short_period = Approximations.short_period(
                velocity, density, Sref, mac, dynamic_stability.cm_q,
                dynamic_stability.cz_alpha, conditions.weights.total_mass,
                static_stability.cm_alpha,
                configuration.mass_properties.moments_of_inertia.tensor[1][1],
                dynamic_stability.cm_alpha_dot)
            stability_model.phugoid = Approximations.phugoid(
                conditions.freestream.gravity, conditions.freestream.velocity,
                aero.drag_coefficient, aero.lift_coefficient)

            # Dynamic Stability Full Linearized Methods
            if aero.has_key(
                    'cy_beta'
            ) and dynamic_stability.cl_p != 0 and dynamic_stability.cl_beta != 0:
                theta = conditions.frames.wind.body_rotations[:, 1]
                dynamic_stability.cy_beta = aero.cy_beta
                dynamic_stability.cl_psi = Supporting_Functions.cy_psi(
                    aero.lift_coefficient, theta)
                dynamic_stability.cL_u = 0
                dynamic_stability.cz_u = Supporting_Functions.cz_u(
                    aero.lift_coefficient, velocity, dynamic_stability.cL_u)
                dynamic_stability.cz_alpha_dot = Supporting_Functions.cz_alphadot(
                    static_stability.cm_alpha,
                    geometry.wings['horizontal_stabilizer'].ep_alpha)
                dynamic_stability.cz_q = Supporting_Functions.cz_q(
                    static_stability.cm_alpha)
                dynamic_stability.cx_u = Supporting_Functions.cx_u(
                    aero.drag_coefficient)
                dynamic_stability.cx_alpha = Supporting_Functions.cx_alpha(
                    aero.lift_coefficient, conditions.lift_curve_slope)

                lateral_directional = Full_Linearized_Equations.lateral_directional(
                    velocity, static_stability.cn_beta, Sref, density, Span,
                    configuration.mass_properties.moments_of_inertia.tensor[2]
                    [2], dynamic_stability.cn_r,
                    configuration.mass_properties.Moments_Of_Inertia.tensor[0]
                    [0], dynamic_stability.cl_p,
                    configuration.mass_properties.moments_of_inertia.tensor[0]
                    [2], dynamic_stability.cl_r, dynamic_stability.cl_beta,
                    dynamic_stability.cn_p, dynamic_stability.cy_phi,
                    dynamic_stability.cy_psi, dynamic_stability.cy_beta,
                    conditions.weights.total_mass)
                longitudinal = Full_Linearized_Equations.longitudinal(
                    velocity, density, Sref, mac, dynamic_stability.cm_q,
                    dynamic_stability.cz_alpha, conditions.weights.total_mass,
                    static_stability.cm_alpha,
                    configuration.mass_properties.moments_of_inertia.tensor[1]
                    [1], dynamic_stability.cm_alpha_dot,
                    dynamic_stability.cz_u, dynamic_stability.cz_alpha_dot,
                    dynamic_stability.cz_q, -aero.lift_coefficient, theta,
                    dynamic_stability.cx_u, dynamic_stability.cx_alpha)
                stability_model.dutch_roll.natural_frequency = lateral_directional.dutch_natural_frequency
                stability_model.dutch_roll.damping_ratio = lateral_directional.dutch_damping_ratio
                stability_model.spiral_tau = lateral_directional.spiral_tau
                stability_model.roll_tau = lateral_directional.roll_tau
                stability_model.short_period.natural_frequency = longitudinal.short_natural_frequency
                stability_model.short_period.damping_ratio = longitudinal.short_damping_ratio
                stability_model.phugoid.natural_frequency = longitudinal.phugoid_natural_frequency
                stability_model.phugoid.damping_ratio = longitudinal.phugoid_damping_ratio

        # pack results
        results = Data()
        results.static = static_stability
        results.dynamic = dynamic_stability

        return results
Exemplo n.º 6
0
    def __call__(self,conditions):
            """ process vehicle to setup geometry, condititon and configuration
                
                Inputs:
                    conditions - DataDict() of aerodynamic conditions
                    results - DataDict() of 
                    
                Outputs:

                    
                Assumptions:

                    
            """
            
            # unpack
            configuration = self.configuration
            geometry      = self.geometry
            q             = conditions.freestream.dynamic_pressure
            Sref          = geometry.reference_area    
            mach          = conditions.freestream.mach_number
            velocity      = conditions.freestream.velocity
            density       = conditions.freestream.density
            Span          = geometry.Wings['Main Wing'].span
            mac           = geometry.Wings['Main Wing'].chord_mac
            aero          = conditions.aerodynamics
            
            # Calculate CL_alpha 
            if not conditions.has_key('lift_curve_slope'):
                conditions.lift_curve_slope = (datcom(geometry.Wings['Main Wing'],mach))
            
            # Calculate change in downwash with respect to change in angle of attack
            for surf in geometry.Wings:
                e = surf.e
                sref = surf.sref
                span = (surf.ar * sref ) ** 0.5
                surf.CL_alpha = datcom(surf,mach)
                surf.ep_alpha = Supporting_Functions.ep_alpha(surf.CL_alpha, sref, span, e)
            
            # Static Stability Methods
            aero.cm_alpha = taw_cmalpha(geometry,mach,conditions,configuration)
            aero.cn_beta = taw_cnbeta(geometry,conditions,configuration)
            
            if np.count_nonzero(configuration.mass_props.I_cg) > 0:         
                # Dynamic Stability Approximation Methods
                if not aero.has_key('cn_r'):  
                    cDw = aero.drag_breakdown.parasite['Main Wing'].parasite_drag_coefficient # Might not be the correct value
                    l_v = geometry.Wings['Vertical Stabilizer'].origin[0] + geometry.Wings['Vertical Stabilizer'].aero_center[0] - geometry.Wings['Main Wing'].origin[0] - geometry.Wings['Main Wing'].aero_center[0]
                    aero.cn_r = Supporting_Functions.cn_r(cDw, geometry.Wings['Vertical Stabilizer'].sref, Sref, l_v, span, geometry.Wings['Vertical Stabilizer'].eta, geometry.Wings['Vertical Stabilizer'].CL_alpha)
                if not aero.has_key('cl_p'):
                    aero.cl_p = 0 # Need to see if there is a low fidelity way to calculate cl_p
                    
                if not aero.has_key('cl_beta'):
                    aero.cl_beta = 0 # Need to see if there is a low fidelity way to calculate cl_beta
                
                l_t = geometry.Wings['Horizontal Stabilizer'].origin[0] + geometry.Wings['Horizontal Stabilizer'].aero_center[0] - geometry.Wings['Main Wing'].origin[0] - geometry.Wings['Main Wing'].aero_center[0] #Need to check this is the length of the horizontal tail moment arm       
                
                if not aero.has_key('cm_q'):
                    aero.cm_q = Supporting_Functions.cm_q(conditions.lift_curve_slope, l_t,mac) # Need to check Cm_i versus Cm_alpha
                
                if not aero.has_key('cm_alpha_dot'):
                    aero.cm_alpha_dot = Supporting_Functions.cm_alphadot(aero.cm_alpha, geometry.Wings['Horizontal Stabilizer'].ep_alpha, l_t, mac) # Need to check Cm_i versus Cm_alpha
                    
                if not aero.has_key('cz_alpha'):
                    aero.cz_alpha = Supporting_Functions.cz_alpha(aero.drag_coefficient,conditions.lift_curve_slope)                   
                
                conditions.dutch_roll = Approximations.dutch_roll(velocity, aero.cn_beta, Sref, density, Span, configuration.mass_props.I_cg[2][2], aero.cn_r)
                
                if aero.cl_p != 0:                 
                    roll_tau = Approximations.roll(configuration.mass_props.I_cg[2][2], Sref, density, velocity, Span, aero.cl_p)
                    if aero.cl_beta != 0:
                        aero.cy_phi = Supporting_Functions.cy_phi(aero.lift_coefficient)
                        aero.cl_r = Supporting_Functions.cl_r( aero.lift_coefficient) # Will need to be changed
                        spiral_tau = Approximations.spiral(conditions.weights.total_mass, velocity, density, Sref, aero.cl_p, aero.cn_beta, aero.cy_phi, aero.cl_beta, aero.cn_r, aero.cl_r)
                conditions.short_period = Approximations.short_period(velocity, density, Sref, mac, aero.cm_q, aero.cz_alpha, conditions.weights.total_mass, aero.cm_alpha, configuration.mass_props.I_cg[1][1], aero.cm_alpha_dot)
                conditions.phugoid = Approximations.phugoid(conditions.freestream.gravity, conditions.freestream.velocity, aero.drag_coefficient, aero.lift_coefficient)
                
                # Dynamic Stability Full Linearized Methods
                if aero.has_key('cy_beta') and aero.cl_p != 0 and aero.cl_beta != 0:
                    if not aero.has_key('cy_psi'):
                        theta = conditions.frames.wind.body_rotations[:,1]
                        aero.cl_psi = Supporting_Functions.cy_psi(aero.lift_coefficient, theta)                     
                    if not aero.has_key('cz_u'):
                        if not aero.has_key('cL_u'):
                            aero.cL_u = 0
                        aero.cz_u = Supporting_Functions.cz_u(aero.lift_coefficient,velocity,aero.cL_u)
                    if not aero.has_key('cz_alpha_dot'):
                        aero.cz_alpha_dot = Supporting_Functions.cz_alphadot(aero.cm_alpha, geometry.Wings['Horizontal Stabilizer'].ep_alpha)
                    if not aero.has_key('cz_q'):
                        aero.cz_q = Supporting_Functions.cz_q(aero.cm_alpha)
                    if not aero.has_key('cx_u'):
                        aero.cx_u = Supporting_Functions.cx_u(aero.drag_coefficient)
                    if not aero.has_key('cx_alpha'):
                        aero.cx_alpha = Supporting_Functions.cx_alpha(aero.lift_coefficient, conditions.lift_curve_slope)
                
                    lateral_directional = Full_Linearized_Equations.lateral_directional(velocity, aero.cn_beta , Sref, density, Span, configuration.mass_props.I_cg[2][2], aero.cn_r, configuration.mass_props.I_cg[0][0], aero.cl_p, configuration.mass_props.I_cg[0][2], aero.cl_r, aero.cl_beta, aero.cn_p, aero.cy_phi, aero.cy_psi, aero.cy_beta, conditions.weights.total_mass)
                    longitudinal = Full_Linearized_Equations.longitudinal(velocity, density, Sref, mac, aero.cm_q, aero.cz_alpha, conditions.weights.total_mass, aero.cm_alpha, configuration.mass_props.I_cg[1][1], aero.cm_alpha_dot, aero.cz_u, aero.cz_alpha_dot, aero.cz_q, -aero.lift_coefficient, theta, aero.cx_u, aero.cx_alpha)
            
            return 
Exemplo n.º 7
0
    def __call__(self, conditions):
        """ Process vehicle to setup geometry, condititon and configuration

        Assumptions:
        None

        Source:
        N/A

        Inputs:
        conditions - DataDict() of aerodynamic conditions
        results    - DataDict() of moment coeffients and stability and body axis derivatives

        Outputs:
        None

        Properties Used:
        self.geometry
        """

        # unpack
        configuration = self.configuration
        geometry = self.geometry

        q = conditions.freestream.dynamic_pressure
        Sref = geometry.reference_area
        mach = conditions.freestream.mach_number
        velocity = conditions.freestream.velocity
        density = conditions.freestream.density
        Span = geometry.wings['main_wing'].spans.projected
        mac = geometry.wings['main_wing'].chords.mean_aerodynamic
        aero = conditions.aerodynamics

        # set up data structures
        stability = Data()
        stability.static = Data()
        stability.dynamic = Data()

        # Calculate CL_alpha
        conditions.lift_curve_slope = datcom(geometry.wings['main_wing'], mach)

        # Calculate change in downwash with respect to change in angle of attack
        for surf in geometry.wings:
            sref = surf.areas.reference
            span = (surf.aspect_ratio * sref)**0.5
            surf.CL_alpha = datcom(surf, mach)
            surf.ep_alpha = Supporting_Functions.ep_alpha(
                surf.CL_alpha, sref, span)

        # Static Stability Methods
        stability.static.Cm_alpha, stability.static.Cm0, stability.static.CM = taw_cmalpha(
            geometry, mach, conditions, configuration)

        if 'vertical_stabilizer' in geometry.wings:
            stability.static.Cn_beta = taw_cnbeta(geometry, conditions,
                                                  configuration)
        else:
            stability.static.Cn_beta = np.zeros_like(mach)

        # calculate the static margin
        stability.static.static_margin = -stability.static.Cm_alpha / conditions.lift_curve_slope

        # Dynamic Stability
        if np.count_nonzero(
                configuration.mass_properties.moments_of_inertia.tensor) > 0:
            # Dynamic Stability Approximation Methods - valid for non-zero I tensor

            # Derivative of yawing moment with respect to the rate of yaw
            cDw = aero.drag_breakdown.parasite[
                'main_wing'].parasite_drag_coefficient  # Might not be the correct value
            l_v = geometry.wings['vertical_stabilizer'].origin[
                0] + geometry.wings['vertical_stabilizer'].aerodynamic_center[
                    0] - geometry.wings['main_wing'].origin[
                        0] - geometry.wings['main_wing'].aerodynamic_center[0]
            stability.static.Cn_r = Supporting_Functions.cn_r(
                cDw, geometry.wings['vertical_stabilizer'].areas.reference,
                Sref, l_v, span,
                geometry.wings['vertical_stabilizer'].dynamic_pressure_ratio,
                geometry.wings['vertical_stabilizer'].CL_alpha)

            # Derivative of rolling moment with respect to roll rate
            stability.static.Cl_p = Supporting_Functions.cl_p(
                conditions.lift_curve_slope, geometry)

            # Derivative of roll rate with respect to sideslip (dihedral effect)
            if 'dihedral' in geometry.wings['main_wing']:
                stability.static.Cl_beta = Supporting_Functions.cl_beta(
                    geometry, stability.static.Cl_p)
            else:
                stability.static.Cl_beta = np.zeros(1)

            stability.static.Cy_beta = 0

            # Derivative of pitching moment with respect to pitch rate
            l_t = geometry.wings['horizontal_stabilizer'].origin[
                0] + geometry.wings['horizontal_stabilizer'].aerodynamic_center[
                    0] - geometry.wings['main_wing'].origin[
                        0] - geometry.wings['main_wing'].aerodynamic_center[
                            0]  #Need to check this is the length of the horizontal tail moment arm
            stability.static.Cm_q = Supporting_Functions.cm_q(
                conditions.lift_curve_slope, l_t,
                mac)  # Need to check Cm_i versus Cm_alpha

            # Derivative of pitching rate with respect to d(alpha)/d(t)
            stability.static.Cm_alpha_dot = Supporting_Functions.cm_alphadot(
                stability.static.Cm_alpha,
                geometry.wings['horizontal_stabilizer'].ep_alpha, l_t,
                mac)  # Need to check Cm_i versus Cm_alpha

            # Derivative of Z-axis force with respect to angle of attack
            stability.static.Cz_alpha = Supporting_Functions.cz_alpha(
                aero.drag_coefficient, conditions.lift_curve_slope)

            dutch_roll = Approximations.dutch_roll(
                velocity, stability.static.Cn_beta, Sref, density, Span,
                configuration.mass_properties.moments_of_inertia.tensor[2][2],
                stability.static.Cn_r)
            stability.dynamic.dutchRollFreqHz = dutch_roll.natural_frequency
            stability.dynamic.dutchRollDamping = dutch_roll.damping_ratio

            if stability.static.Cl_p.all() != 0:
                stability.dynamic.rollSubsistenceTimeConstant = Approximations.roll(
                    configuration.mass_properties.moments_of_inertia.tensor[2]
                    [2], Sref, density, velocity, Span, stability.static.Cl_p)
                stability.static.Cy_phi = Supporting_Functions.cy_phi(
                    aero.lift_coefficient)
                stability.static.Cl_r = Supporting_Functions.cl_r(
                    aero.lift_coefficient)  # Will need to be changed
                stability.dynamic.spiralSubsistenceTimeConstant = Approximations.spiral(conditions.weights.total_mass, velocity, density, Sref, stability.static.Cl_p, stability.static.Cn_beta, stability.static.Cy_phi,\
                                                                            stability.static.Cl_beta, stability.static.Cn_r, stability.static.Cl_r)

            short_period_res                               = Approximations.short_period(velocity, density, Sref, mac, stability.static.Cm_q, stability.static.Cz_alpha, conditions.weights.total_mass, stability.static.Cm_alpha,\
                                                            configuration.mass_properties.moments_of_inertia.tensor[1][1], stability.static.Cm_alpha_dot)
            stability.dynamic.shortPeriodFreqHz = short_period_res.natural_frequency
            stability.dynamic.shortPeriodDamp = short_period_res.damping_ratio

            phugoid_res = Approximations.phugoid(
                conditions.freestream.gravity, conditions.freestream.velocity,
                aero.drag_coefficient, aero.lift_coefficient)
            stability.dynamic.phugoidFreqHz = phugoid_res.natural_frequency
            stability.dynamic.phugoidDamp = phugoid_res.damping_ratio

            # Dynamic Stability Full Linearized Methods
            if stability.static.Cy_beta != 0 and stability.static.Cl_p.all(
            ) != 0 and stability.static.Cl_beta.all() != 0:
                theta = conditions.frames.wind.body_rotations[:, 1]
                stability.static.Cy_psi = Supporting_Functions.cy_psi(
                    aero.lift_coefficient, theta)
                stability.static.CL_u = 0
                stability.static.Cz_u = Supporting_Functions.cz_u(
                    aero.lift_coefficient, velocity, stability.static.cL_u)
                stability.static.Cz_alpha_dot = Supporting_Functions.cz_alphadot(
                    stability.static.Cm_alpha,
                    geometry.wings['horizontal_stabilizer'].ep_alpha)
                stability.static.Cz_q = Supporting_Functions.cz_q(
                    stability.static.Cm_alpha)
                stability.static.Cx_u = Supporting_Functions.cx_u(
                    aero.drag_coefficient)
                stability.static.Cx_alpha = Supporting_Functions.cx_alpha(
                    aero.lift_coefficient, conditions.lift_curve_slope)

                lateral_directional = Full_Linearized_Equations.lateral_directional(velocity, stability.static.cn_beta , Sref, density, Span, configuration.mass_properties.moments_of_inertia.tensor[2][2], stability.static.Cn_r,\
                                    configuration.mass_properties.moments_of_inertia.tensor[0][0], stability.static.Cl_p, configuration.mass_properties.moments_of_inertia.tensor[0][2], stability.static.Cl_r, stability.static.Cl_beta,\
                                    stability.static.Cn_p, stability.static.Cy_phi, stability.static.Cy_psi, stability.static.Cy_beta, conditions.weights.total_mass)
                longitudinal        = Full_Linearized_Equations.longitudinal(velocity, density, Sref, mac, stability.static.Cm_q, stability.static.Cz_alpha, conditions.weights.total_mass, stability.static.Cm_alpha, \
                                    configuration.mass_properties.moments_of_inertia.tensor[1][1], stability.static.Cm_alpha_dot, stability.static.Cz_u, stability.static.Cz_alpha_dot, stability.static.Cz_q, -aero.lift_coefficient,\
                                    theta, stability.static.Cx_u, stability.static.Cx_alpha)
                stability.dynamic.dutchRollFreqHz = lateral_directional.dutch_natural_frequency
                stability.dynamic.dutchRollDamping = lateral_directional.dutch_damping_ratio
                stability.dynamic.spiralSubsistenceTimeConstant = lateral_directional.spiral_tau
                stability.dynamic.rollSubsistenceTimeConstant = lateral_directional.roll_tau
                stability.dynamic.shortPeriodFreqHz = longitudinal.short_natural_frequency
                stability.dynamic.shortPeriodDamp = longitudinal.short_damping_ratio
                stability.dynamic.phugoidFreqHz = longitudinal.phugoid_natural_frequency
                stability.dynamic.phugoidDamp = longitudinal.phugoid_damping_ratio

        # pack results
        results = Data()
        results = stability

        return results
Exemplo n.º 8
0
    def __call__(self,conditions):
        """ process vehicle to setup geometry, condititon and configuration
            
            Inputs:
                conditions - DataDict() of aerodynamic conditions
                results - DataDict() of 
                
            Outputs:

                
            Assumptions:

                
        """
        
        # unpack
        configuration   = self.configuration
        geometry        = self.geometry
        stability_model = self.stability_model
        
        q             = conditions.freestream.dynamic_pressure
        Sref          = geometry.reference_area    
        mach          = conditions.freestream.mach_number
        velocity      = conditions.freestream.velocity
        density       = conditions.freestream.density
        Span          = geometry.wings['main_wing'].spans.projected
        mac           = geometry.wings['main_wing'].chords.mean_aerodynamic
        aero          = conditions.aerodynamics
        
        # set up data structures
        static_stability = Data()
        dynamic_stability = Data()
        
        # Calculate CL_alpha 
        if not conditions.has_key('lift_curve_slope'):
            conditions.lift_curve_slope = datcom(geometry.wings['main_wing'],mach)
        
        # Calculate change in downwash with respect to change in angle of attack
        for surf in geometry.wings:
            sref = surf.areas.reference
            span = (surf.aspect_ratio * sref ) ** 0.5
            surf.CL_alpha = datcom(surf,mach)
            surf.ep_alpha = Supporting_Functions.ep_alpha(surf.CL_alpha, sref, span)
        
        # Static Stability Methods
        static_stability.cm_alpha = taw_cmalpha(geometry,mach,conditions,configuration)
        static_stability.cn_beta = taw_cnbeta(geometry,conditions,configuration)
        
        # Dynamic Stability
        if np.count_nonzero(configuration.mass_properties.moments_of_inertia.tensor) > 0:    
            # Dynamic Stability Approximation Methods - valid for non-zero I tensor
            
            # Derivative of yawing moment with respect to the rate of yaw
            cDw = aero.drag_breakdown.parasite['main_wing'].parasite_drag_coefficient # Might not be the correct value
            l_v = geometry.wings['vertical_stabilizer'].origin[0] + geometry.wings['vertical_stabilizer'].aerodynamic_center[0] - geometry.wings['main_wing'].origin[0] - geometry.wings['main_wing'].aerodynamic_center[0]
            dynamic_stability.cn_r = Supporting_Functions.cn_r(cDw, geometry.wings['vertical_stabilizer'].areas.reference, Sref, l_v, span, geometry.wings['vertical_stabilizer'].dynamic_pressure_ratio, geometry.wings['vertical_stabilizer'].CL_alpha)
            
            # Derivative of rolling moment with respect to roll rate
            dynamic_stability.cl_p = 0 # Need to see if there is a low fidelity way to calculate cl_p
            
            # Derivative of roll rate with respect to sideslip (dihedral effect)
            dynamic_stability.cl_beta = 0 # Need to see if there is a low fidelity way to calculate cl_beta
            
            # Derivative of pitching moment with respect to pitch rate
            l_t = geometry.wings['horizontal_stabilizer'].origin[0] + geometry.wings['horizontal_stabilizer'].aerodynamic_center[0] - geometry.wings['main_wing'].origin[0] - geometry.wings['main_wing'].aerodynamic_center[0] #Need to check this is the length of the horizontal tail moment arm       
            dynamic_stability.cm_q = Supporting_Functions.cm_q(conditions.lift_curve_slope, l_t,mac) # Need to check Cm_i versus Cm_alpha
            
            # Derivative of pitching rate with respect to d(alpha)/d(t)
            dynamic_stability.cm_alpha_dot = Supporting_Functions.cm_alphadot(static_stability.cm_alpha, geometry.wings['horizontal_stabilizer'].ep_alpha, l_t, mac) # Need to check Cm_i versus Cm_alpha
              
            # Derivative of Z-axis force with respect to angle of attack  
            dynamic_stability.cz_alpha = Supporting_Functions.cz_alpha(aero.drag_coefficient,conditions.lift_curve_slope)                   
            
            
            stability_model.dutch_roll = Approximations.dutch_roll(velocity, static_stability.cn_beta, Sref, density, Span, configuration.mass_properties.moments_of_inertia.tensor[2][2], dynamic_stability.cn_r)
            
            if dynamic_stability.cl_p != 0:                 
                stability_model.roll_tau = Approximations.roll(configuration.mass_properties.momen[2][2], Sref, density, velocity, Span, dynamic_stability.cl_p)
                dynamic_stability.cy_phi = Supporting_Functions.cy_phi(aero.lift_coefficient)
                dynamic_stability.cl_r = Supporting_Functions.cl_r( aero.lift_coefficient) # Will need to be changed
                stability_model.spiral_tau = Approximations.spiral(conditions.weights.total_mass, velocity, density, Sref, dynamic_stability.cl_p, static_stability.cn_beta, dynamic_stability.cy_phi, dynamic_stability.cl_beta, dynamic_stability.cn_r, dynamic_stability.cl_r)
            stability_model.short_period = Approximations.short_period(velocity, density, Sref, mac, dynamic_stability.cm_q, dynamic_stability.cz_alpha, conditions.weights.total_mass, static_stability.cm_alpha, configuration.mass_properties.moments_of_inertia.tensor[1][1], dynamic_stability.cm_alpha_dot)
            stability_model.phugoid = Approximations.phugoid(conditions.freestream.gravity, conditions.freestream.velocity, aero.drag_coefficient, aero.lift_coefficient)
            
            # Dynamic Stability Full Linearized Methods
            if aero.has_key('cy_beta') and dynamic_stability.cl_p != 0 and dynamic_stability.cl_beta != 0:
                theta = conditions.frames.wind.body_rotations[:,1]
                dynamic_stability.cy_beta = aero.cy_beta
                dynamic_stability.cl_psi = Supporting_Functions.cy_psi(aero.lift_coefficient, theta)                     
                dynamic_stability.cL_u = 0
                dynamic_stability.cz_u = Supporting_Functions.cz_u(aero.lift_coefficient,velocity,dynamic_stability.cL_u)
                dynamic_stability.cz_alpha_dot = Supporting_Functions.cz_alphadot(static_stability.cm_alpha, geometry.wings['horizontal_stabilizer'].ep_alpha)
                dynamic_stability.cz_q = Supporting_Functions.cz_q(static_stability.cm_alpha)
                dynamic_stability.cx_u = Supporting_Functions.cx_u(aero.drag_coefficient)
                dynamic_stability.cx_alpha = Supporting_Functions.cx_alpha(aero.lift_coefficient, conditions.lift_curve_slope)
            
                lateral_directional = Full_Linearized_Equations.lateral_directional(velocity, static_stability.cn_beta , Sref, density, Span, configuration.mass_properties.moments_of_inertia.tensor[2][2], dynamic_stability.cn_r, configuration.mass_properties.Moments_Of_Inertia.tensor[0][0], dynamic_stability.cl_p, configuration.mass_properties.moments_of_inertia.tensor[0][2], dynamic_stability.cl_r, dynamic_stability.cl_beta, dynamic_stability.cn_p, dynamic_stability.cy_phi, dynamic_stability.cy_psi, dynamic_stability.cy_beta, conditions.weights.total_mass)
                longitudinal = Full_Linearized_Equations.longitudinal(velocity, density, Sref, mac, dynamic_stability.cm_q, dynamic_stability.cz_alpha, conditions.weights.total_mass, static_stability.cm_alpha, configuration.mass_properties.moments_of_inertia.tensor[1][1], dynamic_stability.cm_alpha_dot, dynamic_stability.cz_u, dynamic_stability.cz_alpha_dot, dynamic_stability.cz_q, -aero.lift_coefficient, theta, dynamic_stability.cx_u, dynamic_stability.cx_alpha)                    
                stability_model.dutch_roll.natural_frequency = lateral_directional.dutch_natural_frequency
                stability_model.dutch_roll.damping_ratio = lateral_directional.dutch_damping_ratio
                stability_model.spiral_tau = lateral_directional.spiral_tau
                stability_model.roll_tau = lateral_directional.roll_tau
                stability_model.short_period.natural_frequency = longitudinal.short_natural_frequency
                stability_model.short_period.damping_ratio = longitudinal.short_damping_ratio
                stability_model.phugoid.natural_frequency = longitudinal.phugoid_natural_frequency
                stability_model.phugoid.damping_ratio = longitudinal.phugoid_damping_ratio
        
        # pack results
        results = Data()
        results.static  = static_stability
        results.dynamic = dynamic_stability
        
        return results
Exemplo n.º 9
0
segment            = SUAVE.Attributes.Missions.Segments.Base_Segment()
segment.M          = 0.198
segment.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
altitude           = 0.0 * Units.feet
segment.a          = segment.atmosphere.compute_values(altitude / Units.km, type="a")
segment.rho        = segment.atmosphere.compute_values(altitude / Units.km, type="rho")
segment.mew        = segment.atmosphere.compute_values(altitude / Units.km, type="mew")
segment.v_inf      = segment.M * segment.a


#Method Test
print '<<Test run of the taw_cnbeta() method>>'
print 'Boeing 747 at M = {0} and h = {1} meters'.format(segment.M, altitude)

cn_b = taw_cnbeta(aircraft,segment)

expected = 0.184
print 'Cn_beta        = {0:.4f}'.format(cn_b)
print 'Expected value = {}'.format(expected)
print 'Percent Error  = {0:.2f}%'.format(100.0*(cn_b-expected)/expected)
print ' '  


#Parameters Required
#Using values for a Beechcraft Model 99
#MODEL DOES NOT ACCOUNT FOR DESTABILIZING EFFECTS OF PROPELLERS!
wing               = SUAVE.Components.Wings.Wing()
wing.area          = 280.0 * Units.feet**2
wing.span          = 46.0  * Units.feet
wing.sweep_le      = 3.0   * Units.deg
Exemplo n.º 10
0
    def __call__(self, conditions):
        """ process vehicle to setup geometry, condititon and configuration
                
                Inputs:
                    conditions - DataDict() of aerodynamic conditions
                    results - DataDict() of 
                    
                Outputs:

                    
                Assumptions:

                    
            """

        # unpack
        configuration = self.configuration
        geometry = self.geometry
        stability_model = self.stability_model
        q = conditions.freestream.dynamic_pressure
        Sref = geometry.reference_area
        mach = conditions.freestream.mach_number
        velocity = conditions.freestream.velocity
        density = conditions.freestream.density
        Span = geometry.wings['Main Wing'].spans.projected
        mac = geometry.wings['Main Wing'].chords.mean_aerodynamic
        aero = conditions.aerodynamics

        # Calculate CL_alpha
        if not conditions.has_key('lift_curve_slope'):
            conditions.lift_curve_slope = datcom(geometry.wings['Main Wing'],
                                                 mach)

        # Calculate change in downwash with respect to change in angle of attack
        for surf in geometry.wings:
            e = surf.span_efficiency
            sref = surf.areas.reference
            span = (surf.aspect_ratio * sref)**0.5
            surf.CL_alpha = datcom(surf, mach)
            surf.ep_alpha = Supporting_Functions.ep_alpha(
                surf.CL_alpha, sref, span, e)

        # Static Stability Methods
        aero.cm_alpha = taw_cmalpha(geometry, mach, conditions, configuration)
        aero.cn_beta = taw_cnbeta(geometry, conditions, configuration)

        if np.count_nonzero(
                configuration.mass_properties.moments_of_inertia.tensor) > 0:
            # Dynamic Stability Approximation Methods
            if not aero.has_key('cn_r'):
                cDw = aero.drag_breakdown.parasite[
                    'Main Wing'].parasite_drag_coefficient  # Might not be the correct value
                l_v = geometry.wings['Vertical Stabilizer'].origin[
                    0] + geometry.wings[
                        'Vertical Stabilizer'].aerodynamic_center[
                            0] - geometry.wings['Main Wing'].origin[
                                0] - geometry.wings[
                                    'Main Wing'].aerodynamic_center[0]
                aero.cn_r = Supporting_Functions.cn_r(
                    cDw, geometry.wings['Vertical Stabilizer'].areas.reference,
                    Sref, l_v, span, geometry.wings['Vertical Stabilizer'].eta,
                    geometry.wings['Vertical Stabilizer'].CL_alpha)
            if not aero.has_key('cl_p'):
                aero.cl_p = 0  # Need to see if there is a low fidelity way to calculate cl_p

            if not aero.has_key('cl_beta'):
                aero.cl_beta = 0  # Need to see if there is a low fidelity way to calculate cl_beta

                l_t = geometry.wings['Horizontal Stabilizer'].origin[
                    0] + geometry.wings['Horizontal Stabilizer'].aerodynamic_center[
                        0] - geometry.wings['Main Wing'].origin[
                            0] - geometry.wings['Main Wing'].aerodynamic_center[
                                0]  #Need to check this is the length of the horizontal tail moment arm

            if not aero.has_key('cm_q'):
                aero.cm_q = Supporting_Functions.cm_q(
                    conditions.lift_curve_slope, l_t,
                    mac)  # Need to check Cm_i versus Cm_alpha

            if not aero.has_key('cm_alpha_dot'):
                aero.cm_alpha_dot = Supporting_Functions.cm_alphadot(
                    aero.cm_alpha,
                    geometry.wings['Horizontal Stabilizer'].ep_alpha, l_t,
                    mac)  # Need to check Cm_i versus Cm_alpha

            if not aero.has_key('cz_alpha'):
                aero.cz_alpha = Supporting_Functions.cz_alpha(
                    aero.drag_coefficient, conditions.lift_curve_slope)

            stability_model.dutch_roll = Approximations.dutch_roll(
                velocity, aero.cn_beta, Sref, density, Span,
                configuration.mass_properties.moments_of_inertia.tensor[2][2],
                aero.cn_r)

            if aero.cl_p != 0:
                stability_model.roll_tau = Approximations.roll(
                    configuration.mass_properties.momen[2][2], Sref, density,
                    velocity, Span, aero.cl_p)
                if aero.cl_beta != 0:
                    aero.cy_phi = Supporting_Functions.cy_phi(
                        aero.lift_coefficient)
                    aero.cl_r = Supporting_Functions.cl_r(
                        aero.lift_coefficient)  # Will need to be changed
                    stability_model.spiral_tau = Approximations.spiral(
                        conditions.weights.total_mass, velocity, density, Sref,
                        aero.cl_p, aero.cn_beta, aero.cy_phi, aero.cl_beta,
                        aero.cn_r, aero.cl_r)
            stability_model.short_period = Approximations.short_period(
                velocity, density, Sref, mac, aero.cm_q, aero.cz_alpha,
                conditions.weights.total_mass, aero.cm_alpha,
                configuration.mass_properties.moments_of_inertia.tensor[1][1],
                aero.cm_alpha_dot)
            stability_model.phugoid = Approximations.phugoid(
                conditions.freestream.gravity, conditions.freestream.velocity,
                aero.drag_coefficient, aero.lift_coefficient)

            # Dynamic Stability Full Linearized Methods
            if aero.has_key(
                    'cy_beta') and aero.cl_p != 0 and aero.cl_beta != 0:
                if not aero.has_key('cy_psi'):
                    theta = conditions.frames.wind.body_rotations[:, 1]
                    aero.cl_psi = Supporting_Functions.cy_psi(
                        aero.lift_coefficient, theta)
                if not aero.has_key('cz_u'):
                    if not aero.has_key('cL_u'):
                        aero.cL_u = 0
                    aero.cz_u = Supporting_Functions.cz_u(
                        aero.lift_coefficient, velocity, aero.cL_u)
                if not aero.has_key('cz_alpha_dot'):
                    aero.cz_alpha_dot = Supporting_Functions.cz_alphadot(
                        aero.cm_alpha,
                        geometry.wings['Horizontal Stabilizer'].ep_alpha)
                if not aero.has_key('cz_q'):
                    aero.cz_q = Supporting_Functions.cz_q(aero.cm_alpha)
                if not aero.has_key('cx_u'):
                    aero.cx_u = Supporting_Functions.cx_u(
                        aero.drag_coefficient)
                if not aero.has_key('cx_alpha'):
                    aero.cx_alpha = Supporting_Functions.cx_alpha(
                        aero.lift_coefficient, conditions.lift_curve_slope)

                lateral_directional = Full_Linearized_Equations.lateral_directional(
                    velocity, aero.cn_beta, Sref, density, Span,
                    configuration.mass_properties.moments_of_inertia.tensor[2]
                    [2], aero.cn_r,
                    configuration.mass_properties.Moments_Of_Inertia.tensor[0]
                    [0], aero.cl_p,
                    configuration.mass_properties.moments_of_inertia.tensor[0]
                    [2], aero.cl_r, aero.cl_beta, aero.cn_p, aero.cy_phi,
                    aero.cy_psi, aero.cy_beta, conditions.weights.total_mass)
                longitudinal = Full_Linearized_Equations.longitudinal(
                    velocity, density, Sref, mac, aero.cm_q, aero.cz_alpha,
                    conditions.weights.total_mass, aero.cm_alpha,
                    configuration.mass_properties.moments_of_inertia.tensor[1]
                    [1], aero.cm_alpha_dot, aero.cz_u, aero.cz_alpha_dot,
                    aero.cz_q, -aero.lift_coefficient, theta, aero.cx_u,
                    aero.cx_alpha)
                stability_model.dutch_roll.natural_frequency = lateral_directional.dutch_natural_frequency
                stability_model.dutch_roll.damping_ratio = lateral_directional.dutch_damping_ratio
                stability_model.spiral_tau = lateral_directional.spiral_tau
                stability_model.roll_tau = lateral_directional.roll_tau
                stability_model.short_period.natural_frequency = longitudinal.short_natural_frequency
                stability_model.short_period.damping_ratio = longitudinal.short_damping_ratio
                stability_model.phugoid.natural_frequency = longitudinal.phugoid_natural_frequency
                stability_model.phugoid.damping_ratio = longitudinal.phugoid_damping_ratio

        return