当前位置: 首页>>代码示例>>Python>>正文


Python Data.M方法代码示例

本文整理汇总了Python中SUAVE.Structure.Data.M方法的典型用法代码示例。如果您正苦于以下问题:Python Data.M方法的具体用法?Python Data.M怎么用?Python Data.M使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SUAVE.Structure.Data的用法示例。


在下文中一共展示了Data.M方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compute_energies

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import M [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        
开发者ID:designToolDeveloper,项目名称:SUAVE,代码行数:50,代码来源:compute_energies.py

示例2: __call__

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import M [as 别名]
    def __call__(self,conditions):

        
        alpha = conditions.angle_of_attack
        
        state = Data()
        state.M   = conditions.mach_number
        state.rho = conditions.density
        state.mew = conditions.viscosity
        state.T   = conditions.temperature
        #state.q   = conditions.dynamic_pressure
        state.Sref = self.Sref
        
        #N = state.M.shape[0]
        
        ##interpolation methods
        #f_Cl = interp1d(self.aoa_range, self.Cl_a,bounds_error=False)
        #Cl_inc=f_Cl(alpha)
        ##Cl_inc=self.f_Cl(alpha)

        Cl_inc= self.CL0 + self.dCLdalpha*alpha  
        CL=Cl_inc/(numpy.sqrt(1-state.M**2))
        #print 'alpha',alpha
        #print 'Cl_inc',Cl_inc
        #print 'CL',CL
        #CD = self.CD0 + (CL**2)/(np.pi*self.AR*self.e)      # parbolic drag
        CD= self.drag(CL,state)

        results = Data()
        results.lift_coefficient = CL
        results.drag_coefficient = CD
        
        conditions.lift_coefficient = CL
        conditions.drag_coefficient = CD
        
        L = np.zeros([N,3])
        D = np.zeros([N,3])
        
        L[:,2] = ( -CL * state.q * state.Sref )[:,0]
        D[:,0] = ( -CD * state.q * state.Sref )[:,0]
        
        results.lift_force_vector = L
        results.drag_force_vector = D

        return [CL,CD]
开发者ID:thearn,项目名称:SUAVE,代码行数:47,代码来源:PASS_Aero.py

示例3: __call__

# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import M [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
开发者ID:thearn,项目名称:SUAVE,代码行数:63,代码来源:Propulsor.py


注:本文中的SUAVE.Structure.Data.M方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。