本文整理汇总了Python中SUAVE.Core.Data.items方法的典型用法代码示例。如果您正苦于以下问题:Python Data.items方法的具体用法?Python Data.items怎么用?Python Data.items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Core.Data
的用法示例。
在下文中一共展示了Data.items方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
# This script could fail if either the design or analysis scripts fail,
# in case of failure check both. The design and analysis powers will
# differ because of karman-tsien compressibility corrections in the
# analysis scripts
# Design the Propeller
prop_attributes = Data()
prop_attributes.number_blades = 2.0
prop_attributes.freestream_velocity = 50.0
prop_attributes.angular_velocity = 2000.*(2.*np.pi/60.0)
prop_attributes.tip_radius = 1.5
prop_attributes.hub_radius = 0.05
prop_attributes.design_Cl = 0.7
prop_attributes.design_altitude = 0.0 * Units.km
prop_attributes.design_thrust = 0.0
prop_attributes.design_power = 7000.
prop_attributes = propeller_design(prop_attributes)
# Find the operating conditions
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmosphere_conditions = atmosphere.compute_values(prop_attributes.design_altitude)
V = prop_attributes.freestream_velocity
conditions = Data()
conditions.freestream = Data()
conditions.propulsion = Data()
conditions.freestream.update(atmosphere_conditions)
conditions.freestream.dynamic_viscosity = atmosphere_conditions.dynamic_viscosity
conditions.freestream.velocity = np.array([[V]])
conditions.propulsion.throttle = np.array([[1.0]])
# Create and attach this propeller
prop = SUAVE.Components.Energy.Converters.Propeller()
prop.prop_attributes = prop_attributes
prop.inputs.omega = prop_attributes.angular_velocity
F, Q, P, Cplast = prop.spin(conditions)
# Truth values
F_truth = 166.41590262
Q_truth = 45.21732911
P_truth = 9470.2952633 # Over 9000!
Cplast_truth = 0.00085898
error = Data()
error.Thrust = np.max(np.abs(F-F_truth))
error.Power = np.max(np.abs(P-P_truth))
error.Torque = np.max(np.abs(Q-Q_truth))
error.Cp = np.max(np.abs(Cplast-Cplast_truth))
print 'Errors:'
print error
for k,v in error.items():
assert(np.abs(v)<0.001)
return
示例2: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
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
示例3: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
problem = setup()
obj = problem.objective([1.,1.])
con = problem.all_constraints([1.,1.])
obj2 = problem.objective([0.9,1.1])
con3 = problem.all_constraints([1.1,0.9])
actual = Data()
actual.obj = 0.665588312259718
actual.con = 1.13148448
actual.obj2 = 0.6837024358431955
actual.con3 = 1.20031623
print 'Fuel Burn =', obj
print 'Fuel Margin =', con
error = Data()
error.obj = (actual.obj - obj)/actual.obj
error.con = (actual.con - con)/actual.con
error.obj2 = (actual.obj2 - obj2)/actual.obj2
error.con3 = (actual.con3 - con3)/actual.con3
print 'Fuel Burn Error =',error.obj
print 'Fuel Margin Error =',error.con
for k,v in error.items():
assert(np.abs(v)<1e-6)
return
示例4: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
problem = setup()
obj = problem.objective([1.,1.])
con = problem.all_constraints([1.,1.])
obj2 = problem.objective([0.9,1.1])
con3 = problem.all_constraints([1.1,0.9])
actual = Data()
actual.obj = 0.6631900024526535
actual.con = 1.13869151
actual.obj2 = 0.6809144557780069
actual.con3 = 1.2071255
print('Fuel Burn =', obj)
print('Fuel Margin =', con)
error = Data()
error.obj = (actual.obj - obj)/actual.obj
error.con = (actual.con - con)/actual.con
error.obj2 = (actual.obj2 - obj2)/actual.obj2
error.con3 = (actual.con3 - con3)/actual.con3
print('Fuel Burn Error =',error.obj)
print('Fuel Margin Error =',error.con)
for k,v in list(error.items()):
assert(np.abs(v)<1e-6)
return
示例5: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
# ------------------------------------------------------------------
# Test wing fuel volume
# ------------------------------------------------------------------
# Setup
wing = Data()
wing.areas = Data()
wing.areas.reference = 1400.0
wing.aspect_ratio = 6.0
wing.thickness_to_chord = 0.08
# Calculation
wing_fuel_volume(wing)
# Set Truth
truth_volume = 846.8599884278394 #[m^2]
# Compute Errors
error = Data()
error.volume = np.abs(wing.fuel_volume-truth_volume)/truth_volume
for k,v in list(error.items()):
assert np.any(np.abs(v)<1e-6)
示例6: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
problem = setup()
obj = problem.objective([1.,1.])
con = problem.all_constraints([1.,1.])
obj2 = problem.objective([0.9,1.1])
con3 = problem.all_constraints([1.1,0.9])
actual = Data()
actual.obj = 0.6883660224407133
actual.con = 0.56581479
actual.obj2 = 0.7066622701538261
actual.con3 = 0.67963357
print 'Fuel Burn =', obj
print 'Fuel Margin =', con
error = Data()
error.obj = (actual.obj - obj)/actual.obj
error.con = (actual.con - con)/actual.con
error.obj2 = (actual.obj2 - obj2)/actual.obj2
error.con3 = (actual.con3 - con3)/actual.con3
print 'Fuel Burn Error =', error.obj
print 'Fuel Margin Error =',error.con
for k,v in error.items():
assert(np.abs(v)<0.001)
return
示例7: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
# ------------------------------------------------------------------
# Testing
# Using NACA 2410
# ------------------------------------------------------------------
camber = 0.02
camber_loc = 0.4
thickness = 0.10
npoints = 10
upper,lower = compute_naca_4series(camber, camber_loc, thickness,npoints)
truth_upper = ([[ 0. , 0. ],
[ 0.08654358, 0.04528598],
[ 0.25116155, 0.06683575],
[ 0.46508794, 0.06561866],
[ 0.71656695, 0.04370913],
[ 1. , 0. ]])
truth_lower = ([[ 0. , 0. ],
[ 0.09234186, -0.02939744],
[ 0.25480288, -0.03223931],
[ 0.46442806, -0.02608462],
[ 0.71451656, -0.01477209],
[ 1. , 0. ]])
# Compute Errors
error = Data()
error.upper = np.abs(upper-truth_upper)
error.lower = np.abs(lower-truth_lower)
for k,v in list(error.items()):
assert np.any(np.abs(v)<1e-6)
示例8: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
problem = setup()
n_des_var = 13
var = np.zeros(n_des_var)
var = [134.6,9.6105641082,35.0,0.123,49200.0,70000.0,0.75,6.6,30.0,70000.0,70000.0,11.5,283.0]
input_vec = var / problem.optimization_problem.inputs[:,3]
problem.objective(input_vec)
objectives = problem.objective() * problem.optimization_problem.objective[:,1]
noise_cumulative_margin = objectives[0]
actual = Data()
actual.noise_cumulative_margin = 19.7810544184
error = Data()
error.noise_cumulative_margin = abs(actual.noise_cumulative_margin - noise_cumulative_margin)/actual.noise_cumulative_margin
print 'noise_cumulative_margin=', noise_cumulative_margin
print error.noise_cumulative_margin
print error
for k,v in error.items():
assert(np.abs(v)<1e-6)
return
示例9: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
# ------------------------------------------------------------------
# Testing Arbitrary Wing
# ------------------------------------------------------------------
wing = Data()
wing.chords = Data()
wing.spans = Data()
camber = 0.02
camber_loc = 0.4
wing.thickness_to_chord = 0.10
wing.taper = 0.5
wing.chords.root = 5.0 #[m^2]
wing.chords.tip = 2.5 #[m^2]
wing.spans.projected = 10.0 #[m^2]
volume = estimate_naca_4_series_internal_volume(wing, camber, camber_loc)
truth_volume = 5.0016322889806188 # [m^2]
# Compute Errors
error = Data()
error.volume = np.abs(volume-truth_volume)/truth_volume
print("Error: ",error.volume)
for k,v in list(error.items()):
assert np.any(np.abs(v)<1e-6)
示例10: check_results
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def check_results(new_results):
# check segment values
truth = Data()
truth.dist = [6426122.4935872 , 5848398.49923247 ,7044468.46851841]
truth.fuel = [ 14771. , 12695. , 12695.]
error = Data()
error.dist = np.max(np.abs(new_results.dist-truth.dist))
error.fuel = np.max(np.abs(new_results.fuel-truth.fuel))
for k,v in error.items():
assert(np.abs(v)<0.001)
示例11: check_results
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def check_results(new_results):
# check segment values
truth = Data()
truth.fuel = [ 14246. , 12234. , 12162.]
truth.tow = [ 53855. , 49919. , 39989.]
error = Data()
error.fuel = np.max(np.abs(new_results.fuel-truth.fuel))
error.tow = np.max(np.abs(new_results.tow-truth.tow))
for k,v in error.items():
assert(np.abs(v)<0.5)
示例12: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
# ------------------------------------------------------------------
# Testing
# B737-800
# ------------------------------------------------------------------
# Setup
fuselage = Data()
fuselage.fineness = Data()
fuselage.lengths = Data()
fuselage.heights = Data()
fuselage.areas = Data()
fuselage.number_coach_seats = 170.
fuselage.seat_pitch = 1.0
fuselage.seats_abreast = 6.0
fuselage.fineness.nose = 1.6
fuselage.fineness.tail = 2.0
fuselage.lengths.fore_space = 6.0
fuselage.lengths.aft_space = 5.0
fuselage.width = 3.74
fuselage.heights.maximum = 3.74
# Compute
fuselage_planform(fuselage)
# Truth Values
nose_length_truth = 5.984
tail_length_truth = 7.48
cabin_length_truth = 39.3333
total_length_truth = 52.79733
wetted_area_truth = 580.79624
frontal_area_truth = 10.98583535
dia_effective_truth = 3.74
# Compute Errors
error = Data()
error.nose = np.abs(fuselage.lengths.nose-nose_length_truth)/nose_length_truth
error.tail = np.abs(fuselage.lengths.tail-tail_length_truth)/tail_length_truth
error.cabin = np.abs(fuselage.lengths.cabin-cabin_length_truth)/cabin_length_truth
error.total = np.abs(fuselage.lengths.total-total_length_truth)/total_length_truth
error.wetted_area = np.abs(fuselage.areas.wetted-wetted_area_truth)/wetted_area_truth
error.front_area = np.abs(fuselage.areas.front_projected-frontal_area_truth)/frontal_area_truth
error.diameter = np.abs(fuselage.effective_diameter-dia_effective_truth)/dia_effective_truth
for k,v in list(error.items()):
assert np.any(np.abs(v)<1e-6)
示例13: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
# Instantiate a propulsor
propulsion = Propulsor_Surrogate()
# Build the surrogate
propulsion.input_file = 'deck.csv'
propulsion.number_of_engines = 1.
propulsion.build_surrogate()
# Setup the test point
state = Data()
state.conditions = Data()
state.conditions.freestream = Data()
state.conditions.propulsion = Data()
state.conditions.freestream.mach_number = np.array([[0.4]])
state.conditions.freestream.altitude = np.array([[2500.]])
state.conditions.propulsion.throttle = np.array([[0.75]])
# Evaluate the test point
results = propulsion.evaluate_thrust(state)
F = results.thrust_force_vector
mdot = results.vehicle_mass_rate
# Truth values
F_truth = np.array([[ 1266.66672275, 0. , -0. ]])
mdot_truth = np.array([[ 671.33336306]])
# Error check
error = Data()
error.Thrust = np.max(np.abs(F[0,0]-F_truth[0,0]))/F_truth[0,0]
error.Mass_Rate = np.max(np.abs(mdot[0,0]-mdot_truth[0,0]))/mdot_truth[0,0]
print 'Errors:'
print error
for k,v in error.items():
assert(np.abs(v)<1e-6)
return
示例14: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
weight_landing = 300000 * Units.lbs
number_of_engines = 3.
thrust_sea_level = 40000 * Units.force_pounds
thrust_landing = 0.45 * thrust_sea_level
noise = Correlations.shevell(weight_landing, number_of_engines, thrust_sea_level, thrust_landing)
actual = Data()
actual.takeoff = 99.7
actual.side_line = 97.2
actual.landing = 105.2
error = Data()
error.takeoff = (actual.takeoff - noise.takeoff)/actual.takeoff
error.side_line = (actual.side_line - noise.side_line)/actual.side_line
error.landing = (actual.landing - noise.landing)/actual.landing
for k,v in error.items():
assert(np.abs(v)<0.005)
return
示例15: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import items [as 别名]
def main():
vehicle = vehicle_setup()
weight = Tube_Wing.empty(vehicle)
# regression values
actual = Data()
actual.payload = 27349.9081525 #includes cargo #17349.9081525 #without cargo
actual.pax = 15036.587065500002
actual.bag = 2313.3210870000003
actual.fuel = 12990.957450008464 #includes cargo #22177.6377131 #without cargo
actual.empty = 38674.934397491539
actual.wing = 6649.7096587384294
actual.fuselage = 6642.0611642718986
actual.propulsion = 6838.1851749566231
actual.landing_gear = 3160.632
actual.systems = 13479.10479056802
actual.wt_furnish = 6431.80372889
actual.horizontal_tail = 1024.5873332662029
actual.vertical_tail = 629.03876835025949
actual.rudder = 251.61550734010382
# error calculations
error = Data()
error.payload = (actual.payload - weight.payload)/actual.payload
error.pax = (actual.pax - weight.pax)/actual.pax
error.bag = (actual.bag - weight.bag)/actual.bag
error.fuel = (actual.fuel - weight.fuel)/actual.fuel
error.empty = (actual.empty - weight.empty)/actual.empty
error.wing = (actual.wing - weight.wing)/actual.wing
error.fuselage = (actual.fuselage - weight.fuselage)/actual.fuselage
error.propulsion = (actual.propulsion - weight.propulsion)/actual.propulsion
error.landing_gear = (actual.landing_gear - weight.landing_gear)/actual.landing_gear
error.systems = (actual.systems - weight.systems)/actual.systems
error.wt_furnish = (actual.wt_furnish - weight.systems_breakdown.furnish)/actual.wt_furnish
error.horizontal_tail = (actual.horizontal_tail - weight.horizontal_tail)/actual.horizontal_tail
error.vertical_tail = (actual.vertical_tail - weight.vertical_tail)/actual.vertical_tail
error.rudder = (actual.rudder - weight.rudder)/actual.rudder
print 'Results (kg)'
print weight
print 'Relative Errors'
print error
for k,v in error.items():
assert(np.abs(v)<1E-6)
#General Aviation weights; note that values are taken from Raymer,
#but there is a huge spread among the GA designs, so individual components
#differ a good deal from the actual design
vehicle = vehicle_setup_general_aviation()
GTOW = vehicle.mass_properties.max_takeoff
weight = General_Aviation.empty(vehicle)
weight.fuel = vehicle.fuel.mass_properties.mass
actual = Data()
actual.bag = 0.
actual.empty = 618.485310343
actual.fuel = 144.69596603
actual.wing = 124.673093906
actual.fuselage = 119.522072873
actual.propulsion = 194.477769922 #includes power plant and propeller, does not include fuel system
actual.landing_gear = 44.8033840543+5.27975390045
actual.furnishing = 37.8341395817
actual.electrical = 36.7532226254
actual.control_systems = 14.8331955546
actual.fuel_systems = 15.6859717453
actual.systems = 108.096549345
error = Data()
error.fuel = (actual.fuel - weight.fuel)/actual.fuel
error.empty = (actual.empty - weight.empty)/actual.empty
error.wing = (actual.wing - weight.wing)/actual.wing
error.fuselage = (actual.fuselage - weight.fuselage)/actual.fuselage
error.propulsion = (actual.propulsion - weight.propulsion)/actual.propulsion
error.landing_gear = (actual.landing_gear - (weight.landing_gear_main+weight.landing_gear_nose))/actual.landing_gear
error.furnishing = (actual.furnishing-weight.systems_breakdown.furnish)/actual.furnishing
error.electrical = (actual.electrical-weight.systems_breakdown.electrical)/actual.electrical
error.control_systems = (actual.control_systems-weight.systems_breakdown.control_systems)/actual.control_systems
error.fuel_systems = (actual.fuel_systems-weight.systems_breakdown.fuel_system)/actual.fuel_systems
error.systems = (actual.systems - weight.systems)/actual.systems
print 'actual.systems=', actual.systems
print 'General Aviation Results (kg)'
print weight
print 'Relative Errors'
print error
for k,v in error.items():
assert(np.abs(v)<1e-6)
return