Commit 3b35c3c1 authored by Simone Liuzzo's avatar Simone Liuzzo
Browse files

minibeta matching

parent 66d73167
......@@ -2,12 +2,13 @@ function [rM, qpk,dqpk,qf8dpk]=opticsmatching(r,varargin)
% match lattice optics for S28D ESRF-EBS
%
% OUTPUT:
% rm : S28D ESRF-EBS AT lattice with matched optics knobs
% rm : S28D ESRF-EBS AT lattice with matched optics knobs, canting,
% minbeta, 2pw, sb.
% qpk : matched quadurpole strengths
% dqpk : matched dipole-quadurpole strengths
%
% INPUT:
% r : S28D ESRF-EBS AT lattice
% r : S28D ESRF-EBS AT lattice with canting, minbeta, 2pw, sb.
%
% OPTIONAL INPUT (pairs 'name', value, 'name2',value,... ):
% 'mux' : double (76.21) , total hor. phase advance
......@@ -23,6 +24,7 @@ function [rM, qpk,dqpk,qf8dpk]=opticsmatching(r,varargin)
% 'matchCanting' : logical (true), match also canted cells (14,15,16,29,30)
% 'match2PW' : logical (true), match also 2PW cells (1,5,7,14,25,29,31)
% 'matchSB' : logical (true), match also SB cells (2,8,16,20,26,28,30,32)
% 'matchMiniBeta': logical (false), match also MiniBeta cells cells (31)
% 'verbose' : logical (false), print out text information
% 'noDQ' : logical (false), excludes DQ quadrupoles for optics matching.
% 'noDQ1' : logical (false), excludes DQ1 quadrupoles for optics matching.
......@@ -72,6 +74,7 @@ addOptional(p,'dxsf',defaultdxsf,@isnumeric);
addOptional(p,'bymid',defaultbymid,@isnumeric);
addOptional(p,'matchCanting',true,@islogical);
addOptional(p,'matchMiniBeta',false,@islogical);
addOptional(p,'match2PW',true,@islogical);
addOptional(p,'matchSB',true,@islogical);
addOptional(p,'verbose',false,@islogical);
......@@ -91,6 +94,7 @@ dxsf = p.Results.dxsf;
bymid = p.Results.bymid;
matchCanting = p.Results.matchCanting;
matchMiniBeta = p.Results.matchMiniBeta;
match2PW = p.Results.match2PW;
matchSB = p.Results.matchSB;
verbose = p.Results.verbose;
......@@ -189,6 +193,30 @@ if verbose
disp('! - - - - - - - - - - - - - - - - - - !');
end
%% minibeta (must be first since it impacts the standard ARC phase advance)
minibetaid = [31];
dph = [0 0]; % initialize phase advance variation introduced by minibeta to zero.
if matchMiniBeta
% computephase advance variation introduced by minibeta cells
for idnum=minibetaid
rmb = ebs.matching.MiniBetaOptics( r, r, idnum, false, verbose );
l = atlinopt(r,0,1:length(r)+1);
lmb = atlinopt(rmb,0,1:length(rmb)+1);
dph = dph + ( lmb(end).mu - l(end).mu )/2/pi ; %phase advance variation introduced by minibeta cells
end
disp([' MINI-BETA matching. REDEFINE ARCA total phase advance. ']);
disp(['! Delta ph: ' num2str(dph,'%2.4f') ' ' ]);
muxid = muxid-dph(1)/31*32;
muyid = muyid-dph(2)/31*32;
disp(['! muxid: ' num2str(muxid,'%2.4f') ' ']);
disp(['! muyid: ' num2str(muyid,'%2.4f') ' ']);
end
%% match optics in ARCA
if verbose, disp(['Match Cell' num2str(6)]); end
......@@ -423,6 +451,23 @@ end
end
%% introduce minibeta cells
if matchMiniBeta
% computephase advance variation introduced by minibeta cells
for idnum=minibetaid
if isempty(find(atgetcells(r0,'FamName','QS\w*'),1))
error('no minibeta magnets');
end
rb = ebs.matching.MiniBetaOptics( rb, r0, idnum, false, verbose );
end
end
%% restore 2PW and DQ angles for BM
rb0=rb;
% rb = atsetfieldvalues(rb,dipBM,'BendingAngle',ang_dipBM);
......
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