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