1 | function setoperationalmode(ModeNumber) |
---|
2 | %SETOPERATIONALMODE - Switches between the various operational modes, and |
---|
3 | % set the AD(Accelerator Data) storage path. |
---|
4 | % |
---|
5 | % setoperationalmode(ModeNumber) |
---|
6 | % |
---|
7 | % Modified for ThomX by Jianfeng Zhang @ LAL, 22/06/2013 |
---|
8 | % |
---|
9 | % INPUTS |
---|
10 | % ModeNumber 1 = |
---|
11 | % CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP |
---|
12 | % |
---|
13 | % ModeNumber 2 = |
---|
14 | % CDR_017_064_r56_02_sx_Dff_corrSX_BPMIP |
---|
15 | % |
---|
16 | % ModeNumber 3 = |
---|
17 | % CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP |
---|
18 | % but with the definitions of septums and inj.&extr. kickers |
---|
19 | % |
---|
20 | % |
---|
21 | % ModeNumber 100 = |
---|
22 | % CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF |
---|
23 | % without dipole fringe field. |
---|
24 | % |
---|
25 | % |
---|
26 | % See also aoinit, updateatindex, thomxinit, setmmldirectories, lattice_prep |
---|
27 | |
---|
28 | % NOTES |
---|
29 | % use local_set_config_mode for defining status of S11 et S12; |
---|
30 | |
---|
31 | % |
---|
32 | % Written by Laurent S. Nadolski |
---|
33 | % FOR CVS |
---|
34 | % $Header$ |
---|
35 | global THERING |
---|
36 | |
---|
37 | % Check if the AO exists |
---|
38 | checkforao; |
---|
39 | |
---|
40 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
41 | % Accelerator Dependent Modes % |
---|
42 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
43 | if nargin < 1 |
---|
44 | ModeNumber = []; |
---|
45 | end |
---|
46 | if isempty(ModeNumber) |
---|
47 | ModeCell = {... |
---|
48 | ' 1/ 0.05 GeV, 3.175 1.72', ... |
---|
49 | }; |
---|
50 | [ModeNumber, OKFlag] = listdlg('Name','THOMX','PromptString','Select the Operational Mode:', ... |
---|
51 | 'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [450 200], 'InitialValue', 1); |
---|
52 | if OKFlag ~= 1 |
---|
53 | fprintf(' Operational mode not changed\n'); |
---|
54 | return |
---|
55 | end |
---|
56 | end |
---|
57 | |
---|
58 | |
---|
59 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
60 | % Accelerator Data Structure % |
---|
61 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
62 | AD = getad; |
---|
63 | AD.Machine = 'THOMX'; % Will already be defined if setpathmml was used |
---|
64 | AD.MachineType = 'StorageRing'; % Will already be defined if setpathmml was used |
---|
65 | AD.SubMachine = 'StorageRing'; % Will already be defined if setpathmml was used |
---|
66 | AD.OperationalMode = ''; % Gets filled in later |
---|
67 | AD.HarmonicNumber = 28; |
---|
68 | |
---|
69 | % Defaults RF for dispersion and chromaticity measurements (must be in Hardware units) |
---|
70 | % minimum orbit change 14 micro meter. |
---|
71 | AD.DeltaRFDisp = 100e-6*1e2; % machine unit [MHz], 10000 Hz; called by measdisp.m |
---|
72 | % the mcf of ThomX ring is 1.37e-2, so must have a relative large deltaRF, |
---|
73 | % otherwise the change of energy offset is too small, and BPMs can't |
---|
74 | % detect such a small orbit (BPM resolution is about 5 micro meters in ThomX ring). |
---|
75 | |
---|
76 | |
---|
77 | AD.DeltaRFChro = [-100 -50 0 50 100] * 1e-6*1e2; % machine unit, [MHz]; -50*1e2 Hz |
---|
78 | |
---|
79 | |
---|
80 | % Tune processor delay: delay required to wait |
---|
81 | % to have a fresh tune measurement after changing |
---|
82 | % a variable like the RF frequency. Setpv will wait |
---|
83 | % 2.2 * TuneDelay to be guaranteed a fresh data point. |
---|
84 | %AD.BPMDelay = 0.25; % use [N, BPMDelay]=getbpmaverages (AD.BPMDelay will disappear) |
---|
85 | AD.TuneDelay = 1; |
---|
86 | |
---|
87 | % The offset and golden orbits are stored at the end of this file |
---|
88 | % TODO |
---|
89 | %BuildOffsetAndGoldenOrbits; % Local function |
---|
90 | |
---|
91 | |
---|
92 | % SP-AM Error level |
---|
93 | % AD.ErrorWarningLevel = 0 -> SP-AM errors are Matlab errors {Default} |
---|
94 | % -1 -> SP-AM errors are Matlab warnings |
---|
95 | % -2 -> SP-AM errors prompt a dialog box |
---|
96 | % -3 -> SP-AM errors are ignored (ErrorFlag=-1 is returned) |
---|
97 | AD.ErrorWarningLevel = 0; |
---|
98 | |
---|
99 | %%%%%%%%%%%%%%%%%%%%% |
---|
100 | % Operational Modes % |
---|
101 | %%%%%%%%%%%%%%%%%%%%% |
---|
102 | |
---|
103 | % Mode setup variables (mostly path and file names) |
---|
104 | % AD.OperationalMode - String used in titles |
---|
105 | % ModeName - String used for mode directory name off DataRoot/MachineName |
---|
106 | % OpsFileExtension - string add to default file names |
---|
107 | |
---|
108 | %% ModeNumber == 1, nu_x,y = 3.175/1.72 |
---|
109 | if ModeNumber == 1 |
---|
110 | AD.OperationalMode = '50e-3 GeV, 3.175 1.72'; |
---|
111 | AD.Energy = 50e-3; % Make sure this is the same as bend2gev at the production lattice! |
---|
112 | ModeName = 'CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP'; |
---|
113 | OpsFileExtension = '_CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP'; |
---|
114 | |
---|
115 | % AT lattice |
---|
116 | AD.ATModel = 'CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP'; |
---|
117 | eval(AD.ATModel); %run model for compiler; |
---|
118 | |
---|
119 | % Golden TUNE is with the TUNE family |
---|
120 | % 18.2020 / 10.3170 |
---|
121 | AO = getao; |
---|
122 | AO.TUNE.Monitor.Golden = [ |
---|
123 | 0.175 |
---|
124 | 0.720 |
---|
125 | NaN]; |
---|
126 | |
---|
127 | % Golden chromaticity is in the AD (Physics units) |
---|
128 | AD.Chromaticity.Golden = [0.0; 0.0]; |
---|
129 | |
---|
130 | % Status factory |
---|
131 | % don't need for ThomX ????? |
---|
132 | %local_set_config_mode('normalconfig120'); d |
---|
133 | %AO = local_setmagnetcoefficient(AO, @magnetcoefficients); |
---|
134 | %setao(AO); |
---|
135 | elseif ModeNumber == 2 |
---|
136 | % % User mode - nominal lattice 2010 until installation of S11 and S12 |
---|
137 | AD.OperationalMode = '50e-3 GeV, 3.175 1.64'; |
---|
138 | AD.Energy = 50e-3; % Make sure this is the same as bend2gev at the production lattice! |
---|
139 | ModeName = 'CDR_017_064_r56_02_sx_Dff_corrSX_BPMIP'; |
---|
140 | OpsFileExtension = '_CDR_017_064_r56_02_sx_Dff_corrSX_BPMIP'; |
---|
141 | |
---|
142 | % AT lattice |
---|
143 | AD.ATModel = 'CDR_017_064_r56_02_sx_Dff_corrSX_BPMIP'; |
---|
144 | eval(AD.ATModel); %run model for compiler; |
---|
145 | |
---|
146 | % Golden TUNE is with the TUNE family |
---|
147 | AO = getao; |
---|
148 | AO.TUNE.Monitor.Golden = [ |
---|
149 | 0.175 |
---|
150 | 0.640 |
---|
151 | NaN]; |
---|
152 | |
---|
153 | % Golden chromaticity is in the AD (Physics units) |
---|
154 | AD.Chromaticity.Golden = [0; 0]; |
---|
155 | |
---|
156 | % Status factory |
---|
157 | % don't need for ThomX ????? |
---|
158 | %local_set_config_mode('normalconfig120'); d |
---|
159 | %AO = local_setmagnetcoefficient(AO, @magnetcoefficients); |
---|
160 | %setao(AO); |
---|
161 | elseif ModeNumber == 3 |
---|
162 | AD.OperationalMode = '50e-3 GeV, 3.175 1.72'; |
---|
163 | AD.Energy = 50e-3; % Make sure this is the same as bend2gev at the production lattice! |
---|
164 | ModeName = 'CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP_SEP'; |
---|
165 | OpsFileExtension = '_CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP_SEP'; |
---|
166 | |
---|
167 | % AT lattice |
---|
168 | AD.ATModel = 'CDR_017_072_r56_02_sx_Dff_corrSX_BPMIP_SEP'; |
---|
169 | eval(AD.ATModel); %run model for compiler; |
---|
170 | |
---|
171 | % Golden TUNE is with the TUNE family |
---|
172 | % 18.2020 / 10.3170 |
---|
173 | AO = getao; |
---|
174 | AO.TUNE.Monitor.Golden = [ |
---|
175 | 0.175 |
---|
176 | 0.720 |
---|
177 | NaN]; |
---|
178 | |
---|
179 | % Golden chromaticity is in the AD (Physics units) |
---|
180 | AD.Chromaticity.Golden = [0.0; 0.0]; |
---|
181 | |
---|
182 | % Status factory |
---|
183 | % don't need for ThomX ????? |
---|
184 | %local_set_config_mode('normalconfig120'); d |
---|
185 | %AO = local_setmagnetcoefficient(AO, @magnetcoefficients); |
---|
186 | %setao(AO); |
---|
187 | elseif ModeNumber == 100 |
---|
188 | AD.OperationalMode = '50e-3 GeV, 3.175 1.64'; |
---|
189 | AD.Energy = 50e-3; % Make sure this is the same as bend2gev at the production lattice! |
---|
190 | ModeName = 'CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF'; |
---|
191 | OpsFileExtension = '_CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF'; |
---|
192 | |
---|
193 | % AT lattice |
---|
194 | AD.ATModel = 'CDR_017_064_r56_02_sx_Dff_1_cro0_NoDipFF'; |
---|
195 | eval(AD.ATModel); %run model for compiler; |
---|
196 | |
---|
197 | % Golden TUNE is with the TUNE family |
---|
198 | AO = getao; |
---|
199 | AO.TUNE.Monitor.Golden = [ |
---|
200 | 0.175 |
---|
201 | 0.640 |
---|
202 | NaN]; |
---|
203 | |
---|
204 | % Golden chromaticity is in the AD (Physics units) |
---|
205 | AD.Chromaticity.Golden = [0.0; 0.0]; |
---|
206 | |
---|
207 | % Status factory |
---|
208 | % don't need for ThomX ????? |
---|
209 | %local_set_config_mode('normalconfig120'); d |
---|
210 | %AO = local_setmagnetcoefficient(AO, @magnetcoefficients); |
---|
211 | %setao(AO); |
---|
212 | |
---|
213 | else |
---|
214 | error('Operational mode unknown'); |
---|
215 | end |
---|
216 | |
---|
217 | % Force units to hardware |
---|
218 | switch2hw; |
---|
219 | |
---|
220 | |
---|
221 | % Set the AD directory path |
---|
222 | setad(AD); |
---|
223 | MMLROOT = setmmldirectories(AD.Machine, AD.SubMachine, ModeName, OpsFileExtension); |
---|
224 | AD = getad; |
---|
225 | |
---|
226 | % SOLEIL specific path changes |
---|
227 | |
---|
228 | % Top Level Directories |
---|
229 | |
---|
230 | %AD.Directory.DataRoot = fullfile(MMLROOT, 'measdata', 'SOLEIL', 'StorageRingdata', filesep); |
---|
231 | % RUCHE |
---|
232 | MMLDATAROOT = getmmldataroot; |
---|
233 | AD.Directory.DataRoot = fullfile(MMLDATAROOT, 'measdata', 'THOMX', 'StorageRingdata', filesep); |
---|
234 | AD.Directory.Lattice = fullfile(MMLROOT, 'machine', 'THOMX', 'StorageRing', 'Lattices', filesep); |
---|
235 | AD.Directory.Orbit = fullfile(MMLROOT, 'machine', 'THOMX', 'StorageRing', 'orbit', filesep); |
---|
236 | |
---|
237 | % Data Archive Directories DO NOT REMOVE LINES |
---|
238 | AD.Directory.BeamUser = fullfile(AD.Directory.DataRoot, 'BPM', 'BeamUser', filesep); %store saved orbit for operation (every new beam) |
---|
239 | AD.Directory.BPMData = fullfile(AD.Directory.DataRoot, 'BPM', filesep); |
---|
240 | AD.Directory.TuneData = fullfile(AD.Directory.DataRoot, 'Tune', filesep); |
---|
241 | AD.Directory.ChroData = fullfile(AD.Directory.DataRoot, 'Chromaticity', filesep); |
---|
242 | AD.Directory.DispData = fullfile(AD.Directory.DataRoot, 'Dispersion', filesep); |
---|
243 | AD.Directory.ConfigData = fullfile(MMLROOT, 'machine', 'THOMX', 'StorageRing', 'MachineConfig', filesep); |
---|
244 | AD.Directory.BumpData = fullfile(AD.Directory.DataRoot, 'Bumps', filesep); |
---|
245 | AD.Directory.Archiving = fullfile(AD.Directory.DataRoot, 'ArchivingData', filesep); |
---|
246 | AD.Directory.QUAD = fullfile(AD.Directory.DataRoot, 'QUAD', filesep); |
---|
247 | AD.Directory.BBA = fullfile(AD.Directory.DataRoot, 'BBA', filesep); |
---|
248 | AD.Directory.BBAcurrent = fullfile(AD.Directory.BBA, 'dafault' ,filesep); |
---|
249 | AD.Directory.Synchro = fullfile(MMLROOT, 'machine', 'THOMX', 'common', 'synchro', filesep); |
---|
250 | AD.Directory.LOCOData = fullfile(AD.Directory.DataRoot, 'LOCO', filesep); |
---|
251 | |
---|
252 | % Insertion Devices |
---|
253 | HOMEDIR = getenv('HOME'); |
---|
254 | |
---|
255 | |
---|
256 | % STANDALONE matlab applications |
---|
257 | AD.Directory.Standalone = fullfile(MMLROOT, 'machine', 'THOMX', 'standalone_applications', filesep); |
---|
258 | |
---|
259 | % FOFB matlab applications |
---|
260 | AD.Directory.FOFBdata = fullfile(AD.Directory.DataRoot, 'FOFB'); |
---|
261 | |
---|
262 | % For coupling correction. Used by coupling.m |
---|
263 | %AD.Directory.Coupling = fullfile(AD.Directory.DataRoot, 'SkewQuad', 'solution_QT'); |
---|
264 | |
---|
265 | % AD.Directory.InterlockData = fullfile(AD.Directory.DataRoot, 'Interlock/']; |
---|
266 | |
---|
267 | %Response Matrix Directories |
---|
268 | AD.Directory.BPMResponse = fullfile(AD.Directory.DataRoot, 'Response', 'BPM', filesep); |
---|
269 | AD.Directory.TuneResponse = fullfile(AD.Directory.DataRoot, 'Response', 'Tune', filesep); |
---|
270 | AD.Directory.ChroResponse = fullfile(AD.Directory.DataRoot, 'Response', 'Chrom', filesep); |
---|
271 | AD.Directory.DispResponse = fullfile(AD.Directory.DataRoot, 'Response', 'Disp', filesep); |
---|
272 | AD.Directory.SkewResponse = fullfile(AD.Directory.DataRoot, 'Response', 'Skew', filesep); |
---|
273 | |
---|
274 | % used by energytunette |
---|
275 | AD.Directory.BPMTransport = fullfile(AD.Directory.DataRoot, 'Transport', 'BPM', filesep); |
---|
276 | % used by MAT's Steerette application |
---|
277 | AD.Directory.Steerette = fullfile(AD.Directory.DataRoot, 'Transport', 'Steerette', filesep); |
---|
278 | |
---|
279 | |
---|
280 | %Default Data File Prefix |
---|
281 | AD.Default.BPMArchiveFile = 'BPM'; %file in AD.Directory.BPM orbit data |
---|
282 | AD.Default.TuneArchiveFile = 'Tune'; %file in AD.Directory.Tune tune data |
---|
283 | AD.Default.ChroArchiveFile = 'Chro'; %file in AD.Directory.Chromaticity chromaticity data |
---|
284 | AD.Default.DispArchiveFile = 'Disp'; %file in AD.Directory.Dispersion dispersion data |
---|
285 | AD.Default.CNFArchiveFile = 'CNF'; %file in AD.Directory.CNF configuration data |
---|
286 | AD.Default.QUADArchiveFile = 'QuadBeta'; %file in AD.Directory.QUAD betafunction for quadrupoles |
---|
287 | AD.Default.SkewArchiveFile = 'SkewQuad'; %file in AD.Directory.SkewQuad SkewQuad data |
---|
288 | AD.Default.BBAArchiveFile = 'BBA_DKmode'; %file in AD.Directory.BBA BBA DK mode data |
---|
289 | |
---|
290 | %Default Response Matrix File Prefix |
---|
291 | AD.Default.BPMRespFile = 'BPMRespMat'; %file in AD.Directory.BPMResponse BPM response matrices |
---|
292 | AD.Default.TuneRespFile = 'TuneRespMat'; %file in AD.Directory.TuneResponse tune response matrices |
---|
293 | AD.Default.ChroRespFile = 'ChroRespMat'; %file in AD.Directory.ChroResponse chromaticity response matrices |
---|
294 | AD.Default.DispRespFile = 'DispRespMat'; %file in AD.Directory.DispResponse dispersion response matrices |
---|
295 | AD.Default.SkewRespFile = 'SkewRespMat'; %file in AD.Directory.SkewResponse skew quadrupole response matrices |
---|
296 | |
---|
297 | %Orbit Control and Feedback Files |
---|
298 | AD.Restore.GlobalFeedback = 'Restore.m'; |
---|
299 | |
---|
300 | % Circumference |
---|
301 | AD.Circumference = findspos(THERING,length(THERING)+1); |
---|
302 | setad(AD); |
---|
303 | |
---|
304 | % Updates the AT indices in the MiddleLayer with the present AT lattice |
---|
305 | updateatindex; |
---|
306 | |
---|
307 | % Set the model energy |
---|
308 | setenergymodel(AD.Energy); |
---|
309 | |
---|
310 | |
---|
311 | % Momentum compaction factor |
---|
312 | MCF = getmcf('Model'); |
---|
313 | if isnan(MCF) |
---|
314 | AD.MCF = 1.1366e-02; |
---|
315 | fprintf(' Model alpha calculation failed, middlelayer alpha set to %f\n', AD.MCF); |
---|
316 | else |
---|
317 | AD.MCF = MCF; |
---|
318 | fprintf(' Middlelayer alpha set to %f (AT model).\n', AD.MCF); |
---|
319 | end |
---|
320 | setad(AD); |
---|
321 | |
---|
322 | |
---|
323 | % Add Gain & Offsets for magnet family |
---|
324 | fprintf(' Setting magnet monitor gains based on the production lattice.\n'); |
---|
325 | %setgainsandoffsets; |
---|
326 | |
---|
327 | %% Config texttalker (right location ?), what's it? |
---|
328 | %AD.TANGO.TEXTTALKERS={'ans/ca/texttalker.1', 'ans/ca/texttalker.2'}; |
---|
329 | |
---|
330 | % set LOCO gain and roll to zero |
---|
331 | %setlocodata('Nominal'); |
---|
332 | |
---|
333 | %%%%%%%%%%%%%%%%%%%%%% |
---|
334 | % Final mode changes % |
---|
335 | %%%%%%%%%%%%%%%%%%%%%% |
---|
336 | if any(ModeNumber == [99]) |
---|
337 | % User mode - 0.05 GeV, Nominal lattice |
---|
338 | |
---|
339 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
340 | % Add LOCO Parameters to AO and AT-Model % |
---|
341 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
342 | % 'Nominal' - Sets nominal gains (1) / rolls (0) to the model. |
---|
343 | % 'SetGains' - Set gains/coupling from a LOCO file. |
---|
344 | % 'SetModel' - Set the model from a LOCO file. But it only changes |
---|
345 | % the part of the model that does not get corrected |
---|
346 | % in 'Symmetrize' (also does a SetGains). |
---|
347 | % 'LOCO2Model' - Set the model from a LOCO file (also does a SetGains). |
---|
348 | % This sets all lattice machines fit in the LOCO run to the model. |
---|
349 | % |
---|
350 | % Basically, use 'SetGains' or 'SetModel' if the LOCO run was applied to the accelerator |
---|
351 | % use 'LOCO2Model' if the LOCO run was made after the final setup |
---|
352 | |
---|
353 | % Store the LOCO file in the opsdata directory |
---|
354 | |
---|
355 | % MCF depends on optics !!! |
---|
356 | |
---|
357 | AD.OpsData.LOCOFile = [getfamilydata('Directory','OpsData'),'LOCO_163Quads_122BPMs']; |
---|
358 | |
---|
359 | try % TO BE DONE LATER IN 2012 |
---|
360 | setlocodata('LOCO2Model', AD.OpsData.LOCOFile); |
---|
361 | catch |
---|
362 | fprintf('\n%s\n\n', lasterr); |
---|
363 | fprintf(' WARNING: there was a problem calibrating the model based on LOCO file %s.\n', AD.OpsData.LOCOFile); |
---|
364 | end |
---|
365 | |
---|
366 | else |
---|
367 | setlocodata('Nominal'); |
---|
368 | end |
---|
369 | |
---|
370 | fprintf(' lattice files have changed or if the AT lattice has changed.\n'); |
---|
371 | fprintf(' Middlelayer setup for operational mode: %s\n', AD.OperationalMode); |
---|
372 | |
---|
373 | setad(orderfields(AD)); |
---|
374 | |
---|
375 | end |
---|
376 | |
---|
377 | %% |
---|
378 | function local_setmagnetcoefficient(magnetcoeff_function) |
---|
379 | % quadrupole magnet coefficients |
---|
380 | % number of status 1 quadrupole families |
---|
381 | |
---|
382 | AO = getao; |
---|
383 | |
---|
384 | quadFamList = {'Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6', ... |
---|
385 | 'Q7', 'Q8', 'Q9', 'Q10'}; |
---|
386 | |
---|
387 | if family2status('Q11',1), |
---|
388 | quadFamList = [quadFamList, {'Q11'}]; |
---|
389 | end |
---|
390 | |
---|
391 | if family2status('Q12',1), |
---|
392 | quadFamList = [quadFamList, {'Q12'}]; |
---|
393 | end |
---|
394 | |
---|
395 | |
---|
396 | for k = 1:length(quadFamList), |
---|
397 | ifam = quadFamList{k}; |
---|
398 | |
---|
399 | HW2PhysicsParams = feval(magnetcoeff_function, AO.(ifam).FamilyName); |
---|
400 | Physics2HWParams = HW2PhysicsParams; |
---|
401 | |
---|
402 | nb = size(AO.(ifam).DeviceName,1); |
---|
403 | |
---|
404 | for ii=1:nb, |
---|
405 | val = 1.0; |
---|
406 | AO.(ifam).Monitor.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; |
---|
407 | AO.(ifam).Monitor.HW2PhysicsParams{2}(ii,:) = val; |
---|
408 | AO.(ifam).Monitor.Physics2HWParams{1}(ii,:) = Physics2HWParams; |
---|
409 | AO.(ifam).Monitor.Physics2HWParams{2}(ii,:) = val; |
---|
410 | AO.(ifam).Setpoint.HW2PhysicsParams{1}(ii,:) = HW2PhysicsParams; |
---|
411 | AO.(ifam).Setpoint.HW2PhysicsParams{2}(ii,:) = val; |
---|
412 | AO.(ifam).Setpoint.Physics2HWParams{1}(ii,:) = Physics2HWParams; |
---|
413 | AO.(ifam).Setpoint.Physics2HWParams{2}(ii,:) = val; |
---|
414 | end |
---|
415 | end |
---|
416 | |
---|
417 | % sextupole magnet coefficients |
---|
418 | % number of status 1 sextupole families |
---|
419 | sextuFamList = {'S1', 'S2', 'S3', 'S4', 'S5', 'S6', ... |
---|
420 | 'S7', 'S8', 'S9', 'S10'}; |
---|
421 | |
---|
422 | if family2status('S11',1), |
---|
423 | sextuFamList = [sextuFamList, {'S11'}]; |
---|
424 | end |
---|
425 | |
---|
426 | if family2status('S12',1), |
---|
427 | sextuFamList = [sextuFamList, {'S12'}]; |
---|
428 | end |
---|
429 | |
---|
430 | for k = 1:length(sextuFamList), |
---|
431 | ifam = sextuFamList{k}; |
---|
432 | |
---|
433 | HW2PhysicsParams = feval(magnetcoeff_function, AO.(ifam).FamilyName); |
---|
434 | Physics2HWParams = HW2PhysicsParams; |
---|
435 | |
---|
436 | val = 1.0; |
---|
437 | AO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams; |
---|
438 | AO.(ifam).Monitor.HW2PhysicsParams{2}(1,:) = val; |
---|
439 | AO.(ifam).Monitor.Physics2HWParams{1}(1,:) = Physics2HWParams; |
---|
440 | AO.(ifam).Monitor.Physics2HWParams{2}(1,:) = val; |
---|
441 | AO.(ifam).Setpoint.HW2PhysicsParams{1}(1,:) = HW2PhysicsParams; |
---|
442 | AO.(ifam).Setpoint.HW2PhysicsParams{2}(1,:) = val; |
---|
443 | AO.(ifam).Setpoint.Physics2HWParams{1}(1,:) = Physics2HWParams; |
---|
444 | AO.(ifam).Setpoint.Physics2HWParams{2}(1,:) = val; |
---|
445 | end |
---|
446 | setao(AO); |
---|
447 | |
---|
448 | end |
---|
449 | |
---|
450 | |
---|
451 | function local_set_config_mode(configmode) |
---|
452 | % Function for activating new families of quadrupole and sextupoles |
---|
453 | % magnets. |
---|
454 | |
---|
455 | switch(configmode) |
---|
456 | case 'S11config120' % with S11 120 BPMs to be obsolete |
---|
457 | setfamilydata(1, 'S11', 'Status') |
---|
458 | setfamilydata(0, 'S12', 'Status') |
---|
459 | setfamilydata(0, 'Q11', 'Status') |
---|
460 | setfamilydata(0, 'Q12', 'Status') |
---|
461 | setfamilydata(0, 'HCOR', 'Status', [13 8]); |
---|
462 | setfamilydata(0, 'VCOR', 'Status', [13 9]); |
---|
463 | setfamilydata(0, 'CycleHCOR', 'Status', [13 8]); |
---|
464 | setfamilydata(0, 'CycleVCOR', 'Status', [13 9]); |
---|
465 | setfamilydata(0, 'BPMx', 'Status', [13 8; 13 9]); |
---|
466 | setfamilydata(0, 'BPMz', 'Status', [13 8; 13 9]); |
---|
467 | case 'S11config122' % with S11 122 BPMs |
---|
468 | setfamilydata(1, 'S11', 'Status') |
---|
469 | setfamilydata(0, 'S12', 'Status') |
---|
470 | setfamilydata(0, 'Q11', 'Status') |
---|
471 | setfamilydata(0, 'Q12', 'Status') |
---|
472 | setfamilydata(1, 'HCOR', 'Status', [13 8]); |
---|
473 | setfamilydata(1, 'VCOR', 'Status', [13 9]); |
---|
474 | setfamilydata(1, 'CycleHCOR', 'Status', [13 8]); |
---|
475 | setfamilydata(1, 'CycleVCOR', 'Status', [13 9]); |
---|
476 | setfamilydata(1, 'BPMx', 'Status', [13 8; 13 9]); |
---|
477 | setfamilydata(1, 'BPMz', 'Status', [13 8; 13 9]); |
---|
478 | case 'normalconfig' % without S11 120 BPMs to be obsolete |
---|
479 | setfamilydata(0, 'S11', 'Status') |
---|
480 | setfamilydata(0, 'S12', 'Status') |
---|
481 | setfamilydata(0, 'Q11', 'Status') |
---|
482 | setfamilydata(0, 'Q12', 'Status') |
---|
483 | setfamilydata(0, 'HCOR', 'Status', [13 8]); |
---|
484 | setfamilydata(0, 'VCOR', 'Status', [13 9]); |
---|
485 | setfamilydata(0, 'CycleHCOR', 'Status', [13 8]); |
---|
486 | setfamilydata(0, 'CycleVCOR', 'Status', [13 9]); |
---|
487 | setfamilydata(0, 'BPMx', 'Status', [13 8; 13 9]); |
---|
488 | setfamilydata(0, 'BPMz', 'Status', [13 8; 13 9]); |
---|
489 | case 'nanoscopiumconfig120' % 120 BPMs to be obsolete |
---|
490 | setfamilydata(1, 'S11', 'Status') |
---|
491 | setfamilydata(1, 'S12', 'Status') |
---|
492 | setfamilydata(1, 'Q11', 'Status') |
---|
493 | setfamilydata(1, 'Q12', 'Status') |
---|
494 | setfamilydata(0, 'HCOR', 'Status', [13 8]); |
---|
495 | setfamilydata(0, 'VCOR', 'Status', [13 9]); |
---|
496 | setfamilydata(0, 'CycleHCOR', 'Status', [13 8]); |
---|
497 | setfamilydata(0, 'CycleVCOR', 'Status', [13 9]); |
---|
498 | setfamilydata(0, 'BPMx', 'Status', [13 8; 13 9]); |
---|
499 | setfamilydata(0, 'BPMz', 'Status', [13 8; 13 9]); |
---|
500 | case 'nanoscopiumconfig122' % 122 BPMs |
---|
501 | setfamilydata(1, 'S11', 'Status') |
---|
502 | setfamilydata(1, 'S12', 'Status') |
---|
503 | setfamilydata(1, 'Q11', 'Status') |
---|
504 | setfamilydata(1, 'Q12', 'Status') |
---|
505 | setfamilydata(0, 'HCOR', 'Status', [13 8]); |
---|
506 | setfamilydata(0, 'VCOR', 'Status', [13 9]); |
---|
507 | setfamilydata(0, 'CycleHCOR', 'Status', [13 8]); |
---|
508 | setfamilydata(0, 'CycleVCOR', 'Status', [13 9]); |
---|
509 | setfamilydata(1, 'BPMx', 'Status', [13 8; 13 9]); |
---|
510 | setfamilydata(1, 'BPMz', 'Status', [13 8; 13 9]); |
---|
511 | case 'nanoscopiumconfig122C' |
---|
512 | setfamilydata(1, 'S11', 'Status') |
---|
513 | setfamilydata(1, 'S12', 'Status') |
---|
514 | setfamilydata(1, 'Q11', 'Status') |
---|
515 | setfamilydata(1, 'Q12', 'Status') |
---|
516 | setfamilydata(1, 'HCOR', 'Status', [13 8]); |
---|
517 | setfamilydata(1, 'VCOR', 'Status', [13 9]); |
---|
518 | setfamilydata(1, 'CycleHCOR', 'Status', [13 8]); |
---|
519 | setfamilydata(1, 'CycleVCOR', 'Status', [13 9]); |
---|
520 | setfamilydata(1, 'BPMx', 'Status', [13 8; 13 9]); |
---|
521 | setfamilydata(1, 'BPMz', 'Status', [13 8; 13 9]); |
---|
522 | otherwise |
---|
523 | error('Wrong mode') |
---|
524 | end |
---|
525 | |
---|
526 | % switch addition corrector for HU640... TO BE REMOVED LATER |
---|
527 | switchHU640Cor('OFF'); |
---|
528 | end |
---|