Home > mml > plotbpmrespsym.m

plotbpmrespsym

PURPOSE ^

PLOTBPMRESPSYM - Looks for symmetry of the orbit response matrix

SYNOPSIS ^

function plotbpmrespsym(R)

DESCRIPTION ^

PLOTBPMRESPSYM - Looks for symmetry of the orbit response matrix
  plotbpmrespsym(R)
  plotbpmrespsym(FileName)

  NOTES
  1. This function is only informative if the lattice is
     symmetric by sector.
  2. This function only works if the corrector and BPM 
     placement is symmetric in each sector.

  Written by Greg Portmann

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotbpmrespsym(R)
0002 %PLOTBPMRESPSYM - Looks for symmetry of the orbit response matrix
0003 %  plotbpmrespsym(R)
0004 %  plotbpmrespsym(FileName)
0005 %
0006 %  NOTES
0007 %  1. This function is only informative if the lattice is
0008 %     symmetric by sector.
0009 %  2. This function only works if the corrector and BPM
0010 %     placement is symmetric in each sector.
0011 %
0012 %  Written by Greg Portmann
0013 
0014 
0015 if nargin == 0
0016     R = getbpmresp('Struct');
0017 end
0018 if isempty(R)
0019     R = getbpmresp('','Struct');
0020 end
0021 if isempty(R)
0022     return;
0023 end
0024 
0025 
0026 % Use physics units for scaling
0027 R = hw2physics(R);
0028 
0029 
0030 FontSize = 10;
0031 Buffer = .01;
0032 HeightBuffer = .08;
0033 
0034 
0035 Sx = R(1,1).Data;
0036 Sy = R(2,2).Data;
0037 
0038 NSectors = R(1,1).Monitor.DeviceList(end,1);
0039 NBPMxperSector = max(R(1,1).Monitor.DeviceList(:,2));
0040 NBPMyperSector = max(R(2,2).Monitor.DeviceList(:,2));
0041 
0042 NBPMx = size(Sx,1);
0043 NBPMy = size(Sy,1);
0044 
0045 NHCMperSector = max(R(1,1).Actuator.DeviceList(:,2));
0046 NVCMperSector = max(R(2,2).Actuator.DeviceList(:,2));
0047 
0048 %NHCMperSector = size(Sx,2) / NSectors;
0049 %NVCMperSector = size(Sy,2) / NSectors;
0050 
0051 Circumference = getfamilydata('Circumference');
0052 
0053 BPMxs = getspos(R(1,1).Monitor.FamilyName, R(1,1).Monitor.DeviceList);
0054 BPMxs = BPMxs(:);
0055 BPMys = getspos(R(2,2).Monitor.FamilyName, R(2,2).Monitor.DeviceList);
0056 BPMys = BPMys(:);
0057 
0058 BPMxDev = R(1,1).Monitor.DeviceList;
0059 BPMyDev = R(2,2).Monitor.DeviceList;
0060 % BPMxelem = dev2elem(R(1,1).Monitor.FamilyName, R(1,1).Monitor.DeviceList);
0061 % BPMyelem = dev2elem(R(2,2).Monitor.FamilyName, R(2,2).Monitor.DeviceList);
0062 
0063 % BPMxGain = getgain(R(1,1).Monitor.FamilyName, R(1,1).Monitor.DeviceList);
0064 % BPMyGain = getgain(R(2,2).Monitor.FamilyName, R(2,2).Monitor.DeviceList);
0065 
0066 HCMDev = R(1,1).Actuator.DeviceList;
0067 VCMDev = R(2,2).Actuator.DeviceList;
0068 % HCMelem = dev2elem('HCM', R(1,1).Actuator.DeviceList);
0069 % VCMelem = dev2elem('VCM', R(2,2).Actuator.DeviceList);
0070 
0071 % % Hardware units to mradian
0072 % %HCMGain = getgain('HCM', R(1,1).Actuator.DeviceList);
0073 % HCMGain = 1 ./ (hw2physics('HCM', 'Setpoint', R(1,1).ActuatorDelta, HCMDev) ./ R(1,1).ActuatorDelta) / 1000;
0074 %
0075 % %VCMGain = getgain('VCM', R(2,2).Actuator.DeviceList);
0076 % VCMGain = 1 ./ (hw2physics('VCM', 'Setpoint', R(2,2).ActuatorDelta, VCMDev) ./ R(2,2).ActuatorDelta) / 1000;
0077 
0078 XUnitsString = R(1,1).UnitsString;
0079 XUnitsString(findstr(XUnitsString,'(')) = [];
0080 XUnitsString(findstr(XUnitsString,')')) = [];
0081 YUnitsString = R(2,2).UnitsString;
0082 YUnitsString(findstr(YUnitsString,'(')) = [];
0083 YUnitsString(findstr(YUnitsString,')')) = [];
0084 
0085 
0086 L = getfamilydata('Circumference');
0087 
0088 
0089 
0090 %%%%%%%%%%%%%%
0091 % Horizontal %
0092 %%%%%%%%%%%%%%
0093 
0094 % % Scale response matrix by the BPM gains
0095 % for i = 1:size(Sx,2)
0096 %    Sx(:,i) = Sx(:,i) .* BPMxGain(:);
0097 % end
0098 %
0099 % % Scale response matrix by the HCM gains
0100 % for i = 1:size(Sx,1)
0101 %    Sx(i,:) = Sx(i,:) .* HCMGain(:)';
0102 %    %Sx(i,:) = Sx(i,:) ./ hw2physics('HCM', 'Setpoint', 1, HCMDev)'/1000;
0103 %    %Sx(i,:) = Sx(i,:) / (1000*amps2rad('HCM',1,i));
0104 % end
0105 
0106 
0107 figure;
0108 clf reset
0109 set(gcf,'units','normal','position',[.0+Buffer .27+Buffer .5-2*Buffer .72-2*Buffer-HeightBuffer]);
0110 for Mag = 1:NHCMperSector    
0111     S = [];
0112     P = [];
0113     for i = 1:NSectors
0114         j = findrowindex([i Mag], HCMDev);
0115         if ~isempty(j)
0116             k = min(find(BPMxDev(:,1)==i));
0117             S = [S [Sx(k:end, j); Sx(1:k-1, j)]]; 
0118             P = [P [BPMxs(k:end); BPMxs(1:k-1)+L]-BPMxs(k)+BPMxs(1)]; 
0119         end
0120     end
0121     
0122     subplot(NHCMperSector, 1, Mag);
0123     if isempty(S)
0124         plot(BPMxs, NaN*ones(size(BPMxs)));        
0125     else
0126         plot(P, S);
0127     end
0128     ylabel(sprintf('Mag #%d', Mag), 'FontSize', FontSize);
0129 end
0130 
0131 subplot(NHCMperSector,1,1);
0132 title(sprintf('Horizontal Corrector Magnet Response (%s)', XUnitsString), 'FontSize', FontSize);
0133 
0134 subplot(NHCMperSector,1,NHCMperSector);
0135 xlabel('BPM Position [meters]', 'FontSize', FontSize);
0136 if isfield(R(1,1), 'TimeStamp')
0137     addlabel(1,0,sprintf('%s', datestr(R(1,1).TimeStamp)));
0138 end
0139 orient tall
0140 
0141 
0142 %%%%%%%%%%%%
0143 % Vertical %
0144 %%%%%%%%%%%%
0145 
0146 % % Scale response matrix by the BPM gains
0147 % for i = 1:size(Sy,2)
0148 %    Sy(:,i) = Sy(:,i) .* BPMyGain(:);
0149 % end
0150 %
0151 % % Scale response matrix by the VCM gains
0152 % for i = 1:size(Sy,1)
0153 %    Sy(i,:) = Sy(i,:) .* VCMGain(:)';
0154 %    %Sy(i,:) = Sy(i,:) / (1000*amps2rad('VCM',1,i));
0155 % end
0156 
0157 figure(gcf+1);
0158 clf reset
0159 set(gcf,'units','normal','position',[.5+Buffer .27+Buffer .5-2*Buffer .72-2*Buffer-HeightBuffer]);
0160 
0161 for Mag = 1:NVCMperSector     
0162     S = [];
0163     P = [];
0164     for i = 1:NSectors
0165         j = findrowindex([i Mag], VCMDev);
0166         if ~isempty(j)
0167             k = min(find(BPMyDev(:,1)==i));
0168             S = [S [Sy(k:end, j); Sy(1:k-1, j)]]; 
0169             P = [P [BPMys(k:end); BPMys(1:k-1)+L]-BPMys(k)+BPMys(1)]; 
0170         end
0171     end
0172   
0173     subplot(NVCMperSector, 1, Mag);
0174     if isempty(S)
0175         plot(BPMys, NaN*ones(size(BPMys)));        
0176     else
0177         plot(P, S);
0178     end
0179     ylabel(sprintf('Mag #%d', Mag), 'FontSize', FontSize);
0180 end
0181 
0182 subplot(NVCMperSector,1,1);
0183 title(sprintf('Vertical Corrector Magnet Response (%s)', XUnitsString), 'FontSize', FontSize);
0184 
0185 subplot(NVCMperSector,1,NVCMperSector);
0186 xlabel('BPM Position [meters]', 'FontSize', FontSize);
0187 if isfield(R(1,1), 'TimeStamp')
0188     addlabel(1,0,sprintf('%s', datestr(R(1,1).TimeStamp)));
0189 end
0190 orient tall
0191 
0192

Generated on Mon 21-May-2007 15:29:18 by m2html © 2003