source: MML/trunk/machine/SOLEIL/Booster/applications/tune1.m @ 17

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

To have a stable version on the server.

  • Property svn:executable set to *
File size: 29.0 KB
Line 
1function 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
30gui_Singleton = 1;
31gui_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',   []);
37if nargin && ischar(varargin{1})
38    gui_State.gui_Callback = str2func(varargin{1});
39end
40
41if nargout
42    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
43else
44    gui_mainfcn(gui_State, varargin{:});
45end
46% End initialization code - DO NOT EDIT
47
48
49% --- Executes just before tune1 is made visible.
50function 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
58handles.output = hObject;
59
60% Update handles structure
61guidata(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.
68function 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
75varargout{1} = handles.output;
76
77
78
79function 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
86str2double(get(hObject,'String'))
87
88% --- Executes during object creation, after setting all properties.
89% Xinj
90function 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.
97if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
98    set(hObject,'BackgroundColor','white');
99end
100
101
102
103function 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
114function 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.
121if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
122    set(hObject,'BackgroundColor','white');
123end
124
125
126
127function 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
138function 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.
145if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
146    set(hObject,'BackgroundColor','white');
147end
148
149
150
151function 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
162function 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.
169if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
170    set(hObject,'BackgroundColor','white');
171end
172
173
174
175function 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
186function 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.
193if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
194    set(hObject,'BackgroundColor','white');
195end
196
197
198
199function 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
210function 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.
217if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
218    set(hObject,'BackgroundColor','white');
219end
220
221
222
223function 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
234function 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.
241if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
242    set(hObject,'BackgroundColor','white');
243end
244
245
246
247
248function 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
259function 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.
266if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
267    set(hObject,'BackgroundColor','white');
268end
269
270
271% --- Executes on slider movement.
272function 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.
282function 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.
288if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
289    set(hObject,'BackgroundColor',[.9 .9 .9]);
290end
291
292
293% --- Executes on slider movement.
294function 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
302z =get(handles.slider6,'Value');
303zp=get(handles.slider5,'Value');
304set(handles.edit6,'String',num2str(zp));
305
306zinj = [z   zp]  ;
307m1   =[ 0.0923 -0.4244 ; 0.0738 1.66 ] ;
308klt1 = 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)
310tango_write_attribute2('LT1/AE/CV.2', 'current', (klt1(1)) );
311tango_write_attribute2('LT1/AE/CV.3', 'current', (klt1(2)) );
312CV2=readattribute('LT1/AE/CV.2/current');
313CV3=readattribute('LT1/AE/CV.3/current');
314set(handles.edit7,'String',CV2);
315set(handles.edit8,'String',CV3);
316
317% --- Executes during object creation, after setting all properties.
318% Z'
319function 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.
325if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
326    set(hObject,'BackgroundColor',[.9 .9 .9]);
327end
328
329
330% --- Executes on slider movement.
331function 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
339z =get(handles.slider6,'Value');
340zp=get(handles.slider5,'Value');
341set(handles.edit5,'String',num2str(z));
342
343zinj = [z   zp]  ;
344m1   =[ 0.0923 -0.4244 ; 0.0738 1.66 ] ;
345klt1 = 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)
347tango_write_attribute('LT1/AE/CV.2', 'current', (klt1(1)) );
348tango_write_attribute('LT1/AE/CV.3', 'current', (klt1(2)) );
349CV2=readattribute('LT1/AE/CV.2/current');
350CV3=readattribute('LT1/AE/CV.3/current');
351set(handles.edit7,'String',CV2);
352set(handles.edit8,'String',CV3);
353
354% --- Executes during object creation, after setting all properties.
355% Z
356function 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.
362if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
363    set(hObject,'BackgroundColor',[.9 .9 .9]);
364end
365
366
367% --- Executes on slider movement.
368function 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
376x =get(handles.slider8,'Value');
377xp=get(handles.slider7,'Value');
378set(handles.edit2,'String',num2str(xp));
379
380xinj = [x   xp]  ;
381
382l1=0.5; l2=1.;  k=0.89*0.4;
383m11=1-k*l1/2;
384m12=l1;
385m21=-(2+k*k*l1*(l2-l1)+k*(2*l1-l2));
386m22=l2+k*l1*(l2-l1);
387det=l1+l2+k*l1*l2;
388m1   =[ m11 m12 ; m21 m22 ] / det;
389kep = m1*xinj' ;  % EP sept et kick en mrad 
390sept=191 + kep(1)*191/131;
391kick=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
398set(handles.edit3,'String',sept);
399set(handles.edit4,'String',kick);
400
401% --- Executes during object creation, after setting all properties.
402function 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.
408if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
409    set(hObject,'BackgroundColor',[.9 .9 .9]);
410end
411
412
413% --- Executes on slider movement.
414function 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
422x =get(handles.slider8,'Value');
423xp=get(handles.slider7,'Value');
424set(handles.edit1,'String',num2str(x));
425
426xinj = [x   xp]  ;
427
428l1=0.5; l2=1.;  k=0.89*0.4;
429m11=1-k*l1/2;
430m12=l1;
431m21=-(2+k*k*l1*(l2-l1)+k*(2*l1-l2));
432m22=l2+k*l1*(l2-l1);
433det=l1+l2+k*l1*l2;
434m1   =[ m11 m12 ; m21 m22 ] / det;
435kep = m1*xinj' ;  % EP sept et kick en mrad 
436sept=191 + kep(1)*191/131;
437kick=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
444set(handles.edit3,'String',sept);
445set(handles.edit4,'String',kick);
446
447
448% --- Executes during object creation, after setting all properties.
449function 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.
455if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
456    set(hObject,'BackgroundColor',[.9 .9 .9]);
457end
458
459
460
461function 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.
471function 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.
478if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
479    set(hObject,'BackgroundColor','white');
480end
481
482
483% --- Executes on slider movement.
484function 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
492nux100 =get(handles.slider9,'Value');
493set(handles.edit9,'String',num2str(nux100));
494
495
496% --- Executes during object creation, after setting all properties.
497function 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.
503if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
504    set(hObject,'BackgroundColor',[.9 .9 .9]);
505end
506
507
508
509function 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.
519function 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.
526if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
527    set(hObject,'BackgroundColor','white');
528end
529
530
531% --- Executes on slider movement.
532function 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
540nuz100 =get(handles.slider10,'Value');
541set(handles.edit10,'String',num2str(nuz100));
542
543% --- Executes during object creation, after setting all properties.
544function 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.
550if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
551    set(hObject,'BackgroundColor',[.9 .9 .9]);
552end
553
554
555
556function 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.
566function 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.
573if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
574    set(hObject,'BackgroundColor','white');
575end
576
577
578% --- Executes on slider movement.
579function 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
587nux275 =get(handles.slider11,'Value');
588set(handles.edit11,'String',num2str(nux275));
589
590% --- Executes during object creation, after setting all properties.
591function 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.
597if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
598    set(hObject,'BackgroundColor',[.9 .9 .9]);
599end
600
601
602
603function 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.
613function 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.
620if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
621    set(hObject,'BackgroundColor','white');
622end
623
624
625% --- Executes on slider movement.
626function 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
634nuz275 =get(handles.slider12,'Value');
635set(handles.edit12,'String',num2str(nuz275));
636
637% --- Executes during object creation, after setting all properties.
638function 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.
644if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
645    set(hObject,'BackgroundColor',[.9 .9 .9]);
646end
647
648
649% --- Executes on button press in pushbutton1.
650function 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
655nux100 =get(handles.slider9,'Value');
656nuz100 =get(handles.slider10,'Value');
657nux275 =get(handles.slider11,'Value');
658nuz275 =get(handles.slider12,'Value');
659
660mode_state =get(handles.togglebutton5,'Value');
661if 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
685elseif 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   
734end
735
736
737% --- Executes on button press in togglebutton5.
738function 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
744mode=get(hObject,'Value');
745if mode == 0
746   set(handles.edit13,'String',' Mode 100 MeV');
747elseif mode == 1
748   set(handles.edit13,'String',' Mode rampï¿œ');
749end
750
751function 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.
761function 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.
768if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
769    set(hObject,'BackgroundColor','white');
770end
771
772
Note: See TracBrowser for help on using the repository browser.