source: MML/trunk/machine/THOMX/StorageRing/thomxringgui.m

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

Add features to set/get the TL Dipoles by the bending angle, while the ring dipoles are still connected to the beam energy in AT. (Maybe this features in TL dipoles need to change back in the future...)

  • Property svn:executable set to *
File size: 14.5 KB
Line 
1function varargout = thomxringgui(varargin)
2% OPERATIONGUI M-file for thomxringgui.fig
3%      OPERATIONGUI, by itself, creates a new OPERATIONGUI or raises the existing
4%      singleton*.
5%
6%
7%      H = OPERATIONGUI returns the handle to a new OPERATIONGUI or the handle to
8%      the existing singleton*.
9%
10%      OPERATIONGUI('CALLBACK',hObject,eventData,handles,...) calls the local
11%      function named CALLBACK in OPERATIONGUI.M with the given input arguments.
12%
13%      OPERATIONGUI('Property','Value',...) creates a new OPERATIONGUI or raises the
14%      existing singleton*.  Starting from the left, property value pairs are
15%      applied to the GUI before operationgui_OpeningFcn gets called.  An
16%      unrecognized property name or invalid value makes property application
17%      stop.  All inputs are passed to operationgui_OpeningFcn via varargin.
18%
19%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
20%      instance to run (singleton)".
21%
22% See also: GUIDE, GUIDATA, GUIHANDLES
23
24% Edit the above text to modify the response to help operationgui
25
26% Last Modified by GUIDE v2.5 25-Feb-2014 14:59:25
27
28% Begin initialization code - DO NOT EDIT
29%
30%  Modified by Jianfeng Zhang @ LAL, 01/10/2013
31%  See also operationgui.
32
33gui_Singleton = 1;
34gui_State = struct('gui_Name',       mfilename, ...
35                   'gui_Singleton',  gui_Singleton, ...
36                   'gui_OpeningFcn', @operationgui_OpeningFcn, ...
37                   'gui_OutputFcn',  @operationgui_OutputFcn, ...
38                   'gui_LayoutFcn',  [] , ...
39                   'gui_Callback',   []);
40if nargin && ischar(varargin{1})
41    gui_State.gui_Callback = str2func(varargin{1});
42end
43
44if nargout
45    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
46else
47    gui_mainfcn(gui_State, varargin{:});
48end
49% End initialization code - DO NOT EDIT
50
51
52% --- Executes just before operationgui is made visible.
53function operationgui_OpeningFcn(hObject, eventdata, handles, varargin)
54% This function has no output args, see OutputFcn.
55% hObject    handle to figure
56% eventdata  reserved - to be defined in a future version of MATLAB
57% handles    structure with handles and user data (see GUIDATA)
58% varargin   command line arguments to operationgui (see VARARGIN)
59
60% Choose default command line output for operationgui
61handles.output = hObject;
62
63% Update handles structure
64guidata(hObject, handles);
65
66% UIWAIT makes operationgui wait for user response (see UIRESUME)
67% uiwait(handles.FigMenuGui);
68
69
70% --- Outputs from this function are returned to the command line.
71function varargout = operationgui_OutputFcn(hObject, eventdata, handles)
72% varargout  cell array for returning output args (see VARARGOUT);
73% hObject    handle to figure
74% eventdata  reserved - to be defined in a future version of MATLAB
75% handles    structure with handles and user data (see GUIDATA)
76
77% Get default command line output from handles structure
78varargout{1} = handles.output;
79
80
81% --- Executes on button press in pushbutton_plotfamily.
82function pushbutton_plotfamily_Callback(hObject, eventdata, handles)
83% hObject    handle to pushbutton_plotfamily (see GCBO)
84% eventdata  reserved - to be defined in a future version of MATLAB
85% handles    structure with handles and user data (see GUIDATA)
86plotfamily;
87
88% --- Executes on button press in pushbutton_empty.
89function pushbutton_empty_Callback(hObject, eventdata, handles)
90% hObject    handle to pushbutton_empty (see GCBO)
91% eventdata  reserved - to be defined in a future version of MATLAB
92% handles    structure with handles and user data (see GUIDATA)
93
94
95% place holder.....
96
97% --- Executes on button press in pushbutton19.
98function pushbutton19_Callback(hObject, eventdata, handles)
99% hObject    handle to pushbutton19 (see GCBO)
100% eventdata  reserved - to be defined in a future version of MATLAB
101% handles    structure with handles and user data (see GUIDATA)
102%Variation_points_source;
103
104
105% --- Executes on button press in pushbutton_measbeta.
106function pushbutton_measbeta_Callback(hObject, eventdata, handles)
107% hObject    handle to pushbutton_measbeta (see GCBO)
108% eventdata  reserved - to be defined in a future version of MATLAB
109% handles    structure with handles and user data (see GUIDATA)
110
111measbeta;
112
113% --- Executes on button press in pushbutton_meas.
114function pushbutton_meas_Callback(hObject, eventdata, handles)
115% hObject    handle to pushbutton_meas (see GCBO)
116% eventdata  reserved - to be defined in a future version of MATLAB
117% handles    structure with handles and user data (see GUIDATA)
118
119% to be updated for ThomX
120measmcf;
121
122% --- Executes on button press in pushbutton_setoperationalmode.
123function pushbutton_setoperationalmode_Callback(hObject, eventdata, handles)
124% hObject    handle to pushbutton_setoperationalmode (see GCBO)
125% eventdata  reserved - to be defined in a future version of MATLAB
126% handles    structure with handles and user data (see GUIDATA)
127setoperationalmode
128
129% --- Executes on button press in pushbutton_cyclage.
130function pushbutton_cyclage_Callback(hObject, eventdata, handles)
131% hObject    handle to pushbutton_cyclage (see GCBO)
132% eventdata  reserved - to be defined in a future version of MATLAB
133% handles    structure with handles and user data (see GUIDATA)
134Ringcycling;
135
136% --- Executes on button press in pushbutton_configgui.
137function pushbutton_configgui_Callback(hObject, eventdata, handles)
138% hObject    handle to pushbutton_configgui (see GCBO)
139% eventdata  reserved - to be defined in a future version of MATLAB
140% handles    structure with handles and user data (see GUIDATA)
141configgui;
142
143% --- Executes on button press in pushbutton_setchrogolden.
144function pushbutton_setchrogolden_Callback(hObject, eventdata, handles)
145% hObject    handle to pushbutton_setchrogolden (see GCBO)
146% eventdata  reserved - to be defined in a future version of MATLAB
147% handles    structure with handles and user data (see GUIDATA)
148
149%% need to change back to the online model 'setchro('Physics')' when the ThomX machine is ready
150setchro('Physics','Simulator');
151
152% --- Executes on button press in pushbuttonstepchro.
153function pushbuttonstepchro_Callback(hObject, eventdata, handles)
154% hObject    handle to pushbuttonstepchro (see GCBO)
155% eventdata  reserved - to be defined in a future version of MATLAB
156% handles    structure with handles and user data (see GUIDATA)
157
158
159%% Need to change back to the 'online' model in the future for the ThomX...
160%pop up a dialog window to input the tune change range
161    answer = inputdlg({'Change the horizontal chromaticity by', 'Change the vertical chromaticity by'},'STEPCHRO',1,{'0','0'});
162    if isempty(answer)
163            return
164    end
165
166    DeltaChrom(1,1) = str2num(answer{1});
167    DeltaChrom(2,1) = str2num(answer{2});
168   
169    if (abs(DeltaChrom(1,1)) >= 1.0 || abs(DeltaChrom(2,1))>=1.0)
170        errordlg('Chromaticity change should be less than 1.0','Chromaticity change error');
171        return;
172    end
173    %InitialChrom = measchro;
174    InitialChrom = measchro('Model'); 
175    FinalChrom = InitialChrom + DeltaChrom;
176   
177    while (abs(DeltaChrom(1)) > 1e-3 || abs(DeltaChrom(2)) > 1e-3)
178        stepchro(DeltaChrom, 'Physics');
179        %stepchro('Physics');
180        DeltaChrom = FinalChrom-measchro('Model');
181        %DeltaChrom = FinalChrom-measchro;
182    end
183
184
185
186
187% --- Executes on button press in pushbutton_measchro.
188function pushbutton_measchro_Callback(hObject, eventdata, handles)
189% hObject    handle to pushbutton_measchro (see GCBO)
190% eventdata  reserved - to be defined in a future version of MATLAB
191% handles    structure with handles and user data (see GUIDATA)
192
193%% need to change back to  'measchro('Physics','Display')' when the ThomX ring is ready...
194%% by Jianfeng Zhang @ LAL, 11/2013
195measchro('Simulator','Physics','Display');
196%measchro('Physics','Display');
197
198% --- Executes on button press in pushbutton_settunegolden.
199function pushbutton_settunegolden_Callback(hObject, eventdata, handles)
200% hObject    handle to pushbutton_settunegolden (see GCBO)
201% eventdata  reserved - to be defined in a future version of MATLAB
202% handles    structure with handles and user data (see GUIDATA)
203settune;
204
205% --- Executes on button press in pushbutton_steptune.
206function pushbutton_steptune_Callback(hObject, eventdata, handles)
207% hObject    handle to pushbutton_steptune (see GCBO)
208% eventdata  reserved - to be defined in a future version of MATLAB
209% handles    structure with handles and user data (see GUIDATA)
210
211%pop up a dialog window to input the tune change range
212    answer = inputdlg({'Change the horizontal tune by', 'Change the vertical tune by'},'STEPTUNE',1,{'0','0'});
213    if isempty(answer)
214            return
215    end
216     DeltaTune(1,1) = str2num(answer{1});
217    DeltaTune(2,1) = str2num(answer{2});
218   
219    if (abs(DeltaTune(1,1)) >= 0.1 || abs(DeltaTune(2,1))>=0.1)
220        errordlg('Tune change should be less than 0.1','Tune change error');
221        return;
222    end
223       
224    InitialTune = gettune;
225    FinalTune = InitialTune + DeltaTune;
226   
227    while (abs(DeltaTune(1)) > 1e-4 || abs(DeltaTune(2)) > 1e-4)
228        steptune(DeltaTune);
229        DeltaTune = FinalTune-gettune;
230    end
231
232   
233% --- Executes on button press in pushbutton_measchroFBT.
234function pushbutton_measchroFBT_Callback(hObject, eventdata, handles)
235% hObject    handle to pushbutton_measchroFBT (see GCBO)
236% eventdata  reserved - to be defined in a future version of MATLAB
237% handles    structure with handles and user data (see GUIDATA)
238
239% to be updated for ThomX
240% measchroFBT('Physics')
241
242% --- Executes on button press in pushbutton_stepchroFBT.
243function pushbutton_stepchroFBT_Callback(hObject, eventdata, handles)
244% hObject    handle to pushbutton_stepchroFBT (see GCBO)
245% eventdata  reserved - to be defined in a future version of MATLAB
246% handles    structure with handles and user data (see GUIDATA)
247stepchro('Physics');
248
249% --- Executes on button press in pushbutton_setchroGoldenFBT.
250function pushbutton_setchroGoldenFBT_Callback(hObject, eventdata, handles)
251% hObject    handle to pushbutton_setchroGoldenFBT (see GCBO)
252% eventdata  reserved - to be defined in a future version of MATLAB
253% handles    structure with handles and user data (see GUIDATA)
254setchro('Physics','FBT');
255
256% --- Executes on button press in pushbutton_settuneGoldenFBT.
257function pushbutton_settuneGoldenFBT_Callback(hObject, eventdata, handles)
258% hObject    handle to pushbutton_settuneGoldenFBT (see GCBO)
259% eventdata  reserved - to be defined in a future version of MATLAB
260% handles    structure with handles and user data (see GUIDATA)
261
262% to be updated for ThomX
263% settune('FBT');
264
265% --- Executes on button press in pushbutton_steptuneFBT.
266function pushbutton_steptuneFBT_Callback(hObject, eventdata, handles)
267% hObject    handle to pushbutton_steptuneFBT (see GCBO)
268% eventdata  reserved - to be defined in a future version of MATLAB
269% handles    structure with handles and user data (see GUIDATA)
270
271% to be updated for ThomX
272%steptune;
273
274% --- Executes on button press in pushbutton_getpinhole.
275function pushbutton_getpinhole_Callback(hObject, eventdata, handles)
276% hObject    handle to pushbutton_getpinhole (see GCBO)
277% eventdata  reserved - to be defined in a future version of MATLAB
278% handles    structure with handles and user data (see GUIDATA)
279getpinhole('NoArchive')
280
281% --- Executes on button press in pushbutton_lifetime.
282function pushbutton_lifetime_Callback(hObject, eventdata, handles)
283% hObject    handle to pushbutton_lifetime (see GCBO)
284% eventdata  reserved - to be defined in a future version of MATLAB
285% handles    structure with handles and user data (see GUIDATA)
286measlifetime(30,'Display');
287
288% --- Executes on button press in pushbutton_monbpm.
289function pushbutton_monbpm_Callback(hObject, eventdata, handles)
290% hObject    handle to pushbutton_monbpm (see GCBO)
291% eventdata  reserved - to be defined in a future version of MATLAB
292% handles    structure with handles and user data (see GUIDATA)
293monbpm(60);
294
295% --- Executes on button press in pushbutton_BBA.
296function pushbutton_BBA_Callback(hObject, eventdata, handles)
297% hObject    handle to pushbutton_BBA (see GCBO)
298% eventdata  reserved - to be defined in a future version of MATLAB
299% handles    structure with handles and user data (see GUIDATA)
300bbacentergui
301
302% --- Executes on button press in pushbutton_checklibera.
303function pushbutton_checklibera_Callback(hObject, eventdata, handles)
304% hObject    handle to pushbutton_checklibera (see GCBO)
305% eventdata  reserved - to be defined in a future version of MATLAB
306% handles    structure with handles and user data (see GUIDATA)
307Check_Libera_config
308
309% --- Executes on button press in pushbutton_findrf.
310function pushbutton_findrf_Callback(hObject, eventdata, handles)
311% hObject    handle to pushbutton_findrf (see GCBO)
312% eventdata  reserved - to be defined in a future version of MATLAB
313% handles    structure with handles and user data (see GUIDATA)
314findrf;
315
316% --- Executes on button press in pushbutton_firstturn.
317function pushbutton_firstturn_Callback(hObject, eventdata, handles)
318% hObject    handle to pushbutton_firstturn (see GCBO)
319% eventdata  reserved - to be defined in a future version of MATLAB
320% handles    structure with handles and user data (see GUIDATA)
321getbpmsum;
322
323
324% --- Executes on button press in pushbutton_gettune.
325function pushbutton_gettune_Callback(hObject, eventdata, handles)
326% hObject    handle to pushbutton_gettune (see GCBO)
327% eventdata  reserved - to be defined in a future version of MATLAB
328% handles    structure with handles and user data (see GUIDATA)
329gettune
330
331% --- Executes on button press in pushbutton_gettuneFBT.
332function pushbutton_gettuneFBT_Callback(hObject, eventdata, handles)
333% hObject    handle to pushbutton_gettuneFBT (see GCBO)
334% eventdata  reserved - to be defined in a future version of MATLAB
335% handles    structure with handles and user data (see GUIDATA)
336
337% to be updated for ThomX
338%gettuneFBT
339
340
341% --- Executes on button press in pushbutton_steprf.
342function pushbutton_steprf_Callback(hObject, eventdata, handles)
343% hObject    handle to pushbutton_steprf (see GCBO)
344% eventdata  reserved - to be defined in a future version of MATLAB
345% handles    structure with handles and user data (see GUIDATA)
346Step_RF_Progressive;
347
348
349% --- Executes on button press in pushbutton_BeamsizeTunette.
350function pushbutton_BeamsizeTunette_Callback(hObject, eventdata, handles)
351% hObject    handle to pushbutton_BeamsizeTunette (see GCBO)
352% eventdata  reserved - to be defined in a future version of MATLAB
353% handles    structure with handles and user data (see GUIDATA)
354BeamSizeTunette
355
356
357
358
359
360% --- Executes on button press in pushbutton_measdisp.
361function pushbutton_measdisp_Callback(hObject, eventdata, handles)
362% hObject    handle to pushbutton_measdisp (see GCBO)
363% eventdata  reserved - to be defined in a future version of MATLAB
364% handles    structure with handles and user data (see GUIDATA)
365
366measdisp;
Note: See TracBrowser for help on using the repository browser.