% Analyze Water Flow 4526.  
close all
Load_rtplt(5); %Full Magnet Flow Test Measurement at 115 delta pressure (only 4526).


figure('units','normalized','outerposition',[0 0 0.9 0.9]);
plot(RT5.Flow, mm(1));
xlabel('Measurement #');
ylabel('Flow Rate (gpm)')
title('Full Magnet Flow Rate of LCLS-II Dipole 4526 - BCXDLU3');
hline(mean(RT5.Flow), 'b--',['Beginning Flow = ', num2str(mean(RT5.Flow)), ' gpm']);
hline(mean(RT5.Flow) + std(RT5.Flow),'b', 'mean + std');
hline(mean(RT5.Flow) - std(RT5.Flow),'b','mean - std');


% Write summary file with the fuull manget and individual flows. 
   
  data_file = 'Magnet Flow Rate of LCLS-II Dipole 4526 - BCXDLU3.txt';   
    f_title = '                      Magnet Flow Rate of LCLS-II Dipole 4526 - BCXDLU3 \n\n' ;
    
fidC = fopen(data_file,'w');
fprintf(fidC,f_title);

fprintf(fidC,'    Full Magnet   \n');
fprintf(fidC,'       (gpm)          \n');
fprintf(fidC,'Mean   %5.3f      \n', mean(RT5.Flow));                
fprintf(fidC,'Stdev  %5.3f    ', std(RT5.Flow));                
fclose(fidC);