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


Python Data.power_in方法代码示例

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


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

示例1: evaluate_thrust

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import power_in [as 别名]
    def evaluate_thrust(self,state):
        
        # unpack

        propulsor   = self.propulsor
        battery     = self.battery
    
        conditions = state.conditions
        numerics   = state.numerics
  
        results=propulsor.evaluate_thrust(state)
        Pe     =results.thrust_force_vector[:,0]*conditions.freestream.velocity
        
        try:
            initial_energy=conditions.propulsion.battery_energy
            if initial_energy[0][0]==0: #beginning of segment; initialize battery
                battery.current_energy=battery.current_energy[-1]*np.ones_like(initial_energy)
        except AttributeError: #battery energy not initialized, e.g. in takeoff
            battery.current_energy=battery.current_energy[-1]*np.ones_like(F)
        
        pbat=-Pe/self.motor_efficiency
        
        battery_logic     = Data()
        battery_logic.power_in = pbat
        battery_logic.current  = 90.  #use 90 amps as a default for now; will change this for higher fidelity methods
      
        battery.inputs    =battery_logic
        battery.inputs.power_in=pbat
        tol = 1e-6
        battery.energy_calc(numerics)
        #allow for mass gaining batteries
       
        try:
            mdot=find_mass_gain_rate(battery,-(pbat-battery.resistive_losses))
        except AttributeError:
            mdot=np.zeros_like(F)
           
       
        
        
        #Pack the conditions for outputs
        battery_draw                         = battery.inputs.power_in
        battery_energy                       = battery.current_energy
      
        conditions.propulsion.battery_draw   = battery_draw
        conditions.propulsion.battery_energy = battery_energy
        
        output_power= battery_draw
        #number_of_engines
        #Create the outputs
        
        
 
        results.vehicle_mass_rate   = mdot
        return results
开发者ID:Aircraft-Design-UniNa,项目名称:SUAVE,代码行数:57,代码来源:Battery_Ducted_Fan.py

示例2: main

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import power_in [as 别名]
def main():
    #size the battery
    Mission_total=SUAVE.Analyses.Mission.Sequential_Segments()
    Ereq=4000*Units.Wh #required energy for the mission in Joules
   
    Preq=3000. #maximum power requirements for mission in W
    numerics                      =Data()
    battery_inputs                =Data() #create inputs data structure for inputs for testing discharge model
    specific_energy_guess         =500*Units.Wh/Units.kg
    battery_li_air                = SUAVE.Components.Energy.Storages.Batteries.Variable_Mass.Lithium_Air()
    battery_al_air                = SUAVE.Components.Energy.Storages.Batteries.Variable_Mass.Aluminum_Air()
    battery_li_air.discharge_model=datta_discharge           #default discharge model, but assign anyway
    battery_li_ion                = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
    battery_li_s                  = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Sulfur()
    li_ion_mass                   = 10*Units.kg
    
    #build numerics
    numerics.time                 =Data()
    numerics.time.integrate       = np.array([[0, 0],[0, 10]])
    numerics.time.differentiate   = np.array([[0, 0],[0, 1]])
    
    #build battery_inputs(i.e. current it's run at, power, normally done from energy network
    battery_inputs.current        =90*Units.amps
    battery_inputs.power_in       =np.array([Preq/2. , Preq])
    print 'battery_inputs=', battery_inputs
    battery_li_ion.inputs         =battery_inputs
    
    #run tests on functionality
    test_initialize_from_energy_and_power(battery_al_air, Ereq, Preq)
    test_mass_gain(battery_al_air, Preq)
    test_find_ragone_properties(specific_energy_guess,battery_li_s, Ereq,Preq)
    test_find_ragone_optimum(battery_li_ion,Ereq,Preq)
   
    test_initialize_from_mass(battery_li_ion,li_ion_mass)
    #make sure battery starts fully charged
    battery_li_ion.current_energy=[[battery_li_ion.max_energy, battery_li_ion.max_energy]] #normally handle making sure arrays are same length in network
    #run discharge model
    battery_li_ion.energy_calc(numerics)
    print battery_li_ion
    plot_ragone(battery_li_ion, 'lithium ion')
    plot_ragone(battery_li_s,   'lithium sulfur')
开发者ID:michK,项目名称:SUAVE,代码行数:43,代码来源:battery.py

示例3: evaluate_thrust

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import power_in [as 别名]
    def evaluate_thrust(self,state):
        """ Calculate thrust given the current state of the vehicle
    
            Assumptions:
            None
    
            Source:
            N/A
    
            Inputs:
            state [state()]
    
            Outputs:
            results.thrust_force_vector [newtons]
            results.vehicle_mass_rate   [kg/s]
    
            Properties Used:
            Defaulted values
        """         
        
        # unpack

        propulsor   = self.propulsor
        battery     = self.battery
    
        conditions  = state.conditions
        numerics    = state.numerics
  
        results = propulsor.evaluate_thrust(state)
        Pe      = np.multiply(results.thrust_force_vector[:,0],conditions.freestream.velocity[0])
        
        try:
            initial_energy = conditions.propulsion.battery_energy
            if initial_energy[0][0]==0: #beginning of segment; initialize battery
                battery.current_energy = battery.current_energy[-1]*np.ones_like(initial_energy)
        except AttributeError: #battery energy not initialized, e.g. in takeoff
            battery.current_energy=np.transpose(np.array([battery.current_energy[-1]*np.ones_like(Pe)]))
        
        pbat = -Pe/self.motor_efficiency
        battery_logic          = Data()
        battery_logic.power_in = pbat
        battery_logic.current  = 90.  #use 90 amps as a default for now; will change this for higher fidelity methods
      
        battery.inputs = battery_logic
        tol = 1e-6
        
        battery.energy_calc(numerics)
        #allow for mass gaining batteries
       
        try:
            mdot=find_mass_gain_rate(battery,-(pbat-battery.resistive_losses)) #put in transpose for solver
        except AttributeError:
            mdot=np.zeros_like(results.thrust_force_vector[:,0])
        mdot=np.reshape(mdot, np.shape(conditions.freestream.velocity))
        #Pack the conditions for outputs
        battery_draw                         = battery.inputs.power_in
        battery_energy                       = battery.current_energy
      
        conditions.propulsion.battery_draw   = battery_draw
        conditions.propulsion.battery_energy = battery_energy
        
        results.vehicle_mass_rate   = mdot
        return results
开发者ID:michK,项目名称:SUAVE,代码行数:65,代码来源:Battery_Ducted_Fan.py

示例4: evaluate_thrust

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import power_in [as 别名]
    def evaluate_thrust(self,state):
        
        # unpack

        propulsor          = self.propulsor
        primary_battery    = self.primary_battery
        auxiliary_battery  = self.auxiliary_battery
        conditions         = state.conditions
        numerics           = state.numerics
        
        results=propulsor.evaluate_thrust(state)
     
        Pe     =results.power
        
        try:
            initial_energy           = conditions.propulsion.primary_battery_energy
            initial_energy_auxiliary = conditions.propulsion.auxiliary_battery_energy
            if initial_energy[0][0]==0: #beginning of segment; initialize battery
                primary_battery.current_energy   = primary_battery.current_energy[-1]*np.ones_like(initial_energy)
                auxiliary_battery.current_energy = auxiliary_battery.current_energy[-1]*np.ones_like(initial_energy)
        except AttributeError: #battery energy not initialized, e.g. in takeoff
            primary_battery.current_energy   = np.transpose(np.array([primary_battery.current_energy[-1]*np.ones_like(Pe)]))
            auxiliary_battery.current_energy = np.transpose(np.array([auxiliary_battery.current_energy[-1]*np.ones_like(Pe)]))
       
       
        pbat=-Pe/self.motor_efficiency
        pbat_primary=copy.copy(pbat) #prevent deep copy nonsense
        pbat_auxiliary=np.zeros_like(pbat)
        #print 'pbat=', pbat/10**6.
        #print 'max_power prim=', primary_battery.max_power/10**6. 
        #print 'max_power aux=', auxiliary_battery.max_power/10**6. 
        for i in range(len(pbat)):
            if  pbat[i]<-primary_battery.max_power:   #limit power output of primary_battery
                pbat_primary[i]   = -primary_battery.max_power #-power means discharge
                pbat_auxiliary[i] = pbat[i]-pbat_primary[i]
            elif pbat[i]>primary_battery.max_power: #limit charging rate of battery
                pbat_primary[i]   = primary_battery.max_power
                pbat_auxiliary[i] = pbat[i]-pbat_primary[i]
            if pbat_primary[i]>0: #don't allow non-rechargable battery to charge
                pbat_primary[i]   = 0
                pbat_auxiliary[i] = pbat[i]
     
        primary_battery_logic            = Data()
        primary_battery_logic.power_in   = pbat_primary
        primary_battery_logic.current    = 90.  #use 90 amps as a default for now; will change this for higher fidelity methods
        auxiliary_battery_logic          = copy.copy(primary_battery_logic)
        auxiliary_battery_logic.power_in = pbat_auxiliary
        primary_battery.inputs           = primary_battery_logic
        auxiliary_battery.inputs         = auxiliary_battery_logic
        tol                              = 1e-6
        primary_battery.energy_calc(numerics)
        auxiliary_battery.energy_calc(numerics)
        #allow for mass gaining batteries
        
        try:
            mdot_primary = find_mass_gain_rate(primary_battery,-(pbat_primary-primary_battery.resistive_losses))
        except AttributeError:
            mdot_primary = np.zeros_like(results.thrust_force_vector[:,0])   
        try:
            mdot_auxiliary = find_mass_gain_rate(auxiliary_battery,-(pbat_auxiliary-auxiliary_battery.resistive_losses))
        except AttributeError:
            mdot_auxiliary = np.zeros_like(results.thrust_force_vector[:,0])
    
        mdot=mdot_primary+mdot_auxiliary
        mdot=np.reshape(mdot, np.shape(conditions.freestream.velocity))
        #Pack the conditions for outputs
        primary_battery_draw                 = primary_battery.inputs.power_in
        primary_battery_energy               = primary_battery.current_energy
        auxiliary_battery_draw               = auxiliary_battery.inputs.power_in
        auxiliary_battery_energy             = auxiliary_battery.current_energy
      
        conditions.propulsion.primary_battery_draw   = primary_battery_draw
        conditions.propulsion.primary_battery_energy = primary_battery_energy
        
        conditions.propulsion.auxiliary_battery_draw   = auxiliary_battery_draw
        conditions.propulsion.auxiliary_battery_energy = auxiliary_battery_energy
        
    
        results.vehicle_mass_rate = mdot
        #from SUAVE.Core import Units
        #print 'primary power=',primary_battery_draw/Units.MJ
        #print 'aux power=',auxiliary_battery_draw/Units.MJ
        return results
开发者ID:Alexandrovich,项目名称:SUAVE,代码行数:85,代码来源:Dual_Battery_Ducted_Fan.py

示例5: main

# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import power_in [as 别名]
def main():
    fuel_cell=SUAVE.Components.Energy.Converters.Fuel_Cell()
    max_power=10000.*Units.W
    initialize_from_power(fuel_cell,max_power)
    inputs=Data()
    inputs.power_in=np.linspace(0, max_power, 30)
    fuel_cell.inputs=inputs
    conditions=Data() #not used in zero_fidelity, but may be used in higher fidelity evaluation
    numerics=Data()
    mdot=fuel_cell.energy_calc(conditions,numerics)
    print fuel_cell
    print mdot
    fuel_cell_larminie=SUAVE.Components.Energy.Converters.Fuel_Cell() #higher fidelity model\
    setup_larminie(fuel_cell_larminie)
    initialize_larminie_from_power(fuel_cell_larminie,max_power)
    fuel_cell_larminie.inputs=inputs
    mdot_larminie=fuel_cell_larminie.energy_calc(conditions,numerics)
    print fuel_cell_larminie
    print mdot_larminie
    current_density_vec=np.linspace(.1, 1000, 50)*(Units.mA/(Units.cm**2.))
    i1= current_density_vec/(Units.mA/(Units.cm**2.))
    vvec= find_voltage_larminie(fuel_cell_larminie,current_density_vec)
    pvec=find_power_larminie(current_density_vec,fuel_cell_larminie)
    
    fig, ax1=plt.subplots()
    title='Larminie Discharge Plot'
    ax1.plot(i1,vvec, label='voltage')
    ax1.set_xlabel('current density (mA/cm^2)')
    ax1.set_ylabel('voltage (V)')
    plt.title(title)    
    
    ax2 = ax1.twinx()
    title2='Power Plot'
    ax2.plot(current_density_vec/(Units.mA/(Units.cm**2.)),pvec, 'r', label='Power (W/cell)')
    plt.xlabel('current density (mA/cm^2)')
    ax2.set_ylabel('Power/cell(W)')
    
    '''
    N=3
    thermo=SUAVE.Core.Data()
    air=SUAVE.Attributes.Gases.Air()

    thermo.Tt=np.ones(N)*300.
    thermo.pt=np.ones(N)*100E3
    cp=air.compute_cp(thermo.Tt[0],thermo.pt[0])
    thermo.cp=cp*np.ones(N)
    
    gamma=air.compute_gamma(thermo.Tt[0],thermo.pt[0])
    thermo.gamma=gamma*np.ones(N)
    thermo.ht=np.ones(N)*thermo.cp[0]*thermo.Tt[0]
    maxpower=10000.
    aircraft    = SUAVE.Vehicle()
    compressor=SUAVE.Components.Propulsors.Segments.Compressor()
    compressor.eta_polytropic=[.6]
    compressor.pt_ratio=(2*101.3*10**3)/thermo.pt[0]
    
    mdot=.01;            #assign an overall mass flow rate
    fuel_cell=SUAVE.Components.Energy.Converters.Fuel_Cell()
  
    fuel_cell.active=1
    compressor.active=1
  
    SUAVE.Methods.Power.size_fuel_cell(fuel_cell,maxpower)
    
    power=maxpower/2
    compressor.i=0
    compressor.f=1
    fuel_cell.i=1
    fuel_cell.f=2
    compressor(thermo,power)
    power=power+mdot*(thermo.ht[1]-thermo.ht[0])
    [mdot_h2,mdot_products]=fuel_cell(power, thermo, mdot)
    
    print mdot_products
    print thermo
    
    
    #now run fuel cell without specifying any thermodynamic properties
    [mdot_h2,mdot_products]=fuel_cell(power)
    '''
    return
开发者ID:aerialhedgehog,项目名称:SUAVE,代码行数:83,代码来源:test_fuel_cell.py


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