Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BeamDynamics
matutil
Commits
d6b66abc
Commit
d6b66abc
authored
Sep 27, 2018
by
Simone Liuzzo
Browse files
sliced qf8d quadrupole for 2pw model
parent
7458930b
Changes
3
Hide whitespace changes
Inline
Side-by-side
+ebs/@model/model.m
View file @
d6b66abc
...
...
@@ -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
...
...
+ebs/tune_model.m
View file @
d6b66abc
...
...
@@ -16,8 +16,8 @@ args={pwd};
args
(
1
:
length
(
varargin
))
=
varargin
;
pth
=
args
{
1
};
atmod
el
=
ebs
.
model
(
pth
);
atmod
=
ebs
.
model
(
pth
);
quadmat
=
ebs
.
tuneresponse
(
atmod
el
);
%,'Matching');
quadmat
=
ebs
.
tuneresponse
(
atmod
);
%,'Matching');
end
+ebs/tuneresponse.m
View file @
d6b66abc
function
[
resp
,
devs
]
=
tuneresponse
(
atmodel
,
varargin
)
function
[
resp
,
devs
]
=
tuneresponse
(
l
atmodel
,
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
=
l
atmodel
.
nuh
;
nuv
=
l
atmodel
.
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
=
l
atmodel
.
get
(
0
,
'qp'
);
% quadrupoles
iq8
=
l
atmodel
.
get
(
0
,
'qf8d'
);
% tilted qf8d (varying dipole component, 50 slices)
idq
=
l
atmodel
.
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
(
l
atmodel
);
%,'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'
)
-
l
atmodel
.
get
(
1
,
'qp'
);
D8GL
=
latnewtunes
.
get
(
1
,
'qf8d'
)
-
l
atmodel
.
get
(
1
,
'qf8d'
);
DqGL
=
latnewtunes
.
get
(
1
,
'dq'
)
-
l
atmodel
.
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
(
l
atmodel
);
%,'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'
)
-
l
atmodel
.
get
(
1
,
'qp'
);
D8GL
=
latnewtunes
.
get
(
1
,
'qf8d'
)
-
l
atmodel
.
get
(
1
,
'qf8d'
);
DqGL
=
latnewtunes
.
get
(
1
,
'dq'
)
-
l
atmodel
.
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
(
l
atmodel
.
ring
(
allq
(
iu
)),
'Device'
);
resp
=
[
uMat
(
selnonzero
,
1
),
uMat
(
selnonzero
,
2
)];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment