% Title: id31 microstation in EXP hutch % Date: 15 october 2018 % Description: measure on id31 microstation in exp hutch % FS: =256Hz %% 15 october 2018 -------------- % L4-c sensor at 276V/m/s % ch1: Tilt frame Z upstream % ch2: Tilt frame Z downstream % ch3: Ty frame Y % TY motor off --> on at ~300sec % capt1 % Tilt OFF --> ON at ~ 326sec % capt2 % ---------------------------- % ch1: Hexa Z % ch2: Tilt frame Z downstream % ch3: Ty frame Y % % Hexa ON --> OFF at ~ 406sec (tilt ON) % capt3 % % Hexa OFF - Slip ring ON at ~ 300sec then spindle ON at ~ 620sec (tilt ON) % capt4 %% Marble measurements ---- % ch1 floor Z % ch2 marble Z % ch3 floor Y % ch4 marble Y % capt5 %% PARAMETERS beamline='ID31 Nanostation '; % -------------------------------- %%----------OROS ----------------- ch_max=16; % -------------------------------- mult=1e6/276*173; % --> m/s to micron/s and sensitivity correction nyqhp=2.56; % nyquist f_cut=0.5; % cut frequency for high pass filter t_win=4; % window length in sec t_ovlp=3; % overlap window in sec d=1; % distance between vertical sensors. warning off MATLAB:divideByZero % specify capt # for which to run this capt=1:5; % specify channels for which shut correction must be applied % shunt_ch_a=1:3; % shunt_ch_b=1:4; % in case of hammer inpacts specify capt # where it doesnt occur no_hammer=1:5; %no_hammer=0; % specify hammer channel (or ch to find peak due to impacts) shock_ch=1; %% main loop -------- % ------------------ for i=capt eval(['load Measurement',num2str(i)]) freq_max=Track1_TrueBandWidth; dts=1/(freq_max*nyqhp); freq=linspace(0,freq_max,t_win*freq_max); wo=2*pi*freq; for k=1:ch_max vname=['Track',num2str(k)]; array_exist(k)=ismember(vname,who); end non_zero=find(array_exist); for z=non_zero(1):length(non_zero) track_nb=['Track',num2str(z)]'; eval(['data(:,z)=Track',num2str(z),';']); end c=data*mult; %------------- nbch=size(c,2); %------------- r=length(c); if r/2~=fix(r/2) % loop to test for odd or even nb of samples c=c(1:r-1,:); % take only even else end %------------------------------ time=linspace(0,length(c)*dts,length(c)); for j=nbch %shunt_ch [c(:,j),c_shut]=shut_c(c(:,j),1/dts); % correct for shunt end % compute differential level when necessary and store it as 4th column if i<3 c(:,4)=(c(:,2)-c(:,1))/d; % divide by d to obtain Theta Y angle end b=find(no_hammer==i); % if i==1 | i==2 | i==6 if b~=0 [psd_v,integ_v,psd_d,integ_d]=integrated_psd(c,t_win,t_ovlp,nyqhp,dts); [frz_cut,crsp,pwsp,coherz,nsp]=fqresp(c,1,t_win,t_ovlp,nyqhp,dts); [frh_cut,crsp,pwsp,coherz,nsp]=fqresp(c,3,t_win,t_ovlp,nyqhp,dts); else thresh=0.5; % threshold of max value sep=2.5; % separation minimum of peaks in sec pre_ev=2; % pre event delay in sec pos_ev=2; % post event delay in sec [ti,t_impact]=findpeaks(c(:,shock_ch),'minpeakheight',max(c(:,shock_ch))*thresh,'minpeakdistance',ceil(sep/dts)); % find times at which there are impacts (threshold of max and separated by sep sec) psd_v=zeros((pre_ev+pos_ev)/dts/nyqhp,nbch); psd_d=zeros((pre_ev+pos_ev)/dts/nyqhp,nbch); frz_cut=zeros((pre_ev+pos_ev)/dts/nyqhp,nbch); for k=1:length(t_impact) ibeg=fix(t_impact(k)-(pre_ev/dts)); iend=fix(t_impact(k)+(pos_ev/dts)); freq_s=linspace(0,freq_max,t_win/2*freq_max); if ibeg>1 && iend