source: MML/trunk/machine/SOLEIL/LT1/setoperationalmode.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 5.0 KB
Line 
1function 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
17global THERING
18
19% Check if the AO exists
20checkforao;
21
22
23%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24% Accelerator Dependent Modes %
25%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26if nargin < 1
27    ModeNumber = [];
28end
29if 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
39end
40
41
42%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43% Accelerator Data Structure %
44%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45AD = getad;
46AD.Machine = 'SOLEIL';            % Will already be defined if setpathmml was used
47AD.MachineType = 'StorageRing';   % Will already be defined if setpathmml was used
48AD.SubMachine  = 'LT1';           % Will already be defined if setpathmml was used
49AD.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.
56AD.BPMDelay  = 0.25; % use [N, BPMDelay]=getbpmsaverages (AD.BPMDelay will disappear)
57AD.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)
65AD.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
76if 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
89elseif 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   
102elseif ModeNumber == 3
103    % User mode - High Tune, Top Off injection
104    error('To be completed');
105   
106elseif ModeNumber == 100
107    % User mode - High Tune, Top Off injection
108    error('To be completed');   
109
110else
111    error('Operational mode unknown');
112end
113
114
115
116% Set the AD directory path
117setad(AD);
118MMLROOT = setmmldirectories(AD.Machine, AD.SubMachine, ModeName, OpsFileExtension);
119AD = getad;
120
121% SOLEIL specific path changes
122
123 % Top Level Directories
124MMLDATAROOT = getmmldataroot;
125
126AD.Directory.DataRoot       = fullfile(MMLDATAROOT, 'measdata', 'SOLEIL', 'LT1data', filesep);
127AD.Directory.OpsData        = fullfile(MMLDATAROOT, 'machine', 'SOLEIL', 'LT1OpsData', filesep);
128AD.Directory.Lattice        = fullfile(MMLROOT, 'machine', 'SOLEIL', 'LT1', 'Lattices', filesep);
129
130AD.Directory.FAEData        = fullfile(AD.Directory.DataRoot, 'fae', filesep);
131AD.Directory.EMITData       = fullfile(AD.Directory.DataRoot, 'emittance', filesep);
132AD.Directory.Timing         = fullfile(MMLROOT, 'machine', 'SOLEIL', 'LT1', 'Timing', filesep);
133
134AD.Directory.ConfigData     = fullfile(MMLROOT, 'machine', 'SOLEIL', 'LT1', 'MachineConfig', filesep);
135AD.Directory.Archiving      = fullfile(AD.Directory.DataRoot, 'ArchivingData', filesep);
136AD.Directory.Synchro        = fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'synchro', filesep);
137
138
139%Operational Files
140AD.OpsData.LatticeFile       = 'GoldenLattice';     %Golden Lattice File (setup for users)
141AD.OpsData.PhysDataFile      = 'GoldenPhysData';
142
143% Circumference
144AD.Circumference = findspos(THERING,length(THERING)+1);
145setad(AD);
146
147% Updates the AT indices in the MiddleLayer with the present AT lattice
148updateatindex;
149
150% Set the model energy
151setenergymodel(AD.Energy);
152
153fprintf('   lattice files have changed or if the AT lattice has changed.\n');
154fprintf('   Middlelayer setup for operational mode: %s\n', AD.OperationalMode);
155
156setad(orderfields(AD));
Note: See TracBrowser for help on using the repository browser.