source: MML/trunk/mml/plotidfftable.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 5.8 KB
Line 
1function FigureHandles = plotidfftable(Sector, GeV)
2%PLOTIDFFTABLE - Plots various information about the feed forward tables
3%  FigureHandles = plotidfftable(Sector, GeV)
4%  FigureHandles = plotidfftable(Directory)
5%  FigureHandles = plotidfftable
6%
7%  Sector    - the storage ring sector number for that insertion device
8%  GeV       - the storage ring energy (1.0, 1.3, 1.5, 1.9)
9%  Directory - the directory location where the files are located.
10%
11%  For example, plotidfftable(7,1.5) analyzes the most recently generated table for IDFF.Sector 7
12%  at 1.5 IDFF.GeV.
13%   
14%  If no input auguments are used, a dialog box will allow one
15%  to choose any feed forward table.  Table are grouped in directories
16%  according and energy and the date the file was generated.
17%
18%  Written by Greg Portmann
19
20
21if nargin == 0
22    % Load the data tables
23    [FileName, DirectoryName] = uigetfile('id*.mat', 'Choose the desired feed forward file.', [getfamilydata('Directory','DataRoot'), 'ID', filesep, 'FeedForward', filesep]);
24    if FileName == 0
25        FigureHandles = [];
26        return
27    end
28    FileName = [DirectoryName, FileName];
29elseif nargin == 2
30    FileName = sprintf('%sid%02de%c%c.mat', [getfamilydata('Directory','DataRoot'), 'ID', filesep, 'FeedForward', filesep], IDFF.Sector, floor(IDFF.GeV(1)), rem(IDFF.GeV(1),1));
31elseif nargin == 1
32    FileName = Sector;
33else
34    error('plotidfftable input error');
35end
36
37try
38    load(FileName);
39catch
40    FigureHandles = [];
41    disp('  File not found.');
42    return
43end
44
45
46BPMxs = getspos(IDFF.BPMxFamily, IDFF.BPMxList);
47BPMys = getspos(IDFF.BPMyFamily, IDFF.BPMyList);
48
49
50% Plot tables
51Buffer = .01;
52HeightBuffer = .05;
53
54h1=figure;
55clf reset
56subplot(2,1,1);
57plot(IDFF.Xtable(:,1),IDFF.Xtable(:,2),'-', IDFF.Xtable(:,1),IDFF.Xtable(:,3),'--');
58%xlabel('Gap Position [mm]');
59ylabel('Corrector Strength [amps]');
60title(['Insertion Device Feedfoward Table for Sector ', num2str(IDFF.Sector)]);     
61legend(['HCM4, Sector ',num2str(IDFF.Sector-1),'  '], ...
62       ['HCM1, Sector ',num2str(IDFF.Sector),  '  '],0);
63%[hl,hl1] = legend(['HCM4, IDFF.Sector ',num2str(IDFF.Sector-1),'  '], ...
64%                  ['HCM1, IDFF.Sector ',num2str(IDFF.Sector),  '  ']);
65%set(hl1(1,2),'FontUnits','points','FontSize',10);
66%set(hl1(2,2),'FontUnits','points','FontSize',10);
67axis tight;
68
69subplot(2,1,2);
70plot(IDFF.Ytable(:,1),IDFF.Ytable(:,2),'-', IDFF.Ytable(:,1),IDFF.Ytable(:,3),'--');
71xlabel('Gap Position [mm]');
72ylabel('Corrector Strength [amps]');
73axis tight;
74legend(['VCM4, Sector ',num2str(IDFF.Sector-1),'  '], ...
75       ['VCM1, Sector ',num2str(IDFF.Sector),  '  '],0);
76set(h1,'units','normal','position',[.0+Buffer .5+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]);
77addlabel(1,0,[num2str(IDFF.GeV),' GeV, ', datestr(IDFF.TimeStamp)]);
78orient tall
79
80
81h2 = figure;
82clf reset
83%set(h2,'units','normal','position',[.5+Buffer .1+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]);
84set(h2,'units','normal','position',[.5+Buffer .5+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]);
85subplot(2,1,1);
86plot(IDFF.Xtable(:,1),1000*IDFF.Xrms,'-', IDFF.Xtable(:,1),1000*IDFF.Yrms,'--');
87title(['RMS Orbit Change During Table Generation for Sector ', num2str(IDFF.Sector)]);
88xlabel('GAP Position [mm]');
89ylabel('BPM Error [microns]');
90legend(['Horizontal'],['Vertical'],0);
91axis tight;
92
93subplot(2,1,2);
94plot(BPMxs, 1000*(IDFF.Xmax.Data - IDFF.XmaxEnd.Data),'-', BPMys, 1000*(IDFF.Ymax.Data - IDFF.YmaxEnd.Data),'--');
95title(['Drift in the Orbit During Table Generation']);
96xlabel('BPM Position [meters]');
97ylabel('BPM Drift [microns]');
98axis tight;
99xaxis([0 getfamilydata('Circumference')]);
100legend(['Horizontal'],['Vertical'],0);
101
102addlabel(1,0,[num2str(IDFF.GeV),' GeV, ', datestr(IDFF.TimeStamp)]);
103orient tall
104
105
106% Rate of change
107ExtraPlots = 1;
108if ExtraPlots == 1
109   % Rate of change
110   h3 = figure;
111   clf reset
112   set(h3,'units','normal','position',[.0+Buffer .1+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]);
113 
114   N = size(IDFF.Xtable,1);
115   subplot(2,1,1);
116   plot(IDFF.Xtable(2:N,1),diff(IDFF.Xtable(:,2))./diff(IDFF.Xtable(:,1)),'-', IDFF.Xtable(2:N,1),diff(IDFF.Xtable(:,3))./diff(IDFF.Xtable(:,1)),'--');
117   %xlabel('Gap Position [mm]');
118   ylabel('Horizontal [amps/mm]');
119   title(['Corrector Magnet Rates for Sector ', num2str(IDFF.Sector)]);
120   axis tight;
121   legend(['HCM4, Sector ',num2str(IDFF.Sector-1),'  '], ['HCM1, Sector ',num2str(IDFF.Sector),'  '],0);
122     
123   subplot(2,1,2);
124   plot(IDFF.Ytable(2:N,1),diff(IDFF.Ytable(:,2))./diff(IDFF.Ytable(:,1)),'-', IDFF.Ytable(2:N,1),diff(IDFF.Ytable(:,3))./diff(IDFF.Ytable(:,1)),'--');
125   xlabel('Gap Position [mm]');
126   ylabel('Vertical [amps/mm]');
127   axis tight;
128   legend(['VCM4, Sector ',num2str(IDFF.Sector-1),'  '], ['VCM1, Sector ',num2str(IDFF.Sector),'  '],0);
129
130   addlabel(1,0,[num2str(IDFF.GeV),' GeV, ', datestr(IDFF.TimeStamp)]);
131   orient tall
132     
133   FigureHandles = [h1;h2;h3];
134else
135   FigureHandles = [h1;h2];       
136end
137
138
139if 0
140   figure
141   clf reset
142   set(h1,'units','normal','position',[.0+Buffer .5+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]);
143
144   subplot(2,1,1);
145   plot(IDFF.Xtable(:,1),IDFF.Xtable(:,2)*407,'-', IDFF.Xtable(:,1),IDFF.Xtable(:,3)*407,'--');
146   %xlabel('Gap Position [mm]');
147   ylabel('Corrector Strength [Gauss CM]');
148   title(['Insertion Device Feedfoward Table for Sector ', num2str(IDFF.Sector)]);     
149   axis tight;
150   legend(['HCM4, IDFF.Sector ',num2str(IDFF.Sector-1),'  '], ...
151          ['HCM1, IDFF.Sector ',num2str(IDFF.Sector),  '  '],0);
152   
153   subplot(2,1,2);
154   plot(IDFF.Ytable(:,1),IDFF.Ytable(:,2)*171,'-', IDFF.Ytable(:,1),IDFF.Ytable(:,3)*171,'--');
155   xlabel('Gap Position [mm]');
156   ylabel('Corrector Strength [Gauss CM]');
157   legend(['VCM4, Sector ',num2str(IDFF.Sector-1),'  '], ...
158          ['VCM1, Sector ',num2str(IDFF.Sector),  '  '],0);
159   axis tight;
160   addlabel(1,0,[num2str(IDFF.GeV),' GeV, ', datestr(IDFF.TimeStamp)]);
161   orient tall
162end
163
164
Note: See TracBrowser for help on using the repository browser.