1 | function 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 | |
---|
21 | if 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]; |
---|
29 | elseif 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)); |
---|
31 | elseif nargin == 1 |
---|
32 | FileName = Sector; |
---|
33 | else |
---|
34 | error('plotidfftable input error'); |
---|
35 | end |
---|
36 | |
---|
37 | try |
---|
38 | load(FileName); |
---|
39 | catch |
---|
40 | FigureHandles = []; |
---|
41 | disp(' File not found.'); |
---|
42 | return |
---|
43 | end |
---|
44 | |
---|
45 | |
---|
46 | BPMxs = getspos(IDFF.BPMxFamily, IDFF.BPMxList); |
---|
47 | BPMys = getspos(IDFF.BPMyFamily, IDFF.BPMyList); |
---|
48 | |
---|
49 | |
---|
50 | % Plot tables |
---|
51 | Buffer = .01; |
---|
52 | HeightBuffer = .05; |
---|
53 | |
---|
54 | h1=figure; |
---|
55 | clf reset |
---|
56 | subplot(2,1,1); |
---|
57 | plot(IDFF.Xtable(:,1),IDFF.Xtable(:,2),'-', IDFF.Xtable(:,1),IDFF.Xtable(:,3),'--'); |
---|
58 | %xlabel('Gap Position [mm]'); |
---|
59 | ylabel('Corrector Strength [amps]'); |
---|
60 | title(['Insertion Device Feedfoward Table for Sector ', num2str(IDFF.Sector)]); |
---|
61 | legend(['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); |
---|
67 | axis tight; |
---|
68 | |
---|
69 | subplot(2,1,2); |
---|
70 | plot(IDFF.Ytable(:,1),IDFF.Ytable(:,2),'-', IDFF.Ytable(:,1),IDFF.Ytable(:,3),'--'); |
---|
71 | xlabel('Gap Position [mm]'); |
---|
72 | ylabel('Corrector Strength [amps]'); |
---|
73 | axis tight; |
---|
74 | legend(['VCM4, Sector ',num2str(IDFF.Sector-1),' '], ... |
---|
75 | ['VCM1, Sector ',num2str(IDFF.Sector), ' '],0); |
---|
76 | set(h1,'units','normal','position',[.0+Buffer .5+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]); |
---|
77 | addlabel(1,0,[num2str(IDFF.GeV),' GeV, ', datestr(IDFF.TimeStamp)]); |
---|
78 | orient tall |
---|
79 | |
---|
80 | |
---|
81 | h2 = figure; |
---|
82 | clf reset |
---|
83 | %set(h2,'units','normal','position',[.5+Buffer .1+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]); |
---|
84 | set(h2,'units','normal','position',[.5+Buffer .5+Buffer .5-2*Buffer .5-2*Buffer-HeightBuffer]); |
---|
85 | subplot(2,1,1); |
---|
86 | plot(IDFF.Xtable(:,1),1000*IDFF.Xrms,'-', IDFF.Xtable(:,1),1000*IDFF.Yrms,'--'); |
---|
87 | title(['RMS Orbit Change During Table Generation for Sector ', num2str(IDFF.Sector)]); |
---|
88 | xlabel('GAP Position [mm]'); |
---|
89 | ylabel('BPM Error [microns]'); |
---|
90 | legend(['Horizontal'],['Vertical'],0); |
---|
91 | axis tight; |
---|
92 | |
---|
93 | subplot(2,1,2); |
---|
94 | plot(BPMxs, 1000*(IDFF.Xmax.Data - IDFF.XmaxEnd.Data),'-', BPMys, 1000*(IDFF.Ymax.Data - IDFF.YmaxEnd.Data),'--'); |
---|
95 | title(['Drift in the Orbit During Table Generation']); |
---|
96 | xlabel('BPM Position [meters]'); |
---|
97 | ylabel('BPM Drift [microns]'); |
---|
98 | axis tight; |
---|
99 | xaxis([0 getfamilydata('Circumference')]); |
---|
100 | legend(['Horizontal'],['Vertical'],0); |
---|
101 | |
---|
102 | addlabel(1,0,[num2str(IDFF.GeV),' GeV, ', datestr(IDFF.TimeStamp)]); |
---|
103 | orient tall |
---|
104 | |
---|
105 | |
---|
106 | % Rate of change |
---|
107 | ExtraPlots = 1; |
---|
108 | if 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]; |
---|
134 | else |
---|
135 | FigureHandles = [h1;h2]; |
---|
136 | end |
---|
137 | |
---|
138 | |
---|
139 | if 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 |
---|
162 | end |
---|
163 | |
---|
164 | |
---|