1 | function setoperationalmode(ModeNumber) |
---|
2 | %SETOPERATIONALMODE - Switches between the various operational modes |
---|
3 | % setoperationalmode(ModeNumber) |
---|
4 | % |
---|
5 | % INPUTS |
---|
6 | % 1. ModeNumber = 1. 110 MeV, multibunch |
---|
7 | % 2. LT1 voie directe |
---|
8 | % 3. 80 MeV, backup Linac |
---|
9 | % |
---|
10 | % 100. Laurent's Mode |
---|
11 | % |
---|
12 | % See also aoinit, updateatindex, LT1init |
---|
13 | |
---|
14 | % |
---|
15 | % Written by Laurent S. Nadolski |
---|
16 | |
---|
17 | global THERING |
---|
18 | |
---|
19 | % Check if the AO exists |
---|
20 | checkforao; |
---|
21 | |
---|
22 | |
---|
23 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
24 | % Accelerator Dependent Modes % |
---|
25 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
26 | if nargin < 1 |
---|
27 | ModeNumber = []; |
---|
28 | end |
---|
29 | if isempty(ModeNumber) |
---|
30 | ModeCell = {'110 MeV, multibunch', 'LT1 voie directe', '80 MeV, backup Linac', ... |
---|
31 | 'Laurent''s Mode'}; |
---|
32 | [ModeNumber, OKFlag] = listdlg('Name','SOLEIL','PromptString','Select the Operational Mode:', 'SelectionMode','single', 'ListString', ModeCell, 'ListSize', [450 200]); |
---|
33 | if OKFlag ~= 1 |
---|
34 | fprintf(' Operational mode not changed\n'); |
---|
35 | return |
---|
36 | elseif ModeNumber == 4 |
---|
37 | ModeNumber = 100; % Laurent |
---|
38 | end |
---|
39 | end |
---|
40 | |
---|
41 | |
---|
42 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
43 | % Accelerator Data Structure % |
---|
44 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
45 | AD = getad; |
---|
46 | AD.Machine = 'SOLEIL'; % Will already be defined if setpathmml was used |
---|
47 | AD.MachineType = 'StorageRing'; % Will already be defined if setpathmml was used |
---|
48 | AD.SubMachine = 'LT1'; % Will already be defined if setpathmml was used |
---|
49 | AD.OperationalMode = ''; % Gets filled in later |
---|
50 | |
---|
51 | |
---|
52 | % Tune processor delay: delay required to wait |
---|
53 | % to have a fresh tune measurement after changing |
---|
54 | % a variable like the RF frequency. Setpv will wait |
---|
55 | % 2.2 * TuneDelay to be guaranteed a fresh data point. |
---|
56 | AD.BPMDelay = 0.25; % use [N, BPMDelay]=getbpmsaverages (AD.BPMDelay will disappear) |
---|
57 | AD.TuneDelay = 0.1; |
---|
58 | |
---|
59 | |
---|
60 | % SP-AM Error level |
---|
61 | % AD.ErrorWarningLevel = 0 -> SP-AM errors are Matlab errors {Default} |
---|
62 | % -1 -> SP-AM errors are Matlab warnings |
---|
63 | % -2 -> SP-AM errors prompt a dialog box |
---|
64 | % -3 -> SP-AM errors are ignored (ErrorFlag=-1 is returned) |
---|
65 | AD.ErrorWarningLevel = 0; |
---|
66 | |
---|
67 | %%%%%%%%%%%%%%%%%%%%% |
---|
68 | % Operational Modes % |
---|
69 | %%%%%%%%%%%%%%%%%%%%% |
---|
70 | |
---|
71 | % Mode setup variables (mostly path and file names) |
---|
72 | % AD.OperationalMode - String used in titles |
---|
73 | % ModeName - String used for mode directory name off DataRoot/MachineName |
---|
74 | % OpsFileExtension - string add to default file names |
---|
75 | |
---|
76 | if ModeNumber == 1 |
---|
77 | % LT1 Nominal Lattice |
---|
78 | AD.OperationalMode = '110 MeV, multibunch'; |
---|
79 | AD.Energy = 0.110; % Make sure this is the same as bend2gev at the production lattice! |
---|
80 | ModeName = 'bareLT1lattice'; |
---|
81 | OpsFileExtension = '_bareLT1lattice'; |
---|
82 | |
---|
83 | % AT lattice |
---|
84 | AD.ATModel = 'bareLT1lattice'; |
---|
85 | eval(AD.ATModel); %run model for compilersolamor2linb; |
---|
86 | |
---|
87 | switch2hw; |
---|
88 | |
---|
89 | elseif ModeNumber == 2 |
---|
90 | % LT1 voie directe - ecran emittance=COLL |
---|
91 | AD.OperationalMode = '110 MeV, multibunch'; |
---|
92 | AD.Energy = 0.110; % Make sure this is the same as bend2gev at the production lattice! |
---|
93 | ModeName = 'LT1emittancelattice'; |
---|
94 | OpsFileExtension = '_LT1emittancelattice'; |
---|
95 | |
---|
96 | % AT lattice |
---|
97 | AD.ATModel = 'LT1emittancelattice'; |
---|
98 | eval(AD.ATModel); |
---|
99 | |
---|
100 | switch2hw; |
---|
101 | |
---|
102 | elseif ModeNumber == 3 |
---|
103 | % User mode - High Tune, Top Off injection |
---|
104 | error('To be completed'); |
---|
105 | |
---|
106 | elseif ModeNumber == 100 |
---|
107 | % User mode - High Tune, Top Off injection |
---|
108 | error('To be completed'); |
---|
109 | |
---|
110 | else |
---|
111 | error('Operational mode unknown'); |
---|
112 | end |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | % Set the AD directory path |
---|
117 | setad(AD); |
---|
118 | MMLROOT = setmmldirectories(AD.Machine, AD.SubMachine, ModeName, OpsFileExtension); |
---|
119 | AD = getad; |
---|
120 | |
---|
121 | % SOLEIL specific path changes |
---|
122 | |
---|
123 | % Top Level Directories |
---|
124 | MMLDATAROOT = getmmldataroot; |
---|
125 | |
---|
126 | AD.Directory.DataRoot = fullfile(MMLDATAROOT, 'measdata', 'SOLEIL', 'LT1data', filesep); |
---|
127 | AD.Directory.OpsData = fullfile(MMLDATAROOT, 'machine', 'SOLEIL', 'LT1OpsData', filesep); |
---|
128 | AD.Directory.Lattice = fullfile(MMLROOT, 'machine', 'SOLEIL', 'LT1', 'Lattices', filesep); |
---|
129 | |
---|
130 | AD.Directory.FAEData = fullfile(AD.Directory.DataRoot, 'fae', filesep); |
---|
131 | AD.Directory.EMITData = fullfile(AD.Directory.DataRoot, 'emittance', filesep); |
---|
132 | AD.Directory.Timing = fullfile(MMLROOT, 'machine', 'SOLEIL', 'LT1', 'Timing', filesep); |
---|
133 | |
---|
134 | AD.Directory.ConfigData = fullfile(MMLROOT, 'machine', 'SOLEIL', 'LT1', 'MachineConfig', filesep); |
---|
135 | AD.Directory.Archiving = fullfile(AD.Directory.DataRoot, 'ArchivingData', filesep); |
---|
136 | AD.Directory.Synchro = fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'synchro', filesep); |
---|
137 | |
---|
138 | |
---|
139 | %Operational Files |
---|
140 | AD.OpsData.LatticeFile = 'GoldenLattice'; %Golden Lattice File (setup for users) |
---|
141 | AD.OpsData.PhysDataFile = 'GoldenPhysData'; |
---|
142 | |
---|
143 | % Circumference |
---|
144 | AD.Circumference = findspos(THERING,length(THERING)+1); |
---|
145 | setad(AD); |
---|
146 | |
---|
147 | % Updates the AT indices in the MiddleLayer with the present AT lattice |
---|
148 | updateatindex; |
---|
149 | |
---|
150 | % Set the model energy |
---|
151 | setenergymodel(AD.Energy); |
---|
152 | |
---|
153 | fprintf(' lattice files have changed or if the AT lattice has changed.\n'); |
---|
154 | fprintf(' Middlelayer setup for operational mode: %s\n', AD.OperationalMode); |
---|
155 | |
---|
156 | setad(orderfields(AD)); |
---|