Home > machine > Soleil > StorageRing > stepalpha2.m

stepalpha2

PURPOSE ^

FUNCTION STEPALPHA2 - step chromaticities and alpha2 using sextupole families

SYNOPSIS ^

function stepalpha2(dxix, dxiz, dalpha2)

DESCRIPTION ^

 FUNCTION STEPALPHA2 - step chromaticities and alpha2 using sextupole families

  INPUTS
  1. dxix - horizontal tune variation
  2. dxiz - vertical tune variation
  3. dalpha2 - second order momentum compaction variation

  Notes
  1. Matrix generation
  [DSx DSz DchroVal]   = modelchrosensitivity;
  [SextuRmcf1 SextuRmcf2]=modelmcfsensitivity('Sextu');

  See Also stepalpha1, physics_mcf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function stepalpha2(dxix, dxiz, dalpha2)
0002 % FUNCTION STEPALPHA2 - step chromaticities and alpha2 using sextupole families
0003 %
0004 %  INPUTS
0005 %  1. dxix - horizontal tune variation
0006 %  2. dxiz - vertical tune variation
0007 %  3. dalpha2 - second order momentum compaction variation
0008 %
0009 %  Notes
0010 %  1. Matrix generation
0011 %  [DSx DSz DchroVal]   = modelchrosensitivity;
0012 %  [SextuRmcf1 SextuRmcf2]=modelmcfsensitivity('Sextu');
0013 %
0014 %  See Also stepalpha1, physics_mcf
0015 
0016 
0017    
0018 
0019 %
0020 %% Written by Laurent S. Nadolski
0021 
0022 InteractiveFlag = 1;
0023 
0024 if nargin < 3
0025     error('Number of input parameters is at least than 3!')
0026 end
0027 
0028 % Default families to used
0029 familyList = [1 4 9];
0030 
0031 % Load linear response matrices
0032 % These are the sensibility matrices expressed in amperes
0033 % DchroVal
0034 %
0035 
0036 dirName = getfamilydata('Directory','OpsData');
0037 %load([dirName '..' filesep 'lowalpha_dec08' filesep 'Rmatrix_alphaby20_nouveau_modele_dec08_opt_nonlin']);
0038 load([dirName '..' filesep 'lowalpha_dec08' filesep 'Rmatrix_alphaby40_nouveau_modele_janv10_opt_nonlin']);
0039 
0040 SextuFamNumber = length(familyList);
0041 if nargin == 3
0042     DI= ones(SextuFamNumber,1)*NaN;
0043     DI = pinv([DchroVal(:,familyList); SextuRmcf2(familyList)])*[dxix dxiz dalpha2]';
0044 else
0045     error('Wrong number of parameters')
0046 end
0047 
0048 %Display variation and ask confirmation
0049 fprintf('\n\n Sextupole current values to be applied\n');
0050 for iSextu = 1:SextuFamNumber,
0051     fprintf(sprintf('Sextupole step for S%d is %f A\n', familyList(iSextu), DI(iSextu)));
0052 end
0053 
0054 if InteractiveFlag
0055 
0056     % Ask user for applying correction
0057     reply = input('Apply values (Y/n) \n', 's');
0058     if isempty(reply)
0059         reply = 'Y';
0060     end
0061 
0062     switch reply
0063         case {'y', 'Y'}
0064             for iSextu = 1:SextuFamNumber,
0065                 sprintf('S%d',iSextu);
0066                 stepsp(sprintf('S%d',familyList(iSextu)), DI(iSextu));
0067             end
0068             fprintf('Correction applied\n');
0069         otherwise
0070             fprintf('Aborting ...\n');
0071     end
0072 else
0073     for iSextu = 1:SextuFamNumber,
0074         sprintf('Q%d',iSextu);
0075         stepsp(sprintf('Q%d',familyList(iSextu)), DI(iSextu));
0076     end
0077     fprintf('Correction applied\n');
0078 end
0079

Generated on Fri 23-Jul-2010 00:42:07 by m2html © 2005