本文整理汇总了Python中SUAVE.Structure.Data.g0方法的典型用法代码示例。如果您正苦于以下问题:Python Data.g0方法的具体用法?Python Data.g0怎么用?Python Data.g0使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Structure.Data
的用法示例。
在下文中一共展示了Data.g0方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_energies
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import g0 [as 别名]
def compute_energies(results,summary=False):
# evaluate each segment
for i in range(len(results.Segments)):
segment = results.Segments[i]
eta=segment.conditions.propulsion.throttle[:,0]
state = Data()
state.q = segment.conditions.freestream.dynamic_pressure[:,0]
state.g0 = segment.conditions.freestream.gravity[:,0]
state.V = segment.conditions.freestream.velocity[:,0]
state.M = segment.conditions.freestream.mach_number[:,0]
state.T = segment.conditions.freestream.temperature[:,0]
state.p = segment.conditions.freestream.pressure[:,0]
segment.P_fuel, segment.P_e = segment.config.Propulsors.power_flow(eta,state)
# time integration operator
'''
print segment.numerics
I = segment.numerics.integrate_time
# raw propellant energy consumed
segment.energy.propellant = np.dot(I,segment.P_fuel)[-1]
# raw electrical energy consumed
segment.energy.electric = np.dot(I,segment.P_e)[-1]
# energy to gravity
segment.energy.gravity = np.dot(I,segment.m*segment.g*segment.vectors.V[:,2])[-1] # J
# energy to drag
segment.energy.drag = np.dot(I,segment.D*segment.V)[-1] # J
if summary:
print " "
print "####### Energy Summary: Segment " + str(i) + " #######"
print " "
print "Propellant energy used = " + str(segment.energy.propellant/1e6) + " MJ"
print "Electrical energy used = " + str(segment.energy.electric/1e6) + " MJ"
print "Energy lost to gravity = " + str(segment.energy.gravity/1e6) + " MJ"
print "Energy lost to drag = " + str(segment.energy.drag/1e6) + " MJ"
print " "
print "#########################################"
print " "
'''
return
示例2: __call__
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import g0 [as 别名]
def __call__(self,eta,conditions):
segment=Data()
segment.q = conditions.freestream.dynamic_pressure[:,0]
segment.g0 = conditions.freestream.gravity[:,0]
segment.V = conditions.freestream.velocity[:,0]
segment.M = conditions.freestream.mach_number[:,0]
segment.T = conditions.freestream.temperature[:,0]
segment.p = conditions.freestream.pressure[:,0]
F = np.zeros_like(eta)
mdot = np.zeros_like(eta)
P = np.zeros_like(eta)
for propulsor in self.values():
CF, Isp, etaPe = propulsor(eta,segment)
# get or determine intake area
A = propulsor.get_area()
# compute data
F += CF*segment.q*A # N
# propellant-based
if np.isscalar(Isp):
if Isp != 0.0:
mdot += F/(Isp*segment.g0) # kg/s
else:
mask = (Isp != 0.0)
mdot[mask] += F[mask]/(Isp[mask]*segment.g0) # kg/s
# electric-based
if np.isscalar(etaPe):
if etaPe != 0.0:
P += F*segment.V/etaPe # W
#Account for mass gain of Li-air battery
try:
self.battery
except AttributeError:
if propulsor.battery.type=='Li-Air':
for i in range(len(P)):
if propulsor.battery.MaxPower>P[i]:
[Ploss,Mdot]=propulsor.battery(P[i],.01 ) #choose small dt here (has not been solved for yet); its enough to find mass rate gain of battery
else:
[Ploss,Mdot]=propulsor.battery(propulsor.battery.MaxPower,.01 )
mdot[i]+=Mdot.real
else:
mask = (etaPe != 0.0)
P += F[mask]*segment.V[mask]/etaPe[mask] # W
#print mdot
return F, mdot, P