Home > pubtools > LatticeTuningFunctions > errors > setGirderError.m

setGirderError

PURPOSE ^

rerr=setGirderError(r,pert,errval,mag_group)

SYNOPSIS ^

function rerr=setGirderError(r,pert,errval,mag_group)

DESCRIPTION ^

        rerr=setGirderError(r,pert,errval,mag_group)
 
  sets specified girder errors (absolute values)
  mag_group is the output of getMagGroupsFromGirderIndex(ring);


see also:

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rerr=setGirderError(r,pert,errval,mag_group)
0002 %        rerr=setGirderError(r,pert,errval,mag_group)
0003 %
0004 %  sets specified girder errors (absolute values)
0005 %  mag_group is the output of getMagGroupsFromGirderIndex(ring);
0006 %
0007 %
0008 %see also:
0009 if nargin<4
0010     mag_group=getMagGroupsFromGirderIndex(r);
0011 end
0012 magindex=[mag_group{:}];
0013 
0014 % get existing errors
0015 [X0,Y0,~,T0,R0,P0]=GetExistingErrors(r,magindex);
0016 
0017 % initialize T1 T2 R1 R2 errors to zero
0018 r=setANYshift(r,magindex,1:6,zeros(size(magindex)));
0019 r=setTiltAbout(r,magindex,'s',zeros(size(magindex)));
0020 % initialize rotation storage field
0021 r=atsetfieldvalues(r,magindex,'RotAboutX',{1,1},0);
0022 r=atsetfieldvalues(r,magindex,'RotAboutY',{1,1},0);
0023 r=atsetfieldvalues(r,magindex,'Tilt',{1,1},0);
0024 
0025 switch pert
0026     case 'gx'
0027         errfun=@(r,po,er)setANYshift(r,po,1,er);
0028         err0=X0;
0029     case 'gy'
0030         errfun=@(r,po,er)setANYshift(r,po,3,er);
0031         err0=Y0;
0032     case 'gphi'
0033         errfun=@(r,po,er)setTiltGirderAbout(r,mag_group,'x',er);
0034         err0=R0;
0035     case 'gtheta'
0036         errfun=@(r,po,er)setTiltGirderAbout(r,mag_group,'y',er);
0037         err0=P0;
0038     case 'gpsi'
0039         errfun=@(r,po,er)setTiltGirderAbout(r,mag_group,'s',er);
0040         err0=T0;
0041 end
0042 
0043 err_group=cellfun(@(indg,ev)ev*ones(size(indg)),mag_group,num2cell(errval)','un',0);
0044    
0045 errval=[err_group{:}];
0046 
0047 % move girder
0048 rerr=errfun(r,magindex,err0+errval);
0049 
0050 return

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005