本文整理汇总了Python中SUAVE.Core.Data.current方法的典型用法代码示例。如果您正苦于以下问题:Python Data.current方法的具体用法?Python Data.current怎么用?Python Data.current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Core.Data
的用法示例。
在下文中一共展示了Data.current方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evaluate_thrust
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import current [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
示例2: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import current [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')
示例3: evaluate_thrust
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import current [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
示例4: evaluate_thrust
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import current [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