Commit f28c928e authored by beamdyn's avatar beamdyn

Added function AcquireData.m

parent 4ad0261e
function AcquireData(fileLabel)
%
% function AcquireData(fileLabel)
%
% This function acquires LT, Current, Emittances, Orbit, tunes, energy
% spread and losses from the accelerator and saves the data in matlab
% file.
%
% input fileLabel is a label attached to file name. The file name will
% also include date and time of the measurement.
%
%% get data
%%
filename = [fileLabel '_' datestr(now)];
try
eh07 = tango.Attribute('srdiag/emittance/id07/Emittance_H').value;
catch
eh07 = NaN;
end
try
eh25 = tango.Attribute('srdiag/emittance/id25/Emittance_H').value;
catch
eh25 = NaN;
end
try
ev07 = tango.Attribute('srdiag/emittance/id07/Emittance_V').value;
catch
ev07 = NaN;
end
try
ev25 = tango.Attribute('srdiag/emittance/id25/Emittance_V').value;
catch
eh07 = 0;
end
try
es1 = tango.Attribute('srdiag/beam-espread/1/EnergySpread').value;
catch
es1=NaN;
end
try
es2 = tango.Attribute('srdiag/beam-espread/2/EnergySpread').value;
catch
es2=NaN;
end
I = tango.Attribute('srdiag/beam-current/total/Current').value;
LT = [];
Losses=zeros(5,128);
for it = 1:5
LT(it) = tango.Attribute('srdiag/bpm/lifetime/Lifetime').value;
TotLosses(it)=tango.Attribute('srdiag/blm/All/TotalLoss').value;
Losses(it,:)=tango.Attribute('srdiag/blm/All/Losses').value;
pause(2)
end
orbh=tango.Attribute('srdiag/bpm/all/All_SA_HPosition').value;
orbv=tango.Attribute('srdiag/bpm/all/All_SA_VPosition').value;
th=tango.Attribute('srdiag/beam-tune/main/Qh').value;
tv=tango.Attribute('srdiag/beam-tune/main/Qv').value;
FillPatt=tango.Attribute(...
'srdiag/current-per-bunch/wphd/UnmaskedCurrentsMilliAmpere').read;
RF_VoltTRA1=tango.Attribute('srrf/anodloop/tra1/Voltage').set;
RF_VoltCAV1=tango.Attribute('srrf/ssa-driver/c25-1/RFAmplitude').set;
RF_VoltCAV2=tango.Attribute('srrf/ssa-driver/c25-2/RFAmplitude').set;
RF_VoltCAV3=tango.Attribute('srrf/ssa-driver/c25-3/RFAmplitude').set;
RF_Volt = RF_VoltTRA1 + RF_VoltCAV1 +RF_VoltCAV2 +RF_VoltCAV3;
save(filename,'eh07','eh25','ev07','ev25','I','es1','es2',...
'LT','Losses','TotLosses',...
'th','tv','orbh','orbv','FillPatt',...
'RF_VoltTRA1','RF_VoltCAV1','RF_VoltCAV2','RF_VoltCAV3','RF_Volt');
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment