source: MML/trunk/machine/SOLEIL/common/synchro/synchro_injecteur7_rafale.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 149.1 KB
Line 
1function varargout = synchro_injecteur7_rafale(varargin)
2% SYNCHRO_INJECTEUR7_RAFALE M-file for synchro_injecteur7_rafale.fig
3%      SYNCHRO_INJECTEUR7_RAFALE, by itself, creates a new SYNCHRO_INJECTEUR7_RAFALE or raises the existing
4%      singleton*.
5%
6%      H = SYNCHRO_INJECTEUR7_RAFALE returns the handle to a new SYNCHRO_INJECTEUR7_RAFALE or the handle to
7%      the existing singleton*.
8%
9%      SYNCHRO_INJECTEUR7_RAFALE('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in SYNCHRO_INJECTEUR7_RAFALE.M with the given input arguments.
11%
12%      SYNCHRO_INJECTEUR7_RAFALE('Property','Value',...) creates a new SYNCHRO_INJECTEUR7_RAFALE or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before synchro_injecteur7_rafale_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to synchro_injecteur7_rafale_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% For the compiler
24%#function aoinit setao setoperationalmode
25%#function boosterinit
26%#function magnetcoefficients
27%
28
29% Edit the above text to modify the response to help synchro_injecteur7_rafale
30
31% Last Modified by GUIDE v2.5 02-Oct-2008 16:05:52
32
33% Begin initialization code - DO NOT EDIT
34gui_Singleton = 1;
35gui_State = struct('gui_Name',       mfilename, ...
36                   'gui_Singleton',  gui_Singleton, ...
37                   'gui_OpeningFcn', @synchro_injecteur7_rafale_OpeningFcn, ...
38                   'gui_OutputFcn',  @synchro_injecteur7_rafale_OutputFcn, ...
39                   'gui_LayoutFcn',  [] , ...
40                   'gui_Callback',   []);
41if nargin && ischar(varargin{1})
42    gui_State.gui_Callback = str2func(varargin{1});
43end
44
45if nargout
46    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
47else
48    gui_mainfcn(gui_State, varargin{:});
49end
50% End initialization code - DO NOT EDIT
51
52
53% --- Executes just before synchro_injecteur7_rafale is made visible.
54function synchro_injecteur7_rafale_OpeningFcn(hObject, eventdata, handles, varargin)
55% This function has no output args, see OutputFcn.
56% hObject    handle to figure
57% eventdata  reserved - to be defined in a future version of MATLAB
58% handles    structure with handles and user data (see GUIDATA)
59% varargin   command line arguments to synchro_injecteur7_rafale (see VARARGIN)
60
61% Choose default command line output for synchro_injecteur7_rafale
62handles.output = hObject;
63
64% list les devices annexe pour etat
65fprintf('Liste devices annexes \n');
66% name={'ANS-C03/DG/DCCT','LT1/DG/MC','BOO-C01/DG/DCCT',...
67%     'ANS/DG/PUB-FillingMode', 'ANS/FC/INJ_COND'};
68name={'ANS/DG/DCCT-CTRL','LT1/DG/MC','BOO-C01/DG/DCCT',...
69    'ANS/DG/PUB-FillingMode', 'ANS/FC/INJ_COND'};
70for i=1:4
71    try
72        txt=tango_command_inout2(name{2},'State');
73        %temp=tango_read_attribute(name{i},'State');
74        %temp=tango_read_attribute(name{i},'Status');txt=temp.value;
75    catch
76        txt='bug_device';
77    end
78    fprintf('%s   :   %s \n',name{i},txt);
79end
80
81% Added by Laurent
82if isdeployed
83    cd(getenv('MLROOT'));
84    setpathsoleil('Booster');
85end
86% End
87
88% Directories
89%Directory='/home/matlabML/measdata/SOLEIL/Boosterdata/Datatemp'; % ALEX
90Directory =  [getfamilydata('Directory','DataRoot') '../Boosterdata/Datatemp']; % Laurent
91handles.Directory=Directory;  % for saved data
92
93%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'synchro_offset_lin');
94% DirName ='/home/matlabML/machine/SOLEIL/common/synchro/'; % ALEX
95DirName = getfamilydata('Directory', 'Synchro'); % Laurent
96handles.DirName=DirName;      % for offset & table
97
98% Charge les offset
99FileName = [DirName 'synchro_offset_lin'];
100fprintf('Laurent:%s\n', FileName');
101load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
102set(handles.inj_offset,'String',num2str(inj_offset));
103set(handles.ext_offset,'String',num2str(ext_offset));
104set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
105% Periode linac fin
106handles.lin_fin_step=0.090;                   % En ns  (90 ps)
107handles.one_bunch=2.84/handles.lin_fin_step;  % Nombre de pas pour sauter un paquet
108
109% Periode du trigger par defaut = 10 s
110handles.periode = 10;
111set(handles.periode_edit,'String',num2str(handles.periode));
112set(handles.edit_Ncycle,'String',num2str(1));
113set(handles.edit_Ncoup,'String',1.0);
114
115%Memorise les délais spare et soft initiaux
116temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprStepDelay');
117clk1=temp.value(1);
118temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
119clk2=temp.value(1);
120
121%Stocke les sauts pour les 4 quarts mode LPM
122jump=int32([0 39 26 13]);
123handles.clk_spare  =jump +  int32(clk1);
124handles.clk_soft=jump  + int32(clk2);
125handles.quart=1;
126
127% Table initiale sur paquet 1
128bunch=[1];
129[dtour,dpaquet]=bucketnumber(bunch);
130offset_linac=lin_fin/handles.lin_fin_step;
131bjump=handles.one_bunch;
132dpaquet=dpaquet*bjump+offset_linac;
133handles.table=int32([length(bunch) dtour dpaquet]);
134handles.table0=handles.table;
135handles.bunch=bunch;
136
137handles.mode = 'Mode=???';
138set(handles.edit_filling_relecture_tables,'Enable','off');
139set(handles.edit_filling_relecture_bunch,'Enable','off');
140
141% Verifie le mode selectionné en SPM ou LPM
142% Verifie le mode central selectionné  : rafale ou continue
143% Verifie le mode selectionné en SPM : 1 2 ou 3 paquets
144% Verifie le mode d'injection selectionné : soft ou 3Hz
145test_modes(handles);
146
147
148% Choix des events
149handles.event0 =int32(0);
150handles.event00=int32(100);  %Spéciale EP
151
152% Cache le tableau des délais BPM
153set(handles.panel_bpm,'Visible','off');
154set(handles.uipanel_kicker_machine,'Visible','off');
155
156% text affichage
157handles.txt_inj=  ' INJECTION AUTOMATIQUE EN COURS '; % txt injection auto en cours
158handles.txt_noinj=' INJECTION INTERDITE ';            % txt injection non autorise (Grp fonctionnement)
159
160% Publisher - fonctionnement (gere sur injection en boucle)
161tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(0))         % flag injection auto
162tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(0))  % flag courant consigne atteint
163 
164% tango parser ANS/FC/INJ_COND
165% temp=tango_read_attribute2('ANS/FC/INJ_COND', 'COND_INJ');
166% handles.cond_inj=temp.value;   % 0 no injection,  1 injection
167% try temp=tango_read_attribute2('ANS/FC/INJ_COND', 'COND_INJ'); % 0 no injection,  1 injection
168% val=temp.value; catch val=1 ; end ; if val~=0 ; val=1; end;
169% handles.cond_inj=val;
170
171
172% Fonction timer pour injection en boucle
173% Creates timer Infinite loop
174timer2=timer('StartDelay',1,...
175    'ExecutionMode','fixedRate','Period',3,'TasksToExecute',Inf);
176timer2.TimerFcn = {@fonction_alex2, hObject,eventdata, handles};
177setappdata(handles.figure1,'Timer2',timer2);
178
179% Creates timer Infinite loop
180timer1=timer('StartDelay',1,...
181    'ExecutionMode','fixedRate','Period',handles.periode,'TasksToExecute',Inf);
182timer1.TimerFcn = {@fonction_alex1, hObject,eventdata, handles};
183setappdata(handles.figure1,'Timer1',timer1);
184
185% button group sur on/off timer du trigger
186h = uibuttongroup('visible','off','Position',[0.141 0.37 0.11 0.14],...
187    'Title','','TitlePosition','centertop',...
188    'BackgroundColor',[1 0.3 0 ]);
189u1 = uicontrol('Style','Radio','String',' OFF','Tag','radiobutton1',...
190    'pos',[05 85 55 25],'parent',h,'HandleVisibility','off',...
191    'BackgroundColor',[1 0.3 0  ]);
192u2 = uicontrol('Style','Radio','String',' Laps :','Tag','radiobutton2',...
193    'pos',[05 45 55 25],'parent',h,'HandleVisibility','off',...
194    'BackgroundColor',[1 0.3 0 ]);
195u3 = uicontrol('Style','Radio','String',' Imin :','Tag','radiobutton3',...
196    'pos',[05 05 55 25],'parent',h,'HandleVisibility','off',...
197    'BackgroundColor',[1 0.3 0 ]);
198
199set(h,'SelectionChangeFcn',...
200    {@uibuttongroup_SelectionChangeFcn,handles});
201
202handles.off = u1;
203handles.on1 = u2;
204handles.on2 = u3;
205
206set(h,'SelectedObject',u1);
207set(h,'Visible','on');
208
209%% Set closing gui function
210set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer1,handles.figure1});
211set(handles.figure1,'CloseRequestFcn',{@Closinggui,timer2,handles.figure1});
212
213
214% Update handles structure
215guidata(hObject, handles);
216
217% UIWAIT makes synchro_injecteur7_rafale wait for user response (see UIRESUME)
218% uiwait(handles.figure1);
219
220
221% --- Outputs from this function are returned to the command line.
222function varargout = synchro_injecteur7_rafale_OutputFcn(hObject, eventdata, handles)
223% varargout  cell array for returning output args (see VARARGOUT);
224% hObject    handle to figure
225% eventdata  reserved - to be defined in a future version of MATLAB
226% handles    structure with handles and user data (see GUIDATA)
227
228% Get default command line output from handles structure
229varargout{1} = handles.output;
230
231
232
233function boo_alim_dipole_Callback(hObject, eventdata, handles)
234% hObject    handle to boo_alim_dipole (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% Hints: get(hObject,'String') returns contents of boo_alim_dipole as text
239%        str2double(get(hObject,'String')) returns contents of boo_alim_dipole as a double
240%h=gcf
241delay=str2double(get(hObject,'String'));
242tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'dpTimeDelay',delay);
243
244% --- Executes during object creation, after setting all properties.
245function boo_alim_dipole_CreateFcn(hObject, eventdata, handles)
246% hObject    handle to boo_alim_dipole (see GCBO)
247% eventdata  reserved - to be defined in a future version of MATLAB
248% handles    empty - handles not created until after all CreateFcns called
249
250% Hint: edit controls usually have a white background on Windows.
251%       See ISPC and COMPUTER.
252if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
253    set(hObject,'BackgroundColor','white');
254end
255
256
257function boo_alim_qf_Callback(hObject, eventdata, handles)
258% hObject    handle to boo_alim_qf (see GCBO)
259% eventdata  reserved - to be defined in a future version of MATLAB
260% handles    structure with handles and user data (see GUIDATA)
261
262% Hints: get(hObject,'String') returns contents of boo_alim_qf as text
263%        str2double(get(hObject,'String')) returns contents of boo_alim_qf as a double
264
265delay=str2double(get(hObject,'String'));
266tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay',delay);
267
268% --- Executes during object creation, after setting all properties.
269function boo_alim_qf_CreateFcn(hObject, eventdata, handles)
270% hObject    handle to boo_alim_qf (see GCBO)
271% eventdata  reserved - to be defined in a future version of MATLAB
272% handles    empty - handles not created until after all CreateFcns called
273
274% Hint: edit controls usually have a white background on Windows.
275%       See ISPC and COMPUTER.
276if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
277    set(hObject,'BackgroundColor','white');
278end
279
280
281
282function boo_alim_qd_Callback(hObject, eventdata, handles)
283% hObject    handle to boo_alim_qd (see GCBO)
284% eventdata  reserved - to be defined in a future version of MATLAB
285% handles    structure with handles and user data (see GUIDATA)
286
287% Hints: get(hObject,'String') returns contents of boo_alim_qd as text
288%        str2double(get(hObject,'String')) returns contents of boo_alim_qd as a double
289
290delay=str2double(get(hObject,'String'));
291tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay',delay);
292
293% --- Executes during object creation, after setting all properties.
294function boo_alim_qd_CreateFcn(hObject, eventdata, handles)
295% hObject    handle to boo_alim_qd (see GCBO)
296% eventdata  reserved - to be defined in a future version of MATLAB
297% handles    empty - handles not created until after all CreateFcns called
298
299% Hint: edit controls usually have a white background on Windows.
300%       See ISPC and COMPUTER.
301if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
302    set(hObject,'BackgroundColor','white');
303end
304
305
306
307function boo_alim_sf_Callback(hObject, eventdata, handles)
308% hObject    handle to boo_alim_sf (see GCBO)
309% eventdata  reserved - to be defined in a future version of MATLAB
310% handles    structure with handles and user data (see GUIDATA)
311
312% Hints: get(hObject,'String') returns contents of boo_alim_sf as text
313%        str2double(get(hObject,'String')) returns contents of boo_alim_sf as a double
314
315delay=str2double(get(hObject,'String'));
316tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sfTimeDelay',delay);
317
318% --- Executes during object creation, after setting all properties.
319function boo_alim_sf_CreateFcn(hObject, eventdata, handles)
320% hObject    handle to boo_alim_sf (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: edit controls usually have a white background on Windows.
325%       See ISPC and COMPUTER.
326if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
327    set(hObject,'BackgroundColor','white');
328end
329
330
331
332function boo_alim_sd_Callback(hObject, eventdata, handles)
333% hObject    handle to boo_alim_sd (see GCBO)
334% eventdata  reserved - to be defined in a future version of MATLAB
335% handles    structure with handles and user data (see GUIDATA)
336
337% Hints: get(hObject,'String') returns contents of boo_alim_sd as text
338%        str2double(get(hObject,'String')) returns contents of boo_alim_sd as a double
339
340delay=str2double(get(hObject,'String'));
341tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'sdTimeDelay',delay);
342
343
344% --- Executes during object creation, after setting all properties.
345function boo_alim_sd_CreateFcn(hObject, eventdata, handles)
346% hObject    handle to boo_alim_sd (see GCBO)
347% eventdata  reserved - to be defined in a future version of MATLAB
348% handles    empty - handles not created until after all CreateFcns called
349
350% Hint: edit controls usually have a white background on Windows.
351%       See ISPC and COMPUTER.
352if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
353    set(hObject,'BackgroundColor','white');
354end
355
356
357
358function boo_rf_Callback(hObject, eventdata, handles)
359% hObject    handle to boo_rf (see GCBO)
360% eventdata  reserved - to be defined in a future version of MATLAB
361% handles    structure with handles and user data (see GUIDATA)
362
363% Hints: get(hObject,'String') returns contents of boo_rf as text
364%        str2double(get(hObject,'String')) returns contents of boo_rf as a double
365
366delay=str2double(get(hObject,'String'));
367tango_write_attribute2('BOO/SY/LOCAL.RF.1', 'rfTimeDelay',delay);
368
369% --- Executes during object creation, after setting all properties.
370function boo_rf_CreateFcn(hObject, eventdata, handles)
371% hObject    handle to boo_rf (see GCBO)
372% eventdata  reserved - to be defined in a future version of MATLAB
373% handles    empty - handles not created until after all CreateFcns called
374
375% Hint: edit controls usually have a white background on Windows.
376%       See ISPC and COMPUTER.
377if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
378    set(hObject,'BackgroundColor','white');
379end
380
381
382
383function lin_canon_lpm_Callback(hObject, eventdata, handles)
384% hObject    handle to lin_canon_lpm (see GCBO)
385% eventdata  reserved - to be defined in a future version of MATLAB
386% handles    structure with handles and user data (see GUIDATA)
387
388% Hints: get(hObject,'String') returns contents of lin_canon_lpm as text
389%        str2double(get(hObject,'String')) returns contents of lin_canon_lpm as a double
390
391inj_offset=str2double(get(handles.inj_offset,'String'));
392delay=str2double(get(hObject,'String'))+inj_offset;
393tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
394
395
396% --- Executes during object creation, after setting all properties.
397function lin_canon_lpm_CreateFcn(hObject, eventdata, handles)
398% hObject    handle to lin_canon_lpm (see GCBO)
399% eventdata  reserved - to be defined in a future version of MATLAB
400% handles    empty - handles not created until after all CreateFcns called
401
402% Hint: edit controls usually have a white background on Windows.
403%       See ISPC and COMPUTER.
404if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
405    set(hObject,'BackgroundColor','white');
406end
407
408
409
410function lt1_emittance_Callback(hObject, eventdata, handles)
411% hObject    handle to lt1_emittance (see GCBO)
412% eventdata  reserved - to be defined in a future version of MATLAB
413% handles    structure with handles and user data (see GUIDATA)
414
415% Hints: get(hObject,'String') returns contents of lt1_emittance as text
416%        str2double(get(hObject,'String')) returns contents of lt1_emittance as a double
417inj_offset=str2double(get(handles.inj_offset,'String'));
418delay=str2double(get(hObject,'String'))+inj_offset;
419tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
420
421% --- Executes during object creation, after setting all properties.
422function lt1_emittance_CreateFcn(hObject, eventdata, handles)
423% hObject    handle to lt1_emittance (see GCBO)
424% eventdata  reserved - to be defined in a future version of MATLAB
425% handles    empty - handles not created until after all CreateFcns called
426
427% Hint: edit controls usually have a white background on Windows.
428%       See ISPC and COMPUTER.
429if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
430    set(hObject,'BackgroundColor','white');
431end
432
433
434
435function lt1_MC1_Callback(hObject, eventdata, handles)
436% hObject    handle to lt1_MC1 (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
440% Hints: get(hObject,'String') returns contents of lt1_MC1 as text
441%        str2double(get(hObject,'String')) returns contents of lt1_MC1 as a double
442inj_offset=str2double(get(handles.inj_offset,'String'));
443delay=str2double(get(hObject,'String'))+inj_offset;
444tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
445
446% --- Executes during object creation, after setting all properties.
447function lt1_MC1_CreateFcn(hObject, eventdata, handles)
448% hObject    handle to lt1_MC1 (see GCBO)
449% eventdata  reserved - to be defined in a future version of MATLAB
450% handles    empty - handles not created until after all CreateFcns called
451
452% Hint: edit controls usually have a white background on Windows.
453%       See ISPC and COMPUTER.
454if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
455    set(hObject,'BackgroundColor','white');
456end
457
458
459
460function lt1_MC2_Callback(hObject, eventdata, handles)
461% hObject    handle to lt1_MC2 (see GCBO)
462% eventdata  reserved - to be defined in a future version of MATLAB
463% handles    structure with handles and user data (see GUIDATA)
464
465% Hints: get(hObject,'String') returns contents of lt1_MC2 as text
466%        str2double(get(hObject,'String')) returns contents of lt1_MC2 as a double
467inj_offset=str2double(get(handles.inj_offset,'String'));
468delay=str2double(get(hObject,'String'))+inj_offset;
469tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
470
471% --- Executes during object creation, after setting all properties.
472function lt1_MC2_CreateFcn(hObject, eventdata, handles)
473% hObject    handle to lt1_MC2 (see GCBO)
474% eventdata  reserved - to be defined in a future version of MATLAB
475% handles    empty - handles not created until after all CreateFcns called
476
477% Hint: edit controls usually have a white background on Windows.
478%       See ISPC and COMPUTER.
479if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
480    set(hObject,'BackgroundColor','white');
481end
482
483
484
485function lt1_osc_Callback(hObject, eventdata, handles)
486% hObject    handle to lt1_osc (see GCBO)
487% eventdata  reserved - to be defined in a future version of MATLAB
488% handles    structure with handles and user data (see GUIDATA)
489
490% Hints: get(hObject,'String') returns contents of lt1_osc as text
491%        str2double(get(hObject,'String')) returns contents of lt1_osc as a double
492inj_offset=str2double(get(handles.inj_offset,'String'));
493delay=str2double(get(hObject,'String'))+inj_offset;
494tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
495
496
497% --- Executes during object creation, after setting all properties.
498function lt1_osc_CreateFcn(hObject, eventdata, handles)
499% hObject    handle to lt1_osc (see GCBO)
500% eventdata  reserved - to be defined in a future version of MATLAB
501% handles    empty - handles not created until after all CreateFcns called
502
503% Hint: edit controls usually have a white background on Windows.
504%       See ISPC and COMPUTER.
505if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
506    set(hObject,'BackgroundColor','white');
507end
508
509
510
511function sdc1_Callback(hObject, eventdata, handles)
512% hObject    handle to sdc1 (see GCBO)
513% eventdata  reserved - to be defined in a future version of MATLAB
514% handles    structure with handles and user data (see GUIDATA)
515
516% Hints: get(hObject,'String') returns contents of sdc1 as text
517%        str2double(get(hObject,'String')) returns contents of sdc1 as a double
518inj_offset=str2double(get(handles.inj_offset,'String'));
519delay=str2double(get(hObject,'String'))+inj_offset;
520tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
521
522% --- Executes during object creation, after setting all properties.
523function sdc1_CreateFcn(hObject, eventdata, handles)
524% hObject    handle to sdc1 (see GCBO)
525% eventdata  reserved - to be defined in a future version of MATLAB
526% handles    empty - handles not created until after all CreateFcns called
527
528% Hint: edit controls usually have a white background on Windows.
529%       See ISPC and COMPUTER.
530if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
531    set(hObject,'BackgroundColor','white');
532end
533
534
535
536function boo_inj_septum_Callback(hObject, eventdata, handles)
537% hObject    handle to boo_inj_septum (see GCBO)
538% eventdata  reserved - to be defined in a future version of MATLAB
539% handles    structure with handles and user data (see GUIDATA)
540
541% Hints: get(hObject,'String') returns contents of boo_inj_septum as text
542%        str2double(get(hObject,'String')) returns contents of boo_inj_septum as a double
543inj_offset=str2double(get(handles.inj_offset,'String'));
544delay=str2double(get(hObject,'String'))+inj_offset;
545tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
546
547% --- Executes during object creation, after setting all properties.
548function boo_inj_septum_CreateFcn(hObject, eventdata, handles)
549% hObject    handle to boo_inj_septum (see GCBO)
550% eventdata  reserved - to be defined in a future version of MATLAB
551% handles    empty - handles not created until after all CreateFcns called
552
553% Hint: edit controls usually have a white background on Windows.
554%       See ISPC and COMPUTER.
555if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
556    set(hObject,'BackgroundColor','white');
557end
558
559
560
561function boo_inj_kicker_Callback(hObject, eventdata, handles)
562% hObject    handle to boo_inj_kicker (see GCBO)
563% eventdata  reserved - to be defined in a future version of MATLAB
564% handles    structure with handles and user data (see GUIDATA)
565
566% Hints: get(hObject,'String') returns contents of boo_inj_kicker as text
567%        str2double(get(hObject,'String')) returns contents of boo_inj_kicker as a double
568inj_offset=str2double(get(handles.inj_offset,'String'));
569delay=str2double(get(hObject,'String'))+inj_offset;
570tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
571
572% --- Executes during object creation, after setting all properties.
573function boo_inj_kicker_CreateFcn(hObject, eventdata, handles)
574% hObject    handle to boo_inj_kicker (see GCBO)
575% eventdata  reserved - to be defined in a future version of MATLAB
576% handles    empty - handles not created until after all CreateFcns called
577
578% Hint: edit controls usually have a white background on Windows.
579%       See ISPC and COMPUTER.
580if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
581    set(hObject,'BackgroundColor','white');
582end
583
584
585
586function boo_bpm_Callback(hObject, eventdata, handles)
587% hObject    handle to boo_bpm (see GCBO)
588% eventdata  reserved - to be defined in a future version of MATLAB
589% handles    structure with handles and user data (see GUIDATA)
590
591% Hints: get(hObject,'String') returns contents of boo_bpm as text
592%        str2double(get(hObject,'String')) returns contents of boo_bpm as a double
593
594inj_offset=str2double(get(handles.inj_offset,'String'));
595delay=str2double(get(hObject,'String'))+inj_offset;
596tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
597tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
598tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
599tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
600
601
602% --- Executes during object creation, after setting all properties.
603function boo_bpm_CreateFcn(hObject, eventdata, handles)
604% hObject    handle to boo_bpm (see GCBO)
605% eventdata  reserved - to be defined in a future version of MATLAB
606% handles    empty - handles not created until after all CreateFcns called
607
608% Hint: edit controls usually have a white background on Windows.
609%       See ISPC and COMPUTER.
610if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
611    set(hObject,'BackgroundColor','white');
612end
613
614
615
616function boo_nod_Callback(hObject, eventdata, handles)
617% hObject    handle to boo_nod (see GCBO)
618% eventdata  reserved - to be defined in a future version of MATLAB
619% handles    structure with handles and user data (see GUIDATA)
620
621% Hints: get(hObject,'String') returns contents of boo_nod as text
622%        str2double(get(hObject,'String')) returns contents of boo_nod as a double
623inj_offset=str2double(get(handles.inj_offset,'String'));
624delay=str2double(get(hObject,'String'))+inj_offset;
625tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
626
627% --- Executes during object creation, after setting all properties.
628function boo_nod_CreateFcn(hObject, eventdata, handles)
629% hObject    handle to boo_nod (see GCBO)
630% eventdata  reserved - to be defined in a future version of MATLAB
631% handles    empty - handles not created until after all CreateFcns called
632
633% Hint: edit controls usually have a white background on Windows.
634%       See ISPC and COMPUTER.
635if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
636    set(hObject,'BackgroundColor','white');
637end
638
639
640
641function boo_dcct_Callback(hObject, eventdata, handles)
642% hObject    handle to boo_dcct (see GCBO)
643% eventdata  reserved - to be defined in a future version of MATLAB
644% handles    structure with handles and user data (see GUIDATA)
645
646% Hints: get(hObject,'String') returns contents of boo_dcct as text
647%        str2double(get(hObject,'String')) returns contents of boo_dcct as a double
648inj_offset=str2double(get(handles.inj_offset,'String'));
649delay=str2double(get(hObject,'String'))+inj_offset;
650tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay',delay);
651
652% --- Executes during object creation, after setting all properties.
653function boo_dcct_CreateFcn(hObject, eventdata, handles)
654% hObject    handle to boo_dcct (see GCBO)
655% eventdata  reserved - to be defined in a future version of MATLAB
656% handles    empty - handles not created until after all CreateFcns called
657
658% Hint: edit controls usually have a white background on Windows.
659%       See ISPC and COMPUTER.
660if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
661    set(hObject,'BackgroundColor','white');
662end
663
664
665
666function lin_canon_spm_fin_Callback(hObject, eventdata, handles)
667% hObject    handle to lin_canon_spm_fin (see GCBO)
668% eventdata  reserved - to be defined in a future version of MATLAB
669% handles    structure with handles and user data (see GUIDATA)
670
671% Hints: get(hObject,'String') returns contents of lin_canon_spm_fin as text
672%        str2double(get(hObject,'String')) returns contents of lin_canon_spm_fin as a double
673
674inj_offset=str2double(get(handles.inj_offset,'String'));
675ext_offset=str2double(get(handles.ext_offset,'String'));
676lin_fin   =str2double(get(handles.lin_canon_spm_fin,'String'));
677
678%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'synchro_offset_lin');
679FileName = [handles.DirName 'synchro_offset_lin'];
680save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
681
682% --- Executes during object creation, after setting all properties.
683function lin_canon_spm_fin_CreateFcn(hObject, eventdata, handles)
684% hObject    handle to lin_canon_spm_fin (see GCBO)
685% eventdata  reserved - to be defined in a future version of MATLAB
686% handles    empty - handles not created until after all CreateFcns called
687
688% Hint: edit controls usually have a white background on Windows.
689%       See ISPC and COMPUTER.
690if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
691    set(hObject,'BackgroundColor','white');
692end
693
694
695
696function central_spare_Callback(hObject, eventdata, handles)
697% hObject    handle to central_spare (see GCBO)
698% eventdata  reserved - to be defined in a future version of MATLAB
699% handles    structure with handles and user data (see GUIDATA)
700
701% Hints: get(hObject,'String') returns contents of central_spare as text
702%        str2double(get(hObject,'String')) returns contents of central_spare as a double
703
704delay=str2double(get(hObject,'String'));
705tango_write_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay',delay);
706
707%status soft checked on linac
708temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
709if (temp.value(1)==2)
710   %
711elseif (temp.value(1)==5)
712    dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
713    inj_offset=str2double(get(handles.inj_offset,'String'));
714    dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
715    delay=dt.value(1)-dt1.value(1)+inj_offset;
716    tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
717    temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
718    set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
719end
720
721% --- Executes during object creation, after setting all properties.
722function central_spare_CreateFcn(hObject, eventdata, handles)
723% hObject    handle to central_spare (see GCBO)
724% eventdata  reserved - to be defined in a future version of MATLAB
725% handles    empty - handles not created until after all CreateFcns called
726
727% Hint: edit controls usually have a white background on Windows.
728%       See ISPC and COMPUTER.
729if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
730    set(hObject,'BackgroundColor','white');
731end
732
733
734
735function central_inj_Callback(hObject, eventdata, handles)
736% hObject    handle to central_inj (see GCBO)
737% eventdata  reserved - to be defined in a future version of MATLAB
738% handles    structure with handles and user data (see GUIDATA)
739
740% Hints: get(hObject,'String') returns contents of central_inj as text
741%        str2double(get(hObject,'String')) returns contents of central_inj as a double
742
743delay=str2double(get(hObject,'String'));
744tango_write_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay',delay);
745
746% --- Executes during object creation, after setting all properties.
747function central_inj_CreateFcn(hObject, eventdata, handles)
748% hObject    handle to central_inj (see GCBO)
749% eventdata  reserved - to be defined in a future version of MATLAB
750% handles    empty - handles not created until after all CreateFcns called
751
752% Hint: edit controls usually have a white background on Windows.
753%       See ISPC and COMPUTER.
754if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
755    set(hObject,'BackgroundColor','white');
756end
757
758
759
760
761function central_soft_Callback(hObject, eventdata, handles)
762% hObject    handle to central_soft (see GCBO)
763% eventdata  reserved - to be defined in a future version of MATLAB
764% handles    structure with handles and user data (see GUIDATA)
765
766% Hints: get(hObject,'String') returns contents of central_soft as text
767%        str2double(get(hObject,'String')) returns contents of central_soft as a double
768
769delay=str2double(get(hObject,'String'));
770tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay',delay);
771
772% temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
773% clkinj=int32(temp.value(1)+5*52);
774% clkext=int32(temp.value(1)/52+10);
775% tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',clkinj);
776% tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',clkext);
777%
778% %status soft checked on linac
779% temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
780% if (temp.value(1)==2)
781%    %
782% elseif (temp.value(1)==1)
783%     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
784%     inj_offset=str2double(get(handles.inj_offset,'String'));
785%     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
786%     delay=dt.value(1)-dt1.value(1)+inj_offset;
787%     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
788%     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
789%     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
790% end
791
792% --- Executes during object creation, after setting all properties.
793function central_soft_CreateFcn(hObject, eventdata, handles)
794% hObject    handle to central_soft (see GCBO)
795% eventdata  reserved - to be defined in a future version of MATLAB
796% handles    empty - handles not created until after all CreateFcns called
797
798% Hint: edit controls usually have a white background on Windows.
799%       See ISPC and COMPUTER.
800if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
801    set(hObject,'BackgroundColor','white');
802end
803
804
805% --- Executes on button press in button_acquisition_nooffset.
806function button_acquisition_nooffset_Callback(hObject, eventdata, handles)
807% hObject    handle to button_acquisition_nooffset (see GCBO)
808% eventdata  reserved - to be defined in a future version of MATLAB
809% handles    structure with handles and user data (see GUIDATA)
810
811test_modes(handles);
812
813
814set(handles.inj_offset,'Enable','off');
815set(handles.sdc1,'Enable','off');
816set(handles.lin_canon_lpm,'Enable','off');
817set(handles.lin_canon_spm,'Enable','off');
818set(handles.lin_canon_spm_fin,'Enable','off');
819set(handles.boo_bpm,'Enable','off');
820set(handles.lt1_emittance,'Enable','off');
821set(handles.lt1_MC1,'Enable','off');
822set(handles.lt1_MC2,'Enable','off');
823set(handles.lt1_osc,'Enable','off');
824set(handles.boo_dcct,'Enable','off');
825set(handles.boo_nod,'Enable','off');
826set(handles.boo_inj_septum,'Enable','off');
827set(handles.boo_inj_kicker,'Enable','off');
828set(handles.boo_alim_dipole,'Enable','off');
829set(handles.boo_alim_qf,'Enable','off');
830set(handles.boo_alim_qd,'Enable','off');
831set(handles.boo_alim_sf,'Enable','off');
832set(handles.boo_alim_sd,'Enable','off');
833set(handles.boo_rf,'Enable','off');
834set(handles.lin_modulateur,'Enable','off');
835set(handles.ext_offset,'Enable','off');
836set(handles.boo_ext_dof,'Enable','off');
837set(handles.boo_ext_sept_p,'Enable','off');
838set(handles.boo_ext_sept_a,'Enable','off');
839set(handles.boo_ext_kicker,'Enable','off');
840set(handles.sdc2,'Enable','off');
841set(handles.lt2_emittance,'Enable','off');
842set(handles.lt2_osc,'Enable','off');
843set(handles.lt2_bpm,'Enable','off');
844set(handles.ans_inj_k1,'Enable','off');
845set(handles.ans_inj_k2,'Enable','off');
846set(handles.ans_inj_k3,'Enable','off');
847set(handles.ans_inj_k4,'Enable','off');
848set(handles.ans_inj_sept_p,'Enable','off');
849set(handles.ans_inj_sept_a,'Enable','off');
850set(handles.ans_bpm,'Enable','off');
851set(handles.ans_dcct,'Enable','off');
852set(handles.ans_bpm_c01,'Enable','off');
853set(handles.ans_bpm_c02,'Enable','off');
854set(handles.ans_bpm_c03,'Enable','off');
855set(handles.ans_bpm_c04,'Enable','off');
856set(handles.ans_bpm_c05,'Enable','off');
857set(handles.ans_bpm_c06,'Enable','off');
858set(handles.ans_bpm_c07,'Enable','off');
859set(handles.ans_bpm_c08,'Enable','off');
860set(handles.ans_bpm_c09,'Enable','off');
861set(handles.ans_bpm_c10,'Enable','off');
862set(handles.ans_bpm_c11,'Enable','off');
863set(handles.ans_bpm_c12,'Enable','off');
864set(handles.ans_bpm_c13,'Enable','off');
865set(handles.ans_bpm_c14,'Enable','off');
866set(handles.ans_bpm_c15,'Enable','off');
867set(handles.ans_bpm_c16,'Enable','off');
868
869get_synchro_delay_nooffset(handles)
870n=1;
871
872%status soft checked on linac
873temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
874if (temp.value(n)==2)
875    %set(handles.soft_button,'Value',0);
876elseif (temp.value(n)==5)
877    %set(handles.soft_button,'Value',1);
878end
879
880%status tables
881temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
882offset=temp.value(1)*52;
883temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
884n=temp.value;
885temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
886table=temp.value(1:n)-offset;
887set(handles.edit_filling_relecture_tables,'String',['T=' , num2str(table)]); 
888
889
890
891% --- Executes on button press in button_acquisition_delay.
892function button_acquisition_delay_Callback(hObject, eventdata, handles)
893% hObject    handle to button_acquisition_delay (see GCBO)
894% eventdata  reserved - to be defined in a future version of MATLAB
895% handles    structure with handles and user data (see GUIDATA)
896bug_device='Bug device';
897
898test_modes(handles);
899
900set(handles.inj_offset,'Enable','on');
901set(handles.sdc1,'Enable','on');
902set(handles.lin_canon_lpm,'Enable','on');
903set(handles.lin_canon_spm,'Enable','on');
904set(handles.lin_canon_spm_fin,'Enable','on');
905set(handles.boo_bpm,'Enable','on');
906set(handles.lt1_emittance,'Enable','on');
907set(handles.lt1_MC1,'Enable','on');
908set(handles.lt1_MC2,'Enable','on');
909set(handles.lt1_osc,'Enable','on');
910set(handles.boo_dcct,'Enable','on');
911set(handles.boo_nod,'Enable','on');
912set(handles.boo_inj_septum,'Enable','on');
913set(handles.boo_inj_kicker,'Enable','on');
914set(handles.boo_alim_dipole,'Enable','on');
915set(handles.boo_alim_qf,'Enable','on');
916set(handles.boo_alim_qd,'Enable','on');
917set(handles.boo_alim_sf,'Enable','on');
918set(handles.boo_alim_sd,'Enable','on');
919set(handles.boo_rf,'Enable','on');
920set(handles.lin_modulateur,'Enable','on');
921set(handles.ext_offset,'Enable','on');
922set(handles.boo_ext_dof,'Enable','on');
923set(handles.boo_ext_sept_p,'Enable','on');
924set(handles.boo_ext_sept_a,'Enable','on');
925set(handles.boo_ext_kicker,'Enable','on');
926set(handles.sdc2,'Enable','on');
927set(handles.lt2_emittance,'Enable','on');
928set(handles.lt2_osc,'Enable','on');
929set(handles.lt2_bpm,'Enable','on');
930set(handles.ans_inj_k1,'Enable','on');
931set(handles.ans_inj_k2,'Enable','on');
932set(handles.ans_inj_k3,'Enable','on');
933set(handles.ans_inj_k4,'Enable','on');
934set(handles.ans_inj_sept_p,'Enable','on');
935set(handles.ans_inj_sept_a,'Enable','on');
936set(handles.ans_bpm,'Enable','on');
937set(handles.ans_dcct,'Enable','on');
938set(handles.ans_bpm_c01,'Enable','on');
939set(handles.ans_bpm_c02,'Enable','on');
940set(handles.ans_bpm_c03,'Enable','on');
941set(handles.ans_bpm_c04,'Enable','on');
942set(handles.ans_bpm_c05,'Enable','on');
943set(handles.ans_bpm_c06,'Enable','on');
944set(handles.ans_bpm_c07,'Enable','on');
945set(handles.ans_bpm_c08,'Enable','on');
946set(handles.ans_bpm_c09,'Enable','on');
947set(handles.ans_bpm_c10,'Enable','on');
948set(handles.ans_bpm_c11,'Enable','on');
949set(handles.ans_bpm_c12,'Enable','on');
950set(handles.ans_bpm_c13,'Enable','on');
951set(handles.ans_bpm_c14,'Enable','on');
952set(handles.ans_bpm_c15,'Enable','on');
953set(handles.ans_bpm_c16,'Enable','on');
954set(handles.ans_k_pc,'Enable','on');
955set(handles.ans_k_h,'Enable','on');
956set(handles.ans_k_v,'Enable','on');
957
958
959%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'synchro_offset_lin');
960FileName = [handles.DirName 'synchro_offset_lin'];
961load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
962set(handles.inj_offset,'String',num2str(inj_offset));
963set(handles.ext_offset,'String',num2str(ext_offset));
964set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
965
966get_synchro_delay(handles)
967n=1;
968%status soft checked on linac
969temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
970if (temp.value(n)==2)
971    %set(handles.soft_button,'Value',0);
972elseif (temp.value(n)==5)
973    %set(handles.uipanel_mode,'String','Mode Soft');
974end
975
976%status tables
977%temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
978%offset=temp.value(1)*52;
979offset_linac=10*lin_fin;
980temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
981n=temp.value;
982temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
983table_ext=temp.value(1:n); %-offset_ext;
984temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
985table_linac=(temp.value(1:n)-offset_linac)/28;
986table=[];
987for i=1:n
988    table=[table ' ' '(' num2str([table_ext(i)])  ' '  num2str([table_linac(i)]) ')'];
989end
990set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
991set(handles.edit_filling_relecture_bunch, 'String','??');
992
993
994
995% --- Executes on button press in button_injection_soft.
996function button_injection_soft_Callback(hObject, eventdata, handles)
997% hObject    handle to button_injection_soft (see GCBO)
998% eventdata  reserved - to be defined in a future version of MATLAB
999% handles    structure with handles and user data (see GUIDATA)
1000
1001% verifie si inj autorisé
1002% try temp=tango_read_attribute2('ANS/FC/INJ_COND', 'COND_INJ'); % 0 no injection,  1 injection
1003% val=temp.value; catch val=1 ; end ; if val~=0 ; val=1; end;
1004%
1005% if (val==1)
1006%     
1007%     tic
1008%    [r1,r2]=fire_injection(handles);
1009%     toc
1010% else
1011%     % pas d'injection, tir non autorise
1012%     fprintf('%s\n','Gap U20  < limite    dans ANS/EI/GAP_U20_SECURITY');
1013% end
1014
1015[r1,r2]=fire_injection(handles);
1016
1017% check synchro booster
1018%flag=0 : OK
1019%falg=1 : mauvais delais
1020[flag]=check_boo_synchro;
1021if flag==1 && r1> 20
1022    set(handles.central_inj,'Backgroundcolor', [1 0 0]); % KO
1023else
1024    set(handles.central_inj,'Backgroundcolor', [1 1 1]); % OK
1025end
1026
1027% % Warning mauvais rendement booster
1028% if r1 < 90
1029%     set(handles.edit_rboo,'Backgroundcolor', [1 0 0]); % KO
1030%     set(handles.edit_rboo,'Foregroundcolor', [0 0 0]);
1031% else
1032%     set(handles.edit_rboo,'Backgroundcolor', [1 1 1]); % OK
1033%     set(handles.edit_rboo,'Foregroundcolor', [1 0 0]);
1034% end
1035
1036%
1037test_modes(handles);
1038
1039function periode_edit_Callback(hObject, eventdata, handles)
1040% hObject    handle to periode_edit (see GCBO)
1041% eventdata  reserved - to be defined in a future version of MATLAB
1042% handles    structure with handles and user data (see GUIDATA)
1043
1044% Hints: get(hObject,'String') returns contents of periode_edit as text
1045%        str2double(get(hObject,'String')) returns contents of periode_edit as a double
1046
1047val_multishot = get(handles.on1,'Value');
1048
1049if val_multishot
1050    errordlg('positionner le trigger a OFF !','Attention');
1051    return
1052else
1053    periode = str2double(get(hObject,'String'));
1054
1055    % change timer Infinite loop
1056    timer1=timer('StartDelay',1,...
1057        'ExecutionMode','fixedRate','Period',periode,'TasksToExecute',Inf);
1058    timer1.TimerFcn = {@fonction_alex1, hObject,eventdata, handles};
1059    setappdata(handles.figure1,'Timer1',timer1);
1060
1061    % Update handles structure
1062    guidata(hObject, handles);
1063   
1064    %getappdata(handles.figure1,'Timer1')
1065   
1066end
1067
1068
1069
1070% --- Executes during object creation, after setting all properties.
1071function periode_edit_CreateFcn(hObject, eventdata, handles)
1072% hObject    handle to periode_edit (see GCBO)
1073% eventdata  reserved - to be defined in a future version of MATLAB
1074% handles    empty - handles not created until after all CreateFcns called
1075
1076% Hint: edit controls usually have a white background on Windows.
1077%       See ISPC and COMPUTER.
1078if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1079    set(hObject,'BackgroundColor','white');
1080end
1081
1082function uibuttongroup_SelectionChangeFcn(hObject,eventdata,handles)
1083% hObject    handle to uipanel1 (see GCBO)
1084% eventdata  reserved - to be defined in a future version of MATLAB
1085% handles    structure with handles and user data (see GUIDATA)
1086
1087%handles = guidata(gcbo);
1088timer1 = getappdata(handles.figure1,'Timer1');
1089timer2 = getappdata(handles.figure1,'Timer2');
1090
1091%txt1=' INJECTION EN COURS ';
1092
1093switch get(get(hObject,'SelectedObject'),'Tag')  % Get Tag of selected object
1094    case 'radiobutton1'
1095        % stop du trigger
1096        stop(timer1);
1097        stop(timer2);
1098        set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1099        test_modes(handles);
1100        tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(0))
1101        tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(0))
1102    case 'radiobutton2'
1103        % démarrage  du trigger 1
1104        start(timer1);
1105        set(handles.edit_modes,'String',handles.txt_inj);
1106        tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(1))
1107    case 'radiobutton3'
1108        % démarrage du trigger 2 
1109        temp=tango_read_attribute2('ANS/DG/DCCT-CTRL','current');anscur=temp.value;
1110        if (anscur>1.)
1111           start(timer2);     
1112           set(handles.edit_modes,'String',handles.txt_inj);
1113           tango_write_attribute2('ANS/DG/PUB-FillingMode','mode_auto',uint8(1))
1114        else
1115            % ne fait rien, en cas de perte faisceau
1116        end
1117end
1118
1119
1120function fonction_alex1(arg1,arg2,hObject,eventdata,handles)
1121% hObject    handle to uipanel1 (see GCBO)
1122% eventdata  reserved - to be defined in a future version of MATLAB
1123% handles    structure with handles and user data (see GUIDATA)
1124
1125color=get(handles.uipanel6,'Backgroundcolor');
1126if color==[1 0.3 0]
1127    set(handles.uipanel6,'Backgroundcolor', [1 0.3 1]);
1128elseif color==[1 0.3 1]
1129    set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1130end
1131
1132button_injection_soft_Callback(hObject,eventdata,handles)
1133
1134
1135function fonction_alex2(arg1,arg2,hObject,eventdata,handles)
1136% hObject    handle to uipanel1 (see GCBO)
1137% eventdata  reserved - to be defined in a future version of MATLAB
1138% handles    structure with handles and user data (see GUIDATA)
1139
1140
1141temp=tango_read_attribute2('ANS/DG/DCCT-CTRL','current');anscur=temp.value;
1142set(handles.edit_courant_total,'String', num2str(anscur,'%5.2f'));
1143Imin=str2double(get(handles.edit_Imin,'String'));
1144
1145color=get(handles.uipanel6,'Backgroundcolor');
1146if color==[1 0.3 0]
1147    set(handles.uipanel6,'Backgroundcolor', [1 0.3 1]);
1148elseif color==[1 0.3 1]
1149    set(handles.uipanel6,'Backgroundcolor', [1 0.3 0]);
1150end
1151
1152
1153if     (anscur>Imin)
1154    %on attend
1155    %fprintf('Cur = %g \n',anscur)
1156    tango_write_attribute2('ANS/DG/PUB-FillingMode','courant_consigne',uint8(1))
1157else
1158    %inject le cycle en cours
1159    %fprintf('Cur = %g : Injection \n',anscur)
1160    %set(handles.uipanel6,'Backgroundcolor', [1 1 0]);
1161    button_injection_soft_Callback(hObject, eventdata, handles)
1162end
1163
1164
1165
1166%% What to do before closing the application
1167function Closinggui(obj, event, handles, figure1)
1168
1169% Get default command line output from handles structure
1170answer = questdlg('Fermer softsynchro ?',...
1171    'Exit softsynchro',...
1172    'Yes','No','Yes');
1173
1174switch answer
1175    case 'Yes'           
1176        delete(handles); %Delete Timer       
1177        delete(figure1); %Close gui
1178    otherwise
1179        disp('Closing aborted')
1180end
1181
1182
1183
1184% --- Executes on button press in button_softmoins.
1185function button_softmoins_Callback(hObject, eventdata, handles)
1186% hObject    handle to button_softmoins (see GCBO)
1187% eventdata  reserved - to be defined in a future version of MATLAB
1188% handles    structure with handles and user data (see GUIDATA)
1189tt=0.6;
1190
1191temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1192step=temp.value(1)-52;
1193tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',step);
1194pause(2*tt)
1195
1196%status soft checked on linac
1197temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1198if (temp.value(1)==2)
1199    pause(tt)
1200    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1201    set(handles.central_soft,'String',num2str(temp.value(1)));
1202elseif (temp.value(1)==5)
1203    dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1204    inj_offset=str2double(get(handles.inj_offset,'String'));
1205    dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1206    delay=dt.value(1)-dt1.value(1)+inj_offset;
1207    tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1208
1209    pause(tt)
1210    % read again for possible delay
1211    temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1212    set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1213    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1214    set(handles.central_soft,'String',num2str(temp.value(1)));
1215end
1216
1217
1218
1219% --- Executes on button press in button_softplus.
1220function button_softplus_Callback(hObject, eventdata, handles)
1221% hObject    handle to button_softplus (see GCBO)
1222% eventdata  reserved - to be defined in a future version of MATLAB
1223% handles    structure with handles and user data (see GUIDATA)
1224tt=0.6;
1225
1226temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
1227step=temp.value(1)+52;
1228tango_write_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay',step);
1229pause(2*tt)
1230
1231%status soft checked on linac
1232temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1233if (temp.value(1)==2)
1234    pause(tt)
1235    % read again for possible delay
1236    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1237    set(handles.central_soft,'String',num2str(temp.value(1)));
1238elseif (temp.value(1)==5)
1239    dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1240    inj_offset=str2double(get(handles.inj_offset,'String'));
1241    dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1242    delay=dt.value(1)-dt1.value(1)+inj_offset;
1243    tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1244
1245    pause(tt)
1246    % read again for possible delay
1247    temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1248    set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1249    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftTimeDelay');
1250    set(handles.central_soft,'String',num2str(temp.value(1)));
1251end
1252
1253
1254
1255% --- Executes on button press in button_injmoins.
1256function button_injmoins_Callback(hObject, eventdata, handles)
1257% hObject    handle to button_injmoins (see GCBO)
1258% eventdata  reserved - to be defined in a future version of MATLAB
1259% handles    structure with handles and user data (see GUIDATA)
1260tt=0.6;
1261
1262temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay');
1263step=temp.value(1)-52;
1264tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',step);
1265pause(2*tt)
1266
1267%status soft checked on linac
1268temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1269if (temp.value(1)==5)
1270    pause(tt)
1271    % read again for possible delay
1272    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1273    set(handles.central_inj,'String',num2str(temp.value(1)));
1274elseif (temp.value(1)==2)
1275%    commented With address spare = 2
1276%     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1277%     inj_offset=str2double(get(handles.inj_offset,'String'));
1278%     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1279%     delay=dt.value(1)-dt1.value(1)+inj_offset;
1280%     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1281%
1282%     pause(tt)
1283%     % read again for possible delay
1284%     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1285%     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1286     temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1287     set(handles.central_inj,'String',num2str(temp.value(1)));
1288end
1289
1290
1291% --- Executes on button press in button_injplus.
1292function button_injplus_Callback(hObject, eventdata, handles)
1293% hObject    handle to button_injplus (see GCBO)
1294% eventdata  reserved - to be defined in a future version of MATLAB
1295% handles    structure with handles and user data (see GUIDATA)
1296tt=0.6;
1297
1298temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay');
1299step=temp.value(1)+52;
1300tango_write_attribute2('ANS/SY/CENTRAL', 'TInjStepDelay',step);
1301pause(2*tt)
1302
1303%status soft checked on linac
1304temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
1305if (temp.value(1)==5)
1306    pause(tt)
1307    % read again for possible delay
1308    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1309    set(handles.central_inj,'String',num2str(temp.value(1)));
1310elseif (temp.value(1)==2)
1311%    commented With address spare = 2
1312%     dt=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1313%     inj_offset=str2double(get(handles.inj_offset,'String'));
1314%     dt1=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprTimeDelay');
1315%     delay=dt.value(1)-dt1.value(1)+inj_offset;
1316%     tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1317%
1318%     pause(tt)
1319%     % read again for possible delay
1320%     temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay');
1321%     set(handles.lin_modulateur,'String',num2str(temp.value(1)-inj_offset));
1322     temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TInjTimeDelay');
1323     set(handles.central_inj,'String',num2str(temp.value(1)));
1324end
1325
1326
1327
1328
1329
1330
1331function boo_ext_sept_p_Callback(hObject, eventdata, handles)
1332% hObject    handle to boo_ext_sept_p (see GCBO)
1333% eventdata  reserved - to be defined in a future version of MATLAB
1334% handles    structure with handles and user data (see GUIDATA)
1335
1336% Hints: get(hObject,'String') returns contents of boo_ext_sept_p as text
1337%        str2double(get(hObject,'String')) returns contents of boo_ext_sept_p as a double
1338ext_offset=str2double(get(handles.ext_offset,'String'));
1339delay=str2double(get(hObject,'String'))+ext_offset;
1340tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
1341
1342% --- Executes during object creation, after setting all properties.
1343function boo_ext_sept_p_CreateFcn(hObject, eventdata, handles)
1344% hObject    handle to boo_ext_sept_p (see GCBO)
1345% eventdata  reserved - to be defined in a future version of MATLAB
1346% handles    empty - handles not created until after all CreateFcns called
1347
1348% Hint: edit controls usually have a white background on Windows.
1349%       See ISPC and COMPUTER.
1350if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1351    set(hObject,'BackgroundColor','white');
1352end
1353
1354
1355function boo_ext_dof_Callback(hObject, eventdata, handles)
1356% hObject    handle to boo_ext_dof (see GCBO)
1357% eventdata  reserved - to be defined in a future version of MATLAB
1358% handles    structure with handles and user data (see GUIDATA)
1359
1360% Hints: get(hObject,'String') returns contents of boo_ext_dof as text
1361%        str2double(get(hObject,'String')) returns contents of boo_ext_dof as a double
1362ext_offset=str2double(get(handles.ext_offset,'String'));
1363delay=str2double(get(hObject,'String'))+ext_offset;
1364tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
1365
1366% --- Executes during object creation, after setting all properties.
1367function boo_ext_dof_CreateFcn(hObject, eventdata, handles)
1368% hObject    handle to boo_ext_dof (see GCBO)
1369% eventdata  reserved - to be defined in a future version of MATLAB
1370% handles    empty - handles not created until after all CreateFcns called
1371
1372% Hint: edit controls usually have a white background on Windows.
1373%       See ISPC and COMPUTER.
1374if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1375    set(hObject,'BackgroundColor','white');
1376end
1377
1378
1379function boo_ext_sept_a_Callback(hObject, eventdata, handles)
1380% hObject    handle to boo_ext_sept_a (see GCBO)
1381% eventdata  reserved - to be defined in a future version of MATLAB
1382% handles    structure with handles and user data (see GUIDATA)
1383
1384% Hints: get(hObject,'String') returns contents of boo_ext_sept_a as text
1385%        str2double(get(hObject,'String')) returns contents of boo_ext_sept_a as a double
1386ext_offset=str2double(get(handles.ext_offset,'String'));
1387delay=str2double(get(hObject,'String'))+ext_offset;
1388tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
1389
1390% --- Executes during object creation, after setting all properties.
1391function boo_ext_sept_a_CreateFcn(hObject, eventdata, handles)
1392% hObject    handle to boo_ext_sept_a (see GCBO)
1393% eventdata  reserved - to be defined in a future version of MATLAB
1394% handles    empty - handles not created until after all CreateFcns called
1395
1396% Hint: edit controls usually have a white background on Windows.
1397%       See ISPC and COMPUTER.
1398if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1399    set(hObject,'BackgroundColor','white');
1400end
1401
1402
1403
1404function boo_ext_kicker_Callback(hObject, eventdata, handles)
1405% hObject    handle to boo_ext_kicker (see GCBO)
1406% eventdata  reserved - to be defined in a future version of MATLAB
1407% handles    structure with handles and user data (see GUIDATA)
1408
1409% Hints: get(hObject,'String') returns contents of boo_ext_kicker as text
1410%        str2double(get(hObject,'String')) returns contents of boo_ext_kicker as a double
1411ext_offset=str2double(get(handles.ext_offset,'String'));
1412delay=str2double(get(hObject,'String'))+ext_offset;
1413tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
1414
1415
1416% --- Executes during object creation, after setting all properties.
1417function boo_ext_kicker_CreateFcn(hObject, eventdata, handles)
1418% hObject    handle to boo_ext_kicker (see GCBO)
1419% eventdata  reserved - to be defined in a future version of MATLAB
1420% handles    empty - handles not created until after all CreateFcns called
1421
1422% Hint: edit controls usually have a white background on Windows.
1423%       See ISPC and COMPUTER.
1424if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1425    set(hObject,'BackgroundColor','white');
1426end
1427
1428
1429
1430function ans_inj_sept_p_Callback(hObject, eventdata, handles)
1431% hObject    handle to ans_inj_sept_p (see GCBO)
1432% eventdata  reserved - to be defined in a future version of MATLAB
1433% handles    structure with handles and user data (see GUIDATA)
1434
1435% Hints: get(hObject,'String') returns contents of ans_inj_sept_p as text
1436%        str2double(get(hObject,'String')) returns contents of ans_inj_sept_p as a double
1437
1438ext_offset=str2double(get(handles.ext_offset,'String'));
1439delay=str2double(get(hObject,'String'))+ext_offset;
1440tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
1441
1442% --- Executes during object creation, after setting all properties.
1443function ans_inj_sept_p_CreateFcn(hObject, eventdata, handles)
1444% hObject    handle to ans_inj_sept_p (see GCBO)
1445% eventdata  reserved - to be defined in a future version of MATLAB
1446% handles    empty - handles not created until after all CreateFcns called
1447
1448% Hint: edit controls usually have a white background on Windows.
1449%       See ISPC and COMPUTER.
1450if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1451    set(hObject,'BackgroundColor','white');
1452end
1453
1454
1455
1456function ans_inj_sept_a_Callback(hObject, eventdata, handles)
1457% hObject    handle to ans_inj_sept_a (see GCBO)
1458% eventdata  reserved - to be defined in a future version of MATLAB
1459% handles    structure with handles and user data (see GUIDATA)
1460
1461% Hints: get(hObject,'String') returns contents of ans_inj_sept_a as text
1462%        str2double(get(hObject,'String')) returns contents of ans_inj_sept_a as a double
1463
1464ext_offset=str2double(get(handles.ext_offset,'String'));
1465delay=str2double(get(hObject,'String'))+ext_offset;
1466tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
1467
1468% --- Executes during object creation, after setting all properties.
1469function ans_inj_sept_a_CreateFcn(hObject, eventdata, handles)
1470% hObject    handle to ans_inj_sept_a (see GCBO)
1471% eventdata  reserved - to be defined in a future version of MATLAB
1472% handles    empty - handles not created until after all CreateFcns called
1473
1474% Hint: edit controls usually have a white background on Windows.
1475%       See ISPC and COMPUTER.
1476if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1477    set(hObject,'BackgroundColor','white');
1478end
1479
1480
1481
1482function ans_inj_k1_Callback(hObject, eventdata, handles)
1483% hObject    handle to ans_inj_k1 (see GCBO)
1484% eventdata  reserved - to be defined in a future version of MATLAB
1485% handles    structure with handles and user data (see GUIDATA)
1486
1487% Hints: get(hObject,'String') returns contents of ans_inj_k1 as text
1488%        str2double(get(hObject,'String')) returns contents of ans_inj_k1 as a double
1489
1490ext_offset=str2double(get(handles.ext_offset,'String'));
1491delay=str2double(get(hObject,'String'))+ext_offset;
1492tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
1493
1494
1495
1496% --- Executes during object creation, after setting all properties.
1497function ans_inj_k1_CreateFcn(hObject, eventdata, handles)
1498% hObject    handle to ans_inj_k1 (see GCBO)
1499% eventdata  reserved - to be defined in a future version of MATLAB
1500% handles    empty - handles not created until after all CreateFcns called
1501
1502% Hint: edit controls usually have a white background on Windows.
1503%       See ISPC and COMPUTER.
1504if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1505    set(hObject,'BackgroundColor','white');
1506end
1507
1508
1509
1510function ans_inj_k2_Callback(hObject, eventdata, handles)
1511% hObject    handle to ans_inj_k2 (see GCBO)
1512% eventdata  reserved - to be defined in a future version of MATLAB
1513% handles    structure with handles and user data (see GUIDATA)
1514
1515% Hints: get(hObject,'String') returns contents of ans_inj_k2 as text
1516%        str2double(get(hObject,'String')) returns contents of ans_inj_k2 as a double
1517
1518ext_offset=str2double(get(handles.ext_offset,'String'));
1519delay=str2double(get(hObject,'String'))+ext_offset;
1520tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
1521
1522% --- Executes during object creation, after setting all properties.
1523function ans_inj_k2_CreateFcn(hObject, eventdata, handles)
1524% hObject    handle to ans_inj_k2 (see GCBO)
1525% eventdata  reserved - to be defined in a future version of MATLAB
1526% handles    empty - handles not created until after all CreateFcns called
1527
1528% Hint: edit controls usually have a white background on Windows.
1529%       See ISPC and COMPUTER.
1530if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1531    set(hObject,'BackgroundColor','white');
1532end
1533
1534
1535
1536function ans_inj_k3_Callback(hObject, eventdata, handles)
1537% hObject    handle to ans_inj_k3 (see GCBO)
1538% eventdata  reserved - to be defined in a future version of MATLAB
1539% handles    structure with handles and user data (see GUIDATA)
1540
1541% Hints: get(hObject,'String') returns contents of ans_inj_k3 as text
1542%        str2double(get(hObject,'String')) returns contents of ans_inj_k3 as a double
1543
1544ext_offset=str2double(get(handles.ext_offset,'String'));
1545delay=str2double(get(hObject,'String'))+ext_offset;
1546tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
1547
1548% --- Executes during object creation, after setting all properties.
1549function ans_inj_k3_CreateFcn(hObject, eventdata, handles)
1550% hObject    handle to ans_inj_k3 (see GCBO)
1551% eventdata  reserved - to be defined in a future version of MATLAB
1552% handles    empty - handles not created until after all CreateFcns called
1553
1554% Hint: edit controls usually have a white background on Windows.
1555%       See ISPC and COMPUTER.
1556if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1557    set(hObject,'BackgroundColor','white');
1558end
1559
1560
1561
1562function ans_inj_k4_Callback(hObject, eventdata, handles)
1563% hObject    handle to ans_inj_k4 (see GCBO)
1564% eventdata  reserved - to be defined in a future version of MATLAB
1565% handles    structure with handles and user data (see GUIDATA)
1566
1567% Hints: get(hObject,'String') returns contents of ans_inj_k4 as text
1568%        str2double(get(hObject,'String')) returns contents of ans_inj_k4 as a double
1569
1570ext_offset=str2double(get(handles.ext_offset,'String'));
1571delay=str2double(get(hObject,'String'))+ext_offset;
1572tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
1573
1574% --- Executes during object creation, after setting all properties.
1575function ans_inj_k4_CreateFcn(hObject, eventdata, handles)
1576% hObject    handle to ans_inj_k4 (see GCBO)
1577% eventdata  reserved - to be defined in a future version of MATLAB
1578% handles    empty - handles not created until after all CreateFcns called
1579
1580% Hint: edit controls usually have a white background on Windows.
1581%       See ISPC and COMPUTER.
1582if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1583    set(hObject,'BackgroundColor','white');
1584end
1585
1586
1587
1588function ans_dcct_Callback(hObject, eventdata, handles)
1589% hObject    handle to ans_dcct (see GCBO)
1590% eventdata  reserved - to be defined in a future version of MATLAB
1591% handles    structure with handles and user data (see GUIDATA)
1592
1593% Hints: get(hObject,'String') returns contents of ans_dcct as text
1594%        str2double(get(hObject,'String')) returns contents of ans_dcct as a double
1595
1596ext_offset=str2double(get(handles.ext_offset,'String'));
1597delay=str2double(get(hObject,'String'))+ext_offset;
1598tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'dcctTimeDelay',delay);
1599
1600
1601% --- Executes during object creation, after setting all properties.
1602function ans_dcct_CreateFcn(hObject, eventdata, handles)
1603% hObject    handle to ans_dcct (see GCBO)
1604% eventdata  reserved - to be defined in a future version of MATLAB
1605% handles    empty - handles not created until after all CreateFcns called
1606
1607% Hint: edit controls usually have a white background on Windows.
1608%       See ISPC and COMPUTER.
1609if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1610    set(hObject,'BackgroundColor','white');
1611end
1612
1613
1614
1615function ans_bpm_Callback(hObject, eventdata, handles)
1616% hObject    handle to ans_bpm (see GCBO)
1617% eventdata  reserved - to be defined in a future version of MATLAB
1618% handles    structure with handles and user data (see GUIDATA)
1619
1620% Hints: get(hObject,'String') returns contents of ans_bpm as text
1621%        str2double(get(hObject,'String')) returns contents of ans_bpm as a double
1622
1623ext_offset=str2double(get(handles.ext_offset,'String'));
1624delay=str2double(get(hObject,'String'))+ext_offset;
1625tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1626tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1627tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1628tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1629tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1630tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1631tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1632tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1633tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1634tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1635tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1636tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1637tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1638tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1639tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1640tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
1641
1642
1643
1644% --- Executes during object creation, after setting all properties.
1645function ans_bpm_CreateFcn(hObject, eventdata, handles)
1646% hObject    handle to ans_bpm (see GCBO)
1647% eventdata  reserved - to be defined in a future version of MATLAB
1648% handles    empty - handles not created until after all CreateFcns called
1649
1650% Hint: edit controls usually have a white background on Windows.
1651%       See ISPC and COMPUTER.
1652if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1653    set(hObject,'BackgroundColor','white');
1654end
1655
1656
1657
1658function central_ext_Callback(hObject, eventdata, handles)
1659% hObject    handle to central_ext (see GCBO)
1660% eventdata  reserved - to be defined in a future version of MATLAB
1661% handles    structure with handles and user data (see GUIDATA)
1662
1663% Hints: get(hObject,'String') returns contents of central_ext as text
1664%        str2double(get(hObject,'String')) returns contents of central_ext as a double
1665%'ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue'
1666
1667delay=str2double(get(hObject,'String'));
1668tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetTimeValue',delay);
1669
1670% --- Executes during object creation, after setting all properties.
1671function central_ext_CreateFcn(hObject, eventdata, handles)
1672% hObject    handle to central_ext (see GCBO)
1673% eventdata  reserved - to be defined in a future version of MATLAB
1674% handles    empty - handles not created until after all CreateFcns called
1675
1676% Hint: edit controls usually have a white background on Windows.
1677%       See ISPC and COMPUTER.
1678if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1679    set(hObject,'BackgroundColor','white');
1680end
1681
1682
1683
1684function central_soft1_Callback(hObject, eventdata, handles)
1685% hObject    handle to central_soft1 (see GCBO)
1686% eventdata  reserved - to be defined in a future version of MATLAB
1687% handles    structure with handles and user data (see GUIDATA)
1688
1689% Hints: get(hObject,'String') returns contents of central_soft1 as text
1690%        str2double(get(hObject,'String')) returns contents of central_soft1 as a double
1691
1692
1693
1694% --- Executes during object creation, after setting all properties.
1695function central_soft1_CreateFcn(hObject, eventdata, handles)
1696% hObject    handle to central_soft1 (see GCBO)
1697% eventdata  reserved - to be defined in a future version of MATLAB
1698% handles    empty - handles not created until after all CreateFcns called
1699
1700% Hint: edit controls usually have a white background on Windows.
1701%       See ISPC and COMPUTER.
1702if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1703    set(hObject,'BackgroundColor','white');
1704end
1705
1706
1707% --- Executes on button press in button_extmoins.
1708function button_extmoins_Callback(hObject, eventdata, handles)
1709% hObject    handle to button_extmoins (see GCBO)
1710% eventdata  reserved - to be defined in a future version of MATLAB
1711% handles    structure with handles and user data (see GUIDATA)
1712
1713dclk=10;
1714temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1715step=temp.value(1)-dclk;
1716tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',int32(step));
1717temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
1718set(handles.central_ext,'String',num2str(temp.value(1)));
1719
1720% on fait suivre les septa actif
1721temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay');boo=temp.value(1);
1722tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay',double(boo-dclk*52*184/2));
1723temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay');ans=temp.value(1);
1724tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay',double(ans-dclk*52*184/2))
1725
1726% --- Executes on button press in button_extplus.
1727function button_extplus_Callback(hObject, eventdata, handles)
1728% hObject    handle to button_extplus (see GCBO)
1729% eventdata  reserved - to be defined in a future version of MATLAB
1730% handles    structure with handles and user data (see GUIDATA)
1731
1732dclk=10;
1733temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
1734step=temp.value(1)+dclk;
1735tango_write_attribute2('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue',int32(step));
1736temp=tango_read_attribute2('ANS/SY/CENTRAL','ExtractionOffsetTimeValue');
1737set(handles.central_ext,'String',num2str(temp.value(1)));
1738
1739% on fait suivre les septa actif
1740temp=tango_read_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay');boo=temp.value(1);
1741tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigStepDelay',double(boo+dclk*52*184/2));
1742temp=tango_read_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay');ans=temp.value(1);
1743tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigStepDelay',double(ans+dclk*52*184/2))
1744
1745function sdc2_Callback(hObject, eventdata, handles)
1746% hObject    handle to sdc2 (see GCBO)
1747% eventdata  reserved - to be defined in a future version of MATLAB
1748% handles    structure with handles and user data (see GUIDATA)
1749
1750% Hints: get(hObject,'String') returns contents of sdc2 as text
1751%        str2double(get(hObject,'String')) returns contents of sdc2 as a double
1752ext_offset=str2double(get(handles.ext_offset,'String'));
1753delay=str2double(get(hObject,'String'))+ext_offset;
1754tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
1755
1756% --- Executes during object creation, after setting all properties.
1757function sdc2_CreateFcn(hObject, eventdata, handles)
1758% hObject    handle to sdc2 (see GCBO)
1759% eventdata  reserved - to be defined in a future version of MATLAB
1760% handles    empty - handles not created until after all CreateFcns called
1761
1762% Hint: edit controls usually have a white background on Windows.
1763%       See ISPC and COMPUTER.
1764if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1765    set(hObject,'BackgroundColor','white');
1766end
1767
1768
1769
1770function lt2_emittance_Callback(hObject, eventdata, handles)
1771% hObject    handle to lt2_emittance (see GCBO)
1772% eventdata  reserved - to be defined in a future version of MATLAB
1773% handles    structure with handles and user data (see GUIDATA)
1774
1775% Hints: get(hObject,'String') returns contents of lt2_emittance as text
1776%        str2double(get(hObject,'String')) returns contents of lt2_emittance as a double
1777ext_offset=str2double(get(handles.ext_offset,'String'));
1778delay=str2double(get(hObject,'String'))+ext_offset;
1779tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
1780tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'emittanceTimeDelay',delay);
1781
1782
1783% --- Executes during object creation, after setting all properties.
1784function lt2_emittance_CreateFcn(hObject, eventdata, handles)
1785% hObject    handle to lt2_emittance (see GCBO)
1786% eventdata  reserved - to be defined in a future version of MATLAB
1787% handles    empty - handles not created until after all CreateFcns called
1788
1789% Hint: edit controls usually have a white background on Windows.
1790%       See ISPC and COMPUTER.
1791if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1792    set(hObject,'BackgroundColor','white');
1793end
1794
1795
1796
1797function lt2_bpm_Callback(hObject, eventdata, handles)
1798% hObject    handle to lt2_bpm (see GCBO)
1799% eventdata  reserved - to be defined in a future version of MATLAB
1800% handles    structure with handles and user data (see GUIDATA)
1801
1802% Hints: get(hObject,'String') returns contents of lt2_bpm as text
1803%        str2double(get(hObject,'String')) returns contents of lt2_bpm as a double
1804ext_offset=str2double(get(handles.ext_offset,'String'));
1805delay=str2double(get(hObject,'String'))+ext_offset;
1806tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1807
1808% --- Executes during object creation, after setting all properties.
1809function lt2_bpm_CreateFcn(hObject, eventdata, handles)
1810% hObject    handle to lt2_bpm (see GCBO)
1811% eventdata  reserved - to be defined in a future version of MATLAB
1812% handles    empty - handles not created until after all CreateFcns called
1813
1814% Hint: edit controls usually have a white background on Windows.
1815%       See ISPC and COMPUTER.
1816if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1817    set(hObject,'BackgroundColor','white');
1818end
1819
1820
1821
1822function lt2_osc_Callback(hObject, eventdata, handles)
1823% hObject    handle to lt2_osc (see GCBO)
1824% eventdata  reserved - to be defined in a future version of MATLAB
1825% handles    structure with handles and user data (see GUIDATA)
1826
1827% Hints: get(hObject,'String') returns contents of lt2_osc as text
1828%        str2double(get(hObject,'String')) returns contents of lt2_osc as a double
1829ext_offset=str2double(get(handles.ext_offset,'String'));
1830delay=str2double(get(hObject,'String'))+ext_offset;
1831tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
1832
1833% --- Executes during object creation, after setting all properties.
1834function lt2_osc_CreateFcn(hObject, eventdata, handles)
1835% hObject    handle to lt2_osc (see GCBO)
1836% eventdata  reserved - to be defined in a future version of MATLAB
1837% handles    empty - handles not created until after all CreateFcns called
1838
1839% Hint: edit controls usually have a white background on Windows.
1840%       See ISPC and COMPUTER.
1841if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1842    set(hObject,'BackgroundColor','white');
1843end
1844
1845
1846
1847function lin_modulateur_Callback(hObject, eventdata, handles)
1848% hObject    handle to lin_modulateur (see GCBO)
1849% eventdata  reserved - to be defined in a future version of MATLAB
1850% handles    structure with handles and user data (see GUIDATA)
1851
1852% Hints: get(hObject,'String') returns contents of lin_modulateur as text
1853%        str2double(get(hObject,'String')) returns contents of lin_modulateur as a double
1854inj_offset=str2double(get(handles.inj_offset,'String'));
1855delay=str2double(get(hObject,'String'))+inj_offset;
1856tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1857
1858% --- Executes during object creation, after setting all properties.
1859function lin_modulateur_CreateFcn(hObject, eventdata, handles)
1860% hObject    handle to lin_modulateur (see GCBO)
1861% eventdata  reserved - to be defined in a future version of MATLAB
1862% handles    empty - handles not created until after all CreateFcns called
1863
1864% Hint: edit controls usually have a white background on Windows.
1865%       See ISPC and COMPUTER.
1866if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1867    set(hObject,'BackgroundColor','white');
1868end
1869
1870
1871
1872function inj_offset_Callback(hObject, eventdata, handles)
1873% hObject    handle to inj_offset (see GCBO)
1874% eventdata  reserved - to be defined in a future version of MATLAB
1875% handles    structure with handles and user data (see GUIDATA)
1876
1877% Hints: get(hObject,'String') returns contents of inj_offset as text
1878%        str2double(get(hObject,'String')) returns contents of inj_offset as a double
1879
1880inj_offset=str2double(get(hObject,'String'));
1881ext_offset=str2double(get(handles.ext_offset,'String'));
1882lin_fin   =str2double(get(handles.lin_canon_spm_fin,'String'));
1883%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'synchro_offset_lin');
1884FileName = [handles.DirName 'synchro_offset_lin'];
1885save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin')
1886
1887%LIN
1888delay=str2double(get(handles.lin_canon_lpm,'String'))+inj_offset;
1889tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmTimeDelay',delay);
1890
1891delay=str2double(get(handles.lin_canon_spm,'String'))+inj_offset;
1892tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
1893
1894delay=str2double(get(handles.lin_modulateur,'String'))+inj_offset;
1895tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'spareTimeDelay',delay);
1896
1897delay=str2double(get(handles.sdc1,'String'))+inj_offset;
1898tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'oscTimeDelay',delay);
1899
1900
1901% LT1
1902delay=str2double(get(handles.lt1_MC2,'String'))+inj_offset;
1903tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.2TimeDelay',delay);
1904
1905delay=str2double(get(handles.lt1_MC1,'String'))+inj_offset;
1906tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'mc.1TimeDelay',delay);
1907
1908delay=str2double(get(handles.lt1_emittance,'String'))+inj_offset;
1909tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'emittanceTimeDelay',delay);
1910
1911delay=str2double(get(handles.lt1_osc,'String'))+inj_offset;
1912tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'oscTimeDelay',delay);
1913
1914
1915% BOO
1916delay=str2double(get(handles.boo_inj_septum,'String'))+inj_offset;
1917tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'sep-p.trigTimeDelay',delay);
1918
1919delay=str2double(get(handles.boo_inj_kicker,'String'))+inj_offset;
1920tango_write_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigTimeDelay',delay);
1921
1922delay=str2double(get(handles.boo_bpm,'String'))+inj_offset;
1923tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-bta.trigTimeDelay',delay);
1924tango_write_attribute2('BOO/SY/LOCAL.DG.1', 'bpm-btd.trigTimeDelay',delay);
1925tango_write_attribute2('BOO/SY/LOCAL.DG.2', 'bpm-btb.trigTimeDelay',delay);
1926tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-btc.trigTimeDelay',delay);
1927
1928
1929delay=str2double(get(handles.boo_nod,'String'))+inj_offset;
1930tango_write_attribute2('BOO/SY/LOCAL.DG.3', 'bpm-onde.trigTimeDelay',delay);
1931
1932% delay=str2double(get(handles.boo_dcct,'String'))+inj_offset;
1933% tango_write_attribute2('LT1/SY/LOCAL.DG.1', 'dcct-booTimeDelay',delay);
1934
1935
1936
1937% --- Executes during object creation, after setting all properties.
1938function inj_offset_CreateFcn(hObject, eventdata, handles)
1939% hObject    handle to inj_offset (see GCBO)
1940% eventdata  reserved - to be defined in a future version of MATLAB
1941% handles    empty - handles not created until after all CreateFcns called
1942
1943% Hint: edit controls usually have a white background on Windows.
1944%       See ISPC and COMPUTER.
1945if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1946    set(hObject,'BackgroundColor','white');
1947end
1948
1949
1950
1951function ext_offset_Callback(hObject, eventdata, handles)
1952% hObject    handle to ext_offset (see GCBO)
1953% eventdata  reserved - to be defined in a future version of MATLAB
1954% handles    structure with handles and user data (see GUIDATA)
1955
1956% Hints: get(hObject,'String') returns contents of ext_offset as text
1957%        str2double(get(hObject,'String')) returns contents of ext_offset as a double
1958
1959ext_offset=str2double(get(hObject,'String'));
1960inj_offset=str2double(get(handles.inj_offset,'String'));
1961lin_fin   =str2double(get(handles.lin_canon_spm_fin,'String'));
1962
1963%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'synchro_offset_lin');
1964FileName = [handles.DirName 'synchro_offset_lin'];
1965save(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
1966
1967
1968%BOO
1969delay=str2double(get(handles.boo_ext_dof,'String'))+ext_offset;
1970tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'dof.trigTimeDelay',delay);
1971
1972delay=str2double(get(handles.boo_ext_sept_p,'String'))+ext_offset;
1973tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-p.trigTimeDelay',delay);
1974
1975delay=str2double(get(handles.boo_ext_sept_a,'String'))+ext_offset;
1976tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'sep-a.trigTimeDelay',delay);
1977
1978delay=str2double(get(handles.boo_ext_kicker,'String'))+ext_offset;
1979tango_write_attribute2('BOO/SY/LOCAL.Bext.1', 'k.trigTimeDelay',delay);
1980
1981delay=str2double(get(handles.sdc2,'String'))+ext_offset;
1982tango_write_attribute2('ANS/SY/LOCAL.SDC.1', 'spareTimeDelay',delay);
1983
1984%LT2
1985delay=str2double(get(handles.lt2_bpm,'String'))+ext_offset;
1986tango_write_attribute2('LT2/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
1987
1988delay=str2double(get(handles.lt2_osc,'String'))+ext_offset;
1989tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'osc-fctTimeDelay',delay);
1990
1991delay=str2double(get(handles.lt2_emittance,'String'))+ext_offset;
1992tango_write_attribute2('LT2/SY/LOCAL.DG.1', 'mrsvTimeDelay',delay);
1993
1994%ANS
1995
1996delay=str2double(get(handles.ans_inj_sept_a,'String'))+ext_offset;
1997tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-a.trigTimeDelay',delay);
1998
1999delay=str2double(get(handles.ans_inj_sept_p,'String'))+ext_offset;
2000tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.2', 'sep-p.trigTimeDelay',delay);
2001
2002delay=str2double(get(handles.ans_inj_k1,'String'))+ext_offset;
2003tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k1.trigTimeDelay',delay);
2004
2005delay=str2double(get(handles.ans_inj_k2,'String'))+ext_offset;
2006tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k2.trigTimeDelay',delay);
2007
2008delay=str2double(get(handles.ans_inj_k3,'String'))+ext_offset;
2009tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k3.trigTimeDelay',delay);
2010
2011delay=str2double(get(handles.ans_inj_k4,'String'))+ext_offset;
2012tango_write_attribute2('ANS-C01/SY/LOCAL.Ainj.1', 'k4.trigTimeDelay',delay);
2013
2014
2015
2016% --- Executes during object creation, after setting all properties.
2017function ext_offset_CreateFcn(hObject, eventdata, handles)
2018% hObject    handle to ext_offset (see GCBO)
2019% eventdata  reserved - to be defined in a future version of MATLAB
2020% handles    empty - handles not created until after all CreateFcns called
2021
2022% Hint: edit controls usually have a white background on Windows.
2023%       See ISPC and COMPUTER.
2024if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2025    set(hObject,'BackgroundColor','white');
2026end
2027
2028
2029% --- Executes on button press in button_acquisition_address.
2030function button_acquisition_address_Callback(hObject, eventdata, handles)
2031% hObject    handle to button_acquisition_address (see GCBO)
2032% eventdata  reserved - to be defined in a future version of MATLAB
2033% handles    structure with handles and user data (see GUIDATA)
2034
2035test_modes(handles);
2036
2037
2038set(handles.inj_offset,'Enable','off');
2039set(handles.sdc1,'Enable','off');
2040set(handles.lin_canon_lpm,'Enable','off');
2041set(handles.lin_canon_spm,'Enable','off');
2042set(handles.lin_canon_spm_fin,'Enable','off');
2043set(handles.boo_bpm,'Enable','off');
2044set(handles.lt1_emittance,'Enable','off');
2045set(handles.lt1_MC1,'Enable','off');
2046set(handles.lt1_MC2,'Enable','off');
2047set(handles.lt1_osc,'Enable','off');
2048set(handles.boo_dcct,'Enable','off');
2049set(handles.boo_nod,'Enable','off');
2050set(handles.boo_inj_septum,'Enable','off');
2051set(handles.boo_inj_kicker,'Enable','off');
2052set(handles.boo_alim_dipole,'Enable','off');
2053set(handles.boo_alim_qf,'Enable','off');
2054set(handles.boo_alim_qd,'Enable','off');
2055set(handles.boo_alim_sf,'Enable','off');
2056set(handles.boo_alim_sd,'Enable','off');
2057set(handles.boo_rf,'Enable','off');
2058set(handles.lin_modulateur,'Enable','off');
2059set(handles.ext_offset,'Enable','off');
2060set(handles.boo_ext_dof,'Enable','off');
2061set(handles.boo_ext_sept_p,'Enable','off');
2062set(handles.boo_ext_sept_a,'Enable','off');
2063set(handles.boo_ext_kicker,'Enable','off');
2064set(handles.sdc2,'Enable','off');
2065set(handles.lt2_emittance,'Enable','off');
2066set(handles.lt2_osc,'Enable','off');
2067set(handles.lt2_bpm,'Enable','off');
2068set(handles.ans_inj_k1,'Enable','off');
2069set(handles.ans_inj_k2,'Enable','off');
2070set(handles.ans_inj_k3,'Enable','off');
2071set(handles.ans_inj_k4,'Enable','off');
2072set(handles.ans_inj_sept_p,'Enable','off');
2073set(handles.ans_inj_sept_a,'Enable','off');
2074set(handles.ans_bpm,'Enable','off');
2075set(handles.ans_dcct,'Enable','off');
2076set(handles.ans_bpm_c01,'Enable','off');
2077set(handles.ans_bpm_c02,'Enable','off');
2078set(handles.ans_bpm_c03,'Enable','off');
2079set(handles.ans_bpm_c04,'Enable','off');
2080set(handles.ans_bpm_c05,'Enable','off');
2081set(handles.ans_bpm_c06,'Enable','off');
2082set(handles.ans_bpm_c07,'Enable','off');
2083set(handles.ans_bpm_c08,'Enable','off');
2084set(handles.ans_bpm_c09,'Enable','off');
2085set(handles.ans_bpm_c10,'Enable','off');
2086set(handles.ans_bpm_c11,'Enable','off');
2087set(handles.ans_bpm_c12,'Enable','off');
2088set(handles.ans_bpm_c13,'Enable','off');
2089set(handles.ans_bpm_c14,'Enable','off');
2090set(handles.ans_bpm_c15,'Enable','off');
2091set(handles.ans_bpm_c16,'Enable','off');
2092
2093
2094%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'synchro_offset_lin');
2095FileName = [handles.DirName 'synchro_offset_lin'];
2096load(FileName, 'inj_offset' , 'ext_offset', 'lin_fin');
2097set(handles.inj_offset,'String',num2str(inj_offset));
2098set(handles.ext_offset,'String',num2str(ext_offset));
2099set(handles.lin_canon_spm_fin,'String',num2str(lin_fin));
2100
2101get_synchro_address(handles)
2102
2103
2104% --- Executes on button press in button_offinj_moins.
2105function button_offinj_moins_Callback(hObject, eventdata, handles)
2106% hObject    handle to button_offinj_moins (see GCBO)
2107% eventdata  reserved - to be defined in a future version of MATLAB
2108% handles    structure with handles and user data (see GUIDATA)
2109
2110temp=str2double(get(handles.inj_offset,'String'));
2111step=temp-52*0.52243;
2112set(handles.inj_offset,'String',step);
2113inj_offset_Callback(handles.inj_offset, eventdata, handles);
2114
2115% --- Executes on button press in button_offinj_plus.
2116function button_offinj_plus_Callback(hObject, eventdata, handles)
2117% hObject    handle to button_offinj_plus (see GCBO)
2118% eventdata  reserved - to be defined in a future version of MATLAB
2119% handles    structure with handles and user data (see GUIDATA)
2120
2121temp=str2double(get(handles.inj_offset,'String'));
2122step=temp+52*0.52243;
2123set(handles.inj_offset,'String',step);
2124inj_offset_Callback(handles.inj_offset, eventdata, handles);
2125
2126% --- Executes on button press in button_offext_moins.
2127function button_offext_moins_Callback(hObject, eventdata, handles)
2128% hObject    handle to button_offext_moins (see GCBO)
2129% eventdata  reserved - to be defined in a future version of MATLAB
2130% handles    structure with handles and user data (see GUIDATA)
2131
2132temp=str2double(get(handles.ext_offset,'String'));
2133step=temp-52*0.52243;
2134set(handles.ext_offset,'String',step);
2135ext_offset_Callback(handles.ext_offset, eventdata, handles);
2136
2137% --- Executes on button press in button_offext_plus.
2138function button_offext_plus_Callback(hObject, eventdata, handles)
2139% hObject    handle to button_offext_plus (see GCBO)
2140% eventdata  reserved - to be defined in a future version of MATLAB
2141% handles    structure with handles and user data (see GUIDATA)
2142
2143temp=str2double(get(handles.ext_offset,'String'));
2144step=temp+52*0.52243;
2145set(handles.ext_offset,'String',step);
2146ext_offset_Callback(handles.ext_offset, eventdata, handles);
2147
2148
2149% --- Executes on button press in button_bpm.
2150function button_bpm_Callback(hObject, eventdata, handles)
2151% hObject    handle to button_bpm (see GCBO)
2152% eventdata  reserved - to be defined in a future version of MATLAB
2153% handles    structure with handles and user data (see GUIDATA)
2154
2155% Hint: get(hObject,'Value') returns toggle state of button_bpm
2156
2157bpm=get(hObject,'Value');
2158
2159if (bpm==0)
2160   set(handles.panel_bpm,'Visible','off');
2161elseif (bpm==1)
2162    set(handles.panel_bpm,'Visible','on');
2163end
2164
2165
2166
2167function ans_bpm_c01_Callback(hObject, eventdata, handles)
2168% hObject    handle to ans_bpm_c01 (see GCBO)
2169% eventdata  reserved - to be defined in a future version of MATLAB
2170% handles    structure with handles and user data (see GUIDATA)
2171
2172% Hints: get(hObject,'String') returns contents of ans_bpm_c01 as text
2173%        str2double(get(hObject,'String')) returns contents of ans_bpm_c01 as a double
2174
2175ext_offset=str2double(get(handles.ext_offset,'String'));
2176delay=str2double(get(hObject,'String'))+ext_offset;
2177tango_write_attribute2('ANS-C01/SY/LOCAL.DG.2', 'bpm.trigTimeDelay',delay);
2178
2179% --- Executes during object creation, after setting all properties.
2180function ans_bpm_c01_CreateFcn(hObject, eventdata, handles)
2181% hObject    handle to ans_bpm_c01 (see GCBO)
2182% eventdata  reserved - to be defined in a future version of MATLAB
2183% handles    empty - handles not created until after all CreateFcns called
2184
2185% Hint: edit controls usually have a white background on Windows.
2186%       See ISPC and COMPUTER.
2187if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2188    set(hObject,'BackgroundColor','white');
2189end
2190
2191
2192function ans_bpm_c02_Callback(hObject, eventdata, handles)
2193% hObject    handle to ans_bpm_c02 (see GCBO)
2194% eventdata  reserved - to be defined in a future version of MATLAB
2195% handles    structure with handles and user data (see GUIDATA)
2196
2197% Hints: get(hObject,'String') returns contents of ans_bpm_c02 as text
2198%        str2double(get(hObject,'String')) returns contents of ans_bpm_c02 as a double
2199ext_offset=str2double(get(handles.ext_offset,'String'));
2200delay=str2double(get(hObject,'String'))+ext_offset;
2201tango_write_attribute2('ANS-C02/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2202
2203
2204% --- Executes during object creation, after setting all properties.
2205function ans_bpm_c02_CreateFcn(hObject, eventdata, handles)
2206% hObject    handle to ans_bpm_c02 (see GCBO)
2207% eventdata  reserved - to be defined in a future version of MATLAB
2208% handles    empty - handles not created until after all CreateFcns called
2209
2210% Hint: edit controls usually have a white background on Windows.
2211%       See ISPC and COMPUTER.
2212if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2213    set(hObject,'BackgroundColor','white');
2214end
2215
2216
2217
2218function ans_bpm_c03_Callback(hObject, eventdata, handles)
2219% hObject    handle to ans_bpm_c03 (see GCBO)
2220% eventdata  reserved - to be defined in a future version of MATLAB
2221% handles    structure with handles and user data (see GUIDATA)
2222
2223% Hints: get(hObject,'String') returns contents of ans_bpm_c03 as text
2224%        str2double(get(hObject,'String')) returns contents of ans_bpm_c03 as a double
2225ext_offset=str2double(get(handles.ext_offset,'String'));
2226delay=str2double(get(hObject,'String'))+ext_offset;
2227tango_write_attribute2('ANS-C03/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2228
2229
2230% --- Executes during object creation, after setting all properties.
2231function ans_bpm_c03_CreateFcn(hObject, eventdata, handles)
2232% hObject    handle to ans_bpm_c03 (see GCBO)
2233% eventdata  reserved - to be defined in a future version of MATLAB
2234% handles    empty - handles not created until after all CreateFcns called
2235
2236% Hint: edit controls usually have a white background on Windows.
2237%       See ISPC and COMPUTER.
2238if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2239    set(hObject,'BackgroundColor','white');
2240end
2241
2242
2243
2244function ans_bpm_c04_Callback(hObject, eventdata, handles)
2245% hObject    handle to ans_bpm_c04 (see GCBO)
2246% eventdata  reserved - to be defined in a future version of MATLAB
2247% handles    structure with handles and user data (see GUIDATA)
2248
2249% Hints: get(hObject,'String') returns contents of ans_bpm_c04 as text
2250%        str2double(get(hObject,'String')) returns contents of ans_bpm_c04 as a double
2251ext_offset=str2double(get(handles.ext_offset,'String'));
2252delay=str2double(get(hObject,'String'))+ext_offset;
2253tango_write_attribute2('ANS-C04/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2254
2255
2256% --- Executes during object creation, after setting all properties.
2257function ans_bpm_c04_CreateFcn(hObject, eventdata, handles)
2258% hObject    handle to ans_bpm_c04 (see GCBO)
2259% eventdata  reserved - to be defined in a future version of MATLAB
2260% handles    empty - handles not created until after all CreateFcns called
2261
2262% Hint: edit controls usually have a white background on Windows.
2263%       See ISPC and COMPUTER.
2264if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2265    set(hObject,'BackgroundColor','white');
2266end
2267
2268
2269
2270function ans_bpm_c05_Callback(hObject, eventdata, handles)
2271% hObject    handle to ans_bpm_c05 (see GCBO)
2272% eventdata  reserved - to be defined in a future version of MATLAB
2273% handles    structure with handles and user data (see GUIDATA)
2274
2275% Hints: get(hObject,'String') returns contents of ans_bpm_c05 as text
2276%        str2double(get(hObject,'String')) returns contents of ans_bpm_c05 as a double
2277ext_offset=str2double(get(handles.ext_offset,'String'));
2278delay=str2double(get(hObject,'String'))+ext_offset;
2279tango_write_attribute2('ANS-C05/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2280
2281
2282% --- Executes during object creation, after setting all properties.
2283function ans_bpm_c05_CreateFcn(hObject, eventdata, handles)
2284% hObject    handle to ans_bpm_c05 (see GCBO)
2285% eventdata  reserved - to be defined in a future version of MATLAB
2286% handles    empty - handles not created until after all CreateFcns called
2287
2288% Hint: edit controls usually have a white background on Windows.
2289%       See ISPC and COMPUTER.
2290if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2291    set(hObject,'BackgroundColor','white');
2292end
2293
2294
2295
2296function ans_bpm_c06_Callback(hObject, eventdata, handles)
2297% hObject    handle to ans_bpm_c06 (see GCBO)
2298% eventdata  reserved - to be defined in a future version of MATLAB
2299% handles    structure with handles and user data (see GUIDATA)
2300
2301% Hints: get(hObject,'String') returns contents of ans_bpm_c06 as text
2302%        str2double(get(hObject,'String')) returns contents of ans_bpm_c06 as a double
2303ext_offset=str2double(get(handles.ext_offset,'String'));
2304delay=str2double(get(hObject,'String'))+ext_offset;
2305tango_write_attribute2('ANS-C06/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2306
2307
2308% --- Executes during object creation, after setting all properties.
2309function ans_bpm_c06_CreateFcn(hObject, eventdata, handles)
2310% hObject    handle to ans_bpm_c06 (see GCBO)
2311% eventdata  reserved - to be defined in a future version of MATLAB
2312% handles    empty - handles not created until after all CreateFcns called
2313
2314% Hint: edit controls usually have a white background on Windows.
2315%       See ISPC and COMPUTER.
2316if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2317    set(hObject,'BackgroundColor','white');
2318end
2319
2320
2321
2322function ans_bpm_c07_Callback(hObject, eventdata, handles)
2323% hObject    handle to ans_bpm_c07 (see GCBO)
2324% eventdata  reserved - to be defined in a future version of MATLAB
2325% handles    structure with handles and user data (see GUIDATA)
2326
2327% Hints: get(hObject,'String') returns contents of ans_bpm_c07 as text
2328%        str2double(get(hObject,'String')) returns contents of ans_bpm_c07 as a double
2329ext_offset=str2double(get(handles.ext_offset,'String'));
2330delay=str2double(get(hObject,'String'))+ext_offset;
2331tango_write_attribute2('ANS-C07/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2332
2333
2334% --- Executes during object creation, after setting all properties.
2335function ans_bpm_c07_CreateFcn(hObject, eventdata, handles)
2336% hObject    handle to ans_bpm_c07 (see GCBO)
2337% eventdata  reserved - to be defined in a future version of MATLAB
2338% handles    empty - handles not created until after all CreateFcns called
2339
2340% Hint: edit controls usually have a white background on Windows.
2341%       See ISPC and COMPUTER.
2342if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2343    set(hObject,'BackgroundColor','white');
2344end
2345
2346
2347
2348function ans_bpm_c08_Callback(hObject, eventdata, handles)
2349% hObject    handle to ans_bpm_c08 (see GCBO)
2350% eventdata  reserved - to be defined in a future version of MATLAB
2351% handles    structure with handles and user data (see GUIDATA)
2352
2353% Hints: get(hObject,'String') returns contents of ans_bpm_c08 as text
2354%        str2double(get(hObject,'String')) returns contents of ans_bpm_c08 as a double
2355ext_offset=str2double(get(handles.ext_offset,'String'));
2356delay=str2double(get(hObject,'String'))+ext_offset;
2357tango_write_attribute2('ANS-C08/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2358
2359
2360% --- Executes during object creation, after setting all properties.
2361function ans_bpm_c08_CreateFcn(hObject, eventdata, handles)
2362% hObject    handle to ans_bpm_c08 (see GCBO)
2363% eventdata  reserved - to be defined in a future version of MATLAB
2364% handles    empty - handles not created until after all CreateFcns called
2365
2366% Hint: edit controls usually have a white background on Windows.
2367%       See ISPC and COMPUTER.
2368if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2369    set(hObject,'BackgroundColor','white');
2370end
2371
2372
2373
2374function ans_bpm_c09_Callback(hObject, eventdata, handles)
2375% hObject    handle to ans_bpm_c09 (see GCBO)
2376% eventdata  reserved - to be defined in a future version of MATLAB
2377% handles    structure with handles and user data (see GUIDATA)
2378
2379% Hints: get(hObject,'String') returns contents of ans_bpm_c09 as text
2380%        str2double(get(hObject,'String')) returns contents of ans_bpm_c09 as a double
2381ext_offset=str2double(get(handles.ext_offset,'String'));
2382delay=str2double(get(hObject,'String'))+ext_offset;
2383tango_write_attribute2('ANS-C09/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2384
2385
2386% --- Executes during object creation, after setting all properties.
2387function ans_bpm_c09_CreateFcn(hObject, eventdata, handles)
2388% hObject    handle to ans_bpm_c09 (see GCBO)
2389% eventdata  reserved - to be defined in a future version of MATLAB
2390% handles    empty - handles not created until after all CreateFcns called
2391
2392% Hint: edit controls usually have a white background on Windows.
2393%       See ISPC and COMPUTER.
2394if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2395    set(hObject,'BackgroundColor','white');
2396end
2397
2398
2399
2400function ans_bpm_c10_Callback(hObject, eventdata, handles)
2401% hObject    handle to ans_bpm_c10 (see GCBO)
2402% eventdata  reserved - to be defined in a future version of MATLAB
2403% handles    structure with handles and user data (see GUIDATA)
2404
2405% Hints: get(hObject,'String') returns contents of ans_bpm_c10 as text
2406%        str2double(get(hObject,'String')) returns contents of ans_bpm_c10 as a double
2407ext_offset=str2double(get(handles.ext_offset,'String'));
2408delay=str2double(get(hObject,'String'))+ext_offset;
2409tango_write_attribute2('ANS-C10/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2410
2411
2412% --- Executes during object creation, after setting all properties.
2413function ans_bpm_c10_CreateFcn(hObject, eventdata, handles)
2414% hObject    handle to ans_bpm_c10 (see GCBO)
2415% eventdata  reserved - to be defined in a future version of MATLAB
2416% handles    empty - handles not created until after all CreateFcns called
2417
2418% Hint: edit controls usually have a white background on Windows.
2419%       See ISPC and COMPUTER.
2420if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2421    set(hObject,'BackgroundColor','white');
2422end
2423
2424
2425
2426function ans_bpm_c11_Callback(hObject, eventdata, handles)
2427% hObject    handle to ans_bpm_c11 (see GCBO)
2428% eventdata  reserved - to be defined in a future version of MATLAB
2429% handles    structure with handles and user data (see GUIDATA)
2430
2431% Hints: get(hObject,'String') returns contents of ans_bpm_c11 as text
2432%        str2double(get(hObject,'String')) returns contents of ans_bpm_c11 as a double
2433ext_offset=str2double(get(handles.ext_offset,'String'));
2434delay=str2double(get(hObject,'String'))+ext_offset;
2435tango_write_attribute2('ANS-C11/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2436
2437
2438% --- Executes during object creation, after setting all properties.
2439function ans_bpm_c11_CreateFcn(hObject, eventdata, handles)
2440% hObject    handle to ans_bpm_c11 (see GCBO)
2441% eventdata  reserved - to be defined in a future version of MATLAB
2442% handles    empty - handles not created until after all CreateFcns called
2443
2444% Hint: edit controls usually have a white background on Windows.
2445%       See ISPC and COMPUTER.
2446if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2447    set(hObject,'BackgroundColor','white');
2448end
2449
2450
2451
2452function ans_bpm_c12_Callback(hObject, eventdata, handles)
2453% hObject    handle to ans_bpm_c12 (see GCBO)
2454% eventdata  reserved - to be defined in a future version of MATLAB
2455% handles    structure with handles and user data (see GUIDATA)
2456
2457% Hints: get(hObject,'String') returns contents of ans_bpm_c12 as text
2458%        str2double(get(hObject,'String')) returns contents of ans_bpm_c12 as a double
2459ext_offset=str2double(get(handles.ext_offset,'String'));
2460delay=str2double(get(hObject,'String'))+ext_offset;
2461tango_write_attribute2('ANS-C12/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2462
2463
2464% --- Executes during object creation, after setting all properties.
2465function ans_bpm_c12_CreateFcn(hObject, eventdata, handles)
2466% hObject    handle to ans_bpm_c12 (see GCBO)
2467% eventdata  reserved - to be defined in a future version of MATLAB
2468% handles    empty - handles not created until after all CreateFcns called
2469
2470% Hint: edit controls usually have a white background on Windows.
2471%       See ISPC and COMPUTER.
2472if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2473    set(hObject,'BackgroundColor','white');
2474end
2475
2476
2477
2478function ans_bpm_c13_Callback(hObject, eventdata, handles)
2479% hObject    handle to ans_bpm_c13 (see GCBO)
2480% eventdata  reserved - to be defined in a future version of MATLAB
2481% handles    structure with handles and user data (see GUIDATA)
2482
2483% Hints: get(hObject,'String') returns contents of ans_bpm_c13 as text
2484%        str2double(get(hObject,'String')) returns contents of ans_bpm_c13 as a double
2485ext_offset=str2double(get(handles.ext_offset,'String'));
2486delay=str2double(get(hObject,'String'))+ext_offset;
2487tango_write_attribute2('ANS-C13/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2488
2489
2490% --- Executes during object creation, after setting all properties.
2491function ans_bpm_c13_CreateFcn(hObject, eventdata, handles)
2492% hObject    handle to ans_bpm_c13 (see GCBO)
2493% eventdata  reserved - to be defined in a future version of MATLAB
2494% handles    empty - handles not created until after all CreateFcns called
2495
2496% Hint: edit controls usually have a white background on Windows.
2497%       See ISPC and COMPUTER.
2498if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2499    set(hObject,'BackgroundColor','white');
2500end
2501
2502
2503
2504function ans_bpm_c14_Callback(hObject, eventdata, handles)
2505% hObject    handle to ans_bpm_c14 (see GCBO)
2506% eventdata  reserved - to be defined in a future version of MATLAB
2507% handles    structure with handles and user data (see GUIDATA)
2508
2509% Hints: get(hObject,'String') returns contents of ans_bpm_c14 as text
2510%        str2double(get(hObject,'String')) returns contents of ans_bpm_c14 as a double
2511ext_offset=str2double(get(handles.ext_offset,'String'));
2512delay=str2double(get(hObject,'String'))+ext_offset;
2513tango_write_attribute2('ANS-C14/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2514
2515
2516% --- Executes during object creation, after setting all properties.
2517function ans_bpm_c14_CreateFcn(hObject, eventdata, handles)
2518% hObject    handle to ans_bpm_c14 (see GCBO)
2519% eventdata  reserved - to be defined in a future version of MATLAB
2520% handles    empty - handles not created until after all CreateFcns called
2521
2522% Hint: edit controls usually have a white background on Windows.
2523%       See ISPC and COMPUTER.
2524if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2525    set(hObject,'BackgroundColor','white');
2526end
2527
2528
2529
2530function ans_bpm_c15_Callback(hObject, eventdata, handles)
2531% hObject    handle to ans_bpm_c15 (see GCBO)
2532% eventdata  reserved - to be defined in a future version of MATLAB
2533% handles    structure with handles and user data (see GUIDATA)
2534
2535% Hints: get(hObject,'String') returns contents of ans_bpm_c15 as text
2536%        str2double(get(hObject,'String')) returns contents of ans_bpm_c15 as a double
2537ext_offset=str2double(get(handles.ext_offset,'String'));
2538delay=str2double(get(hObject,'String'))+ext_offset;
2539tango_write_attribute2('ANS-C15/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2540
2541
2542% --- Executes during object creation, after setting all properties.
2543function ans_bpm_c15_CreateFcn(hObject, eventdata, handles)
2544% hObject    handle to ans_bpm_c15 (see GCBO)
2545% eventdata  reserved - to be defined in a future version of MATLAB
2546% handles    empty - handles not created until after all CreateFcns called
2547
2548% Hint: edit controls usually have a white background on Windows.
2549%       See ISPC and COMPUTER.
2550if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2551    set(hObject,'BackgroundColor','white');
2552end
2553
2554
2555
2556function ans_bpm_c16_Callback(hObject, eventdata, handles)
2557% hObject    handle to ans_bpm_c16 (see GCBO)
2558% eventdata  reserved - to be defined in a future version of MATLAB
2559% handles    structure with handles and user data (see GUIDATA)
2560
2561% Hints: get(hObject,'String') returns contents of ans_bpm_c16 as text
2562%        str2double(get(hObject,'String')) returns contents of ans_bpm_c16 as a double
2563ext_offset=str2double(get(handles.ext_offset,'String'));
2564delay=str2double(get(hObject,'String'))+ext_offset;
2565tango_write_attribute2('ANS-C16/SY/LOCAL.DG.1', 'bpm.trigTimeDelay',delay);
2566
2567
2568% --- Executes during object creation, after setting all properties.
2569function ans_bpm_c16_CreateFcn(hObject, eventdata, handles)
2570% hObject    handle to ans_bpm_c16 (see GCBO)
2571% eventdata  reserved - to be defined in a future version of MATLAB
2572% handles    empty - handles not created until after all CreateFcns called
2573
2574% Hint: edit controls usually have a white background on Windows.
2575%       See ISPC and COMPUTER.
2576if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2577    set(hObject,'BackgroundColor','white');
2578end
2579
2580
2581
2582function edit_filling_relecture_tables_Callback(hObject, eventdata, handles)
2583% hObject    handle to edit_filling_relecture_tables (see GCBO)
2584% eventdata  reserved - to be defined in a future version of MATLAB
2585% handles    structure with handles and user data (see GUIDATA)
2586
2587% Hints: get(hObject,'String') returns contents of edit_filling_relecture_tables as text
2588%        str2double(get(hObject,'String')) returns contents of edit_filling_relecture_tables as a double
2589
2590
2591% --- Executes during object creation, after setting all properties.
2592function edit_filling_relecture_tables_CreateFcn(hObject, eventdata, handles)
2593% hObject    handle to edit_filling_relecture_tables (see GCBO)
2594% eventdata  reserved - to be defined in a future version of MATLAB
2595% handles    empty - handles not created until after all CreateFcns called
2596
2597% Hint: edit controls usually have a white background on Windows.
2598%       See ISPC and COMPUTER.
2599if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2600    set(hObject,'BackgroundColor','white');
2601end
2602
2603
2604
2605function edit_filling_relecture_bunch_Callback(hObject, eventdata, handles)
2606% hObject    handle to edit_filling_relecture_bunch (see GCBO)
2607% eventdata  reserved - to be defined in a future version of MATLAB
2608% handles    structure with handles and user data (see GUIDATA)
2609
2610% Hints: get(hObject,'String') returns contents of edit_filling_relecture_bunch as text
2611%        str2double(get(hObject,'String')) returns contents of edit_filling_relecture_bunch as a double
2612
2613
2614% --- Executes during object creation, after setting all properties.
2615function edit_filling_relecture_bunch_CreateFcn(hObject, eventdata, handles)
2616% hObject    handle to edit_filling_relecture_bunch (see GCBO)
2617% eventdata  reserved - to be defined in a future version of MATLAB
2618% handles    empty - handles not created until after all CreateFcns called
2619
2620% Hint: edit controls usually have a white background on Windows.
2621%       See ISPC and COMPUTER.
2622if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2623    set(hObject,'BackgroundColor','white');
2624end
2625
2626
2627
2628function edit_filling_entrer_bunch_Callback(hObject, eventdata, handles)
2629% hObject    handle to edit_filling_entrer_bunch (see GCBO)
2630% eventdata  reserved - to be defined in a future version of MATLAB
2631% handles    structure with handles and user data (see GUIDATA)
2632
2633% Hints: get(hObject,'String') returns contents of edit_filling_entrer_bunch as text
2634%        str2double(get(hObject,'String')) returns contents of edit_filling_entrer_bunch as a double
2635
2636%set(handles.listbox_fillingmode,'value',12);
2637%listbox_fillingmode_Callback;
2638
2639% --- Executes during object creation, after setting all properties.
2640function edit_filling_entrer_bunch_CreateFcn(hObject, eventdata, handles)
2641% hObject    handle to edit_filling_entrer_bunch (see GCBO)
2642% eventdata  reserved - to be defined in a future version of MATLAB
2643% handles    empty - handles not created until after all CreateFcns called
2644
2645% Hint: edit controls usually have a white background on Windows.
2646%       See ISPC and COMPUTER.
2647if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2648    set(hObject,'BackgroundColor','white');
2649end
2650
2651
2652% --- Executes on button press in button_update.
2653function button_update_Callback(hObject, eventdata, handles)
2654% hObject    handle to button_update (see GCBO)
2655% eventdata  reserved - to be defined in a future version of MATLAB
2656% handles    structure with handles and user data (see GUIDATA)
2657
2658do_update
2659
2660% --- Executes on button press in button_acquisition_trigstatus.
2661function button_acquisition_trigstatus_Callback(hObject, eventdata, handles)
2662% hObject    handle to button_acquisition_trigstatus (see GCBO)
2663% eventdata  reserved - to be defined in a future version of MATLAB
2664% handles    structure with handles and user data (see GUIDATA)
2665
2666test_modes(handles);
2667
2668set(handles.inj_offset,'Enable','off');
2669set(handles.sdc1,'Enable','off');
2670set(handles.lin_canon_lpm,'Enable','off');
2671set(handles.boo_bpm,'Enable','off');
2672set(handles.lt1_emittance,'Enable','off');
2673set(handles.lt1_MC1,'Enable','off');
2674set(handles.lt1_MC2,'Enable','off');
2675set(handles.lt1_osc,'Enable','off');
2676set(handles.boo_dcct,'Enable','off');
2677set(handles.boo_nod,'Enable','off');
2678set(handles.boo_inj_septum,'Enable','off');
2679set(handles.boo_inj_kicker,'Enable','off');
2680set(handles.boo_alim_dipole,'Enable','off');
2681set(handles.boo_alim_qf,'Enable','off');
2682set(handles.boo_alim_qd,'Enable','off');
2683set(handles.boo_alim_sf,'Enable','off');
2684set(handles.boo_alim_sd,'Enable','off');
2685set(handles.boo_rf,'Enable','off');
2686set(handles.lin_modulateur,'Enable','off');
2687set(handles.ext_offset,'Enable','off');
2688set(handles.boo_ext_dof,'Enable','off');
2689set(handles.boo_ext_sept_p,'Enable','off');
2690set(handles.boo_ext_sept_a,'Enable','off');
2691set(handles.boo_ext_kicker,'Enable','off');
2692set(handles.sdc2,'Enable','off');
2693set(handles.lt2_emittance,'Enable','off');
2694set(handles.lt2_osc,'Enable','off');
2695set(handles.lt2_bpm,'Enable','off');
2696set(handles.ans_inj_k1,'Enable','off');
2697set(handles.ans_inj_k2,'Enable','off');
2698set(handles.ans_inj_k3,'Enable','off');
2699set(handles.ans_inj_k4,'Enable','off');
2700set(handles.ans_inj_sept_p,'Enable','off');
2701set(handles.ans_inj_sept_a,'Enable','off');
2702set(handles.ans_bpm,'Enable','off');
2703set(handles.ans_dcct,'Enable','off');
2704set(handles.ans_bpm_c01,'Enable','off');
2705set(handles.ans_bpm_c02,'Enable','off');
2706set(handles.ans_bpm_c03,'Enable','off');
2707set(handles.ans_bpm_c04,'Enable','off');
2708set(handles.ans_bpm_c05,'Enable','off');
2709set(handles.ans_bpm_c06,'Enable','off');
2710set(handles.ans_bpm_c07,'Enable','off');
2711set(handles.ans_bpm_c08,'Enable','off');
2712set(handles.ans_bpm_c09,'Enable','off');
2713set(handles.ans_bpm_c10,'Enable','off');
2714set(handles.ans_bpm_c11,'Enable','off');
2715set(handles.ans_bpm_c12,'Enable','off');
2716set(handles.ans_bpm_c13,'Enable','off');
2717set(handles.ans_bpm_c14,'Enable','off');
2718set(handles.ans_bpm_c15,'Enable','off');
2719set(handles.ans_bpm_c16,'Enable','off');
2720
2721get_synchro_trigstatus(handles)
2722
2723
2724% --- Executes on button press in togglebutton2.
2725function togglebutton2_Callback(hObject, eventdata, handles)
2726% hObject    handle to togglebutton2 (see GCBO)
2727% eventdata  reserved - to be defined in a future version of MATLAB
2728% handles    structure with handles and user data (see GUIDATA)
2729
2730% Hint: get(hObject,'Value') returns toggle state of togglebutton2
2731
2732
2733% --- Executes on selection change in listbox_fillingmode.
2734function listbox_fillingmode_Callback(hObject, eventdata, handles)
2735% hObject    handle to listbox_fillingmode (see GCBO)
2736% eventdata  reserved - to be defined in a future version of MATLAB
2737% handles    structure with handles and user data (see GUIDATA)
2738
2739% Hints: contents = get(hObject,'String') returns listbox_fillingmode contents as cell array
2740%        contents{get(hObject,'Value')} returns selected item from listbox_fillingmode
2741pattern=get(hObject,'String');
2742mode=get(hObject,'Value');
2743fprintf('***************************************************\n')
2744fprintf('Mode de remplissage sélectionné : %s\n',pattern{mode})
2745fprintf('***************************************************\n')
2746
2747
2748% Prépare les tables pour le 3 Hz
2749quart=[1 105 209 313];
2750temp=tango_read_attribute('ANS/SY/CENTRAL', 'ExtractionOffsetClkStepValue');
2751offset_ext=temp.value(1)*52;
2752offset_linac=str2double(get(handles.lin_canon_spm_fin,'String')) ;% délai fin de réglage en ns
2753offset_linac=offset_linac/handles.lin_fin_step;                   % délai fin de réglage en pas de handles.lin_fin_step ps
2754bjump=handles.one_bunch;
2755
2756
2757if (mode<=4)    %LPM
2758    bunch=quart(mode);
2759    fillingmode='1/4';
2760elseif (mode>4)&&(mode<=7) %LPM
2761    bunch=quart(1:(mode-3));
2762    if mode==5 ; fillingmode='1/2'; end
2763    if mode==6 ; fillingmode='3/4'; end
2764    if mode==7 ; fillingmode='4/4'; end
2765elseif (mode==8)    %LPM
2766    bunch=[365];      % SPM hybride
2767    %bunch=[0 104+32 2*(104+40)]+1; % spécial 3/4
2768    fillingmode='3/4';
2769elseif (mode==9)   % SPM    1 paquet
2770    bunch=[1];
2771    fillingmode='1 bunch';
2772elseif (mode==10)  % SPM    8 paquets
2773    bunch=[0:7]*52+1;
2774    fillingmode='8 bunches';
2775elseif (mode==11)  % SPM    16 paquets
2776    bunch=[0:15]*26+1;
2777    fillingmode='16 bunches';
2778elseif (mode==12)  % SPM    n paquets
2779    bunch=str2num(get(handles.edit_filling_entrer_bunch,'String'));
2780    if isempty(bunch)
2781        set(handles.edit_filling_entrer_bunch,'String','Bug format');
2782    end
2783    fillingmode='Few bunches';
2784elseif (mode==13)  % SPM    n paquets
2785    paq=str2num(get(handles.edit_filling_entrer_bunch1,'String'));
2786    if (length(paq) == 2)
2787       bunch=paq(1):paq(2);
2788    else
2789       set(handles.edit_filling_entrer_bunch1,'String','Bug format')
2790    end
2791    fillingmode='Few bunches';
2792end
2793
2794% Renseigne le filling Mode
2795tango_write_attribute2('ANS/DG/PUB-FillingMode', 'fillingMode',fillingmode)
2796
2797% Charge la longueur de la rafale par défaut sur un cycle
2798Ncoup=length(bunch);
2799boucle=int16(str2double(get(handles.edit_Ncycle,'String')));
2800if Ncoup>=1
2801    set(handles.edit_Ncoup,'String',num2str(Ncoup));
2802    tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2803end
2804   
2805   
2806[dtour,dpaquet]=bucketnumber(bunch);
2807dpaquet=dpaquet*bjump+offset_linac;
2808table=int32([length(bunch) dtour dpaquet]);
2809handles.table=table;
2810handles.bunch=bunch;
2811
2812%FileName = fullfile(getfamilydata('Directory', 'Synchro'), 'table');
2813FileName = [handles.DirName 'table.mat'];
2814save(FileName, 'table'); % pour palier aux handles via timer non mis à jour !!!!!!
2815
2816modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
2817if strcmp(modeinj,'togglebutton_soft')  % on rempli la table sur paquet 1 par défaut, pas utilisée
2818    table=handles.table0;
2819    tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
2820   
2821elseif strcmp(modeinj,'togglebutton_3Hz') % on rempli la table associée au remplissage
2822    tango_command_inout('ANS/SY/CENTRAL','SetTables',table);
2823    pause(1); % mise a jour table ATK
2824    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TablesCurrentDepth');
2825    n=temp.value;
2826    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'ExtractionDelayTable');
2827    table_ext=temp.value(1:n); %-offset_ext;
2828    temp=tango_read_attribute2('ANS/SY/CENTRAL', 'LinacDelayTable');
2829    table_linac=(temp.value(1:n)-offset_linac)/bjump;
2830    table=[];
2831    for i=1:n
2832        table=[table ' ' '(' num2str([table_ext(i)])  ' '  num2str([table_linac(i)]) ')'];
2833    end
2834end
2835
2836set(handles.edit_filling_relecture_tables,'String',[num2str(table)]);
2837set(handles.edit_filling_relecture_bunch, 'String',[num2str(bunch)]);
2838
2839
2840guidata(hObject, handles);
2841
2842
2843% --- Executes during object creation, after setting all properties.
2844function listbox_fillingmode_CreateFcn(hObject, eventdata, handles)
2845% hObject    handle to listbox_fillingmode (see GCBO)
2846% eventdata  reserved - to be defined in a future version of MATLAB
2847% handles    empty - handles not created until after all CreateFcns called
2848
2849% Hint: listbox controls usually have a white background on Windows.
2850%       See ISPC and COMPUTER.
2851if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2852    set(hObject,'BackgroundColor','white');
2853end
2854
2855
2856% --- Executes on button press in button_fix.
2857function button_fix_Callback(hObject, eventdata, handles)
2858% hObject    handle to button_fix (see GCBO)
2859% eventdata  reserved - to be defined in a future version of MATLAB
2860% handles    structure with handles and user data (see GUIDATA)
2861
2862[clk_spare,clk_soft]=fix_quart;
2863handles.clk_spare  =clk_spare;
2864handles.clk_soft=clk_soft;
2865
2866% n=1;
2867% temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSprStepDelay');
2868% clk1=temp.value(n);
2869% temp=tango_read_attribute2('ANS/SY/CENTRAL', 'TSoftStepDelay');
2870% clk2=temp.value(n);
2871%
2872% jump=int32([0 39 26 13]);
2873% handles.clk_spare  =jump +  int32(clk1);
2874% handles.clk_soft=jump  + int32(clk2);
2875
2876guidata(hObject, handles);
2877
2878
2879
2880function edit_Ncycle_Callback(hObject, eventdata, handles)
2881% hObject    handle to edit_Ncycle (see GCBO)
2882% eventdata  reserved - to be defined in a future version of MATLAB
2883% handles    structure with handles and user data (see GUIDATA)
2884
2885% Hints: get(hObject,'String') returns contents of edit_Ncycle as text
2886%        str2double(get(hObject,'String')) returns contents of edit_Ncycle as a double
2887boucle=str2double(get(hObject,'String'));
2888Ncoup=str2double(get(handles.edit_Ncoup,'String'));
2889tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2890
2891% --- Executes during object creation, after setting all properties.
2892function edit_Ncycle_CreateFcn(hObject, eventdata, handles)
2893% hObject    handle to edit_Ncycle (see GCBO)
2894% eventdata  reserved - to be defined in a future version of MATLAB
2895% handles    empty - handles not created until after all CreateFcns called
2896
2897% Hint: edit controls usually have a white background on Windows.
2898%       See ISPC and COMPUTER.
2899if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2900    set(hObject,'BackgroundColor','white');
2901end
2902
2903
2904
2905function edit_Ncoup_Callback(hObject, eventdata, handles)
2906% hObject    handle to edit_Ncoup (see GCBO)
2907% eventdata  reserved - to be defined in a future version of MATLAB
2908% handles    structure with handles and user data (see GUIDATA)
2909
2910% Hints: get(hObject,'String') returns contents of edit_Ncoup as text
2911%        str2double(get(hObject,'String')) returns contents of edit_Ncoup as a double
2912Ncoup=str2double(get(hObject,'String'));
2913boucle=str2double(get(handles.edit_Ncycle,'String'));
2914tango_write_attribute2('ANS/SY/CENTRAL', 'burstSize',int32(Ncoup*boucle));
2915
2916% --- Executes during object creation, after setting all properties.
2917function edit_Ncoup_CreateFcn(hObject, eventdata, handles)
2918% hObject    handle to edit_Ncoup (see GCBO)
2919% eventdata  reserved - to be defined in a future version of MATLAB
2920% handles    empty - handles not created until after all CreateFcns called
2921
2922% Hint: edit controls usually have a white background on Windows.
2923%       See ISPC and COMPUTER.
2924if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2925    set(hObject,'BackgroundColor','white');
2926end
2927
2928
2929
2930function edit_qlt1_Callback(hObject, eventdata, handles)
2931% hObject    handle to edit_qlt1 (see GCBO)
2932% eventdata  reserved - to be defined in a future version of MATLAB
2933% handles    structure with handles and user data (see GUIDATA)
2934
2935% Hints: get(hObject,'String') returns contents of edit_qlt1 as text
2936%        str2double(get(hObject,'String')) returns contents of edit_qlt1 as a double
2937
2938
2939% --- Executes during object creation, after setting all properties.
2940function edit_qlt1_CreateFcn(hObject, eventdata, handles)
2941% hObject    handle to edit_qlt1 (see GCBO)
2942% eventdata  reserved - to be defined in a future version of MATLAB
2943% handles    empty - handles not created until after all CreateFcns called
2944
2945% Hint: edit controls usually have a white background on Windows.
2946%       See ISPC and COMPUTER.
2947if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2948    set(hObject,'BackgroundColor','white');
2949end
2950
2951
2952
2953function edit_iboo_Callback(hObject, eventdata, handles)
2954% hObject    handle to edit_iboo (see GCBO)
2955% eventdata  reserved - to be defined in a future version of MATLAB
2956% handles    structure with handles and user data (see GUIDATA)
2957
2958% Hints: get(hObject,'String') returns contents of edit_iboo as text
2959%        str2double(get(hObject,'String')) returns contents of edit_iboo as a double
2960
2961
2962% --- Executes during object creation, after setting all properties.
2963function edit_iboo_CreateFcn(hObject, eventdata, handles)
2964% hObject    handle to edit_iboo (see GCBO)
2965% eventdata  reserved - to be defined in a future version of MATLAB
2966% handles    empty - handles not created until after all CreateFcns called
2967
2968% Hint: edit controls usually have a white background on Windows.
2969%       See ISPC and COMPUTER.
2970if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2971    set(hObject,'BackgroundColor','white');
2972end
2973
2974
2975
2976function edit_dians_Callback(hObject, eventdata, handles)
2977% hObject    handle to edit_dians (see GCBO)
2978% eventdata  reserved - to be defined in a future version of MATLAB
2979% handles    structure with handles and user data (see GUIDATA)
2980
2981% Hints: get(hObject,'String') returns contents of edit_dians as text
2982%        str2double(get(hObject,'String')) returns contents of edit_dians as a double
2983
2984
2985% --- Executes during object creation, after setting all properties.
2986function edit_dians_CreateFcn(hObject, eventdata, handles)
2987% hObject    handle to edit_dians (see GCBO)
2988% eventdata  reserved - to be defined in a future version of MATLAB
2989% handles    empty - handles not created until after all CreateFcns called
2990
2991% Hint: edit controls usually have a white background on Windows.
2992%       See ISPC and COMPUTER.
2993if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
2994    set(hObject,'BackgroundColor','white');
2995end
2996
2997
2998
2999function edit_rlt1_Callback(hObject, eventdata, handles)
3000% hObject    handle to edit_rlt1 (see GCBO)
3001% eventdata  reserved - to be defined in a future version of MATLAB
3002% handles    structure with handles and user data (see GUIDATA)
3003
3004% Hints: get(hObject,'String') returns contents of edit_rlt1 as text
3005%        str2double(get(hObject,'String')) returns contents of edit_rlt1 as a double
3006
3007
3008% --- Executes during object creation, after setting all properties.
3009function edit_rlt1_CreateFcn(hObject, eventdata, handles)
3010% hObject    handle to edit_rlt1 (see GCBO)
3011% eventdata  reserved - to be defined in a future version of MATLAB
3012% handles    empty - handles not created until after all CreateFcns called
3013
3014% Hint: edit controls usually have a white background on Windows.
3015%       See ISPC and COMPUTER.
3016if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3017    set(hObject,'BackgroundColor','white');
3018end
3019
3020
3021
3022function edit_rboo_Callback(hObject, eventdata, handles)
3023% hObject    handle to edit_rboo (see GCBO)
3024% eventdata  reserved - to be defined in a future version of MATLAB
3025% handles    structure with handles and user data (see GUIDATA)
3026
3027% Hints: get(hObject,'String') returns contents of edit_rboo as text
3028%        str2double(get(hObject,'String')) returns contents of edit_rboo as a double
3029
3030
3031% --- Executes during object creation, after setting all properties.
3032function edit_rboo_CreateFcn(hObject, eventdata, handles)
3033% hObject    handle to edit_rboo (see GCBO)
3034% eventdata  reserved - to be defined in a future version of MATLAB
3035% handles    empty - handles not created until after all CreateFcns called
3036
3037% Hint: edit controls usually have a white background on Windows.
3038%       See ISPC and COMPUTER.
3039if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3040    set(hObject,'BackgroundColor','white');
3041end
3042
3043
3044
3045function edit_rans_Callback(hObject, eventdata, handles)
3046% hObject    handle to edit_rans (see GCBO)
3047% eventdata  reserved - to be defined in a future version of MATLAB
3048% handles    structure with handles and user data (see GUIDATA)
3049
3050% Hints: get(hObject,'String') returns contents of edit_rans as text
3051%        str2double(get(hObject,'String')) returns contents of edit_rans as a double
3052
3053
3054% --- Executes during object creation, after setting all properties.
3055function edit_rans_CreateFcn(hObject, eventdata, handles)
3056% hObject    handle to edit_rans (see GCBO)
3057% eventdata  reserved - to be defined in a future version of MATLAB
3058% handles    empty - handles not created until after all CreateFcns called
3059
3060% Hint: edit controls usually have a white background on Windows.
3061%       See ISPC and COMPUTER.
3062if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3063    set(hObject,'BackgroundColor','white');
3064end
3065
3066
3067
3068function edit_dians1_Callback(hObject, eventdata, handles)
3069% hObject    handle to edit_dians1 (see GCBO)
3070% eventdata  reserved - to be defined in a future version of MATLAB
3071% handles    structure with handles and user data (see GUIDATA)
3072
3073% Hints: get(hObject,'String') returns contents of edit_dians1 as text
3074%        str2double(get(hObject,'String')) returns contents of edit_dians1 as a double
3075
3076
3077% --- Executes during object creation, after setting all properties.
3078function edit_dians1_CreateFcn(hObject, eventdata, handles)
3079% hObject    handle to edit_dians1 (see GCBO)
3080% eventdata  reserved - to be defined in a future version of MATLAB
3081% handles    empty - handles not created until after all CreateFcns called
3082
3083% Hint: edit controls usually have a white background on Windows.
3084%       See ISPC and COMPUTER.
3085if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3086    set(hObject,'BackgroundColor','white');
3087end
3088
3089
3090
3091function edit_cycle_Callback(hObject, eventdata, handles)
3092% hObject    handle to edit_cycle (see GCBO)
3093% eventdata  reserved - to be defined in a future version of MATLAB
3094% handles    structure with handles and user data (see GUIDATA)
3095
3096% Hints: get(hObject,'String') returns contents of edit_cycle as text
3097%        str2double(get(hObject,'String')) returns contents of edit_cycle as a double
3098
3099
3100% --- Executes during object creation, after setting all properties.
3101function edit_cycle_CreateFcn(hObject, eventdata, handles)
3102% hObject    handle to edit_cycle (see GCBO)
3103% eventdata  reserved - to be defined in a future version of MATLAB
3104% handles    empty - handles not created until after all CreateFcns called
3105
3106% Hint: edit controls usually have a white background on Windows.
3107%       See ISPC and COMPUTER.
3108if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3109    set(hObject,'BackgroundColor','white');
3110end
3111
3112
3113
3114function edit_courant_total_Callback(hObject, eventdata, handles)
3115% hObject    handle to edit_courant_total (see GCBO)
3116% eventdata  reserved - to be defined in a future version of MATLAB
3117% handles    structure with handles and user data (see GUIDATA)
3118
3119% Hints: get(hObject,'String') returns contents of edit_courant_total as text
3120%        str2double(get(hObject,'String')) returns contents of edit_courant_total as a double
3121
3122
3123% --- Executes during object creation, after setting all properties.
3124function edit_courant_total_CreateFcn(hObject, eventdata, handles)
3125% hObject    handle to edit_courant_total (see GCBO)
3126% eventdata  reserved - to be defined in a future version of MATLAB
3127% handles    empty - handles not created until after all CreateFcns called
3128
3129% Hint: edit controls usually have a white background on Windows.
3130%       See ISPC and COMPUTER.
3131if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3132    set(hObject,'BackgroundColor','white');
3133end
3134
3135
3136
3137function lin_canon_spm_Callback(hObject, eventdata, handles)
3138% hObject    handle to lin_canon_spm (see GCBO)
3139% eventdata  reserved - to be defined in a future version of MATLAB
3140% handles    structure with handles and user data (see GUIDATA)
3141
3142% Hints: get(hObject,'String') returns contents of lin_canon_spm as text
3143%        str2double(get(hObject,'String')) returns contents of lin_canon_spm as a double
3144
3145inj_offset=str2double(get(handles.inj_offset,'String'));
3146delay=str2double(get(hObject,'String'))+inj_offset;
3147tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacTimeDelay',delay);
3148
3149
3150% --- Executes during object creation, after setting all properties.
3151function lin_canon_spm_CreateFcn(hObject, eventdata, handles)
3152% hObject    handle to lin_canon_spm (see GCBO)
3153% eventdata  reserved - to be defined in a future version of MATLAB
3154% handles    empty - handles not created until after all CreateFcns called
3155
3156% Hint: edit controls usually have a white background on Windows.
3157%       See ISPC and COMPUTER.
3158if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3159    set(hObject,'BackgroundColor','white');
3160end
3161
3162
3163function  uipanel_mode_CreateFcn(hObject, eventdata, handles)
3164% hObject    handle to lin_canon_spm (see GCBO)
3165% eventdata  reserved - to be defined in a future version of MATLAB
3166% handles    empty - handles not created until after all CreateFcns called
3167
3168
3169% % --------------------------------------------------------------------
3170function uipanel_mode_SelectionChangeFcn(hObject, eventdata, handles)
3171% % hObject    handle to uipanel_mode (see GCBO)
3172% % eventdata  reserved - to be defined in a future version of MATLAB
3173% % handles    structure with handles and user data (see GUIDATA)
3174
3175set(handles.button_injection_soft,'Enable','Off')
3176set(handles.edit_modes,'String','Please WAIT !!!!')
3177mode=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3178
3179switch mode  % Get Tag of selected object
3180    case 'togglebutton_soft'
3181        % switch to soft (load golden)
3182       
3183        Directory=handles.Directory;
3184        DirName=handles.DirName;
3185        file='golden_rafale_soft.mat';
3186        load_synchro_rafale(Directory,file,DirName)
3187       
3188       
3189        % special septum actif boo et ans
3190        r=(1-0.0004);
3191        try
3192            temp=tango_read_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage');boo=temp.value(2)*r
3193            tango_write_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage',boo);
3194            temp=tango_read_attribute2('ANS-C01/EP/AL_SEP_A','voltage');ans=temp.value(2)*r
3195            tango_write_attribute2('ANS-C01/EP/AL_SEP_A','voltage',ans);
3196        catch
3197            display('Erreur ajustement tension septa passif')
3198        end
3199        set(handles.edit_Ncoup,'Enable','off');
3200        tango_command_inout('ANS/SY/CENTRAL','SetTables',handles.table0);
3201
3202    case 'togglebutton_3Hz'
3203        % switch to 3Hz(load golden)
3204       
3205        Directory=handles.Directory;
3206        DirName=handles.DirName;
3207        file='golden_rafale_3Hz.mat';
3208        load_synchro_rafale(Directory,file,DirName)
3209       
3210        % special septum actif boo et ans
3211        r=(1+0.0004);
3212        try
3213            temp=tango_read_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage');boo=temp.value(2)*r
3214            tango_write_attribute2('BOO-C12/EP/AL_SEP_A.Ext','voltage',boo);
3215            temp=tango_read_attribute2('ANS-C01/EP/AL_SEP_A','voltage');    ans=temp.value(2)*r
3216            tango_write_attribute2('ANS-C01/EP/AL_SEP_A','voltage',ans);
3217        catch
3218            display('Erreur ajustement tension septa passif')
3219        end
3220        set(handles.edit_Ncoup,'Enable','on');
3221        tango_command_inout('ANS/SY/CENTRAL','SetTables',handles.table);
3222end
3223
3224set(handles.button_injection_soft,'Enable','On')
3225test_modes(handles);
3226display('ok change address')
3227
3228
3229
3230function edit_filling_entrer_bunch1_Callback(hObject, eventdata, handles)
3231% hObject    handle to edit_filling_entrer_bunch1 (see GCBO)
3232% eventdata  reserved - to be defined in a future version of MATLAB
3233% handles    structure with handles and user data (see GUIDATA)
3234
3235% Hints: get(hObject,'String') returns contents of edit_filling_entrer_bunch1 as text
3236%        str2double(get(hObject,'String')) returns contents of edit_filling_entrer_bunch1 as a double
3237
3238
3239
3240
3241% --- Executes during object creation, after setting all properties.
3242function edit_filling_entrer_bunch1_CreateFcn(hObject, eventdata, handles)
3243% hObject    handle to edit_filling_entrer_bunch1 (see GCBO)
3244% eventdata  reserved - to be defined in a future version of MATLAB
3245% handles    empty - handles not created until after all CreateFcns called
3246
3247% Hint: edit controls usually have a white background on Windows.
3248%       See ISPC and COMPUTER.
3249if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3250    set(hObject,'BackgroundColor','white');
3251end
3252
3253
3254
3255function edit_Imin_Callback(hObject, eventdata, handles)
3256% hObject    handle to edit_Imin (see GCBO)
3257% eventdata  reserved - to be defined in a future version of MATLAB
3258% handles    structure with handles and user data (see GUIDATA)
3259
3260% Hints: get(hObject,'String') returns contents of edit_Imin as text
3261%        str2double(get(hObject,'String')) returns contents of edit_Imin as a double
3262
3263
3264% --- Executes during object creation, after setting all properties.
3265function edit_Imin_CreateFcn(hObject, eventdata, handles)
3266% hObject    handle to edit_Imin (see GCBO)
3267% eventdata  reserved - to be defined in a future version of MATLAB
3268% handles    empty - handles not created until after all CreateFcns called
3269
3270% Hint: edit controls usually have a white background on Windows.
3271%       See ISPC and COMPUTER.
3272if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3273    set(hObject,'BackgroundColor','white');
3274end
3275
3276
3277% --------------------------------------------------------------------
3278function uipanel_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
3279% hObject    handle to uipanel_spm_mode (see GCBO)
3280% eventdata  reserved - to be defined in a future version of MATLAB
3281% handles    structure with handles and user data (see GUIDATA)
3282
3283%h=get(handles.uipanel_spm_mode);
3284%get(h.Children)
3285
3286mode=get(get(handles.uipanel_spm_mode,'SelectedObject'),'Tag');
3287
3288switch mode  % Get Tag of selected object
3289    case 'spm_mode_1'
3290        display('spm_mode_1')     
3291        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(1));
3292    case 'spm_mode_2'
3293        display('spm_mode_2') 
3294        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(2));
3295    case 'spm_mode_2p'
3296        display('spm_mode_2p')   
3297        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(3));
3298    case 'spm_mode_3'
3299        display('spm_mode_3')   
3300        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'mode',int16(4));   
3301end
3302
3303test_modes(handles);
3304
3305% --------------------------------------------------------------------
3306function uipanel_lpm_spm_mode_SelectionChangeFcn(hObject, eventdata, handles)
3307% hObject    handle to uipanel_lpm_spm_mode (see GCBO)
3308% eventdata  reserved - to be defined in a future version of MATLAB
3309% handles    structure with handles and user data (see GUIDATA)
3310
3311
3312mode=get(get(handles.uipanel_lpm_spm_mode,'SelectedObject'),'Tag');
3313modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3314event0=int32(0);
3315if     strcmp(modeinj,'togglebutton_soft')
3316    event=int32(5);
3317elseif strcmp(modeinj,'togglebutton_3Hz')
3318    event=int32(2);
3319else
3320    %%%
3321end
3322
3323switch mode  % Get Tag of selected object
3324    case 'no_mode'
3325        tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event0);
3326        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event0);
3327       
3328    case 'lpm_mode'
3329        tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event);
3330        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event0);     
3331       
3332%         tango_write_attribute('LT1/AE/CV.2', 'current',  0.058 );
3333%         tango_write_attribute('LT1/AE/CV.3', 'current', -0.119 );
3334
3335    case 'spm_mode'
3336        tango_write_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent',event0);
3337        tango_write_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent',event);   
3338       
3339%         tango_write_attribute('LT1/AE/CV.2', 'current',  0.058 );
3340%         tango_write_attribute('LT1/AE/CV.3', 'current', -0.119 );
3341       
3342end
3343test_modes(handles);
3344
3345
3346
3347
3348       
3349
3350% --------------------------------------------------------------------
3351function uipanel_central_mode_SelectionChangeFcn(hObject, eventdata, handles)
3352% hObject    handle to uipanel_central_mode (see GCBO)
3353% eventdata  reserved - to be defined in a future version of MATLAB
3354% handles    structure with handles and user data (see GUIDATA)
3355
3356mode=get(get(handles.uipanel_central_mode,'SelectedObject'),'Tag');
3357modeinj=get(get(handles.uipanel_mode,'SelectedObject'),'Tag');
3358
3359h='Yes';
3360if strcmp(mode,'continuous_mode')
3361    if strcmp(modeinj,'togglebutton_3Hz')
3362        h = questdlg('Attention, déclenchement continu des équipements sur adresses 1 2 3');
3363    end
3364end
3365
3366if strcmp(h,'Yes')
3367    switch mode  % Get Tag of selected object
3368        case 'burst_mode'
3369            tango_command_inout2('ANS/SY/CENTRAL', 'SetBurstMode');
3370        case 'continuous_mode'
3371            tango_command_inout2('ANS/SY/CENTRAL', 'SetContinuousMode');
3372    end
3373end
3374pause(1)
3375test_modes(handles);
3376
3377% [etat_central]=test_central_mode(handles);
3378% h='Yes';
3379% if strcmp(etat_central,'Continu')
3380%     h = questdlg('Attention, Trigger en mode continu');
3381% end
3382% if strcmp(h,'Yes')
3383%     set(handles.button_injection_soft,'Enable','Off')
3384%     set(handles.edit_modes,'String','Please WAIT !!!!')
3385%     file='golden_rafale_3Hz.mat';
3386%     load_synchro_rafale(file)
3387%     set(handles.button_injection_soft,'Enable','On')
3388%     test_modes(handles);
3389% end
3390
3391
3392function  [etat]=test_central_mode(handles)
3393% Verifie le mode central selectionné  : rafale ou continue
3394temp=tango_read_attribute2('ANS/SY/CENTRAL', 'currentMode');
3395mode=temp.value;
3396h=get(handles.uipanel_central_mode);
3397switch mode  % Get Tag of selected object
3398    case 'BURST'
3399       set(handles.uipanel_central_mode,'SelectedObject',h.Children(2))
3400       etat='Rafale';
3401    case 'CONTINUOUS'
3402       set(handles.uipanel_central_mode,'SelectedObject',h.Children(1))
3403       etat='Continu';
3404end
3405
3406function  [etat]=test_injection_mode(handles)
3407% Verifie le mode d'injection selectionné : soft ou 3Hz
3408%temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'spareEvent');
3409temp=tango_read_attribute2('BOO/SY/LOCAL.Binj.1', 'k.trigEvent');
3410mode=temp.value(1);
3411h=get(handles.uipanel_mode);
3412if     mode==2
3413    set(handles.uipanel_mode,'SelectedObject',h.Children(1))
3414    etat='3Hz';
3415elseif mode==5
3416    set(handles.uipanel_mode,'SelectedObject',h.Children(2))
3417    etat='Soft';
3418else
3419    set(handles.uipanel_mode,'SelectedObject',[])
3420    etat='??';
3421end
3422
3423
3424function  [etat]=test_lpm_spm_mode(handles)
3425% Verifie le mode selectionné en SPM ou LPM
3426temp=tango_read_attribute2('LIN/SY/LOCAL.LPM.1', 'lpmEvent');
3427modelpm=temp.value(1);
3428temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'spmLinacEvent');
3429modespm=temp.value(1);
3430h=get(handles.uipanel_lpm_spm_mode);
3431if     (modelpm==5)&(modespm==0) | (modelpm==2)&(modespm==0)
3432    set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(2))
3433    etat='LPM';
3434elseif (modelpm==0)&(modespm==5) | (modelpm==0)&(modespm==2)
3435    set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(1))
3436    etat='SPM';
3437else
3438    set(handles.uipanel_lpm_spm_mode,'SelectedObject',h.Children(3))
3439    etat='NONE';
3440end
3441
3442function  [etat]=test_spm_mode(handles)
3443% Verifie le mode selectionné en SPM : 1 2 ou 3 paquets
3444temp=tango_read_attribute2('LIN/SY/LOCAL.SPM.1', 'mode');
3445mode=temp.value(1);
3446h=get(handles.uipanel_spm_mode);
3447select=h.Children(5-mode);
3448set(handles.uipanel_spm_mode,'SelectedObject',select)
3449etat=num2str(5-mode);
3450
3451function  [etat]=test_cond_inj(handles)
3452% Verifie si tir autorise  (Grp fonctionnement)
3453try temp=tango_read_attribute2('ANS/FC/INJ_COND', 'COND_INJ'); % 0 no injection,  1 injection
3454    val=temp.value; catch val=1 ; end; if val~=0 ; val=1; end;
3455if (val==1)
3456    etat='TIR AUTORISE';
3457else
3458    etat='TIR NON AUTORISE';
3459end
3460
3461
3462
3463
3464function  test_modes(handles)
3465% Verifie le mode central selectionné  : rafale ou continue
3466[etat_central]=test_central_mode(handles);
3467% Verifie le mode d'injection selectionné : soft ou 3Hz
3468[etat_injection]=test_injection_mode(handles);
3469% Verifie le mode selectionné en SPM ou LPM
3470[etat_linac]=test_lpm_spm_mode(handles);
3471% Verifie le mode selectionné en SPM : 1 2 ou 3 paquets
3472[etat_linac_spm]=test_spm_mode(handles);
3473% Vérifie si injectio autorisee
3474%[etat_inj]=test_cond_inj(handles);
3475
3476
3477% txt=[etat_inj,'    ####     ', ...
3478%      'CENTRAL : ',etat_central,'   #   INJECTION : ',etat_injection,'   #   LINAC : ',etat_linac];
3479txt=['CENTRAL : ',etat_central,'   #   INJECTION : ',etat_injection,'   #   LINAC : ',etat_linac];
3480set(handles.edit_modes,'String',txt)
3481
3482
3483
3484function edit_modes_Callback(hObject, eventdata, handles)
3485% hObject    handle to edit_modes (see GCBO)
3486% eventdata  reserved - to be defined in a future version of MATLAB
3487% handles    structure with handles and user data (see GUIDATA)
3488
3489% Hints: get(hObject,'String') returns contents of edit_modes as text
3490%        str2double(get(hObject,'String')) returns contents of edit_modes as a double
3491
3492
3493% --- Executes during object creation, after setting all properties.
3494function edit_modes_CreateFcn(hObject, eventdata, handles)
3495% hObject    handle to edit_modes (see GCBO)
3496% eventdata  reserved - to be defined in a future version of MATLAB
3497% handles    empty - handles not created until after all CreateFcns called
3498
3499% Hint: edit controls usually have a white background on Windows.
3500%       See ISPC and COMPUTER.
3501if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3502    set(hObject,'BackgroundColor','white');
3503end
3504
3505function ans_k_pc_Callback(hObject, eventdata, handles)
3506% hObject    handle to ans_k_pc (see GCBO)
3507% eventdata  reserved - to be defined in a future version of MATLAB
3508% handles    structure with handles and user data (see GUIDATA)
3509
3510% Hints: get(hObject,'String') returns contents of ans_k_pc as text
3511%        str2double(get(hObject,'String')) returns contents of ans_k_pc as a double
3512
3513
3514% --- Executes during object creation, after setting all properties.
3515function ans_k_pc_CreateFcn(hObject, eventdata, handles)
3516% hObject    handle to ans_k_pc (see GCBO)
3517% eventdata  reserved - to be defined in a future version of MATLAB
3518% handles    empty - handles not created until after all CreateFcns called
3519
3520% Hint: edit controls usually have a white background on Windows.
3521%       See ISPC and COMPUTER.
3522if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3523    set(hObject,'BackgroundColor','white');
3524end
3525
3526
3527
3528function ans_k_h_Callback(hObject, eventdata, handles)
3529% hObject    handle to ans_k_h (see GCBO)
3530% eventdata  reserved - to be defined in a future version of MATLAB
3531% handles    structure with handles and user data (see GUIDATA)
3532
3533% Hints: get(hObject,'String') returns contents of ans_k_h as text
3534%        str2double(get(hObject,'String')) returns contents of ans_k_h as a double
3535
3536
3537% --- Executes during object creation, after setting all properties.
3538function ans_k_h_CreateFcn(hObject, eventdata, handles)
3539% hObject    handle to ans_k_h (see GCBO)
3540% eventdata  reserved - to be defined in a future version of MATLAB
3541% handles    empty - handles not created until after all CreateFcns called
3542
3543% Hint: edit controls usually have a white background on Windows.
3544%       See ISPC and COMPUTER.
3545if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3546    set(hObject,'BackgroundColor','white');
3547end
3548
3549
3550
3551function ans_k_v_Callback(hObject, eventdata, handles)
3552% hObject    handle to ans_k_v (see GCBO)
3553% eventdata  reserved - to be defined in a future version of MATLAB
3554% handles    structure with handles and user data (see GUIDATA)
3555
3556% Hints: get(hObject,'String') returns contents of ans_k_v as text
3557%        str2double(get(hObject,'String')) returns contents of ans_k_v as a double
3558
3559
3560% --- Executes during object creation, after setting all properties.
3561function ans_k_v_CreateFcn(hObject, eventdata, handles)
3562% hObject    handle to ans_k_v (see GCBO)
3563% eventdata  reserved - to be defined in a future version of MATLAB
3564% handles    empty - handles not created until after all CreateFcns called
3565
3566% Hint: edit controls usually have a white background on Windows.
3567%       See ISPC and COMPUTER.
3568if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
3569    set(hObject,'BackgroundColor','white');
3570end
3571
3572
3573% --- Executes on button press in button_kicker.
3574function button_kicker_Callback(hObject, eventdata, handles)
3575% hObject    handle to button_kicker (see GCBO)
3576% eventdata  reserved - to be defined in a future version of MATLAB
3577% handles    structure with handles and user data (see GUIDATA)
3578
3579% Hint: get(hObject,'Value') returns toggle state of button_kicker
3580
3581bpm=get(hObject,'Value');
3582
3583if (bpm==0)
3584   set(handles.uipanel_kicker_machine,'Visible','off');
3585elseif (bpm==1)
3586    set(handles.uipanel_kicker_machine,'Visible','on');
3587end
3588
3589
3590% --- Executes on button press in button_save_golden_soft.
3591function button_save_golden_soft_Callback(hObject, eventdata, handles)
3592% hObject    handle to button_save_golden_soft (see GCBO)
3593% eventdata  reserved - to be defined in a future version of MATLAB
3594% handles    structure with handles and user data (see GUIDATA)
3595h = questdlg('Attention, sauvegarde nouvelle golden !!!');
3596
3597if strcmp(h,'Yes')
3598
3599    DirName=handles.DirName;
3600    [timing]=get_synchro_rafale(DirName);
3601    % sauvegarde
3602    file='golden_rafale_soft.mat';
3603    %Directory =  [getfamilydata('Directory','DataRoot') 'Datatemp'];
3604    Directory=handles.Directory;
3605    pwdold = pwd;
3606    cd(Directory);
3607    save(file, 'timing');
3608    cd(pwdold);
3609
3610end
3611
3612
3613% --- Executes on button press in button_load_golden_soft.
3614function button_load_golden_soft_Callback(hObject, eventdata, handles)
3615% hObject    handle to button_load_golden_soft (see GCBO)
3616% eventdata  reserved - to be defined in a future version of MATLAB
3617% handles    structure with handles and user data (see GUIDATA)
3618
3619set(handles.button_injection_soft,'Enable','Off')
3620set(handles.edit_modes,'String','Please WAIT !!!!')
3621Directory=handles.Directory;
3622DirName=handles.DirName;
3623file='golden_rafale_soft.mat';
3624load_synchro_rafale(Directory,file,DirName)
3625set(handles.button_injection_soft,'Enable','On')
3626test_modes(handles);
3627
3628
3629% --- Executes on button press in button_load_golden_3Hz.
3630function button_load_golden_3Hz_Callback(hObject, eventdata, handles)
3631% hObject    handle to button_load_golden_3Hz (see GCBO)
3632% eventdata  reserved - to be defined in a future version of MATLAB
3633% handles    structure with handles and user data (see GUIDATA)
3634
3635[etat_central]=test_central_mode(handles);
3636h='Yes';
3637if strcmp(etat_central,'Continu')
3638    h = questdlg('Attention, Trigger en mode continu');
3639end
3640if strcmp(h,'Yes')
3641    set(handles.button_injection_soft,'Enable','Off')
3642    set(handles.edit_modes,'String','Please WAIT !!!!')
3643    Directory=handles.Directory;
3644    DirName=handles.DirName;
3645    file='golden_rafale_3Hz.mat';
3646    load_synchro_rafale(Directory,file,DirName)
3647    set(handles.button_injection_soft,'Enable','On')
3648    test_modes(handles);
3649end
3650
3651% --- Executes on button press in button_save_golden_3Hz.
3652function button_save_golden_3Hz_Callback(hObject, eventdata, handles)
3653% hObject    handle to button_save_golden_3Hz (see GCBO)
3654% eventdata  reserved - to be defined in a future version of MATLAB
3655% handles    structure with handles and user data (see GUIDATA)
3656h = questdlg('Attention, sauvegarde nouvelle golden !!!');
3657
3658if strcmp(h,'Yes')
3659   
3660    DirName=handles.DirName;
3661    [timing]=get_synchro_rafale(DirName);
3662    % sauvegarde
3663    file='golden_rafale_3Hz.mat';
3664    %Directory =  [getfamilydata('Directory','DataRoot') 'Datatemp'];
3665    Directory=handles.Directory;
3666    pwdold = pwd;
3667    cd(Directory);
3668    save(file, 'timing');
3669    cd(pwdold);
3670
3671end
3672
3673% --- Executes on button press in button_load_golden_3Hz_66MeV.
3674function button_load_golden_3Hz_66MeV_Callback(hObject, eventdata, handles)
3675% hObject    handle to button_load_golden_3Hz_66MeV (see GCBO)
3676% eventdata  reserved - to be defined in a future version of MATLAB
3677% handles    structure with handles and user data (see GUIDATA)
3678[etat_central]=test_central_mode(handles);
3679h='Yes';
3680if strcmp(etat_central,'Continu')
3681    h = questdlg('Attention, Trigger en mode continu');
3682end
3683if strcmp(h,'Yes')
3684    set(handles.button_injection_soft,'Enable','Off')
3685    set(handles.edit_modes,'String','Please WAIT !!!!')
3686    Directory=handles.Directory;
3687    DirName=handles.DirName;
3688    file='golden_rafale_3Hz_66MeV.mat';
3689    load_synchro_rafale(Directory,file,DirName)
3690    set(handles.button_injection_soft,'Enable','On')
3691    test_modes(handles);
3692end
3693
3694
3695% --- Executes on button press in button_save_golden_66MeV.
3696function button_save_golden_66MeV_Callback(hObject, eventdata, handles)
3697% hObject    handle to button_save_golden_66MeV (see GCBO)
3698% eventdata  reserved - to be defined in a future version of MATLAB
3699% handles    structure with handles and user data (see GUIDATA)
3700h = questdlg('Attention, sauvegarde nouvelle golden 66 MeV!!!');
3701
3702if strcmp(h,'Yes')
3703
3704    DirName=handles.DirName;
3705    [timing]=get_synchro_rafale(DirName);
3706    % sauvegarde
3707    file='golden_rafale_3Hz_66MeV.mat';
3708    %Directory =  [getfamilydata('Directory','DataRoot') 'Datatemp'];
3709    Directory=handles.Directory;
3710    pwdold = pwd;
3711    cd(Directory);
3712    save(file, 'timing');
3713    cd(pwdold);
3714
3715end
3716
Note: See TracBrowser for help on using the repository browser.