Commit 1293ae58 authored by Simone Liuzzo's avatar Simone Liuzzo
Browse files

quadrupolar resonance computation considers QF8D as single magnet

parent 78e0b516
function resp=resonquad(atmodel)
% r = atmodel.ring;
%
% % merge QF8 dipoles to 1 single quadrupole
% indQF8dip = find(atgetcells(r,'FamName','QF8\w*') & atgetcells(r,'Class','Bend'))';
% r=atsetfieldvalues(r,indQF8dip,'BendingAngle',0);
% r=atsetfieldvalues(r,indQF8dip,'Class','Quadrupole');
% r=atsetfieldvalues(r,indQF8dip,'PassMethod','StrMPoleSymplectic4Pass');
%
% % rebuild minimal ebs lattice model, without splitted magnets, just for strengths
% atmodel=ebs.model(r,'reduce',true);
% reduced model with merged DQ (3 of them have a pinhole marker)
atmodel=ebs.model(atmodel.ring,'reduce',true,'keep','BPM.*|ID.*|2PW*|QF8D*');
% pure quadrupoles
iq = atmodel.get(0,'qp');
idq = atmodel.get(0,'dq');
[~,iqa]= sort([iq;idq]); % get quadrupoles order
q = atmodel.get('qp');
% dipole quadrupoles
idq = atmodel.get(0,'dq');
dq = atmodel.get('dq');
Kqa=[q; dq];
% rotated quadrupoles
iqf8d = atmodel.get(0,'qf8d');
q8 = atmodel.get('qf8d');
% count q8 slices
i2pw = atmodel.get(0,'2pw');
n2pw = length(i2pw);
nslices = length(iqf8d)/n2pw; % slices for each qf8d
% average qf8 parameters over slices
for i2 = 1:n2pw
q8red(i2,:)=mean(q8((nslices*(i2-1)+1):(nslices*i2),:));
end
[~,iqa]= sort([iq;idq;iqf8d(floor(nslices/2):nslices:end);]); % get quadrupoles order
Kqa=[q; dq; q8red;];
quad=Kqa(iqa,:);
......
Supports Markdown
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