Example #1
0
def performAnalysisSingleSetting():
    PLLBW = 32
    FLLBW = 0
    CNO = 45
    
    t,SignalIn,stateHistory = GenSignal.constantSnap(1,CNO,200)
    Z,DcoFreqArray,LockStateValues,PhaseError = \
    runReceiver(t,SignalIn,PLLBW,FLLBW)
    LockStateValues = np.where(LockStateValues == 3, 1, 0)
    breakingPoint = 200*(np.mean(LockStateValues)) #m/s^2
    
    plt.title('Doppler frequency')
    t = 0.004*np.arange(0,DcoFreqArray.size)
    plt.plot(t,DcoFreqArray,color='k')
    plt.xlabel('Time (s)')
    plt.ylabel('Doppler frequency (Hz)')
    plt.savefig('DcoFreqArray.eps', format='eps', dpi=1000)
        
    plt.close()
    
    plt.title('PLL lock state')
    t = 0.004*np.arange(0,LockStateValues.size)
    print(breakingPoint)            

    plt.plot(t,LockStateValues,color='k')
    plt.fill_between(t,LockStateValues,color='r',alpha=0.5)

    plt.xlabel('Time (s)')
    plt.ylabel('Phase lock')
    plt.ylim(0,1.5)
    plt.savefig('LockState.eps', format='eps', dpi=1000)
    plt.close()

    t = 0.004*np.arange(0,PhaseError.size)

    plt.title('Phase Error')
    plt.xlabel('Time (s)')
    plt.ylabel('Phase error (degrees)')
    plt.plot(t,360*PhaseError,color='k',alpha=0.5)
    plt.savefig('PhaseError.eps', format='eps', dpi=1000)
    plt.close()
    
    plt.title('Phase error standard deviation')    
    stdList =[]
    for i in range(0,PhaseError.size):
        stdList.append((360*PhaseError[i:i+100]).std())

    t = 0.004*np.arange(0,len(stdList))
    
    plt.plot(t,stdList,color='k',alpha=0.5)
    plt.grid()
    plt.ylabel('Window standard deviation (degrees)')
    plt.xlabel('Time (s)')
    plt.savefig('PhaseErrorSTD.eps', format='eps', dpi=1000)
    plt.close()
Example #2
0
def monteCarloAnalysis():
    PLLBW = 32
    FLLBW = 10
    CNO = 45
    
    breakingPoints1 = np.zeros((100))
    averagePhaseJitter1 = np.zeros((100))
    for i in range(0,100):
        t,SignalIn,stateHistory = GenSignal.constantSnap(1,CNO,200)
        Z,DcoFreqArray,LockStateValues,PhaseError = \
        runReceiver(t,SignalIn,PLLBW,FLLBW)
        LockStateValues = np.where(LockStateValues == 3, 1, 0)
        breakingPoint = 200*(np.mean(LockStateValues)) #m/s^2
        breakingPoints1[i] = breakingPoint
        stdArray = np.zeros((250*70))
        for j in range(0,250*70):
            stdArray[j] = (360*PhaseError[j:j+100]).std()
        averagePhaseJitter1[i] = stdArray.mean()
        print(i,stdArray.mean())

    print('A')
    print(np.mean(averagePhaseJitter1),np.std(averagePhaseJitter1)) 

    PLLBW = 32
    FLLBW = 0
    CNO = 45
    
    breakingPoints2 = np.zeros((100))
    averagePhaseJitter2 = np.zeros((100))
    for i in range(0,100):
        t,SignalIn,stateHistory = GenSignal.constantSnap(1,CNO,200)
        Z,DcoFreqArray,LockStateValues,PhaseError = \
        runReceiver(t,SignalIn,PLLBW,FLLBW)
        LockStateValues = np.where(LockStateValues == 3, 1, 0)
        breakingPoint = 200*(np.mean(LockStateValues)) #m/s^2
        breakingPoints2[i] = breakingPoint
        stdArray = np.zeros((250*70))
        for j in range(0,250*70):
            stdArray[j] = (360*PhaseError[j:j+100]).std()
        averagePhaseJitter2[i] = stdArray.mean()
        print(i,stdArray.mean())

    print('B')
    print(np.mean(averagePhaseJitter2),np.std(averagePhaseJitter2)) 

    ## Create data
    np.random.seed(10)
    
    ## combine these different collections into a list    
    data_to_plot = [averagePhaseJitter1, averagePhaseJitter2]

    plt.rc('text', usetex=True)
    plt.rc('font', family='serif')

    # Create the boxplot
    bp = plt.boxplot(data_to_plot)
    plt.setp(bp['boxes'], color='k')
    plt.setp(bp['whiskers'], color='k')
    plt.setp(bp['fliers'], color='k', marker='+')
    plt.setp(bp['medians'], color='k')
    
    plt.title('Average phase jitter jitter')
    plt.ylabel('Average phase jitter $(m/s^3)$')
    plt.savefig('BoxplotPhaseJitter.eps', format='eps', dpi=1000)