11# tut_solar_UAV.py
22#
33# Created: Jul 2014, E. Botero
4- # Modified: Jan 2017, E. Botero
4+ # Modified: Aug 2017, E. Botero
55
66#----------------------------------------------------------------------
77# Imports
88# ----------------------------------------------------------------------
99import SUAVE
10- from SUAVE .Core import Units
11-
12- from SUAVE .Core import (
13- Data , Container
14- )
10+ from SUAVE .Core import Units , Data
1511
1612import numpy as np
1713import pylab as plt
18- import matplotlib
19- import copy , time
14+ import time
2015
2116from SUAVE .Components .Energy .Networks .Solar import Solar
2217from SUAVE .Methods .Propulsion import propeller_design
@@ -104,7 +99,7 @@ def vehicle_setup():
10499 wing .tag = 'main_wing'
105100
106101 wing .areas .reference = vehicle .reference_area
107- wing .spans .projected = 40.0
102+ wing .spans .projected = 40.0 * Units . meter
108103 wing .aspect_ratio = (wing .spans .projected ** 2 )/ wing .areas .reference
109104 wing .sweeps .quarter_chord = 0.0 * Units .deg
110105 wing .symmetric = True
@@ -149,7 +144,7 @@ def vehicle_setup():
149144 wing .spans .projected = np .sqrt (wing .aspect_ratio * wing .areas .reference )
150145 wing .twists .root = 0.0 * Units .degrees
151146 wing .twists .tip = 0.0 * Units .degrees
152-
147+
153148 wing .vertical = False
154149 wing .symmetric = True
155150 wing .dynamic_pressure_ratio = 0.9
@@ -182,7 +177,6 @@ def vehicle_setup():
182177 wing .chords .root = wing .areas .reference / wing .spans .projected
183178 wing .chords .tip = wing .areas .reference / wing .spans .projected
184179 wing .chords .mean_aerodynamic = wing .areas .reference / wing .spans .projected
185-
186180 wing .areas .wetted = 2.0 * wing .areas .reference
187181 wing .areas .exposed = 0.8 * wing .areas .wetted
188182 wing .areas .affected = 0.6 * wing .areas .wetted
@@ -209,7 +203,7 @@ def vehicle_setup():
209203 net .nacelle_diameter = 0.2
210204 net .engine_length = 0.01
211205 net .areas = Data ()
212- net .areas .wetted = 0.01 * (2 * np .pi * 0.01 / 2 )
206+ net .areas .wetted = 0.01 * (2 * np .pi * 0.01 / 2. )
213207
214208 # Component 1 the Sun?
215209 sun = SUAVE .Components .Energy .Processes .Solar_Radiation ()
@@ -228,18 +222,17 @@ def vehicle_setup():
228222 net .esc = esc
229223
230224 # Component 5 the Propeller
231-
232225 # Design the Propeller
233226 prop_attributes = Data ()
234227 prop_attributes .number_blades = 2.0
235- prop_attributes .freestream_velocity = 40.0 # freestream m/s
228+ prop_attributes .freestream_velocity = 40.0 * Units [ ' m/s' ] # freestream
236229 prop_attributes .angular_velocity = 150. * Units ['rpm' ]
237230 prop_attributes .tip_radius = 4.25
238231 prop_attributes .hub_radius = 0.05
239232 prop_attributes .design_Cl = 0.7
240233 prop_attributes .design_altitude = 14.0 * Units .km
241234 prop_attributes .design_thrust = 0.0
242- prop_attributes .design_power = 3500.0
235+ prop_attributes .design_power = 3500.0 * Units . watts
243236 prop_attributes = propeller_design (prop_attributes )
244237
245238 prop = SUAVE .Components .Energy .Converters .Propeller ()
@@ -289,7 +282,6 @@ def vehicle_setup():
289282
290283 return vehicle
291284
292-
293285# ----------------------------------------------------------------------
294286# Define the Configurations
295287# ---------------------------------------------------------------------
@@ -315,7 +307,6 @@ def configs_setup(vehicle):
315307
316308 configs .append (config )
317309
318- # done!
319310 return configs
320311
321312
@@ -576,7 +567,6 @@ def plot_mission(results):
576567 cdm = drag_breakdown .miscellaneous .total [:,0 ]
577568 cd = drag_breakdown .total [:,0 ]
578569
579-
580570 axes .plot ( time , cdp , 'ko-' , label = 'CD_P' )
581571 axes .plot ( time , cdi , 'bo-' , label = 'CD_I' )
582572 axes .plot ( time , cdc , 'go-' , label = 'CD_C' )
@@ -590,7 +580,6 @@ def plot_mission(results):
590580 axes .set_ylabel ('CD' )
591581 axes .grid (True )
592582
593-
594583 # ------------------------------------------------------------------
595584 # Battery Energy
596585 # ------------------------------------------------------------------
@@ -680,8 +669,6 @@ def plot_mission(results):
680669 axes .grid (True )
681670 plt .ylim ((0 ,1 ))
682671
683-
684-
685672 # ------------------------------------------------------------------
686673 # Flight Conditions
687674 # ------------------------------------------------------------------
@@ -718,7 +705,6 @@ def plot_mission(results):
718705 # ------------------------------------------------------------------
719706 # Solar Flux, Charging Power, Battery Energy
720707 # ------------------------------------------------------------------
721-
722708
723709 fig = plt .figure ("Electric Outputs" )
724710 for segment in results .segments .values ():
@@ -744,10 +730,9 @@ def plot_mission(results):
744730 axes .set_ylabel ('Battery Energy (MJ)' )
745731 axes .grid (True )
746732
747-
748733 return
749734
750735if __name__ == '__main__' :
751736 main ()
752737
753- plt .show ()
738+ plt .show ()
0 commit comments