source: MML/trunk/machine/SOLEIL/StorageRing/stepalpha2.m @ 17

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

To have a stable version on the server.

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1function stepalpha2(dxix, dxiz, dalpha2)
2% FUNCTION STEPALPHA2 - step chromaticities and alpha2 using sextupole families
3%
4%  INPUTS
5%  1. dxix - horizontal tune variation
6%  2. dxiz - vertical tune variation
7%  3. dalpha2 - second order momentum compaction variation
8%
9%  Notes
10%  1. Matrix generation
11%  [DSx DSz DchroVal]     = modelchrosensitivity;
12%  [SextuRmcf1 SextuRmcf2]= modelmcfsensitivity('Sextu');
13%  2. Save matrices for operation
14%     [DKx DKz DtuneVal]   = modeltunesensitivity;
15%     [DSx DSz DchroVal]   = modelchrosensitivity;
16%     [QuadRmcf1 QuadRmcf2]= modelmcfsensitivity('Quad');
17%     [SextuRmcf1 SextuRmcf2]=modelmcfsensitivity('Sextu');
18%     save('Rmatrix_alphaby10_nouveau_modele_janv10_opt_nonlin', 'DtuneVal', 'DchroVal', 'QuadRmcf1', 'QuadRmcf2', 'SextuRmcf1', 'SextuRmcf2');
19
20%  3. S11 and S1 are linked together
21%
22%  See Also stepalpha1, physics_mcf, modelmcfsensitivity, modelalpharesponsemat
23
24%
25%% Written by Laurent S. Nadolski
26
27InteractiveFlag = 1;
28
29% Check input parameters
30if nargin < 3
31    error('Number of input parameters is at least than 3!')
32end
33
34% Default sextupole families to used
35%familyList = [1 4 9]; % low alpha MAHER : ancien choix
36%familyList = [10 9 8]; % low alpha AMOR : ancien choix
37familyList = [4 9 8]; % low alpha AMOR + MAHER (nouveau choix janvier 2011)
38
39% Load linear response matrices
40% These are the sensibility matrices expressed in amperes
41% DchroVal
42%
43
44dirName = getfamilydata('Directory','OpsData');
45%load([dirName '..' filesep 'lowalpha_dec08' filesep 'Rmatrix_alphaby20_nouveau_modele_dec08_opt_nonlin']);
46%load([dirName '..' filesep 'lowalpha_dec08' filesep 'Rmatrix_alphaby10_nouveau_modele_janv10_opt_nonlin']);
47FileName = 'Rmatrix_alpha.mat';
48DirectoryName = getfamilydata('Directory', 'OpsData');
49load(fullfile(DirectoryName, FileName));
50
51SextuFamNumber = length(familyList);
52if nargin == 3
53    %DI= ones(SextuFamNumber,1)*NaN;
54    DI = pinv([DchroVal(:,familyList); SextuRmcf2(familyList)])*[dxix; dxiz; dalpha2];
55else
56    error('Wrong number of parameters')
57end
58
59%Display variation and ask confirmation
60fprintf('\n\n Sextupole current values to be applied\n');
61for iSextu = 1:SextuFamNumber,
62    fprintf(sprintf('Sextupole step for S%d is %f A\n', familyList(iSextu), DI(iSextu)));
63end
64
65if InteractiveFlag
66    % Ask user for applying correction
67    reply = input('Apply values (Y/n) \n', 's');
68    if isempty(reply)
69        reply = 'Y';
70    end
71
72    switch reply
73        case {'y', 'Y'}
74            for iSextu = 1:SextuFamNumber,
75                sprintf('S%d',iSextu);
76                if familyList(iSextu) == 1, % step also S11
77                    stepsp('S11', DI(iSextu));
78                end
79                stepsp(sprintf('S%d',familyList(iSextu)), DI(iSextu));
80            end
81            fprintf('Correction applied\n');
82        otherwise
83            fprintf('Aborting ...\n');
84    end
85else
86    for iSextu = 1:SextuFamNumber,
87        sprintf('S%d',iSextu);
88        if familyList(iSextu) == 1, % step also S11
89            stepsp('S11', DI(iSextu));
90        end
91        stepsp(sprintf('S%d',familyList(iSextu)), DI(iSextu));
92    end
93    fprintf('Correction applied\n');
94end
95
Note: See TracBrowser for help on using the repository browser.