Skip to content

Commit

Permalink
Merge pull request #563 from suavecode/fix-release
Browse files Browse the repository at this point in the history
Fix release
  • Loading branch information
planes authored Mar 16, 2022
2 parents 901edf3 + c8d1777 commit 11f0909
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 39 deletions.
2 changes: 1 addition & 1 deletion regression/scripts/VTOL/test_Multicopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def main():

# Battery Energy Check During Transition
battery_energy_transition = results.segments.hover.conditions.propulsion.battery_energy[:,0]
battery_energy_transition_true = np.array([2.01866711e+08, 1.97468218e+08, 1.93030572e+08])
battery_energy_transition_true = np.array([2.01278052e+08, 1.92663331e+08, 1.84037484e+08])

print(battery_energy_transition)
diff_battery_energy_transition = np.abs(battery_energy_transition - battery_energy_transition_true)
Expand Down
10 changes: 5 additions & 5 deletions regression/scripts/electric_performance/electric_V_h_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def main():
display_plot=True)


climb_rate_r = [[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 689.2455217 , 0. , 0. , 0. , 0. ],
[ 988.89829547, 889.33701357, 794.8764816 , 705.03514251, 619.30429191],
[1123.00395055, 1014.68342263, 914.80801112, 822.37329709, 736.36838436]]
climb_rate_r = [[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[365.28164616, 0. , 0. , 0. , 0. ],
[671.06501573, 565.12568368, 462.33970468, 362.03685772, 263.49032629],
[677.20427984, 577.26538105, 483.80816586, 395.7082193 , 311.81340271]]


assert (np.all(np.nan_to_num(np.abs(climb_rate-climb_rate_r)/climb_rate_r) < 1e-6)), "Electric V_h Diagram Regression Failed"
Expand Down
2 changes: 1 addition & 1 deletion regression/scripts/ramjet_network/ramjet_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def energy_network():
# ------------------------------------------------------------------

# --- Conditions
ones_1col = np.ones([1,1])
ones_1col = np.ones([2,1])

# setup conditions
conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
Expand Down
2 changes: 1 addition & 1 deletion regression/scripts/solar_network/solar_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def main():
truth_F = 105.36115293802891
truth_rpm = 218.16054150543144
truth_i = 130.07438365817305
truth_bat = 136582345.19056103
truth_bat = 139687275.25925913

print('battery energy')
print(energy)
Expand Down
4 changes: 2 additions & 2 deletions trunk/SUAVE/Components/Energy/Converters/Combustor.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def compute_rayleigh(self,conditions):
Ptr = 1*Pt_in/Pt_in

# Isentropic decceleration through divergent nozzle
Mach = fm_solver(ar,Mach[:,0],gamma[:,0])
Mach = np.atleast_2d(fm_solver(ar,Mach[:,0],gamma[:,0])).T

# Determine max stagnation temperature to thermally choke flow
Tt4_ray = Tt_in*(1.+gamma*Mach*Mach)**2./((2.*(1.+gamma)*Mach*Mach)*(1.+(gamma-1.)/2.*Mach*Mach))
Expand All @@ -229,7 +229,7 @@ def compute_rayleigh(self,conditions):
Tt4[Tt4_ray <= Tt4] = Tt4_ray[Tt4_ray <= Tt4]

#Rayleigh calculations
M_out[:,0], Ptr[:,0] = rayleigh(gamma[:,0],Mach,Tt4[:,0]/Tt_in[:,0])
M_out[:,0], Ptr[:,0] = rayleigh(gamma[:,0],Mach[:,0],Tt4[:,0]/Tt_in[:,0])
Pt_out = Ptr*Pt_in

# method to compute combustor properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ def currentin(self,conditions):
eta = (conditions.propulsion.throttle[:,0,None])*1.0
eff = self.efficiency
currentout = self.inputs.currentout
currentin = currentout*eta/eff
currentin = currentout*eta/eff # The inclusion of eta satisfies a power balance: p_in = p_out/eff

# Pack
self.outputs.currentin = currentin
self.outputs.power_in = self.outputs.voltageout*currentin
self.outputs.power_in = self.inputs.voltagein*currentin

return currentin
4 changes: 1 addition & 3 deletions trunk/SUAVE/Components/Energy/Distributors/Solar_Logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def logic(self,conditions,numerics):
powerin
pavionics
ppayload
volts_motor
currentesc
numerics.time.integrate
Expand All @@ -112,14 +111,13 @@ def logic(self,conditions,numerics):
pin = self.inputs.powerin[:,0,None]
pavionics = self.inputs.pavionics
ppayload = self.inputs.ppayload
volts_motor = self.inputs.volts_motor
esccurrent = self.inputs.currentesc
volts = self.voltage()
I = numerics.time.integrate

pavail = pin*self.MPPT_efficiency

plevel = pavail -pavionics -ppayload - volts_motor*esccurrent
plevel = pavail -pavionics -ppayload - volts*esccurrent

# Integrate the plevel over time to assess the energy consumption
# or energy storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def evaluate_thrust(self,state):
esc.voltageout(conditions)
esc.inputs.currentout = motor_power/esc.outputs.voltageout
esc.currentin(conditions)
esc_power = esc.inputs.voltagein*esc.outputs.currentin
esc_power = esc.outputs.power_in

# Run the avionics
avionics.power()
Expand Down
6 changes: 3 additions & 3 deletions trunk/SUAVE/Components/Energy/Networks/Battery_Propeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ def evaluate_thrust(self,state):
avionics_payload_current = avionics_payload_power/self.voltage

# link
battery.inputs.current = esc.outputs.currentin + avionics_payload_current
battery.inputs.power_in = -(esc.outputs.voltageout *esc.outputs.currentin + avionics_payload_power)
battery.inputs.current = esc.outputs.currentin + avionics_payload_current
battery.inputs.power_in = -(esc.outputs.power_in + avionics_payload_power)
battery.energy_calc(numerics,discharge_flag)

# --------------------------------------------------------------------------------
Expand All @@ -282,7 +282,7 @@ def evaluate_thrust(self,state):
# link
battery.inputs.current = -battery.cell.charging_current*n_parallel * np.ones_like(volts)
battery.inputs.voltage = battery.cell.charging_voltage*n_series * np.ones_like(volts)
battery.inputs.power_in = -battery.inputs.current * battery.inputs.voltage
battery.inputs.power_in = -battery.inputs.current * battery.inputs.voltage
battery.energy_calc(numerics,discharge_flag)

avionics_payload_power = np.zeros((len(volts),1))
Expand Down
3 changes: 0 additions & 3 deletions trunk/SUAVE/Components/Energy/Networks/Ramjet.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ def evaluate_thrust(self,state):
mdot = thrust.outputs.fuel_flow_rate
Isp = thrust.outputs.specific_impulse
output_power = thrust.outputs.power
F_vec = conditions.ones_row(3) * 0.0
F_vec[:,0] = F[:,0]
F = F_vec

results = Data()
results.thrust_force_vector = F
Expand Down
1 change: 0 additions & 1 deletion trunk/SUAVE/Components/Energy/Networks/Solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ def evaluate_thrust(self,state):

# link
solar_logic.inputs.currentesc = esc.outputs.currentin
solar_logic.inputs.volts_motor = esc.outputs.voltageout
solar_logic.logic(conditions,numerics)

# link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def evaluate_thrust(self,state):
esc.currentin(conditions)
# link
solar_logic.inputs.currentesc = esc.outputs.currentin*num_engines
solar_logic.inputs.volts_motor = esc.outputs.voltageout

# Adjust power usage for magic thrust
solar_logic.inputs.currentesc[eta>1.0] = solar_logic.inputs.currentesc[eta>1.0]*eta[eta>1.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ def pre_stall_coefficients(state,settings,geometry):
if wing.vertical == True:
alpha = 0. * np.ones_like(alpha)





# Equation 6c
RCL1 = S1*(ACL1-A0)-CL1max
RCL1[RCL1<=0] = 1.e-16
Expand Down
13 changes: 7 additions & 6 deletions trunk/SUAVE/Methods/Aerodynamics/AERODAS/section_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def section_properties(state,settings,geometry):
S1p = settings.section_lift_curve_slope
ACDmin = settings.section_minimum_drag_coefficient_angle_of_attack

# RE dimensionless
# RE dimensional
RE = re*mac

# Calculate 2-D CLmax
Expand All @@ -65,11 +65,12 @@ def section_properties(state,settings,geometry):
CL1maxp = 1.5 * np.ones_like(state.conditions.freestream.altitude)

# Estimate the ACL1'
ACLp = A0 + CL1maxp/S1p + 3. * Units.deg

ACLp = A0 + CL1maxp/S1p
# Calculate 2-D Cd0
# First calculate CF, from AA 241 A/B Notes
CF = 0.455/(np.log(RE)**2.58)
# First calculate CF,
#CF = 0.455/(np.log(RE)**2.58) # from AA 241 A/B Notes
CF = 0.0576*(RE**(-0.2)) # Typical power law for turbulent skin friction

# Find k, from AA 241 A/B Notes
beta2 = 1
Expand All @@ -79,7 +80,7 @@ def section_properties(state,settings,geometry):
k = 1 + k1 + k2;

# Cd0
Cd0 = k*CF
Cd0 = 2*k*CF

# Estimate the CD1max'
# I have no idea
Expand Down
6 changes: 3 additions & 3 deletions trunk/SUAVE/Methods/Propulsion/nozzle_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def mach_area(area_ratio, gamma, subsonic):
"""
func = lambda Me : (area_ratio**2. - ((1./Me)**2.)*(((2./(gamma+1.))*(1.+((gamma-1.)/2.)*Me**2.))**((gamma+1.)/((gamma-1.)))))[:,0]
if subsonic:
Me_initial_guess = 0.01
Me_initial_guess = np.ones_like(gamma)*0.01
else:
Me_initial_guess = 2.0
Me_initial_guess = np.ones_like(gamma)*2.0

Me = fsolve(func,Me_initial_guess, factor = 0.1)
Me = np.atleast_2d(fsolve(func,Me_initial_guess, factor = 0.1)).T

return Me

Expand Down
4 changes: 2 additions & 2 deletions trunk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def main():
import sys

the_package = 'SUAVE'
version = 'Develop'
date = 'Nov 9, 2021'
version = '2.5.2'
date = 'Mar 16, 2022'

if len(sys.argv) >= 2:
command = sys.argv[1]
Expand Down

0 comments on commit 11f0909

Please sign in to comment.