1 | function [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathsoleil(varargin) |
---|
2 | %SETPATHSOLEIL - Initializes the Matlab Middle Layer (MML) for SOLEIL |
---|
3 | % [MachineName, SubMachineName, OnlineLinkMethod, MMLROOT] = setpathsoleil(SubMachineName) |
---|
4 | % |
---|
5 | % INPUTS |
---|
6 | % 1. SubMachineName - 'StorageRing', 'Booster', 'LT2', 'LT1' |
---|
7 | % |
---|
8 | % See Also setoperationalmode, setpathsoleil, aoinit, soleilinit |
---|
9 | |
---|
10 | % |
---|
11 | % Written by Gregory J. Portmann |
---|
12 | % Adapted by Laurent S. Nadolski |
---|
13 | |
---|
14 | Machine = 'SOLEIL'; |
---|
15 | |
---|
16 | %%%%%%%%%%%%%%%%% |
---|
17 | % Input Parsing % |
---|
18 | %%%%%%%%%%%%%%%%% |
---|
19 | |
---|
20 | % First strip-out the link method (although it should not be there) |
---|
21 | LinkFlag = ''; |
---|
22 | for i = length(varargin):-1:1 |
---|
23 | if ~ischar(varargin{i}) |
---|
24 | % Ignore input |
---|
25 | elseif strcmpi(varargin{i},'LabCA') |
---|
26 | LinkFlag = 'LabCA'; |
---|
27 | varargin(i) = []; |
---|
28 | elseif strcmpi(varargin{i},'MCA') |
---|
29 | LinkFlag = 'MCA'; |
---|
30 | varargin(i) = []; |
---|
31 | elseif strcmpi(varargin{i},'SCA') |
---|
32 | LinkFlag = 'SCA'; |
---|
33 | varargin(i) = []; |
---|
34 | elseif strcmpi(varargin{i},'SLC') |
---|
35 | LinkFlag = 'SLC'; |
---|
36 | varargin(i) = []; |
---|
37 | elseif strcmpi(varargin{i},'Tango') |
---|
38 | LinkFlag = 'Tango'; |
---|
39 | varargin(i) = []; |
---|
40 | elseif strcmpi(varargin{i},'UCODE') |
---|
41 | LinkFlag = 'UCODE'; |
---|
42 | varargin(i) = []; |
---|
43 | end |
---|
44 | end |
---|
45 | |
---|
46 | if isempty(LinkFlag) |
---|
47 | LinkFlag = 'Tango'; |
---|
48 | end |
---|
49 | |
---|
50 | |
---|
51 | % Get the submachine name |
---|
52 | if length(varargin) >= 1 |
---|
53 | SubMachineName = varargin{1}; |
---|
54 | else |
---|
55 | SubMachineName = 'StorageRing'; |
---|
56 | end |
---|
57 | |
---|
58 | if isempty(SubMachineName) |
---|
59 | SubMachineNameCell = {'LT1', 'Booster', 'LT2', 'Storage Ring'}; |
---|
60 | [i, ok] = listdlg('PromptString', 'Select an accelerator:',... |
---|
61 | 'SelectionMode', 'Single',... |
---|
62 | 'Name', 'SOLEIL', ... |
---|
63 | 'ListString', SubMachineNameCell,'ListSize', [160 60]); |
---|
64 | if ok |
---|
65 | SubMachineName = SubMachineNameCell{i}; |
---|
66 | else |
---|
67 | fprintf('Initialization cancelled (no path change).\n'); |
---|
68 | return; |
---|
69 | end |
---|
70 | end |
---|
71 | |
---|
72 | if any(strcmpi(SubMachineName, {'Storage Ring','Ring'})) |
---|
73 | SubMachineName = 'StorageRing'; |
---|
74 | end |
---|
75 | |
---|
76 | % Common path at SOLEIL |
---|
77 | try |
---|
78 | MMLROOT = getmmlroot; |
---|
79 | [status servername] = system('uname -n'); |
---|
80 | if strcmp(servername(1:5), 'metis'), |
---|
81 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'CommunHyperion')); |
---|
82 | end |
---|
83 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common')); |
---|
84 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'naff', 'naffutils')); |
---|
85 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'naff', 'naffutils', 'touscheklifetime')); |
---|
86 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'naff', 'nafflib')); |
---|
87 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'archiving')); |
---|
88 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'database')); |
---|
89 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'geophone')); |
---|
90 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'synchro')); |
---|
91 | addpath(fullfile(MMLROOT, 'mml', 'plotfamily')); % greg version |
---|
92 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'plotfamily')); |
---|
93 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'configurations')); |
---|
94 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'cycling')); |
---|
95 | addpath(fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'diag', 'DserverBPM')); |
---|
96 | addpath(fullfile(MMLROOT, 'applications', 'mmlviewer')); |
---|
97 | ToolboxPath = fullfile(MMLROOT, 'machine', 'SOLEIL', 'common', 'toolbox'); |
---|
98 | % "inverse" INTERP1 |
---|
99 | addpath(fullfile(ToolboxPath, 'findX')) |
---|
100 | % nonlinear optimization toolbox |
---|
101 | addpath(fullfile(ToolboxPath, 'optimize')) |
---|
102 | % FMINSEARCH, but with bound constraints by transformation |
---|
103 | addpath(fullfile(ToolboxPath, 'fminsearchbnd/fminsearchbnd')) |
---|
104 | % FMINSEARCHCON extension of FMINSEARCH |
---|
105 | addpath(fullfile(ToolboxPath, 'FMINSEARCHCON/FMINSEARCHCON')) |
---|
106 | % Integration |
---|
107 | addpath(fullfile(ToolboxPath,'quadgr')) |
---|
108 | addpath(fullfile(ToolboxPath,'gaussquad')) |
---|
109 | % 2 fitting toolbox |
---|
110 | addpath(fullfile(ToolboxPath,'ezyfit/ezyfit')) |
---|
111 | % requiredsymbolic toolbox |
---|
112 | addpath(fullfile(ToolboxPath,'PolyfitnTools/PolyfitnTools')) |
---|
113 | addpath(fullfile(ToolboxPath,'SymbolicPolynomials/SymbolicPolynomials')) |
---|
114 | % chebychev |
---|
115 | addpath(fullfile(ToolboxPath,'chebfun_v2_0501')); |
---|
116 | % GUILayout |
---|
117 | addpath(fullfile(ToolboxPath,'GUILayout')); |
---|
118 | addpath(fullfile(ToolboxPath,'GUILayout/Patch')); |
---|
119 | addpath(fullfile(ToolboxPath,'GUILayout/layoutHelp')); |
---|
120 | catch err |
---|
121 | disp('Path loading failed'); |
---|
122 | end |
---|
123 | |
---|
124 | |
---|
125 | if strcmpi(SubMachineName,'StorageRing') |
---|
126 | [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'StorageRing', 'StorageRing', LinkFlag); |
---|
127 | elseif strcmpi(SubMachineName,'LT1') |
---|
128 | [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'LT1', 'Transport', LinkFlag); |
---|
129 | elseif strcmpi(SubMachineName,'Booster') |
---|
130 | [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'Booster', 'Booster', LinkFlag); |
---|
131 | elseif strcmpi(SubMachineName,'LT2') |
---|
132 | [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'LT2', 'Transport', LinkFlag); |
---|
133 | else |
---|
134 | error('SubMachineName %s unknown', SubMachineName); |
---|
135 | end |
---|
136 | |
---|
137 | try |
---|
138 | %% Proprietes par defauts |
---|
139 | %% Impression |
---|
140 | set(0,'DefaultFigurePaperType','a4'); |
---|
141 | set(0,'DefaultFigurePaperUnits','centimeters'); |
---|
142 | % commande type pour imprimer |
---|
143 | % print |
---|
144 | % l'imprimante Color |
---|
145 | % print -Pcolor |
---|
146 | % postcript level 2 en couleur |
---|
147 | % print -dps2c -Pcolor |
---|
148 | |
---|
149 | warning off MATLAB:dispatcher:InexactMatch |
---|
150 | |
---|
151 | % cycling over 15 different color |
---|
152 | set(0,'DefaultAxesColorOrder',(colordg(1:15))); |
---|
153 | |
---|
154 | % Global options |
---|
155 | set(0,'DefaultAxesXgrid', 'On'); |
---|
156 | set(0,'DefaultAxesYgrid', 'On') |
---|
157 | |
---|
158 | %format long |
---|
159 | |
---|
160 | % Repertoire par defaut |
---|
161 | if ispc |
---|
162 | cd(getenv('HOME_OPERATION')); |
---|
163 | else |
---|
164 | % default starting directory |
---|
165 | cd(getenv('HOME')); |
---|
166 | end |
---|
167 | disp('Ready') |
---|
168 | catch |
---|
169 | disp('Error') |
---|
170 | end |
---|