1 | function varargout = tune1(varargin) |
---|
2 | % TUNE1 M-file for tune1.fig |
---|
3 | % TUNE1, by itself, creates a new TUNE1 or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = TUNE1 returns the handle to a new TUNE1 or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % TUNE1('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in TUNE1.M with the given input arguments. |
---|
11 | % |
---|
12 | % TUNE1('Property','Value',...) creates a new TUNE1 or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before tune1_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to tune1_OpeningFcn via varargin. |
---|
17 | % |
---|
18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
19 | % instance to run (singleton)". |
---|
20 | % |
---|
21 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
22 | |
---|
23 | % Copyright 2002-2003 The MathWorks, Inc. |
---|
24 | |
---|
25 | % Edit the above text to modify the response to help tune1 |
---|
26 | |
---|
27 | % Last Modified by GUIDE v2.5 26-Jan-2006 11:45:33 |
---|
28 | |
---|
29 | % Begin initialization code - DO NOT EDIT |
---|
30 | gui_Singleton = 1; |
---|
31 | gui_State = struct('gui_Name', mfilename, ... |
---|
32 | 'gui_Singleton', gui_Singleton, ... |
---|
33 | 'gui_OpeningFcn', @tune1_OpeningFcn, ... |
---|
34 | 'gui_OutputFcn', @tune1_OutputFcn, ... |
---|
35 | 'gui_LayoutFcn', [] , ... |
---|
36 | 'gui_Callback', []); |
---|
37 | if nargin && ischar(varargin{1}) |
---|
38 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
39 | end |
---|
40 | |
---|
41 | if nargout |
---|
42 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
43 | else |
---|
44 | gui_mainfcn(gui_State, varargin{:}); |
---|
45 | end |
---|
46 | % End initialization code - DO NOT EDIT |
---|
47 | |
---|
48 | |
---|
49 | % --- Executes just before tune1 is made visible. |
---|
50 | function tune1_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
51 | % This function has no output args, see OutputFcn. |
---|
52 | % hObject handle to figure |
---|
53 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
54 | % handles structure with handles and user data (see GUIDATA) |
---|
55 | % varargin command line arguments to tune1 (see VARARGIN) |
---|
56 | |
---|
57 | % Choose default command line output for tune1 |
---|
58 | handles.output = hObject; |
---|
59 | |
---|
60 | % Update handles structure |
---|
61 | guidata(hObject, handles); |
---|
62 | |
---|
63 | % UIWAIT makes tune1 wait for user response (see UIRESUME) |
---|
64 | % uiwait(handles.figure1); |
---|
65 | |
---|
66 | |
---|
67 | % --- Outputs from this function are returned to the command line. |
---|
68 | function varargout = tune1_OutputFcn(hObject, eventdata, handles) |
---|
69 | % varargout cell array for returning output args (see VARARGOUT); |
---|
70 | % hObject handle to figure |
---|
71 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
72 | % handles structure with handles and user data (see GUIDATA) |
---|
73 | |
---|
74 | % Get default command line output from handles structure |
---|
75 | varargout{1} = handles.output; |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | function edit1_Callback(hObject, eventdata, handles) |
---|
80 | % hObject handle to edit1 (see GCBO) |
---|
81 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
82 | % handles structure with handles and user data (see GUIDATA) |
---|
83 | |
---|
84 | % Hints: get(hObject,'String') returns contents of edit1 as text |
---|
85 | % str2double(get(hObject,'String')) returns contents of edit1 as a double |
---|
86 | str2double(get(hObject,'String')) |
---|
87 | |
---|
88 | % --- Executes during object creation, after setting all properties. |
---|
89 | % Xinj |
---|
90 | function edit1_CreateFcn(hObject, eventdata, handles) |
---|
91 | % hObject handle to edit1 (see GCBO) |
---|
92 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
93 | % handles empty - handles not created until after all CreateFcns called |
---|
94 | |
---|
95 | % Hint: edit controls usually have a white background on Windows. |
---|
96 | % See ISPC and COMPUTER. |
---|
97 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
98 | set(hObject,'BackgroundColor','white'); |
---|
99 | end |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | function edit2_Callback(hObject, eventdata, handles) |
---|
104 | % hObject handle to edit2 (see GCBO) |
---|
105 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
106 | % handles structure with handles and user data (see GUIDATA) |
---|
107 | |
---|
108 | % Hints: get(hObject,'String') returns contents of edit2 as text |
---|
109 | % str2double(get(hObject,'String')) returns contents of edit2 as a double |
---|
110 | |
---|
111 | |
---|
112 | % --- Executes during object creation, after setting all properties. |
---|
113 | % X'inj |
---|
114 | function edit2_CreateFcn(hObject, eventdata, handles) |
---|
115 | % hObject handle to edit2 (see GCBO) |
---|
116 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
117 | % handles empty - handles not created until after all CreateFcns called |
---|
118 | |
---|
119 | % Hint: edit controls usually have a white background on Windows. |
---|
120 | % See ISPC and COMPUTER. |
---|
121 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
122 | set(hObject,'BackgroundColor','white'); |
---|
123 | end |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | function edit3_Callback(hObject, eventdata, handles) |
---|
128 | % hObject handle to edit3 (see GCBO) |
---|
129 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
130 | % handles structure with handles and user data (see GUIDATA) |
---|
131 | |
---|
132 | % Hints: get(hObject,'String') returns contents of edit3 as text |
---|
133 | % str2double(get(hObject,'String')) returns contents of edit3 as a double |
---|
134 | |
---|
135 | |
---|
136 | % --- Executes during object creation, after setting all properties. |
---|
137 | % tension sept |
---|
138 | function edit3_CreateFcn(hObject, eventdata, handles) |
---|
139 | % hObject handle to edit3 (see GCBO) |
---|
140 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
141 | % handles empty - handles not created until after all CreateFcns called |
---|
142 | |
---|
143 | % Hint: edit controls usually have a white background on Windows. |
---|
144 | % See ISPC and COMPUTER. |
---|
145 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
146 | set(hObject,'BackgroundColor','white'); |
---|
147 | end |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | function edit4_Callback(hObject, eventdata, handles) |
---|
152 | % hObject handle to edit4 (see GCBO) |
---|
153 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
154 | % handles structure with handles and user data (see GUIDATA) |
---|
155 | |
---|
156 | % Hints: get(hObject,'String') returns contents of edit4 as text |
---|
157 | % str2double(get(hObject,'String')) returns contents of edit4 as a double |
---|
158 | |
---|
159 | |
---|
160 | % --- Executes during object creation, after setting all properties. |
---|
161 | % tension kicker |
---|
162 | function edit4_CreateFcn(hObject, eventdata, handles) |
---|
163 | % hObject handle to edit4 (see GCBO) |
---|
164 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
165 | % handles empty - handles not created until after all CreateFcns called |
---|
166 | |
---|
167 | % Hint: edit controls usually have a white background on Windows. |
---|
168 | % See ISPC and COMPUTER. |
---|
169 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
170 | set(hObject,'BackgroundColor','white'); |
---|
171 | end |
---|
172 | |
---|
173 | |
---|
174 | |
---|
175 | function edit5_Callback(hObject, eventdata, handles) |
---|
176 | % hObject handle to edit5 (see GCBO) |
---|
177 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
178 | % handles structure with handles and user data (see GUIDATA) |
---|
179 | |
---|
180 | % Hints: get(hObject,'String') returns contents of edit5 as text |
---|
181 | % str2double(get(hObject,'String')) returns contents of edit5 as a double |
---|
182 | |
---|
183 | |
---|
184 | % --- Executes during object creation, after setting all properties. |
---|
185 | % Zinj |
---|
186 | function edit5_CreateFcn(hObject, eventdata, handles) |
---|
187 | % hObject handle to edit5 (see GCBO) |
---|
188 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
189 | % handles empty - handles not created until after all CreateFcns called |
---|
190 | |
---|
191 | % Hint: edit controls usually have a white background on Windows. |
---|
192 | % See ISPC and COMPUTER. |
---|
193 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
194 | set(hObject,'BackgroundColor','white'); |
---|
195 | end |
---|
196 | |
---|
197 | |
---|
198 | |
---|
199 | function edit6_Callback(hObject, eventdata, handles) |
---|
200 | % hObject handle to edit6 (see GCBO) |
---|
201 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
202 | % handles structure with handles and user data (see GUIDATA) |
---|
203 | |
---|
204 | % Hints: get(hObject,'String') returns contents of edit6 as text |
---|
205 | % str2double(get(hObject,'String')) returns contents of edit6 as a double |
---|
206 | |
---|
207 | |
---|
208 | % --- Executes during object creation, after setting all properties. |
---|
209 | % Z'inj |
---|
210 | function edit6_CreateFcn(hObject, eventdata, handles) |
---|
211 | % hObject handle to edit6 (see GCBO) |
---|
212 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
213 | % handles empty - handles not created until after all CreateFcns called |
---|
214 | |
---|
215 | % Hint: edit controls usually have a white background on Windows. |
---|
216 | % See ISPC and COMPUTER. |
---|
217 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
218 | set(hObject,'BackgroundColor','white'); |
---|
219 | end |
---|
220 | |
---|
221 | |
---|
222 | |
---|
223 | function edit7_Callback(hObject, eventdata, handles) |
---|
224 | % hObject handle to edit7 (see GCBO) |
---|
225 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
226 | % handles structure with handles and user data (see GUIDATA) |
---|
227 | |
---|
228 | % Hints: get(hObject,'String') returns contents of edit7 as text |
---|
229 | % str2double(get(hObject,'String')) returns contents of edit7 as a double |
---|
230 | |
---|
231 | |
---|
232 | % --- Executes during object creation, after setting all properties. |
---|
233 | % VCOR3 |
---|
234 | function edit7_CreateFcn(hObject, eventdata, handles) |
---|
235 | % hObject handle to edit7 (see GCBO) |
---|
236 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
237 | % handles empty - handles not created until after all CreateFcns called |
---|
238 | |
---|
239 | % Hint: edit controls usually have a white background on Windows. |
---|
240 | % See ISPC and COMPUTER. |
---|
241 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
242 | set(hObject,'BackgroundColor','white'); |
---|
243 | end |
---|
244 | |
---|
245 | |
---|
246 | |
---|
247 | |
---|
248 | function edit8_Callback(hObject, eventdata, handles) |
---|
249 | % hObject handle to edit8 (see GCBO) |
---|
250 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
251 | % handles structure with handles and user data (see GUIDATA) |
---|
252 | |
---|
253 | % Hints: get(hObject,'String') returns contents of edit8 as text |
---|
254 | % str2double(get(hObject,'String')) returns contents of edit8 as a double |
---|
255 | |
---|
256 | |
---|
257 | % --- Executes during object creation, after setting all properties. |
---|
258 | % VCOR4 |
---|
259 | function edit8_CreateFcn(hObject, eventdata, handles) |
---|
260 | % hObject handle to edit8 (see GCBO) |
---|
261 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
262 | % handles empty - handles not created until after all CreateFcns called |
---|
263 | |
---|
264 | % Hint: edit controls usually have a white background on Windows. |
---|
265 | % See ISPC and COMPUTER. |
---|
266 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
267 | set(hObject,'BackgroundColor','white'); |
---|
268 | end |
---|
269 | |
---|
270 | |
---|
271 | % --- Executes on slider movement. |
---|
272 | function slider4_Callback(hObject, eventdata, handles) |
---|
273 | % hObject handle to slider4 (see GCBO) |
---|
274 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
275 | % handles structure with handles and user data (see GUIDATA) |
---|
276 | |
---|
277 | % Hints: get(hObject,'Value') returns position of slider |
---|
278 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
279 | |
---|
280 | |
---|
281 | % --- Executes during object creation, after setting all properties. |
---|
282 | function slider4_CreateFcn(hObject, eventdata, handles) |
---|
283 | % hObject handle to slider4 (see GCBO) |
---|
284 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
285 | % handles empty - handles not created until after all CreateFcns called |
---|
286 | |
---|
287 | % Hint: slider controls usually have a light gray background. |
---|
288 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
289 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
290 | end |
---|
291 | |
---|
292 | |
---|
293 | % --- Executes on slider movement. |
---|
294 | function slider5_Callback(hObject, eventdata, handles) |
---|
295 | % hObject handle to slider5 (see GCBO) |
---|
296 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
297 | % handles structure with handles and user data (see GUIDATA) |
---|
298 | |
---|
299 | % Hints: get(hObject,'Value') returns position of slider |
---|
300 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
301 | |
---|
302 | z =get(handles.slider6,'Value'); |
---|
303 | zp=get(handles.slider5,'Value'); |
---|
304 | set(handles.edit6,'String',num2str(zp)); |
---|
305 | |
---|
306 | zinj = [z zp] ; |
---|
307 | m1 =[ 0.0923 -0.4244 ; 0.0738 1.66 ] ; |
---|
308 | klt1 = m1*zinj'/1.2 ; % corr 2 et 3 en A |
---|
309 | %sprintf(' Courant correcteur LT1 CV.2: %g A et CV.3: %g A', klt1) |
---|
310 | tango_write_attribute2('LT1/AE/CV.2', 'current', (klt1(1)) ); |
---|
311 | tango_write_attribute2('LT1/AE/CV.3', 'current', (klt1(2)) ); |
---|
312 | CV2=readattribute('LT1/AE/CV.2/current'); |
---|
313 | CV3=readattribute('LT1/AE/CV.3/current'); |
---|
314 | set(handles.edit7,'String',CV2); |
---|
315 | set(handles.edit8,'String',CV3); |
---|
316 | |
---|
317 | % --- Executes during object creation, after setting all properties. |
---|
318 | % Z' |
---|
319 | function slider5_CreateFcn(hObject, eventdata, handles) |
---|
320 | % hObject handle to slider5 (see GCBO) |
---|
321 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
322 | % handles empty - handles not created until after all CreateFcns called |
---|
323 | |
---|
324 | % Hint: slider controls usually have a light gray background. |
---|
325 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
326 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
327 | end |
---|
328 | |
---|
329 | |
---|
330 | % --- Executes on slider movement. |
---|
331 | function slider6_Callback(hObject, eventdata, handles) |
---|
332 | % hObject handle to slider6 (see GCBO) |
---|
333 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
334 | % handles structure with handles and user data (see GUIDATA) |
---|
335 | |
---|
336 | % Hints: get(hObject,'Value') returns position of slider |
---|
337 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
338 | |
---|
339 | z =get(handles.slider6,'Value'); |
---|
340 | zp=get(handles.slider5,'Value'); |
---|
341 | set(handles.edit5,'String',num2str(z)); |
---|
342 | |
---|
343 | zinj = [z zp] ; |
---|
344 | m1 =[ 0.0923 -0.4244 ; 0.0738 1.66 ] ; |
---|
345 | klt1 = m1*zinj'/1.2 ; % corr 2 et 3 en A |
---|
346 | %sprintf(' Courant correcteur LT1 CV.2: %g A et CV.3: %g A', klt1) |
---|
347 | tango_write_attribute('LT1/AE/CV.2', 'current', (klt1(1)) ); |
---|
348 | tango_write_attribute('LT1/AE/CV.3', 'current', (klt1(2)) ); |
---|
349 | CV2=readattribute('LT1/AE/CV.2/current'); |
---|
350 | CV3=readattribute('LT1/AE/CV.3/current'); |
---|
351 | set(handles.edit7,'String',CV2); |
---|
352 | set(handles.edit8,'String',CV3); |
---|
353 | |
---|
354 | % --- Executes during object creation, after setting all properties. |
---|
355 | % Z |
---|
356 | function slider6_CreateFcn(hObject, eventdata, handles) |
---|
357 | % hObject handle to slider6 (see GCBO) |
---|
358 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
359 | % handles empty - handles not created until after all CreateFcns called |
---|
360 | |
---|
361 | % Hint: slider controls usually have a light gray background. |
---|
362 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
363 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
364 | end |
---|
365 | |
---|
366 | |
---|
367 | % --- Executes on slider movement. |
---|
368 | function slider7_Callback(hObject, eventdata, handles) |
---|
369 | % hObject handle to slider7 (see GCBO) |
---|
370 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
371 | % handles structure with handles and user data (see GUIDATA) |
---|
372 | |
---|
373 | % Hints: get(hObject,'Value') returns position of slider |
---|
374 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
375 | |
---|
376 | x =get(handles.slider8,'Value'); |
---|
377 | xp=get(handles.slider7,'Value'); |
---|
378 | set(handles.edit2,'String',num2str(xp)); |
---|
379 | |
---|
380 | xinj = [x xp] ; |
---|
381 | |
---|
382 | l1=0.5; l2=1.; k=0.89*0.4; |
---|
383 | m11=1-k*l1/2; |
---|
384 | m12=l1; |
---|
385 | m21=-(2+k*k*l1*(l2-l1)+k*(2*l1-l2)); |
---|
386 | m22=l2+k*l1*(l2-l1); |
---|
387 | det=l1+l2+k*l1*l2; |
---|
388 | m1 =[ m11 m12 ; m21 m22 ] / det; |
---|
389 | kep = m1*xinj' ; % EP sept et kick en mrad |
---|
390 | sept=191 + kep(1)*191/131; |
---|
391 | kick=6800 + kep(2)*6800/12; |
---|
392 | |
---|
393 | % tango_write_attribute('LT1/AE/CV.2', 'current', (klt1(1)) ); |
---|
394 | % tango_write_attribute('LT1/AE/CV.3', 'current', (klt1(2)) ); |
---|
395 | % CV2=readattribute('LT1/AE/CV.2/current'); |
---|
396 | % CV3=readattribute('LT1/AE/CV.3/current'); |
---|
397 | |
---|
398 | set(handles.edit3,'String',sept); |
---|
399 | set(handles.edit4,'String',kick); |
---|
400 | |
---|
401 | % --- Executes during object creation, after setting all properties. |
---|
402 | function slider7_CreateFcn(hObject, eventdata, handles) |
---|
403 | % hObject handle to slider7 (see GCBO) |
---|
404 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
405 | % handles empty - handles not created until after all CreateFcns called |
---|
406 | |
---|
407 | % Hint: slider controls usually have a light gray background. |
---|
408 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
409 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
410 | end |
---|
411 | |
---|
412 | |
---|
413 | % --- Executes on slider movement. |
---|
414 | function slider8_Callback(hObject, eventdata, handles) |
---|
415 | % hObject handle to slider8 (see GCBO) |
---|
416 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
417 | % handles structure with handles and user data (see GUIDATA) |
---|
418 | |
---|
419 | % Hints: get(hObject,'Value') returns position of slider |
---|
420 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
421 | |
---|
422 | x =get(handles.slider8,'Value'); |
---|
423 | xp=get(handles.slider7,'Value'); |
---|
424 | set(handles.edit1,'String',num2str(x)); |
---|
425 | |
---|
426 | xinj = [x xp] ; |
---|
427 | |
---|
428 | l1=0.5; l2=1.; k=0.89*0.4; |
---|
429 | m11=1-k*l1/2; |
---|
430 | m12=l1; |
---|
431 | m21=-(2+k*k*l1*(l2-l1)+k*(2*l1-l2)); |
---|
432 | m22=l2+k*l1*(l2-l1); |
---|
433 | det=l1+l2+k*l1*l2; |
---|
434 | m1 =[ m11 m12 ; m21 m22 ] / det; |
---|
435 | kep = m1*xinj' ; % EP sept et kick en mrad |
---|
436 | sept=191 + kep(1)*191/131; |
---|
437 | kick=6800 + kep(2)*6800/12; |
---|
438 | |
---|
439 | % tango_write_attribute('LT1/AE/CV.2', 'current', (klt1(1)) ); |
---|
440 | % tango_write_attribute('LT1/AE/CV.3', 'current', (klt1(2)) ); |
---|
441 | % CV2=readattribute('LT1/AE/CV.2/current'); |
---|
442 | % CV3=readattribute('LT1/AE/CV.3/current'); |
---|
443 | |
---|
444 | set(handles.edit3,'String',sept); |
---|
445 | set(handles.edit4,'String',kick); |
---|
446 | |
---|
447 | |
---|
448 | % --- Executes during object creation, after setting all properties. |
---|
449 | function slider8_CreateFcn(hObject, eventdata, handles) |
---|
450 | % hObject handle to slider8 (see GCBO) |
---|
451 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
452 | % handles empty - handles not created until after all CreateFcns called |
---|
453 | |
---|
454 | % Hint: slider controls usually have a light gray background. |
---|
455 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
456 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
457 | end |
---|
458 | |
---|
459 | |
---|
460 | |
---|
461 | function edit9_Callback(hObject, eventdata, handles) |
---|
462 | % hObject handle to edit9 (see GCBO) |
---|
463 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
464 | % handles structure with handles and user data (see GUIDATA) |
---|
465 | |
---|
466 | % Hints: get(hObject,'String') returns contents of edit9 as text |
---|
467 | % str2double(get(hObject,'String')) returns contents of edit9 as a double |
---|
468 | |
---|
469 | |
---|
470 | % --- Executes during object creation, after setting all properties. |
---|
471 | function edit9_CreateFcn(hObject, eventdata, handles) |
---|
472 | % hObject handle to edit9 (see GCBO) |
---|
473 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
474 | % handles empty - handles not created until after all CreateFcns called |
---|
475 | |
---|
476 | % Hint: edit controls usually have a white background on Windows. |
---|
477 | % See ISPC and COMPUTER. |
---|
478 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
479 | set(hObject,'BackgroundColor','white'); |
---|
480 | end |
---|
481 | |
---|
482 | |
---|
483 | % --- Executes on slider movement. |
---|
484 | function slider9_Callback(hObject, eventdata, handles) |
---|
485 | % hObject handle to slider9 (see GCBO) |
---|
486 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
487 | % handles structure with handles and user data (see GUIDATA) |
---|
488 | |
---|
489 | % Hints: get(hObject,'Value') returns position of slider |
---|
490 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
491 | |
---|
492 | nux100 =get(handles.slider9,'Value'); |
---|
493 | set(handles.edit9,'String',num2str(nux100)); |
---|
494 | |
---|
495 | |
---|
496 | % --- Executes during object creation, after setting all properties. |
---|
497 | function slider9_CreateFcn(hObject, eventdata, handles) |
---|
498 | % hObject handle to slider9 (see GCBO) |
---|
499 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
500 | % handles empty - handles not created until after all CreateFcns called |
---|
501 | |
---|
502 | % Hint: slider controls usually have a light gray background. |
---|
503 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
504 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
505 | end |
---|
506 | |
---|
507 | |
---|
508 | |
---|
509 | function edit10_Callback(hObject, eventdata, handles) |
---|
510 | % hObject handle to edit10 (see GCBO) |
---|
511 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
512 | % handles structure with handles and user data (see GUIDATA) |
---|
513 | |
---|
514 | % Hints: get(hObject,'String') returns contents of edit10 as text |
---|
515 | % str2double(get(hObject,'String')) returns contents of edit10 as a double |
---|
516 | |
---|
517 | |
---|
518 | % --- Executes during object creation, after setting all properties. |
---|
519 | function edit10_CreateFcn(hObject, eventdata, handles) |
---|
520 | % hObject handle to edit10 (see GCBO) |
---|
521 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
522 | % handles empty - handles not created until after all CreateFcns called |
---|
523 | |
---|
524 | % Hint: edit controls usually have a white background on Windows. |
---|
525 | % See ISPC and COMPUTER. |
---|
526 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
527 | set(hObject,'BackgroundColor','white'); |
---|
528 | end |
---|
529 | |
---|
530 | |
---|
531 | % --- Executes on slider movement. |
---|
532 | function slider10_Callback(hObject, eventdata, handles) |
---|
533 | % hObject handle to slider10 (see GCBO) |
---|
534 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
535 | % handles structure with handles and user data (see GUIDATA) |
---|
536 | |
---|
537 | % Hints: get(hObject,'Value') returns position of slider |
---|
538 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
539 | |
---|
540 | nuz100 =get(handles.slider10,'Value'); |
---|
541 | set(handles.edit10,'String',num2str(nuz100)); |
---|
542 | |
---|
543 | % --- Executes during object creation, after setting all properties. |
---|
544 | function slider10_CreateFcn(hObject, eventdata, handles) |
---|
545 | % hObject handle to slider10 (see GCBO) |
---|
546 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
547 | % handles empty - handles not created until after all CreateFcns called |
---|
548 | |
---|
549 | % Hint: slider controls usually have a light gray background. |
---|
550 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
551 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
552 | end |
---|
553 | |
---|
554 | |
---|
555 | |
---|
556 | function edit11_Callback(hObject, eventdata, handles) |
---|
557 | % hObject handle to edit11 (see GCBO) |
---|
558 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
559 | % handles structure with handles and user data (see GUIDATA) |
---|
560 | |
---|
561 | % Hints: get(hObject,'String') returns contents of edit11 as text |
---|
562 | % str2double(get(hObject,'String')) returns contents of edit11 as a double |
---|
563 | |
---|
564 | |
---|
565 | % --- Executes during object creation, after setting all properties. |
---|
566 | function edit11_CreateFcn(hObject, eventdata, handles) |
---|
567 | % hObject handle to edit11 (see GCBO) |
---|
568 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
569 | % handles empty - handles not created until after all CreateFcns called |
---|
570 | |
---|
571 | % Hint: edit controls usually have a white background on Windows. |
---|
572 | % See ISPC and COMPUTER. |
---|
573 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
574 | set(hObject,'BackgroundColor','white'); |
---|
575 | end |
---|
576 | |
---|
577 | |
---|
578 | % --- Executes on slider movement. |
---|
579 | function slider11_Callback(hObject, eventdata, handles) |
---|
580 | % hObject handle to slider11 (see GCBO) |
---|
581 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
582 | % handles structure with handles and user data (see GUIDATA) |
---|
583 | |
---|
584 | % Hints: get(hObject,'Value') returns position of slider |
---|
585 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
586 | |
---|
587 | nux275 =get(handles.slider11,'Value'); |
---|
588 | set(handles.edit11,'String',num2str(nux275)); |
---|
589 | |
---|
590 | % --- Executes during object creation, after setting all properties. |
---|
591 | function slider11_CreateFcn(hObject, eventdata, handles) |
---|
592 | % hObject handle to slider11 (see GCBO) |
---|
593 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
594 | % handles empty - handles not created until after all CreateFcns called |
---|
595 | |
---|
596 | % Hint: slider controls usually have a light gray background. |
---|
597 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
598 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
599 | end |
---|
600 | |
---|
601 | |
---|
602 | |
---|
603 | function edit12_Callback(hObject, eventdata, handles) |
---|
604 | % hObject handle to edit12 (see GCBO) |
---|
605 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
606 | % handles structure with handles and user data (see GUIDATA) |
---|
607 | |
---|
608 | % Hints: get(hObject,'String') returns contents of edit12 as text |
---|
609 | % str2double(get(hObject,'String')) returns contents of edit12 as a double |
---|
610 | |
---|
611 | |
---|
612 | % --- Executes during object creation, after setting all properties. |
---|
613 | function edit12_CreateFcn(hObject, eventdata, handles) |
---|
614 | % hObject handle to edit12 (see GCBO) |
---|
615 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
616 | % handles empty - handles not created until after all CreateFcns called |
---|
617 | |
---|
618 | % Hint: edit controls usually have a white background on Windows. |
---|
619 | % See ISPC and COMPUTER. |
---|
620 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
621 | set(hObject,'BackgroundColor','white'); |
---|
622 | end |
---|
623 | |
---|
624 | |
---|
625 | % --- Executes on slider movement. |
---|
626 | function slider12_Callback(hObject, eventdata, handles) |
---|
627 | % hObject handle to slider12 (see GCBO) |
---|
628 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
629 | % handles structure with handles and user data (see GUIDATA) |
---|
630 | |
---|
631 | % Hints: get(hObject,'Value') returns position of slider |
---|
632 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
633 | |
---|
634 | nuz275 =get(handles.slider12,'Value'); |
---|
635 | set(handles.edit12,'String',num2str(nuz275)); |
---|
636 | |
---|
637 | % --- Executes during object creation, after setting all properties. |
---|
638 | function slider12_CreateFcn(hObject, eventdata, handles) |
---|
639 | % hObject handle to slider12 (see GCBO) |
---|
640 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
641 | % handles empty - handles not created until after all CreateFcns called |
---|
642 | |
---|
643 | % Hint: slider controls usually have a light gray background. |
---|
644 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
645 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
646 | end |
---|
647 | |
---|
648 | |
---|
649 | % --- Executes on button press in pushbutton1. |
---|
650 | function pushbutton1_Callback(hObject, eventdata, handles) |
---|
651 | % hObject handle to pushbutton1 (see GCBO) |
---|
652 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
653 | % handles structure with handles and user data (see GUIDATA) |
---|
654 | |
---|
655 | nux100 =get(handles.slider9,'Value'); |
---|
656 | nuz100 =get(handles.slider10,'Value'); |
---|
657 | nux275 =get(handles.slider11,'Value'); |
---|
658 | nuz275 =get(handles.slider12,'Value'); |
---|
659 | |
---|
660 | mode_state =get(handles.togglebutton5,'Value'); |
---|
661 | if mode_state == 0 % mode 100 MeV |
---|
662 | |
---|
663 | dtune = [nux100 nuz100]; % dnu H et dnu V |
---|
664 | m1 =[ 0.88 0.125 ; 0.2 0.716 ] ; |
---|
665 | kqp = m1*dtune' ; % DI QPF et QPD en A |
---|
666 | fprintf('\n'); |
---|
667 | fprintf(' Courant delta-quadrupole dQPF: %g A et dQPD: %g A \n', kqp) |
---|
668 | temp = tango_read_attribute2('BOO/AE/QF', 'current'); |
---|
669 | qpf_inj = temp.value(2) + kqp(1); |
---|
670 | tango_write_attribute('BOO/AE/QF', 'current', qpf_inj); |
---|
671 | if (tango_error == -1) |
---|
672 | %- handle error |
---|
673 | tango_print_error_stack; |
---|
674 | return |
---|
675 | end |
---|
676 | temp=tango_read_attribute2('BOO/AE/QD', 'current'); |
---|
677 | qpd_inj = temp.value(2) + kqp(2); |
---|
678 | tango_write_attribute('BOO/AE/QD', 'current', qpd_inj); |
---|
679 | if (tango_error == -1) |
---|
680 | %- handle error |
---|
681 | tango_print_error_stack; |
---|
682 | return |
---|
683 | end |
---|
684 | |
---|
685 | elseif mode_state == 1 %Mode rampᅵ |
---|
686 | |
---|
687 | dtune_inj = [nux100 nuz100]; % dnu H et dnu V |
---|
688 | dtune_ext = [nux275 nuz275]; % dnu H et dnu V |
---|
689 | m1 =[ 0.88 0.125 ; 0.2 0.716 ] ; |
---|
690 | m2 =inv([ 1 1 ; 110/2750 1 ]) ; |
---|
691 | k_inj = m1*dtune_inj' ; % DI QPF et QPD en A |
---|
692 | k_ext = m1*dtune_ext' *2750/110 ; % DI QPF et QPD en A |
---|
693 | kqp_qf = m2*[k_ext(1) ; k_inj(1)]; % DI offset et cur QPF |
---|
694 | kqp_qd = m2*[k_ext(2) ; k_inj(2)]; % DI offset et cur QPD |
---|
695 | fprintf('\n'); |
---|
696 | fprintf(' Delta courant qf : offset %g A et current: %g A \n', kqp_qf(2) , kqp_qf(1)) |
---|
697 | fprintf('Delta courant qd : offset %g A et current: %g A \n', kqp_qd(2) , kqp_qd(2)) |
---|
698 | |
---|
699 | temp=tango_read_attribute2('BOO/AE/QD', 'current'); |
---|
700 | qpd_ext = temp.value(2) + kqp_qd(1); |
---|
701 | tango_write_attribute('BOO/AE/QD', 'current', qpd_ext); |
---|
702 | if (tango_error == -1) |
---|
703 | %- handle error |
---|
704 | tango_print_error_stack; |
---|
705 | return |
---|
706 | end |
---|
707 | % temp=tango_read_attribute2('BOO/AE/QD', 'waveformOffset'); |
---|
708 | % qpd_inj = temp.value(2) + kqp_qd(2); |
---|
709 | % tango_write_attribute('BOO/AE/QD', 'waveformOffset', qpd_inj); |
---|
710 | % if (tango_error == -1) |
---|
711 | % %- handle error |
---|
712 | % tango_print_error_stack; |
---|
713 | % return |
---|
714 | % end |
---|
715 | |
---|
716 | temp=tango_read_attribute2('BOO/AE/QF', 'current'); |
---|
717 | qpf_ext = temp.value(2) + kqp_qf(1); |
---|
718 | tango_write_attribute('BOO/AE/QF', 'current', qpf_ext); |
---|
719 | if (tango_error == -1) |
---|
720 | %- handle error |
---|
721 | tango_print_error_stack; |
---|
722 | return |
---|
723 | end |
---|
724 | |
---|
725 | % temp = tango_read_attribute2('BOO/AE/QF', 'waveformOffset'); |
---|
726 | % qpf_inj = temp.value(2) + kqp_qf(2); |
---|
727 | % tango_write_attribute('BOO/AE/QF', 'waveformOffset', qpf_inj); |
---|
728 | % if (tango_error == -1) |
---|
729 | % %- handle error |
---|
730 | % tango_print_error_stack; |
---|
731 | % return |
---|
732 | % end |
---|
733 | |
---|
734 | end |
---|
735 | |
---|
736 | |
---|
737 | % --- Executes on button press in togglebutton5. |
---|
738 | function togglebutton5_Callback(hObject, eventdata, handles) |
---|
739 | % hObject handle to togglebutton5 (see GCBO) |
---|
740 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
741 | % handles structure with handles and user data (see GUIDATA) |
---|
742 | |
---|
743 | % Hint: get(hObject,'Value') returns toggle state of togglebutton5 |
---|
744 | mode=get(hObject,'Value'); |
---|
745 | if mode == 0 |
---|
746 | set(handles.edit13,'String',' Mode 100 MeV'); |
---|
747 | elseif mode == 1 |
---|
748 | set(handles.edit13,'String',' Mode rampᅵ'); |
---|
749 | end |
---|
750 | |
---|
751 | function edit13_Callback(hObject, eventdata, handles) |
---|
752 | % hObject handle to edit13 (see GCBO) |
---|
753 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
754 | % handles structure with handles and user data (see GUIDATA) |
---|
755 | |
---|
756 | % Hints: get(hObject,'String') returns contents of edit13 as text |
---|
757 | % str2double(get(hObject,'String')) returns contents of edit13 as a double |
---|
758 | |
---|
759 | |
---|
760 | % --- Executes during object creation, after setting all properties. |
---|
761 | function edit13_CreateFcn(hObject, eventdata, handles) |
---|
762 | % hObject handle to edit13 (see GCBO) |
---|
763 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
764 | % handles empty - handles not created until after all CreateFcns called |
---|
765 | |
---|
766 | % Hint: edit controls usually have a white background on Windows. |
---|
767 | % See ISPC and COMPUTER. |
---|
768 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
769 | set(hObject,'BackgroundColor','white'); |
---|
770 | end |
---|
771 | |
---|
772 | |
---|