1 | function varargout = ACtune(varargin) |
---|
2 | % ACTUNE M-file for ACtune.fig |
---|
3 | % ACTUNE, by itself, creates a new ACTUNE or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = ACTUNE returns the handle to a new ACTUNE or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % ACTUNE('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in ACTUNE.M with the given input arguments. |
---|
11 | % |
---|
12 | % ACTUNE('Property','Value',...) creates a new ACTUNE or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before ACtune_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to ACtune_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 | % Edit the above text to modify the response to help ACtune |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 27-Apr-2006 14:46:15 |
---|
26 | |
---|
27 | % Begin initialization code - DO NOT EDIT |
---|
28 | gui_Singleton = 1; |
---|
29 | gui_State = struct('gui_Name', mfilename, ... |
---|
30 | 'gui_Singleton', gui_Singleton, ... |
---|
31 | 'gui_OpeningFcn', @ACtune_OpeningFcn, ... |
---|
32 | 'gui_OutputFcn', @ACtune_OutputFcn, ... |
---|
33 | 'gui_LayoutFcn', [] , ... |
---|
34 | 'gui_Callback', []); |
---|
35 | if nargin && ischar(varargin{1}) |
---|
36 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
37 | end |
---|
38 | |
---|
39 | if nargout |
---|
40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
41 | else |
---|
42 | gui_mainfcn(gui_State, varargin{:}); |
---|
43 | end |
---|
44 | % End initialization code - DO NOT EDIT |
---|
45 | |
---|
46 | |
---|
47 | % --- Executes just before ACtune is made visible. |
---|
48 | function ACtune_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
49 | % This function has no output args, see OutputFcn. |
---|
50 | % hObject handle to figure |
---|
51 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
52 | % handles structure with handles and user data (see GUIDATA) |
---|
53 | % varargin command line arguments to ACtune (see VARARGIN) |
---|
54 | |
---|
55 | % Choose default command line output for ACtune |
---|
56 | handles.output = hObject; |
---|
57 | |
---|
58 | if ~strcmp(getfamilydata('SubMachine'),'Booster') |
---|
59 | error('Load Booster first'); |
---|
60 | end |
---|
61 | |
---|
62 | m1 =[1.1931 -0.1543 ; -0.2537 1.2602 ] ; |
---|
63 | acqf=200.*18.48/2*sin(18.48*.020); |
---|
64 | acqd=150.*18.48/2*sin(18.48*.020); |
---|
65 | r =110/2750; |
---|
66 | % dtune = M * QFoffset QDoffset QFcur QDcur delayQF delay QD (A et seconde) |
---|
67 | M = [m1(1,1) m1(1,2) r*m1(1,1) r*m1(1,2) -acqf*m1(1,1) -acqd*m1(1,2); ... |
---|
68 | m1(2,1) m1(2,2) r*m1(2,1) r*m1(2,2) -acqf*m1(2,1) -acqd*m1(2,2); ... |
---|
69 | r*m1(1,1) r*m1(1,2) r*m1(1,1) r*m1(1,2) 0 0 ; ... |
---|
70 | r*m1(2,1) r*m1(2,2) r*m1(2,1) r*m1(2,2) 0 0 ; ... |
---|
71 | m1(1,1) m1(1,2) r*m1(1,1) r*m1(1,2) acqf*m1(1,1) acqd*m1(1,2); ... |
---|
72 | m1(2,1) m1(2,2) r*m1(2,1) r*m1(2,2) acqf*m1(2,1) acqd*m1(2,2)]; |
---|
73 | |
---|
74 | handles.M=M; |
---|
75 | % alim |
---|
76 | boo.DIPcurrent=readattribute('BOO/AE/D.1/current' ,'Setpoint'); |
---|
77 | boo.DIPoffset =readattribute('BOO/AE/D.1/waveformOffset' ,'Setpoint'); |
---|
78 | boo.QFcurrent=readattribute('BOO/AE/QF/current' ,'Setpoint'); |
---|
79 | boo.QFpoffset =readattribute('BOO/AE/QF/waveformOffset' ,'Setpoint'); |
---|
80 | boo.QDcurrent=readattribute('BOO/AE/QD/current' ,'Setpoint'); |
---|
81 | boo.QDpoffset =readattribute('BOO/AE/QD/waveformOffset' ,'Setpoint'); |
---|
82 | boo.SFcurrent=readattribute('BOO/AE/SF/current' ,'Setpoint'); |
---|
83 | boo.SFpoffset =readattribute('BOO/AE/SF/waveformOffset' ,'Setpoint'); |
---|
84 | boo.SDcurrent=readattribute('BOO/AE/SD/current' ,'Setpoint'); |
---|
85 | boo.SDpoffset =readattribute('BOO/AE/SD/waveformOffset' ,'Setpoint'); |
---|
86 | % synchro |
---|
87 | temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay'); |
---|
88 | boo.DIPdelay=temp.value(1); |
---|
89 | temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay'); |
---|
90 | boo.QFdelay=temp.value(1); |
---|
91 | temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay'); |
---|
92 | boo.QDdelay=temp.value(1); |
---|
93 | handles.boo=boo; |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | % Update handles structure |
---|
98 | guidata(hObject, handles); |
---|
99 | |
---|
100 | |
---|
101 | % UIWAIT makes ACtune wait for user response (see UIRESUME) |
---|
102 | % uiwait(handles.figure1); |
---|
103 | |
---|
104 | |
---|
105 | % --- Outputs from this function are returned to the command line. |
---|
106 | function varargout = ACtune_OutputFcn(hObject, eventdata, handles) |
---|
107 | % varargout cell array for returning output args (see VARARGOUT); |
---|
108 | % hObject handle to figure |
---|
109 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
110 | % handles structure with handles and user data (see GUIDATA) |
---|
111 | |
---|
112 | % Get default command line output from handles structure |
---|
113 | varargout{1} = handles.output; |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | function x_inj_Callback(hObject, eventdata, handles) |
---|
118 | % hObject handle to x_inj (see GCBO) |
---|
119 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
120 | % handles structure with handles and user data (see GUIDATA) |
---|
121 | |
---|
122 | % Hints: get(hObject,'String') returns contents of x_inj as text |
---|
123 | % str2double(get(hObject,'String')) returns contents of x_inj as a double |
---|
124 | |
---|
125 | |
---|
126 | % --- Executes during object creation, after setting all properties. |
---|
127 | function x_inj_CreateFcn(hObject, eventdata, handles) |
---|
128 | % hObject handle to x_inj (see GCBO) |
---|
129 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
130 | % handles empty - handles not created until after all CreateFcns called |
---|
131 | |
---|
132 | % Hint: edit controls usually have a white background on Windows. |
---|
133 | % See ISPC and COMPUTER. |
---|
134 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
135 | set(hObject,'BackgroundColor','white'); |
---|
136 | end |
---|
137 | |
---|
138 | |
---|
139 | |
---|
140 | function x_ext_Callback(hObject, eventdata, handles) |
---|
141 | % hObject handle to x_ext (see GCBO) |
---|
142 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
143 | % handles structure with handles and user data (see GUIDATA) |
---|
144 | |
---|
145 | % Hints: get(hObject,'String') returns contents of x_ext as text |
---|
146 | % str2double(get(hObject,'String')) returns contents of x_ext as a double |
---|
147 | |
---|
148 | |
---|
149 | % --- Executes during object creation, after setting all properties. |
---|
150 | function x_ext_CreateFcn(hObject, eventdata, handles) |
---|
151 | % hObject handle to x_ext (see GCBO) |
---|
152 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
153 | % handles empty - handles not created until after all CreateFcns called |
---|
154 | |
---|
155 | % Hint: edit controls usually have a white background on Windows. |
---|
156 | % See ISPC and COMPUTER. |
---|
157 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
158 | set(hObject,'BackgroundColor','white'); |
---|
159 | end |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | function x_retour_Callback(hObject, eventdata, handles) |
---|
164 | % hObject handle to x_retour (see GCBO) |
---|
165 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
166 | % handles structure with handles and user data (see GUIDATA) |
---|
167 | |
---|
168 | % Hints: get(hObject,'String') returns contents of x_retour as text |
---|
169 | % str2double(get(hObject,'String')) returns contents of x_retour as a double |
---|
170 | |
---|
171 | |
---|
172 | % --- Executes during object creation, after setting all properties. |
---|
173 | function x_retour_CreateFcn(hObject, eventdata, handles) |
---|
174 | % hObject handle to x_retour (see GCBO) |
---|
175 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
176 | % handles empty - handles not created until after all CreateFcns called |
---|
177 | |
---|
178 | % Hint: edit controls usually have a white background on Windows. |
---|
179 | % See ISPC and COMPUTER. |
---|
180 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
181 | set(hObject,'BackgroundColor','white'); |
---|
182 | end |
---|
183 | |
---|
184 | |
---|
185 | % --- Executes on button press in button_x_inj_plus. |
---|
186 | function button_x_inj_plus_Callback(hObject, eventdata, handles) |
---|
187 | % hObject handle to button_x_inj_plus (see GCBO) |
---|
188 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
189 | % handles structure with handles and user data (see GUIDATA) |
---|
190 | |
---|
191 | tune =str2double(get(handles.x_inj,'String')); |
---|
192 | tune=tune+0.05; |
---|
193 | set(handles.x_inj,'String',num2str(tune)); |
---|
194 | |
---|
195 | % --- Executes on button press in button_x_ext_plus. |
---|
196 | function button_x_ext_plus_Callback(hObject, eventdata, handles) |
---|
197 | % hObject handle to button_x_ext_plus (see GCBO) |
---|
198 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
199 | % handles structure with handles and user data (see GUIDATA) |
---|
200 | |
---|
201 | tune =str2double(get(handles.x_ext,'String')); |
---|
202 | tune=tune+0.05; |
---|
203 | set(handles.x_ext,'String',num2str(tune)); |
---|
204 | |
---|
205 | % --- Executes on button press in button_x_retour_plus. |
---|
206 | function button_x_retour_plus_Callback(hObject, eventdata, handles) |
---|
207 | % hObject handle to button_x_retour_plus (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 | tune =str2double(get(handles.x_retour,'String')); |
---|
211 | tune=tune+0.05; |
---|
212 | set(handles.x_retour,'String',num2str(tune)); |
---|
213 | |
---|
214 | % --- Executes on button press in button_x_inj_moins. |
---|
215 | function button_x_inj_moins_Callback(hObject, eventdata, handles) |
---|
216 | % hObject handle to button_x_inj_moins (see GCBO) |
---|
217 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
218 | % handles structure with handles and user data (see GUIDATA) |
---|
219 | tune =str2double(get(handles.x_inj,'String')); |
---|
220 | tune=tune-0.05; |
---|
221 | set(handles.x_inj,'String',num2str(tune)); |
---|
222 | |
---|
223 | % --- Executes on button press in button_x_ext_moins. |
---|
224 | function button_x_ext_moins_Callback(hObject, eventdata, handles) |
---|
225 | % hObject handle to button_x_ext_moins (see GCBO) |
---|
226 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
227 | % handles structure with handles and user data (see GUIDATA) |
---|
228 | tune =str2double(get(handles.x_ext,'String')); |
---|
229 | tune=tune-0.05; |
---|
230 | set(handles.x_ext,'String',num2str(tune)); |
---|
231 | |
---|
232 | % --- Executes on button press in button_x_retour_moins. |
---|
233 | function button_x_retour_moins_Callback(hObject, eventdata, handles) |
---|
234 | % hObject handle to button_x_retour_moins (see GCBO) |
---|
235 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
236 | % handles structure with handles and user data (see GUIDATA) |
---|
237 | |
---|
238 | tune =str2double(get(handles.x_retour,'String')); |
---|
239 | tune=tune-0.05; |
---|
240 | set(handles.x_retour,'String',num2str(tune)); |
---|
241 | |
---|
242 | |
---|
243 | % --- Executes on button press in button_x_plus. |
---|
244 | function button_x_plus_Callback(hObject, eventdata, handles) |
---|
245 | % hObject handle to button_x_plus (see GCBO) |
---|
246 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
247 | % handles structure with handles and user data (see GUIDATA) |
---|
248 | |
---|
249 | tune =str2double(get(handles.x_inj,'String')); |
---|
250 | tune=tune+0.05; |
---|
251 | set(handles.x_inj,'String',num2str(tune)); |
---|
252 | tune =str2double(get(handles.x_ext,'String')); |
---|
253 | tune=tune+0.05; |
---|
254 | set(handles.x_ext,'String',num2str(tune)); |
---|
255 | tune =str2double(get(handles.x_retour,'String')); |
---|
256 | tune=tune+0.05; |
---|
257 | set(handles.x_retour,'String',num2str(tune)); |
---|
258 | |
---|
259 | % --- Executes on button press in button_x_zero. |
---|
260 | function button_x_zero_Callback(hObject, eventdata, handles) |
---|
261 | % hObject handle to button_x_zero (see GCBO) |
---|
262 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
263 | % handles structure with handles and user data (see GUIDATA) |
---|
264 | |
---|
265 | tune=0; |
---|
266 | set(handles.x_inj,'String',num2str(tune)); |
---|
267 | set(handles.x_ext,'String',num2str(tune)); |
---|
268 | set(handles.x_retour,'String',num2str(tune)); |
---|
269 | |
---|
270 | % --- Executes on button press in button_x_moins. |
---|
271 | function button_x_moins_Callback(hObject, eventdata, handles) |
---|
272 | % hObject handle to button_x_moins (see GCBO) |
---|
273 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
274 | % handles structure with handles and user data (see GUIDATA) |
---|
275 | |
---|
276 | tune =str2double(get(handles.x_inj,'String')); |
---|
277 | tune=tune-0.05; |
---|
278 | set(handles.x_inj,'String',num2str(tune)); |
---|
279 | tune =str2double(get(handles.x_ext,'String')); |
---|
280 | tune=tune-0.05; |
---|
281 | set(handles.x_ext,'String',num2str(tune)); |
---|
282 | tune =str2double(get(handles.x_retour,'String')); |
---|
283 | tune=tune-0.05; |
---|
284 | set(handles.x_retour,'String',num2str(tune)); |
---|
285 | |
---|
286 | |
---|
287 | |
---|
288 | function z_inj_Callback(hObject, eventdata, handles) |
---|
289 | % hObject handle to z_inj (see GCBO) |
---|
290 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
291 | % handles structure with handles and user data (see GUIDATA) |
---|
292 | |
---|
293 | % Hints: get(hObject,'String') returns contents of z_inj as text |
---|
294 | % str2double(get(hObject,'String')) returns contents of z_inj as a double |
---|
295 | |
---|
296 | |
---|
297 | % --- Executes during object creation, after setting all properties. |
---|
298 | function z_inj_CreateFcn(hObject, eventdata, handles) |
---|
299 | % hObject handle to z_inj (see GCBO) |
---|
300 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
301 | % handles empty - handles not created until after all CreateFcns called |
---|
302 | |
---|
303 | % Hint: edit controls usually have a white background on Windows. |
---|
304 | % See ISPC and COMPUTER. |
---|
305 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
306 | set(hObject,'BackgroundColor','white'); |
---|
307 | end |
---|
308 | |
---|
309 | |
---|
310 | |
---|
311 | function z_ext_Callback(hObject, eventdata, handles) |
---|
312 | % hObject handle to z_ext (see GCBO) |
---|
313 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
314 | % handles structure with handles and user data (see GUIDATA) |
---|
315 | |
---|
316 | % Hints: get(hObject,'String') returns contents of z_ext as text |
---|
317 | % str2double(get(hObject,'String')) returns contents of z_ext as a double |
---|
318 | |
---|
319 | |
---|
320 | % --- Executes during object creation, after setting all properties. |
---|
321 | function z_ext_CreateFcn(hObject, eventdata, handles) |
---|
322 | % hObject handle to z_ext (see GCBO) |
---|
323 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
324 | % handles empty - handles not created until after all CreateFcns called |
---|
325 | |
---|
326 | % Hint: edit controls usually have a white background on Windows. |
---|
327 | % See ISPC and COMPUTER. |
---|
328 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
329 | set(hObject,'BackgroundColor','white'); |
---|
330 | end |
---|
331 | |
---|
332 | |
---|
333 | % --- Executes on button press in button_z_inj_plus. |
---|
334 | function button_z_inj_plus_Callback(hObject, eventdata, handles) |
---|
335 | % hObject handle to button_z_inj_plus (see GCBO) |
---|
336 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
337 | % handles structure with handles and user data (see GUIDATA) |
---|
338 | tune =str2double(get(handles.z_inj,'String')); |
---|
339 | tune=tune+0.05; |
---|
340 | set(handles.z_inj,'String',num2str(tune)); |
---|
341 | |
---|
342 | % --- Executes on button press in button_z_ext_plus. |
---|
343 | function button_z_ext_plus_Callback(hObject, eventdata, handles) |
---|
344 | % hObject handle to button_z_ext_plus (see GCBO) |
---|
345 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
346 | % handles structure with handles and user data (see GUIDATA) |
---|
347 | tune =str2double(get(handles.z_ext,'String')); |
---|
348 | tune=tune+0.05; |
---|
349 | set(handles.z_ext,'String',num2str(tune)); |
---|
350 | |
---|
351 | |
---|
352 | % --- Executes on button press in pushbutton15. |
---|
353 | function pushbutton15_Callback(hObject, eventdata, handles) |
---|
354 | % hObject handle to pushbutton15 (see GCBO) |
---|
355 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
356 | % handles structure with handles and user data (see GUIDATA) |
---|
357 | |
---|
358 | |
---|
359 | % --- Executes on button press in button_z_inj_moins. |
---|
360 | function button_z_inj_moins_Callback(hObject, eventdata, handles) |
---|
361 | % hObject handle to button_z_inj_moins (see GCBO) |
---|
362 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
363 | % handles structure with handles and user data (see GUIDATA) |
---|
364 | tune =str2double(get(handles.z_inj,'String')); |
---|
365 | tune=tune-0.05; |
---|
366 | set(handles.z_inj,'String',num2str(tune)); |
---|
367 | |
---|
368 | % --- Executes on button press in button_z_ext_moins. |
---|
369 | function button_z_ext_moins_Callback(hObject, eventdata, handles) |
---|
370 | % hObject handle to button_z_ext_moins (see GCBO) |
---|
371 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
372 | % handles structure with handles and user data (see GUIDATA) |
---|
373 | tune =str2double(get(handles.z_ext,'String')); |
---|
374 | tune=tune-0.05; |
---|
375 | set(handles.z_ext,'String',num2str(tune)); |
---|
376 | |
---|
377 | % --- Executes on button press in button_z_retour_moins. |
---|
378 | function button_z_retour_moins_Callback(hObject, eventdata, handles) |
---|
379 | % hObject handle to button_z_retour_moins (see GCBO) |
---|
380 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
381 | % handles structure with handles and user data (see GUIDATA) |
---|
382 | tune =str2double(get(handles.z_retour,'String')); |
---|
383 | tune=tune-0.05; |
---|
384 | set(handles.z_retour,'String',num2str(tune)); |
---|
385 | |
---|
386 | function z_retour_Callback(hObject, eventdata, handles) |
---|
387 | % hObject handle to z_retour (see GCBO) |
---|
388 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
389 | % handles structure with handles and user data (see GUIDATA) |
---|
390 | |
---|
391 | % Hints: get(hObject,'String') returns contents of z_retour as text |
---|
392 | % str2double(get(hObject,'String')) returns contents of z_retour as a double |
---|
393 | |
---|
394 | |
---|
395 | % --- Executes during object creation, after setting all properties. |
---|
396 | function z_retour_CreateFcn(hObject, eventdata, handles) |
---|
397 | % hObject handle to z_retour (see GCBO) |
---|
398 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
399 | % handles empty - handles not created until after all CreateFcns called |
---|
400 | |
---|
401 | % Hint: edit controls usually have a white background on Windows. |
---|
402 | % See ISPC and COMPUTER. |
---|
403 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
404 | set(hObject,'BackgroundColor','white'); |
---|
405 | end |
---|
406 | |
---|
407 | |
---|
408 | % --- Executes on button press in button_z_plus. |
---|
409 | function button_z_plus_Callback(hObject, eventdata, handles) |
---|
410 | % hObject handle to button_z_plus (see GCBO) |
---|
411 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
412 | % handles structure with handles and user data (see GUIDATA) |
---|
413 | tune =str2double(get(handles.z_inj,'String')); |
---|
414 | tune=tune+0.05; |
---|
415 | set(handles.z_inj,'String',num2str(tune)); |
---|
416 | tune =str2double(get(handles.z_ext,'String')); |
---|
417 | tune=tune+0.05; |
---|
418 | set(handles.z_ext,'String',num2str(tune)); |
---|
419 | tune =str2double(get(handles.z_retour,'String')); |
---|
420 | tune=tune+0.05; |
---|
421 | set(handles.z_retour,'String',num2str(tune)); |
---|
422 | |
---|
423 | % --- Executes on button press in button_z_zero. |
---|
424 | function button_z_zero_Callback(hObject, eventdata, handles) |
---|
425 | % hObject handle to button_z_zero (see GCBO) |
---|
426 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
427 | % handles structure with handles and user data (see GUIDATA) |
---|
428 | |
---|
429 | tune=0; |
---|
430 | set(handles.z_inj,'String',num2str(tune)); |
---|
431 | set(handles.z_ext,'String',num2str(tune)); |
---|
432 | set(handles.z_retour,'String',num2str(tune)); |
---|
433 | |
---|
434 | % --- Executes on button press in button_z_moins. |
---|
435 | function button_z_moins_Callback(hObject, eventdata, handles) |
---|
436 | % hObject handle to button_z_moins (see GCBO) |
---|
437 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
438 | % handles structure with handles and user data (see GUIDATA) |
---|
439 | tune =str2double(get(handles.z_inj,'String')); |
---|
440 | tune=tune-0.05; |
---|
441 | set(handles.z_inj,'String',num2str(tune)); |
---|
442 | tune =str2double(get(handles.z_ext,'String')); |
---|
443 | tune=tune-0.05; |
---|
444 | set(handles.z_ext,'String',num2str(tune)); |
---|
445 | tune =str2double(get(handles.z_retour,'String')); |
---|
446 | tune=tune-0.05; |
---|
447 | set(handles.z_retour,'String',num2str(tune)); |
---|
448 | |
---|
449 | % --- Executes on button press in button_z_retour_plus. |
---|
450 | function button_z_retour_plus_Callback(hObject, eventdata, handles) |
---|
451 | % hObject handle to button_z_retour_plus (see GCBO) |
---|
452 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
453 | % handles structure with handles and user data (see GUIDATA) |
---|
454 | tune =str2double(get(handles.z_retour,'String')); |
---|
455 | tune=tune+0.05; |
---|
456 | set(handles.z_retour,'String',num2str(tune)); |
---|
457 | |
---|
458 | |
---|
459 | |
---|
460 | % --- Executes on button press in button_apply. |
---|
461 | function button_apply_Callback(hObject, eventdata, handles) |
---|
462 | % hObject handle to button_apply (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 | xinj=str2double(get(handles.x_inj,'String')); |
---|
467 | xext=str2double(get(handles.x_ext,'String')) ; |
---|
468 | xretour=str2double(get(handles.x_retour,'String')) ; |
---|
469 | zinj=str2double(get(handles.z_inj,'String')); |
---|
470 | zext=str2double(get(handles.z_ext,'String')) ; |
---|
471 | zretour=str2double(get(handles.z_retour,'String')) ; |
---|
472 | |
---|
473 | tunex=[ xinj xext xretour]; |
---|
474 | tunez=[ zinj zext zretour]; |
---|
475 | % x z |
---|
476 | dtune_inj = [tunex(1) tunez(1)]; % dnu H et dnu V injection 110 MeV |
---|
477 | dtune_ext = [tunex(2) tunez(2)]; % dnu H et dnu V extraction 2750 MeV |
---|
478 | dtune_dow = [tunex(3) tunez(3)]; % dnu H et dnu V retour 110 MeV |
---|
479 | dtune = [dtune_inj dtune_ext dtune_dow]; |
---|
480 | % |
---|
481 | M=handles.M;sol=inv(M)*dtune'; |
---|
482 | |
---|
483 | fprintf(' ************************** \n') |
---|
484 | fprintf(' OFFSET QF = %g A \n',sol(1) ) |
---|
485 | fprintf(' OFFSET QD = %g A \n',sol(2) ) |
---|
486 | fprintf(' CURRENT QF = %g A \n',sol(3) ) |
---|
487 | fprintf(' CURRENT QD = %g A \n',sol(4) ) |
---|
488 | fprintf(' DELAY QF = %g µs \n',sol(5)*1e+06 ) |
---|
489 | fprintf(' DELAY QD = %g µs \n ',sol(6)*1e+06 ) |
---|
490 | |
---|
491 | % read setpoint values |
---|
492 | button_load_setpoint_Callback(hObject, eventdata, handles); |
---|
493 | boo=handles.boo; |
---|
494 | |
---|
495 | % add delta current on the solution |
---|
496 | if (sol(1)<50) & (sol(2)<50) |
---|
497 | |
---|
498 | boo.QFpoffset=boo.QFpoffset + sol(1); |
---|
499 | boo.QDpoffset=boo.QDpoffset + sol(2); |
---|
500 | boo.QFcurrent=boo.QFcurrent + sol(3); |
---|
501 | boo.QDcurrent=boo.QDcurrent + sol(4); |
---|
502 | |
---|
503 | boo.QFdelay = boo.QFdelay + sol(5)*1e+06; |
---|
504 | boo.QDdelay = boo.QDdelay + sol(6)*1e+06; |
---|
505 | handles.boo=boo; |
---|
506 | guidata(hObject, handles); |
---|
507 | |
---|
508 | end |
---|
509 | |
---|
510 | % apply solution |
---|
511 | button_load_file_Callback(hObject, eventdata, handles); |
---|
512 | |
---|
513 | |
---|
514 | ok=1; |
---|
515 | |
---|
516 | if (ok==1) |
---|
517 | |
---|
518 | |
---|
519 | |
---|
520 | |
---|
521 | % model pour affichage |
---|
522 | Grf = 0.0465 +0.015; % gradient remanent T/m |
---|
523 | Grd = 0.0490 +0.0093; % gradient remanent T/m |
---|
524 | af = 0.0520 ; % G/I T/m/A |
---|
525 | ad = 0.0517; |
---|
526 | Br = 0.0020 ; % Champ remanent T |
---|
527 | b = 0.0013516 ; % B/I T/A |
---|
528 | rho=12.3759 ; % rayon dipole |
---|
529 | brhom = 9.17 ; |
---|
530 | deltaf=-0.00005 ; |
---|
531 | deltad=-0.00005 ; |
---|
532 | |
---|
533 | load 'current_ttf' time Df1 Df2 Dqf Dqd; |
---|
534 | n=length(Df1); |
---|
535 | dt=0.0001/6; %step temp 16 ï¿œs |
---|
536 | |
---|
537 | |
---|
538 | |
---|
539 | %% model |
---|
540 | Iqf0 = boo.QFcurrent; Iqfc = boo.QFpoffset; |
---|
541 | Iqd0 = boo.QDcurrent; Iqdc = boo.QDpoffset ; |
---|
542 | Id0 = boo.DIPcurrent; Ibc = boo.DIPoffset ; |
---|
543 | delf=deltaf + (boo.DIPdelay-boo.QFdelay)*1e-06 ; % 0.0002 -sol(5) % avance si positif |
---|
544 | deld=deltad + (boo.DIPdelay-boo.QDdelay)*1e-06 ; % 0.0001 -sol(6) |
---|
545 | |
---|
546 | |
---|
547 | %courant en manipe 09-04-06 |
---|
548 | % Iqf0 =201.65 +sol(3); Iqfc = -0.617 +sol(1); |
---|
549 | % Iqd0 =162.43 +sol(4); Iqdc = -0.700 +sol(2) ; |
---|
550 | % Id0 =545; Ibc = -0.01 ; |
---|
551 | % delf=deltaf + 0.0002 -sol(5) ; % avance si positif |
---|
552 | % deld=deltad + 0.0001 -sol(6); |
---|
553 | |
---|
554 | |
---|
555 | |
---|
556 | |
---|
557 | % calcul dï¿œcalage table pour dï¿œlai |
---|
558 | clear qf qd |
---|
559 | k1=int16(delf/dt); |
---|
560 | if (k1>0) |
---|
561 | qf=[Dqf(k1+1:n); Dqf(1:k1)]; |
---|
562 | else |
---|
563 | qf=[Dqf(n+k1:n); Dqf(1:n+k1-1)]; |
---|
564 | end |
---|
565 | k1=int16(deld/dt); |
---|
566 | if (k1>0) |
---|
567 | qd=[Dqd(k1+1:n); Dqd(1:k1)]; |
---|
568 | else |
---|
569 | qd=[Dqd(n+k1:n); Dqd(1:n+k1-1)]; |
---|
570 | end |
---|
571 | Dqf1=qf; |
---|
572 | Dqd1=qd; |
---|
573 | |
---|
574 | clear Id Iqf Iqd |
---|
575 | Id =Id0*(Df1+Df2)*(-28)/553.6 +Ibc; |
---|
576 | Iqf=Iqf0*Dqf1*(-25)/201.3 + Iqfc; |
---|
577 | Iqd=Iqd0*Dqd1*(-25)/151.04 + Iqdc; |
---|
578 | |
---|
579 | clear pf pd p0 rf rd |
---|
580 | pf=Grf + af*(Iqf); |
---|
581 | pd=Grd + ad*(Iqd); |
---|
582 | p0=Br + b.*(Id); |
---|
583 | rf=pf./(p0*rho); |
---|
584 | rd=pd./(p0*rho); |
---|
585 | |
---|
586 | table=(31 + [0 10 20 30 100 148 200 270 280 293 ]); |
---|
587 | |
---|
588 | ntable=int16(table*1e-03/dt); |
---|
589 | |
---|
590 | |
---|
591 | global THERING |
---|
592 | clear dnux dnuz tt |
---|
593 | %switch2sim |
---|
594 | QFI = findcells(THERING,'FamName','QPF'); |
---|
595 | QDI = findcells(THERING,'FamName','QPD'); |
---|
596 | i=0; |
---|
597 | for k=1:length(table) |
---|
598 | n1=ntable(k); |
---|
599 | KQF=rf(n1); |
---|
600 | KQD=-rd(n1); |
---|
601 | THERING = setcellstruct(THERING,'K',QFI,KQF); |
---|
602 | THERING = setcellstruct(THERING,'K',QDI,KQD); |
---|
603 | THERING = setcellstruct(THERING,'PolynomB',QFI, KQF,2); |
---|
604 | THERING = setcellstruct(THERING,'PolynomB',QDI, KQD,2); |
---|
605 | [TD, tune] = twissring(THERING,0,1:(length(THERING)+1)); |
---|
606 | dnux(k)=tune(1);dnuz(k)=tune(2); |
---|
607 | end |
---|
608 | n1=ntable(1); |
---|
609 | n2=ntable(6); % ntable(length(ntable)); |
---|
610 | fprintf('\n'); |
---|
611 | fprintf(' Tune à l injection %g %g: \n', dnux(1), dnuz(1)) |
---|
612 | fprintf(' Courant à l injection %g %g %g: \n', (Id(n1)),(Iqf(n1)),(Iqd(n1))) |
---|
613 | fprintf(' Courant à la redescente %g %g %g: \n', (Id(n2)),(Iqf(n2)),(Iqd(n2))) |
---|
614 | fprintf('\n');fprintf('\n'); |
---|
615 | |
---|
616 | axes(handles.axes1) |
---|
617 | plot(table,dnux-6, '-or',table , dnuz-4,'-ob'); |
---|
618 | legend('X','Z') |
---|
619 | xlim([0 340]); ylim([0.5 1]); |
---|
620 | xlabel('Time (ms)'); ylabel('Tune'); |
---|
621 | grid on |
---|
622 | |
---|
623 | end |
---|
624 | |
---|
625 | function comment_Callback(hObject, eventdata, handles) |
---|
626 | % hObject handle to comment (see GCBO) |
---|
627 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
628 | % handles structure with handles and user data (see GUIDATA) |
---|
629 | |
---|
630 | % Hints: get(hObject,'String') returns contents of comment as text |
---|
631 | % str2double(get(hObject,'String')) returns contents of comment as a double |
---|
632 | |
---|
633 | |
---|
634 | % --- Executes during object creation, after setting all properties. |
---|
635 | function comment_CreateFcn(hObject, eventdata, handles) |
---|
636 | % hObject handle to comment (see GCBO) |
---|
637 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
638 | % handles empty - handles not created until after all CreateFcns called |
---|
639 | |
---|
640 | % Hint: edit controls usually have a white background on Windows. |
---|
641 | % See ISPC and COMPUTER. |
---|
642 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
643 | set(hObject,'BackgroundColor','white'); |
---|
644 | end |
---|
645 | |
---|
646 | |
---|
647 | % --- Executes on button press in button_save. |
---|
648 | function button_save_Callback(hObject, eventdata, handles) |
---|
649 | % hObject handle to button_save (see GCBO) |
---|
650 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
651 | % handles structure with handles and user data (see GUIDATA) |
---|
652 | |
---|
653 | legend=get(handles.comment,'String'); |
---|
654 | Directory = [getfamilydata('Directory','DataRoot') 'Datatemp']; |
---|
655 | pwdold = pwd; |
---|
656 | cd(Directory); |
---|
657 | save_param(legend) |
---|
658 | cd(pwdold); |
---|
659 | |
---|
660 | % --- Executes on button press in button_load_file. |
---|
661 | function button_load_file_Callback(hObject, eventdata, handles) |
---|
662 | % hObject handle to button_load_file (see GCBO) |
---|
663 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
664 | % handles structure with handles and user data (see GUIDATA) |
---|
665 | |
---|
666 | boo=handles.boo; |
---|
667 | boo |
---|
668 | tout=0.5; |
---|
669 | %Alim |
---|
670 | writeattribute('BOO/AE/dipole/current',boo.DIPcurrent); |
---|
671 | writeattribute('BOO/AE/QF/current',boo.QFcurrent); |
---|
672 | writeattribute('BOO/AE/QD/current',boo.QDcurrent); |
---|
673 | writeattribute('BOO/AE/SF/current',boo.SFcurrent); |
---|
674 | writeattribute('BOO/AE/SD/current',boo.SDcurrent); |
---|
675 | writeattribute('BOO/AE/dipole/waveformOffset',boo.DIPoffset); |
---|
676 | writeattribute('BOO/AE/QF/waveformOffset',boo.QFpoffset); |
---|
677 | writeattribute('BOO/AE/QD/waveformOffset',boo.QDpoffset); |
---|
678 | writeattribute('BOO/AE/SF/waveformOffset',boo.SFpoffset); |
---|
679 | writeattribute('BOO/AE/SD/waveformOffset',boo.SDpoffset); |
---|
680 | %timing |
---|
681 | tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay',boo.DIPdelay);pause(tout); |
---|
682 | tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay',boo.QFdelay);pause(tout); |
---|
683 | tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay',boo.QDdelay);pause(tout); |
---|
684 | tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTimeDelay',boo.DIPdelay);pause(tout); |
---|
685 | tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTimeDelay',boo.DIPdelay);pause(tout); |
---|
686 | |
---|
687 | |
---|
688 | % --- Executes on button press in button_openfile. |
---|
689 | function button_openfile_Callback(hObject, eventdata, handles) |
---|
690 | % hObject handle to button_openfile (see GCBO) |
---|
691 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
692 | % handles structure with handles and user data (see GUIDATA) |
---|
693 | |
---|
694 | Directory = [getfamilydata('Directory','DataRoot') 'Datatemp']; |
---|
695 | pwdold = pwd; |
---|
696 | cd(Directory); |
---|
697 | [FileName,PathName] = uigetfile('*.mat','Select the setpoint file'); |
---|
698 | load(FileName, 'boo'); |
---|
699 | handles.boo=boo; |
---|
700 | set(handles.comment,'String',boo.comment); |
---|
701 | guidata(hObject, handles); |
---|
702 | cd(pwdold); |
---|
703 | |
---|
704 | % --- Executes on button press in button_load_setpoint. |
---|
705 | function button_load_setpoint_Callback(hObject, eventdata, handles) |
---|
706 | % hObject handle to button_load_setpoint (see GCBO) |
---|
707 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
708 | % handles structure with handles and user data (see GUIDATA) |
---|
709 | % alim |
---|
710 | boo.DIPcurrent=readattribute('BOO/AE/D.1/current' ,'Setpoint'); |
---|
711 | boo.DIPoffset =readattribute('BOO/AE/D.1/waveformOffset' ,'Setpoint'); |
---|
712 | boo.QFcurrent=readattribute('BOO/AE/QF/current' ,'Setpoint'); |
---|
713 | boo.QFpoffset =readattribute('BOO/AE/QF/waveformOffset' ,'Setpoint'); |
---|
714 | boo.QDcurrent=readattribute('BOO/AE/QD/current' ,'Setpoint'); |
---|
715 | boo.QDpoffset =readattribute('BOO/AE/QD/waveformOffset' ,'Setpoint'); |
---|
716 | boo.SFcurrent=readattribute('BOO/AE/SF/current' ,'Setpoint'); |
---|
717 | boo.SFpoffset =readattribute('BOO/AE/SF/waveformOffset' ,'Setpoint'); |
---|
718 | boo.SDcurrent=readattribute('BOO/AE/SD/current' ,'Setpoint'); |
---|
719 | boo.SDpoffset =readattribute('BOO/AE/SD/waveformOffset' ,'Setpoint'); |
---|
720 | % synchro |
---|
721 | temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay'); |
---|
722 | boo.DIPdelay=temp.value(1); |
---|
723 | temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay'); |
---|
724 | boo.QFdelay=temp.value(1); |
---|
725 | temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay'); |
---|
726 | boo.QDdelay=temp.value(1); |
---|
727 | |
---|
728 | handles.boo=boo; |
---|
729 | boo |
---|
730 | guidata(hObject, handles); |
---|