Exemplo n.º 1
0
def create_propeller(x,afOld):
    diameter = 1.75
    hubDiameter = 0.3
    hubX = hubDiameter / diameter
    baseAfPath = 'clark-Y.txt'

    chordX = array([hubX,0.35,0.5,0.75,0.95])
    pitchX = array([hubX,0.35,0.5,0.75,0.95])
    thickX = array([hubX,0.35,0.5,0.75,0.95])
    xnew = linspace(hubX,0.95,10)
    betaSet = pitchX[3]
    n1,n2,n3 = len(chordX), len(pitchX), len(thickX)
    chordY = x[0:n1]
    pitchY = x[n1:n1+n2]
    thickY = x[n1+n2:]

    method = 'spline'
    chord = _interpolate(chordX,chordY,xnew,method)
    pitch = _interpolate(pitchX,pitchY,xnew,method)
    thick = _interpolate(thickX,thickY,xnew,method)
    
    prop = propeller()
    if afOld==None:
        af = list()
        for tc in thick:
            afnew = Airfoil()
            afnew.read_txt(baseAfPath)
            afnew.analyze_geometry()
            afnew.scale_thickness(tc,False)
            afnew.build_aero_table(alphaSeq=[-40.0,40.0,1.0])
            af.append(afnew)
        prop.airfoil = af
    else:
        prop.airfoil = afOld

    prop.name = 'MDO_project'
    prop.diameter = diameter
    prop.hubDiameter = hubDiameter
    prop.chord = chord
    prop.beta = pitch
    prop.x = xnew
    prop.r = xnew*diameter/2.0
    prop.radius = diameter/2.0
    prop.numBlades = 3.0
    prop.thickness = thick
    prop.numStations = len(xnew)
    prop.analyze_geometry()
    prop.set_beta(betaSet)
    
#    if show:
#        fig = plt.figure(1)
#        ax1 = fig.add_subplot(311)
#        ax1.grid(True)
#        ax1.hold(True)
#        ax1.plot(xnew,chord)
#        ax2 = fig.add_subplot(312)
#        ax2.grid(True)
#        ax2.plot(xnew,pitch)
#        ax3 = fig.add_subplot(313)
#        ax3.grid(True)
#        ax3.plot(xnew,thick)
#        plt.show()
    return prop