source: MML/trunk/machine/SOLEIL/StorageRing/setoperationalmode.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 87.6 KB
Line 
1function setoperationalmode(ModeNumber)
2%SETOPERATIONALMODE - Switches between the various operational modes
3%  setoperationalmode(ModeNumber)
4%
5%  INPUTS
6%  1. ModeNumber = number
7%        1 '2.7391 GeV, 18.2020 10.3170', ...
8%        2 '2.7391 GeV, 18.20 10.30', ...
9%        3 '2.7391 GeV, Chasmann-Green', ...
10%        4 '2.7391 GeV, Low Alpha nominal alpha1/15 December 2007', ...
11%        5 '2.7391 GeV, alpha1/20 alpha1by20_maher',...
12%        6 '2.7391 GeV, HU640', ...
13%        7 '2.7391 GeV, low alpha1/20  20.3 8.4 December 2008', ...
14%        8 '2.7391 GeV, 18.2020 10.3170 w/ new steerer position', ...
15%        9 '2.7391 GeV, 18.2020 10.3170 w/ new steerer position and new quad model', ...
16%        10 '2.7391 GeV, 18.2020 10.3170 w/ PX2 w/ new steerer position and new quad model', ...
17%        11 '2.7391 GeV, 18.217 10.312 w/ PX2 w/ new steerer position and new quad model, with Nanoscopium', ...
18%        12/ 2.7391 GeV, low alpha_nominal/10  20.3 8.4 December 2008/January 2010', ...
19%        13/ 2.7391 GeV, low alpha1_nominal/100  20.3 8.4 December 2008/January 2010', ...
20%        14/ 2.7391 GeV, 17.80 10.70 Nanoscopium w/ PX2 with new steerer position and new quad model', ...
21%        15/ 2.7391 GeV, 18.20 10.70 Nanoscopium w/ PX2 with new steerer position and new quad model', ...
22%        16/ 2.7391 GeV, 18.2020 10.3170 w/ betax=5 m new steerer position and new quad model', ...
23%        17/ 2.7391 GeV, 18.2000 10.6400  Nanoscopium', ...
24%        18/ 2.7391 GeV, 18.2000 10.3000 w/ betax=5 m Nanoscopium', ...
25%        19/ 2.7391 GeV, 18.2020 10.3170 w/ S11 new steerer position and new quad model', ...
26%        20/ 2.7391 GeV, 18.2020 10.3170 w/ S11 betax=5 m new steerer position and new quad model', ...
27%        21/ 2.7391 GeV, 18.1700 10.2500 S11 betax=5 m Nanoscopium', ...
28%        22/ 2.7391 GeV, low alpha_nominal/10 AMOR 20.77 9.20 December 2010', ...
29%        23/ 2.7391 GeV, low alpha_nominal/10 MAHER 20.30 8.40 OD optimise (lin_1_auto) December 2010', ...
30%        24/ 2.7391 GeV, betaz=1m et betax=15m dans les sections courtes Fevrier 2011', ...
31%        25/ 2.7391 GeV, lowalpha MAHER, alpha negatif, OD optimisee',...
32%        26/ 2.7391 GeV, lowalpha from nominal optics alpha/200 19.24 10.317 Juin 2011'...
33%        27/ 2.7391 GeV, betax=15m SDC + idem Nanoscopium Juin 2011', ...
34%        28/ 2.7391 GeV, 122 BPMs nominal RUN3 2011 18.2020 10.3170 w/ S11 betax=5m en SDL',...
35%        29/ 2.7391 GeV, 122 BPMs nanoscopium',...
36%        30/ 2.7391 GeV, 122 BPMs nominal RUN4 2011 pseudo-nano betax = 15m SDC + idem Nanoscopium Juin 2011', ...
37%        31/ 2.7391 GeV, 122 BPMs betaz = 1m et betax = 15m dans les sections courtes Fevrier 2011', ...
38%        32/ 2.7391 GeV, 122 BPMs low alpha_nominal/10  20.3 8.4 December 2008/January 2010', ...
39%        33/ 2.7391 GeV, 122 BPMs low alpha_nominal/100  20.3 8.4 December 2008/January 2010', ...
40%        34/ 2.7391 GeV, 122 BPMs low alpha_nominal/10 MAHER 20.30 8.40 OD optimise (lin_1_auto) December 2010', ...
41%        35/ 2.7391 GeV, 122 BPMs lowalpha MAHER, alpha negatif, OD optimise',...
42%        36/ 2.7391 GeV, 122 BPMs  alpha_nominal/25  20.3 8.4 Octobre 2011',...
43%        37/ 2.7391 GeV, 122 BPMs 18.2020 10.3170  User mode - S11 betax=10m till November 2010 ',...
44%        38/ 2.7391 GeV, 122 BPMs nanoscopium run machine .170 .250 ',...
45%        39/ 2.7391 GeV, 122 BPMs low alpha_nominal/25  20.3 8.4 BETAZ = 2.6m CRISTAL' ,...       
46%        40/ 2.7391 GeV, 122 BPMs + 4 XBPM with nanoscopium from March 2012', ...       
47%        41/ 2.7391 GeV, 122 BPMs nanoscopium from January/May 2012 Thick sextupoles',...
48%        100 'Laurent''s Mode'...
49%
50%  See also aoinit, updateatindex, soleilinit, setmmldirectories, lattice_prep
51
52%  NOTES
53% use local_set_config_mode for defining status of S11 et S12;
54
55
56%
57% Written by Laurent S. Nadolski
58% FOR CVS
59% $Header$
60global THERING
61
62% Check if the AO exists
63checkforao;
64
65%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66% Accelerator Dependent Modes %
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68if nargin < 1
69    ModeNumber = [];
70end
71if isempty(ModeNumber)
72    ModeCell = {...
73        ' 1/ 2.7391 GeV, 18.2020 10.3170', ...
74        ' 2/ 2.7391 GeV, 18.20 10.30', ...
75        ' 3/ 2.7391 GeV, Chasmann-Green', ...
76        ' 4/ 2.7391 GeV, Low Alpha nominal alpha1/15 December 2007', ...
77        ' 5/ 2.7391 GeV, alpha1/20 alpha1by20_maher',...
78        ' 6/ 2.7391 GeV, HU640', ...
79        ' 7/ 2.7391 GeV, low alpha_nominal/20  20.3 8.4 December 2008/January 2010', ...
80        ' 8/ 2.7391 GeV, 18.2020 10.3170 with new steerer position', ...
81        ' 9/ 2.7391 GeV, 18.2020 10.3170 with new steerer position and new quad model', ...
82        '10/ 2.7391 GeV, 18.2020 10.3170 w/ PX2 with new steerer position and new quad model', ...
83        '11/ 2.7391 GeV, 18.217 10.312 Nanoscopium w/ PX2 with new steerer position and new quad model', ...
84        '12/ 2.7391 GeV, low alpha_nominal/10  20.3 8.4 December 2008/January 2010', ...
85        '13/ 2.7391 GeV, low alpha1_nominal/100  20.3 8.4 December 2008/January 2010', ...
86        '14/ 2.7391 GeV, 17.80 10.70 Nanoscopium w/ PX2 with new steerer position and new quad model', ...
87        '15/ 2.7391 GeV, 18.20 10.70 Nanoscopium w/ PX2 with new steerer position and new quad model', ...
88        '16/ 2.7391 GeV, 18.2020 10.3170 with betax=5m with new steerer position and new quad model', ...
89        '17/ 2.7391 GeV, 18.2000 10.6400  Nanoscopium', ...
90        '18/ 2.7391 GeV, 18.2000 10.3000 betax=5 m Nanoscopium', ...
91        '19/ 2.7391 GeV, 18.2020 10.3170 w/ S11 new steerer position and new quad model', ...
92        '20/ 2.7391 GeV, TO DO 18.2020 10.3170 w/ S11 betax=5 m new steerer position and new quad model', ...
93        '21/ 2.7391 GeV, 18.1700 10.2500 S11 betax=5 m Nanoscopium', ...
94        '22/ 2.7391 GeV, low alpha_nominal/10 AMOR 20.77 9.20 December 2010', ...
95        '23/ 2.7391 GeV, low alpha_nominal/10 MAHER 20.30 8.40 OD optimisï¿œe (lin_1_auto) December 2010', ...
96        '24/ 2.7391 GeV, betaz=1m et betax=15m dans les sections courtes Fevrier 2011', ...
97        '25/ 2.7391 GeV,lowalpha MAHER, alpha negatif, OD optimise',...
98        '26/ 2.7391 GeV,lowalpha from nominal optics alpha/200 19.24 10.317 Juin 2011',...
99        '27/ 2.7391 GeV, betax=15m SDC + idem Nanoscopium Juin 2011', ...
100        '28/ 2.7391 GeV, 122 BPMs nominal RUN3 2011 18.2020 10.3170 w/ S11 betax=5m en SDL',...
101        '29/ 2.7391 GeV, 122 BPMs nanoscopium from January 2012',...
102        '30/ 2.7391 GeV, 122 BPMs nominal RUN4 2011 pseudo-nano betax = 15m SDC + idem Nanoscopium Juin 2011', ...
103        '31/ 2.7391 GeV, 122 BPMs betaz = 1m et betax = 15m dans les sections courtes Fevrier 2011', ...
104        '32/ 2.7391 GeV, 122 BPMs low alpha_nominal/10  20.3 8.4 December 2008/January 2010', ...
105        '33/ 2.7391 GeV, 122 BPMs low alpha_nominal/100  20.3 8.4 December 2008/January 2010', ...
106        '34/ 2.7391 GeV, 122 BPMs low alpha_nominal/10 MAHER 20.30 8.40 OD optimise (lin_1_auto) December 2010', ...
107        '35/ 2.7391 GeV, 122 BPMs lowalpha MAHER, alpha negatif, OD optimise',...
108        '36/ 2.7391 GeV, 122 BPMs  alpha_nominal/25  20.3 8.4 Octobre 2011',...
109        '37/ 2.7391 GeV, 122 BPMs 18.2020 10.3170  User mode - S11 betax=10m till November 2010 ',...
110        '38/ 2.7391 GeV, 122 BPMs nanoscopium run machine .170 .250 ',...
111        '39/ 2.7391 GeV, 122 BPMs low alpha_nominal/25  20.3 8.4 BETAZ = 2.6m CRISTAL' ,...       
112        '40/ 2.7391 GeV, 122 BPMs + 4 XBPM with nanoscopium from March 2012', ...       
113        '41/ 2.7391 GeV, 122 BPMs nanoscopium from January/May 2012 Thick sextupoles',...
114        'Laurent''s Mode'...
115        };
116    [ModeNumber, OKFlag] = listdlg('Name','SOLEIL','PromptString','Select the Operational Mode:', ...
117        'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [450 200], 'InitialValue', 29);
118    if OKFlag ~= 1
119        fprintf('   Operational mode not changed\n');
120        return
121    elseif ModeNumber == length(ModeCell);
122        ModeNumber = 100;  % Laurent
123    end
124end
125
126
127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128% Accelerator Data Structure %
129%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
130AD = getad;
131AD.Machine = 'SOLEIL';            % Will already be defined if setpathmml was used
132AD.MachineType = 'StorageRing';   % Will already be defined if setpathmml was used
133AD.SubMachine  = 'StorageRing';   % Will already be defined if setpathmml was used
134AD.OperationalMode = '';          % Gets filled in later
135AD.HarmonicNumber = 416;
136
137% Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
138AD.DeltaRFDisp = 100e-6;
139AD.DeltaRFChro = [-100 -50 0 50 100] * 1e-6;
140
141% Tune processor delay: delay required to wait
142% to have a fresh tune measurement after changing
143% a variable like the RF frequency.  Setpv will wait
144% 2.2 * TuneDelay to be guaranteed a fresh data point.
145%AD.BPMDelay  = 0.25; % use [N, BPMDelay]=getbpmaverages (AD.BPMDelay will disappear)
146AD.TuneDelay = 1;
147
148% The offset and golden orbits are stored at the end of this file
149% TODO
150%BuildOffsetAndGoldenOrbits;  % Local function
151
152
153% SP-AM Error level
154% AD.ErrorWarningLevel = 0 -> SP-AM errors are Matlab errors {Default}
155%                       -1 -> SP-AM errors are Matlab warnings
156%                       -2 -> SP-AM errors prompt a dialog box
157%                       -3 -> SP-AM errors are ignored (ErrorFlag=-1 is returned)
158AD.ErrorWarningLevel = 0;
159
160%%%%%%%%%%%%%%%%%%%%%
161% Operational Modes %
162%%%%%%%%%%%%%%%%%%%%%
163
164% Mode setup variables (mostly path and file names)
165% AD.OperationalMode - String used in titles
166% ModeName - String used for mode directory name off DataRoot/MachineName
167% OpsFileExtension - string add to default file names
168
169 
170
171
172%% ModeNumber == 9 bx=10m nominal lattice 2010 until installation of S11 and S12
173if ModeNumber == 9
174    % User mode - nominal lattice 2010 until installation of S11 and S12
175    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
176    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
177    ModeName = 'lat_2020_3170b';
178    OpsFileExtension = '_lat_2020_3170b';
179
180    % AT lattice
181    AD.ATModel = 'lat_2020_3170b';
182    eval(AD.ATModel);  %run model for compiler;
183
184    % Golden TUNE is with the TUNE family
185    % 18.2020 / 10.3170
186    AO = getao;
187    AO.TUNE.Monitor.Golden = [
188        0.2020
189        0.3170
190        NaN];
191
192    % Golden chromaticity is in the AD (Physics units)
193    AD.Chromaticity.Golden = [2; 2];
194
195    % Status factory
196    local_set_config_mode('normalconfig120');
197    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
198    setao(AO);
199
200    %% ModeNumber == 19 User mode - S11 betax=10m till November 2010
201elseif ModeNumber == 19
202    % User mode - S11 betax=10m 2010
203    AD.OperationalMode = '2.7391 GeV, 18.202 10.317 S11';
204    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
205    ModeName = 'lat_2020_3170f';
206    OpsFileExtension = '_lat_2020_3170f';
207
208    % AT lattice
209    AD.ATModel = 'lat_2020_3170f';
210    eval(AD.ATModel);  %run model for compiler;
211
212    % Golden TUNE is with the TUNE family
213    % 18.2020 / 10.3170
214    AO = getao;
215    AO.TUNE.Monitor.Golden = [
216        0.2020
217        0.3170
218        NaN];
219
220    % Golden chromaticity is in the AD (Physics units)
221    AD.Chromaticity.Golden = [2; 2.6];
222
223    % Status factory
224    local_set_config_mode('S11config120');
225    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
226    setao(AO);
227   
228    %% ModeNumber == 16 User mode - betax = 5m
229elseif ModeNumber == 16
230    % User mode - betax = 5m
231    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
232    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
233    ModeName = 'lat_2020_3170e';
234    OpsFileExtension = '_lat_2020_3170e';
235
236    % AT lattice
237    AD.ATModel = 'lat_2020_3170e';
238    eval(AD.ATModel);  %run model for compiler;
239
240    % Golden TUNE is with the TUNE family
241    % 18.2020 / 10.3170
242    % 18.1990 / 10.3170 April 2011
243    AO = getao;
244    AO.TUNE.Monitor.Golden = [
245        0.1990
246        0.3100
247        0.00642];
248
249    % Golden chromaticity is in the AD (Physics units)
250    AD.Chromaticity.Golden = [2; 2];
251
252    local_set_config_mode('S11config120');
253    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
254    setao(AO);
255
256    %% ModeNumber == 10 User mode - with PX2 corrector   
257elseif ModeNumber == 10
258    % User mode - with PX2 corrector
259    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
260    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
261    ModeName = 'lat_2020_3170bPX2';
262    OpsFileExtension = '_lat_2020_3170bPX2';
263
264    % AT lattice
265    AD.ATModel = 'lat_2020_3170bPX2';
266    eval(AD.ATModel);  %run model for compiler;
267
268    % Golden TUNE is with the TUNE family
269    % 18.2020 / 10.3170
270    AO = getao;
271    AO.TUNE.Monitor.Golden = [
272        0.2020
273        0.3170
274        NaN];
275
276    % Golden chromaticity is in the AD (Physics units)
277    AD.Chromaticity.Golden = [2; 2];
278
279    local_set_config_mode('normalconfig120');
280    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
281    setao(AO);
282
283    %% ModeNumber == 11  User mode - Nanoscopium
284elseif ModeNumber == 11 % User mode - Nanoscopium
285    AD.OperationalMode = '2.7391 GeV, 18.2175 10.3120';
286    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
287    ModeName = 'nano_2175_3120a';
288    OpsFileExtension = '_nano_2175_3120a';
289
290    % AT lattice
291    AD.ATModel = 'nano_2175_3120'; % new lattice version from Alex
292    eval(AD.ATModel);  %run model for compiler;
293
294    % Golden TUNE is with the TUNE family
295    AO = getao;
296    AO.TUNE.Monitor.Golden = [
297        0.2175
298        0.3120
299        NaN];
300
301    % Golden chromaticity is in the AD (Physics units)
302    AD.Chromaticity.Golden = [2; 2];
303
304    local_set_config_mode('nanoscopiumconfig');
305    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
306    setao(AO);
307
308 
309    % triplet upstreams and downstreams of SDL13 for nanoscopium
310    % Need to point to another family for magnetcoefficients (other range of current)
311    % Q1 upstream
312    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q1');
313    AO.Q1.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
314    AO.Q1.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
315    AO.Q1.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
316    AO.Q1.Setpoint.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
317    % Q1 downstream
318    AO.Q1.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
319    AO.Q1.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
320    AO.Q1.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
321    AO.Q1.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
322    % Q2 upstream
323    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q2');
324    AO.Q2.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
325    AO.Q2.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
326    AO.Q2.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
327    AO.Q2.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
328    % Q2 downstream
329    AO.Q2.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
330    AO.Q2.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
331    AO.Q2.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
332    AO.Q2.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
333    % Q3 upstream
334    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q1');
335    AO.Q3.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
336    AO.Q3.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
337    AO.Q3.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
338    AO.Q3.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
339    % Q3 downstream
340    AO.Q3.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
341    AO.Q3.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
342    AO.Q3.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
343    AO.Q3.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
344   
345    setao(AO);
346
347    %% ModeNumber == 14 % User mode - Nanoscopium
348elseif ModeNumber == 14 % User mode - Nanoscopium
349    AD.OperationalMode = '2.7391 GeV, 18.2175 10.3120';
350    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
351    ModeName = 'nano_8000_7000a';
352    OpsFileExtension = '_nano_8000_7000a';
353
354    % AT lattice
355    AD.ATModel = 'nano_8000_7000'; % new lattice version from Alex
356    eval(AD.ATModel);  %run model for compiler;
357
358    % Golden TUNE is with the TUNE family
359    AO = getao;
360    AO.TUNE.Monitor.Golden = [
361        0.2175
362        0.3120
363        NaN];
364
365    % Golden chromaticity is in the AD (Physics units)
366    AD.Chromaticity.Golden = [2; 2];
367
368
369    local_set_config_mode('nanoscopiumconfig');
370    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
371    setao(AO);
372
373    % triplet upstreams and downstreams of SDL13 for nanoscopium
374    % Need to point to another family for magnetcoefficients (other range of current)
375    % Q1 upstream
376    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_80_70('Q1');
377    AO.Q1.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
378    AO.Q1.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
379    AO.Q1.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
380    AO.Q1.Setpoint.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
381    % Q1 downstream
382    AO.Q1.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
383    AO.Q1.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
384    AO.Q1.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
385    AO.Q1.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
386    % Q2 upstream
387    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_80_70('Q2');
388    AO.Q2.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
389    AO.Q2.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
390    AO.Q2.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
391    AO.Q2.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
392    % Q2 downstream
393    AO.Q2.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
394    AO.Q2.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
395    AO.Q2.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
396    AO.Q2.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
397    % Q3 upstream
398    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_80_70('Q1');
399    AO.Q3.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
400    AO.Q3.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
401    AO.Q3.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
402    AO.Q3.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
403    % Q3 downstream
404    AO.Q3.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
405    AO.Q3.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
406    AO.Q3.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
407    AO.Q3.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
408
409    % triplet nanoscopium
410    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_80_70('Q11');
411    AO.Q11.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
412    AO.Q11.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
413    AO.Q11.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
414    AO.Q11.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
415    AO.Q11.Monitor.HW2PhysicsParams{1}(2,:)  = HW2PhysicsParams;
416    AO.Q11.Setpoint.HW2PhysicsParams{1}(2,:) = HW2PhysicsParams;
417    AO.Q11.Monitor.Physics2HWParams{1}(2,:)  = HW2PhysicsParams;
418    AO.Q11.Setpoint.Physics2HWParams{1}(2,:) = HW2PhysicsParams;
419
420    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_80_70('Q2');
421    AO.Q12.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
422    AO.Q12.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
423    AO.Q12.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
424    AO.Q12.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
425
426
427    AO.Q11.Status = [1; 1];
428    AO.Q12.Status = 1;
429
430    setao(AO);
431   
432    %% ModeNumber == 15 User mode - Nanoscopium
433elseif ModeNumber == 15 % User mode - Nanoscopium
434    AD.OperationalMode = '2.7391 GeV, 18.2000 10.7000';
435    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
436    ModeName = 'nano_2000_7000a';
437    OpsFileExtension = '_nano_2000_7000a';
438
439    % AT lattice
440    AD.ATModel = 'nano_2000_7000'; % new lattice version from Alex
441    eval(AD.ATModel);  %run model for compiler;
442
443    % Golden TUNE is with the TUNE family
444    AO = getao;
445    AO.TUNE.Monitor.Golden = [
446        0.2175
447        0.3120
448        NaN];
449
450    % Golden chromaticity is in the AD (Physics units)
451    AD.Chromaticity.Golden = [2; 2];
452
453    local_set_config_mode('nanoscopiumconfig');
454    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
455    setao(AO);
456
457    % triplet upstreams and downstreams of SDL13 for nanoscopium
458    % Need to point to another family for magnetcoefficients (other range of current)
459    % Q1 upstream
460    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano2_20_70('Q1');
461    AO.Q1.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
462    AO.Q1.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
463    AO.Q1.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
464    AO.Q1.Setpoint.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
465    % Q1 downstream
466    AO.Q1.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
467    AO.Q1.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
468    AO.Q1.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
469    AO.Q1.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
470    % Q2 upstream
471    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano2_20_70('Q2');
472    AO.Q2.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
473    AO.Q2.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
474    AO.Q2.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
475    AO.Q2.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
476    % Q2 downstream
477    AO.Q2.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
478    AO.Q2.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
479    AO.Q2.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
480    AO.Q2.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
481    % Q3 upstream
482    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano2_20_70('Q1');
483    AO.Q3.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
484    AO.Q3.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
485    AO.Q3.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
486    AO.Q3.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
487    % Q3 downstream
488    AO.Q3.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
489    AO.Q3.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
490    AO.Q3.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
491    AO.Q3.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
492
493    % triplet nanoscopium
494    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano2_20_70('Q11');
495    AO.Q11.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
496    AO.Q11.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
497    AO.Q11.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
498    AO.Q11.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
499    AO.Q11.Monitor.HW2PhysicsParams{1}(2,:)  = HW2PhysicsParams;
500    AO.Q11.Setpoint.HW2PhysicsParams{1}(2,:) = HW2PhysicsParams;
501    AO.Q11.Monitor.Physics2HWParams{1}(2,:)  = HW2PhysicsParams;
502    AO.Q11.Setpoint.Physics2HWParams{1}(2,:) = HW2PhysicsParams;
503
504    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano2_20_70('Q7');
505    AO.Q12.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
506    AO.Q12.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
507    AO.Q12.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
508    AO.Q12.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
509
510    setao(AO);
511
512    %% ModeNumber == 8         
513elseif ModeNumber == 8
514    % User mode
515    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
516    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
517    ModeName = 'lat_2020_3170a';
518    OpsFileExtension = '_lat_2020_3170a';
519
520    % AT lattice
521    AD.ATModel = 'lat_2020_3170a';
522    eval(AD.ATModel);  %run model for compiler;
523
524    % Golden TUNE is with the TUNE family
525    % 18.2020 / 10.3170
526    AO = getao;
527    AO.TUNE.Monitor.Golden = [
528        0.2020
529        0.3170
530        NaN];
531
532    % Golden chromaticity is in the AD (Physics units)
533    AD.Chromaticity.Golden = [2; 2];
534
535    % Status factory
536    local_set_config_mode('normalconfig120');
537    AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
538    setao(AO);
539
540    %% ModeNumber == 17  Nanoscopium : new tune (to be tested)  16 June 2010
541elseif ModeNumber == 17 % Nanoscopium : new tune (to be tested)  16 June 2010
542    % ATTENTION LE MAGNET COEFFICIENT EST CELUI DE LA MAILLE nano_2000_7000
543    % à voir s'il faut le modifier
544    AD.OperationalMode = '2.7391 GeV, 18.20 10.64';
545    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
546    ModeName = 'nano_2000_6400';
547    OpsFileExtension = '_nano_2000_6400';
548
549    % AT lattice
550    AD.ATModel = 'nano_2000_6400'; % new lattice version from Alex
551    eval(AD.ATModel);  %run model for compiler;
552
553    % Golden TUNE is with the TUNE family
554    AO = getao;
555    AO.TUNE.Monitor.Golden = [
556        0.2175
557        0.3120
558        NaN];
559
560    % Golden chromaticity is in the AD (Physics units)
561    AD.Chromaticity.Golden = [2; 2];
562
563    % Status factory
564    local_set_config_mode('normalconfig120');
565    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009);
566
567    % triplet upstreams and downstreams of SDL13 for nanoscopium
568    % Need to point to another family for magnetcoefficients (other range of current)
569    % Q1 upstream
570    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q1');
571    AO.Q1.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
572    AO.Q1.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
573    AO.Q1.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
574    AO.Q1.Setpoint.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
575    % Q1 downstream
576    AO.Q1.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
577    AO.Q1.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
578    AO.Q1.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
579    AO.Q1.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
580    % Q2 upstream
581    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q2');
582    AO.Q2.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
583    AO.Q2.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
584    AO.Q2.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
585    AO.Q2.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
586    % Q2 downstream
587    AO.Q2.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
588    AO.Q2.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
589    AO.Q2.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
590    AO.Q2.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
591    % Q3 upstream
592    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q1');
593    AO.Q3.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
594    AO.Q3.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
595    AO.Q3.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
596    AO.Q3.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
597    % Q3 downstream
598    AO.Q3.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
599    AO.Q3.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
600    AO.Q3.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
601    AO.Q3.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
602
603    % triplet nanoscopium
604    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q11');
605    AO.Q11.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
606    AO.Q11.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
607    AO.Q11.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
608    AO.Q11.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
609    AO.Q11.Monitor.HW2PhysicsParams{1}(2,:)  = HW2PhysicsParams;
610    AO.Q11.Setpoint.HW2PhysicsParams{1}(2,:) = HW2PhysicsParams;
611    AO.Q11.Monitor.Physics2HWParams{1}(2,:)  = HW2PhysicsParams;
612    AO.Q11.Setpoint.Physics2HWParams{1}(2,:) = HW2PhysicsParams;
613
614    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009('Q7');
615    AO.Q12.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
616    AO.Q12.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
617    AO.Q12.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
618    AO.Q12.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
619    setao(AO);
620   
621   
622    %% ModeNumber == 18
623elseif ModeNumber == 18 % User mode - Nanoscopium
624       
625    AD.OperationalMode = '2.7391 GeV, 18.200 10.300  Bx SDL =5m Nanoscopium';
626    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
627    ModeName = 'nano_5m_2000_3000a';
628    OpsFileExtension = '_nano_5m_2000_3000a';
629
630    % AT lattice
631    AD.ATModel = 'nano_5m_20_30'; % new lattice version from Alex
632    eval(AD.ATModel);  %run model for compiler;
633
634    % Golden TUNE is with the TUNE family
635    AO = getao;
636    AO.TUNE.Monitor.Golden = [
637        0.20
638        0.30
639        NaN];
640   
641    % Golden chromaticity is in the AD (Physics units)
642    AD.Chromaticity.Golden = [2; 2];
643
644    local_set_config_mode('nanoscopiumconfig');
645    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m);
646    setao(AO);
647 
648    % triplet upstreams and downstreams of SDL13 for nanoscopium
649    % Need to point to another family for magnetcoefficients (other range of current)
650    % Q1 upstream
651    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q1');
652    AO.Q1.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
653    AO.Q1.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
654    AO.Q1.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
655    AO.Q1.Setpoint.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
656    % Q1 downstream
657    AO.Q1.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
658    AO.Q1.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
659    AO.Q1.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
660    AO.Q1.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
661    % Q2 upstream
662    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q2');
663    AO.Q2.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
664    AO.Q2.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
665    AO.Q2.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
666    AO.Q2.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
667    % Q2 downstream
668    AO.Q2.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
669    AO.Q2.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
670    AO.Q2.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
671    AO.Q2.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
672    % Q3 upstream
673    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q1');
674    AO.Q3.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
675    AO.Q3.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
676    AO.Q3.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
677    AO.Q3.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
678    % Q3 downstream
679    AO.Q3.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
680    AO.Q3.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
681    AO.Q3.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
682    AO.Q3.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
683
684    % triplet nanoscopium
685    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q11');
686    AO.Q11.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
687    AO.Q11.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
688    AO.Q11.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
689    AO.Q11.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
690    AO.Q11.Monitor.HW2PhysicsParams{1}(2,:)  = HW2PhysicsParams;
691    AO.Q11.Setpoint.HW2PhysicsParams{1}(2,:) = HW2PhysicsParams;
692    AO.Q11.Monitor.Physics2HWParams{1}(2,:)  = HW2PhysicsParams;
693    AO.Q11.Setpoint.Physics2HWParams{1}(2,:) = HW2PhysicsParams;
694
695    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q2');
696    AO.Q12.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
697    AO.Q12.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
698    AO.Q12.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
699    AO.Q12.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
700
701    setao(AO);
702         
703   
704    %% ModeNumber == 21  % User mode - Nanoscopium betax=5m
705elseif ModeNumber == 21 % User mode - Nanoscopium
706       
707    AD.OperationalMode = '2.7391 GeV, 18.1700 10.2500  S11  Bx SDL =5m Nanoscopium';
708    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
709    ModeName = 'nano_5m_1700_2500a';
710    OpsFileExtension = '_nano_5m_1700_2500a';
711
712    % AT lattice
713    AD.ATModel = 'nano_5m_17_25_S11'; % new lattice version from Alex
714    eval(AD.ATModel);  %run model for compiler;
715
716    % Golden TUNE is with the TUNE family
717    AO = getao;
718    AO.TUNE.Monitor.Golden = [
719        0.20
720        0.30
721        NaN];
722   
723    % Golden chromaticity is in the AD (Physics units)
724    AD.Chromaticity.Golden = [2; 2.6];
725
726    local_set_config_mode('nanoscopiumconfig');
727    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m);
728    setao(AO);
729 
730    % triplet upstreams and downstreams of SDL13 for nanoscopium
731    % Need to point to another family for magnetcoefficients (other range of current)
732    % Q1 upstream
733    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q1');
734    AO.Q1.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
735    AO.Q1.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
736    AO.Q1.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
737    AO.Q1.Setpoint.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
738    % Q1 downstream
739    AO.Q1.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
740    AO.Q1.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
741    AO.Q1.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
742    AO.Q1.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
743    % Q2 upstream
744    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q2');
745    AO.Q2.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
746    AO.Q2.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
747    AO.Q2.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
748    AO.Q2.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
749    % Q2 downstream
750    AO.Q2.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
751    AO.Q2.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
752    AO.Q2.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
753    AO.Q2.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
754    % Q3 upstream
755    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q1');
756    AO.Q3.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
757    AO.Q3.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
758    AO.Q3.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
759    AO.Q3.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
760    % Q3 downstream
761    AO.Q3.Monitor.HW2PhysicsParams{1}(7,:)  = HW2PhysicsParams;
762    AO.Q3.Monitor.Physics2HWParams{1}(7,:)  = HW2PhysicsParams;
763    AO.Q3.Setpoint.HW2PhysicsParams{1}(7,:) = HW2PhysicsParams;
764    AO.Q3.Setpoint.Physics2HWParams{1}(7,:) = HW2PhysicsParams;
765
766    % triplet nanoscopium
767    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q11');
768    AO.Q11.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
769    AO.Q11.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
770    AO.Q11.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
771    AO.Q11.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
772    AO.Q11.Monitor.HW2PhysicsParams{1}(2,:)  = HW2PhysicsParams;
773    AO.Q11.Setpoint.HW2PhysicsParams{1}(2,:) = HW2PhysicsParams;
774    AO.Q11.Monitor.Physics2HWParams{1}(2,:)  = HW2PhysicsParams;
775    AO.Q11.Setpoint.Physics2HWParams{1}(2,:) = HW2PhysicsParams;
776
777    HW2PhysicsParams = magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m('Q2');
778    AO.Q12.Monitor.HW2PhysicsParams{1}(1,:)  = HW2PhysicsParams;
779    AO.Q12.Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams;
780    AO.Q12.Monitor.Physics2HWParams{1}(1,:)  = HW2PhysicsParams;
781    AO.Q12.Setpoint.Physics2HWParams{1}(1,:) = HW2PhysicsParams;
782
783    setao(AO);
784   
785    %% ModeNumber == 1
786elseif ModeNumber == 1
787    % User mode -
788    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
789    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
790    ModeName = 'solamor2c';
791    OpsFileExtension = '_solamor2c';
792
793    % AT lattice
794    AD.ATModel = 'solamor2linc';
795    eval(AD.ATModel);  %run model for compilersolamor2linb;
796
797    % Golden TUNE is with the TUNE family
798    % 18.2020 / 10.3170
799    AO = getao;
800    AO.TUNE.Monitor.Golden = [
801        0.2020
802        0.3170
803        NaN];
804    % Golden chromaticity is in the AD (Physics units)
805    AD.Chromaticity.Golden = [2; 2];
806
807    % Status factory
808    local_set_config_mode('normalconfig120');
809    AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
810    setao(AO);
811
812    %% ModeNumber == 2
813elseif ModeNumber == 2
814    % User mode -
815    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
816    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
817    ModeName = 'solamor2';
818    OpsFileExtension = '_solamor2';
819
820    % AT lattice
821    AD.ATModel = 'solamor2linb';
822    eval(AD.ATModel);  %run model for compilersolamor2linb;
823
824    % Golden TUNE is with the TUNE family
825    % 18.20 / 10.30
826    AO = getao;
827    AO.TUNE.Monitor.Golden = [
828        0.2000
829        0.3000
830        NaN];
831
832    % Golden chromaticity is in the AD (Physics units)
833    AD.Chromaticity.Golden = [2; 2];
834
835    % Status factory
836    local_set_config_mode('normalconfig120');
837    AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
838    setao(AO);
839
840    %% ModeNumber == 3 Chasmann_green
841elseif ModeNumber == 3
842    % Chasmann_green
843    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
844    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
845    ModeName = 'chasmann_green';
846    OpsFileExtension = '_chasmann_green';
847
848    % AT lattice
849    AD.ATModel = 'chasman_green';
850    eval(AD.ATModel);  %run model for compilersolamor2linb;
851
852    % Golden TUNE is with the TUNE family
853    % 18.20 / 10.30
854    AO = getao;
855    AO.TUNE.Monitor.Golden = [
856        0.20
857        0.30
858        NaN];
859
860    % Golden chromaticity is in the AD (Physics units)
861    AD.Chromaticity.Golden = [2; 2];
862
863    % Status factory
864    local_set_config_mode('S11config120');
865    AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
866    setao(AO);
867
868    %% ModeNumber == 4 Low Alpha alpha_nominal/15
869elseif ModeNumber == 4
870    % Low Alpha alpha_nominal/15
871    AD.OperationalMode = '2.7391 GeV, 20.72 9.2, lowalpha1/15';
872    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
873    ModeName = 'lowalpha1by15';
874    OpsFileExtension = '_lowalpha1by15';
875
876    % AT lattice
877    AD.ATModel = 'lowalpha1by15';
878    eval(AD.ATModel);  %run model for compilersolamor2linb;
879
880    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
881    AD.DeltaRFDisp = 100e-6/15*3;
882    AD.DeltaRFChro = [-100 -50 0 50 150] * 1e-6/15*3;
883
884    % Golden TUNE is with the TUNE family
885    % 20.72 / 9.20
886    AO = getao;
887
888    AO.TUNE.Monitor.Golden = [
889        0.72
890        0.20
891        NaN];
892
893    % Golden chromaticity is in the AD (Physics units)
894    AD.Chromaticity.Golden = [2; 2];
895
896    % Status factory
897    local_set_config_mode('normalconfig120');
898    AO = local_setmagnetcoefficient(AO, @magnetcoefficients);
899    setao(AO);
900
901    %% ModeNumber == 5 Low Alpha alpha1by20_maher
902elseif ModeNumber == 5
903    % Low Alpha alpha1by20_maher
904    AD.OperationalMode = '2.7391 GeV, 20.3 8.4, lowalpha1/20';
905    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
906    ModeName = 'alpha1by20';
907    OpsFileExtension = '_alpha1by20';
908
909    % AT lattice
910    AD.ATModel = 'alpha1by20_maher';
911    eval(AD.ATModel);  %run model for compilersolamor2linb;
912
913    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
914    AD.DeltaRFDisp = 100e-6/20*3;
915    AD.DeltaRFChro = [-100 -50 0 50 150] * 1e-6/20*3;
916
917    % Golden TUNE is with the TUNE family
918    % 20.40 / 8.40
919    AO = getao;
920
921    AO.TUNE.Monitor.Golden = [
922        0.30
923        0.40
924        NaN];
925   
926    % Golden chromaticity is in the AD (Physics units)
927    AD.Chromaticity.Golden = [2; 2];
928
929    % Status factory
930    local_set_config_mode('normalconfig120');
931    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_lowalpha);
932    setao(AO);
933
934    %% ModeNumber == 6 User mode - HU640
935elseif ModeNumber == 6
936    % User mode - HU640
937    AD.OperationalMode = '2.7391 GeV HU640, 18.2 10.3';
938    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
939    ModeName = 'solamor2_HU640';
940    OpsFileExtension = '_solamor2_HU640';
941
942    % AT lattice
943    AD.ATModel = 'solamor2linb_HU640';
944    eval(AD.ATModel);  %run model for compilersolamor2linb;
945
946    % Golden TUNE is with the TUNE family
947    % 18.20 / 10.30
948    AO = getao;
949    AO.TUNE.Monitor.Golden = [
950        0.20
951        0.30
952        NaN];
953
954    % Golden chromaticity is in the AD (Physics units)
955    AD.Chromaticity.Golden = [2; 2];
956
957    % Status factory
958    local_set_config_mode('normalconfig120');
959    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_lowalpha);
960    setao(AO);
961
962    %% ModeNumber == 7 alpha1/20 new callibration 20.3 8.4
963elseif ModeNumber == 7
964    % December 2008
965    % alpha1/20 new callibration 20.3 8.4
966    AD.OperationalMode = '2.7391 GeV, alpha1/20 new calibration';
967    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
968    ModeName = 'lowalpha_dec08';
969    OpsFileExtension = '_lowalpha_dec08';
970
971    % AT lattice
972    AD.ATModel = 'alphaby20_nouveau_modele_dec08_opt_nonlin';
973    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
974    eval(AD.ATModel);  %run model for compiler;
975
976    % Golden TUNE is with the TUNE family
977    % 20.30 / 8.40
978    AO = getao;
979    AO.TUNE.Monitor.Golden = [
980        0.30
981        0.40
982        NaN];
983
984    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
985    AD.DeltaRFDisp = 10e-6;
986    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
987
988
989    % Golden chromaticity is in the AD (Physics units)
990    AD.Chromaticity.Golden = [2; 2];
991
992    local_set_config_mode('normalconfig120');   
993    % Commented for shift January 2010
994    %AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_cal_lowalphaMAHER_Linterm);
995    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
996    setao(AO);
997 
998
999    %% ModeNumber == 12 alpha1/10 new calibration 20.3 8.4
1000elseif ModeNumber == 12
1001    % February 2010
1002    % alpha1/10 new calibration 20.3 8.4
1003    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1004    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1005    ModeName = 'alpha_over_10';
1006    OpsFileExtension = '_alpha_over_10';
1007
1008    % AT lattice
1009    AD.ATModel = 'alphaby10_nouveau_modele_dec08_opt_lin_1';
1010    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1011    eval(AD.ATModel);  %run model for compiler;
1012
1013    % Golden TUNE is with the TUNE family
1014    % 20.30 / 8.40
1015    AO = getao;
1016    AO.TUNE.Monitor.Golden = [
1017        0.30
1018        0.40
1019        NaN];
1020
1021    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1022    AD.DeltaRFDisp = 10e-6;
1023    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1024
1025    % Golden chromaticity is in the AD (Physics units)
1026    AD.Chromaticity.Golden = [2; 2];
1027
1028    local_set_config_mode('S11config120');   
1029    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
1030    setao(AO);
1031
1032    %% ModeNumber == 13 alpha1/1000 new calibration 20.3 8.4
1033elseif ModeNumber == 13
1034    % February 2010
1035    % alpha1/1000 new calibration 20.3 8.4
1036    AD.OperationalMode = '2.7391 GeV, alpha_nominal/100 new calibration';
1037    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1038    ModeName = 'alpha_over_100';
1039    OpsFileExtension = '_alpha_over_100';
1040
1041    % AT lattice
1042    AD.ATModel = 'alphaby100_nouveau_modele_janvier2010_opt_nonlin_ksi_2_2';
1043    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1044    eval(AD.ATModel);  %run model for compiler;
1045
1046    % Golden TUNE is with the TUNE family
1047    % 20.30 / 8.40
1048    AO = getao;
1049    AO.TUNE.Monitor.Golden = [
1050        0.30
1051        0.40
1052        NaN];
1053
1054    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1055    AD.DeltaRFDisp = 1e-6;
1056    AD.DeltaRFChro = [-1 -0.5 0 0.5 1] * 1e-6;
1057
1058    % Response matrix
1059    devnumber = length(AO.HCOR.Status);
1060    AO.HCOR.Setpoint.DeltaRespMat(:,:) = ones(devnumber,1)*5e-6; % 2*2.5 urad (half used for kicking)
1061    AO.HCOR.Setpoint.DeltaRespMat = physics2hw(AO.HCOR.FamilyName,'Setpoint', ...
1062        AO.HCOR.Setpoint.DeltaRespMat, AO.HCOR.DeviceList);
1063
1064    % Golden chromaticity is in the AD (Physics units)
1065    AD.Chromaticity.Golden = [2; 2];
1066   
1067    local_set_config_mode('S11config120');   
1068    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
1069    setao(AO);
1070
1071
1072    %% ModeNumber == 22 alpha1/10 AMOR december 2010 new calibration 20.77 9.2
1073elseif ModeNumber == 22
1074    % February 2010
1075    % alpha1/10 new calibration 20.3 8.4
1076    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1077    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1078    ModeName = 'alpha_over_10_AMOR';
1079    OpsFileExtension = '_alpha_over_10_AMOR';
1080
1081    % AT lattice
1082    AD.ATModel = 'alphaby10_AMOR_new_mod_nov10_lin_auto_0';
1083    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_AMOR'));
1084    eval(AD.ATModel);  %run model for compiler;
1085
1086    % Golden TUNE is with the TUNE family
1087    % 20.77 / 9.20
1088    AO = getao;
1089    AO.TUNE.Monitor.Golden = [
1090        0.77
1091        0.20
1092        NaN];
1093
1094    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1095    AD.DeltaRFDisp = 10e-6;
1096    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1097
1098    % Golden chromaticity is in the AD (Physics units)
1099    AD.Chromaticity.Golden = [0; 0];
1100
1101    local_set_config_mode('S11config120');   
1102    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_mod_low_alpha_AMOR_oct10);
1103    setao(AO);
1104
1105    %% ModeNumber == 23 low alpha_nominal/10 MAHER 20.30 8.40 OD optimised (lin_1_auto) December 2010
1106elseif ModeNumber == 23
1107    % February 2010
1108    % alpha1/10 new calibration 20.3 8.4
1109    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1110    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1111    ModeName = 'alpha_over_10_MAHER_auto';
1112    OpsFileExtension = '_alpha_over_10_MAHER_auto';
1113
1114    % AT lattice
1115    AD.ATModel = 'alphaby10_maher_opt_lin_1_auto';
1116    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1117    eval(AD.ATModel);  %run model for compiler;
1118
1119    % Golden TUNE is with the TUNE family
1120    % 20.30 / 8.40
1121    AO = getao;
1122    AO.TUNE.Monitor.Golden = [
1123        0.30
1124        0.40
1125        NaN];
1126
1127    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1128    AD.DeltaRFDisp = 10e-6;
1129    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1130
1131    % Golden chromaticity is in the AD (Physics units)
1132    AD.Chromaticity.Golden = [0; 0];
1133
1134    local_set_config_mode('S11config120');   
1135    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_modele_low_alpha_oct2010_auto1);
1136    setao(AO);
1137   
1138
1139    %% ModeNumber == 24 betaz=1m et betax=15m dans les sections courtes
1140    %% Fevrier 2011
1141elseif ModeNumber == 24
1142    AD.OperationalMode = '2.7391 GeV, betaz=1m SDC';
1143    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1144    ModeName = 'betaz_1m_SDC';
1145    OpsFileExtension = '_betaz_1m_SDC';
1146
1147    % AT lattice
1148    AD.ATModel = 'lat_betaz_1m_sdc';
1149    eval(AD.ATModel);  %run model for compiler;
1150
1151    % Golden TUNE is with the TUNE family
1152    % 18.202 / 10.317
1153    AO = getao;
1154    AO.TUNE.Monitor.Golden = [
1155        0.202
1156        0.317
1157        NaN];
1158
1159    % Golden chromaticity is in the AD (Physics units)
1160    AD.Chromaticity.Golden = [2; 2];
1161
1162    local_set_config_mode('S11config120');   
1163    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_mod_betaz_1m_fevrier2011);
1164    setao(AO); 
1165   
1166    %% ModeNumber == 25 low alphaMAHER alpha negatif by 10 20.30 8.40
1167    %% OD optimise auto Juin 2011
1168elseif ModeNumber == 25
1169    % February 2010
1170    % alpha1/10 new calibration 20.3 8.4
1171    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1172    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1173    ModeName = 'malpha_over_10_MAHER_auto';
1174    OpsFileExtension = '_malpha_over_10_MAHER_auto';
1175
1176    % AT lattice
1177    %AD.ATModel = 'malphaby10_from_nominal_optics_step7gbis';
1178    AD.ATModel = 'malphaby10_maher_auto';
1179    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1180    eval(AD.ATModel);  %run model for compiler;
1181
1182    % Golden TUNE is with the TUNE family
1183    % 20.30 / 8.40
1184    AO = getao;
1185    AO.TUNE.Monitor.Golden = [
1186        0.30
1187        0.40
1188        NaN];
1189
1190    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1191    AD.DeltaRFDisp = 10e-6;
1192    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1193
1194    % Golden chromaticity is in the AD (Physics units)
1195    AD.Chromaticity.Golden = [0; 0];
1196
1197    local_set_config_mode('S11config120');   
1198    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_alphaby10_maher_negatif_juin2011_auto);
1199    setao(AO);
1200   
1201    %% ModeNumber == 26 low alpha_nominal/200 from nominal optics 19.24 10.317 Juin 2011
1202elseif ModeNumber == 26
1203    % February 2010
1204    % alpha1/10 new calibration 20.3 8.4
1205    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1206    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1207    ModeName = 'alpha_over_200_nom_optics';
1208    OpsFileExtension = '_alpha_over_200_nom_optics';
1209
1210    % AT lattice
1211    AD.ATModel = 'alphaby200_from_nominal_optics';
1212    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1213    eval(AD.ATModel);  %run model for compiler;
1214
1215    % Golden TUNE is with the TUNE family
1216    % 20.30 / 8.40
1217    AO = getao;
1218    AO.TUNE.Monitor.Golden = [
1219        0.30
1220        0.40
1221        NaN];
1222
1223    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1224    AD.DeltaRFDisp = 10e-6;
1225    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1226
1227    % Golden chromaticity is in the AD (Physics units)
1228    AD.Chromaticity.Golden = [0; 0];
1229
1230    local_set_config_mode('S11config120');   
1231    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_alphaby10_from_nomopt_positif_juin2011);
1232    setao(AO);
1233    % commentaire : ce magnet coefficient a bien et verifie 15 juin 2011
1234
1235    %% ModeNumber == 27 betax=15m dans les sections courtes + idem Nanoscopium juin 2011
1236elseif ModeNumber == 27
1237    AD.OperationalMode = '2.7391 GeV, betax=15m SDC + idem Nanoscopium';
1238    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1239    ModeName = 'like_nanoscopium';
1240    OpsFileExtension = '_like_nanoscopium';
1241
1242    % AT lattice
1243    AD.ATModel = 'lat_like_nanoscopium_juin2011';
1244    eval(AD.ATModel);  %run model for compiler;
1245
1246    % Golden TUNE is with the TUNE family
1247    % 18.202 / 10.317
1248    AO = getao;
1249    AO.TUNE.Monitor.Golden = [
1250        0.202
1251        0.317
1252        NaN];
1253
1254    % Golden chromaticity is in the AD (Physics units)
1255    AD.Chromaticity.Golden = [2; 2];
1256
1257    local_set_config_mode('S11config120');   
1258    %AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_mod_betaz_1m_fevrier2011);
1259    AO = local_setmagnetcoefficient(AO, @magnetcoefficients_like_nanoscopium_juin2011);
1260    setao(AO); 
1261   
1262    %% ModeNumber == 28 122 BPMs with nominal lattice RUN3 2011 betax=5m en SDL
1263elseif ModeNumber == 28
1264    % User mode - Laurent
1265    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
1266    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
1267    ModeName = 'lat_1990_3170_122BPM';
1268    OpsFileExtension = '_122BPMs';
1269
1270    % AT lattice
1271    AD.ATModel = 'lat_1990_3170_122BPM';
1272    run(AD.ATModel);
1273
1274    % Golden TUNE is with the TUNE family
1275    % 18.20 / 10.30
1276    AO = getao;
1277    AO.TUNE.Monitor.Golden = [
1278        0.1990
1279        0.3170
1280        NaN];
1281
1282
1283    % Golden chromaticity is in the AD (Physics units)
1284    AD.Chromaticity.Golden = [2; 2];
1285
1286    setao(AO);
1287   
1288    local_set_config_mode('S11config122');
1289    AO = getao;
1290    %setfamilydata(ones(length(AO.HCOR.ElementList),1)*5e-6*2, 'HCOR', 'Setpoint', 'DeltaRespMat');
1291    %setfamilydata(ones(length(AO.VCOR.ElementList),1)*5e-6*2, 'VCOR', 'Setpoint', 'DeltaRespMat');
1292    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_juin2009);
1293
1294   
1295    %% ModeNumber == 29 122 BPMs with nanoscopium from January 2012 0.176 0.234
1296elseif ModeNumber == 29
1297    % User mode - Laurent
1298    AD.OperationalMode = '2.7391 GeV, 18.176 10.234';
1299    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
1300    ModeName = 'Nanoscopium';
1301    OpsFileExtension = '_nano_122BPMs';
1302
1303    % AT lattice
1304    AD.ATModel = 'lat_nano_176_234_122BPM';
1305    run(AD.ATModel);
1306
1307    % Golden TUNE is with the TUNE family
1308    % 18.20 / 10.30
1309    AO = getao;
1310    AO.TUNE.Monitor.Golden = [
1311        0.176
1312        0.234
1313        NaN];
1314    AO.COUPLING.Golden = 1;
1315
1316
1317    % Golden chromaticity is in the AD (Physics units)
1318    AD.Chromaticity.Golden = [1.8; 2.3];
1319
1320    setao(AO);
1321    local_set_config_mode('nanoscopiumconfig122C'); % with correctors
1322    %setfamilydata(1, 'BPMx', 'Status');
1323    %setfamilydata(1, 'BPMz', 'Status');
1324    AO = getao;
1325    %setfamilydata(ones(length(AO.HCOR.ElementList),1)*5e-6*2, 'HCOR', 'Setpoint', 'DeltaRespMat');
1326    %setfamilydata(ones(length(AO.VCOR.ElementList),1)*5e-6*2, 'VCOR', 'Setpoint', 'DeltaRespMat');
1327    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m);
1328   
1329    %% ModeNumber == 38 122 BPMs with nanoscopium lattice run machine 2011 0.170 0.250
1330elseif ModeNumber == 38
1331    % User mode - Laurent
1332    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
1333    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
1334    ModeName = 'nano';
1335    OpsFileExtension = '_nano_122BPMs';
1336
1337    % AT lattice
1338    AD.ATModel = 'lat_nano_17_25_122BPM';
1339    run(AD.ATModel);
1340
1341    % Golden TUNE is with the TUNE family
1342    % 18.20 / 10.30
1343    AO = getao;
1344    AO.TUNE.Monitor.Golden = [
1345        0.2016
1346        0.2998
1347        NaN];
1348
1349
1350    % Golden chromaticity is in the AD (Physics units)
1351    AD.Chromaticity.Golden = [2; 2];
1352
1353    setao(AO);
1354    local_set_config_mode('nanoscopiumconfig122C'); % with correctors
1355    %setfamilydata(1, 'BPMx', 'Status');
1356    %setfamilydata(1, 'BPMz', 'Status');
1357    AO = getao;
1358    %setfamilydata(ones(length(AO.HCOR.ElementList),1)*5e-6*2, 'HCOR', 'Setpoint', 'DeltaRespMat');
1359    %setfamilydata(ones(length(AO.VCOR.ElementList),1)*5e-6*2, 'VCOR', 'Setpoint', 'DeltaRespMat');
1360    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m);
1361   
1362%% ModeNumber == 30 122 betax=15m dans les sections courtes + idem Nanoscopium juin 2011 122 BPM
1363elseif ModeNumber == 30
1364    AD.OperationalMode = '2.7391 GeV, betax=15m SDC + idem Nanoscopium';
1365    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1366    ModeName = 'pseudo_nanoscopium';
1367    OpsFileExtension = '_122BPMs';
1368
1369    % AT lattice
1370    AD.ATModel = 'lat_pseudo_nanoscopium_juin2011_122BPM';
1371    eval(AD.ATModel);  %run model for compiler;
1372
1373    % Golden TUNE is with the TUNE family
1374    % 18.202 / 10.317
1375    AO = getao;
1376    AO.TUNE.Monitor.Golden = [
1377        0.2020
1378        0.3100
1379        NaN];
1380
1381    % Golden chromaticity is in the AD (Physics units)
1382    AD.Chromaticity.Golden = [2; 2.5];
1383    setao(AO);
1384    local_set_config_mode('S11config122');   
1385    %AO = local_setmagnetcoefficient(AO, @magnetcoefficients_new_calib_new_mod_betaz_1m_fevrier2011);
1386    local_setmagnetcoefficient(@magnetcoefficients_like_nanoscopium_juin2011);
1387
1388%% ModeNumber == 31 122 betaz=1m et betax=15m dans les sections courtes Fevrier 2011
1389elseif ModeNumber == 31
1390    AD.OperationalMode = '2.7391 GeV, betaz=1m SDC';
1391    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1392    ModeName = 'betaz_1m_SDC';
1393    OpsFileExtension = '_122BPMs';
1394
1395    % AT lattice
1396    AD.ATModel = 'lat_betaz_1m_sdc_122BPM';
1397    eval(AD.ATModel);  %run model for compiler;
1398
1399    % Golden TUNE is with the TUNE family
1400    % 18.202 / 10.317
1401    AO = getao;
1402    AO.TUNE.Monitor.Golden = [
1403        0.202
1404        0.317
1405        NaN];
1406
1407    % Golden chromaticity is in the AD (Physics units)
1408    AD.Chromaticity.Golden = [2; 2];
1409
1410    setao(AO);
1411    local_set_config_mode('S11config122');
1412    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_mod_betaz_1m_fevrier2011);
1413   
1414%% ModeNumber == 32 122 BPMs alpha1/10 new calibration 20.3 8.4
1415elseif ModeNumber == 32
1416    % February 2010
1417    % alpha1/10 new calibration 20.3 8.4
1418    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1419    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1420    ModeName = 'alpha_over_10';
1421    OpsFileExtension = '_122BPMs';
1422
1423    % AT lattice
1424    AD.ATModel = 'alphaby10_nouveau_modele_dec08_opt_lin_1_122BPM';
1425    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1426    eval(AD.ATModel);  %run model for compiler;
1427
1428    % Golden TUNE is with the TUNE family
1429    % 20.30 / 8.40
1430    AO = getao;
1431    AO.TUNE.Monitor.Golden = [
1432        0.30
1433        0.40
1434        NaN];
1435
1436    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1437    AD.DeltaRFDisp = 10e-6;
1438    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1439
1440    % Golden chromaticity is in the AD (Physics units)
1441    AD.Chromaticity.Golden = [2; 2];
1442
1443    setao(AO);
1444    local_set_config_mode('S11config122');   
1445    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
1446
1447    %% ModeNumber == 33 122 BPMs alpha1/1000 new calibration 20.3 8.4
1448elseif ModeNumber == 33
1449    % February 2010
1450    % alpha1/1000 new calibration 20.3 8.4
1451    AD.OperationalMode = '2.7391 GeV, alpha_nominal/100 new calibration';
1452    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1453    ModeName = 'alpha_over_100';
1454    OpsFileExtension = '_122BPMs';
1455
1456    % AT lattice
1457    AD.ATModel = 'alphaby100_new_mod_janvier2010_opt_nonlin_ksi_2_2_122BPM';
1458    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1459    eval(AD.ATModel);  %run model for compiler;
1460
1461    % Golden TUNE is with the TUNE family
1462    % 20.30 / 8.40
1463    AO = getao;
1464    AO.TUNE.Monitor.Golden = [
1465        0.30
1466        0.40
1467        NaN];
1468
1469    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1470    AD.DeltaRFDisp = 1e-6;
1471    AD.DeltaRFChro = [-1 -0.5 0 0.5 1] * 1e-6;
1472
1473    % Response matrix
1474    devnumber = length(AO.HCOR.Status);
1475    AO.HCOR.Setpoint.DeltaRespMat(:,:) = ones(devnumber,1)*5e-6; % 2*2.5 urad (half used for kicking)
1476    AO.HCOR.Setpoint.DeltaRespMat = physics2hw(AO.HCOR.FamilyName,'Setpoint', ...
1477        AO.HCOR.Setpoint.DeltaRespMat, AO.HCOR.DeviceList);
1478
1479    % Golden chromaticity is in the AD (Physics units)
1480    AD.Chromaticity.Golden = [2; 2];
1481   
1482    setao(AO);
1483    local_set_config_mode('S11config122');   
1484    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
1485       
1486        %% ModeNumber == 34 122 BPMs low alpha_nominal/10 MAHER 20.30 8.40 OD optimise (lin_1_auto) December 2010
1487elseif ModeNumber == 34
1488    % February 2010
1489    % alpha1/10 new calibration 20.3 8.4
1490    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1491    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1492    ModeName = 'alpha_over_10_MAHER_auto';
1493    OpsFileExtension = '_122BPMs';
1494
1495    % AT lattice
1496    AD.ATModel = 'alphaby10_maher_opt_lin_1_auto_122BPM';
1497    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1498    eval(AD.ATModel);  %run model for compiler;
1499
1500    % Golden TUNE is with the TUNE family
1501    % 20.30 / 8.40
1502    AO = getao;
1503    AO.TUNE.Monitor.Golden = [
1504        0.30
1505        0.40
1506        NaN];
1507
1508    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1509    AD.DeltaRFDisp = 10e-6;
1510    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1511
1512    % Golden chromaticity is in the AD (Physics units)
1513    AD.Chromaticity.Golden = [0; 0];
1514
1515    setao(AO);
1516    local_set_config_mode('S11config122');   
1517    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_low_alpha_oct2010_auto1);
1518
1519    %% ModeNumber == 35 122 BPMs low alphaMAHER alpha negatif by 10 20.30 8.40
1520    % OD optimise auto Juin 2011 122 BPM
1521elseif ModeNumber == 35
1522    % February 2010
1523    % alpha1/10 new calibration 20.3 8.4
1524    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1525    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1526    ModeName = 'malpha_over_10_MAHER_auto';
1527    OpsFileExtension = '_122BPM';
1528
1529    % AT lattice
1530    %AD.ATModel = 'malphaby10_from_nominal_optics_step7gbis';
1531    AD.ATModel = 'malphaby10_maher_auto_122BPM';
1532    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1533    eval(AD.ATModel);  %run model for compiler;
1534
1535    % Golden TUNE is with the TUNE family
1536    % 20.30 / 8.40
1537    AO = getao;
1538    AO.TUNE.Monitor.Golden = [
1539        0.30
1540        0.40
1541        NaN];
1542
1543    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1544    AD.DeltaRFDisp = 10e-6;
1545    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1546
1547    % Golden chromaticity is in the AD (Physics units)
1548    AD.Chromaticity.Golden = [0; 0];
1549
1550    setao(AO);
1551    local_set_config_mode('S11config122');   
1552    local_setmagnetcoefficient(@magnetcoefficients_alphaby10_maher_negatif_juin2011_auto);
1553
1554       %% ModeNumber == 36 pseudo alpha1/25 new calibration 20.3 8.4 122 BPMs
1555elseif ModeNumber == 36
1556    % February 2010
1557    % alpha1/10 new calibration 20.3 8.4
1558    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1559    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1560    ModeName = 'alpha_over_25';
1561    OpsFileExtension = '_122BPMs';
1562
1563    % AT lattice
1564    AD.ATModel = 'alphaby25_stepalpha1_new_modele_dec08_opt_lin_1_122BPM';
1565    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1566    eval(AD.ATModel);  %run model for compiler;
1567
1568    % Golden TUNE is with the TUNE family
1569    % 20.30 / 8.40
1570    AO = getao;
1571    AO.TUNE.Monitor.Golden = [
1572        0.30
1573        0.40
1574        NaN];
1575
1576    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1577    AD.DeltaRFDisp = 10e-6;
1578    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1579
1580    % Golden chromaticity is in the AD (Physics units)
1581    AD.Chromaticity.Golden = [2; 2];
1582
1583    setao(AO);
1584    local_set_config_mode('S11config122');   
1585    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
1586   
1587%% ModeNumber == 39 122 BPMs alpha1/25 new calibration 20.3 8.4 betaz local CRISTAL augmente ᅵ 2.6m
1588elseif ModeNumber == 39
1589    % February 2010
1590    % alpha1/10 new calibration 20.3 8.4
1591    AD.OperationalMode = '2.7391 GeV, alpha1/10 new calibration';
1592    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1593    ModeName = 'alpha_over_25_CRISTAL';
1594    OpsFileExtension = '_122BPMs';
1595
1596    % AT lattice
1597    AD.ATModel = 'alphaby25_nouveau_modele_opt_lin_122BPM_bz_2p6m_CRISTAL_auto';
1598    %AD.ATModel = 'alphaby25_nouveau_modele_opt_lin_122BPM_bz_2p6m_CRISTAL';
1599    %AD.ATModel = 'alphaby10_nouveau_modele_dec08_opt_lin_1_122BPM_bz_CRISTAL';
1600    addpath(fullfile(getfamilydata('Directory','Lattice'), 'lowalpha_dec08'));
1601    eval(AD.ATModel);  %run model for compiler;
1602
1603    % Golden TUNE is with the TUNE family
1604    % 20.30 / 8.40
1605    AO = getao;
1606    AO.TUNE.Monitor.Golden = [
1607        0.30
1608        0.38
1609        NaN];
1610
1611    % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units)
1612    AD.DeltaRFDisp = 10e-6;
1613    AD.DeltaRFChro = [-10 -5 0 5 10] * 1e-6;
1614
1615    % Golden chromaticity is in the AD (Physics units)
1616    AD.Chromaticity.Golden = [0; 0];
1617
1618    setao(AO);
1619    local_set_config_mode('S11config122');   
1620    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_mod_low_alpha_CRISTAL);
1621
1622    % Quad before and after CRISTAL section
1623    % Need to point to another family for magnetcoefficients (other range of current)
1624    % Q6 upstream  PROBLEME il n'existe pas de quad dï¿œjï¿œ dans cette gamme
1625    HW2PhysicsParams = magnetcoefficients_new_calib_new_mod_low_alpha_CRISTAL('Q6SDC');
1626    AO.Q6.Monitor.HW2PhysicsParams{1}(8,:)  = HW2PhysicsParams;
1627    AO.Q6.Monitor.Physics2HWParams{1}(8,:)  = HW2PhysicsParams;
1628    AO.Q6.Setpoint.HW2PhysicsParams{1}(8,:) = HW2PhysicsParams;
1629    AO.Q6.Setpoint.Physics2HWParams{1}(8,:)  = HW2PhysicsParams;
1630    % Q6 downstream
1631    AO.Q6.Monitor.HW2PhysicsParams{1}(9,:)  = HW2PhysicsParams;
1632    AO.Q6.Monitor.Physics2HWParams{1}(9,:)  = HW2PhysicsParams;
1633    AO.Q6.Setpoint.HW2PhysicsParams{1}(9,:) = HW2PhysicsParams;
1634    AO.Q6.Setpoint.Physics2HWParams{1}(9,:) = HW2PhysicsParams;
1635    % Q7 upstream
1636    HW2PhysicsParams = magnetcoefficients_new_calib_new_mod_low_alpha_CRISTAL('Q2');
1637    AO.Q7.Monitor.HW2PhysicsParams{1}(8,:)  = HW2PhysicsParams;
1638    AO.Q7.Monitor.Physics2HWParams{1}(8,:)  = HW2PhysicsParams;
1639    AO.Q7.Setpoint.HW2PhysicsParams{1}(8,:) = HW2PhysicsParams;
1640    AO.Q7.Setpoint.Physics2HWParams{1}(8,:) = HW2PhysicsParams;
1641    % Q7 downstream
1642    AO.Q7.Monitor.HW2PhysicsParams{1}(9,:)  = HW2PhysicsParams;
1643    AO.Q7.Monitor.Physics2HWParams{1}(9,:)  = HW2PhysicsParams;
1644    AO.Q7.Setpoint.HW2PhysicsParams{1}(9,:) = HW2PhysicsParams;
1645    AO.Q7.Setpoint.Physics2HWParams{1}(9,:) = HW2PhysicsParams;
1646    % Q8 upstream
1647    HW2PhysicsParams = magnetcoefficients_new_calib_new_mod_low_alpha_CRISTAL('Q8SDC');
1648    AO.Q8.Monitor.HW2PhysicsParams{1}(8,:)  = HW2PhysicsParams;
1649    AO.Q8.Monitor.Physics2HWParams{1}(8,:)  = HW2PhysicsParams;
1650    AO.Q8.Setpoint.HW2PhysicsParams{1}(8,:) = HW2PhysicsParams;
1651    AO.Q8.Setpoint.Physics2HWParams{1}(8,:) = HW2PhysicsParams;
1652    % Q8 downstream
1653    AO.Q8.Monitor.HW2PhysicsParams{1}(9,:)  = HW2PhysicsParams;
1654    AO.Q8.Monitor.Physics2HWParams{1}(9,:)  = HW2PhysicsParams;
1655    AO.Q8.Setpoint.HW2PhysicsParams{1}(9,:) = HW2PhysicsParams;
1656    AO.Q8.Setpoint.Physics2HWParams{1}(9,:) = HW2PhysicsParams;
1657
1658    % Q9 upstream
1659    HW2PhysicsParams = magnetcoefficients_new_calib_new_mod_low_alpha_CRISTAL('Q9SDC');
1660    AO.Q9.Monitor.HW2PhysicsParams{1}(5,:)  = HW2PhysicsParams;
1661    AO.Q9.Monitor.Physics2HWParams{1}(5,:)  = HW2PhysicsParams;
1662    AO.Q9.Setpoint.HW2PhysicsParams{1}(5,:) = HW2PhysicsParams;
1663    AO.Q9.Setpoint.Physics2HWParams{1}(5,:) = HW2PhysicsParams;
1664    % Q9 downstream
1665    AO.Q9.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
1666    AO.Q9.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
1667    AO.Q9.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
1668    AO.Q9.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
1669   
1670    % Q10 upstream
1671    HW2PhysicsParams = magnetcoefficients_new_calib_new_mod_low_alpha_CRISTAL('Q10');
1672    AO.Q10.Monitor.HW2PhysicsParams{1}(5,:)  = HW2PhysicsParams;
1673    AO.Q10.Monitor.Physics2HWParams{1}(5,:)  = HW2PhysicsParams;
1674    AO.Q10.Setpoint.HW2PhysicsParams{1}(5,:) = HW2PhysicsParams;
1675    AO.Q10.Setpoint.Physics2HWParams{1}(5,:) = HW2PhysicsParams;
1676    % Q10 downstream
1677    AO.Q10.Monitor.HW2PhysicsParams{1}(6,:)  = HW2PhysicsParams;
1678    AO.Q10.Monitor.Physics2HWParams{1}(6,:)  = HW2PhysicsParams;
1679    AO.Q10.Setpoint.HW2PhysicsParams{1}(6,:) = HW2PhysicsParams;
1680    AO.Q10.Setpoint.Physics2HWParams{1}(6,:) = HW2PhysicsParams;
1681
1682    setao(AO);   
1683
1684    %% ModeNumber == 37 122 User mode - S11 betax=10m till November 2010   .202 .317  122 BPMs
1685elseif ModeNumber == 37
1686    AD.OperationalMode = '2.7391 GeV,18.202 10.317 S11';
1687    AD.Energy = 2.7391; % Make sure this is the same as bend2gev at the production lattice!
1688    ModeName = 'lat_2020_3170f';
1689    OpsFileExtension = '_122BPMs';
1690   
1691    % AT lattice
1692    AD.ATModel = 'lat_2020_3170f_122BPM';
1693    eval(AD.ATModel);  %run model for compiler;
1694
1695    % Golden TUNE is with the TUNE family
1696    % 18.202 / 10.317
1697    AO = getao;
1698    AO.TUNE.Monitor.Golden = [
1699        0.202
1700        0.317
1701        NaN];
1702
1703    % Golden chromaticity is in the AD (Physics units)
1704    AD.Chromaticity.Golden = [2; 2.6];
1705
1706    setao(AO);
1707    local_set_config_mode('S11config122');
1708    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_mod_betaz_1m_fevrier2011);
1709
1710   %% ModeNumber == 40 122 BPMs + 4 XBPM with nanoscopium from March 2012 0.176 0.234
1711elseif ModeNumber == 40
1712    % User mode - Laurent
1713    AD.OperationalMode = '2.7391 GeV, 18.176 10.234';
1714    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
1715    ModeName = 'Nanoscopium_XBPM';
1716    OpsFileExtension = '_nano_122BPMs';
1717
1718    % AT lattice
1719    AD.ATModel = 'lat_nano_176_234_122BPM_XBPM';
1720    run(AD.ATModel);
1721
1722    % Golden TUNE is with the TUNE family
1723    % 18.20 / 10.30
1724    AO = getao;
1725    AO.TUNE.Monitor.Golden = [
1726        0.176
1727        0.234
1728        NaN];
1729
1730
1731    % Golden chromaticity is in the AD (Physics units)
1732    AD.Chromaticity.Golden = [1.8; 2.3];
1733
1734    setao(AO);
1735    local_set_config_mode('nanoscopiumconfig122C'); % with correctors
1736    %setfamilydata(1, 'BPMx', 'Status');
1737    %setfamilydata(1, 'BPMz', 'Status');
1738    AO = getao;
1739    %setfamilydata(ones(length(AO.HCOR.ElementList),1)*5e-6*2, 'HCOR', 'Setpoint', 'DeltaRespMat');
1740    %setfamilydata(ones(length(AO.VCOR.ElementList),1)*5e-6*2, 'VCOR', 'Setpoint', 'DeltaRespMat');
1741    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m);
1742   
1743    %% ModeNumber == 41 122 BPMs/ Thick Sextu with nanoscopium from January/May 2012 0.176 0.234
1744elseif ModeNumber == 41
1745    % User mode - Laurent
1746    AD.OperationalMode = '2.7391 GeV, 18.176 10.234';
1747    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
1748    ModeName = 'lat_nano_176_234_122BPM_thickSextu';
1749    OpsFileExtension = '_                                                                                                                                                         thickSextu';
1750
1751    % AT lattice
1752    AD.ATModel = 'lat_nano_176_234_122BPM_thickSextu';
1753    run(AD.ATModel);
1754
1755    % Golden TUNE is with the TUNE family
1756    % 18.20 / 10.30
1757    AO = getao;
1758    AO.TUNE.Monitor.Golden = [
1759        0.176
1760        0.234
1761        NaN];
1762
1763
1764    % Golden chromaticity is in the AD (Physics units)
1765    AD.Chromaticity.Golden = [1.8; 2.3];
1766
1767    setao(AO);
1768    local_set_config_mode('nanoscopiumconfig122C'); % with correctors
1769    %setfamilydata(1, 'BPMx', 'Status');
1770    %setfamilydata(1, 'BPMz', 'Status');
1771    AO = getao;
1772    %setfamilydata(ones(length(AO.HCOR.ElementList),1)*5e-6*2, 'HCOR', 'Setpoint', 'DeltaRespMat');
1773    %setfamilydata(ones(length(AO.VCOR.ElementList),1)*5e-6*2, 'VCOR', 'Setpoint', 'DeltaRespMat');
1774    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m);
1775   
1776%% ModeNumber == 100 Laurent
1777elseif ModeNumber == 100
1778    % User mode - Laurent
1779    AD.OperationalMode = '2.7391 GeV, 18.2 10.3';
1780    AD.Energy = 2.7391;     % Make sure this is the same as bend2gev at the production lattice!
1781    ModeName = 'chasmann_green';
1782    OpsFileExtension = '_chasmann_green';
1783
1784    % AT lattice
1785    AD.ATModel = 'chasman_green';
1786    chasman_green;
1787
1788    % Golden TUNE is with the TUNE family
1789    % 18.20 / 10.30
1790    AO = getao;
1791    AO.TUNE.Monitor.Golden = [
1792        0.20
1793        0.30
1794        NaN];
1795
1796
1797    % Golden chromaticity is in the AD (Physics units)
1798    AD.Chromaticity.Golden = [2; 2];
1799
1800    setao(AO);
1801    setfamilydata(ones(120,1)*1e-5, 'HCOR', 'Setpoint', 'DeltaRespMat');
1802    setfamilydata(ones(120,1)*1e-5, 'VCOR', 'Setpoint', 'DeltaRespMat');
1803    % AO.(ifam).Setpoint.DeltaRespMat(:,:) = ones(nb,1)*0.5e-4*1; % 2*25 urad (half used for kicking)
1804    local_set_config_mode('normalconfig120');   
1805    local_setmagnetcoefficient(@magnetcoefficients_new_calib_new_modele_low_alpha_janv2010);
1806
1807 else
1808    error('Operational mode unknown');
1809end
1810
1811% Force units to hardware
1812switch2hw;
1813
1814% Activation of correctors of HU640
1815if ModeNumber == 6
1816    switchHU640Cor('ON');
1817else
1818    switchHU640Cor('OFF');
1819end
1820
1821% Set the AD directory path
1822setad(AD);
1823MMLROOT = setmmldirectories(AD.Machine, AD.SubMachine, ModeName, OpsFileExtension);
1824AD = getad;
1825
1826% SOLEIL specific path changes
1827
1828% Top Level Directories
1829
1830%AD.Directory.DataRoot       = fullfile(MMLROOT, 'measdata', 'SOLEIL', 'StorageRingdata', filesep);
1831% RUCHE
1832MMLDATAROOT = getmmldataroot;
1833AD.Directory.DataRoot       = fullfile(MMLDATAROOT, 'measdata', 'SOLEIL', 'StorageRingdata', filesep);
1834AD.Directory.Lattice        = fullfile(MMLROOT, 'machine', 'SOLEIL', 'StorageRing', 'Lattices', filesep);
1835AD.Directory.Orbit          = fullfile(MMLROOT, 'machine', 'SOLEIL', 'StorageRing',  'orbit', filesep);
1836
1837% Data Archive Directories DO NOT REMOVE LINES
1838AD.Directory.BeamUser       = fullfile(AD.Directory.DataRoot, 'BPM', 'BeamUser', filesep); %store saved orbit for operation (every new beam)
1839AD.Directory.BPMData        = fullfile(AD.Directory.DataRoot, 'BPM', filesep);
1840AD.Directory.TuneData       = fullfile(AD.Directory.DataRoot, 'Tune', filesep);
1841AD.Directory.ChroData       = fullfile(AD.Directory.DataRoot, 'Chromaticity', filesep);
1842AD.Directory.DispData       = fullfile(AD.Directory.DataRoot, 'Dispersion', filesep);
1843AD.Directory.ConfigData     = fullfile(MMLROOT, 'machine', 'SOLEIL', 'StorageRing', 'MachineConfig', filesep);
1844AD.Directory.BumpData       = fullfile(AD.Directory.DataRoot, 'Bumps', filesep);
1845AD.Directory.Archiving      = fullfile(AD.Directory.DataRoot, 'ArchivingData', filesep);
1846AD.Directory.QUAD           = fullfile(AD.Directory.DataRoot, 'QUAD', filesep);
1847AD.Directory.BBA            = fullfile(AD.Directory.DataRoot, 'BBA', filesep);
1848AD.Directory.BBAcurrent     = fullfile(AD.Directory.BBA, 'dafault' ,filesep);
1849AD.Directory.PINHOLE        = fullfile(AD.Directory.DataRoot, 'PINHOLE', filesep);
1850AD.Directory.Synchro        = fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'synchro', filesep);
1851AD.Directory.LOCOData       = fullfile(AD.Directory.DataRoot, 'LOCO', filesep);
1852
1853% Insertion Devices
1854HOMEDIR = getenv('HOME');
1855AD.Directory.HU80_TEMPO     = fullfile(HOMEDIR, 'GrpGMI', 'HU80_TEMPO', filesep);
1856AD.Directory.HU80_PLEIADES  = fullfile(HOMEDIR, 'GrpGMI', 'HU80_PLEIADES', filesep);
1857AD.Directory.HU80_SEXTANTS  = fullfile(HOMEDIR, 'GrpGMI', 'HU80_SEXTANTS', filesep);
1858AD.Directory.HU60_CASSIOPEE = fullfile(HOMEDIR, 'GrpGMI', 'HU60_CASSIOPEE', filesep);
1859AD.Directory.HU60_ANTARES   = fullfile(HOMEDIR, 'GrpGMI', 'HU60_ANTARES', filesep);
1860AD.Directory.U20_PROXIMA1   = fullfile(HOMEDIR, 'GrpGMI', 'U20_PROXIMA1', filesep);
1861AD.Directory.U20_SWING      = fullfile(HOMEDIR, 'GrpGMI', 'U20_SWING', filesep);
1862AD.Directory.U20_CRISTAL    = fullfile(HOMEDIR, 'GrpGMI', 'U20_CRISTAL', filesep);
1863AD.Directory.U20_SIXS       = fullfile(HOMEDIR, 'GrpGMI', 'U20_SIXS', filesep);
1864AD.Directory.U20_GALAXIES   = fullfile(HOMEDIR, 'GrpGMI', 'U20_GALAXIES', filesep);
1865AD.Directory.U24_PXIIA      = fullfile(HOMEDIR, 'GrpGMI', 'U24_PXIIA ', filesep);
1866AD.Directory.WSV50_PSICHE   = fullfile(HOMEDIR, 'GrpGMI', 'WSV50_PSICHE ', filesep);
1867AD.Directory.HU640_DESIRS   = fullfile(HOMEDIR, 'GrpGMI', 'HU640_DESIRS', filesep);
1868AD.Directory.HU256_CASSIOPEE= fullfile(HOMEDIR, 'GrpGMI', 'HU256_CASSIOPEE', filesep);
1869AD.Directory.HU256_PLEIADES = fullfile(HOMEDIR, 'GrpGMI', 'HU256_PLEIADES', filesep);
1870AD.Directory.HU256_ANTARES  = fullfile(HOMEDIR, 'GrpGMI', 'HU256_ANTARES', filesep);
1871AD.Directory.HU42_HERMES    = fullfile(HOMEDIR, 'GrpGMI', 'HU42_HERMES', filesep);
1872AD.Directory.HU44_TEMPO     = fullfile(HOMEDIR, 'GrpGMI', 'HU44_TEMPO', filesep);
1873AD.Directory.HU44_SEXTANTS  = fullfile(HOMEDIR, 'GrpGMI', 'HU44_SEXTANTS', filesep);
1874AD.Directory.HU52_DEIMOS    = fullfile(HOMEDIR, 'GrpGMI', 'HU52_DEIMOS', filesep);
1875AD.Directory.HU65_DEIMOS    = fullfile(HOMEDIR, 'GrpGMI', 'HU65_DEIMOS', filesep);
1876AD.Directory.HU52_LUCIA     = fullfile(HOMEDIR, 'GrpGMI', 'HU52_LUCIA', filesep);
1877AD.Directory.HU36_SIRIUS    = fullfile(HOMEDIR, 'GrpGMI', 'HU36_SIRIUS', filesep);
1878AD.Directory.HU64_HERMES    = fullfile(HOMEDIR, 'GrpGMI', 'HU64_HERMES', filesep);
1879AD.Directory.U18_TOMO       = fullfile(HOMEDIR, 'GrpGMI', 'U18_TOMO', filesep);
1880AD.Directory.U20_NANO       = fullfile(HOMEDIR, 'GrpGMI', 'U20_NANO', filesep);
1881
1882
1883% STANDALONE matlab applications
1884AD.Directory.Standalone     = fullfile(MMLROOT, 'machine', 'SOLEIL', 'standalone_applications', filesep);
1885
1886% FOFB matlab applications
1887AD.Directory.FOFBdata     = fullfile(AD.Directory.DataRoot, 'FOFB');
1888
1889% For coupling correction. Used by coupling.m
1890AD.Directory.Coupling     = fullfile(AD.Directory.DataRoot, 'SkewQuad', 'solution_QT');
1891
1892% AD.Directory.InterlockData  = fullfile(AD.Directory.DataRoot, 'Interlock/'];
1893
1894%Response Matrix Directories
1895AD.Directory.BPMResponse    = fullfile(AD.Directory.DataRoot, 'Response', 'BPM', filesep);
1896AD.Directory.TuneResponse   = fullfile(AD.Directory.DataRoot, 'Response', 'Tune', filesep);
1897AD.Directory.ChroResponse   = fullfile(AD.Directory.DataRoot, 'Response', 'Chrom', filesep);
1898AD.Directory.DispResponse   = fullfile(AD.Directory.DataRoot, 'Response', 'Disp', filesep);
1899AD.Directory.SkewResponse   = fullfile(AD.Directory.DataRoot, 'Response', 'Skew', filesep);
1900
1901% used by energytunette
1902AD.Directory.BPMTransport   = fullfile(AD.Directory.DataRoot, 'Transport', 'BPM', filesep);
1903% used by MAT's Steerette application
1904AD.Directory.Steerette     = fullfile(AD.Directory.DataRoot, 'Transport', 'Steerette', filesep);
1905
1906% Postmortem DATA
1907AD.Directory.BPMPostmortem    = fullfile(AD.Directory.DataRoot, 'Postmortem', 'BPMPostmortem', filesep);
1908AD.Directory.RFPostmortem     = fullfile(AD.Directory.DataRoot, 'Postmortem', 'RFPostmortem', filesep);
1909
1910%Default Data File Prefix
1911AD.Default.BPMArchiveFile      = 'BPM';                %file in AD.Directory.BPM               orbit data
1912AD.Default.TuneArchiveFile     = 'Tune';               %file in AD.Directory.Tune              tune data
1913AD.Default.ChroArchiveFile     = 'Chro';               %file in AD.Directory.Chromaticity       chromaticity data
1914AD.Default.DispArchiveFile     = 'Disp';               %file in AD.Directory.Dispersion       dispersion data
1915AD.Default.CNFArchiveFile      = 'CNF';                %file in AD.Directory.CNF               configuration data
1916AD.Default.QUADArchiveFile     = 'QuadBeta';           %file in AD.Directory.QUAD             betafunction for quadrupoles
1917AD.Default.PINHOLEArchiveFile  = 'Pinhole';            %file in AD.Directory.PINHOLE             pinhole data
1918AD.Default.SkewArchiveFile     = 'SkewQuad';           %file in AD.Directory.SkewQuad             SkewQuad data
1919AD.Default.BBAArchiveFile      = 'BBA_DKmode';         %file in AD.Directory.BBA             BBA DK mode data
1920
1921%Default Response Matrix File Prefix
1922AD.Default.BPMRespFile      = 'BPMRespMat';         %file in AD.Directory.BPMResponse       BPM response matrices
1923AD.Default.TuneRespFile     = 'TuneRespMat';        %file in AD.Directory.TuneResponse      tune response matrices
1924AD.Default.ChroRespFile     = 'ChroRespMat';        %file in AD.Directory.ChroResponse      chromaticity response matrices
1925AD.Default.DispRespFile     = 'DispRespMat';        %file in AD.Directory.DispResponse      dispersion response matrices
1926AD.Default.SkewRespFile     = 'SkewRespMat';        %file in AD.Directory.SkewResponse      skew quadrupole response matrices
1927
1928%Orbit Control and Feedback Files
1929AD.Restore.GlobalFeedback   = 'Restore.m';
1930
1931% Circumference
1932AD.Circumference = findspos(THERING,length(THERING)+1);
1933setad(AD);
1934
1935% Updates the AT indices in the MiddleLayer with the present AT lattice
1936updateatindex;
1937
1938% Set the model energy
1939setenergymodel(AD.Energy);
1940
1941
1942% Momentum compaction factor
1943MCF = getmcf('Model');
1944if isnan(MCF)
1945    AD.MCF = 4.498325442923014e-04;
1946    fprintf('   Model alpha calculation failed, middlelayer alpha set to  %f\n', AD.MCF);
1947else
1948    AD.MCF = MCF;
1949    fprintf('   Middlelayer alpha set to %f (AT model).\n', AD.MCF);
1950end
1951setad(AD);
1952
1953
1954% Add Gain & Offsets for magnet family
1955fprintf('   Setting magnet monitor gains based on the production lattice.\n');
1956%setgainsandoffsets;
1957
1958%% Config texttalker (right location ?)
1959AD.TANGO.TEXTTALKERS={'ans/ca/texttalker.1', 'ans/ca/texttalker.2'};
1960
1961% set LOCO gain and roll to zero
1962setlocodata('Nominal');
1963
1964%%%%%%%%%%%%%%%%%%%%%%
1965% Final mode changes %
1966%%%%%%%%%%%%%%%%%%%%%%
1967if any(ModeNumber == [99])
1968    % User mode - 2.75 GeV, Nominal lattice
1969
1970    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1971    % Add LOCO Parameters to AO and AT-Model %
1972    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1973    %     'Nominal'    - Sets nominal gains (1) / rolls (0) to the model.
1974    %     'SetGains'   - Set gains/coupling from a LOCO file.
1975    %     'SetModel'   - Set the model from a LOCO file.  But it only changes
1976    %                    the part of the model that does not get corrected
1977    %                    in 'Symmetrize' (also does a SetGains).
1978    %     'LOCO2Model' - Set the model from a LOCO file (also does a SetGains).
1979    %                    This sets all lattice machines fit in the LOCO run to the model.
1980    %
1981    % Basically, use 'SetGains' or 'SetModel' if the LOCO run was applied to the accelerator
1982    %            use 'LOCO2Model' if the LOCO run was made after the final setup
1983
1984    % Store the LOCO file in the opsdata directory
1985
1986    % MCF depends on optics !!!
1987
1988    AD.OpsData.LOCOFile = [getfamilydata('Directory','OpsData'),'LOCO_163Quads_122BPMs'];
1989   
1990    try % TO BE DONE LATER IN 2012
1991        setlocodata('LOCO2Model', AD.OpsData.LOCOFile);
1992    catch
1993        fprintf('\n%s\n\n', lasterr);
1994        fprintf('   WARNING: there was a problem calibrating the model based on LOCO file %s.\n', AD.OpsData.LOCOFile);
1995    end
1996
1997else
1998    setlocodata('Nominal');
1999end
2000
2001fprintf('   lattice files have changed or if the AT lattice has changed.\n');
2002fprintf('   Middlelayer setup for operational mode: %s\n', AD.OperationalMode);
2003
2004setad(orderfields(AD));
2005
2006end
2007
2008function local_setmagnetcoefficient(magnetcoeff_function)
2009% quadrupole magnet coefficients
2010% number of status 1 quadrupole families
2011
2012AO = getao;
2013   
2014quadFamList = {'Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6', ...
2015         'Q7', 'Q8', 'Q9', 'Q10'};
2016   
2017if family2status('Q11',1),
2018        quadFamList = [quadFamList, {'Q11'}];
2019end
2020   
2021if family2status('Q12',1),
2022        quadFamList = [quadFamList, {'Q12'}];
2023end
2024       
2025   
2026for k = 1:length(quadFamList),
2027        ifam = quadFamList{k};
2028
2029        HW2PhysicsParams = feval(magnetcoeff_function, AO.(ifam).FamilyName);
2030        Physics2HWParams = HW2PhysicsParams;
2031
2032        nb = size(AO.(ifam).DeviceName,1);
2033
2034        for ii=1:nb,
2035            val = 1.0;
2036            AO.(ifam).Monitor.HW2PhysicsParams{1}(ii,:)                 = HW2PhysicsParams;
2037            AO.(ifam).Monitor.HW2PhysicsParams{2}(ii,:)                 = val;
2038            AO.(ifam).Monitor.Physics2HWParams{1}(ii,:)                 = Physics2HWParams;
2039            AO.(ifam).Monitor.Physics2HWParams{2}(ii,:)                 = val;
2040            AO.(ifam).Setpoint.HW2PhysicsParams{1}(ii,:)                = HW2PhysicsParams;
2041            AO.(ifam).Setpoint.HW2PhysicsParams{2}(ii,:)                = val;
2042            AO.(ifam).Setpoint.Physics2HWParams{1}(ii,:)                = Physics2HWParams;
2043            AO.(ifam).Setpoint.Physics2HWParams{2}(ii,:)                = val;
2044        end
2045end
2046
2047% sextupole magnet coefficients
2048% number of status 1 sextupole families
2049sextuFamList = {'S1', 'S2', 'S3', 'S4', 'S5', 'S6', ...
2050         'S7', 'S8', 'S9', 'S10'};
2051   
2052if family2status('S11',1),
2053        sextuFamList = [sextuFamList, {'S11'}];
2054end
2055   
2056if family2status('S12',1),
2057        sextuFamList = [sextuFamList, {'S12'}];
2058end
2059
2060for k = 1:length(sextuFamList),
2061        ifam = sextuFamList{k};
2062       
2063        HW2PhysicsParams = feval(magnetcoeff_function, AO.(ifam).FamilyName);
2064        Physics2HWParams = HW2PhysicsParams;
2065       
2066        val = 1.0;
2067        AO.(ifam).Monitor.HW2PhysicsParams{1}(1,:)                 = HW2PhysicsParams;
2068        AO.(ifam).Monitor.HW2PhysicsParams{2}(1,:)                 = val;
2069        AO.(ifam).Monitor.Physics2HWParams{1}(1,:)                 = Physics2HWParams;
2070        AO.(ifam).Monitor.Physics2HWParams{2}(1,:)                 = val;
2071        AO.(ifam).Setpoint.HW2PhysicsParams{1}(1,:)                 = HW2PhysicsParams;
2072        AO.(ifam).Setpoint.HW2PhysicsParams{2}(1,:)                 = val;
2073        AO.(ifam).Setpoint.Physics2HWParams{1}(1,:)                 = Physics2HWParams;
2074        AO.(ifam).Setpoint.Physics2HWParams{2}(1,:)                 = val;
2075end
2076setao(AO);
2077
2078end
2079
2080
2081function  local_set_config_mode(configmode)
2082% Function for activating new families of quadrupole and sextupoles
2083% magnets.
2084
2085switch(configmode)
2086    case 'S11config120' % with S11 120 BPMs to be obsolete
2087        setfamilydata(1, 'S11', 'Status')
2088        setfamilydata(0, 'S12', 'Status')
2089        setfamilydata(0, 'Q11', 'Status')
2090        setfamilydata(0, 'Q12', 'Status')
2091        setfamilydata(0, 'HCOR', 'Status', [13 8]);
2092        setfamilydata(0, 'VCOR', 'Status', [13 9]);
2093        setfamilydata(0, 'CycleHCOR', 'Status', [13 8]);
2094        setfamilydata(0, 'CycleVCOR', 'Status', [13 9]);
2095        setfamilydata(0, 'BPMx', 'Status', [13 8; 13 9]);
2096        setfamilydata(0, 'BPMz', 'Status', [13 8; 13 9]);
2097    case 'S11config122' % with S11 122 BPMs
2098        setfamilydata(1, 'S11', 'Status')
2099        setfamilydata(0, 'S12', 'Status')
2100        setfamilydata(0, 'Q11', 'Status')
2101        setfamilydata(0, 'Q12', 'Status')
2102        setfamilydata(1, 'HCOR', 'Status', [13 8]);
2103        setfamilydata(1, 'VCOR', 'Status', [13 9]);
2104        setfamilydata(1, 'CycleHCOR', 'Status', [13 8]);
2105        setfamilydata(1, 'CycleVCOR', 'Status', [13 9]);
2106        setfamilydata(1, 'BPMx', 'Status', [13 8; 13 9]);
2107        setfamilydata(1, 'BPMz', 'Status', [13 8; 13 9]);
2108    case 'normalconfig' % without S11 120 BPMs to be obsolete
2109        setfamilydata(0, 'S11', 'Status')
2110        setfamilydata(0, 'S12', 'Status')
2111        setfamilydata(0, 'Q11', 'Status')
2112        setfamilydata(0, 'Q12', 'Status')
2113        setfamilydata(0, 'HCOR', 'Status', [13 8]);
2114        setfamilydata(0, 'VCOR', 'Status', [13 9]);
2115        setfamilydata(0, 'CycleHCOR', 'Status', [13 8]);
2116        setfamilydata(0, 'CycleVCOR', 'Status', [13 9]);
2117        setfamilydata(0, 'BPMx', 'Status', [13 8; 13 9]);
2118        setfamilydata(0, 'BPMz', 'Status', [13 8; 13 9]);
2119    case 'nanoscopiumconfig120' % 120 BPMs to be obsolete
2120        setfamilydata(1, 'S11', 'Status')
2121        setfamilydata(1, 'S12', 'Status')
2122        setfamilydata(1, 'Q11', 'Status')
2123        setfamilydata(1, 'Q12', 'Status')
2124        setfamilydata(0, 'HCOR', 'Status', [13 8]);
2125        setfamilydata(0, 'VCOR', 'Status', [13 9]);
2126        setfamilydata(0, 'CycleHCOR', 'Status', [13 8]);
2127        setfamilydata(0, 'CycleVCOR', 'Status', [13 9]);
2128        setfamilydata(0, 'BPMx', 'Status', [13 8; 13 9]);
2129        setfamilydata(0, 'BPMz', 'Status', [13 8; 13 9]);
2130    case 'nanoscopiumconfig122' % 122 BPMs
2131        setfamilydata(1, 'S11', 'Status')
2132        setfamilydata(1, 'S12', 'Status')
2133        setfamilydata(1, 'Q11', 'Status')
2134        setfamilydata(1, 'Q12', 'Status')
2135        setfamilydata(0, 'HCOR', 'Status', [13 8]);
2136        setfamilydata(0, 'VCOR', 'Status', [13 9]);
2137        setfamilydata(0, 'CycleHCOR', 'Status', [13 8]);
2138        setfamilydata(0, 'CycleVCOR', 'Status', [13 9]);
2139        setfamilydata(1, 'BPMx', 'Status', [13 8; 13 9]);
2140        setfamilydata(1, 'BPMz', 'Status', [13 8; 13 9]);
2141    case 'nanoscopiumconfig122C'
2142        setfamilydata(1, 'S11', 'Status')
2143        setfamilydata(1, 'S12', 'Status')
2144        setfamilydata(1, 'Q11', 'Status')
2145        setfamilydata(1, 'Q12', 'Status')
2146        setfamilydata(1, 'HCOR', 'Status', [13 8]);
2147        setfamilydata(1, 'VCOR', 'Status', [13 9]);
2148        setfamilydata(1, 'CycleHCOR', 'Status', [13 8]);
2149        setfamilydata(1, 'CycleVCOR', 'Status', [13 9]);
2150        setfamilydata(1, 'BPMx', 'Status', [13 8; 13 9]);
2151        setfamilydata(1, 'BPMz', 'Status', [13 8; 13 9]);
2152    otherwise
2153        error('Wrong mode')
2154end
2155
2156% switch addition corrector for HU640... TO BE REMOVED LATER
2157switchHU640Cor('OFF');
2158end
Note: See TracBrowser for help on using the repository browser.