本文整理汇总了Python中SUAVE.Core.Data.numerics方法的典型用法代码示例。如果您正苦于以下问题:Python Data.numerics方法的具体用法?Python Data.numerics怎么用?Python Data.numerics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Core.Data
的用法示例。
在下文中一共展示了Data.numerics方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_ducted_fan_geometry
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
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
示例2: energy_network
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
def energy_network():
# ------------------------------------------------------------------
# Evaluation Conditions
# ------------------------------------------------------------------
# setup conditions
conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
planet = SUAVE.Attributes.Planets.Earth()
ones_1col = np.ones([1,1])
conditions.freestream = Data()
conditions.propulsion = Data()
# vacuum conditions
vac = conditions.freestream
vac.altitude = ones_1col*0.0
vac.gravity = ones_1col*planet.sea_level_gravity
vac.pressure = ones_1col*0.0
# propulsion conditions
conditions.propulsion.throttle = ones_1col*1.0
# ------------------------------------------------------------------
# Design/sizing conditions
# ------------------------------------------------------------------
# setup conditions
conditions_sls = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
ones_1col = np.ones([1,1])
conditions_sls.freestream = Data()
conditions_sls.propulsion = Data()
# freestream conditions
SLS = conditions_sls.freestream
SLS.altitude = ones_1col*0.0
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere.compute_values(SLS.altitude,0,True)
SLS.pressure = ones_1col*atmo_data.pressure
SLS.temperature = ones_1col*atmo_data.temperature
SLS.density = ones_1col*atmo_data.density
SLS.speed_of_sound = ones_1col*atmo_data.speed_of_sound
SLS.gravity = ones_1col*planet.sea_level_gravity
# propulsion conditions
conditions_sls.propulsion.throttle = ones_1col*1.0
# setting states
state_sls = Data()
state_sls.numerics = Data()
state_sls.conditions = conditions_sls
state_vacuum = Data()
state_vacuum.numerics = Data()
state_vacuum.conditions = conditions
# ------------------------------------------------------------------
# F-1 Liquid Rocket Network
# ------------------------------------------------------------------
# instantiate the ramjet network
liquid_rocket = SUAVE.Components.Energy.Networks.Liquid_Rocket()
liquid_rocket.tag = 'liquid_rocket'
# setup
liquid_rocket.number_of_engines = 1.0
liquid_rocket.area_throat = 0.6722
liquid_rocket.contraction_ratio = 2.8956
liquid_rocket.expansion_ratio = 16.0
# ------------------------------------------------------------------
# Component 1 - Combustor
# instantiate
combustor = SUAVE.Components.Energy.Converters.Rocket_Combustor()
combustor.tag = 'combustor'
# setup
combustor.propellant_data = SUAVE.Attributes.Propellants.LOX_RP1()
combustor.inputs.combustion_pressure = 7000000.0
# add to network
liquid_rocket.append(combustor)
# ------------------------------------------------------------------
# Component 2 - Core Nozzle
# instantiate
nozzle = SUAVE.Components.Energy.Converters.de_Laval_Nozzle()
nozzle.tag = 'core_nozzle'
# setup
nozzle.polytropic_efficiency = 1.0
nozzle.expansion_ratio = liquid_rocket.expansion_ratio
nozzle.area_throat = liquid_rocket.area_throat
nozzle.pressure_ratio = 1.0
# add to network
#.........这里部分代码省略.........
示例3: energy_network
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
def energy_network():
# ------------------------------------------------------------------
# Evaluation Conditions
# ------------------------------------------------------------------
# Conditions
ones_1col = np.ones([1,1])
alt = 10.0
# Setup conditions
planet = SUAVE.Attributes.Planets.Earth()
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere.compute_values(alt,0,True)
working_fluid = SUAVE.Attributes.Gases.Air()
conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions.freestream.altitude = ones_1col*alt
conditions.freestream.mach_number = ones_1col*0.8
conditions.freestream.pressure = ones_1col*atmo_data.pressure
conditions.freestream.temperature = ones_1col*atmo_data.temperature
conditions.freestream.density = ones_1col*atmo_data.density
conditions.freestream.dynamic_viscosity = ones_1col*atmo_data.dynamic_viscosity
conditions.freestream.gravity = ones_1col*planet.compute_gravity(alt)
conditions.freestream.isentropic_expansion_factor = ones_1col*working_fluid.compute_gamma(atmo_data.temperature,atmo_data.pressure)
conditions.freestream.Cp = ones_1col*working_fluid.compute_cp(atmo_data.temperature,atmo_data.pressure)
conditions.freestream.R = ones_1col*working_fluid.gas_specific_constant
conditions.freestream.speed_of_sound = ones_1col*atmo_data.speed_of_sound
conditions.freestream.velocity = conditions.freestream.mach_number*conditions.freestream.speed_of_sound
conditions.velocity = conditions.freestream.mach_number*conditions.freestream.speed_of_sound
conditions.q = 0.5*conditions.freestream.density*conditions.velocity**2
conditions.g0 = conditions.freestream.gravity
# propulsion conditions
conditions.propulsion.throttle = ones_1col*1.0
# ------------------------------------------------------------------
# Design/sizing conditions
# ------------------------------------------------------------------
# Conditions
ones_1col = np.ones([1,1])
alt_size = 10000.0
# Setup conditions
planet = SUAVE.Attributes.Planets.Earth()
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere.compute_values(alt_size,0,True)
working_fluid = SUAVE.Attributes.Gases.Air()
conditions_sizing = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions_sizing.freestream.altitude = ones_1col*alt_size
conditions_sizing.freestream.mach_number = ones_1col*0.8
conditions_sizing.freestream.pressure = ones_1col*atmo_data.pressure
conditions_sizing.freestream.temperature = ones_1col*atmo_data.temperature
conditions_sizing.freestream.density = ones_1col*atmo_data.density
conditions_sizing.freestream.dynamic_viscosity = ones_1col*atmo_data.dynamic_viscosity
conditions_sizing.freestream.gravity = ones_1col*planet.compute_gravity(alt_size)
conditions_sizing.freestream.isentropic_expansion_factor = ones_1col*working_fluid.compute_gamma(atmo_data.temperature,atmo_data.pressure)
conditions_sizing.freestream.Cp = ones_1col*working_fluid.compute_cp(atmo_data.temperature,atmo_data.pressure)
conditions_sizing.freestream.R = ones_1col*working_fluid.gas_specific_constant
conditions_sizing.freestream.speed_of_sound = ones_1col*atmo_data.speed_of_sound
conditions_sizing.freestream.velocity = conditions_sizing.freestream.mach_number*conditions_sizing.freestream.speed_of_sound
conditions_sizing.velocity = conditions_sizing.freestream.mach_number*conditions_sizing.freestream.speed_of_sound
conditions_sizing.q = 0.5*conditions_sizing.freestream.density*conditions_sizing.velocity**2
conditions_sizing.g0 = conditions_sizing.freestream.gravity
# propulsion conditions
conditions_sizing.propulsion.throttle = ones_1col*1.0
state_sizing = Data()
state_sizing.numerics = Data()
state_sizing.conditions = conditions_sizing
state_off_design = Data()
state_off_design.numerics = Data()
state_off_design.conditions = conditions
# ------------------------------------------------------------------
# Turbofan Network
# ------------------------------------------------------------------
# Instantiate the gas turbine network
turbofan = SUAVE.Components.Energy.Networks.Turbofan()
turbofan.tag = 'turbofan'
# setup
turbofan.bypass_ratio = 5.4
turbofan.number_of_engines = 2.0
turbofan.engine_length = 2.5
turbofan.nacelle_diameter = 1.580
# working fluid
turbofan.working_fluid = SUAVE.Attributes.Gases.Air()
# ------------------------------------------------------------------
# Component 1 - Ram
# instantiate
#.........这里部分代码省略.........
示例4: estimate_take_off_field_length
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
# ==============================================
# Determining vehicle maximum lift coefficient
# ==============================================
try: # aircraft maximum lift informed by user
maximum_lift_coefficient = vehicle.maximum_lift_coefficient
except:
# Using semi-empirical method for maximum lift coefficient calculation
from SUAVE.Methods.Aerodynamics.Fidelity_Zero.Lift import compute_max_lift_coeff
# Condition to CLmax calculation: 90KTAS @ 10000ft, ISA
conditions = atmo.compute_values(10000. * Units.ft)
conditions.freestream=Data()
conditions.freestream.density = conditions.density
conditions.freestream.dynamic_viscosity = conditions.dynamic_viscosity
conditions.freestream.velocity = 90. * Units.knots
try:
maximum_lift_coefficient, induced_drag_high_lift = compute_max_lift_coeff(vehicle,conditions)
vehicle.maximum_lift_coefficient = maximum_lift_coefficient
except:
raise ValueError, "Maximum lift coefficient calculation error. Please, check inputs"
# ==============================================
# Computing speeds (Vs, V2, 0.7*V2)
# ==============================================
stall_speed = (2 * weight * sea_level_gravity / (rho * reference_area * maximum_lift_coefficient)) ** 0.5
V2_speed = V2_VS_ratio * stall_speed
speed_for_thrust = 0.70 * V2_speed
# ==============================================
# Determining vehicle number of engines
# ==============================================
engine_number = 0.
for propulsor in vehicle.propulsors : # may have than one propulsor
engine_number += propulsor.number_of_engines
if engine_number == 0:
raise ValueError, "No engine found in the vehicle"
# ==============================================
# Getting engine thrust
# ==============================================
state = Data()
state.conditions = conditions
state.numerics = Data()
conditions.freestream = Data()
conditions.propulsion = Data()
conditions.freestream.dynamic_pressure = np.array(np.atleast_1d(0.5 * rho * speed_for_thrust**2))
conditions.freestream.gravity = np.array([np.atleast_1d(sea_level_gravity)])
conditions.freestream.velocity = np.array(np.atleast_1d(speed_for_thrust))
conditions.freestream.mach_number = np.array(np.atleast_1d(speed_for_thrust/ a_delta_ISA))
conditions.freestream.temperature = np.array(np.atleast_1d(T_delta_ISA))
conditions.freestream.pressure = np.array(np.atleast_1d(p))
conditions.propulsion.throttle = np.array(np.atleast_1d(1.))
results = vehicle.propulsors.evaluate_thrust(state) # total thrust
thrust = results.thrust_force_vector
# ==============================================
# Calculate takeoff distance
# ==============================================
# Defining takeoff distance equations coefficients
try:
takeoff_constants = vehicle.takeoff_constants # user defined
except: # default values
takeoff_constants = np.zeros(3)
if engine_number == 2:
takeoff_constants[0] = 857.4
takeoff_constants[1] = 2.476
takeoff_constants[2] = 0.00014
elif engine_number == 3:
takeoff_constants[0] = 667.9
takeoff_constants[1] = 2.343
takeoff_constants[2] = 0.000093
elif engine_number == 4:
takeoff_constants[0] = 486.7
takeoff_constants[1] = 2.282
takeoff_constants[2] = 0.0000705
elif engine_number > 4:
takeoff_constants[0] = 486.7
takeoff_constants[1] = 2.282
takeoff_constants[2] = 0.0000705
print 'The vehicle has more than 4 engines. Using 4 engine correlation. Result may not be correct.'
else:
takeoff_constants[0] = 857.4
takeoff_constants[1] = 2.476
takeoff_constants[2] = 0.00014
print 'Incorrect number of engines: {0:.1f}. Using twin engine correlation.'.format(engine_number)
# Define takeoff index (V2^2 / (T/W)
takeoff_index = V2_speed**2. / (thrust[0][0] / weight)
# Calculating takeoff field length
takeoff_field_length = 0.
for idx,constant in enumerate(takeoff_constants):
takeoff_field_length += constant * takeoff_index**idx
p
takeoff_field_length = takeoff_field_length * Units.ft
# return
return takeoff_field_length
示例5: turbofan_sizing
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
#flow through the low pressure turbine
low_pressure_turbine(conditions)
#link the core nozzle to the low pressure turbine
core_nozzle.inputs.stagnation_temperature = low_pressure_turbine.outputs.stagnation_temperature
core_nozzle.inputs.stagnation_pressure = low_pressure_turbine.outputs.stagnation_pressure
#flow through the core nozzle
core_nozzle(conditions)
#link the fan nozzle to the fan
fan_nozzle.inputs.stagnation_temperature = fan.outputs.stagnation_temperature
fan_nozzle.inputs.stagnation_pressure = fan.outputs.stagnation_pressure
#flow through the fan nozzle
fan_nozzle(conditions)
# compute the thrust using the thrust component
#link the thrust component to the fan nozzle
thrust.inputs.fan_exit_velocity = fan_nozzle.outputs.velocity
thrust.inputs.fan_area_ratio = fan_nozzle.outputs.area_ratio
thrust.inputs.fan_nozzle = fan_nozzle.outputs
#link the thrust component to the core nozzle
thrust.inputs.core_exit_velocity = core_nozzle.outputs.velocity
thrust.inputs.core_area_ratio = core_nozzle.outputs.area_ratio
thrust.inputs.core_nozzle = core_nozzle.outputs
#link the thrust component to the combustor
thrust.inputs.fuel_to_air_ratio = combustor.outputs.fuel_to_air_ratio
#link the thrust component to the low pressure compressor
thrust.inputs.total_temperature_reference = low_pressure_compressor.outputs.stagnation_temperature
thrust.inputs.total_pressure_reference = low_pressure_compressor.outputs.stagnation_pressure
thrust.inputs.number_of_engines = number_of_engines
thrust.inputs.bypass_ratio = bypass_ratio
thrust.inputs.flow_through_core = 1./(1.+bypass_ratio) #scaled constant to turn on core thrust computation
thrust.inputs.flow_through_fan = bypass_ratio/(1.+bypass_ratio) #scaled constant to turn on fan thrust computation
#compute the thrust
thrust.size(conditions)
#determine geometry;
mass_flow = thrust.mass_flow_rate_design
mass_flow_fan = mass_flow*bypass_ratio
U0 = conditions.freestream.velocity
gamma = ram.outputs.isentropic_expansion_factor
R = ram.outputs.universal_gas_constant
rho0 = conditions.freestream.density
rho5_fan = fan_nozzle.outputs.density
U5_fan = fan_nozzle.outputs.velocity
rho5_core = core_nozzle.outputs.density
U5_core = core_nozzle.outputs.velocity
#update the design thrust value
turbofan.design_thrust = thrust.total_design
#compute the sls_thrust
#call the atmospheric model to get the conditions at the specified altitude
atmosphere_sls = SUAVE.Analyses.Atmospheric.US_Standard_1976()
p,T,rho,a,mu = atmosphere_sls.compute_values(0.0,0.0)
# setup conditions
conditions_sls = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions_sls.freestream.altitude = np.atleast_1d(0.)
conditions_sls.freestream.mach_number = np.atleast_1d(0.01)
conditions_sls.freestream.pressure = np.atleast_1d(p)
conditions_sls.freestream.temperature = np.atleast_1d(T)
conditions_sls.freestream.density = np.atleast_1d(rho)
conditions_sls.freestream.dynamic_viscosity = np.atleast_1d(mu)
conditions_sls.freestream.gravity = np.atleast_1d(9.81)
conditions_sls.freestream.gamma = np.atleast_1d(1.4)
conditions_sls.freestream.Cp = 1.4*(p/(rho*T))/(1.4-1)
conditions_sls.freestream.R = p/(rho*T)
conditions_sls.freestream.speed_of_sound = np.atleast_1d(a)
conditions_sls.freestream.velocity = np.atleast_1d(a*0.01)
# propulsion conditions
conditions_sls.propulsion.throttle = np.atleast_1d(1.0)
#size the turbofan
state_sls = Data()
state_sls.numerics = Data()
state_sls.conditions = conditions_sls
results_sls = turbofan.evaluate_thrust(state_sls)
turbofan.sealevel_static_thrust = results_sls.thrust_force_vector[0,0] / number_of_engines
示例6: estimate_take_off_field_length
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
# Condition to CLmax calculation: 90KTAS @ 10000ft, ISA
conditions = atmo.compute_values(10000. * Units.ft)
conditions.freestream=Data()
conditions.freestream.density = conditions.density
conditions.freestream.dynamic_viscosity = conditions.dynamic_viscosity
conditions.freestream.velocity = 90. * Units.knots
try:
maximum_lift_coefficient, induced_drag_high_lift = compute_max_lift_coeff(vehicle,conditions)
vehicle.maximum_lift_coefficient = maximum_lift_coefficient
except:
raise ValueError, "Maximum lift coefficient calculation error. Please, check inputs"
# ==============================================
# Computing speeds (Vs, V2, 0.7*V2)
# ==============================================
stall_speed = (2 * weight * sea_level_gravity / (rho * reference_area * maximum_lift_coefficient)) ** 0.5
V2_speed = V2_VS_ratio * stall_speed
speed_for_thrust = 0.70 * V2_speed
# ==============================================
# Determining vehicle number of engines
# ==============================================
engine_number = 0.
for propulsor in vehicle.propulsors : # may have than one propulsor
engine_number += propulsor.number_of_engines
if engine_number == 0:
raise ValueError, "No engine found in the vehicle"
# ==============================================
# Getting engine thrust
# ==============================================
state = Data()
state.conditions = Aerodynamics()
state.numerics = Numerics()
conditions = state.conditions
conditions.freestream.dynamic_pressure = np.array(np.atleast_1d(0.5 * rho * speed_for_thrust**2))
conditions.freestream.gravity = np.array([np.atleast_1d(sea_level_gravity)])
conditions.freestream.velocity = np.array(np.atleast_1d(speed_for_thrust))
conditions.freestream.mach_number = np.array(np.atleast_1d(speed_for_thrust/ a))
conditions.freestream.temperature = np.array(np.atleast_1d(T))
conditions.freestream.pressure = np.array(np.atleast_1d(p))
conditions.propulsion.throttle = np.array(np.atleast_1d(1.))
results = vehicle.propulsors.evaluate_thrust(state) # total thrust
thrust = results.thrust_force_vector
# ==============================================
# Calculate takeoff distance
# ==============================================
# Defining takeoff distance equations coefficients
try:
takeoff_constants = vehicle.takeoff_constants # user defined
except: # default values
takeoff_constants = np.zeros(3)
if engine_number == 2:
takeoff_constants[0] = 857.4
takeoff_constants[1] = 2.476
takeoff_constants[2] = 0.00014
elif engine_number == 3:
takeoff_constants[0] = 667.9
takeoff_constants[1] = 2.343
takeoff_constants[2] = 0.000093
elif engine_number == 4:
示例7: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
motor.no_load_current = 8.0
motor.speed_constant = 140.*(2.*np.pi/60.) # RPM/volt converted to rad/s
motor.propeller_radius = prop.prop_attributes.tip_radius
#motor.propeller_Cp = prop.prop_attributes.Cp
motor.gear_ratio = 1.
motor.gearbox_efficiency = 1.
motor.expected_current = 260.
motor.mass_properties.mass = 2.0
net.motor = motor
# Component 6 the Payload
payload = SUAVE.Components.Energy.Peripherals.Payload()
payload.power_draw = 0. #Watts
payload.mass_properties.mass = 0. * Units.kg
net.payload = payload
# Component 7 the Avionics
avionics = SUAVE.Components.Energy.Peripherals.Avionics()
avionics.power_draw = 0. #Watts
net.avionics = avionics
# Component 8 the Battery
bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
batterymass = 50. #kg
bat.type = 'Li-Ion'
bat.resistance = 0.0
bat.energy_density = 250.
initialize_from_mass(bat,batterymass)
bat.current_energy = bat.max_energy
net.battery = bat
#Component 9 the system logic controller and MPPT
logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
logic.system_voltage = 50.0
logic.MPPT_efficiency = 0.95
net.solar_logic = logic
# Setup the conditions to run the network
state = Data()
state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()
conditions = state.conditions
numerics = state.numerics
# Calculate atmospheric properties
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmosphere_conditions = atmosphere.compute_values(prop_attributes.design_altitude)
rho = atmosphere_conditions.density[0,:]
a = atmosphere_conditions.speed_of_sound[0,:]
mu = atmosphere_conditions.dynamic_viscosity[0,:]
T = atmosphere_conditions.temperature[0,:]
conditions.propulsion.throttle = np.array([[1.0],[1.0]])
conditions.freestream.velocity = np.array([[1.0],[1.0]])
conditions.freestream.density = np.array([rho,rho])
conditions.freestream.dynamic_viscosity = np.array([mu, mu])
conditions.freestream.speed_of_sound = np.array([a, a])
conditions.freestream.altitude = np.array([[design_altitude], [design_altitude]])
conditions.propulsion.battery_energy = bat.max_energy*np.ones_like(conditions.freestream.altitude)
conditions.frames.body.inertial_rotations = np.zeros([2,3])
conditions.frames.inertial.time = np.array([[0.0],[1.0]])
numerics.time.integrate = np.array([[0, 0],[0, 1]])
numerics.time.differentiate = np.array([[0, 0],[0, 1]])
conditions.frames.planet.start_time = time.strptime("Sat, Jun 21 06:00:00 2014", "%a, %b %d %H:%M:%S %Y",)
conditions.frames.planet.latitude = np.array([[0.0],[0.0]])
conditions.frames.planet.longitude = np.array([[0.0],[0.0]])
conditions.freestream.temperature = np.array([T, T])
conditions.frames.body.transform_to_inertial = np.array([[[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]],
[[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]]])
conditions.propulsion.propeller_power_coefficient = np.array([[1.], [1.]]) * prop.prop_attributes.Cp
# Run the network and print the results
results = net(state)
F = results.thrust_force_vector
# Truth results
truth_F = [[ 545.35952329, 545.35952329]]
truth_i = [[ 249.31622624], [ 249.31622624]]
truth_rpm = [[ 6668.4094191], [ 6668.4094191]]
truth_bat = [[ 36000000. ], [ 35987534.18868808]]
error = Data()
error.Thrust = np.max(np.abs(F[:,0]-truth_F))
error.RPM = np.max(np.abs(conditions.propulsion.rpm-truth_rpm))
error.Current = np.max(np.abs(conditions.propulsion.current-truth_i))
error.Battery = np.max(np.abs(bat.current_energy-truth_bat))
print(error)
for k,v in list(error.items()):
assert(np.abs(v)<1e-6)
return
示例8: print_engine_data
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
def print_engine_data(vehicle, filename='engine_data.dat', units="imperial"):
"""This creates a file showing engine information.
Assumptions:
One propulsor (can be multiple engines) with 'turbofan' tag.
Source:
N/A
Inputs:
vehicle.
tag
turbofan() Function to compute thrust and fuel burn rate
propulsors.turbofan.
design_thrust [N]
engine_length [m]
nacelle_diameter [m]
thrust.bypass_ratio [-]
filename (optional) <string> Determines the name of the saved file
units (optional) <string> Determines the type of units used in the output, options are imperial and si
Outputs:
filename Saved file with name as above
Properties Used:
N/A
"""
imperial = False
SI = False
if units.lower() == "imperial":
imperial = True
elif units.lower() == "si":
SI = True
else:
print "Incorrect system of units selected - choose 'imperial' or 'SI'"
return
d_isa_vec = [0, 10]
if imperial:
speed_vec = np.linspace(0, 450, 10) * Units.knots
hp_vec = np.linspace(0, 50000, 11) * Units.ft
elif SI:
speed_vec = np.linspace(0, 225, 10) * Units['m/s']
hp_vec = np.linspace(0, 15000, 11) * Units.m
speed_vec[0] = 1.
thrust = np.zeros_like(speed_vec)
mdot = np.zeros_like(speed_vec)
# Determining vehicle number of engines
engine_number = 0.
for propulsor in vehicle.propulsors: # may have than one propulsor
engine_number += propulsor.number_of_engines
if engine_number == 0:
raise ValueError, "No engine found in the vehicle"
engine_tag = vehicle.propulsors.turbofan.tag
design_thrust = vehicle.propulsors.turbofan.design_thrust
engine_length = vehicle.propulsors.turbofan.engine_length
nacelle_diameter = vehicle.propulsors.turbofan.nacelle_diameter
bypass_ratio = vehicle.propulsors.turbofan.thrust.bypass_ratio
# Considering planet and atmosphere of 1st mission segment
sea_level_gravity = 9.81 # mission.segments[0].planet.sea_level_gravity
atmo = SUAVE.Analyses.Atmospheric.US_Standard_1976() # mission.segments[0].atmosphere
atmo_values = atmo.compute_values(0.,0.)
p0 = atmo_values.pressure
T0 = atmo_values.temperature
rho0 = atmo_values.density
a0 = atmo_values.speed_of_sound
mu0 = atmo_values.dynamic_viscosity
state = Data()
state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()
# write header of file
fid = open(filename, 'w') # Open output file
fid.write('Output file with engine data \n\n')
fid.write(' VEHICLE TAG : ' + vehicle.tag + '\n\n')
for d_isa in d_isa_vec:
fid.write('\n DELTA ISA: {:3.0f} degC'.format(d_isa) + '\n')
if imperial:
fid.write('\n' + 8 * ' ' + '|' + 40 * ' ' + ' SPEED [KTAS]' + 48 * ' ' + '|' + 27 * ' ' + ' SPEED [KTAS]' + 33 * ' ')
fid.write('\n' + 8 * ' ' + '|')
fid.write(np.transpose(map('{:10.0f}'.format, speed_vec / Units.knots)))
fid.write(' |' + 3 * ' ')
fid.write(np.transpose(map('{:6.0f} '.format, speed_vec / Units.knots)))
fid.write( '\n HP[ft] |' + 40 * ' ' + ' THRUST [lbf]' + 48 * ' ' + '|' + 30 * ' ' + ' SFC [adm]' + 33 * ' ' + '|\n')
elif SI:
fid.write('\n' + 8 * ' ' + '|' + 40 * ' ' + ' SPEED [m/s]' + 48 * ' ' + '|' + 27 * ' ' + ' SPEED [m/s]' + 33 * ' ')
#.........这里部分代码省略.........
示例9: turbojet_sizing
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
high_pressure_turbine.inputs.stagnation_pressure = combustor.outputs.stagnation_pressure
high_pressure_turbine.inputs.fuel_to_air_ratio = combustor.outputs.fuel_to_air_ratio
#link the high pressuer turbine to the high pressure compressor
high_pressure_turbine.inputs.compressor = high_pressure_compressor.outputs
#flow through the high pressure turbine
high_pressure_turbine.inputs.bypass_ratio = 0.0
high_pressure_turbine.inputs.fan = Data()
high_pressure_turbine.inputs.fan.work_done = 0.0
high_pressure_turbine(conditions)
#link the low pressure turbine to the high pressure turbine
low_pressure_turbine.inputs.stagnation_temperature = high_pressure_turbine.outputs.stagnation_temperature
low_pressure_turbine.inputs.stagnation_pressure = high_pressure_turbine.outputs.stagnation_pressure
#link the low pressure turbine to the low_pressure_compresor
low_pressure_turbine.inputs.compressor = low_pressure_compressor.outputs
#link the low pressure turbine to the combustor
low_pressure_turbine.inputs.fuel_to_air_ratio = combustor.outputs.fuel_to_air_ratio
#flow through the low pressure turbine
low_pressure_turbine.inputs.bypass_ratio = 0.0
low_pressure_turbine.inputs.fan = Data()
low_pressure_turbine.inputs.fan.work_done = 0.0
low_pressure_turbine(conditions)
#link the core nozzle to the low pressure turbine
core_nozzle.inputs.stagnation_temperature = low_pressure_turbine.outputs.stagnation_temperature
core_nozzle.inputs.stagnation_pressure = low_pressure_turbine.outputs.stagnation_pressure
#flow through the core nozzle
core_nozzle(conditions)
# compute the thrust using the thrust component
#link the thrust component to the core nozzle
thrust.inputs.core_exit_velocity = core_nozzle.outputs.velocity
thrust.inputs.core_area_ratio = core_nozzle.outputs.area_ratio
thrust.inputs.core_nozzle = core_nozzle.outputs
#link the thrust component to the combustor
thrust.inputs.fuel_to_air_ratio = combustor.outputs.fuel_to_air_ratio
#link the thrust component to the low pressure compressor
thrust.inputs.stag_temp_lpt_exit = low_pressure_compressor.outputs.stagnation_temperature
thrust.inputs.stag_press_lpt_exit = low_pressure_compressor.outputs.stagnation_pressure
thrust.inputs.number_of_engines = number_of_engines
thrust.inputs.total_temperature_reference = low_pressure_compressor.outputs.stagnation_temperature
thrust.inputs.total_pressure_reference = low_pressure_compressor.outputs.stagnation_pressure
#compute the thrust
thrust.inputs.fan_nozzle = Data()
thrust.inputs.fan_nozzle.velocity = 0.0
thrust.inputs.fan_nozzle.area_ratio = 0.0
thrust.inputs.fan_nozzle.static_pressure = 0.0
thrust.inputs.bypass_ratio = 0.0
thrust.inputs.flow_through_core = 1.0 #scaled constant to turn on core thrust computation
thrust.inputs.flow_through_fan = 0.0 #scaled constant to turn on fan thrust computation
thrust.size(conditions)
#update the design thrust value
turbojet.design_thrust = thrust.total_design
#compute the sls_thrust
#call the atmospheric model to get the conditions at the specified altitude
atmosphere_sls = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere_sls.compute_values(0.0,0.0)
p = atmo_data.pressure
T = atmo_data.temperature
rho = atmo_data.density
a = atmo_data.speed_of_sound
mu = atmo_data.dynamic_viscosity
# setup conditions
conditions_sls = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions_sls.freestream.altitude = np.atleast_1d(0.)
conditions_sls.freestream.mach_number = np.atleast_1d(0.01)
conditions_sls.freestream.pressure = np.atleast_1d(p)
conditions_sls.freestream.temperature = np.atleast_1d(T)
conditions_sls.freestream.density = np.atleast_1d(rho)
conditions_sls.freestream.dynamic_viscosity = np.atleast_1d(mu)
conditions_sls.freestream.gravity = np.atleast_1d(9.81)
conditions_sls.freestream.isentropic_expansion_factor = np.atleast_1d(1.4)
conditions_sls.freestream.Cp = 1.4*(p/(rho*T))/(1.4-1)
conditions_sls.freestream.R = p/(rho*T)
conditions_sls.freestream.speed_of_sound = np.atleast_1d(a)
conditions_sls.freestream.velocity = np.atleast_1d(a*0.01)
# propulsion conditions
conditions_sls.propulsion.throttle = np.atleast_1d(1.0)
state_sls = Data()
state_sls.numerics = Data()
state_sls.conditions = conditions_sls
results_sls = turbojet.evaluate_thrust(state_sls)
turbojet.sealevel_static_thrust = results_sls.thrust_force_vector[0,0] / number_of_engines
示例10: ducted_fan_sizing
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
inlet_nozzle = ducted_fan.inlet_nozzle
fan = ducted_fan.fan
fan_nozzle = ducted_fan.fan_nozzle
thrust = ducted_fan.thrust
bypass_ratio = ducted_fan.bypass_ratio #0
number_of_engines = ducted_fan.number_of_engines
#Creating the network by manually linking the different components
#set the working fluid to determine the fluid properties
ram.inputs.working_fluid = ducted_fan.working_fluid
#Flow through the ram , this computes the necessary flow quantities and stores it into conditions
ram(conditions)
#link inlet nozzle to ram
inlet_nozzle.inputs = ram.outputs
#Flow through the inlet nozzle
inlet_nozzle(conditions)
#Link the fan to the inlet nozzle
fan.inputs = inlet_nozzle.outputs
#flow through the fan
fan(conditions)
#link the dan nozzle to the fan
fan_nozzle.inputs = fan.outputs
# flow through the fan nozzle
fan_nozzle(conditions)
# compute the thrust using the thrust component
#link the thrust component to the fan nozzle
thrust.inputs.fan_exit_velocity = fan_nozzle.outputs.velocity
thrust.inputs.fan_area_ratio = fan_nozzle.outputs.area_ratio
thrust.inputs.fan_nozzle = fan_nozzle.outputs
thrust.inputs.number_of_engines = number_of_engines
thrust.inputs.bypass_ratio = bypass_ratio
thrust.inputs.total_temperature_reference = fan_nozzle.outputs.stagnation_temperature
thrust.inputs.total_pressure_reference = fan_nozzle.outputs.stagnation_pressure
thrust.inputs.flow_through_core = 0.
thrust.inputs.flow_through_fan = 1.
#nonexistant components used to run thrust
thrust.inputs.core_exit_velocity = 0.
thrust.inputs.core_area_ratio = 0.
thrust.inputs.core_nozzle = Data()
thrust.inputs.core_nozzle.velocity = 0.
thrust.inputs.core_nozzle.area_ratio = 0.
thrust.inputs.core_nozzle.static_pressure = 0.
#compute the trust
thrust.size(conditions)
mass_flow = thrust.mass_flow_rate_design
#update the design thrust value
ducted_fan.design_thrust = thrust.total_design
#compute the sls_thrust
#call the atmospheric model to get the conditions at the specified altitude
atmosphere_sls = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere_sls.compute_values(0.0,0.0)
p = atmo_data.pressure
T = atmo_data.temperature
rho = atmo_data.density
a = atmo_data.speed_of_sound
mu = atmo_data.dynamic_viscosity
# setup conditions
conditions_sls = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions_sls.freestream.altitude = np.atleast_1d(0.)
conditions_sls.freestream.mach_number = np.atleast_1d(0.01)
conditions_sls.freestream.pressure = np.atleast_1d(p)
conditions_sls.freestream.temperature = np.atleast_1d(T)
conditions_sls.freestream.density = np.atleast_1d(rho)
conditions_sls.freestream.dynamic_viscosity = np.atleast_1d(mu)
conditions_sls.freestream.gravity = np.atleast_1d(planet.sea_level_gravity)
conditions_sls.freestream.isentropic_expansion_factor = np.atleast_1d(ducted_fan.working_fluid.compute_gamma(T,p))
conditions_sls.freestream.Cp = np.atleast_1d(ducted_fan.working_fluid.compute_cp(T,p))
conditions_sls.freestream.R = np.atleast_1d(ducted_fan.working_fluid.gas_specific_constant)
conditions_sls.freestream.speed_of_sound = np.atleast_1d(a)
conditions_sls.freestream.velocity = conditions_sls.freestream.mach_number * conditions_sls.freestream.speed_of_sound
# propulsion conditions
conditions_sls.propulsion.throttle = np.atleast_1d(1.0)
state_sls = Data()
state_sls.numerics = Data()
state_sls.conditions = conditions_sls
results_sls = ducted_fan.evaluate_thrust(state_sls)
ducted_fan.sealevel_static_thrust = results_sls.thrust_force_vector[0,0] / number_of_engines
示例11: energy_network
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
def energy_network():
# ------------------------------------------------------------------
# Evaluation Conditions
# ------------------------------------------------------------------
# --- Conditions
ones_1col = np.ones([1,1])
# setup conditions
conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
'''
conditions.frames = Data()
conditions.freestream = Data()
conditions.aerodynamics = Data()
conditions.propulsion = Data()
conditions.weights = Data()
conditions.energies = Data()
'''
# self.conditions = conditions
# freestream conditions
conditions.freestream.mach_number = ones_1col*0.8
conditions.freestream.pressure = ones_1col*20000.
conditions.freestream.temperature = ones_1col*215.
conditions.freestream.density = ones_1col*0.8
conditions.freestream.dynamic_viscosity = ones_1col* 0.000001475
conditions.freestream.altitude = ones_1col* 10.
conditions.freestream.gravity = ones_1col*9.81
conditions.freestream.gamma = ones_1col*1.4
conditions.freestream.Cp = 1.4*287.87/(1.4-1)
conditions.freestream.R = 287.87
conditions.M = conditions.freestream.mach_number
conditions.T = conditions.freestream.temperature
conditions.p = conditions.freestream.pressure
conditions.freestream.speed_of_sound = ones_1col* np.sqrt(conditions.freestream.Cp/(conditions.freestream.Cp-conditions.freestream.R)*conditions.freestream.R*conditions.freestream.temperature) #300.
conditions.freestream.velocity = conditions.M * conditions.freestream.speed_of_sound
conditions.velocity = conditions.M * conditions.freestream.speed_of_sound
conditions.q = 0.5*conditions.freestream.density*conditions.velocity**2
conditions.g0 = conditions.freestream.gravity
# propulsion conditions
conditions.propulsion.throttle = ones_1col*1.0
# ------------------------------------------------------------------
# Design/sizing conditions
# ------------------------------------------------------------------
# --- Conditions
ones_1col = np.ones([1,1])
# setup conditions
conditions_sizing = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
'''
conditions_sizing.frames = Data()
conditions_sizing.freestream = Data()
conditions_sizing.aerodynamics = Data()
conditions_sizing.propulsion = Data()
conditions_sizing.weights = Data()
conditions_sizing.energies = Data()
'''
# self.conditions = conditions
# freestream conditions
conditions_sizing.freestream.mach_number = ones_1col*0.8
conditions_sizing.freestream.pressure = ones_1col*26499.73156529
conditions_sizing.freestream.temperature = ones_1col*223.25186491
conditions_sizing.freestream.density = ones_1col*0.41350854
conditions_sizing.freestream.dynamic_viscosity = ones_1col* 1.45766126e-05 #*1.789*10**(-5)
conditions_sizing.freestream.altitude = ones_1col* 10000. #* 0.5
conditions_sizing.freestream.gravity = ones_1col*9.81
conditions_sizing.freestream.gamma = ones_1col*1.4
conditions_sizing.freestream.Cp = 1.4*287.87/(1.4-1)
conditions_sizing.freestream.R = 287.87
conditions_sizing.freestream.speed_of_sound = 299.53150968
conditions_sizing.freestream.velocity = conditions_sizing.freestream.mach_number * conditions_sizing.freestream.speed_of_sound
# propulsion conditions
conditions_sizing.propulsion.throttle = ones_1col*1.0
state_sizing = Data()
state_sizing.numerics = Data()
state_sizing.conditions = conditions_sizing
state_off_design=Data()
state_off_design.numerics=Data()
state_off_design.conditions=conditions
#.........这里部分代码省略.........
示例12: ducted_fan_sizing
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
#link inlet nozzle to ram
inlet_nozzle.inputs.stagnation_temperature = ram.outputs.stagnation_temperature #conditions.freestream.stagnation_temperature
inlet_nozzle.inputs.stagnation_pressure = ram.outputs.stagnation_pressure #conditions.freestream.stagnation_pressure
#Flow through the inlet nozzle
inlet_nozzle(conditions)
#Link the fan to the inlet nozzle
fan.inputs.stagnation_temperature = inlet_nozzle.outputs.stagnation_temperature
fan.inputs.stagnation_pressure = inlet_nozzle.outputs.stagnation_pressure
#flow through the fan
fan(conditions)
#link the dan nozzle to the fan
fan_nozzle.inputs.stagnation_temperature = fan.outputs.stagnation_temperature
fan_nozzle.inputs.stagnation_pressure = fan.outputs.stagnation_pressure
# flow through the fan nozzle
fan_nozzle(conditions)
# compute the thrust using the thrust component
#link the thrust component to the fan nozzle
thrust.inputs.fan_exit_velocity = fan_nozzle.outputs.velocity
thrust.inputs.fan_area_ratio = fan_nozzle.outputs.area_ratio
thrust.inputs.fan_nozzle = fan_nozzle.outputs
thrust.inputs.number_of_engines = number_of_engines
thrust.inputs.bypass_ratio = bypass_ratio
thrust.inputs.total_temperature_reference = fan_nozzle.outputs.stagnation_temperature
thrust.inputs.total_pressure_reference = fan_nozzle.outputs.stagnation_pressure
thrust.inputs.flow_through_core = 0.
thrust.inputs.flow_through_fan = 1.
#nonexistant components used to run thrust
thrust.inputs.core_exit_velocity = 0.
thrust.inputs.core_area_ratio = 0.
thrust.inputs.core_nozzle = Data()
thrust.inputs.core_nozzle.velocity = 0.
thrust.inputs.core_nozzle.area_ratio = 0.
thrust.inputs.core_nozzle.static_pressure = 0.
#compute the trust
thrust.size(conditions)
mass_flow = thrust.mass_flow_rate_design
#update the design thrust value
ducted_fan.design_thrust = thrust.total_design
#compute the sls_thrust
#call the atmospheric model to get the conditions at the specified altitude
atmosphere_sls = SUAVE.Analyses.Atmospheric.US_Standard_1976()
p,T,rho,a,mu = atmosphere_sls.compute_values(0.0,0.0)
# setup conditions
conditions_sls = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions_sls.freestream.altitude = np.atleast_1d(0.)
conditions_sls.freestream.mach_number = np.atleast_1d(0.01)
conditions_sls.freestream.pressure = np.atleast_1d(p)
conditions_sls.freestream.temperature = np.atleast_1d(T)
conditions_sls.freestream.density = np.atleast_1d(rho)
conditions_sls.freestream.dynamic_viscosity = np.atleast_1d(mu)
conditions_sls.freestream.gravity = np.atleast_1d(9.81)
conditions_sls.freestream.gamma = np.atleast_1d(1.4)
conditions_sls.freestream.Cp = 1.4*287.87/(1.4-1)
conditions_sls.freestream.R = 287.87
conditions_sls.freestream.speed_of_sound = np.atleast_1d(a)
conditions_sls.freestream.velocity = conditions_sls.freestream.mach_number * conditions_sls.freestream.speed_of_sound
# propulsion conditions
conditions_sls.propulsion.throttle = np.atleast_1d(1.0)
state_sls = Data()
state_sls.numerics = Data()
state_sls.conditions = conditions_sls
results_sls = ducted_fan.evaluate_thrust(state_sls)
ducted_fan.sealevel_static_thrust = results_sls.thrust_force_vector[0,0] / number_of_engines
#determine geometry
示例13: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
def main():
#------------------------------------------------------------------
# Propulsor
#------------------------------------------------------------------
# build network
net = Solar_Low_Fidelity()
net.number_of_engines = 1.
net.nacelle_diameter = 0.05
net.areas = Data()
net.areas.wetted = 0.01*(2*np.pi*0.01/2)
net.engine_length = 0.01
# Component 1 the Sun
sun = SUAVE.Components.Energy.Processes.Solar_Radiation()
net.solar_flux = sun
# Component 2 the solar panels
panel = SUAVE.Components.Energy.Converters.Solar_Panel()
panel.ratio = 0.9
panel.area = 1.0 * panel.ratio
panel.efficiency = 0.25
panel.mass_properties.mass = panel.area*(0.60 * Units.kg)
net.solar_panel = panel
# Component 3 the ESC
esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller()
esc.efficiency = 0.95 # Gundlach for brushless motors
net.esc = esc
# Component 5 the Propeller
prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
prop.propulsive_efficiency = 0.825
net.propeller = prop
# Component 4 the Motor
motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
kv = 800. * Units['rpm/volt'] # RPM/volt is standard
motor = size_from_kv(motor, kv)
motor.gear_ratio = 1. # Gear ratio, no gearbox
motor.gearbox_efficiency = 1. # Gear box efficiency, no gearbox
motor.motor_efficiency = 0.825;
net.motor = motor
# Component 6 the Payload
payload = SUAVE.Components.Energy.Peripherals.Payload()
payload.power_draw = 0. #Watts
payload.mass_properties.mass = 0.0 * Units.kg
net.payload = payload
# Component 7 the Avionics
avionics = SUAVE.Components.Energy.Peripherals.Avionics()
avionics.power_draw = 10. #Watts
net.avionics = avionics
# Component 8 the Battery
bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
bat.mass_properties.mass = 5.0 * Units.kg
bat.specific_energy = 250. *Units.Wh/Units.kg
bat.resistance = 0.003
bat.iters = 0
initialize_from_mass(bat,bat.mass_properties.mass)
net.battery = bat
#Component 9 the system logic controller and MPPT
logic = SUAVE.Components.Energy.Distributors.Solar_Logic()
logic.system_voltage = 18.5
logic.MPPT_efficiency = 0.95
net.solar_logic = logic
# Setup the conditions to run the network
state = Data()
state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()
conditions = state.conditions
numerics = state.numerics
# Calculate atmospheric properties
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmosphere_conditions = atmosphere.compute_values(1000.*Units.ft)
rho = atmosphere_conditions.density[0,:]
a = atmosphere_conditions.speed_of_sound[0,:]
mu = atmosphere_conditions.dynamic_viscosity[0,:]
T = atmosphere_conditions.temperature[0,:]
conditions.propulsion.throttle = np.array([[1.0],[1.0]])
conditions.freestream.velocity = np.array([[1.0],[1.0]])
conditions.freestream.density = np.array([rho,rho])
conditions.freestream.dynamic_viscosity = np.array([mu, mu])
conditions.freestream.speed_of_sound = np.array([a, a])
conditions.freestream.altitude = np.array([[1000.0],[1000.0]])
conditions.propulsion.battery_energy = bat.max_energy*np.ones_like(conditions.freestream.altitude)
conditions.frames.body.inertial_rotations = np.zeros([2,3])
conditions.frames.inertial.time = np.array([[0.0],[1.0]])
numerics.time.integrate = np.array([[0, 0],[0, 1]])
numerics.time.differentiate = np.array([[0, 0],[0, 1]])
conditions.frames.planet.start_time = time.strptime("Sat, Jun 21 06:00:00 2014", "%a, %b %d %H:%M:%S %Y",)
#.........这里部分代码省略.........
示例14: scramjet_sizing
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
#.........这里部分代码省略.........
conditions.freestream.Cp = np.atleast_1d(scramjet.working_fluid.compute_cp(T,p))
conditions.freestream.R = np.atleast_1d(scramjet.working_fluid.gas_specific_constant)
conditions.freestream.speed_of_sound = np.atleast_1d(a)
conditions.freestream.velocity = np.atleast_1d(a*mach_number)
# propulsion conditions
conditions.propulsion.throttle = np.atleast_1d(1.0)
ram = scramjet.ram
inlet_nozzle = scramjet.inlet_nozzle
combustor = scramjet.combustor
core_nozzle = scramjet.core_nozzle
thrust = scramjet.thrust
number_of_engines = scramjet.number_of_engines
#Creating the network by manually linking the different components
#set the working fluid to determine the fluid properties
ram.inputs.working_fluid = scramjet.working_fluid
#Flow through the ram
ram(conditions)
#link inlet nozzle to ram
inlet_nozzle.inputs = ram.outputs
#Flow through the inlet nozzle
inlet_nozzle.compute_scramjet(conditions)
#link the combustor to the inlet nozzle
combustor.inputs.stagnation_temperature = inlet_nozzle.outputs.stagnation_temperature
combustor.inputs.stagnation_pressure = inlet_nozzle.outputs.stagnation_pressure
combustor.inputs.inlet_nozzle = inlet_nozzle.outputs
#flow through the high pressor comprresor
combustor.compute_supersonic_combustion(conditions)
#link the core nozzle to the combustor
core_nozzle.inputs = combustor.outputs
#flow through the core nozzle
core_nozzle.compute_scramjet(conditions)
#link the thrust component to the core nozzle
thrust.inputs.core_nozzle = core_nozzle.outputs
thrust.inputs.number_of_engines = number_of_engines
thrust.inputs.total_temperature_reference = core_nozzle.outputs.stagnation_temperature
thrust.inputs.total_pressure_reference = core_nozzle.outputs.stagnation_pressure
#link the thrust component to the combustor
thrust.inputs.fuel_to_air_ratio = combustor.outputs.fuel_to_air_ratio
#compute the thrust
thrust.inputs.fan_nozzle = Data()
thrust.inputs.fan_nozzle.velocity = 0.0
thrust.inputs.fan_nozzle.area_ratio = 0.0
thrust.inputs.fan_nozzle.static_pressure = 0.0
thrust.inputs.bypass_ratio = 0.0
thrust.inputs.flow_through_core = 1.0 #scaled constant to turn on core thrust computation
thrust.inputs.flow_through_fan = 0.0 #scaled constant to turn on fan thrust computation
thrust.size_stream_thrust(conditions)
#update the design thrust value
scramjet.design_thrust = thrust.total_design
#compute the sls_thrust
#call the atmospheric model to get the conditions at the specified altitude
atmosphere_sls = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere_sls.compute_values(0.0,0.0)
p = atmo_data.pressure
T = atmo_data.temperature
rho = atmo_data.density
a = atmo_data.speed_of_sound
mu = atmo_data.dynamic_viscosity
# setup conditions
conditions_sls = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
conditions_sls.freestream.altitude = np.atleast_1d(0.)
conditions_sls.freestream.mach_number = np.atleast_1d(0.01)
conditions_sls.freestream.pressure = np.atleast_1d(p)
conditions_sls.freestream.temperature = np.atleast_1d(T)
conditions_sls.freestream.density = np.atleast_1d(rho)
conditions_sls.freestream.dynamic_viscosity = np.atleast_1d(mu)
conditions_sls.freestream.gravity = np.atleast_1d(planet.sea_level_gravity)
conditions_sls.freestream.isentropic_expansion_factor = np.atleast_1d(scramjet.working_fluid.compute_gamma(T,p))
conditions_sls.freestream.Cp = np.atleast_1d(scramjet.working_fluid.compute_cp(T,p))
conditions_sls.freestream.R = np.atleast_1d(scramjet.working_fluid.gas_specific_constant)
conditions_sls.freestream.speed_of_sound = np.atleast_1d(a)
conditions_sls.freestream.velocity = np.atleast_1d(a*0.01)
# propulsion conditions
conditions_sls.propulsion.throttle = np.atleast_1d(1.0)
state_sls = Data()
state_sls.numerics = Data()
state_sls.conditions = conditions_sls
results_sls = scramjet.evaluate_thrust(state_sls)
scramjet.sealevel_static_thrust = results_sls.thrust_force_vector[0,0] / number_of_engines
示例15: energy_network
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import numerics [as 别名]
def energy_network():
# ------------------------------------------------------------------
# Evaluation Conditions
# ------------------------------------------------------------------
# --- Conditions
ones_1col = np.ones([1,1])
# setup conditions
conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
EVAL = conditions.freestream
EVAL.mach_number = ones_1col*1.5
conditions.M = EVAL.mach_number
EVAL.altitude = ones_1col*10000.
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere.compute_values(EVAL.altitude,0,True)
working_fluid = SUAVE.Attributes.Gases.Air()
EVAL.pressure = ones_1col*atmo_data.pressure
EVAL.temperature = ones_1col*atmo_data.temperature
EVAL.density = ones_1col*atmo_data.density
EVAL.dynamic_viscosity = ones_1col* atmo_data.dynamic_viscosity
EVAL.gravity = ones_1col*9.81
EVAL.isentropic_expansion_factor = working_fluid.compute_gamma(EVAL.temperature,EVAL.pressure)
EVAL.Cp = working_fluid.compute_cp(EVAL.temperature,EVAL.pressure)
EVAL.R = working_fluid.gas_specific_constant
EVAL.speed_of_sound = ones_1col* atmo_data.speed_of_sound
EVAL.velocity = conditions.M * EVAL.speed_of_sound
conditions.velocity = conditions.M * EVAL.speed_of_sound
conditions.q = 0.5*EVAL.density*conditions.velocity**2
conditions.g0 = EVAL.gravity
# propulsion conditions
conditions.propulsion.throttle = ones_1col*1.0
# ------------------------------------------------------------------
# Design/sizing conditions
# ------------------------------------------------------------------
# --- Conditions
ones_1col = np.ones([1,1])
# setup conditions
conditions_sizing = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
# freestream conditions
SIZE = conditions_sizing.freestream
SIZE.mach_number = ones_1col*2.5
conditions_sizing.M = SIZE.mach_number
SIZE.altitude = ones_1col*10000.
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere.compute_values(SIZE.altitude,0,True)
working_fluid = SUAVE.Attributes.Gases.Air()
SIZE.pressure = ones_1col*atmo_data.pressure
SIZE.temperature = ones_1col*atmo_data.temperature
SIZE.density = ones_1col*atmo_data.density
SIZE.dynamic_viscosity = ones_1col*atmo_data.dynamic_viscosity
SIZE.gravity = ones_1col*9.81
SIZE.isentropic_expansion_factor = working_fluid.compute_gamma(SIZE.temperature,SIZE.pressure)
SIZE.Cp = working_fluid.compute_cp(SIZE.temperature,SIZE.pressure)
SIZE.R = working_fluid.gas_specific_constant
SIZE.speed_of_sound = ones_1col * atmo_data.speed_of_sound
SIZE.velocity = conditions_sizing.M * SIZE.speed_of_sound
conditions_sizing.velocity = conditions_sizing.M * SIZE.speed_of_sound
conditions_sizing.q = 0.5*SIZE.density*conditions_sizing.velocity**2
conditions_sizing.g0 = SIZE.gravity
# propulsion conditions
conditions_sizing.propulsion.throttle = ones_1col*1.0
state_sizing = Data()
state_sizing.numerics = Data()
state_sizing.conditions = conditions_sizing
state_off_design=Data()
state_off_design.numerics=Data()
state_off_design.conditions=conditions
# ------------------------------------------------------------------
# Ramjet Network
# ------------------------------------------------------------------
# instantiate the ramjet network
ramjet = SUAVE.Components.Energy.Networks.Ramjet()
ramjet.tag = 'ramjet'
# setup
ramjet.number_of_engines = 2.0
ramjet.engine_length = 6.0
ramjet.nacelle_diameter = 1.3 * Units.meter
ramjet.inlet_diameter = 1.1 * Units.meter
# working fluid
ramjet.working_fluid = SUAVE.Attributes.Gases.Air()
#.........这里部分代码省略.........