Commit d6b66abc authored by Simone Liuzzo's avatar Simone Liuzzo
Browse files

sliced qf8d quadrupole for 2pw model

parent 7458930b
......@@ -103,6 +103,8 @@ classdef model < atmodel
% add dq integrated field (EBS specific)
idz=this.getid('dq');
this.vlave(idz,12)=setintegfield(this.ring(idz),'PolynomB',{2});
idz=this.getid('qf8d');
this.vlave(idz,12)=setintegfield(this.ring(idz),'PolynomB',{2});
this.modified=false;
this.emith_=[]; % Triger computation of emittances
......
......@@ -16,8 +16,8 @@ args={pwd};
args(1:length(varargin))=varargin;
pth=args{1};
atmodel=ebs.model(pth);
atmod=ebs.model(pth);
quadmat=ebs.tuneresponse(atmodel);%,'Matching');
quadmat=ebs.tuneresponse(atmod);%,'Matching');
end
function [resp,devs]=tuneresponse(atmodel,varargin)
function [resp,devs]=tuneresponse(latmodel,varargin)
%TUNERESPONSE compute tune response for tune correction
%
% INPUT:
......@@ -18,13 +18,13 @@ elseif nargin==2
end
% get initial tunes
nuh=atmodel.nuh;
nuv=atmodel.nuv;
nuh=latmodel.nuh;
nuv=latmodel.nuv;
% get quadurpole and DQ indexes
iq = atmodel.get(0,'qp'); % quadrupoles
iq8 = atmodel.get(0,'qf8d'); % tilted qf8d (varying dipole component, 50 slices)
idq = atmodel.get(0,'dq'); % dipole quadrupole (fixed dipole component, but may be splitted for markers)
iq = latmodel.get(0,'qp'); % quadrupoles
iq8 = latmodel.get(0,'qf8d'); % tilted qf8d (varying dipole component, 50 slices)
idq = latmodel.get(0,'dq'); % dipole quadrupole (fixed dipole component, but may be splitted for markers)
allq_unsort = [iq;iq8;idq];
% get order of quadrupoles components in lattice
[allq,iqa] = sort(allq_unsort);
......@@ -72,12 +72,12 @@ DQ=.001;
Q1=Q0+[DQ 0.0];
latnewtunes=ebs.model(atmodel);%,'reduce',true);
latnewtunes=ebs.model(latmodel);%,'reduce',true);
latnewtunes.settune(Q1,tunemode);
DGL=latnewtunes.get(1,'qp') - atmodel.get(1,'qp');
D8GL=latnewtunes.get(1,'qf8d') - atmodel.get(1,'qf8d');
DqGL=latnewtunes.get(1,'dq') - atmodel.get(1,'dq');
DGL=[DGL; D8GL; DqGL];
DGL_=latnewtunes.get(1,'qp') - latmodel.get(1,'qp');
D8GL=latnewtunes.get(1,'qf8d') - latmodel.get(1,'qf8d');
DqGL=latnewtunes.get(1,'dq') - latmodel.get(1,'dq');
DGL=[DGL_; D8GL; DqGL];
% sum gradient changes for sliced magnets
DGLsum = sumk(DGL(iqa),q_group);
......@@ -88,12 +88,12 @@ Mat(:,1)=DGLsum/DQ;
Q1=Q0+[0.0 DQ];
latnewtunes=ebs.model(atmodel);%,'reduce',true);
latnewtunes=ebs.model(latmodel);%,'reduce',true);
latnewtunes.settune(Q1,tunemode);
DGL=latnewtunes.get(1,'qp') - atmodel.get(1,'qp');
D8GL=latnewtunes.get(1,'qf8d') - atmodel.get(1,'qf8d');
DqGL=latnewtunes.get(1,'dq') - atmodel.get(1,'dq');
DGL=[DGL; D8GL; DqGL];
DGL_=latnewtunes.get(1,'qp') - latmodel.get(1,'qp');
D8GL=latnewtunes.get(1,'qf8d') - latmodel.get(1,'qf8d');
DqGL=latnewtunes.get(1,'dq') - latmodel.get(1,'dq');
DGL=[DGL_; D8GL; DqGL];
DGLsum = sumk(DGL(iqa),q_group);
......@@ -110,7 +110,7 @@ selnonzero = 1:length(Mat) ;
%N_dq = size(unique(q_group(ismember(allq,idq))));
[~,iu,~]=unique(q_group);
devs = atgetfieldvalues(atmodel.ring(allq(iu)),'Device');
devs = atgetfieldvalues(latmodel.ring(allq(iu)),'Device');
resp=[uMat(selnonzero,1),uMat(selnonzero,2)];
......
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