Exemple #1
0
def plotWingGeom(ax, myWing, style = [91.,91.,91.]):
    xRoot       = myWing.xRoot.getValue()
    zRoot       = myWing.zRoot.getValue()
    cRoot       = myWing.cRoot.getValue()
    cTip        = myWing.cTip.getValue()
    phiLE       = myWing.phiLE.getValue()
    span        = myWing.span.getValue()
    
    xMAC        = myWing.xMAC.getValue()
    yMAC        = myWing.yMAC.getValue()
    cMAC        = myWing.cMAC.getValue()

    xMAC        = (xMAC,xMAC+cMAC)    
    yMAC        = (yMAC,yMAC)
    zMAC        = (0.,0.)
    ax.plot(xMAC, yMAC, zMAC,color=giveColorForNetworkx(style),linestyle='--')
    
    xw          = (xRoot,xRoot+span/2.*tan(phiLE*rad),xRoot+span/2.*tan(phiLE*rad)+cTip,xRoot+cRoot,xRoot)
    yw          = (0.,span/2.,span/2.,0.,0.)
    zw          = (zRoot,zRoot,zRoot,zRoot,zRoot)
    ax.plot(xw, yw, zw, label=myWing.id,color=giveColorForNetworkx(style))

    xw          = (xRoot+0.25*cRoot,xRoot+0.25*cTip+span/2.*tan(phiLE*rad))
    yw          = (0.,span/2.)
    zw          = (zRoot,zRoot)
    ax.plot(xw, yw, zw,color=giveColorForNetworkx(style),linestyle='--')
    
    return ax
Exemple #2
0
def plotOEM(myAircraft):
    # make a square figure and axes
    fig = figure(figsize=(15, 15))
    ax = axes([0.1, 0.1, 0.8, 0.8])

    labels = []
    fracs = []
    colors = []

    labels.append(myAircraft.wing.id)
    fracs.append(myAircraft.wing.mWing.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append(myAircraft.htp.id)
    fracs.append(myAircraft.htp.mHtp.getValue())
    colors.append(giveColorForNetworkx(htpC))

    labels.append(myAircraft.vtp.id)
    fracs.append(myAircraft.vtp.mVtp.getValue())
    colors.append(giveColorForNetworkx(vtpC))

    labels.append(myAircraft.fuselage.id)
    fracs.append(myAircraft.fuselage.mFuselage.getValue())
    colors.append(giveColorForNetworkx(fuselageC))

    labels.append(myAircraft.engine.id)
    fracs.append(myAircraft.engine.mEngine.getValue())
    colors.append(giveColorForNetworkx(engineC))

    labels.append(myAircraft.pylon.id)
    fracs.append(myAircraft.pylon.mPylon.getValue())
    colors.append(giveColorForNetworkx(pylonC))

    labels.append(myAircraft.systems.id)
    fracs.append(myAircraft.systems.mSystems.getValue())
    colors.append(giveColorForNetworkx(systemsC))

    labels.append(myAircraft.landingGear.id)
    fracs.append(myAircraft.landingGear.mLandingGear.getValue())
    colors.append(giveColorForNetworkx(landingGearC))

    labels.append('oIM')
    fracs.append(myAircraft.oIM.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    explode = [0.05] * len(labels)
    myPie = pie(fracs,
                explode=explode,
                labels=labels,
                colors=colors,
                autopct='%1.1f%%',
                shadow=True)
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[kg]' % (labels[i], fracs[i])
        legends.append(out)

    ax.legend(myPie[0], legends, shadow=True)
    saveFigure('OEM Breakdown')
    close(fig)
Exemple #3
0
def plotOEM(myAircraft):
    # make a square figure and axes
    fig         = figure(figsize=(15,15)) 
    ax          = axes([0.1, 0.1, 0.8, 0.8])
    
    labels      = []
    fracs       = []
    colors      = []
    
    labels.append(myAircraft.wing.id)
    fracs.append(myAircraft.wing.mWing.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append(myAircraft.htp.id)
    fracs.append(myAircraft.htp.mHtp.getValue())
    colors.append(giveColorForNetworkx(htpC))

    labels.append(myAircraft.vtp.id)
    fracs.append(myAircraft.vtp.mVtp.getValue())
    colors.append(giveColorForNetworkx(vtpC))

    labels.append(myAircraft.fuselage.id)
    fracs.append(myAircraft.fuselage.mFuselage.getValue())
    colors.append(giveColorForNetworkx(fuselageC))
    
    labels.append(myAircraft.engine.id)
    fracs.append(myAircraft.engine.mEngine.getValue())
    colors.append(giveColorForNetworkx(engineC))

    labels.append(myAircraft.pylon.id)
    fracs.append(myAircraft.pylon.mPylon.getValue())
    colors.append(giveColorForNetworkx(pylonC))

    labels.append(myAircraft.systems.id)
    fracs.append(myAircraft.systems.mSystems.getValue())
    colors.append(giveColorForNetworkx(systemsC))

    labels.append(myAircraft.landingGear.id)
    fracs.append(myAircraft.landingGear.mLandingGear.getValue())
    colors.append(giveColorForNetworkx(landingGearC))

    labels.append('oIM')
    fracs.append(myAircraft.oIM.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    explode=[0.05]*len(labels)
    myPie = pie(fracs, explode=explode,labels=labels,  colors=colors, autopct='%1.1f%%', shadow=True)
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[kg]'%(labels[i],fracs[i])
        legends.append(out)  
    
    ax.legend(myPie[0],legends,shadow = True)
    saveFigure('OEM Breakdown')
    close(fig)
def plotSensitivityBarDoc(parameter, names, ups, calcName):
    '''
    Plots a sensitivity Bar for the documentation
    @param name: Name of the Parameter used for saving as well 
    @param names: Namelist of dependent callees
    @param ups: upper sensitivity values
    '''
    componentName = parameter.parent.id
    disciplineName = parameter["discipline"]
    name = parameter["name"]

    lName = parameter.longName.replace('.', '')
    fileName = parameter.picName
    #==============================================================================
    #Create Folder and File 
    #==============================================================================
    dir = os.path.dirname(fileName)
    if not os.path.exists(dir):
        os.makedirs(dir)

    if ups:
        ind = np.arange(float(len(ups)))
        fig = plt.figure(figsize=(4, len(ups) / 2.))
        ax = fig.add_subplot(111, axisbg='grey', frameon=False, xticks=[], yticks=[])

        colors = []
        values = []
        for item in ups:
            if item > 0.:
                color = giveColorForNetworkx(aircraftC)
            else:
                color = giveColorForNetworkx(engineC)

            colors.append(color)
            values.append(abs(item))

        ax.barh(ind, values, color=colors, align='center', left=0., height=.5, edgecolor='w')

        for Cname in names:
            ax.text(0, names.index(Cname), ' ' + Cname, ha='left', va='center', color='k', alpha=0.8, size=16)

        ax.plot([0., 0.], [-0.25, len(ups) -1 + .25], 'k', alpha=0.25, linewidth=2.)
        ax.set_xticklabels([''])
        ax.set_yticklabels([''])

        ax.set_title('')
        plt.savefig(fileName, dpi=300)
        plt.close(fig)
Exemple #5
0
def plotDrag(myAircraft):
    # make a square figure and axes
    fig = figure(figsize=(15, 15))
    ax = axes([0.1, 0.1, 0.8, 0.8])

    labels = []
    fracs = []
    colors = []

    labels.append(myAircraft.wing.id)
    fracs.append(myAircraft.wing.cD0c.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append(myAircraft.htp.id)
    fracs.append(myAircraft.htp.cD0c.getValue())
    colors.append(giveColorForNetworkx(htpC))

    labels.append(myAircraft.vtp.id)
    fracs.append(myAircraft.vtp.cD0c.getValue())
    colors.append(giveColorForNetworkx(vtpC))

    labels.append(myAircraft.fuselage.id)
    fracs.append(myAircraft.fuselage.cD0c.getValue())
    colors.append(giveColorForNetworkx(fuselageC))

    labels.append(myAircraft.engine.id)
    fracs.append(myAircraft.engine.cD0c.getValue())
    colors.append(giveColorForNetworkx(engineC))

    explode = [0.05] * len(labels)

    myPie = pie(fracs,
                explode=explode,
                labels=labels,
                colors=colors,
                autopct='%1.1f%%',
                shadow=True)

    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f' % (labels[i], fracs[i])
        legends.append(out)

    ax.legend(myPie[0], legends, shadow=True)

    saveFigure('Component Drag')
    close(fig)
Exemple #6
0
def plotDrag(myAircraft):
    # make a square figure and axes
    fig         = figure(figsize=(15,15))
    ax          = axes([0.1, 0.1, 0.8, 0.8])
    
    labels      = []
    fracs       = []
    colors      = []
    
    labels.append(myAircraft.wing.id)
    fracs.append(myAircraft.wing.cD0c.getValue())
    colors.append(giveColorForNetworkx(wingC))


    labels.append(myAircraft.htp.id)
    fracs.append(myAircraft.htp.cD0c.getValue())
    colors.append(giveColorForNetworkx(htpC))


    labels.append(myAircraft.vtp.id)
    fracs.append(myAircraft.vtp.cD0c.getValue())
    colors.append(giveColorForNetworkx(vtpC))
    
    labels.append(myAircraft.fuselage.id)
    fracs.append(myAircraft.fuselage.cD0c.getValue())
    colors.append(giveColorForNetworkx(fuselageC))

    
    labels.append(myAircraft.engine.id)
    fracs.append(myAircraft.engine.cD0c.getValue())
    colors.append(giveColorForNetworkx(engineC))

    
    explode=[0.05]*len(labels)
    
    
    myPie = pie(fracs, explode=explode,labels=labels,colors=colors, autopct='%1.1f%%', shadow=True)
    
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f'%(labels[i],fracs[i])
        legends.append(out)  
    
    ax.legend(myPie[0],legends,shadow = True)
    
    saveFigure('Component Drag')
    close(fig)
Exemple #7
0
def plotMFUEL(myAircraft):
    # make a square figure and axes
    fig = figure(figsize=(15, 15))
    ax = axes([0.1, 0.1, 0.8, 0.8])

    labels = []
    fracs = []
    colors = []

    labels.append('mFuelCR')
    fracs.append(myAircraft.fuel.mFuelCR.getValue())
    colors.append(giveColorForNetworkx(fuelC))

    labels.append('mFuelCLIMB')
    fracs.append(myAircraft.fuel.mFuelCLIMB.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('mFuelDESCENT')
    fracs.append(myAircraft.fuel.mFuelDESCENT.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('mFuelTO')
    fracs.append(myAircraft.fuel.mFuelTO.getValue())
    colors.append(giveColorForNetworkx(payloadC))

    labels.append('mFuelRES')
    fracs.append(myAircraft.fuel.mFuelRES.getValue())
    colors.append(giveColorForNetworkx(engineC))

    explode = [0.05] * len(labels)
    myPie = pie(fracs,
                explode=explode,
                labels=labels,
                colors=colors,
                autopct='%1.1f%%',
                shadow=True)
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[kg]' % (labels[i], fracs[i])
        legends.append(out)

    ax.legend(myPie[0], legends, shadow=True)
    saveFigure('mFUEL Breakdown')
    close(fig)
Exemple #8
0
def plotEngineGeom(ax,myEngine,style = [91.,91.,91.]):
    lEngine     = myEngine.lEngine.getValue()
    dEngine     = myEngine.dEngine.getValue()
    xEngine     = myEngine.xEngine.getValue()
    yEngine     = myEngine.yEngine.getValue()
    
    x,y,z       = cRooteateCylinder(xEngine,lEngine,dEngine)
    ploty       = [value + yEngine for value in y]
    ax.plot(x, ploty, z, label=myEngine.id,color=giveColorForNetworkx(style))
    
    return ax
Exemple #9
0
def plotMFUEL(myAircraft):
    # make a square figure and axes
    fig         = figure(figsize=(15,15))
    ax          = axes([0.1, 0.1, 0.8, 0.8])
    
    labels      = []
    fracs       = []
    colors      = []
    

    labels.append('mFuelCR')
    fracs.append(myAircraft.fuel.mFuelCR.getValue())
    colors.append(giveColorForNetworkx(fuelC))

    labels.append('mFuelCLIMB')
    fracs.append(myAircraft.fuel.mFuelCLIMB.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('mFuelDESCENT')
    fracs.append(myAircraft.fuel.mFuelDESCENT.getValue())
    colors.append(giveColorForNetworkx(aircraftC))
    
    labels.append('mFuelTO')
    fracs.append(myAircraft.fuel.mFuelTO.getValue())
    colors.append(giveColorForNetworkx(payloadC))

    labels.append('mFuelRES')
    fracs.append(myAircraft.fuel.mFuelRES.getValue())
    colors.append(giveColorForNetworkx(engineC))

    explode=[0.05]*len(labels)
    myPie = pie(fracs, explode=explode,labels=labels,colors=colors, autopct='%1.1f%%', shadow=True)
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[kg]'%(labels[i],fracs[i])
        legends.append(out)  
    
    ax.legend(myPie[0],legends,shadow = True)
    saveFigure('mFUEL Breakdown')
    close(fig)
Exemple #10
0
def plotFuselageGeom(ax,myFuselage, style = [91.,91.,91.]):

    
    dfus        = myFuselage.dfus.getValue()
    
    lcabin      = myFuselage.lcabin.getValue()
    ltail       = myFuselage.ltail.getValue()
    lnose       = myFuselage.lnose.getValue()
    loverlay       = myFuselage.loverlay.getValue()

    #Nose
    x,y,z       = cRooteateCylinder(0, lnose, dfus)
    ax.plot(x, y, z, color=giveColorForNetworkx(style),linestyle='--')
    
    #Cabin
    x,y,z       = cRooteateCylinder(lnose-(lnose-2.4),lcabin , dfus)
    ax.plot(x, y, z, label=myFuselage.id,color=giveColorForNetworkx(style))

    #Tail
    x,y,z       = cRooteateCylinder(lnose-(lnose-2.4)+lcabin-loverlay ,ltail, dfus)
    ax.plot(x, y, z, color=giveColorForNetworkx(style),linestyle='--')

    return ax
Exemple #11
0
def plotCOC(myAircraft):
    # make a square figure and axes
    fig = figure(figsize=(15, 15))
    ax = axes([0.1, 0.1, 0.8, 0.8])

    labels = []
    fracs = []
    colors = []

    #===========================================================================
    # COC
    #===========================================================================
    labels.append('costCrew')
    fracs.append(myAircraft.costCrew.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costFuel')
    fracs.append(myAircraft.costFuel.getValue())
    colors.append(giveColorForNetworkx(fuselageC))

    labels.append('costMaintenance')
    fracs.append(myAircraft.costMaintenance.getValue())
    colors.append(giveColorForNetworkx(htpC))

    labels.append('costNavigation')
    fracs.append(myAircraft.costNavigation.getValue())
    colors.append(giveColorForNetworkx(engineC))

    labels.append('costLanding')
    fracs.append(myAircraft.costLanding.getValue())
    colors.append(giveColorForNetworkx(vtpC))

    labels.append('costGround')
    fracs.append(myAircraft.costGround.getValue())
    colors.append(giveColorForNetworkx(fuelC))

    #===========================================================================
    # Plot
    #===========================================================================
    explode = [0.05] * len(labels)
    myPie = pie(fracs,
                explode=explode,
                labels=labels,
                colors=colors,
                autopct='%1.1f%%',
                shadow=True)

    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[EU/bh]' % (labels[i], fracs[i])
        legends.append(out)

    ax.legend(myPie[0], legends, shadow=True)

    saveFigure('COC Breakdown')
    close(fig)
Exemple #12
0
def plotCOC(myAircraft):
    # make a square figure and axes
    fig         = figure(figsize=(15,15))
    ax          = axes([0.1, 0.1, 0.8, 0.8])
    
    labels      = []
    fracs       = []
    colors      = []
    
    #===========================================================================
    # COC
    #===========================================================================
    labels.append('costCrew')
    fracs.append(myAircraft.costCrew.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costFuel')
    fracs.append(myAircraft.costFuel.getValue())
    colors.append(giveColorForNetworkx(fuselageC))
    
    labels.append('costMaintenance')
    fracs.append(myAircraft.costMaintenance.getValue())
    colors.append(giveColorForNetworkx(htpC))

    labels.append('costNavigation')
    fracs.append(myAircraft.costNavigation.getValue())
    colors.append(giveColorForNetworkx(engineC))

    labels.append('costLanding')
    fracs.append(myAircraft.costLanding.getValue())
    colors.append(giveColorForNetworkx(vtpC))

    labels.append('costGround')
    fracs.append(myAircraft.costGround.getValue())
    colors.append(giveColorForNetworkx(fuelC))

    #===========================================================================
    # Plot
    #===========================================================================
    explode=[0.05]*len(labels)
    myPie = pie(fracs, explode=explode,labels=labels,colors=colors, autopct='%1.1f%%', shadow=True)
    
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[EU/bh]'%(labels[i],fracs[i])
        legends.append(out)  
    
    ax.legend(myPie[0],legends,shadow = True)
         
    saveFigure('COC Breakdown')
    close(fig)
Exemple #13
0
def plotPayloadRange(myAircraft):
    '''
    Is used to generate a Paylaod Range Diagramm of the Aircraft configuration
    should not be triggered unless VAMPzero has already reached convergence
    '''
    myAircraft.log.info("VAMPzero PLOT: Calculation PayloadRange Diagram")
    myAircraft.log.info("VAMPzero PLOT: .. this will trigger three calcAuto runs")
    
    fig = figure(figsize=(15,15))
    ax  = axes()
    x = []
    y = []
    z = []
    v = []
    l = []

    
    myAircraft.freeze()
    myAircraft.desRange.setStatus("calc")
    myAircraft.distCR.setStatus("calc")
    myAircraft.distCLIMB.setStatus("calc")
    myAircraft.distDESCENT.setStatus("calc")
    myAircraft.distRES.setStatus("calc")

    myAircraft.timeCR.setStatus("calc")
    myAircraft.timeCLIMB.setStatus("calc")
    myAircraft.timeDESCENT.setStatus("calc")
    myAircraft.timeRES.setStatus("calc")

    myAircraft.fuel.mFuelCR.setStatus("calc")
    myAircraft.fuel.mFuelCLIMB.setStatus("calc")
    myAircraft.fuel.mFuelDESCENT.setStatus("calc")
    myAircraft.fuel.mFuelRES.setStatus("calc")

    mPayloadTemp    = [myAircraft.payload.mPayload.getValue()]*2
    mZFWTemp        = [myAircraft.mZFW.getValue()]*2
    mTOMTemp        = [myAircraft.mTOM.getValue()]*2
    mTOM            = myAircraft.mTOM.getValue()
    oEM             = myAircraft.oEM.getValue()
    mLMTemp         = [myAircraft.mLM.getValue()]*2
    mFuelMAXTemp    = [myAircraft.fuel.mFuelMAX.getValue()]*2
    
    

    ax.plot([myAircraft.desRange.getValue()/1000.,myAircraft.desRange.getValue()/1000.],[0.,mTOM],'k-.',label='designPoint')

    ################################################################################################################
    #Point 0 maximum Payload fill up with no fuel
    ################################################################################################################
    

    x.append(0.)
    y.append(myAircraft.payload.mPayload.getValue())
    z.append(0.)
    
    v.append(myAircraft.payload.mPayload.getValue()+oEM)#+myAircraft.fuel.mFM.getValue()#)
    l.append(myAircraft.payload.mPayload.getValue()+oEM)
    
    ################################################################################################################
    #Point 1 maximum Payload fill up with fuel!
    #Set mission Fuel Mass to the highest value without exceeding mTOM
    ################################################################################################################
    if mTOM- oEM- myAircraft.payload.mPayload.getValue() < myAircraft.fuel.mFuelMAX.getValue():
        myAircraft.fuel.mFM.setValueFix(mTOM- oEM- myAircraft.payload.mPayload.getValue())
    else:
        myAircraft.log.debug("VAMPzero PLOT: Payload Failure Can not Reach maximum Fuel Mass")
        myAircraft.fuel.mFM.setValueFix(myAircraft.fuel.mFuelMAX.getValue())
        
    myAircraft.calcAuto()
    

    x.append(myAircraft.desRange.getValue()/1000.)
    y.append(myAircraft.payload.mPayload.getValue())
    z.append(myAircraft.fuel.mFM.getValue())

    v.append(myAircraft.fuel.mFM.getValue()+myAircraft.payload.mPayload.getValue()+oEM)
    l.append(myAircraft.payload.mPayload.getValue()+oEM)    
    
    ################################################################################################################    
    #Point 2 maximum Fuel in Tanks Rest Payload
    #Only adjust Payload if it is less then mTOM minus max Fuel and oEM
    ################################################################################################################
    
    addWeight  = mTOM - oEM
    maxFuel    = myAircraft.fuel.mFuelMAX.getValue()
    
    if maxFuel >= addWeight:
        myAircraft.fuel.mFM.setValueFix(addWeight)
        myAircraft.payload.mPayload.setValueFix(0.)
    else:
        myAircraft.fuel.mFM.setValueFix(maxFuel)
        myAircraft.payload.mPayload.setValueFix(addWeight-maxFuel)

    myAircraft.calcAuto()
    
    x.append(myAircraft.desRange.getValue()/1000.)
    y.append(myAircraft.payload.mPayload.getValue())
    z.append(myAircraft.fuel.mFM.getValue())

    v.append(myAircraft.fuel.mFM.getValue()+myAircraft.payload.mPayload.getValue()+oEM)    
    l.append(myAircraft.payload.mPayload.getValue()+oEM)        

    ################################################################################################################
    #Point 3 maximum Fuel in Tanks no Payload
    ################################################################################################################
    
    myAircraft.payload.mPayload.setValueFix(0.)
    myAircraft.calcAuto()


    x.append(myAircraft.desRange.getValue()/1000.)
    y.append(myAircraft.payload.mPayload.getValue())
    z.append(myAircraft.fuel.mFM.getValue())
    
    v.append(myAircraft.fuel.mFM.getValue()+myAircraft.payload.mPayload.getValue()+oEM)    
    l.append(myAircraft.payload.mPayload.getValue()+oEM)

    ################################################################################################################
    #Do the Plotting
    ################################################################################################################
    ax.plot(x,v,'o-',color=giveColorForNetworkx(aircraftC),label='actual TakeOff Mass')

    ax.plot(x,z,'o-',color=giveColorForNetworkx(fuelC),label='mission Fuel Mass')
    
    ax.plot(x,l,'o-',color=giveColorForNetworkx(wingC),label='actual Landing Mass')
    
    ax.plot(x,y,'o-',color=giveColorForNetworkx(payloadC),label='carried Payload Mass')

    ax.plot([0.,myAircraft.desRange.getValue()/1000.],mZFWTemp,'--',color=giveColorForNetworkx(engineC),label='maximum Zero Fuel Mass')

    ax.plot([0.,myAircraft.desRange.getValue()/1000.],mPayloadTemp,color=giveColorForNetworkx(payloadC),linestyle='--',label='design Payload Mass')
    
    ax.plot([0.,myAircraft.desRange.getValue()/1000.],mTOMTemp,'--',color=giveColorForNetworkx(aircraftC),label='maximum TakeOff Mass')

    ax.plot([0.,myAircraft.desRange.getValue()/1000.],mLMTemp,'--',color=giveColorForNetworkx(wingC),label='maximum Landing Mass')
    
    ax.plot([0.,myAircraft.desRange.getValue()/1000.],mFuelMAXTemp,color=giveColorForNetworkx(fuelC),linestyle='--',label='maximum Fuel Mass')
    
    ################################################################################################################       
    xlabel('Range [km]')
    ylabel('Mass [kg]')
    grid(False)
    leg = ax.legend(loc='center left',frameon=False)
    for t in leg.get_texts():
        t.set_fontsize('small')      
    title('VAMPzero PayloadRange ',color=(139/255.,0,0))
    fig.savefig('./ReturnDirectory/payloadRange.pdf')
    close(fig)
    
    ################################################################################################################
    #Write the points of the payload range diagram to a file
    ################################################################################################################
    points = zip(x,y)
    PR_outfile = './ReturnDirectory/PRpoints.csv'
    with open(PR_outfile,'w') as outfile:
        cases = []
        outfile.write('Range0;Payload0;RangeA;PayloadA;RangeB;PayloadB;RangeC;PayloadC\n')
        for p in points:
            cases.append("%f;%f" %(p))
        outfile.write(';'.join(cases) + '\n')
Exemple #14
0
def plotDOC(myAircraft):
    # make a square figure and axes
    fig = figure(figsize=(15, 15))
    ax = axes([0.1, 0.1, 0.8, 0.8])

    labels = []
    fracs = []
    colors = []
    '''
    #===========================================================================
    # COC
    #===========================================================================
    labels.append('costCrew')
    fracs.append(myAircraft.costCrew.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costFuel')
    fracs.append(myAircraft.costFuel.getValue())
    colors.append(giveColorForNetworkx(wingC))
    
    labels.append('costMaintenance')
    fracs.append(myAircraft.costMaintenance.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costNavigation')
    fracs.append(myAircraft.costNavigation.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costLanding')
    fracs.append(myAircraft.costLanding.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costGround')
    fracs.append(myAircraft.costGround.getValue())
    colors.append(giveColorForNetworkx(wingC))

    #===========================================================================
    # COO
    #===========================================================================
    labels.append('costDepreciation')
    fracs.append(myAircraft.costDepreciation.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costInterest')
    fracs.append(myAircraft.costInterest.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costInsurance')
    fracs.append(myAircraft.costInsurance.getValue())
    colors.append(giveColorForNetworkx(aircraftC))
    '''
    #===========================================================================
    # TU Berlin DOC method
    #===========================================================================

    # C1 = costCrew + CostCap

    labels.append('costCrew')
    fracs.append(myAircraft.costCrew.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costCap')
    fracs.append(myAircraft.costCap.getValue())
    colors.append(giveColorForNetworkx(wingC))

    # C2 = costFuel + costLanding + costGround + costNavigation + costMaintenance

    labels.append('costFuel')
    fracs.append(myAircraft.costFuel.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costLanding')
    fracs.append(myAircraft.costLanding.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costGround')
    fracs.append(myAircraft.costGround.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costNavigation')
    fracs.append(myAircraft.costNavigation.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costMaintenance')
    fracs.append(myAircraft.costMaintenance.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    #===========================================================================
    # Plot
    #===========================================================================
    explode = [0.05] * len(labels)
    myPie = pie(fracs,
                explode=explode,
                labels=labels,
                colors=colors,
                autopct='%1.1f%%',
                shadow=True)

    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[EU/bh]' % (labels[i], fracs[i])
        legends.append(out)

    ax.legend(myPie[0], legends, shadow=True)

    saveFigure('DOC Breakdown')
    close(fig)
def plotSensitivityBarDoc(parameter, names, ups, calcName):
    '''
    Plots a sensitivity Bar for the documentation
    @param name: Name of the Parameter used for saving as well 
    @param names: Namelist of dependent callees
    @param ups: upper sensitivity values
    '''
    componentName = parameter.parent.id
    disciplineName = parameter["discipline"]
    name = parameter["name"]

    lName = parameter.longName.replace('.', '')
    fileName = parameter.picName
    #==============================================================================
    #Create Folder and File
    #==============================================================================
    dir = os.path.dirname(fileName)
    if not os.path.exists(dir):
        os.makedirs(dir)

    if ups:
        ind = np.arange(float(len(ups)))
        fig = plt.figure(figsize=(4, len(ups) / 2.))
        ax = fig.add_subplot(111,
                             axisbg='grey',
                             frameon=False,
                             xticks=[],
                             yticks=[])

        colors = []
        values = []
        for item in ups:
            if item > 0.:
                color = giveColorForNetworkx(aircraftC)
            else:
                color = giveColorForNetworkx(engineC)

            colors.append(color)
            values.append(abs(item))

        ax.barh(ind,
                values,
                color=colors,
                align='center',
                left=0.,
                height=.5,
                edgecolor='w')

        for Cname in names:
            ax.text(0,
                    names.index(Cname),
                    ' ' + Cname,
                    ha='left',
                    va='center',
                    color='k',
                    alpha=0.8,
                    size=16)

        ax.plot([0., 0.], [-0.25, len(ups) - 1 + .25],
                'k',
                alpha=0.25,
                linewidth=2.)
        ax.set_xticklabels([''])
        ax.set_yticklabels([''])

        ax.set_title('')
        plt.savefig(fileName, dpi=300)
        plt.close(fig)
Exemple #16
0
def plotDOC(myAircraft):
    # make a square figure and axes
    fig         = figure(figsize=(15,15))
    ax          = axes([0.1,0.1,0.8,0.8])
   
    labels      = []
    fracs       = []
    colors      = []
    '''
    #===========================================================================
    # COC
    #===========================================================================
    labels.append('costCrew')
    fracs.append(myAircraft.costCrew.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costFuel')
    fracs.append(myAircraft.costFuel.getValue())
    colors.append(giveColorForNetworkx(wingC))
    
    labels.append('costMaintenance')
    fracs.append(myAircraft.costMaintenance.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costNavigation')
    fracs.append(myAircraft.costNavigation.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costLanding')
    fracs.append(myAircraft.costLanding.getValue())
    colors.append(giveColorForNetworkx(wingC))

    labels.append('costGround')
    fracs.append(myAircraft.costGround.getValue())
    colors.append(giveColorForNetworkx(wingC))

    #===========================================================================
    # COO
    #===========================================================================
    labels.append('costDepreciation')
    fracs.append(myAircraft.costDepreciation.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costInterest')
    fracs.append(myAircraft.costInterest.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costInsurance')
    fracs.append(myAircraft.costInsurance.getValue())
    colors.append(giveColorForNetworkx(aircraftC))
    '''
    #===========================================================================
    # TU Berlin DOC method
    #===========================================================================
    
    # C1 = costCrew + CostCap
    
    labels.append('costCrew')
    fracs.append(myAircraft.costCrew.getValue())
    colors.append(giveColorForNetworkx(wingC)) 

    labels.append('costCap')
    fracs.append(myAircraft.costCap.getValue())
    colors.append(giveColorForNetworkx(wingC))
    
    # C2 = costFuel + costLanding + costGround + costNavigation + costMaintenance
    
    labels.append('costFuel')
    fracs.append(myAircraft.costFuel.getValue())
    colors.append(giveColorForNetworkx(aircraftC))
    
    labels.append('costLanding')
    fracs.append(myAircraft.costLanding.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costGround')
    fracs.append(myAircraft.costGround.getValue())
    colors.append(giveColorForNetworkx(aircraftC))

    labels.append('costNavigation')
    fracs.append(myAircraft.costNavigation.getValue())
    colors.append(giveColorForNetworkx(aircraftC))
    
    labels.append('costMaintenance')
    fracs.append(myAircraft.costMaintenance.getValue())
    colors.append(giveColorForNetworkx(aircraftC))
    
    #===========================================================================
    # Plot
    #===========================================================================
    explode=[0.05]*len(labels)
    myPie = pie(fracs, explode=explode,labels=labels,colors=colors, autopct='%1.1f%%', shadow=True)
    
    legends = []
    for i in range(len(fracs)):
        out = '%-10s= %.2f[EU/bh]'%(labels[i],fracs[i])
        legends.append(out)  
    
    ax.legend(myPie[0],legends,shadow = True)
         
    saveFigure('DOC Breakdown')
    close(fig)
Exemple #17
0
 def plotLine(ax,style, x,y,z,c):
     x = (x,x+c)
     y = (y,y)
     z = (z,z)
     ax.plot(x, y, z,color=giveColorForNetworkx(style),linestyle='--')
     return ax