In [1]:
    
cd D:\Dropbox\ucla\research\perry\github-desktop\spardesign2
    
    
Before starting, we have created a path called "sandia_blade".
In [2]:
    
ls
    
    
Inside the path "sandia_blade", there is (1) a blade definition file "blade_definition.csv", and (2) a path "airfoils" that contains nondimensional airfoil coordinates.
In [3]:
    
ls sandia_blade
    
    
In [4]:
    
import scripts.blade as bl
b = bl.Blade(name='Sandia blade SNL100-00', blade_path='sandia_blade')
    
    
This creates a blade name "Sandia blade SNL100-00", and looks in the path "sandia_blade" for the blade definition file "blade_definition.csv". It also creates a new folder for each blade station (station paths), located inside the path "sandia_blade".
In [5]:
    
ls sandia_blade
    
    
If our blade definition file was named something else, we could have called:
b = bl.Blade(name='Sandia blade SNL100-00', blade_path='sandia_blade', defn_filename='some_file.csv')
Next, we'll copy all the airfoil coordinates from "sandia_blade/airfoils" into the appropriate station path.
In [6]:
    
b.copy_all_airfoil_coords()
    
    
Next, we can plot the (dimensional) airfoils at each blade station.
In [7]:
    
for station in b.list_of_stations:
    station.read_airfoil_coords()
    station.plot_airfoil_coords(show_flag=True, savefig_flag=True)
    # show_flag : bool, show plots on the screen
    # save_fig_flag : bool (default is True), save airfoil plots to each station path
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
Now, let's explore all the blade definition data that we've imported into the variable b.
We can see how many blade stations there are:
In [8]:
    
b.number_of_stations
    
    Out[8]:
Each of the blade stations can be accessed from the list b.list_of_stations
In [9]:
    
b.list_of_stations
    
    Out[9]:
This may look like nonsense, but each item in the list is a Python object. Notice that there are 34 items in the list above.
We can access individual blade station objects by specifying an index:
In [10]:
    
b.list_of_stations[25]
    
    Out[10]:
There are many attributes for each blade station.
We can access the station number:
In [11]:
    
b.list_of_stations[25].station_num
    
    Out[11]:
Notice that the index of list_of_stations is one off from the attribute .station_num. This is because Python lists start indexing at zero.
We can also access the station path:
In [12]:
    
b.list_of_stations[25].station_path
    
    Out[12]:
The attributes for each blade station are organized into three categories:
1. coordinates : `<station>.coords` (where the station is located)  
2. airfoil properties : `<station>.airfoil` (external airfoil dimensions)  
3. structure properties : `<station>.structure` (internal structure dimensions)  
In [13]:
    
print b.list_of_stations[25].coords
    
    
In [14]:
    
print (b.list_of_stations[25].coords.x1, b.list_of_stations[25].coords.x2, b.list_of_stations[25].coords.x3)
    
    
Here, x1 is the spanwise coordinate, x2 is the edgewise coordinate, and x3 is the flapwise coordinate.
In [15]:
    
print b.list_of_stations[25].airfoil
    
    
We can access individual attributes, like the airfoil name, pitch axis fraction, chord length, and twist:
In [16]:
    
b.list_of_stations[25].airfoil.name
    
    Out[16]:
In [17]:
    
b.list_of_stations[25].airfoil.pitch_axis
    
    Out[17]:
In [18]:
    
b.list_of_stations[25].airfoil.chord
    
    Out[18]:
In [19]:
    
b.list_of_stations[25].airfoil.twist
    
    Out[19]:
We can also access the path of the nondimensional airfoil coordinates:
In [20]:
    
b.list_of_stations[25].airfoil.path
    
    Out[20]:
In [21]:
    
print b.list_of_stations[25].structure
    
    
We can access individual dimensions, too.
For example, we can access the spar cap height:
In [22]:
    
b.list_of_stations[25].structure.spar_cap.height
    
    Out[22]:
Or, we can access the height of the uniaxial GFRP layer in the trailing edge reinforcement:
In [23]:
    
b.list_of_stations[25].structure.TE_reinforcement.height_uniax
    
    Out[23]:
In [24]:
    
b.plot_chord_schedule()
    
    
We can also plot the twist vs. span:
In [25]:
    
b.plot_twist_schedule()
    
    
In [25]: