% Noise budget PLL test script % % $Id$ %% Add paths clear all close all addpath('../'); findNbSVNroot; addpath(genpath([NbSVNroot 'Common/Utils'])); addpath(genpath([NbSVNroot 'Dev/Utils/'])); %% Define some filters and plot expected OLTF Changing_unit = zpk([],[0],2*pi); Sen = 1; %Filt_Temp = 0; Filt_PZT = zpk([-2*pi*5e3,-2*pi*5e3],[0,0],0.01); %Act_Temp = 0 Act_PZT = 2e6; %Gol = Sen*Filt_Temp*Act_Temp+Sen*Filt_PZT*Act_PZT; Gol = Changing_unit*Sen*Filt_PZT*Act_PZT; %%%% to create a bode plot with the freqeuncy axis in Hz set(cstprefs.tbxprefs,'FrequencyUnits','Hz') figure(100) bode(Gol) grid on %% Define some parameters and get live parts parameters freq = logspace(-11,6,10000); liveModel = 'TEST_PLL'; dof = 'TST'; % name of DOF to plot NB startTime = 1078250000; % start GPS time durationTime = 512; IFO = 'H1'; site = 'LHO'; % Try setting different NDS server if you couldn't get data % setenv('LIGONDSIP','h1nds1:8088'); % mdv_config; % load cached outputs loadFunctionCache() % get live parts parameters %liveParts(liveModel, startTime, durationTime, freq) %% Compute noises and save cache % Compute noises [noises, sys] = nbFromSimulink(liveModel, freq, 'dof', dof); % save cached outputs saveFunctionCache(); %% Make a quick NB plot disp('Plotting noises') nb = nbGroupNoises(liveModel, noises, sys); % Get noise data from DAQ. Put NdNoiseSource block with DAQ channel % specified. Put something (e.g. 1) in ASD parameter of that block. %nb = nbAcquireData(liveModel, sys, nb, startTime, durationTime); nb.sortModel(); matlabNoisePlot(nb); figure(1) %ylim([1e-10,1]) %% plot expected curve from calculation [mag,ph]=bode((Gol)/(1+Gol),2*pi*freq); loglog(freq,squeeze(mag),'b.') hold on %[mag,ph]=bode(1/Sen,2*pi*freq); %loglog(freq,freq./freq/Sen,'r.')