本文整理汇总了Python中SUAVE.Structure.Data类的典型用法代码示例。如果您正苦于以下问题:Python Data类的具体用法?Python Data怎么用?Python Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例3: main
def main():
# Setup and pack inputs, test several cases
conditions = Data()
conditions.frames = Data()
conditions.frames.body = Data()
conditions.frames.planet = Data()
conditions.frames.inertial = Data()
conditions.freestream = Data()
conditions.frames.body.inertial_rotations = np.zeros((4,3))
conditions.frames.planet.start_time = time.strptime("Thu, Mar 20 12:00:00 2014", "%a, %b %d %H:%M:%S %Y",)
conditions.frames.planet.latitude = np.array([[0.0],[35],[70],[0.0]])
conditions.frames.planet.longitude = np.array([[0.0],[0.0],[0.0],[0.0]])
conditions.frames.body.inertial_rotations[:,0] = np.array([0.0,np.pi/10,np.pi/5,0.0]) # Phi
conditions.frames.body.inertial_rotations[:,1] = np.array([0.0,np.pi/10,np.pi/5,0.0]) # Theta
conditions.frames.body.inertial_rotations[:,2] = np.array([0.0,np.pi/2,np.pi,0.0]) # Psi
conditions.freestream.altitude = np.array([[600000.0],[0.0],[60000],[1000]])
conditions.frames.inertial.time = np.array([[0.0],[0.0],[0.0],[43200]])
# Call solar radiation
rad = SUAVE.Components.Energy.Processes.Solar_Radiation()
fluxes = rad.solar_radiation(conditions)
print('Solar Fluxes')
print fluxes
truth_fluxes = [[ 1304.01069749],[ 815.02502004],[ 783.55678702],[0.0]]
max_error = np.max(np.abs(fluxes-truth_fluxes))
assert( max_error < 1e-5 )
return
示例4: 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
示例5: evaluate_field_length
def evaluate_field_length(vehicle):
# ---------------------------
# Check field performance
# ---------------------------
# define takeoff and landing configuration
#print ' Defining takeoff and landing configurations'
takeoff_config,landing_config = define_field_configs(vehicle)
# define airport to be evaluated
airport = SUAVE.Attributes.Airports.Airport()
airport.altitude = 0.0 * Units.ft
airport.delta_isa = 0.0
airport.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()
# evaluate takeoff / landing
#print ' Estimating takeoff performance'
TOFL = estimate_take_off_field_length(vehicle,takeoff_config,airport)
#print ' Estimating landing performance'
LFL = estimate_landing_field_length(vehicle,landing_config,airport)
fldlength = Data()
fldlength.TOFL = TOFL
fldlength.LFL = LFL
return fldlength
示例6: __call__
def __call__(self,conditions):
""" process vehicle to setup geometry, condititon and configuration
Inputs:
conditions - DataDict() of aerodynamic conditions
Outputs:
CL - array of lift coefficients, same size as alpha
CD - array of drag coefficients, same size as alpha
Assumptions:
linear intperolation surrogate model on Mach, Angle of Attack
and Reynolds number
locations outside the surrogate's table are held to nearest data
no changes to initial geometry or configuration
"""
# unpack
configuration = self.configuration
geometry = self.geometry
q = conditions.freestream.dynamic_pressure
Sref = geometry.reference_area
# lift needs to compute first, updates data needed for drag
CL = SUAVE.Methods.Aerodynamics.Supersonic_Zero.Lift.compute_aircraft_lift(conditions,configuration,geometry)
# drag computes second
CD = compute_aircraft_drag(conditions,configuration,geometry)
# pack conditions
conditions.aerodynamics.lift_coefficient = CL
conditions.aerodynamics.drag_coefficient = CD
# pack results
results = Data()
results.lift_coefficient = CL
results.drag_coefficient = CD
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]
#if L.any < 0.0:
#k = 1
results.lift_force_vector = L
results.drag_force_vector = D
return results
示例7: tail_vertical
def tail_vertical(S_v,Nult,b_v,TOW,t_c_v,sweep_v,S_gross_w,t_tail,rudder_fraction = 0.25):
""" output = SUAVE.Methods.Weights.Correlations.Tube_Wing.tail_vertical(S_v,Nult,b_v,TOW,t_c_v,sweep_v,S_gross_w,t_tail)
Calculate the weight of the vertical fin of an aircraft without the weight of the rudder and then calculate the weight of the rudder
Inputs:
S_v - area of the vertical tail (combined fin and rudder) [meters**2]
Nult - ultimate load of the aircraft [dimensionless]
b_v - span of the vertical [meters]
TOW - maximum takeoff weight of the aircraft [kilograms]
t_c_v - thickness-to-chord ratio of the vertical tail [dimensionless]
sweep_v - sweep angle of the vertical tail [radians]
S_gross_w - wing gross area [meters**2]
t_tail - factor to determine if aircraft has a t-tail [dimensionless]
rudder_fraction - fraction of the vertical tail that is the rudder [dimensionless]
Outputs:
output - a dictionary with outputs:
wt_tail_vertical - weight of the vertical fin portion of the vertical tail [kilograms]
wt_rudder - weight of the rudder on the aircraft [kilograms]
Assumptions:
Vertical tail weight is the weight of the vertical fin without the rudder weight.
Rudder occupies 25% of the S_v and weighs 60% more per unit area.
"""
# unpack inputs
span = b_v / Units.ft # Convert meters to ft
sweep = sweep_v # Convert deg to radians
area = S_v / Units.ft**2 # Convert meters squared to ft squared
mtow = TOW / Units.lb # Convert kg to lbs
Sref = S_gross_w / Units.ft**2 # Convert from meters squared to ft squared
# process
# Determine weight of the vertical portion of the tail
if t_tail == "yes":
T_tail_factor = 1.25 # Weight of vertical portion of the T-tail is 25% more than a conventional tail
else:
T_tail_factor = 1.0
# Calculate weight of wing for traditional aircraft vertical tail without rudder
tail_vert_English = T_tail_factor * (2.62*area+1.5*10.**(-5.)*Nult*span**3.*(8.+0.44*mtow/Sref)/(t_c_v*(np.cos(sweep)**2.)))
# packup outputs
output = Data()
output.wt_tail_vertical = tail_vert_English * Units.lbs # Convert from lbs to kg
output.wt_rudder = output.wt_tail_vertical * rudder_fraction * 1.6
return output
示例8: main
def main():
# define the problem
additional_drag_coefficient = 0.0000
vehicle, mission = full_setup(additional_drag_coefficient)
# run the problem
results = Data()
results.mission_profile = Data()
results.mission_profile = SUAVE.Methods.Performance.evaluate_mission(mission)
# post process the results
plot_mission(vehicle,mission,results)
return
示例9: short_period
def short_period(velocity, density, S_gross_w, mac, Cm_q, Cz_alpha, mass, Cm_alpha, Iy, Cm_alpha_dot):
""" output = SUAVE.Methods.Flight_Dynamics.Dynamic_Stablity.Approximations.short_period(velocity, density, S_gross_w, mac, Cm_q, Cz_alpha, mass, Cm_alpha, Iy, Cm_alpha_dot)
Calculate the natural frequency and damping ratio for the approximate short period characteristics
Inputs:
velocity - flight velocity at the condition being considered [meters/seconds]
density - flight density at condition being considered [kg/meters**3]
S_gross_w - area of the wing [meters**2]
mac - mean aerodynamic chord of the wing [meters]
Cm_q - coefficient for the change in pitching moment due to pitch rate [dimensionless]
Cz_alpha - coefficient for the change in Z force due to the angle of attack [dimensionless]
mass - mass of the aircraft [kilograms]
Cm_alpha - coefficient for the change in pitching moment due to angle of attack [dimensionless]
Iy - moment of interia about the body y axis [kg * meters**2]
Cm_alpha_dot - coefficient for the change in pitching moment due to rate of change of angle of attack [dimensionless]
Outputs:
output - a data dictionary with fields:
w_n - natural frequency of the short period mode [radian/second]
zeta - damping ratio of the short period mode [dimensionless]
Assumptions:
X-Z axis is plane of symmetry
Constant mass of aircraft
Origin of axis system at c.g. of aircraft
Aircraft is a rigid body
Earth is inertial reference frame
Perturbations from equilibrium are small
Flow is Quasisteady
Constant forward airspeed
Neglect Cz_alpha_dot and Cz_q
Theta = 0
Source:
J.H. Blakelock, "Automatic Control of Aircraft and Missiles" Wiley & Sons, Inc. New York, 1991, p 46-50.
"""
#process
w_n = velocity * density * S_gross_w * mac / 2. * ((0.5*Cm_q*Cz_alpha - 2. * mass / density /S_gross_w /mac * Cm_alpha) / Iy /mass)**(0.5)
zeta = -0.25 * (Cm_q + Cm_alpha_dot + 2. * Iy * Cz_alpha / mass / (mac ** 2.)) * ( mass * mac ** 2. / Iy / (Cm_q * Cz_alpha * 0.5 - 2. * mass * Cm_alpha / density / S_gross_w / mac)) ** 0.5
output = Data()
output.natural_frequency = w_n
output.damping_ratio = zeta
return output
示例10: dutch_roll
def dutch_roll(velocity, Cn_Beta, S_gross_w, density, span, I_z, Cn_r):
""" output = SUAVE.Methods.Flight_Dynamics.Dynamic_Stablity.Approximations.dutch_roll(velocity, Cn_Beta, S_gross_w, density, span, I_z, Cn_r)
Calculate the natural frequency and damping ratio for the approximate dutch roll characteristics
Inputs:
velocity - flight velocity at the condition being considered [meters/seconds]
Cn_Beta - coefficient for change in yawing moment due to sideslip [dimensionless]
S_gross_w - area of the wing [meters**2]
density - flight density at condition being considered [kg/meters**3]
span - wing span of the aircraft [meters]
I_z - moment of interia about the body z axis [kg * meters**2]
Cn_r - coefficient for change in yawing moment due to yawing velocity [dimensionless]
Outputs:
output - a data dictionary with fields:
dutch_w_n - natural frequency of the dutch roll mode [radian/second]
dutch_zeta - damping ratio of the dutch roll mode [dimensionless]
Assumptions:
Major effect of rudder deflection is the generation of the Dutch roll mode.
Dutch roll mode only consists of sideslip and yaw
Beta = -Psi
Phi and its derivatives are zero
consider only delta_r input and Theta = 0
Neglect Cy_r
X-Z axis is plane of symmetry
Constant mass of aircraft
Origin of axis system at c.g. of aircraft
Aircraft is a rigid body
Earth is inertial reference frame
Perturbations from equilibrium are small
Flow is Quasisteady
Source:
J.H. Blakelock, "Automatic Control of Aircraft and Missiles" Wiley & Sons, Inc. New York, 1991, p 132-134.
"""
#process
w_n = velocity * (Cn_Beta*S_gross_w*density*span/2./I_z)**0.5 # natural frequency
zeta = -Cn_r /8. * (2.*S_gross_w*density*span**3./I_z/Cn_Beta)**0.5 # damping ratio
output = Data()
output.natural_frequency = w_n
output.damping_ratio = zeta
return output
示例11: logic
def logic(self,conditions,numerics):
""" The power being sent to the battery
Inputs:
payload power
avionics power
current to the esc
voltage of the system
MPPT efficiency
Outputs:
power to the battery
Assumptions:
Many: the system voltage is constant, the maximum power
point is at a constant voltage
"""
#Unpack
pin = self.inputs.powerin[:,0,None]
pavionics = self.inputs.pavionics
ppayload = self.inputs.ppayload
volts_motor = self.inputs.volts_motor
volts = self.voltage()
esccurrent = self.inputs.currentesc
I = numerics.integrate_time
pavail = pin*self.MPPT_efficiency
plevel = pavail -pavionics -ppayload - volts_motor*esccurrent
# Integrate the plevel over time to assess the energy consumption
# or energy storage
e = np.dot(I,plevel)
# Send or take power out of the battery, Pack up
batlogic = Data()
batlogic.pbat = plevel
batlogic.Ibat = abs(plevel/volts)
batlogic.e = e
# Output
self.outputs.batlogic = batlogic
return
示例12: shevell
def shevell(weight_landing, number_of_engines, thrust_sea_level, thrust_landing):
""" weight = SUAVE.Methods.Noise.Correlations.shevell(weight_landing, number_of_engines, thrust_sea_level, thrust_landing)
Inputs:
weight_landing - Landing weight of the aircraft [kilograms]
number of engines - Number of engines installed on the aircraft [Dimensionless]
thrust_sea_level - Sea Level Thrust of the Engine [Newtons]
thrust_landing - Thrust of the aircraft coming in for landing [Newtons]
Outputs:
output() - Data Class
takeoff - Noise of the aircraft at takeoff directly along the runway centerline (500 ft altitude at 6500m from start of take-off) [dB]
side_line - Noise of the aircraft at takeoff at the sideline measurement station (1,476 ft (450m) from centerline (effective distance = 1476*1.25 = 1845ft)[dB]
landing - Noise of the aircraft at landing directly along the trajectory (370 ft altitude at 6562 ft (2000m) from runway) [dB]
Assumptions:
The baseline case used is 101 PNdb, 25,000 lb thrust, 1 engine, 1000ft
The noise_increase_due_to_thrust and noise_landing are equation extracted from images.
This is only meant to give a rough estimate compared to a DC-10 aircraft. As the aircraft configuration varies from this configuration, the validity of the method will also degrade.
"""
#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 #1 476 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
示例13: phugoid
def phugoid(g, velocity, CD, CL):
""" output = SUAVE.Methods.Flight_Dynamics.Dynamic_Stablity.Approximations.phugoid(g, velocity, CD, CL)
Calculate the natural frequency and damping ratio for the approximate phugoid characteristics
Inputs:
g - gravitational constant [meters/second**2]
velocity - flight velocity at the condition being considered [meters/seconds]
CD - coefficient of drag [dimensionless]
CL - coefficient of lift [dimensionless]
Outputs:
output - a data dictionary with fields:
phugoid_w_n - natural frequency of the phugoid mode [radian/second]
phugoid_zeta - damping ratio of the phugoid mode [dimensionless]
Assumptions:
constant angle of attack
theta changes very slowly
Inertial forces are neglected
Neglect Cz_q
Theta = 0
X-Z axis is plane of symmetry
Constant mass of aircraft
Origin of axis system at c.g. of aircraft
Aircraft is a rigid body
Earth is inertial reference frame
Perturbations from equilibrium are small
Flow is Quasisteady
Source:
J.H. Blakelock, "Automatic Control of Aircraft and Missiles" Wiley & Sons, Inc. New York, 1991, p 50-53.
"""
#process
w_n = g/velocity * (2.)**0.5
zeta = CD/(CL*(2.)**0.5)
output = Data()
output.phugoid_w_n = w_n
output.phugoid_zeta = zeta
return output
示例14: __call__
def __call__(self,input1,input2=None):
# the method used with the class is called like a function
# document at class level
# 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
示例15: __defaults__
def __defaults__(self):
self.tag = 'Aerodynamics'
self.geometry = Geometry()
self.configuration = Configuration()
self.conditions_table = Conditions(
angle_of_attack = np.linspace(-10., 10. , 5) * Units.deg ,
)
self.model = Data()