本文整理汇总了Python中SUAVE.Core.Data类的典型用法代码示例。如果您正苦于以下问题:Python Data类的具体用法?Python Data怎么用?Python Data使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shevell
def shevell(weight_landing, number_of_engines, thrust_sea_level, thrust_landing):
#process
baseline_noise = 101.
thrust_percentage = (thrust_sea_level/ Units.force_pound)/25000 * 100.
thrust_reduction = thrust_landing/thrust_sea_level * 100.
noise_increase_due_to_thrust = - 0.0002193 * thrust_percentage ** 2. + 0.09454 * thrust_percentage - 7.30116
noise_landing = - 0.0015766 * thrust_reduction ** 2. + 0.34882 * thrust_reduction -19.2569
takeoff_distance_noise = -4. # 1500 ft altitude at 6500m from start of take-off
sideline_distance_noise = -6.5 # 1476 ft (450m) from centerline (effective distance = 1476*1.25 = 1845ft)
landing_distance_noise = 9.1 # 370 ft altitude at 6562 ft (2000m) from runway
takeoff = 10. * np.log10(10. ** (baseline_noise/10.) * number_of_engines) - 4. \
+ takeoff_distance_noise + noise_increase_due_to_thrust
side_line = 10. * np.log10(10. ** (baseline_noise/10.) * number_of_engines) - 4. \
+ sideline_distance_noise + noise_increase_due_to_thrust
landing = 10. * np.log10(10. ** (baseline_noise/10.) * number_of_engines) - 5. \
+ landing_distance_noise + noise_increase_due_to_thrust + noise_landing
airframe = 40. + 10. * np.log10(weight_landing / Units.lbs)
output = Data()
output.takeoff = takeoff
output.side_line = side_line
output.landing = 10. * np.log10(10. ** (airframe/10.) + 10. ** (landing/10.))
return output
示例2: evaluate
def evaluate(self,state,settings=None,geometry=None):
# unpack
aoa = state.conditions.aerodynamics.angle_of_attack
Sref = self.geometry.reference_area
# evaluate surrogates
CL = self.surrogates.lift_coefficient(aoa)
CDi = self.surrogates.induced_drag_coefficient(aoa)
Cm = self.surrogates.pitch_moment_coefficient(aoa)
# pack conditions
state.conditions.aerodynamics.lift_coefficient = CL
state.conditions.aerodynamics.drag_coefficient = CDi
state.conditions.aerodynamics.pitch_moment_coefficient = Cm
# pack results
results = Data()
results.lift_coefficient = CL
results.drag_coefficient = CDi
results.induced_drag_coefficient = CDi
results.pitch_moment_coefficient = Cm
#results.update( self.compute_forces(state.conditions) )
return results
示例3: append_control_deflection
def append_control_deflection(self,control_tag,deflection):
""" Adds a control deflection case
Assumptions:
None
Source:
None
Inputs:
None
Outputs:
None
Properties Used:
N/A
"""
control_deflection = Data()
control_deflection.tag = control_tag
control_deflection.deflection = deflection
if self.stability_and_control.control_deflections is None:
self.stability_and_control.control_deflections = Data()
self.stability_and_control.control_deflections.append(control_deflection)
return
示例4: __defaults__
def __defaults__(self):
"""This sets the default for wing segments in SUAVE.
Assumptions:
None
Source:
N/A
Inputs:
None
Outputs:
None
Properties Used:
N/A
"""
self.tag = 'segment'
self.percent_span_location = 0.0
self.twist = 0.0
self.root_chord_percent = 0.0
self.dihedral_outboard = 0.0
self.sweeps = Data()
self.sweeps.quarter_chord = 0.0
self.sweeps.leading_edge = 0.0
self.Airfoil = Data()
self.control_surfaces = Data()
示例5: Empty
def Empty(vehicle):
"""
Structural Weight correlation from all 415 samples of fixed-wing UAVs and sailplanes
Equation 3.16 from 'Design of Solar Powered Airplanes for Continuous Flight' by Andre Noth
Relatively valid for a wide variety of vehicles, may be optimistic
Assumes a 'main wing' is attached
"""
# Unpack
S = vehicle.reference_area
AR = vehicle.wings['main_wing'].aspect_ratio
Earth = SUAVE.Attributes.Planets.Earth()
g = Earth.sea_level_gravity
# Airframe weight
Waf = (5.58*(S**1.59)*(AR**0.71))/g # All Samples
#Waf = (0.44*(S**1.55)*(AR**1.30))/g # Top 19
# Pack
weight = Data()
weight.empty = Waf
return weight
示例6: estimate_hourly_rates
def estimate_hourly_rates(year):
"""Estimates the hourly rate according to a trend line.
Assumptions:
None
Source:
Trends in hourly rates according to "Fundamentals of Aircraft Design",
vol 1, Nicolai Figure 24.4.
Inputs:
year [-]
Outputs:
hourly_rates.
engineering [$/hr]
tooling [$/hr]
manufacturing [$/hr]
quality_control [$/hr]
Properties Used:
N/A
"""
# Unpack
reference_year = year
hourly_rates = Data()
hourly_rates.engineering = 2.576 * reference_year - 5058.
hourly_rates.tooling = 2.883 * reference_year - 5666.
hourly_rates.manufacturing = 2.316 * reference_year - 4552.
hourly_rates.quality_control = 2.600 * reference_year - 5112.
return hourly_rates
示例7: compute_forces
def compute_forces(self,conditions):
# unpack
q = conditions.freestream.dynamic_pressure
Sref = self.geometry.reference_area
#
CL = conditions.aerodynamics.lift_coefficient
CD = conditions.aerodynamics.drag_coefficient
N = q.shape[0]
L = np.zeros([N,3])
D = np.zeros([N,3])
L[:,2] = ( -CL * q * Sref )[:,0]
D[:,0] = ( -CD * q * Sref )[:,0]
results = Data()
results.lift_force_vector = L
results.drag_force_vector = D
return results
示例8: short_field
def short_field(interface):
# unpack data
results_field = interface.results.takeoff_field_length
results_fuel = interface.results.fuel_for_missions
available_tofl = interface.analyses.missions.short_field.mission.airport.available_tofl
tofl_vec = results_field.takeoff_field_length
weight_vec_tofl = results_field.takeoff_weights
range_vec = results_fuel.distances
weight_vec_fuel = results_fuel.weights
fuel_vec = results_fuel.fuels
# evaluate maximum allowable takeoff weight from a given airfield
tow_short_field = np.interp(available_tofl,tofl_vec,weight_vec_tofl)
# determine maximum range/fuel based in tow short_field
range_short_field = np.interp(tow_short_field,weight_vec_fuel,range_vec)
fuel_short_field = np.interp(tow_short_field,weight_vec_fuel,fuel_vec)
# pack
results = Data()
results.tag = 'short_field'
results.takeoff_weight = tow_short_field
results.range = range_short_field
results.fuel = fuel_short_field
return results
示例9: evaluate_range_from_short_field
def evaluate_range_from_short_field(vehicle,mission,results):
# unpack
airport_short_field = mission.airport_short_field
tofl = airport_short_field.field_lenght
takeoff_config = vehicle.configs.takeoff
from SUAVE.Methods.Performance import find_takeoff_weight_given_tofl
# evaluate maximum allowable takeoff weight from a short field
tow_short_field = find_takeoff_weight_given_tofl(vehicle,takeoff_config,airport_short_field,tofl)
# determine maximum range based in tow short_field
from SUAVE.Methods.Performance import size_mission_range_given_weights
# unpack
cruise_segment_tag = 'Cruise'
mission_payload = vehicle.mass_properties.payload
# call function
distance,fuel = size_mission_range_given_weights(vehicle,mission,cruise_segment_tag,mission_payload,tow_short_field)
# pack
short_field = Data()
short_field.tag = 'short_field'
short_field.takeoff_weight = tow_short_field
short_field.range = distance
short_field.fuel = fuel
results.short_field = short_field
return results
示例10: fuel_for_missions
def fuel_for_missions(interface):
# unpack data
config = interface.configs.cruise
analyses = interface.analyses
mission = interface.analyses.missions.fuel.mission
mission_payload = interface.analyses.missions.fuel.payload
# determine maximum range based in tow short_field
from SUAVE.Methods.Performance import size_mission_range_given_weights
# unpack
cruise_segment_tag = 'cruise'
weight_max = config.mass_properties.max_takeoff
weight_min = config.mass_properties.operating_empty + 0.10 * mission_payload # 10%
takeoff_weight_vec = np.linspace(weight_min,weight_max,3)
distance_vec = np.zeros_like(takeoff_weight_vec)
fuel_vec = np.zeros_like(takeoff_weight_vec)
# call function
distance_vec,fuel_vec = size_mission_range_given_weights(config,mission,cruise_segment_tag,mission_payload,takeoff_weight_vec)
# pack
results = Data()
results.tag = 'missions_fuel'
results.weights = takeoff_weight_vec
results.distances = distance_vec
results.fuels = fuel_vec
## print results
return results
示例11: compute_ducted_fan_geometry
def compute_ducted_fan_geometry(ducted_fan, conditions):
""" SUAVE.Methods.Geometry.Two_Dimensional.Planform.wing_fuel_volume(wing):
Estimates wing fuel capacity based in correlation methods.
"""
# unpack
thrust = ducted_fan.thrust
fan_nozzle = ducted_fan.fan_nozzle
mass_flow = thrust.mass_flow_rate_design
#evaluate engine at these conditions
state=Data()
state.conditions=conditions
state.numerics= Data()
ducted_fan.evaluate_thrust(state)
#determine geometry
U0 = conditions.freestream.velocity
rho0 = conditions.freestream.density
Ue = fan_nozzle.outputs.velocity
rhoe = fan_nozzle.outputs.density
Ae = mass_flow[0][0]/(rhoe[0][0]*Ue[0][0]) #ducted fan nozzle exit area
A0 = (mass_flow/(rho0*U0))[0][0]
ducted_fan.areas.maximum = 1.2*Ae/fan_nozzle.outputs.area_ratio[0][0]
ducted_fan.nacelle_diameter = 2.1*((ducted_fan.areas.maximum/np.pi)**.5)
ducted_fan.engine_length = 1.5*ducted_fan.nacelle_diameter
ducted_fan.areas.wetted = ducted_fan.nacelle_diameter*ducted_fan.engine_length*np.pi
示例12: main
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
示例13: do_this
def do_this(input1,input2=None):
""" SUAVE.Attributes.Attribute.do_this(input1,input2=None)
conditions data for some useful purpose
Inputs:
input1 - description [units]
input2 - description [units]
Outpus:
output1 - description
output2 - description
>> try to minimize outputs
>> pack up outputs into Data() if needed
Assumptions:
if needed
"""
# unpack inputs
var1 = input1.var1
var2 = inputs.var2
# setup
var3 = var1 * var2
# process
magic = np.log(var3)
# packup outputs
output = Data()
output.magic = magic
output.var3 = var3
return output
示例14: Wing
class Wing(Data):
def __defaults__(self):
self.tag = 'wing'
self.symmetric = True
self.vertical = False
self.origin = [0.,0.,0.]
self.sweep = 0.0
self.dihedral = 0.0
self.sections = Data()
self.configuration = Data()
self.control_surfaces = Data()
self.configuration.nspanwise = 10
self.configuration.nchordwise = 5
self.configuration.sspace = 1.0
self.configuration.cspace = 1.0
def append_section(self,section):
""" adds a segment to the wing """
# assert database type
if not isinstance(section,Data):
raise Component_Exception, 'input component must be of type Data()'
# store data
self.sections.append(section)
return
示例15: simple_method
def simple_method(input1,input2=None):
""" SUAVE.Methods.SimpleMethod(input1,input2=None)
does something useful
Inputs:
input1 - description [units]
input2 - description [units]
Outputs:
output1 - description
output2 - description
>> try to minimize outputs
>> pack up outputs into Data() if needed
Assumptions:
if needed
"""
# unpack inputs
var1 = input1.var1
var2 = inputs.var2
# setup
var3 = var1 * var2
# process
magic = np.log(var3)
# packup outputs
output = Data()
output.magic = magic
output.var3 = var3
return output