Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature twotwo #367

Merged
merged 3 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion regression/scripts/VTOL/results_multicopter.res

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion regression/scripts/VTOL/results_tiltwing.res

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions regression/scripts/VTOL/test_Multicopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def main():

# RPM of rotor check during hover
RPM = results.segments.climb.conditions.propulsion.rpm[0][0]
RPM_true = 1572.860935682432
RPM_true = 1566.1021667076357
print(RPM)
diff_RPM = np.abs(RPM - RPM_true)
print('RPM difference')
Expand All @@ -56,10 +56,10 @@ def main():

# Battery Energy Check During Transition
battery_energy_transition = results.segments.hover.conditions.propulsion.battery_energy[:,0]
battery_energy_transition_true = np.array([3.57925502e+08, 3.57739913e+08, 3.57191102e+08, 3.56302619e+08,
3.55112663e+08, 3.53672533e+08, 3.52044519e+08, 3.50299289e+08,
3.48512882e+08, 3.46763416e+08, 3.45127659e+08, 3.43677611e+08,
3.42477272e+08, 3.41579738e+08, 3.41024780e+08, 3.40837016e+08])
battery_energy_transition_true = np.array([3.57930608e+08, 3.57746146e+08, 3.57200666e+08, 3.56317580e+08,
3.55134857e+08, 3.53703492e+08, 3.52085397e+08, 3.50350813e+08,
3.48575318e+08, 3.46836552e+08, 3.45210809e+08, 3.43769647e+08,
3.42576670e+08, 3.41684644e+08, 3.41133093e+08, 3.40946482e+08])
print(battery_energy_transition)
diff_battery_energy_transition = np.abs(battery_energy_transition - battery_energy_transition_true)
print('battery energy of transition')
Expand Down
12 changes: 6 additions & 6 deletions regression/scripts/VTOL/test_Stopped_Rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ def main():

# RPM of rotor check during hover
RPM = results.segments.climb_1.conditions.propulsion.rpm_lift[0][0]
RPM_true = 2258.286261769841
RPM_true = 2245.9307267535346
print(RPM)
diff_RPM = np.abs(RPM - RPM_true)
print('RPM difference')
print(diff_RPM)
assert np.abs((RPM - RPM_true)/RPM_true) < 1e-3

# Battery Energy Check During Transition
battery_energy_hover_to_transition = results.segments.transition_1.conditions.propulsion.battery_energy[:,0]
battery_energy_hover_to_transition_true = np.array([3.06429161e+08,3.06380479e+08,3.06186506e+08 ,3.05843629e+08,
3.05384280e+08,3.04820654e+08,3.04178123e+08 ,3.03484506e+08,
3.02775394e+08,3.02087748e+08,3.01458035e+08 ,3.00916095e+08,
3.00483060e+08,3.00170388e+08,2.99982462e+08 ,2.99919877e+08])
battery_energy_hover_to_transition = results.segments.transition_1.conditions.propulsion.battery_energy[:,0]
battery_energy_hover_to_transition_true = np.array([3.06429284e+08, 3.06380623e+08, 3.06186829e+08, 3.05844315e+08,
3.05385476e+08, 3.04822568e+08, 3.04181088e+08, 3.03489087e+08,
3.02782435e+08, 3.02098309e+08, 3.01473160e+08, 3.00936484e+08,
3.00508759e+08, 3.00200642e+08, 3.00015784e+08, 2.99954279e+08])

print(battery_energy_hover_to_transition)
diff_battery_energy_hover_to_transition = np.abs(battery_energy_hover_to_transition - battery_energy_hover_to_transition_true)
Expand Down
6 changes: 3 additions & 3 deletions regression/scripts/VTOL/test_Tiltwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def main():
plot_mission(results)

# save, load and plot old results
#save_tiltwing_results(results)
save_tiltwing_results(results)
old_results = load_tiltwing_results()
plot_mission(old_results,'k-')

# RPM check during hover
RPM = results.segments.hover.conditions.propulsion.rpm[0][0]
RPM_true = 1604.530912012658
RPM_true = 1600.1282025898854

print(RPM)
diff_RPM = np.abs(RPM - RPM_true)
Expand All @@ -61,7 +61,7 @@ def main():

# lift Coefficient Check During Cruise
lift_coefficient = results.segments.cruise.conditions.aerodynamics.lift_coefficient[0][0]
lift_coefficient_true = 0.6482812427145301
lift_coefficient_true = 0.6482051842320408
print(lift_coefficient)
diff_CL = np.abs(lift_coefficient - lift_coefficient_true)
print('CL difference')
Expand Down
13 changes: 7 additions & 6 deletions regression/scripts/Vehicles/Solar_UAV.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def vehicle_setup():
# Vehicle-level Properties
# ------------------------------------------------------------------
# mass properties
vehicle.mass_properties.takeoff = 200. * Units.kg
vehicle.mass_properties.operating_empty = 200. * Units.kg
vehicle.mass_properties.max_takeoff = 200. * Units.kg
vehicle.mass_properties.takeoff = 250. * Units.kg
vehicle.mass_properties.operating_empty = 250. * Units.kg
vehicle.mass_properties.max_takeoff = 250. * Units.kg

# basic parameters
vehicle.reference_area = 80.
Expand Down Expand Up @@ -206,10 +206,11 @@ def vehicle_setup():
net.avionics = avionics

# Component 8 the Battery
bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
bat.mass_properties.mass = 55.0 * Units.kg
bat.specific_energy = 450. * Units.Wh/Units.kg
bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion()
bat.mass_properties.mass = 90.0 * Units.kg
bat.specific_energy = 600. * Units.Wh/Units.kg
bat.resistance = 0.05
bat.max_voltage = 45.0
initialize_from_mass(bat,bat.mass_properties.mass)
net.battery = bat

Expand Down
4 changes: 2 additions & 2 deletions regression/scripts/battery_propeller/battery_propeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main():

# RPM of rotor check during hover
RPM = results.segments.climb_1.conditions.propulsion.rpm[3][0]
RPM_true = 1045.247788481607
RPM_true = 1027.4250935509208
print(RPM)
diff_RPM = np.abs(RPM - RPM_true)
print('RPM difference')
Expand All @@ -66,7 +66,7 @@ def main():

# lift Coefficient Check During Cruise
lift_coefficient = results.segments.cruise.conditions.aerodynamics.lift_coefficient[2][0]
lift_coefficient_true = 0.38376159297584717
lift_coefficient_true = 0.3837615929756915
print(lift_coefficient)
diff_CL = np.abs(lift_coefficient - lift_coefficient_true)
print('CL difference')
Expand Down
32 changes: 16 additions & 16 deletions regression/scripts/propeller/propeller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,28 +143,28 @@ def main():
Fr, Qr, Pr, Cplastr ,outputr , etapr = rot.spin_variable_pitch(conditions_r)

# Truth values for propeller with airfoil geometry defined
F_a_truth = 1154.29064103
Q_a_truth = 316.6157116
P_a_truth = 66311.83957118
Cplast_a_truth = 0.00601468
F_a_truth = 1014.92402212
Q_a_truth = 278.20652782
P_a_truth = 58267.43893127
Cplast_a_truth = 0.00528503

# Truth values for propeller without airfoil geometry defined
F_truth = 2071.22171907
Q_truth = 562.64831677
P_truth = 117840.78790108
Cplast_truth = 0.01068851
F_truth = 1815.75252952
Q_truth = 490.65810968
P_truth = 102763.19418643
Cplast_truth = 0.00932092

# Truth values for rotor with airfoil geometry defined
Fr_a_truth = 893.16859917
Qr_a_truth = 77.57705597
Pr_a_truth = 16247.70060823
Cplastr_a_truth = 0.00147371
Fr_a_truth = 893.49222898
Qr_a_truth = 77.63298515
Pr_a_truth = 16259.4143889
Cplastr_a_truth = 0.00147478

# Truth values for rotor without airfoil geometry defined
Fr_truth = 900.63698565
Qr_truth = 78.01972629
Pr_truth = 16340.41326374
Cplastr_truth = 0.00148212
Fr_truth = 900.96955037
Qr_truth = 78.07626613
Pr_truth = 16352.25493882
Cplastr_truth = 0.0014832

# Store errors
error = Data()
Expand Down
8 changes: 4 additions & 4 deletions regression/scripts/solar_network/solar_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def main():
energy = results.segments.cruise1.conditions.propulsion.battery_energy[8,0]

# Truth results
truth_F = 103.21142960021062
truth_rpm = 159.01582417482118
truth_i = 127.37614381819269
truth_bat = 88527918.2771849
truth_F = 105.97675179372324
truth_rpm = 262.0569419141544
truth_i = 131.47750267229216
truth_bat = 185967082.27901796

print('battery energy')
print(energy)
Expand Down
2 changes: 1 addition & 1 deletion regression/scripts/solar_network/solar_uav_mission.res

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions regression/scripts/weights/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def main():

# regression values
actual = Data()
actual.empty = 138.02737768459374
actual.wing = 89.86286881794777
actual.empty = 143.59737768459374
actual.wing = 95.43286881794776
actual.fuselage = 1.0
actual.horizontal_tail = 31.749272074174737
actual.vertical_tail = 16.415236792471237
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ def __defaults__(self):

# propulsion conditions
self.propulsion = Conditions()
self.propulsion.throttle = ones_1col * 0
self.propulsion.battery_energy = ones_1col * 0
self.propulsion.battery_voltage = ones_1col * 0
self.propulsion.throttle = ones_1col * 0
self.propulsion.battery_energy = ones_1col * 0
self.propulsion.battery_voltage = ones_1col * 0
self.propulsion.voltage_under_load = ones_1col * 0
self.propulsion.voltage_open_circuit = ones_1col * 0
self.propulsion.thrust_breakdown = Conditions()
self.propulsion.acoustic_outputs = Conditions()
self.propulsion.acoustic_outputs.fan = Conditions()
Expand Down
4 changes: 2 additions & 2 deletions trunk/SUAVE/Components/Energy/Converters/Propeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def spin(self,conditions):
psiold = psi

# If its really not going to converge
if np.any(psi>(pi*85.0/180.)) and np.any(dpsi>0.0):
if np.any(psi>pi/2) and np.any(dpsi>0.0):
break

ii+=1
Expand Down Expand Up @@ -601,7 +601,7 @@ def spin_variable_pitch(self,conditions):
psiold = psi

# If its really not going to converge
if np.any(psi>(pi*85.0/180.)) and np.any(dpsi>0.0):
if np.any(psi>(pi/2)) and np.any(dpsi>0.0):
break

ii+=1
Expand Down
8 changes: 4 additions & 4 deletions trunk/SUAVE/Components/Energy/Converters/Rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def spin(self,conditions):
diff = 1.

ii = 0
broke = False
broke = False
while (diff>tol):
sin_psi = np.sin(psi)
cos_psi = np.cos(psi)
Expand Down Expand Up @@ -331,7 +331,7 @@ def spin(self,conditions):
psiold = psi

# If its really not going to converge
if np.any(psi>(pi*85.0/180.)) and np.any(dpsi>0.0):
if np.any(psi>(pi*2)) and np.any(dpsi>0.0):
break

ii+=1
Expand Down Expand Up @@ -598,7 +598,7 @@ def spin_variable_pitch(self,conditions):

ii = 0
broke = False
tol = 1e-6 # Convergence tolerance
tol = 1e-6 # Convergence tolerance
while (diff>tol):
sin_psi = np.sin(psi)
cos_psi = np.cos(psi)
Expand Down Expand Up @@ -677,7 +677,7 @@ def spin_variable_pitch(self,conditions):
psiold = psi

# If its really not going to converge
if np.any(psi>(pi*85.0/180.)) and np.any(dpsi>0.0):
if np.any(psi>(pi/2)) and np.any(dpsi>0.0):
broke = True
break

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def evaluate_thrust(self,state):
conditions.propulsion.motor_torque = motor.outputs.torque
conditions.propulsion.propeller_torque = Q
conditions.propulsion.battery_specfic_power = -battery_draw/battery.mass_properties.mass # Wh/kg
conditions.propulsion.propeller_tip_mach = (R*rpm)/a
conditions.propulsion.propeller_tip_mach = (R*rpm*Units.rpm)/a

# Create the outputs
F = num_engines* F * [np.cos(self.thrust_angle),0,-np.sin(self.thrust_angle)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def evaluate_thrust(self,state):
conditions.propulsion.rpm = rpm
conditions.propulsion.propeller_torque = Q
conditions.propulsion.power = P
conditions.propulsion.propeller_tip_mach = (R*rpm)/a
conditions.propulsion.propeller_tip_mach = (R*rpm*Units.rpm)/a

# Create the outputs
F = num_engines* F * [np.cos(self.thrust_angle),0,-np.sin(self.thrust_angle)]
Expand Down
22 changes: 13 additions & 9 deletions trunk/SUAVE/Components/Energy/Networks/Solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,19 @@ def evaluate_thrust(self,state):
current = solar_logic.inputs.currentesc
battery_draw = battery.inputs.power_in
battery_energy = battery.current_energy

conditions.propulsion.solar_flux = solar_flux.outputs.flux
conditions.propulsion.rpm = rpm
conditions.propulsion.current = current
conditions.propulsion.battery_draw = battery_draw
conditions.propulsion.battery_energy = battery_energy
conditions.propulsion.motor_torque = motor.outputs.torque
conditions.propulsion.propeller_torque = Q
conditions.propulsion.propeller_tip_mach = (R*rpm)/a
voltage_open_circuit = battery.voltage_open_circuit
voltage_under_load = battery.voltage_under_load

conditions.propulsion.solar_flux = solar_flux.outputs.flux
conditions.propulsion.rpm = rpm
conditions.propulsion.voltage_open_circuit = voltage_open_circuit
conditions.propulsion.voltage_under_load = voltage_under_load
conditions.propulsion.current = current
conditions.propulsion.battery_draw = battery_draw
conditions.propulsion.battery_energy = battery_energy
conditions.propulsion.motor_torque = motor.outputs.torque
conditions.propulsion.propeller_torque = Q
conditions.propulsion.propeller_tip_mach = (R*rpm*Units.rpm)/a

#Create the outputs
F = num_engines * F * [1,0,0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def evaluate_thrust(self,state):
conditions.propulsion.current = current
conditions.propulsion.battery_draw = battery_draw
conditions.propulsion.battery_energy = battery_energy
conditions.propulsion.propeller_tip_mach = (R*rpm)/a
conditions.propulsion.propeller_tip_mach = (R*rpm*Units.rpm)/a

#Create the outputs
F = num_engines * F * [1,0,0]
Expand Down
2 changes: 1 addition & 1 deletion trunk/SUAVE/Components/Energy/Networks/Vectored_Thrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def evaluate_thrust(self,state):
conditions.propulsion.acoustic_outputs[rotor.tag] = output
conditions.propulsion.battery_specfic_power = -battery_draw/battery.mass_properties.mass #Wh/kg
conditions.propulsion.electronics_efficiency = -(P*num_engines)/battery_draw
conditions.propulsion.propeller_tip_mach = (R*motor.outputs.omega)/a
conditions.propulsion.propeller_tip_mach = (R*rpm*Units.rpm)/a
conditions.propulsion.battery_current = total_current
conditions.propulsion.battery_efficiency = (battery_draw+battery.resistive_losses)/battery_draw
conditions.propulsion.payload_efficiency = (battery_draw+(avionics.outputs.power + payload.outputs.power))/battery_draw
Expand Down
14 changes: 7 additions & 7 deletions trunk/SUAVE/Methods/Propulsion/propeller_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def propeller_design(prop,number_of_stations=20):
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
atmo_data = atmosphere.compute_values(alt)

p = atmo_data.pressure[0]
T = atmo_data.temperature[0]
rho = atmo_data.density[0]
a = atmo_data.speed_of_sound[0]
mu = atmo_data.dynamic_viscosity[0]
nu = mu/rho
p = atmo_data.pressure[0]
T = atmo_data.temperature[0]
rho = atmo_data.density[0]
speed_of_sound = atmo_data.speed_of_sound[0]
mu = atmo_data.dynamic_viscosity[0]
nu = mu/rho

# Nondimensional thrust
if (Thrust!= None) and (Power == None):
Expand Down Expand Up @@ -113,7 +113,7 @@ def propeller_design(prop,number_of_stations=20):
#Step 3, determine the product Wc, and RE
G = F*x*np.cos(phi)*np.sin(phi) #Circulation function
Wc = 4.*np.pi*lamda*G*V*R*zeta/(Cl*B)
Ma = Wc/a
Ma = Wc/speed_of_sound
RE = Wc/nu

#Step 4, determine epsilon and alpha from airfoil data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# ----------------------------------------------------------------------

## @ingroup Methods-Weights-Correlations-Human_Powered
def empty(vehicle):
def empty(vehicle,settings=None):
""" Computes weights estimates for human powered aircraft

Assumptions:
Expand Down
2 changes: 1 addition & 1 deletion trunk/SUAVE/Methods/Weights/Correlations/UAV/empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# ----------------------------------------------------------------------

## @ingroup Methods-Weights-Correlations-UAV
def empty(vehicle):
def empty(vehicle,settings=None):
""" This comoutes the weigt of a UAV

Assumptions:
Expand Down
4 changes: 2 additions & 2 deletions trunk/SUAVE/Plots/Mission_Plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,12 @@ def plot_propeller_conditions(results, line_color = 'bo-', save_figure = False,
for segment in results.segments.values():
time = segment.conditions.frames.inertial.time[:,0] / Units.min
rpm = segment.conditions.propulsion.rpm[:,0]
thrust = segment.conditions.frames.body.thrust_force_vector[:,2]
thrust = np.linalg.norm(segment.conditions.frames.body.thrust_force_vector[:,:],axis=1)
torque = segment.conditions.propulsion.motor_torque[:,0]
tm = segment.conditions.propulsion.propeller_tip_mach[:,0]

axes = fig.add_subplot(2,2,1)
axes.plot(time, -thrust, line_color)
axes.plot(time, thrust, line_color)
axes.set_ylabel('Thrust (N)',axis_font)
set_axes(axes)

Expand Down