source: MML/trunk/at/atdemos/findrespmdemo.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 2.7 KB
Line 
1%FINDRESPMDEMO response matrix demo
2% This script illustrates the use of AT function FINDRESPM
3
4spear2
5% The most common RM is corrector-to-BPM
6% In this demonstration we will not use the actual correctors
7% to keep the lattice simple.
8
9% We will use all focusing quadrupoles as correctors:
10% In order to do this we need to use StrMPolesymplectic4 pass-method
11% for them. This mehod looks at all terms of the polynomial
12% expansion of transverse magnetic field.
13% (QuadLinearPass only looks at field 'K')
14% PolynomB(1) gives horizontal kick
15% PolynomA(1) gives a vertical kick
16
17% Find indexes of elements that belong to QF Q1 Q2 Q3 families
18% We will use them as corrector elements
19QFI = findcells(THERING,'FamName','QF');
20Q1I = findcells(THERING,'FamName','Q1');
21Q2I = findcells(THERING,'FamName','Q2');
22Q3I = findcells(THERING,'FamName','Q3');
23CORRINDEX = sort([ QFI Q1I Q2I Q3I]);
24% Install the new pass-method 'StrMPoleSymplectic4Pass'
25THERING = setcellstruct(THERING,'PassMethod',CORRINDEX,'StrMPoleSymplectic4Pass');
26
27% We will use etrance points of all bending magnets as observation points (BPMs)
28BPMINDEX = findcells(THERING,'BendingAngle');
29
30NBPM = length(BPMINDEX);
31NCOR = length(CORRINDEX);
32
33% Prepare input parameters for FINDRESPM that will tell it, which
34% parameters to use as orbit perturbations
35% See help for FINDRESPM
36
37% Set the size of a parameter change for numeric differentiation
38KICKSIZE = 1e-5;
39
40RX = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, 'PolynomB',1,1);
41RY = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, 'PolynomA',1,1);
42% Build the response matrix
43% In the form
44%
45% | HH HV |
46% | VH VV |
47%
48% HH - Horizontal BPM response to horizontal orbit kicks
49% HV - Horizontal BPM response to vertical orbit kicks
50% VH - vertical BPM response to horizontal orbit kicks
51% VV - vertical BPM response to vertical orbit kicks
52RespM_XY = [RX{1} RY{1}; RX{3} RY{3}];
53figure(1);
54mesh(RespM_XY);
55colormap('copper');
56xlabel('Corrector Number')
57ylabel('BPM Number');
58zlabel('Normalized Orbit Response');
59title('Orbit Response Matrix - uncoupled lattice')
60
61% Now we wish to introduce coupling:
62QDI = findcells(THERING,'FamName','QD');
63% Generate random rotations:
64QDTILTS =   1*(pi/180)*randn(1,length(QDI));
65% Put random values in the ring
66settilt(QDI,QDTILTS);
67
68% Generate the new response matrix for the lattice with errors
69RX = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, 'PolynomB',1,1);
70RY = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, 'PolynomA',1,1);
71
72RespM_XY_Coupled = [RX{1} RY{1}; RX{3} RY{3}];
73figure(2);
74mesh(RespM_XY_Coupled);
75colormap('copper');
76title('Orbit Response Matrix - coupled lattice')
77xlabel('Corrector Number')
78ylabel('BPM Number');
79zlabel('Normalized Orbit Response');
80
Note: See TracBrowser for help on using the repository browser.